libqutim  0.3.1.0
passworddialog.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** qutIM - instant messenger
4 **
5 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6 **
7 *****************************************************************************
8 **
9 ** $QUTIM_BEGIN_LICENSE$
10 ** This program is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation, either version 3 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ** See the GNU General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see http://www.gnu.org/licenses/.
22 ** $QUTIM_END_LICENSE$
23 **
24 ****************************************************************************/
25 
26 #ifndef PASSWORDDIALOG_H
27 #define PASSWORDDIALOG_H
28 
29 #include "libqutim_global.h"
30 #include <QValidator>
31 
32 namespace qutim_sdk_0_3
33 {
34 class Account;
35 class PasswordDialogPrivate;
36 
37 class LIBQUTIM_EXPORT PasswordDialog : public QObject
38 {
39  Q_OBJECT
40  Q_DECLARE_PRIVATE(PasswordDialog)
41 public:
42  enum DialogCode { Rejected, Accepted };
43 
44  static PasswordDialog *request(Account *account);
45  static PasswordDialog *request(const QString &windowTitle, const QString &description);
46 
47  explicit PasswordDialog();
48  virtual ~PasswordDialog();
49 
50  virtual void setValidator(QValidator *validator) = 0;
51 
52  QString login() const;
53  QString password() const;
54  bool remember() const;
55  int exec();
56  int result() const;
57  void setSaveButtonVisible(bool allow);
58  void setLoginEditVisible(bool allow);
59 
60 signals:
61 #if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER)
62 private: // don't tell moc, doxygen or kdevelop, but those signals are in fact private
63 #endif
64  void rejected();
65  void entered(const QString &password, bool remember);
66  void finished(int result);
67 
68 protected:
69  void apply(const QString &login, const QString &password, bool remember);
70  void apply(const QString &password, bool remember);
71  void reject();
72 
74  SetTextHook = 1,
76  SetShowLoginHook
77  };
78 
80  {
81  QString title;
82  QString description;
83  };
84 
85  virtual void setAccount(Account *account) = 0;
86  virtual void virtual_hook(int id, void *data);
87 
88  QScopedPointer<PasswordDialogPrivate> d_ptr;
89 };
90 }
91 
92 #endif // PASSWORDDIALOG_H
93 

Generated by Doxygen