summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/scriptedit.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/scriptedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/scriptedit.cpp174
1 files changed, 174 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/ppp/scriptedit.cpp b/noncore/settings/networksettings/ppp/scriptedit.cpp
new file mode 100644
index 0000000..b8afad5
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/scriptedit.cpp
@@ -0,0 +1,174 @@
1
2/*
3 * kPPP: A front end for pppd for the KDE project
4 *
5 * $Id$
6 *
7 * Copyright (C) 1997 Bernd Johannes Wuebben
8 * wuebben@math.cornell.edu
9 *
10 * based on EzPPP:
11 * Copyright (C) 1997 Jay Painter
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
22 *
23 * You should have received a copy of the GNU Library General Public
24 * License along with this program; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#include "scriptedit.h"
29#include <qlayout.h>
30#include <qcombobox.h>
31#include <qlineedit.h>
32
33ScriptEdit::ScriptEdit( QWidget *parent, const char *name )
34 : QWidget(parent, name)
35{
36 QHBoxLayout *tl = new QHBoxLayout(this, 0, 10);
37
38 st = new QComboBox(this, "st");
39 st->insertItem("Expect");
40 st->insertItem("Send");
41 st->insertItem("Pause (sec)");
42 st->insertItem("Hangup");
43 st->insertItem("Answer");
44 st->insertItem("Timeout (sec)");
45 st->insertItem("Password");
46 st->insertItem("ID");
47 st->insertItem("Prompt");
48 st->insertItem("PWPrompt");
49 st->insertItem("LoopStart");
50 st->insertItem("LoopEnd");
51 st->insertItem("Scan");
52 st->insertItem("Save");
53 st->insertItem("SendNoEcho");
54 connect(st, SIGNAL(activated(int)), SLOT(setType(int)));
55
56 se = new QLineEdit(this, "se");
57 se->setGeometry(120, 5, 140, 25);
58 se->setMaxLength(50);
59 connect(se, SIGNAL(returnPressed()), SLOT(seReturnPressed()));
60
61 tl->addWidget(st, 3);
62 tl->addWidget(se, 7);
63
64 setType(0);
65
66 tl->activate();
67}
68
69
70void ScriptEdit::setEnabled(bool b) {
71 se->setEnabled(b);
72 st->setEnabled(b);
73}
74
75void ScriptEdit::seReturnPressed() {
76 emit returnPressed();
77}
78
79
80QString ScriptEdit::text() {
81 return se->text();
82}
83
84void ScriptEdit::setText(const QString &t) {
85 se->setText(t);
86}
87
88
89int ScriptEdit::type() {
90 return st->currentItem();
91}
92
93void ScriptEdit::setType(int i) {
94 switch(i) {
95 case Expect:
96 se->setText("");
97 se->setEnabled(TRUE);
98 break;
99
100 case Send:
101 se->setText("");
102 se->setEnabled(TRUE);
103 break;
104
105 case Pause:
106 se->setText("");
107 se->setEnabled(TRUE);
108 break;
109
110 case Hangup:
111 se->setText("");
112 se->setEnabled(FALSE);
113 break;
114
115 case Answer:
116 se->setText("");
117 se->setEnabled(FALSE);
118 break;
119
120 case Timeout:
121 se->setText("");
122 se->setEnabled(TRUE);
123 break;
124
125 case Password:
126 se->setText("");
127 se->setEnabled(TRUE);
128 break;
129
130 case ID:
131 se->setText("");
132 se->setEnabled(TRUE);
133 break;
134
135 case Prompt:
136 se->setText("");
137 se->setEnabled(TRUE);
138 break;
139
140 case PWPrompt:
141 se->setText("");
142 se->setEnabled(TRUE);
143 break;
144
145 case LoopStart:
146 se->setText("");
147 se->setEnabled(TRUE);
148 break;
149
150 case LoopEnd:
151 se->setText("");
152 se->setEnabled(TRUE);
153 break;
154
155 case Scan:
156 se->setText("");
157 se->setEnabled(TRUE);
158 break;
159
160 case Save:
161 se->setText("password");
162 se->setEnabled(FALSE);
163 break;
164
165 default: break;
166 }
167}
168
169
170
171
172
173
174