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 2003/03/08 01:43:05 waba Exp $";
00040
00041
00042
00043
00044
00045 #include <string.h>
00046 #include <stdio.h>
00047
00048 #include <qapplication.h>
00049 #include <qpushbutton.h>
00050 #include <qlabel.h>
00051 #include <qlayout.h>
00052 #include <qdialog.h>
00053 #include <qaccel.h>
00054 #include <qmessagebox.h>
00055 #include <qcheckbox.h>
00056
00057 #include "passworddialog.h"
00058 #include "passworddialog.moc"
00059
00060 #include <klocale.h>
00061 #include <kapplication.h>
00062
00063 PasswordDialog::PasswordDialog(QString head, QWidget* parent, const char* name, bool modal, WFlags wflags)
00064 : QDialog(parent, name, modal, wflags)
00065 {
00066
00067 _head = head;
00068
00069
00070
00071
00072 if (!_head.isEmpty())
00073 {
00074 QLabel *l;
00075
00076 l = new QLabel(_head, this);
00077 l->setGeometry( 10, 10, 200, 20 );
00078 }
00079
00080
00081
00082
00083 QLabel *l_password = new QLabel(i18n("Password"), this);
00084 l_password->setGeometry( 10, 40, 80, 30 );
00085
00086 _w_password = new QLineEdit( this );
00087 _w_password->setGeometry( 90, 40, 100, 30 );
00088 _w_password->setEchoMode( QLineEdit::Password );
00089
00090
00091
00092
00093 QAccel *ac = new QAccel(this);
00094 ac->connectItem( ac->insertItem(Key_Escape), this, SLOT(reject()) );
00095
00096 connect( _w_password, SIGNAL(returnPressed()), SLOT(accept()) );
00097
00098
00099
00100
00101 QFrame *f = new QFrame(this);
00102 f->setLineWidth(1);
00103 f->setMidLineWidth(1);
00104 f->setFrameStyle( QFrame::HLine|QFrame::Raised);
00105 f->setGeometry( 10, 80, 180, 2 );
00106
00107
00108
00109
00110 QPushButton *b1, *b2;
00111 b1 = new QPushButton(i18n("OK"), this);
00112 b1->setGeometry( 10, 90, 80, 30 );
00113
00114 b2 = new QPushButton(i18n("Cancel"), this);
00115 b2->setGeometry( 110, 90, 80, 30 );
00116
00117
00118 connect( b1, SIGNAL(clicked()), SLOT(accept()) );
00119 connect( b2, SIGNAL(clicked()), SLOT(reject()) );
00120
00121
00122 setCaption(i18n("Password"));
00123
00124
00125 _w_password->setFocus();
00126
00127 setGeometry( x(), y(), 200, 130 );
00128
00129 (void) passworddialog_id;
00130 }
00131
00132 const char * PasswordDialog::password()
00133 {
00134 if ( _w_password )
00135 return _w_password->text().latin1();
00136 else
00137 return "";
00138 }
This file is part of the documentation for kpilot Library Version 3.2.2.