summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/pwentry.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/pwentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/pwentry.cpp116
1 files changed, 116 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/ppp/pwentry.cpp b/noncore/settings/networksettings/ppp/pwentry.cpp
new file mode 100644
index 0000000..842dc87
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/pwentry.cpp
@@ -0,0 +1,116 @@
1/*
2 *
3 * Kppp: A pppd front end for the KDE project
4 *
5 * $Id$
6 *
7 * Copyright (C) 1997 Bernd Johannes Wuebben
8 * wuebben@math.cornell.edu
9 *
10 *
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.
15 *
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.
20 *
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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26
27
28#include <stdio.h>
29#include <qapplication.h>
30#include "pwentry.h"
31
32PWEntry::PWEntry( QWidget *parent, const char *name )
33 : QWidget(NULL, name) {
34
35 if(parent){
36
37 QPoint point = this->mapToGlobal (QPoint (0,0));
38 QRect pos = this->geometry();
39
40 setGeometry(point.x() + pos.width()/2 - 300/2,
41 point.y() + pos.height()/2 - 90/2,
42 300,
43 90);
44 }
45// else{
46// int scnum = QApplication::desktop()->screenNumber(parent);
47// QRect desk = QApplication::desktop()->screenGeometry(scnum);
48// setGeometry( desk.center().x() - 150, desk.center().y() - 50, 300, 90 );
49// }
50
51 frame = new QGroupBox(name, this );
52
53 this->setFocusPolicy( QWidget::StrongFocus );
54
55 pw = new QLineEdit( this, "le" );
56 pw->setEchoMode( QLineEdit::Password );
57 connect( pw, SIGNAL(returnPressed()), this, SLOT(hide()) );
58
59 isconsumed = TRUE;
60}
61
62QString PWEntry::text() { return (pw->text()); }
63
64void PWEntry::focusInEvent( QFocusEvent *){
65
66 pw->setFocus();
67
68}
69
70void PWEntry::setEchoModeNormal() {
71
72 pw->setEchoMode(QLineEdit::Normal);
73
74}
75
76void PWEntry::setEchoModePassword() {
77
78 pw->setEchoMode(QLineEdit::Password);
79
80}
81
82void PWEntry::setPrompt(const QString &p) {
83
84 frame->setTitle(p);
85
86}
87
88void PWEntry::resizeEvent(QResizeEvent* ){
89
90 pw->setGeometry( 15,35, this->width() - 30, 25 );
91 frame->setGeometry(5,5,this->width() - 10, this->height() - 10 );
92
93}
94
95
96void PWEntry::show() {
97
98 pw->setText("");
99 isconsumed = FALSE;
100 QWidget::show();
101}
102
103bool PWEntry::Consumed() {
104 return(isconsumed);
105}
106
107void PWEntry::setConsumed() {
108 isconsumed = TRUE;
109}
110
111void PWEntry::hide() {
112 QWidget::hide();
113 return;
114}
115
116//#include "pwentry.moc"