• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kdeui

kpassdlg.h

Go to the documentation of this file.
00001 // vi: ts=8 sts=4 sw=4
00002 /* This file is part of the KDE libraries
00003    Copyright (C) 1998 Pietro Iglio <iglio@fub.it>
00004    Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
00005    Copyright (C) 2004,2005 Andrew Coles <andrew_coles@yahoo.co.uk>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License version 2 as published by the Free Software Foundation.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
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     // KDE4: either of the two must go! add default values for parameters
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     // note that this implicitly deprecates the 'prompt' variants of
00213     // getPassword() below. i guess the above constructor needs to be extended.
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__

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal