1 /*
2  * This file is part of Licq, an instant messaging client for UNIX.
3  * Copyright (C) 2004-2012 Licq developers <licq-dev@googlegroups.com>
4  *
5  * Licq is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * Licq is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with Licq; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef OWNERMANAGERDLG_H
21 #define OWNERMANAGERDLG_H
22 
23 #include <QDialog>
24 
25 class QPushButton;
26 class QTreeWidget;
27 class QTreeWidgetItem;
28 
29 namespace Licq
30 {
31 class UserId;
32 }
33 
34 namespace LicqQtGui
35 {
36 
37 /**
38  * Dialog for managing accounts
39  */
40 class OwnerManagerDlg : public QDialog
41 {
42    Q_OBJECT
43 
44 public:
45   /**
46    * Create and show owner manager dialog or raise it if already exists
47    */
48   static void showOwnerManagerDlg();
49 
50 private slots:
51   /**
52    * Selection has changed
53    */
54   void listSelectionChanged();
55 
56   /**
57    * Add an existing account
58    *
59    * @param protocolId Id of protocol to add owner for
60    */
61   void addOwner(unsigned long protocolId);
62 
63   /**
64    * Register a new account
65    *
66    * @param protocolId Id of protocol to register owner with
67    */
68   void registerOwner(unsigned long protocolId);
69 
70   /**
71    * Edit currently selected account
72    */
73   void modify();
74 
75   /**
76    * An item was double clicked
77    *
78    * @param item Protocol or account item from list
79    * @param column List column, not used
80    */
81   void itemDoubleClicked(QTreeWidgetItem* item, int column = 0);
82 
83   /**
84    * Remove currently select account or plugin
85    */
86   void remove();
87 
88   /**
89    * Refresh list of protocols and accounts
90    */
91   void updateList();
92 
93   /**
94    * A protocol has been loaded
95    *
96    * @param protocolId Id of loaded protocol
97    */
98   void protocolLoaded(unsigned long protocolId);
99 
100   /**
101    * Add button was pressed
102    */
103   void addPressed();
104 
105   /**
106    * Register button was pressed
107    */
108   void registerPressed();
109 
110 private:
111   static OwnerManagerDlg* myInstance;
112 
113   /**
114    * Constructor
115    * Private so it can only be access through the singleton interface
116    *
117    * @parent Parent window
118    */
119   OwnerManagerDlg(QWidget* parent = NULL);
120 
121   /**
122    * Destructor
123    */
124   virtual ~OwnerManagerDlg();
125 
126   QTreeWidget* myOwnerView;
127   QPushButton* myAddButton;
128   QPushButton* myRegisterButton;
129   QPushButton* myModifyButton;
130   QPushButton* myRemoveButton;
131 
132   bool myPendingAdd;
133   bool myPendingRegister;
134 };
135 
136 } // namespace LicqQtGui
137 
138 #endif // OWNERMANAGERDLG_H
139