kpassdlg.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# 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);
    00054     KPasswordEdit(EchoMode echoMode, QWidget *parent, const char *name);
    00059     KPasswordEdit(QWidget *parent, const char *name, int echoMode);
    00063     ~KPasswordEdit();
    00064
    00069     const char *password() const { return m_Password; }
    00070
    00074     void erase();
    00075
    00076     static const int PassLen;
    00077
    00078 public slots:
    00082     virtual void insert( const QString &);
    00083
    00084 protected:
    00085     virtual void keyPressEvent(QKeyEvent *);
    00086     virtual void focusInEvent(QFocusEvent *e);
    00087     virtual bool event(QEvent *e);
    00088
    00089 private:
    00090     void init();
    00091     void showPass();
    00092
    00093     char *m_Password;
    00094     int m_EchoMode, m_Length;
    00095 };
    00096
    00097
    00133 class KPasswordDialog
    00134     : public KDialogBase
    00135 {
    00136     Q_OBJECT
    00137
    00138 public:
    00142     enum Types {
    00146         Password,
    00152         NewPassword
    00153     };
    00154
    00167     KPasswordDialog(Types type, bool enableKeep, int extraBttn,
    00168                     QWidget *parent=0, const char *name=0);
    00173     KPasswordDialog(int type, QString prompt, bool enableKeep=false,
    00174             int extraBttn=0);
    00178     virtual ~KPasswordDialog();
    00179
    00183     void setPrompt(QString prompt);
    00187     QString prompt() const;
    00188
    00192     void addLine(QString key, QString value);
    00197     const char *password() const { return m_pEdit->password(); }
    00198
    00202     bool keep() const { return m_Keep; }
    00203
    00216     static int getPassword(QCString &password, QString prompt, int *keep=0L);
    00217
    00228     static int getNewPassword(QCString &password, QString prompt);
    00229
    00233     static void disableCoreDumps();
    00234
    00235 protected slots:
    00236     void slotOk();
    00237     void slotCancel();
    00238     void slotKeep(bool);
    00239
    00240 protected:
    00241
    00247     virtual bool checkPassword(const char *) { return true; }
    00248
    00249 private:
    00250     void init();
    00251     void erase();
    00252
    00253     int m_Keep, m_Type, m_Row;
    00254     QLabel *m_pHelpLbl;
    00255     QGridLayout *m_pGrid;
    00256     QWidget *m_pMain;
    00257     KPasswordEdit *m_pEdit, *m_pEdit2;
    00258
    00259 protected:
    00260     virtual void virtual_hook( int id, void* data );
    00261 private:
    00262     class KPasswordDialogPrivate;
    00263     KPasswordDialogPrivate *d;
    00264 };
    00265
    00266
    00267 #endif // __KPassDlg_h_included__

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:30 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001