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 protected:
00079 virtual void keyPressEvent(QKeyEvent *);
00080 virtual void focusInEvent(QFocusEvent *e);
00081 virtual bool event(QEvent *e);
00082
00083 private:
00084 void init();
00085 void showPass();
00086
00087 char *m_Password;
00088 int m_EchoMode, m_Length;
00089 };
00090
00091
00127 class KPasswordDialog
00128 : public KDialogBase
00129 {
00130 Q_OBJECT
00131
00132 public:
00136 enum Types {
00140 Password,
00146 NewPassword
00147 };
00148
00161 KPasswordDialog(Types type, bool enableKeep, int extraBttn,
00162 QWidget *parent=0, const char *name=0);
00167 KPasswordDialog(int type, QString prompt, bool enableKeep=false,
00168 int extraBttn=0);
00172 virtual ~KPasswordDialog();
00173
00177 void setPrompt(QString prompt);
00181 QString prompt() const;
00182
00186 void addLine(QString key, QString value);
00191 const char *password() const { return m_pEdit->password(); }
00192
00196 bool keep() const { return m_Keep; }
00197
00210 static int getPassword(QCString &password, QString prompt, int *keep=0L);
00211
00222 static int getNewPassword(QCString &password, QString prompt);
00223
00227 static void disableCoreDumps();
00228
00229 protected slots:
00230 void slotOk();
00231 void slotCancel();
00232 void slotKeep(bool);
00233
00234 protected:
00235
00241 virtual bool checkPassword(const char *) { return true; }
00242
00243 private:
00244 void init();
00245 void erase();
00246
00247 int m_Keep, m_Type, m_Row;
00248 QLabel *m_pHelpLbl;
00249 QGridLayout *m_pGrid;
00250 QWidget *m_pMain;
00251 KPasswordEdit *m_pEdit, *m_pEdit2;
00252
00253 protected:
00254 virtual void virtual_hook( int id, void* data );
00255 private:
00256 class KPasswordDialogPrivate;
00257 KPasswordDialogPrivate *d;
00258 };
00259
00260
00261 #endif // __KPassDlg_h_included__
This file is part of the documentation for kdelibs Version 3.1.0.