1 | /*
|
---|
2 | * accountdlg.h - dialogs for manipulating PsiAccounts
|
---|
3 | * Copyright (C) 2001, 2002 Justin Karneges
|
---|
4 | *
|
---|
5 | * This program is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * as published by the Free Software Foundation; either version 2
|
---|
8 | * of the License, or (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program 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 this library; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
18 | *
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef ACCOUNTDLG_H
|
---|
22 | #define ACCOUNTDLG_H
|
---|
23 |
|
---|
24 | #include<qca.h>
|
---|
25 | #include"ui_accountmanage.h"
|
---|
26 | #include"ui_accountadd.h"
|
---|
27 | #include"ui_accountreg.h"
|
---|
28 | #include"ui_accountremove.h"
|
---|
29 | #include"ui_accountmodify.h"
|
---|
30 | #include"ui_pgpkey.h"
|
---|
31 | #include"xmpp.h"
|
---|
32 | #include"openpgp.h"
|
---|
33 |
|
---|
34 | namespace XMPP
|
---|
35 | {
|
---|
36 | class Jid;
|
---|
37 | class Client;
|
---|
38 | }
|
---|
39 |
|
---|
40 | using namespace XMPP;
|
---|
41 |
|
---|
42 | class PsiCon;
|
---|
43 | class PsiAccount;
|
---|
44 | class QListViewItem;
|
---|
45 | class UserAccount;
|
---|
46 | class ProxyManager;
|
---|
47 | class ProxyChooser;
|
---|
48 |
|
---|
49 | namespace QCA
|
---|
50 | {
|
---|
51 | class Cert;
|
---|
52 | }
|
---|
53 |
|
---|
54 | class MiniClient : public QObject
|
---|
55 | {
|
---|
56 | Q_OBJECT
|
---|
57 | public:
|
---|
58 | MiniClient(QObject *parent=0);
|
---|
59 | ~MiniClient();
|
---|
60 |
|
---|
61 | void reset();
|
---|
62 | void connectToServer(const Jid &j, bool ssl, const QString &host, int port, ProxyManager *pm, int proxy, QString *pass);
|
---|
63 | void close();
|
---|
64 | Client *client();
|
---|
65 |
|
---|
66 | signals:
|
---|
67 | void handshaken();
|
---|
68 | void error();
|
---|
69 |
|
---|
70 | private slots:
|
---|
71 | void tls_handshaken();
|
---|
72 | void cs_connected();
|
---|
73 | void cs_securityLayerActivated(int);
|
---|
74 | void cs_needAuthParams(bool, bool, bool);
|
---|
75 | void cs_authenticated();
|
---|
76 | void cs_connectionClosed();
|
---|
77 | void cs_delayedCloseFinished();
|
---|
78 | void cs_warning(int);
|
---|
79 | void cs_error(int);
|
---|
80 |
|
---|
81 | private:
|
---|
82 | AdvancedConnector *conn;
|
---|
83 | ClientStream *stream;
|
---|
84 | QCA::TLS *tls;
|
---|
85 | QCATLSHandler *tlsHandler;
|
---|
86 | QPtrList<QCA::Cert> certList;
|
---|
87 | Client *_client;
|
---|
88 | Jid j;
|
---|
89 | QString pass;
|
---|
90 | };
|
---|
91 |
|
---|
92 | class AccountManageDlg : public AccountManageUI
|
---|
93 | {
|
---|
94 | Q_OBJECT
|
---|
95 | public:
|
---|
96 | AccountManageDlg(PsiCon *, const char *name=0);
|
---|
97 | ~AccountManageDlg();
|
---|
98 |
|
---|
99 | private slots:
|
---|
100 | void qlv_selectionChanged(QListViewItem *);
|
---|
101 | void add();
|
---|
102 | void modify();
|
---|
103 | void modify(QListViewItem *);
|
---|
104 | void remove();
|
---|
105 | void accountAdded(PsiAccount *);
|
---|
106 | void accountUpdated(PsiAccount *);
|
---|
107 | void accountRemoved(PsiAccount *);
|
---|
108 |
|
---|
109 | private:
|
---|
110 | PsiCon *psi;
|
---|
111 | };
|
---|
112 |
|
---|
113 | class AccountAddDlg : public AccountAddUI
|
---|
114 | {
|
---|
115 | Q_OBJECT
|
---|
116 | public:
|
---|
117 | AccountAddDlg(PsiCon *, QWidget *parent=0, const char *name=0);
|
---|
118 | ~AccountAddDlg();
|
---|
119 |
|
---|
120 | private slots:
|
---|
121 | void add();
|
---|
122 | void setAddButton(const QString &);
|
---|
123 |
|
---|
124 | private:
|
---|
125 | PsiCon *psi;
|
---|
126 | };
|
---|
127 |
|
---|
128 | class AccountModifyDlg : public AccountModifyUI
|
---|
129 | {
|
---|
130 | Q_OBJECT
|
---|
131 | public:
|
---|
132 | AccountModifyDlg(PsiAccount *, QWidget *parent=0, const char *name=0);
|
---|
133 | ~AccountModifyDlg();
|
---|
134 |
|
---|
135 | void setPassword(const QString &);
|
---|
136 |
|
---|
137 | private slots:
|
---|
138 | void sslToggled(bool);
|
---|
139 | void hostToggled(bool);
|
---|
140 |
|
---|
141 | void detailsVCard();
|
---|
142 | void detailsChangePW();
|
---|
143 |
|
---|
144 | void save();
|
---|
145 |
|
---|
146 | void pgpToggled(bool);
|
---|
147 | void chooseKey();
|
---|
148 | void clearKey();
|
---|
149 |
|
---|
150 | private:
|
---|
151 | PsiAccount *pa;
|
---|
152 | ProxyChooser *pc;
|
---|
153 | QString keyID;
|
---|
154 |
|
---|
155 | void updateUserID();
|
---|
156 | void setKeyID(bool b, const QString &s="");
|
---|
157 | };
|
---|
158 |
|
---|
159 | class AccountRegDlg : public AccountRegUI
|
---|
160 | {
|
---|
161 | Q_OBJECT
|
---|
162 | public:
|
---|
163 | AccountRegDlg(ProxyManager *, QWidget *parent=0, const char *name=0);
|
---|
164 | ~AccountRegDlg();
|
---|
165 |
|
---|
166 | Jid jid;
|
---|
167 | QString sp_host, pass;
|
---|
168 | int sp_port;
|
---|
169 | bool ssl, opt_host;
|
---|
170 | int proxy;
|
---|
171 |
|
---|
172 | protected:
|
---|
173 | // reimplemented
|
---|
174 | //void closeEvent(QCloseEvent *);
|
---|
175 |
|
---|
176 | public slots:
|
---|
177 | void done(int);
|
---|
178 |
|
---|
179 | private slots:
|
---|
180 | void sslToggled(bool);
|
---|
181 | void hostToggled(bool);
|
---|
182 | void reg();
|
---|
183 |
|
---|
184 | void client_handshaken();
|
---|
185 | void client_error();
|
---|
186 |
|
---|
187 | void reg_finished();
|
---|
188 |
|
---|
189 | void block();
|
---|
190 | void unblock();
|
---|
191 |
|
---|
192 | private:
|
---|
193 | ProxyManager *proxyman;
|
---|
194 | ProxyChooser *pc;
|
---|
195 | MiniClient *client;
|
---|
196 | };
|
---|
197 |
|
---|
198 | class AccountRemoveDlg : public AccountRemoveUI
|
---|
199 | {
|
---|
200 | Q_OBJECT
|
---|
201 | public:
|
---|
202 | AccountRemoveDlg(ProxyManager *, const UserAccount &, QWidget *parent=0, const char *name=0);
|
---|
203 | ~AccountRemoveDlg();
|
---|
204 |
|
---|
205 | protected:
|
---|
206 | // reimplemented
|
---|
207 | //void closeEvent(QCloseEvent *);
|
---|
208 |
|
---|
209 | public slots:
|
---|
210 | void done(int);
|
---|
211 |
|
---|
212 | private slots:
|
---|
213 | void remove();
|
---|
214 | void bg_clicked(int);
|
---|
215 |
|
---|
216 | void client_handshaken();
|
---|
217 | void client_error();
|
---|
218 | void unreg_finished();
|
---|
219 |
|
---|
220 | private:
|
---|
221 | class Private;
|
---|
222 | Private *d;
|
---|
223 |
|
---|
224 | MiniClient *client;
|
---|
225 | };
|
---|
226 |
|
---|
227 | #endif
|
---|