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 KDEUI_EXPORT 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
00148 class KDEUI_EXPORT KPasswordDialog
00149 : public KDialogBase
00150 {
00151 Q_OBJECT
00152
00153 public:
00157 enum Types {
00161 Password,
00162
00168 NewPassword
00169 };
00170
00185 KPasswordDialog(Types type, bool enableKeep, int extraBttn,
00186 QWidget *parent=0, const char *name=0);
00187
00192 KPasswordDialog(int type, QString prompt, bool enableKeep=false,
00193 int extraBttn=0) KDE_DEPRECATED;
00194
00195
00196
00212 KPasswordDialog(Types type, bool enableKeep, int extraBttn, const QString& iconName,
00213 QWidget *parent = 0, const char *name = 0);
00214
00218 virtual ~KPasswordDialog();
00219
00223 void setPrompt(QString prompt);
00224
00228 QString prompt() const;
00229
00233 void addLine(QString key, QString value);
00234
00235
00236
00241 const char *password() const { return m_pEdit->password(); }
00242
00248 void clearPassword();
00249
00253 bool keep() const { return m_Keep; }
00254
00267 static int getPassword(QCString &password, QString prompt, int *keep=0L);
00268
00279 static int getNewPassword(QCString &password, QString prompt);
00280
00284 static void disableCoreDumps();
00285
00286 protected slots:
00287 void slotOk();
00288 void slotCancel();
00289 void slotKeep(bool);
00290
00291 protected:
00292
00298 virtual bool checkPassword(const char *) { return true; }
00299
00300 private slots:
00301 void enableOkBtn();
00302
00303 private:
00304 void init();
00305 void erase();
00306
00307 int m_Keep, m_Type, m_Row;
00308 QLabel *m_pHelpLbl;
00309 QGridLayout *m_pGrid;
00310 QWidget *m_pMain;
00311 KPasswordEdit *m_pEdit, *m_pEdit2;
00312
00313 protected:
00314 virtual void virtual_hook( int id, void* data );
00315 private:
00316 class KPasswordDialogPrivate;
00317 KPasswordDialogPrivate* d;
00318 };
00319
00320
00321 #endif // __KPassDlg_h_included__
This file is part of the documentation for kdeui Library Version 3.3.90.