summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/ui/accountselector.h
blob: 2ad22a5379e9c5b5f24eeb1195324145324bf350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
    accountselector.cpp - An Accountselector

    Copyright (c) 2004      by Stefan Gehn <metz AT gehn.net>

    Kopete    (c) 2002-2004 by the Kopete developers  <kopete-devel@kde.org>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#ifndef ACCOUNTSELECTOR_H
#define ACCOUNTSELECTOR_H

#include <tqwidget.h>
#include <kopeteprotocol.h>
#include "kopete_export.h"

class AccountSelectorPrivate;
class TQListViewItem;
/**
 * \brief widget to select an account, based on KListView
 * @author Stefan Gehn <metz AT gehn.net>
 */
class KOPETE_EXPORT AccountSelector : public TQWidget
{
Q_OBJECT
  TQ_OBJECT

	public:
		/**
		 * Constructor.
		 *
		 * The parameters @p parent and @p name are handled by
		 * KListView.
		 */
		AccountSelector(TQWidget *parent=0, const char *name=0);

		/**
		 * Constructor for a list of accounts for one protocol only
		 *
		 * The parameters @p parent and @p name are handled by
		 * KListView. @p proto defines the protocol whose accounts are
		 * shown in the list
		 */
		AccountSelector(Kopete::Protocol *proto, TQWidget *parent=0, const char *name=0);

		/**
		 * Destructor.
		 */
		~AccountSelector();

		/**
		 * Select @p account in the list, in case it's part of the list
		 */
		void setSelected(Kopete::Account *account);

		/**
		 * Returns true in case @p account is in the list and
		 * the currently selected item, false otherwise
		 */
		bool isSelected(Kopete::Account *account);

		/**
		 * @return the currently selected account.
		 */
		Kopete::Account *selectedItem();

	signals:
		/**
		 * Emitted whenever the selection changed, @p acc is a pointer to the
		 * newly selected account
		 */
		void selectionChanged(Kopete::Account *acc);

	private slots:
		void slotSelectionChanged(TQListViewItem *item);

	private:
		void initUI();

	private:
		AccountSelectorPrivate *d;
};

#endif
// vim: set noet ts=4 sts=4 sw=4: