kpassdlg.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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);
00054 KPasswordEdit(EchoMode echoMode, QWidget *parent, const char *name);
00059 KPasswordEdit(QWidget *parent, const char *name, int echoMode);
00063 ~KPasswordEdit();
00064
00069 const char *password() const { return m_Password; }
00070
00074 void erase();
00075
00076 static const int PassLen;
00077
00078 public slots:
00082 virtual void insert( const QString &);
00083
00084 protected:
00085 virtual void keyPressEvent(QKeyEvent *);
00086 virtual void focusInEvent(QFocusEvent *e);
00087 virtual bool event(QEvent *e);
00088
00089 private:
00090 void init();
00091 void showPass();
00092
00093 char *m_Password;
00094 int m_EchoMode, m_Length;
00095 };
00096
00097
00133 class KPasswordDialog
00134 : public KDialogBase
00135 {
00136 Q_OBJECT
00137
00138 public:
00142 enum Types {
00146 Password,
00152 NewPassword
00153 };
00154
00167 KPasswordDialog(Types type, bool enableKeep, int extraBttn,
00168 QWidget *parent=0, const char *name=0);
00173 KPasswordDialog(int type, QString prompt, bool enableKeep=false,
00174 int extraBttn=0);
00178 virtual ~KPasswordDialog();
00179
00183 void setPrompt(QString prompt);
00187 QString prompt() const;
00188
00192 void addLine(QString key, QString value);
00197 const char *password() const { return m_pEdit->password(); }
00198
00202 bool keep() const { return m_Keep; }
00203
00216 static int getPassword(QCString &password, QString prompt, int *keep=0L);
00217
00228 static int getNewPassword(QCString &password, QString prompt);
00229
00233 static void disableCoreDumps();
00234
00235 protected slots:
00236 void slotOk();
00237 void slotCancel();
00238 void slotKeep(bool);
00239
00240 protected:
00241
00247 virtual bool checkPassword(const char *) { return true; }
00248
00249 private:
00250 void init();
00251 void erase();
00252
00253 int m_Keep, m_Type, m_Row;
00254 QLabel *m_pHelpLbl;
00255 QGridLayout *m_pGrid;
00256 QWidget *m_pMain;
00257 KPasswordEdit *m_pEdit, *m_pEdit2;
00258
00259 protected:
00260 virtual void virtual_hook( int id, void* data );
00261 private:
00262 class KPasswordDialogPrivate;
00263 KPasswordDialogPrivate *d;
00264 };
00265
00266
00267 #endif // __KPassDlg_h_included__
This file is part of the documentation for kdelibs Version 3.1.4.