KDEUI
kpassworddialog.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 David Faure <faure@kde.org> 00003 Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org> 00004 Copyright (C) 2007 Olivier Goffart <ogoffart at kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; see the file COPYING.LIB. If 00017 not, write to the Free Software Foundation, Inc., 51 Franklin Street, 00018 Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KPASSWORDDIALOG_H 00022 #define KPASSWORDDIALOG_H 00023 00024 #include <kdialog.h> 00025 #include <QtCore/QFlags> 00026 00056 class KDEUI_EXPORT KPasswordDialog : public KDialog 00057 { 00058 Q_OBJECT 00059 00060 public: 00061 00062 enum KPasswordDialogFlag 00063 { 00064 NoFlags = 0x00, 00069 ShowKeepPassword = 0x01, 00074 ShowUsernameLine = 0x02, 00078 UsernameReadOnly = 0x04, 00083 ShowAnonymousLoginCheckBox = 0x08, 00088 ShowDomainLine = 0x10, 00093 DomainReadOnly = 0x20 00094 }; 00095 Q_DECLARE_FLAGS(KPasswordDialogFlags, KPasswordDialogFlag) 00096 00097 enum ErrorType 00098 { 00099 UnknownError = 0, 00100 00104 UsernameError, 00105 00109 PasswordError, 00110 00114 FatalError, 00115 00120 DomainError 00121 }; 00122 00132 explicit KPasswordDialog( QWidget *parent = 0L, 00133 const KPasswordDialogFlags& flags = 0, 00134 const KDialog::ButtonCodes otherButtons = 0); 00135 00139 ~KPasswordDialog(); 00140 00145 void setPrompt( const QString& prompt ); 00146 00150 QString prompt() const; 00151 00155 void setPixmap(const QPixmap&); 00159 QPixmap pixmap() const; 00160 00171 void addCommentLine( const QString& label, const QString& comment ); 00172 00178 void showErrorMessage( const QString& message, const ErrorType type = PasswordError ); 00179 00184 QString password() const; 00185 00189 void setUsername(const QString&); 00190 00195 QString username() const; 00196 00201 void setDomain(const QString&); 00202 00208 QString domain() const; 00209 00214 void setAnonymousMode(bool anonymous); 00215 00220 bool anonymousMode() const; 00221 00231 bool keepPassword() const; 00232 00241 void setKeepPassword( bool b ); 00242 00251 void setUsernameReadOnly( bool readOnly ); 00252 00257 void setPassword( const QString& password ); 00258 00266 void setKnownLogins( const QMap<QString, QString>& knownLogins ); 00267 00271 void accept(); 00272 00273 Q_SIGNALS: 00279 void gotPassword( const QString& password , bool keep ); 00280 00287 void gotUsernameAndPassword( const QString& username, const QString& password , bool keep ); 00288 00289 protected: 00295 virtual bool checkPassword(); 00296 00297 00298 private: 00299 Q_PRIVATE_SLOT(d, void actuallyAccept()) 00300 Q_PRIVATE_SLOT(d, void activated( const QString& userName )) 00301 Q_PRIVATE_SLOT(d, void updateFields()) 00302 00303 private: 00304 class KPasswordDialogPrivate; 00305 friend class KPasswordDialogPrivate; 00306 KPasswordDialogPrivate* const d; 00307 00308 Q_DISABLE_COPY(KPasswordDialog) 00309 }; 00310 00311 Q_DECLARE_OPERATORS_FOR_FLAGS(KPasswordDialog::KPasswordDialogFlags) 00312 00313 #endif
KDE 4.6 API Reference