3 * Kppp: A pppd front end for the KDE project
7 * Copyright (C) 1997 Bernd Johannes Wuebben
8 * wuebben@math.cornell.edu
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this program; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 #include <qapplication.h>
31 #include <QFocusEvent>
32 #include <QResizeEvent>
33 #include <kglobalsettings.h>
37 #warning A null parent is a weird choice. Any reason?
39 PWEntry::PWEntry( QWidget
*parent
, const char *name
)
45 QPoint point
= mapToGlobal (QPoint (0,0));
46 QRect pos
= geometry();
48 setGeometry(point
.x() + pos
.width()/2 - 300/2,
49 point
.y() + pos
.height()/2 - 90/2,
53 QRect desk
= KGlobalSettings::desktopGeometry(parent
);
54 setGeometry( desk
.center().x() - 150, desk
.center().y() - 50, 300, 90 );
57 frame
= new Q3GroupBox(name
, this );
59 setFocusPolicy( Qt::StrongFocus
);
61 pw
= new QLineEdit( this );
62 pw
->setObjectName( "le" );
63 pw
->setEchoMode( QLineEdit::Password
);
64 connect( pw
, SIGNAL(returnPressed()), this, SLOT(hide()) );
69 QString
PWEntry::text() { return (pw
->text()); }
71 void PWEntry::focusInEvent( QFocusEvent
*){
77 void PWEntry::setEchoModeNormal() {
79 pw
->setEchoMode(QLineEdit::Normal
);
83 void PWEntry::setEchoModePassword() {
85 pw
->setEchoMode(QLineEdit::Password
);
89 void PWEntry::setPrompt(const QString
&p
) {
95 void PWEntry::resizeEvent(QResizeEvent
* ){
97 pw
->setGeometry( 15,35, width() - 30, 25 );
98 frame
->setGeometry(5,5, width() - 10, height() - 10 );
103 void PWEntry::show() {
110 bool PWEntry::Consumed() {
114 void PWEntry::setConsumed() {
118 void PWEntry::hide() {
123 #include "pwentry.moc"