passworddialog.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 static const char *passworddialog_id="$Id: passworddialog.cc,v 1.15.4.1 2004/04/11 11:00:05 binner Exp $";
00040
00041
00042
00043
00044
00045 #include <string.h>
00046 #include <stdio.h>
00047
00048 #include <qapplication.h>
00049 #include <qlabel.h>
00050 #include <qlayout.h>
00051 #include <qdialog.h>
00052 #include <qaccel.h>
00053 #include <qmessagebox.h>
00054 #include <qcheckbox.h>
00055
00056 #include "passworddialog.h"
00057 #include "passworddialog.moc"
00058
00059 #include <klocale.h>
00060 #include <kapplication.h>
00061 #include <kstdguiitem.h>
00062 #include <kpushbutton.h>
00063
00064 PasswordDialog::PasswordDialog(QString head, QWidget* parent, const char* name, bool modal, WFlags wflags)
00065 : QDialog(parent, name, modal, wflags)
00066 {
00067
00068 _head = head;
00069
00070
00071
00072
00073 if (!_head.isEmpty())
00074 {
00075 QLabel *l;
00076
00077 l = new QLabel(_head, this);
00078 l->setGeometry( 10, 10, 200, 20 );
00079 }
00080
00081
00082
00083
00084 QLabel *l_password = new QLabel(i18n("Password"), this);
00085 l_password->setGeometry( 10, 40, 80, 30 );
00086
00087 _w_password = new QLineEdit( this );
00088 _w_password->setGeometry( 90, 40, 100, 30 );
00089 _w_password->setEchoMode( QLineEdit::Password );
00090
00091
00092
00093
00094 QAccel *ac = new QAccel(this);
00095 ac->connectItem( ac->insertItem(Key_Escape), this, SLOT(reject()) );
00096
00097 connect( _w_password, SIGNAL(returnPressed()), SLOT(accept()) );
00098
00099
00100
00101
00102 QFrame *f = new QFrame(this);
00103 f->setLineWidth(1);
00104 f->setMidLineWidth(1);
00105 f->setFrameStyle( QFrame::HLine|QFrame::Raised);
00106 f->setGeometry( 10, 80, 180, 2 );
00107
00108
00109
00110
00111 QPushButton *b1, *b2;
00112 b1 = new KPushButton(KStdGuiItem::ok(), this);
00113 b1->setGeometry( 10, 90, 80, 30 );
00114
00115 b2 = new KPushButton(KStdGuiItem::cancel(), this);
00116 b2->setGeometry( 110, 90, 80, 30 );
00117
00118
00119 connect( b1, SIGNAL(clicked()), SLOT(accept()) );
00120 connect( b2, SIGNAL(clicked()), SLOT(reject()) );
00121
00122
00123 setCaption(i18n("Password"));
00124
00125
00126 _w_password->setFocus();
00127
00128 setGeometry( x(), y(), 200, 130 );
00129
00130 (void) passworddialog_id;
00131 }
00132
00133 const char * PasswordDialog::password()
00134 {
00135 if ( _w_password )
00136 return _w_password->text().latin1();
00137 else
00138 return "";
00139 }
This file is part of the documentation for kpilot Library Version 3.2.2.