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 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     // 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 
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     // note that this implicitly deprecates the 'prompt' variants of
00195     // getPassword() below. i guess the above constructor needs to be extended.
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__
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:12:01 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003