libqutim
0.3.2.0
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru> 00006 ** 00007 ***************************************************************************** 00008 ** 00009 ** $QUTIM_BEGIN_LICENSE$ 00010 ** This program is free software: you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation, either version 3 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 ** See the GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see http://www.gnu.org/licenses/. 00022 ** $QUTIM_END_LICENSE$ 00023 ** 00024 ****************************************************************************/ 00025 00026 #ifndef PASSWORDDIALOG_H 00027 #define PASSWORDDIALOG_H 00028 00029 #include "libqutim_global.h" 00030 #include <QValidator> 00031 00032 namespace qutim_sdk_0_3 00033 { 00034 class Account; 00035 class PasswordDialogPrivate; 00036 00037 class LIBQUTIM_EXPORT PasswordDialog : public QObject 00038 { 00039 Q_OBJECT 00040 Q_DECLARE_PRIVATE(PasswordDialog) 00041 public: 00042 enum DialogCode { Rejected, Accepted }; 00043 00044 static PasswordDialog *request(Account *account); 00045 static PasswordDialog *request(const QString &windowTitle, const QString &description); 00046 00047 explicit PasswordDialog(); 00048 virtual ~PasswordDialog(); 00049 00050 virtual void setValidator(QValidator *validator) = 0; 00051 00052 QString login() const; 00053 QString password() const; 00054 bool remember() const; 00055 int exec(); 00056 int result() const; 00057 void setSaveButtonVisible(bool allow); 00058 void setLoginEditVisible(bool allow); 00059 00060 signals: 00061 #if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER) 00062 private: // don't tell moc, doxygen or kdevelop, but those signals are in fact private 00063 #endif 00064 void rejected(); 00065 void entered(const QString &password, bool remember); 00066 void finished(int result); 00067 00068 protected: 00069 void apply(const QString &login, const QString &password, bool remember); 00070 void apply(const QString &password, bool remember); 00071 void reject(); 00072 00073 enum PasswordDialogHook { 00074 SetTextHook = 1, 00075 SetShowSaveHook, 00076 SetShowLoginHook 00077 }; 00078 00079 struct SetTextArgument 00080 { 00081 QString title; 00082 QString description; 00083 }; 00084 00085 virtual void setAccount(Account *account) = 0; 00086 virtual void virtual_hook(int id, void *data); 00087 00088 QScopedPointer<PasswordDialogPrivate> d_ptr; 00089 }; 00090 } 00091 00092 #endif // PASSWORDDIALOG_H 00093