kdeui Library API Documentation

kpassdlg.h

00001 // vi: ts=8 sts=4 sw=4 00002 /* This file is part of the KDE libraries 00003 Copyright (C) 1998 Pietro Iglio <iglio@fub.it> 00004 Copyright (C) 1999,2000 Geert Jansen <jansen@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 License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 #ifndef __KPassDlg_h_included__ 00021 #define __KPassDlg_h_included__ 00022 00023 #include <qstring.h> 00024 #include <qlineedit.h> 00025 #include <kdialogbase.h> 00026 00027 class QLabel; 00028 class QGridLayout; 00029 class QWidget; 00030 00038 class KPasswordEdit 00039 : public QLineEdit 00040 { 00041 Q_OBJECT 00042 00043 public: 00044 enum EchoModes { OneStar, ThreeStars, NoEcho }; 00045 00049 KPasswordEdit(QWidget *parent=0, const char *name=0); 00050 // KDE4: either of the two must go! add default values for parameters 00056 KPasswordEdit(EchoMode echoMode, QWidget *parent, const char *name); 00062 KPasswordEdit(EchoModes echoMode, QWidget *parent, const char *name); 00067 KPasswordEdit(QWidget *parent, const char *name, int echoMode) KDE_DEPRECATED; 00071 ~KPasswordEdit(); 00072 00077 const char *password() const { return m_Password; } 00078 00082 void erase(); 00083 00084 static const int PassLen; 00085 00086 public slots: 00090 virtual void insert( const QString &); 00091 00092 protected: 00093 virtual void keyPressEvent(QKeyEvent *); 00094 virtual void focusInEvent(QFocusEvent *e); 00095 virtual bool event(QEvent *e); 00096 00097 private: 00098 void init(); 00099 void showPass(); 00100 00101 char *m_Password; 00102 int m_EchoMode, m_Length; 00103 }; 00104 00105 00141 class KPasswordDialog 00142 : public KDialogBase 00143 { 00144 Q_OBJECT 00145 00146 public: 00150 enum Types { 00154 Password, 00160 NewPassword 00161 }; 00162 00177 KPasswordDialog(Types type, bool enableKeep, int extraBttn, 00178 QWidget *parent=0, const char *name=0); 00183 // note that this implicitly deprecates the 'prompt' variants of 00184 // getPassword() below. i guess the above constructor needs to be extended. 00185 KPasswordDialog(int type, QString prompt, bool enableKeep=false, 00186 int extraBttn=0) KDE_DEPRECATED; 00190 virtual ~KPasswordDialog(); 00191 00195 void setPrompt(QString prompt); 00199 QString prompt() const; 00200 00204 void addLine(QString key, QString value); 00209 const char *password() const { return m_pEdit->password(); } 00210 00214 bool keep() const { return m_Keep; } 00215 00228 static int getPassword(QCString &password, QString prompt, int *keep=0L); 00229 00240 static int getNewPassword(QCString &password, QString prompt); 00241 00245 static void disableCoreDumps(); 00246 00247 protected slots: 00248 void slotOk(); 00249 void slotCancel(); 00250 void slotKeep(bool); 00251 00252 protected: 00253 00259 virtual bool checkPassword(const char *) { return true; } 00260 00261 private slots: 00262 void enableOkBtn(); 00263 00264 private: 00265 void init(); 00266 void erase(); 00267 00268 int m_Keep, m_Type, m_Row; 00269 QLabel *m_pHelpLbl; 00270 QGridLayout *m_pGrid; 00271 QWidget *m_pMain; 00272 KPasswordEdit *m_pEdit, *m_pEdit2; 00273 00274 protected: 00275 virtual void virtual_hook( int id, void* data ); 00276 private: 00277 class KPasswordDialogPrivate; 00278 KPasswordDialogPrivate *d; 00279 }; 00280 00281 00282 #endif // __KPassDlg_h_included__
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:53:58 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003