00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef __KPassDlg_h_included__
00022
#define __KPassDlg_h_included__
00023
00024
#include <qstring.h>
00025
#include <qlineedit.h>
00026
#include <kdialogbase.h>
00027
00028
class QLabel;
00029
class QGridLayout;
00030
class QWidget;
00031
00039 class KDEUI_EXPORT KPasswordEdit
00040 :
public QLineEdit
00041 {
00042 Q_OBJECT
00043
00044
public:
00045
enum EchoModes { OneStar, ThreeStars, NoEcho };
00046
00050 KPasswordEdit(
QWidget *parent=0,
const char *name=0);
00051
00052
00058 KPasswordEdit(EchoMode echoMode,
QWidget *parent,
const char *name);
00059
00065 KPasswordEdit(EchoModes echoMode,
QWidget *parent,
const char *name);
00066
00071 KPasswordEdit(
QWidget *parent,
const char *name,
int echoMode) KDE_DEPRECATED;
00072
00076 ~KPasswordEdit();
00077
00082 const char *password()
const {
return m_Password; }
00083
00087
void erase();
00088
00089
static const int PassLen;
00090
00100
void setMaxPasswordLength(
int newLength);
00101
00106
int maxPasswordLength() const;
00107
00108 public slots:
00112 virtual
void insert( const
QString &);
00113
00114 protected:
00115 virtual
void keyPressEvent(
QKeyEvent *);
00116 virtual
void focusInEvent(
QFocusEvent *e);
00117 virtual
bool event(
QEvent *e);
00118
00119 private:
00120
void init();
00121
void showPass();
00122
00123
char *m_Password;
00124
int m_EchoMode, m_Length;
00125 };
00126
00127
00166 class KDEUI_EXPORT
KPasswordDialog
00167 : public
KDialogBase
00168 {
00169 Q_OBJECT
00170
00171
public:
00175 enum Types {
00179 Password,
00180
00186 NewPassword
00187 };
00188
00203
KPasswordDialog(Types type,
bool enableKeep,
int extraBttn,
00204
QWidget *parent=0,
const char *name=0);
00205
00210
KPasswordDialog(
int type, QString prompt,
bool enableKeep=
false,
00211
int extraBttn=0) KDE_DEPRECATED;
00212
00213
00214
00230
KPasswordDialog(Types type,
bool enableKeep,
int extraBttn,
const QString& iconName,
00231
QWidget *parent = 0,
const char *name = 0);
00232
00236
virtual ~
KPasswordDialog();
00237
00241
void setPrompt(QString prompt);
00242
00246 QString prompt() const;
00247
00251
void addLine(QString key, QString value);
00252
00257
void setAllowEmptyPasswords(
bool allowed);
00258
00263
bool allowEmptyPasswords() const;
00264
00273
void setMinimumPasswordLength(
int minLength);
00274
00279
int minimumPasswordLength() const;
00280
00288
void setMaximumPasswordLength(
int maxLength);
00289
00294
int maximumPasswordLength() const;
00295
00304
void setReasonablePasswordLength(
int reasonableLength);
00305
00310
int reasonablePasswordLength() const;
00311
00322
void setPasswordStrengthWarningLevel(
int warningLevel);
00323
00328
int passwordStrengthWarningLevel() const;
00329
00334 const
char *password()
const {
return m_pEdit->password(); }
00335
00341
void clearPassword();
00342
00346 bool keep()
const {
return m_Keep; }
00347
00360
static int getPassword(
QCString &password, QString prompt,
int *keep=0L);
00361
00372
static int getNewPassword(
QCString &password, QString prompt);
00373
00377
static void disableCoreDumps();
00378
00379
protected slots:
00380
void slotOk();
00381
void slotCancel();
00382
void slotKeep(
bool);
00383
00384
protected:
00385
00391 virtual bool checkPassword(
const char *) {
return true; }
00392
00393
private slots:
00394
void enableOkBtn();
00395
00396
private:
00397
void init();
00398
void erase();
00399
00400
int m_Keep, m_Type, m_Row;
00401
QLabel *m_pHelpLbl;
00402
QGridLayout *m_pGrid;
00403
QWidget *m_pMain;
00404 KPasswordEdit *m_pEdit, *m_pEdit2;
00405
00406
protected:
00407
virtual void virtual_hook(
int id,
void* data );
00408
private:
00409
class KPasswordDialogPrivate;
00410 KPasswordDialogPrivate*
const d;
00411 };
00412
00413
00414
#endif // __KPassDlg_h_included__