kdeui Library API Documentation

kpassdlg.h

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 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
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     // KDE4: either of the two must go! add default values for parameters
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     // note that this implicitly deprecates the 'prompt' variants of
00192     // getPassword() below. i guess the above constructor needs to be extended.
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__
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jan 22 16:45:15 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003