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     
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     
00184     
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__
 
This file is part of the documentation for kdeui Library Version 3.2.0.