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);
00050
00051
00057 KPasswordEdit(EchoMode echoMode, QWidget *parent, const char *name);
00058
00064 KPasswordEdit(EchoModes echoMode, QWidget *parent, const char *name);
00065
00070 KPasswordEdit(QWidget *parent, const char *name, int echoMode) KDE_DEPRECATED;
00071
00075 ~KPasswordEdit();
00076
00081 const char *password() const { return m_Password; }
00082
00086 void erase();
00087
00088 static const int PassLen;
00089
00090 public slots:
00094 virtual void insert( const QString &);
00095
00096 protected:
00097 virtual void keyPressEvent(QKeyEvent *);
00098 virtual void focusInEvent(QFocusEvent *e);
00099 virtual bool event(QEvent *e);
00100
00101 private:
00102 void init();
00103 void showPass();
00104
00105 char *m_Password;
00106 int m_EchoMode, m_Length;
00107 };
00108
00109
00145 class KPasswordDialog
00146 : public KDialogBase
00147 {
00148 Q_OBJECT
00149
00150 public:
00154 enum Types {
00158 Password,
00159
00165 NewPassword
00166 };
00167
00182 KPasswordDialog(Types type, bool enableKeep, int extraBttn,
00183 QWidget *parent=0, const char *name=0);
00184
00189 KPasswordDialog(int type, QString prompt, bool enableKeep=false,
00190 int extraBttn=0) KDE_DEPRECATED;
00191
00192
00193
00204 KPasswordDialog(Types type, bool enableKeep, int extraBttn, const QString& iconName,
00205 QWidget *parent = 0, const char *name = 0);
00206
00210 virtual ~KPasswordDialog();
00211
00215 void setPrompt(QString prompt);
00216
00220 QString prompt() const;
00221
00225 void addLine(QString key, QString value);
00226
00231 const char *password() const { return m_pEdit->password(); }
00232
00238 void clearPassword();
00239
00243 bool keep() const { return m_Keep; }
00244
00257 static int getPassword(QCString &password, QString prompt, int *keep=0L);
00258
00269 static int getNewPassword(QCString &password, QString prompt);
00270
00274 static void disableCoreDumps();
00275
00276 protected slots:
00277 void slotOk();
00278 void slotCancel();
00279 void slotKeep(bool);
00280
00281 protected:
00282
00288 virtual bool checkPassword(const char *) { return true; }
00289
00290 private slots:
00291 void enableOkBtn();
00292
00293 private:
00294 void init();
00295 void erase();
00296
00297 int m_Keep, m_Type, m_Row;
00298 QLabel *m_pHelpLbl;
00299 QGridLayout *m_pGrid;
00300 QWidget *m_pMain;
00301 KPasswordEdit *m_pEdit, *m_pEdit2;
00302
00303 protected:
00304 virtual void virtual_hook( int id, void* data );
00305 private:
00306 class KPasswordDialogPrivate;
00307 KPasswordDialogPrivate *d;
00308 };
00309
00310
00311 #endif // __KPassDlg_h_included__
This file is part of the documentation for kdeui Library Version 3.3.0.