author | tille <tille> | 2003-05-24 17:03:27 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-24 17:03:27 (UTC) |
commit | 58947769d80d49faaccac1703da0e66c90158957 (patch) (unidiff) | |
tree | 4ba8961b94ca5cd74265346bf9b48afdb126c07a | |
parent | ea6b12007f4b5af926f6732637cb159904c4da7a (diff) | |
download | opie-58947769d80d49faaccac1703da0e66c90158957.zip opie-58947769d80d49faaccac1703da0e66c90158957.tar.gz opie-58947769d80d49faaccac1703da0e66c90158957.tar.bz2 |
layout fixes
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 54 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdargs.cpp | 26 |
2 files changed, 42 insertions, 38 deletions
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 6132b80..eee643d 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -1,266 +1,266 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd Front End for the KDE project | 2 | * kPPP: A pppd Front End for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * Copyright (C) 1997 Bernd Johannes Wuebben | 5 | * Copyright (C) 1997 Bernd Johannes Wuebben |
6 | * wuebben@math.cornell.edu | 6 | * wuebben@math.cornell.edu |
7 | * | 7 | * |
8 | * based on EzPPP: | 8 | * based on EzPPP: |
9 | * Copyright (C) 1997 Jay Painter | 9 | * Copyright (C) 1997 Jay Painter |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or | 11 | * This program is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU Library General Public | 12 | * modify it under the terms of the GNU Library General Public |
13 | * License as published by the Free Software Foundation; either | 13 | * License as published by the Free Software Foundation; either |
14 | * version 2 of the License, or (at your option) any later version. | 14 | * version 2 of the License, or (at your option) any later version. |
15 | * | 15 | * |
16 | * This program is distributed in the hope that it will be useful, | 16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | * Library General Public License for more details. | 19 | * Library General Public License for more details. |
20 | * | 20 | * |
21 | * You should have received a copy of the GNU Library General Public | 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 | 22 | * License along with this program; if not, write to the Free |
23 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 23 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include <termios.h> | 27 | #include <termios.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <kiconloader.h> | 33 | //#include <kiconloader.h> |
34 | #include <qbuttongroup.h> | 34 | #include <qbuttongroup.h> |
35 | //#include <klocale.h> | 35 | //#include <klocale.h> |
36 | #define i18n QObject::tr | 36 | #define i18n QObject::tr |
37 | #include <qvgroupbox.h> | 37 | #include <qvgroupbox.h> |
38 | #include <qhbox.h> | 38 | #include <qhbox.h> |
39 | #include <qdialog.h> | 39 | #include <qdialog.h> |
40 | //#include <kwin.h> | 40 | //#include <kwin.h> |
41 | 41 | ||
42 | #include "edit.h" | 42 | #include "edit.h" |
43 | #include "pppdata.h" | 43 | #include "pppdata.h" |
44 | //#include "newwidget.h" | 44 | //#include "newwidget.h" |
45 | #include "iplined.h" | 45 | #include "iplined.h" |
46 | #include "auth.h" | 46 | #include "auth.h" |
47 | 47 | ||
48 | DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | 48 | DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) |
49 | : QWidget(parent, name) | 49 | : QWidget(parent, name) |
50 | { | 50 | { |
51 | const int GRIDROWS = 6; | 51 | const int GRIDROWS = 6; |
52 | 52 | ||
53 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); | 53 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); |
54 | 54 | ||
55 | connect_label = new QLabel(i18n("Connection name:"), this); | 55 | connect_label = new QLabel(i18n("Connection name:"), this); |
56 | tl->addWidget(connect_label, 0, 0); | 56 | tl->addWidget(connect_label, 0, 0); |
57 | 57 | ||
58 | connectname_l = new QLineEdit(this); | 58 | connectname_l = new QLineEdit(this); |
59 | // connectname_l->setMaxLength(ACCNAME_SIZE); | 59 | // connectname_l->setMaxLength(ACCNAME_SIZE); |
60 | tl->addWidget(connectname_l, 0, 1); | 60 | tl->addWidget(connectname_l, 0, 1); |
61 | QString tmp = i18n("Type in a unique name for this connection"); | 61 | QString tmp = i18n("Type in a unique name for this connection"); |
62 | 62 | ||
63 | QWhatsThis::add(connect_label,tmp); | 63 | QWhatsThis::add(connect_label,tmp); |
64 | QWhatsThis::add(connectname_l,tmp); | 64 | QWhatsThis::add(connectname_l,tmp); |
65 | 65 | ||
66 | 66 | ||
67 | number_label = new QLabel(i18n("Phone number:"), this); | 67 | number_label = new QLabel(i18n("Phone number:"), this); |
68 | number_label->setAlignment(AlignTop|AlignLeft); | 68 | number_label->setAlignment(AlignTop|AlignLeft); |
69 | tl->addWidget(number_label, 1, 0); | 69 | tl->addWidget(number_label, 1, 0); |
70 | 70 | ||
71 | QHBoxLayout *lpn = new QHBoxLayout(5); | 71 | QHBoxLayout *lpn = new QHBoxLayout(5); |
72 | tl->addLayout(lpn, 1, 1); | 72 | tl->addLayout(lpn, 1, 1); |
73 | numbers = new QListBox(this); | 73 | numbers = new QListBox(this); |
74 | numbers->setMinimumSize(120, 70); | 74 | // numbers->setMinimumSize(120, 70); |
75 | lpn->addWidget(numbers); | 75 | lpn->addWidget(numbers); |
76 | QVBoxLayout *lpn1 = new QVBoxLayout; | 76 | QVBoxLayout *lpn1 = new QVBoxLayout; |
77 | lpn->addLayout(lpn1); | 77 | lpn->addLayout(lpn1); |
78 | add = new QPushButton(i18n("&Add..."), this); | 78 | add = new QPushButton(i18n("&Add..."), this); |
79 | del = new QPushButton(i18n("&Remove"), this); | 79 | del = new QPushButton(i18n("&Remove"), this); |
80 | 80 | ||
81 | up = new QPushButton(this); | 81 | up = new QPushButton(this); |
82 | //FIXME: QPixmap pm = BarIcon("up"); | 82 | //FIXME: QPixmap pm = BarIcon("up"); |
83 | // up->setPixmap(pm); | 83 | // up->setPixmap(pm); |
84 | down = new QPushButton(this); | 84 | down = new QPushButton(this); |
85 | //FIXME: pm = BarIcon("down"); | 85 | //FIXME: pm = BarIcon("down"); |
86 | // down->setPixmap(pm); | 86 | // down->setPixmap(pm); |
87 | lpn1->addWidget(add); | 87 | lpn1->addWidget(add); |
88 | lpn1->addWidget(del); | 88 | lpn1->addWidget(del); |
89 | lpn1->addStretch(1); | 89 | lpn1->addStretch(1); |
90 | lpn1->addWidget(up); | 90 | lpn1->addWidget(up); |
91 | lpn1->addWidget(down); | 91 | lpn1->addWidget(down); |
92 | connect(add, SIGNAL(clicked()), | 92 | connect(add, SIGNAL(clicked()), |
93 | this, SLOT(addNumber())); | 93 | this, SLOT(addNumber())); |
94 | connect(del, SIGNAL(clicked()), | 94 | connect(del, SIGNAL(clicked()), |
95 | this, SLOT(delNumber())); | 95 | this, SLOT(delNumber())); |
96 | connect(up, SIGNAL(clicked()), | 96 | connect(up, SIGNAL(clicked()), |
97 | this, SLOT(upNumber())); | 97 | this, SLOT(upNumber())); |
98 | connect(down, SIGNAL(clicked()), | 98 | connect(down, SIGNAL(clicked()), |
99 | this, SLOT(downNumber())); | 99 | this, SLOT(downNumber())); |
100 | connect(numbers, SIGNAL(highlighted(int)), | 100 | connect(numbers, SIGNAL(highlighted(int)), |
101 | this, SLOT(selectionChanged(int))); | 101 | this, SLOT(selectionChanged(int))); |
102 | numbersChanged(); | 102 | numbersChanged(); |
103 | 103 | ||
104 | tmp = i18n("<p>Specifies the phone numbers to dial. You\n" | 104 | tmp = i18n("<p>Specifies the phone numbers to dial. You\n" |
105 | "can supply multiple numbers here, simply\n" | 105 | "can supply multiple numbers here, simply\n" |
106 | "click on \"Add\". You can arrange the\n" | 106 | "click on \"Add\". You can arrange the\n" |
107 | "order the numbers are tried by using the\n" | 107 | "order the numbers are tried by using the\n" |
108 | "arrow buttons.\n\n" | 108 | "arrow buttons.\n\n" |
109 | "When a number is busy or fails, <i>kppp</i> will \n" | 109 | "When a number is busy or fails, <i>kppp</i> will \n" |
110 | "try the next number and so on"); | 110 | "try the next number and so on"); |
111 | 111 | ||
112 | QWhatsThis::add(number_label,tmp); | 112 | QWhatsThis::add(number_label,tmp); |
113 | QWhatsThis::add(numbers,tmp); | 113 | QWhatsThis::add(numbers,tmp); |
114 | 114 | ||
115 | auth_l = new QLabel(i18n("Authentication:"), this); | 115 | auth_l = new QLabel(i18n("Authentication:"), this); |
116 | tl->addWidget(auth_l, 3, 0); | 116 | tl->addWidget(auth_l, 3, 0); |
117 | 117 | ||
118 | auth = new QComboBox(this); | 118 | auth = new QComboBox(this); |
119 | auth->insertItem(i18n("Script-based")); | 119 | auth->insertItem(i18n("Script-based")); |
120 | auth->insertItem(i18n("PAP")); | 120 | auth->insertItem(i18n("PAP")); |
121 | auth->insertItem(i18n("Terminal-based")); | 121 | auth->insertItem(i18n("Terminal-based")); |
122 | auth->insertItem(i18n("CHAP")); | 122 | auth->insertItem(i18n("CHAP")); |
123 | auth->insertItem(i18n("PAP/CHAP")); | 123 | auth->insertItem(i18n("PAP/CHAP")); |
124 | tl->addWidget(auth, 3, 1); | 124 | tl->addWidget(auth, 3, 1); |
125 | tmp = i18n("<p>Specifies the method used to identify yourself to\n" | 125 | tmp = i18n("<p>Specifies the method used to identify yourself to\n" |
126 | "the PPP server. Most universities still use\n" | 126 | "the PPP server. Most universities still use\n" |
127 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" | 127 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" |
128 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" | 128 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" |
129 | "unsure, contact your ISP.\n" | 129 | "unsure, contact your ISP.\n" |
130 | "\n" | 130 | "\n" |
131 | "If you can choose between PAP and CHAP,\n" | 131 | "If you can choose between PAP and CHAP,\n" |
132 | "choose CHAP, because it's much safer. If you don't know\n" | 132 | "choose CHAP, because it's much safer. If you don't know\n" |
133 | "whether PAP or CHAP is right, choose PAP/CHAP."); | 133 | "whether PAP or CHAP is right, choose PAP/CHAP."); |
134 | 134 | ||
135 | QWhatsThis::add(auth_l,tmp); | 135 | QWhatsThis::add(auth_l,tmp); |
136 | QWhatsThis::add(auth,tmp); | 136 | QWhatsThis::add(auth,tmp); |
137 | 137 | ||
138 | store_password = new QCheckBox(i18n("Store password"), this); | 138 | store_password = new QCheckBox(i18n("Store password"), this); |
139 | store_password->setChecked(true); | 139 | store_password->setChecked(true); |
140 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); | 140 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); |
141 | QWhatsThis::add(store_password, | 141 | QWhatsThis::add(store_password, |
142 | i18n("<p>When this is turned on, your ISP password\n" | 142 | i18n("<p>When this is turned on, your ISP password\n" |
143 | "will be saved in <i>kppp</i>'s config file, so\n" | 143 | "will be saved in <i>kppp</i>'s config file, so\n" |
144 | "you do not need to type it in every time.\n" | 144 | "you do not need to type it in every time.\n" |
145 | "\n" | 145 | "\n" |
146 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" | 146 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" |
147 | "plain text in the config file, which is\n" | 147 | "plain text in the config file, which is\n" |
148 | "readable only to you. Make sure nobody\n" | 148 | "readable only to you. Make sure nobody\n" |
149 | "gains access to this file!")); | 149 | "gains access to this file!")); |
150 | 150 | ||
151 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); | 151 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); |
152 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); | 152 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); |
153 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); | 153 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); |
154 | 154 | ||
155 | // Set defaults if editing an existing connection | 155 | // Set defaults if editing an existing connection |
156 | if(!isnewaccount) { | 156 | if(!isnewaccount) { |
157 | connectname_l->setText(PPPData::data()->accname()); | 157 | connectname_l->setText(PPPData::data()->accname()); |
158 | 158 | ||
159 | // insert the phone numbers into the listbox | 159 | // insert the phone numbers into the listbox |
160 | QString n = PPPData::data()->phonenumber(); | 160 | QString n = PPPData::data()->phonenumber(); |
161 | QString tmp = ""; | 161 | QString tmp = ""; |
162 | uint idx = 0; | 162 | uint idx = 0; |
163 | while(idx != n.length()) { | 163 | while(idx != n.length()) { |
164 | if(n[idx] == ':') { | 164 | if(n[idx] == ':') { |
165 | if(tmp.length() > 0) | 165 | if(tmp.length() > 0) |
166 | numbers->insertItem(tmp); | 166 | numbers->insertItem(tmp); |
167 | tmp = ""; | 167 | tmp = ""; |
168 | } else | 168 | } else |
169 | tmp += n[idx]; | 169 | tmp += n[idx]; |
170 | idx++; | 170 | idx++; |
171 | } | 171 | } |
172 | if(tmp.length() > 0) | 172 | if(tmp.length() > 0) |
173 | numbers->insertItem(tmp); | 173 | numbers->insertItem(tmp); |
174 | 174 | ||
175 | auth->setCurrentItem(PPPData::data()->authMethod()); | 175 | auth->setCurrentItem(PPPData::data()->authMethod()); |
176 | store_password->setChecked(PPPData::data()->storePassword()); | 176 | store_password->setChecked(PPPData::data()->storePassword()); |
177 | } else { | 177 | } else { |
178 | // select PAP/CHAP as default | 178 | // select PAP/CHAP as default |
179 | auth->setCurrentItem(AUTH_PAPCHAP); | 179 | auth->setCurrentItem(AUTH_PAPCHAP); |
180 | } | 180 | } |
181 | 181 | ||
182 | numbersChanged(); | 182 | numbersChanged(); |
183 | tl->activate(); | 183 | tl->activate(); |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | bool DialWidget::save() { | 187 | bool DialWidget::save() { |
188 | //first check to make sure that the account name is unique! | 188 | //first check to make sure that the account name is unique! |
189 | if(connectname_l->text().isEmpty() || | 189 | if(connectname_l->text().isEmpty() || |
190 | !PPPData::data()->isUniqueAccname(connectname_l->text())) { | 190 | !PPPData::data()->isUniqueAccname(connectname_l->text())) { |
191 | return false; | 191 | return false; |
192 | } else { | 192 | } else { |
193 | PPPData::data()->setAccname(connectname_l->text()); | 193 | PPPData::data()->setAccname(connectname_l->text()); |
194 | 194 | ||
195 | QString number = ""; | 195 | QString number = ""; |
196 | for(uint i = 0; i < numbers->count(); i++) { | 196 | for(uint i = 0; i < numbers->count(); i++) { |
197 | if(i != 0) | 197 | if(i != 0) |
198 | number += ":"; | 198 | number += ":"; |
199 | number += numbers->text(i); | 199 | number += numbers->text(i); |
200 | } | 200 | } |
201 | 201 | ||
202 | PPPData::data()->setPhonenumber(number); | 202 | PPPData::data()->setPhonenumber(number); |
203 | PPPData::data()->setAuthMethod(auth->currentItem()); | 203 | PPPData::data()->setAuthMethod(auth->currentItem()); |
204 | PPPData::data()->setStorePassword(store_password->isChecked()); | 204 | PPPData::data()->setStorePassword(store_password->isChecked()); |
205 | return true; | 205 | return true; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | ||
210 | void DialWidget::numbersChanged() { | 210 | void DialWidget::numbersChanged() { |
211 | int sel = numbers->currentItem(); | 211 | int sel = numbers->currentItem(); |
212 | 212 | ||
213 | del->setEnabled(sel != -1); | 213 | del->setEnabled(sel != -1); |
214 | up->setEnabled(sel != -1 && sel != 0); | 214 | up->setEnabled(sel != -1 && sel != 0); |
215 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); | 215 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | void DialWidget::selectionChanged(int) { | 219 | void DialWidget::selectionChanged(int) { |
220 | numbersChanged(); | 220 | numbersChanged(); |
221 | } | 221 | } |
222 | 222 | ||
223 | 223 | ||
224 | void DialWidget::addNumber() { | 224 | void DialWidget::addNumber() { |
225 | PhoneNumberDialog dlg(this); | 225 | PhoneNumberDialog dlg(this); |
226 | if(dlg.exec()) { | 226 | if(dlg.exec()) { |
227 | numbers->insertItem(dlg.phoneNumber()); | 227 | numbers->insertItem(dlg.phoneNumber()); |
228 | numbersChanged(); | 228 | numbersChanged(); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | void DialWidget::delNumber() { | 233 | void DialWidget::delNumber() { |
234 | if(numbers->currentItem() != -1) { | 234 | if(numbers->currentItem() != -1) { |
235 | numbers->removeItem(numbers->currentItem()); | 235 | numbers->removeItem(numbers->currentItem()); |
236 | numbersChanged(); | 236 | numbersChanged(); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
241 | void DialWidget::upNumber() { | 241 | void DialWidget::upNumber() { |
242 | int idx = numbers->currentItem(); | 242 | int idx = numbers->currentItem(); |
243 | if(idx != -1) { | 243 | if(idx != -1) { |
244 | QString item = numbers->text(idx); | 244 | QString item = numbers->text(idx); |
245 | numbers->removeItem(idx); | 245 | numbers->removeItem(idx); |
246 | numbers->insertItem(item, idx-1); | 246 | numbers->insertItem(item, idx-1); |
247 | numbers->setCurrentItem(idx-1); | 247 | numbers->setCurrentItem(idx-1); |
248 | numbersChanged(); | 248 | numbersChanged(); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
253 | void DialWidget::downNumber() { | 253 | void DialWidget::downNumber() { |
254 | int idx = numbers->currentItem(); | 254 | int idx = numbers->currentItem(); |
255 | if(idx != -1) { | 255 | if(idx != -1) { |
256 | QString item = numbers->text(idx); | 256 | QString item = numbers->text(idx); |
257 | numbers->removeItem(idx); | 257 | numbers->removeItem(idx); |
258 | numbers->insertItem(item, idx+1); | 258 | numbers->insertItem(item, idx+1); |
259 | numbers->setCurrentItem(idx+1); | 259 | numbers->setCurrentItem(idx+1); |
260 | numbersChanged(); | 260 | numbersChanged(); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | void DialWidget::pppdargsbutton() { | 265 | void DialWidget::pppdargsbutton() { |
266 | PPPdArguments pa(this); | 266 | PPPdArguments pa(this); |
@@ -637,557 +637,561 @@ DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
637 | tl->addWidget(dnsservers, 5, 1); | 637 | tl->addWidget(dnsservers, 5, 1); |
638 | tmp = i18n("<p>This shows all defined DNS servers to use\n" | 638 | tmp = i18n("<p>This shows all defined DNS servers to use\n" |
639 | "while you are connected. Use the <b>Add</b> and\n" | 639 | "while you are connected. Use the <b>Add</b> and\n" |
640 | "<b>Remove</b> buttons to modify the list"); | 640 | "<b>Remove</b> buttons to modify the list"); |
641 | 641 | ||
642 | QWhatsThis::add(servers_label,tmp); | 642 | QWhatsThis::add(servers_label,tmp); |
643 | QWhatsThis::add(dnsservers,tmp); | 643 | QWhatsThis::add(dnsservers,tmp); |
644 | 644 | ||
645 | exdnsdisabled_toggle = new QCheckBox(i18n( \ | 645 | exdnsdisabled_toggle = new QCheckBox(i18n( \ |
646 | "Disable existing DNS servers during connection"), | 646 | "Disable existing DNS servers during connection"), |
647 | this); | 647 | this); |
648 | exdnsdisabled_toggle->setChecked(PPPData::data()->exDNSDisabled()); | 648 | exdnsdisabled_toggle->setChecked(PPPData::data()->exDNSDisabled()); |
649 | tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); | 649 | tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); |
650 | QWhatsThis::add(exdnsdisabled_toggle, | 650 | QWhatsThis::add(exdnsdisabled_toggle, |
651 | i18n("<p>When this option is selected, all DNS\n" | 651 | i18n("<p>When this option is selected, all DNS\n" |
652 | "servers specified in <tt>/etc/resolv.conf</tt> are\n" | 652 | "servers specified in <tt>/etc/resolv.conf</tt> are\n" |
653 | "temporary disabled while the dialup connection\n" | 653 | "temporary disabled while the dialup connection\n" |
654 | "is established. After the connection is\n" | 654 | "is established. After the connection is\n" |
655 | "closed, the servers will be re-enabled\n" | 655 | "closed, the servers will be re-enabled\n" |
656 | "\n" | 656 | "\n" |
657 | "Typically, there is no reason to use this\n" | 657 | "Typically, there is no reason to use this\n" |
658 | "option, but it may become useful under \n" | 658 | "option, but it may become useful under \n" |
659 | "some circumstances.")); | 659 | "some circumstances.")); |
660 | 660 | ||
661 | 661 | ||
662 | // restore data if editing | 662 | // restore data if editing |
663 | if(!isnewaccount) { | 663 | if(!isnewaccount) { |
664 | dnsservers->insertStringList(PPPData::data()->dns()); | 664 | dnsservers->insertStringList(PPPData::data()->dns()); |
665 | dnsdomain->setText(PPPData::data()->domain()); | 665 | dnsdomain->setText(PPPData::data()->domain()); |
666 | } | 666 | } |
667 | 667 | ||
668 | int mode = PPPData::data()->autoDNS() ? 0 : 1; | 668 | int mode = PPPData::data()->autoDNS() ? 0 : 1; |
669 | bg->setButton(mode); | 669 | bg->setButton(mode); |
670 | DNS_Mode_Selected(mode); | 670 | DNS_Mode_Selected(mode); |
671 | 671 | ||
672 | tl->activate(); | 672 | tl->activate(); |
673 | } | 673 | } |
674 | 674 | ||
675 | void DNSWidget::DNS_Edit_Changed(const QString &text) { | 675 | void DNSWidget::DNS_Edit_Changed(const QString &text) { |
676 | QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); | 676 | QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); |
677 | add->setEnabled(text.find(r) != -1); | 677 | add->setEnabled(text.find(r) != -1); |
678 | } | 678 | } |
679 | 679 | ||
680 | void DNSWidget::DNS_Entry_Selected(int) { | 680 | void DNSWidget::DNS_Entry_Selected(int) { |
681 | remove->setEnabled(true); | 681 | remove->setEnabled(true); |
682 | } | 682 | } |
683 | 683 | ||
684 | void DNSWidget::DNS_Mode_Selected(int mode) { | 684 | void DNSWidget::DNS_Mode_Selected(int mode) { |
685 | bool on = (mode == 1); | 685 | bool on = (mode == 1); |
686 | dns_label->setEnabled(on); | 686 | dns_label->setEnabled(on); |
687 | servers_label->setEnabled(on); | 687 | servers_label->setEnabled(on); |
688 | dnsipaddr->setText(""); | 688 | dnsipaddr->setText(""); |
689 | dnsipaddr->setEnabled(on); | 689 | dnsipaddr->setEnabled(on); |
690 | add->setEnabled(false); | 690 | add->setEnabled(false); |
691 | remove->setEnabled(dnsservers->count()>0 && on); | 691 | remove->setEnabled(dnsservers->count()>0 && on); |
692 | dnsservers->clearSelection(); | 692 | dnsservers->clearSelection(); |
693 | dnsservers->setEnabled(on); | 693 | dnsservers->setEnabled(on); |
694 | dnsservers->triggerUpdate(false); | 694 | dnsservers->triggerUpdate(false); |
695 | } | 695 | } |
696 | 696 | ||
697 | void DNSWidget::save() { | 697 | void DNSWidget::save() { |
698 | PPPData::data()->setAutoDNS(bg->id(bg->selected()) == 0); | 698 | PPPData::data()->setAutoDNS(bg->id(bg->selected()) == 0); |
699 | QStringList serverlist; | 699 | QStringList serverlist; |
700 | for(uint i=0; i < dnsservers->count(); i++) | 700 | for(uint i=0; i < dnsservers->count(); i++) |
701 | serverlist.append(dnsservers->text(i)); | 701 | serverlist.append(dnsservers->text(i)); |
702 | PPPData::data()->setDns(serverlist); | 702 | PPPData::data()->setDns(serverlist); |
703 | 703 | ||
704 | // strip leading dot | 704 | // strip leading dot |
705 | QString s(dnsdomain->text()); | 705 | QString s(dnsdomain->text()); |
706 | if(s.left(1) == ".") | 706 | if(s.left(1) == ".") |
707 | PPPData::data()->setDomain(s.mid(1)); | 707 | PPPData::data()->setDomain(s.mid(1)); |
708 | else | 708 | else |
709 | PPPData::data()->setDomain(dnsdomain->text()); | 709 | PPPData::data()->setDomain(dnsdomain->text()); |
710 | 710 | ||
711 | PPPData::data()->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); | 711 | PPPData::data()->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); |
712 | } | 712 | } |
713 | 713 | ||
714 | 714 | ||
715 | void DNSWidget::adddns() { | 715 | void DNSWidget::adddns() { |
716 | if(dnsservers->count() < MAX_DNS_ENTRIES) { | 716 | if(dnsservers->count() < MAX_DNS_ENTRIES) { |
717 | dnsservers->insertItem(dnsipaddr->text()); | 717 | dnsservers->insertItem(dnsipaddr->text()); |
718 | dnsipaddr->setText(""); | 718 | dnsipaddr->setText(""); |
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | 722 | ||
723 | void DNSWidget::removedns() { | 723 | void DNSWidget::removedns() { |
724 | int i; | 724 | int i; |
725 | i = dnsservers->currentItem(); | 725 | i = dnsservers->currentItem(); |
726 | if(i != -1) | 726 | if(i != -1) |
727 | dnsservers->removeItem(i); | 727 | dnsservers->removeItem(i); |
728 | remove->setEnabled(dnsservers->count()>0); | 728 | remove->setEnabled(dnsservers->count()>0); |
729 | } | 729 | } |
730 | 730 | ||
731 | 731 | ||
732 | // | 732 | // |
733 | // GatewayWidget | 733 | // GatewayWidget |
734 | // | 734 | // |
735 | GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) | 735 | GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) |
736 | : QWidget(parent, name) | 736 | : QWidget(parent, name) |
737 | { | 737 | { |
738 | QVBoxLayout *topLayout = new QVBoxLayout(this); | 738 | QVBoxLayout *topLayout = new QVBoxLayout(this); |
739 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); | 739 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); |
740 | 740 | ||
741 | box = new QVGroupBox(i18n("Configuration"), this); | 741 | box = new QVGroupBox(i18n("Configuration"), this); |
742 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); | 742 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); |
743 | 743 | ||
744 | rb = new QButtonGroup(this); | 744 | rb = new QButtonGroup(this); |
745 | rb->hide(); | 745 | rb->hide(); |
746 | connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); | 746 | connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); |
747 | 747 | ||
748 | defaultgateway = new QRadioButton(box); | 748 | defaultgateway = new QRadioButton(box); |
749 | defaultgateway->setText(i18n("Default gateway")); | 749 | defaultgateway->setText(i18n("Default gateway")); |
750 | rb->insert(defaultgateway, 0); | 750 | rb->insert(defaultgateway, 0); |
751 | QWhatsThis::add(defaultgateway, | 751 | QWhatsThis::add(defaultgateway, |
752 | i18n("This makes the PPP peer computer (the computer\n" | 752 | i18n("This makes the PPP peer computer (the computer\n" |
753 | "you are connected to with your modem) to act as\n" | 753 | "you are connected to with your modem) to act as\n" |
754 | "a gateway. Your computer will send all packets not\n" | 754 | "a gateway. Your computer will send all packets not\n" |
755 | "going to a computer inside your local net to this\n" | 755 | "going to a computer inside your local net to this\n" |
756 | "computer, which will route these packets.\n" | 756 | "computer, which will route these packets.\n" |
757 | "\n" | 757 | "\n" |
758 | "This is the default for most ISPs, so you should\n" | 758 | "This is the default for most ISPs, so you should\n" |
759 | "probably leave this option on.")); | 759 | "probably leave this option on.")); |
760 | 760 | ||
761 | 761 | ||
762 | staticgateway = new QRadioButton(box); | 762 | staticgateway = new QRadioButton(box); |
763 | staticgateway->setText(i18n("Static gateway")); | 763 | staticgateway->setText(i18n("Static gateway")); |
764 | rb->insert(staticgateway, 1); | 764 | rb->insert(staticgateway, 1); |
765 | QWhatsThis::add(staticgateway, | 765 | QWhatsThis::add(staticgateway, |
766 | i18n("<p>Allows you to specify which computer you want\n" | 766 | i18n("<p>Allows you to specify which computer you want\n" |
767 | "to use as gateway (see <i>Default Gateway</i> above)")); | 767 | "to use as gateway (see <i>Default Gateway</i> above)")); |
768 | 768 | ||
769 | QHBox *gateBox = new QHBox(box); | 769 | QHBox *gateBox = new QHBox(box); |
770 | gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); | 770 | gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); |
771 | gatewayaddr = new IPLineEdit(gateBox); | 771 | gatewayaddr = new IPLineEdit(gateBox); |
772 | 772 | ||
773 | defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), | 773 | defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), |
774 | this); | 774 | this); |
775 | QWhatsThis::add(defaultroute, | 775 | QWhatsThis::add(defaultroute, |
776 | i18n("If this option is enabled, all packets not\n" | 776 | i18n("If this option is enabled, all packets not\n" |
777 | "going to the local net are routed through\n" | 777 | "going to the local net are routed through\n" |
778 | "the PPP connection.\n" | 778 | "the PPP connection.\n" |
779 | "\n" | 779 | "\n" |
780 | "Normally, you should turn this on")); | 780 | "Normally, you should turn this on")); |
781 | 781 | ||
782 | topLayout->addWidget(box); | 782 | topLayout->addWidget(box); |
783 | topLayout->addWidget(defaultroute); | 783 | topLayout->addWidget(defaultroute); |
784 | topLayout->addStretch(); | 784 | topLayout->addStretch(); |
785 | 785 | ||
786 | //load info from gpppdata | 786 | //load info from gpppdata |
787 | if(!isnewaccount) { | 787 | if(!isnewaccount) { |
788 | if(PPPData::data()->gateway() == "0.0.0.0") { | 788 | if(PPPData::data()->gateway() == "0.0.0.0") { |
789 | defaultgateway->setChecked(true); | 789 | defaultgateway->setChecked(true); |
790 | hitGatewaySelect(0); | 790 | hitGatewaySelect(0); |
791 | } | 791 | } |
792 | else { | 792 | else { |
793 | gatewayaddr->setText(PPPData::data()->gateway()); | 793 | gatewayaddr->setText(PPPData::data()->gateway()); |
794 | staticgateway->setChecked(true); | 794 | staticgateway->setChecked(true); |
795 | } | 795 | } |
796 | defaultroute->setChecked(PPPData::data()->defaultroute()); | 796 | defaultroute->setChecked(PPPData::data()->defaultroute()); |
797 | } | 797 | } |
798 | else { | 798 | else { |
799 | defaultgateway->setChecked(true); | 799 | defaultgateway->setChecked(true); |
800 | hitGatewaySelect(0); | 800 | hitGatewaySelect(0); |
801 | defaultroute->setChecked(true); | 801 | defaultroute->setChecked(true); |
802 | } | 802 | } |
803 | } | 803 | } |
804 | 804 | ||
805 | void GatewayWidget::save() { | 805 | void GatewayWidget::save() { |
806 | PPPData::data()->setGateway(gatewayaddr->text()); | 806 | PPPData::data()->setGateway(gatewayaddr->text()); |
807 | PPPData::data()->setDefaultroute(defaultroute->isChecked()); | 807 | PPPData::data()->setDefaultroute(defaultroute->isChecked()); |
808 | } | 808 | } |
809 | 809 | ||
810 | 810 | ||
811 | void GatewayWidget::hitGatewaySelect( int i ) { | 811 | void GatewayWidget::hitGatewaySelect( int i ) { |
812 | if(i == 0) { | 812 | if(i == 0) { |
813 | gatewayaddr->setText("0.0.0.0"); | 813 | gatewayaddr->setText("0.0.0.0"); |
814 | gatewayaddr->setEnabled(false); | 814 | gatewayaddr->setEnabled(false); |
815 | gate_label->setEnabled(false); | 815 | gate_label->setEnabled(false); |
816 | } | 816 | } |
817 | else { | 817 | else { |
818 | gatewayaddr->setEnabled(true); | 818 | gatewayaddr->setEnabled(true); |
819 | gatewayaddr->setText(""); | 819 | gatewayaddr->setText(""); |
820 | gate_label->setEnabled(true); | 820 | gate_label->setEnabled(true); |
821 | } | 821 | } |
822 | } | 822 | } |
823 | 823 | ||
824 | 824 | ||
825 | 825 | ||
826 | ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) | 826 | ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) |
827 | : QWidget(parent, name) | 827 | : QWidget(parent, name) |
828 | { | 828 | { |
829 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 829 | |
830 | QVBoxLayout *tl = new QVBoxLayout(this, 0 ); | ||
830 | se = new ScriptEdit(this); | 831 | se = new ScriptEdit(this); |
831 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); | 832 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); |
832 | tl->addWidget(se); | 833 | tl->addWidget(se); |
833 | 834 | ||
834 | // insert equal-sized buttons | 835 | // insert equal-sized buttons |
835 | QButtonGroup *bbox = new QButtonGroup(this); | 836 | QHBoxLayout *hl = new QHBoxLayout( this ); |
836 | add = new QPushButton( bbox, i18n("Add") ); | 837 | tl->addLayout( hl ); |
837 | bbox->insert(add); | 838 | add = new QPushButton( i18n("Add"), this ); |
839 | hl->addWidget( add ); | ||
838 | connect(add, SIGNAL(clicked()), SLOT(addButton())); | 840 | connect(add, SIGNAL(clicked()), SLOT(addButton())); |
839 | // bbox->addStretch(1); | 841 | insert = new QPushButton( i18n("Insert"), this ); |
840 | insert = new QPushButton( bbox, i18n("Insert") ); | 842 | hl->addWidget( insert ); |
841 | bbox->insert(insert); | ||
842 | connect(insert, SIGNAL(clicked()), SLOT(insertButton())); | 843 | connect(insert, SIGNAL(clicked()), SLOT(insertButton())); |
843 | // bbox->addStretch(1); | 844 | remove = new QPushButton( i18n("Remove"), this ); |
844 | remove = new QPushButton( bbox, i18n("Remove") ); | 845 | hl->addWidget( remove ); |
845 | bbox->insert(remove); | ||
846 | connect(remove, SIGNAL(clicked()), SLOT(removeButton())); | 846 | connect(remove, SIGNAL(clicked()), SLOT(removeButton())); |
847 | bbox->layout(); | ||
848 | tl->addWidget(bbox); | ||
849 | 847 | ||
850 | QHBoxLayout *l12 = new QHBoxLayout(0); | 848 | QHBoxLayout *l12 = new QHBoxLayout(0); |
851 | tl->addLayout(l12); | 849 | tl->addLayout(l12); |
852 | stl = new QListBox(this); | 850 | stl = new QListBox(this); |
853 | stl->setVScrollBarMode( QScrollView::AlwaysOff ); | 851 | // stl->setVScrollBarMode( QScrollView::AlwaysOff ); |
854 | connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); | 852 | connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); |
855 | stl->setMinimumSize(QSize(70, 140)); | 853 | // stl->setMinimumSize(QSize(70, 140)); |
856 | 854 | ||
857 | sl = new QListBox(this); | 855 | sl = new QListBox(this); |
858 | sl->setVScrollBarMode( QScrollView::AlwaysOff ); | 856 | // sl->setVScrollBarMode( QScrollView::AlwaysOff ); |
859 | connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); | 857 | connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); |
860 | sl->setMinimumSize(QSize(150, 140)); | 858 | // sl->setMinimumSize(QSize(150, 140)); |
861 | 859 | ||
862 | slb = new QScrollBar(this); | 860 | slb = new QScrollBar(this); |
863 | // slb->setFixedWidth(slb->sizeHint().width()); | 861 | // slb->setFixedWidth(slb->sizeHint().width()); |
864 | connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); | 862 | connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); |
865 | 863 | ||
866 | l12->addWidget(stl, 1); | 864 | l12->addWidget(stl, 1); |
867 | l12->addWidget(sl, 3); | 865 | l12->addWidget(sl, 3); |
868 | l12->addWidget(slb, 0); | 866 | l12->addWidget(slb, 0); |
869 | 867 | ||
870 | //load data from gpppdata | 868 | //load data from gpppdata |
871 | if(!isnewaccount) { | 869 | if(!isnewaccount) { |
872 | QStringList &comlist = PPPData::data()->scriptType(); | 870 | QStringList &comlist = PPPData::data()->scriptType(); |
873 | QStringList &arglist = PPPData::data()->script(); | 871 | QStringList &arglist = PPPData::data()->script(); |
874 | QStringList::Iterator itcom = comlist.begin(); | 872 | QStringList::Iterator itcom = comlist.begin(); |
875 | QStringList::Iterator itarg = arglist.begin(); | 873 | QStringList::Iterator itarg = arglist.begin(); |
876 | 874 | ||
877 | for ( ; | 875 | for ( ; |
878 | itcom != comlist.end() && itarg != arglist.end(); | 876 | itcom != comlist.end() && itarg != arglist.end(); |
879 | ++itcom, ++itarg ) | 877 | ++itcom, ++itarg ) |
880 | { | 878 | { |
881 | stl->insertItem(*itcom); | 879 | stl->insertItem(*itcom); |
882 | sl->insertItem(*itarg); | 880 | sl->insertItem(*itarg); |
883 | } | 881 | } |
884 | } | 882 | } |
885 | 883 | ||
886 | insert->setEnabled(false); | 884 | insert->setEnabled(false); |
887 | remove->setEnabled(false); | 885 | remove->setEnabled(false); |
888 | adjustScrollBar(); | 886 | adjustScrollBar(); |
889 | tl->activate(); | 887 | tl->activate(); |
890 | } | 888 | } |
891 | 889 | ||
892 | bool ScriptWidget::check() { | 890 | bool ScriptWidget::check() { |
893 | uint lstart = 0; | 891 | uint lstart = 0; |
894 | uint lend = 0; | 892 | uint lend = 0; |
895 | uint errcnt = 0; | 893 | uint errcnt = 0; |
896 | 894 | ||
897 | if(sl->count() > 0) { | 895 | if(sl->count() > 0) { |
898 | for( uint i=0; i <= sl->count()-1; i++) { | 896 | for( uint i=0; i <= sl->count()-1; i++) { |
899 | if(stl->text(i) == "LoopStart") { | 897 | if(stl->text(i) == "LoopStart") { |
900 | lstart++; | 898 | lstart++; |
901 | } | 899 | } |
902 | if (stl->text(i) == "LoopEnd") { | 900 | if (stl->text(i) == "LoopEnd") { |
903 | lend++; | 901 | lend++; |
904 | } | 902 | } |
905 | if ( lend > lstart ) errcnt++; | 903 | if ( lend > lstart ) errcnt++; |
906 | } | 904 | } |
907 | return ( (errcnt == 0 ) && (lstart == lend) ); | 905 | return ( (errcnt == 0 ) && (lstart == lend) ); |
908 | } | 906 | } |
909 | return true; | 907 | return true; |
910 | } | 908 | } |
911 | 909 | ||
912 | 910 | ||
913 | void ScriptWidget::save() { | 911 | void ScriptWidget::save() { |
914 | QStringList typelist, arglist; | 912 | QStringList typelist, arglist; |
915 | for(uint i=0; i < sl->count(); i++) { | 913 | for(uint i=0; i < sl->count(); i++) { |
916 | typelist.append(stl->text(i)); | 914 | typelist.append(stl->text(i)); |
917 | arglist.append(sl->text(i)); | 915 | arglist.append(sl->text(i)); |
918 | } | 916 | } |
919 | PPPData::data()->setScriptType(typelist); | 917 | PPPData::data()->setScriptType(typelist); |
920 | PPPData::data()->setScript(arglist); | 918 | PPPData::data()->setScript(arglist); |
921 | } | 919 | } |
922 | 920 | ||
923 | 921 | ||
924 | 922 | ||
925 | void ScriptWidget::adjustScrollBar() { | 923 | void ScriptWidget::adjustScrollBar() { |
926 | if((int)sl->count() <= sl->numItemsVisible()) | 924 | if((int)sl->count() <= sl->numItemsVisible()) |
927 | slb->setRange(0, 0); | 925 | slb->setRange(0, 0); |
928 | else | 926 | else |
929 | slb->setRange(0, (sl->count() - sl->numItemsVisible())+1); | 927 | slb->setRange(0, (sl->count() - sl->numItemsVisible())+1); |
930 | } | 928 | } |
931 | 929 | ||
932 | 930 | ||
933 | void ScriptWidget::scrolling(int i) { | 931 | void ScriptWidget::scrolling(int i) { |
934 | sl->setTopItem(i); | 932 | sl->setTopItem(i); |
935 | stl->setTopItem(i); | 933 | stl->setTopItem(i); |
936 | } | 934 | } |
937 | 935 | ||
938 | 936 | ||
939 | void ScriptWidget::slhighlighted(int i) { | 937 | void ScriptWidget::slhighlighted(int i) { |
940 | insert->setEnabled(true); | 938 | insert->setEnabled(true); |
941 | remove->setEnabled(true); | 939 | remove->setEnabled(true); |
942 | stl->setCurrentItem(i); | 940 | stl->setCurrentItem(i); |
943 | } | 941 | } |
944 | 942 | ||
945 | 943 | ||
946 | void ScriptWidget::stlhighlighted(int i) { | 944 | void ScriptWidget::stlhighlighted(int i) { |
947 | insert->setEnabled(true); | 945 | insert->setEnabled(true); |
948 | remove->setEnabled(true); | 946 | remove->setEnabled(true); |
949 | sl->setCurrentItem(i); | 947 | sl->setCurrentItem(i); |
950 | } | 948 | } |
951 | 949 | ||
952 | 950 | ||
953 | void ScriptWidget::addButton() { | 951 | void ScriptWidget::addButton() { |
954 | //don't allow more than the maximum script entries | 952 | //don't allow more than the maximum script entries |
955 | if(sl->count() == MAX_SCRIPT_ENTRIES-1) | 953 | if(sl->count() == MAX_SCRIPT_ENTRIES-1) |
956 | return; | 954 | return; |
957 | 955 | ||
958 | switch(se->type()) { | 956 | switch(se->type()) { |
959 | case ScriptEdit::Expect: | 957 | case ScriptEdit::Expect: |
960 | stl->insertItem("Expect"); | 958 | stl->insertItem("Expect"); |
961 | sl->insertItem(se->text()); | 959 | sl->insertItem(se->text()); |
962 | break; | 960 | break; |
963 | 961 | ||
964 | case ScriptEdit::Send: | 962 | case ScriptEdit::Send: |
965 | stl->insertItem("Send"); | 963 | stl->insertItem("Send"); |
966 | sl->insertItem(se->text()); | 964 | sl->insertItem(se->text()); |
967 | break; | 965 | break; |
968 | 966 | ||
969 | case ScriptEdit::SendNoEcho: | 967 | case ScriptEdit::SendNoEcho: |
970 | stl->insertItem("SendNoEcho"); | 968 | stl->insertItem("SendNoEcho"); |
971 | sl->insertItem(se->text()); | 969 | sl->insertItem(se->text()); |
972 | break; | 970 | break; |
973 | 971 | ||
974 | case ScriptEdit::Pause: | 972 | case ScriptEdit::Pause: |
975 | stl->insertItem("Pause"); | 973 | stl->insertItem("Pause"); |
976 | sl->insertItem(se->text()); | 974 | sl->insertItem(se->text()); |
977 | break; | 975 | break; |
978 | 976 | ||
979 | case ScriptEdit::Hangup: | 977 | case ScriptEdit::Hangup: |
980 | stl->insertItem("Hangup"); | 978 | stl->insertItem("Hangup"); |
981 | sl->insertItem(""); | 979 | sl->insertItem(""); |
982 | break; | 980 | break; |
983 | 981 | ||
984 | case ScriptEdit::Answer: | 982 | case ScriptEdit::Answer: |
985 | stl->insertItem("Answer"); | 983 | stl->insertItem("Answer"); |
986 | sl->insertItem(""); | 984 | sl->insertItem(""); |
987 | break; | 985 | break; |
988 | 986 | ||
989 | case ScriptEdit::Timeout: | 987 | case ScriptEdit::Timeout: |
990 | stl->insertItem("Timeout"); | 988 | stl->insertItem("Timeout"); |
991 | sl->insertItem(se->text()); | 989 | sl->insertItem(se->text()); |
992 | break; | 990 | break; |
993 | 991 | ||
994 | case ScriptEdit::Password: | 992 | case ScriptEdit::Password: |
995 | stl->insertItem("Password"); | 993 | stl->insertItem("Password"); |
996 | sl->insertItem(se->text()); | 994 | sl->insertItem(se->text()); |
997 | break; | 995 | break; |
998 | 996 | ||
999 | case ScriptEdit::ID: | 997 | case ScriptEdit::ID: |
1000 | stl->insertItem("ID"); | 998 | stl->insertItem("ID"); |
1001 | sl->insertItem(se->text()); | 999 | sl->insertItem(se->text()); |
1002 | break; | 1000 | break; |
1003 | 1001 | ||
1004 | case ScriptEdit::Prompt: | 1002 | case ScriptEdit::Prompt: |
1005 | stl->insertItem("Prompt"); | 1003 | stl->insertItem("Prompt"); |
1006 | sl->insertItem(se->text()); | 1004 | sl->insertItem(se->text()); |
1007 | break; | 1005 | break; |
1008 | 1006 | ||
1009 | case ScriptEdit::PWPrompt: | 1007 | case ScriptEdit::PWPrompt: |
1010 | stl->insertItem("PWPrompt"); | 1008 | stl->insertItem("PWPrompt"); |
1011 | sl->insertItem(se->text()); | 1009 | sl->insertItem(se->text()); |
1012 | break; | 1010 | break; |
1013 | 1011 | ||
1014 | case ScriptEdit::LoopStart: | 1012 | case ScriptEdit::LoopStart: |
1015 | stl->insertItem("LoopStart"); | 1013 | stl->insertItem("LoopStart"); |
1016 | sl->insertItem(se->text()); | 1014 | sl->insertItem(se->text()); |
1017 | break; | 1015 | break; |
1018 | 1016 | ||
1019 | case ScriptEdit::LoopEnd: | 1017 | case ScriptEdit::LoopEnd: |
1020 | stl->insertItem("LoopEnd"); | 1018 | stl->insertItem("LoopEnd"); |
1021 | sl->insertItem(se->text()); | 1019 | sl->insertItem(se->text()); |
1022 | break; | 1020 | break; |
1023 | 1021 | ||
1024 | case ScriptEdit::Scan: | 1022 | case ScriptEdit::Scan: |
1025 | stl->insertItem("Scan"); | 1023 | stl->insertItem("Scan"); |
1026 | sl->insertItem(se->text()); | 1024 | sl->insertItem(se->text()); |
1027 | break; | 1025 | break; |
1028 | 1026 | ||
1029 | case ScriptEdit::Save: | 1027 | case ScriptEdit::Save: |
1030 | stl->insertItem("Save"); | 1028 | stl->insertItem("Save"); |
1031 | sl->insertItem(se->text()); | 1029 | sl->insertItem(se->text()); |
1032 | break; | 1030 | break; |
1033 | 1031 | ||
1034 | default: | 1032 | default: |
1035 | break; | 1033 | break; |
1036 | } | 1034 | } |
1037 | 1035 | ||
1038 | //get the scrollbar adjusted, and scroll the list so we can see what | 1036 | //get the scrollbar adjusted, and scroll the list so we can see what |
1039 | //we're adding to | 1037 | //we're adding to |
1040 | adjustScrollBar(); | 1038 | adjustScrollBar(); |
1041 | slb->setValue(slb->maxValue()); | 1039 | slb->setValue(slb->maxValue()); |
1042 | 1040 | ||
1043 | //clear the text in the entry box | 1041 | //clear the text in the entry box |
1044 | se->setText(""); | 1042 | se->setText(""); |
1045 | } | 1043 | } |
1046 | 1044 | ||
1047 | 1045 | ||
1048 | void ScriptWidget::insertButton() { | 1046 | void ScriptWidget::insertButton() { |
1049 | //exit if there is no highlighted item, or we've reached the | 1047 | //exit if there is no highlighted item, or we've reached the |
1050 | //maximum entries in the script list | 1048 | //maximum entries in the script list |
1051 | if(sl->currentItem() < 0 || (sl->count() == MAX_SCRIPT_ENTRIES-1)) | 1049 | if(sl->currentItem() < 0 || (sl->count() == MAX_SCRIPT_ENTRIES-1)) |
1052 | return; | 1050 | return; |
1053 | 1051 | ||
1054 | switch(se->type()) { | 1052 | switch(se->type()) { |
1055 | case ScriptEdit::Expect: | 1053 | case ScriptEdit::Expect: |
1056 | stl->insertItem("Expect", stl->currentItem()); | 1054 | stl->insertItem("Expect", stl->currentItem()); |
1057 | sl->insertItem(se->text(), sl->currentItem()); | 1055 | sl->insertItem(se->text(), sl->currentItem()); |
1058 | break; | 1056 | break; |
1059 | 1057 | ||
1060 | case ScriptEdit::Send: | 1058 | case ScriptEdit::Send: |
1061 | stl->insertItem("Send", stl->currentItem()); | 1059 | stl->insertItem("Send", stl->currentItem()); |
1062 | sl->insertItem(se->text(), sl->currentItem()); | 1060 | sl->insertItem(se->text(), sl->currentItem()); |
1063 | break; | 1061 | break; |
1064 | 1062 | ||
1065 | case ScriptEdit::SendNoEcho: | 1063 | case ScriptEdit::SendNoEcho: |
1066 | stl->insertItem("SendNoEcho", stl->currentItem()); | 1064 | stl->insertItem("SendNoEcho", stl->currentItem()); |
1067 | sl->insertItem(se->text(), sl->currentItem()); | 1065 | sl->insertItem(se->text(), sl->currentItem()); |
1068 | break; | 1066 | break; |
1069 | 1067 | ||
1070 | case ScriptEdit::Pause: | 1068 | case ScriptEdit::Pause: |
1071 | stl->insertItem("Pause", stl->currentItem()); | 1069 | stl->insertItem("Pause", stl->currentItem()); |
1072 | sl->insertItem(se->text(), sl->currentItem()); | 1070 | sl->insertItem(se->text(), sl->currentItem()); |
1073 | break; | 1071 | break; |
1074 | 1072 | ||
1075 | case ScriptEdit::Hangup: | 1073 | case ScriptEdit::Hangup: |
1076 | stl->insertItem("Hangup", stl->currentItem()); | 1074 | stl->insertItem("Hangup", stl->currentItem()); |
1077 | sl->insertItem("", sl->currentItem()); | 1075 | sl->insertItem("", sl->currentItem()); |
1078 | break; | 1076 | break; |
1079 | 1077 | ||
1080 | case ScriptEdit::Answer: | 1078 | case ScriptEdit::Answer: |
1081 | stl->insertItem("Answer", stl->currentItem()); | 1079 | stl->insertItem("Answer", stl->currentItem()); |
1082 | sl->insertItem("", sl->currentItem()); | 1080 | sl->insertItem("", sl->currentItem()); |
1083 | break; | 1081 | break; |
1084 | 1082 | ||
1085 | case ScriptEdit::Timeout: | 1083 | case ScriptEdit::Timeout: |
1086 | stl->insertItem("Timeout", stl->currentItem()); | 1084 | stl->insertItem("Timeout", stl->currentItem()); |
1087 | sl->insertItem(se->text(), sl->currentItem()); | 1085 | sl->insertItem(se->text(), sl->currentItem()); |
1088 | break; | 1086 | break; |
1089 | 1087 | ||
1090 | case ScriptEdit::Password: | 1088 | case ScriptEdit::Password: |
1091 | stl->insertItem("Password", stl->currentItem()); | 1089 | stl->insertItem("Password", stl->currentItem()); |
1092 | sl->insertItem(se->text(), sl->currentItem()); | 1090 | sl->insertItem(se->text(), sl->currentItem()); |
1093 | break; | 1091 | break; |
1094 | 1092 | ||
1095 | case ScriptEdit::ID: | 1093 | case ScriptEdit::ID: |
1096 | stl->insertItem("ID", stl->currentItem()); | 1094 | stl->insertItem("ID", stl->currentItem()); |
1097 | sl->insertItem(se->text(), sl->currentItem()); | 1095 | sl->insertItem(se->text(), sl->currentItem()); |
1098 | break; | 1096 | break; |
1099 | 1097 | ||
1100 | case ScriptEdit::Prompt: | 1098 | case ScriptEdit::Prompt: |
1101 | stl->insertItem("Prompt", stl->currentItem()); | 1099 | stl->insertItem("Prompt", stl->currentItem()); |
1102 | sl->insertItem(se->text(), sl->currentItem()); | 1100 | sl->insertItem(se->text(), sl->currentItem()); |
1103 | break; | 1101 | break; |
1104 | 1102 | ||
1105 | case ScriptEdit::PWPrompt: | 1103 | case ScriptEdit::PWPrompt: |
1106 | stl->insertItem("PWPrompt", stl->currentItem()); | 1104 | stl->insertItem("PWPrompt", stl->currentItem()); |
1107 | sl->insertItem(se->text(), sl->currentItem()); | 1105 | sl->insertItem(se->text(), sl->currentItem()); |
1108 | break; | 1106 | break; |
1109 | 1107 | ||
1110 | case ScriptEdit::LoopStart: | 1108 | case ScriptEdit::LoopStart: |
1111 | stl->insertItem("LoopStart", stl->currentItem()); | 1109 | stl->insertItem("LoopStart", stl->currentItem()); |
1112 | sl->insertItem(se->text(), sl->currentItem()); | 1110 | sl->insertItem(se->text(), sl->currentItem()); |
1113 | break; | 1111 | break; |
1114 | 1112 | ||
1115 | case ScriptEdit::LoopEnd: | 1113 | case ScriptEdit::LoopEnd: |
1116 | stl->insertItem("LoopEnd", stl->currentItem()); | 1114 | stl->insertItem("LoopEnd", stl->currentItem()); |
1117 | sl->insertItem(se->text(), sl->currentItem()); | 1115 | sl->insertItem(se->text(), sl->currentItem()); |
1118 | break; | 1116 | break; |
1119 | 1117 | ||
1120 | case ScriptEdit::Scan: | 1118 | case ScriptEdit::Scan: |
1121 | stl->insertItem("Scan", stl->currentItem()); | 1119 | stl->insertItem("Scan", stl->currentItem()); |
1122 | sl->insertItem(se->text(), sl->currentItem()); | 1120 | sl->insertItem(se->text(), sl->currentItem()); |
1123 | break; | 1121 | break; |
1124 | 1122 | ||
1125 | case ScriptEdit::Save: | 1123 | case ScriptEdit::Save: |
1126 | stl->insertItem("Save", stl->currentItem()); | 1124 | stl->insertItem("Save", stl->currentItem()); |
1127 | sl->insertItem(se->text(), sl->currentItem()); | 1125 | sl->insertItem(se->text(), sl->currentItem()); |
1128 | break; | 1126 | break; |
1129 | 1127 | ||
1130 | default: | 1128 | default: |
1131 | break; | 1129 | break; |
1132 | } | 1130 | } |
1133 | adjustScrollBar(); | 1131 | adjustScrollBar(); |
1134 | se->setText(""); | 1132 | se->setText(""); |
1135 | } | 1133 | } |
1136 | 1134 | ||
1137 | 1135 | ||
1138 | void ScriptWidget::removeButton() { | 1136 | void ScriptWidget::removeButton() { |
1139 | if(sl->currentItem() >= 0) { | 1137 | if(sl->currentItem() >= 0) { |
1140 | int stlc = stl->currentItem(); | 1138 | int stlc = stl->currentItem(); |
1141 | sl->removeItem(sl->currentItem()); | 1139 | sl->removeItem(sl->currentItem()); |
1142 | stl->removeItem(stlc); | 1140 | stl->removeItem(stlc); |
1143 | adjustScrollBar(); | 1141 | adjustScrollBar(); |
1144 | insert->setEnabled(sl->currentItem() != -1); | 1142 | insert->setEnabled(sl->currentItem() != -1); |
1145 | remove->setEnabled(sl->currentItem() != -1); | 1143 | remove->setEnabled(sl->currentItem() != -1); |
1146 | } | 1144 | } |
1147 | } | 1145 | } |
1148 | 1146 | ||
1149 | 1147 | ||
1150 | 1148 | ||
1151 | ///////////////////////////////////////////////////////////////////////////// | 1149 | ///////////////////////////////////////////////////////////////////////////// |
1152 | // | 1150 | // |
1153 | // Used to specify a new phone number | 1151 | // Used to specify a new phone number |
1154 | // | 1152 | // |
1155 | ///////////////////////////////////////////////////////////////////////////// | 1153 | ///////////////////////////////////////////////////////////////////////////// |
1156 | PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) | 1154 | PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) |
1157 | : QDialog(parent,"PhoneNumberDialog",true) { | 1155 | : QDialog(parent,"PhoneNumberDialog",true) |
1156 | { | ||
1158 | setCaption( i18n("Add Phone Number") ); | 1157 | setCaption( i18n("Add Phone Number") ); |
1159 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | ||
1160 | 1158 | ||
1161 | QHBox *hbox = new QHBox(this); | 1159 | |
1160 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
1161 | layout->setSpacing( 3 ); | ||
1162 | layout->setMargin( 3 ); | ||
1163 | |||
1164 | // QHBox *hbox = new QHBox(this); | ||
1162 | // setMainWidget(hbox); | 1165 | // setMainWidget(hbox); |
1163 | 1166 | ||
1164 | hbox->setSpacing( 2 );//KDialog::spacingHint()); | 1167 | // hbox->setSpacing( 2 );//KDialog::spacingHint()); |
1165 | 1168 | ||
1166 | new QLabel(i18n("Enter a phone number:"), hbox); | 1169 | QLabel *label = new QLabel(this, tr("Enter a phone number:")); |
1170 | layout->addWidget( label ); | ||
1167 | 1171 | ||
1168 | le = new QLineEdit(hbox); | 1172 | le = new QLineEdit(this, "lineEdit"); |
1169 | // le->setMinimumWidth(125); | 1173 | layout->addWidget( le ); |
1170 | 1174 | ||
1171 | connect(le, SIGNAL(textChanged(const QString &)), | 1175 | connect(le, SIGNAL(textChanged(const QString &)), |
1172 | this, SLOT(textChanged(const QString &))); | 1176 | this, SLOT(textChanged(const QString &))); |
1173 | 1177 | ||
1174 | le->setFocus(); | 1178 | le->setFocus(); |
1175 | textChanged(""); | 1179 | textChanged(""); |
1176 | 1180 | ||
1177 | // enableButtonSeparator(true); | 1181 | |
1178 | } | 1182 | } |
1179 | 1183 | ||
1180 | 1184 | ||
1181 | QString PhoneNumberDialog::phoneNumber() { | 1185 | QString PhoneNumberDialog::phoneNumber() { |
1182 | QString s = le->text(); | 1186 | QString s = le->text(); |
1183 | 1187 | ||
1184 | return s; | 1188 | return s; |
1185 | } | 1189 | } |
1186 | 1190 | ||
1187 | 1191 | ||
1188 | void PhoneNumberDialog::textChanged(const QString &s) { | 1192 | void PhoneNumberDialog::textChanged(const QString &s) { |
1189 | // enableButtonOK(s.length() > 0); | 1193 | // enableButtonOK(s.length() > 0); |
1190 | } | 1194 | } |
1191 | 1195 | ||
1192 | 1196 | ||
1193 | //#include "edit.moc" | 1197 | //#include "edit.moc" |
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp index b7fca3f..4039939 100644 --- a/noncore/settings/networksettings/ppp/pppdargs.cpp +++ b/noncore/settings/networksettings/ppp/pppdargs.cpp | |||
@@ -1,166 +1,166 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
11 | * | 11 | * |
12 | * | 12 | * |
13 | * This library is free software; you can redistribute it and/or | 13 | * This library is free software; you can redistribute it and/or |
14 | * modify it under the terms of the GNU Library General Public | 14 | * modify it under the terms of the GNU Library General Public |
15 | * License as published by the Free Software Foundation; either | 15 | * License as published by the Free Software Foundation; either |
16 | * version 2 of the License, or (at your option) any later version. | 16 | * version 2 of the License, or (at your option) any later version. |
17 | * | 17 | * |
18 | * This library is distributed in the hope that it will be useful, | 18 | * This library is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 | * Library General Public License for more details. | 21 | * Library General Public License for more details. |
22 | * | 22 | * |
23 | * You should have received a copy of the GNU Library General Public | 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 | 24 | * License along with this program; if not, write to the Free |
25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | //#include <kwin.h> | 30 | //#include <kwin.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include "pppdargs.h" | 32 | #include "pppdargs.h" |
33 | #include "pppdata.h" | 33 | #include "pppdata.h" |
34 | //#include <klocale.h> | 34 | //#include <klocale.h> |
35 | #define i18n QObject::tr | 35 | #define i18n QObject::tr |
36 | 36 | ||
37 | PPPdArguments::PPPdArguments(QWidget *parent, const char *name) | 37 | PPPdArguments::PPPdArguments(QWidget *parent, const char *name) |
38 | : QDialog(parent, name, TRUE) | 38 | : QDialog(parent, name, TRUE) |
39 | { | 39 | { |
40 | setCaption(i18n("Customize pppd Arguments")); | 40 | setCaption(i18n("Customize pppd Arguments")); |
41 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 41 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
42 | QVBoxLayout *l = new QVBoxLayout(this, 10, 10); | 42 | QVBoxLayout *l = new QVBoxLayout(this, 10, 10); |
43 | QHBoxLayout *tl = new QHBoxLayout(10); | 43 | QHBoxLayout *tl = new QHBoxLayout(10); |
44 | l->addLayout(tl); | 44 | l->addLayout(tl); |
45 | QVBoxLayout *l1 = new QVBoxLayout(); | 45 | QVBoxLayout *l1 = new QVBoxLayout(); |
46 | QVBoxLayout *l2 = new QVBoxLayout(); | 46 | QVBoxLayout *l2 = new QVBoxLayout(); |
47 | tl->addLayout(l1, 1); | 47 | tl->addLayout(l1, 1); |
48 | tl->addLayout(l2, 0); | 48 | tl->addLayout(l2, 0); |
49 | 49 | ||
50 | QHBoxLayout *l11 = new QHBoxLayout(10); | 50 | QHBoxLayout *l11 = new QHBoxLayout(10); |
51 | l1->addLayout(l11); | 51 | l1->addLayout(l11); |
52 | 52 | ||
53 | argument_label = new QLabel(i18n("Argument:"), this); | 53 | argument_label = new QLabel(i18n("Argument:"), this); |
54 | l11->addWidget(argument_label); | 54 | l11->addWidget(argument_label); |
55 | 55 | ||
56 | argument = new QLineEdit(this); | 56 | argument = new QLineEdit(this); |
57 | connect(argument, SIGNAL(returnPressed()), | 57 | connect(argument, SIGNAL(returnPressed()), |
58 | SLOT(addbutton())); | 58 | SLOT(addbutton())); |
59 | l11->addWidget(argument); | 59 | l11->addWidget(argument); |
60 | connect(argument, SIGNAL(textChanged(const QString &)), | 60 | connect(argument, SIGNAL(textChanged(const QString &)), |
61 | this, SLOT(textChanged(const QString &))); | 61 | this, SLOT(textChanged(const QString &))); |
62 | 62 | ||
63 | arguments = new QListBox(this); | 63 | arguments = new QListBox(this); |
64 | arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); | 64 | arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); |
65 | connect(arguments, SIGNAL(highlighted(int)), | 65 | connect(arguments, SIGNAL(highlighted(int)), |
66 | this, SLOT(itemSelected(int))); | 66 | this, SLOT(itemSelected(int))); |
67 | l1->addWidget(arguments, 1); | 67 | l1->addWidget(arguments, 1); |
68 | 68 | ||
69 | add = new QPushButton(i18n("Add"), this); | 69 | add = new QPushButton(i18n("Add"), this); |
70 | connect(add, SIGNAL(clicked()), SLOT(addbutton())); | 70 | connect(add, SIGNAL(clicked()), SLOT(addbutton())); |
71 | l2->addWidget(add); | 71 | l2->addWidget(add); |
72 | l2->addStretch(1); | 72 | l2->addStretch(1); |
73 | 73 | ||
74 | remove = new QPushButton(i18n("Remove"), this); | 74 | remove = new QPushButton(i18n("Remove"), this); |
75 | connect(remove, SIGNAL(clicked()), SLOT(removebutton())); | 75 | connect(remove, SIGNAL(clicked()), SLOT(removebutton())); |
76 | l2->addWidget(remove); | 76 | l2->addWidget(remove); |
77 | 77 | ||
78 | defaults = new QPushButton(i18n("Defaults"), this); | 78 | defaults = new QPushButton(i18n("Defaults"), this); |
79 | connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); | 79 | connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); |
80 | l2->addWidget(defaults); | 80 | l2->addWidget(defaults); |
81 | 81 | ||
82 | l->addSpacing(5); | 82 | l->addSpacing(5); |
83 | 83 | ||
84 | QButtonGroup *bbox = new QButtonGroup(this); | 84 | // QButtonGroup *bbox = new QButtonGroup(this); |
85 | // bbox->addStretch(1); | 85 | // // bbox->addStretch(1); |
86 | closebtn = new QPushButton( bbox, i18n("OK")); | 86 | // closebtn = new QPushButton( bbox, i18n("OK")); |
87 | bbox->insert(closebtn); | 87 | // bbox->insert(closebtn); |
88 | connect(closebtn, SIGNAL(clicked()), SLOT(closebutton())); | 88 | // connect(closebtn, SIGNAL(clicked()), SLOT(closebutton())); |
89 | QPushButton *cancel = new QPushButton( bbox, i18n("Cancel")); | 89 | // QPushButton *cancel = new QPushButton( bbox, i18n("Cancel")); |
90 | bbox->insert(cancel); | 90 | // bbox->insert(cancel); |
91 | connect(cancel, SIGNAL(clicked()), | 91 | // connect(cancel, SIGNAL(clicked()), |
92 | this, SLOT(reject())); | 92 | // this, SLOT(reject())); |
93 | bbox->layout(); | 93 | // bbox->layout(); |
94 | l->addWidget(bbox); | 94 | // l->addWidget(bbox); |
95 | 95 | ||
96 | setFixedSize(sizeHint()); | 96 | // setFixedSize(sizeHint()); |
97 | 97 | ||
98 | //load info from gpppdata | 98 | //load info from gpppdata |
99 | init(); | 99 | init(); |
100 | 100 | ||
101 | add->setEnabled(false); | 101 | add->setEnabled(false); |
102 | remove->setEnabled(false); | 102 | remove->setEnabled(false); |
103 | argument->setFocus(); | 103 | argument->setFocus(); |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | void PPPdArguments::addbutton() { | 107 | void PPPdArguments::addbutton() { |
108 | if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { | 108 | if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { |
109 | arguments->insertItem(argument->text()); | 109 | arguments->insertItem(argument->text()); |
110 | argument->setText(""); | 110 | argument->setText(""); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | ||
115 | void PPPdArguments::removebutton() { | 115 | void PPPdArguments::removebutton() { |
116 | if(arguments->currentItem() >= 0) | 116 | if(arguments->currentItem() >= 0) |
117 | arguments->removeItem(arguments->currentItem()); | 117 | arguments->removeItem(arguments->currentItem()); |
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | void PPPdArguments::defaultsbutton() { | 121 | void PPPdArguments::defaultsbutton() { |
122 | // all of this is a hack | 122 | // all of this is a hack |
123 | // save current list | 123 | // save current list |
124 | QStringList arglist(PPPData::data()->pppdArgument()); | 124 | QStringList arglist(PPPData::data()->pppdArgument()); |
125 | 125 | ||
126 | // get defaults | 126 | // get defaults |
127 | PPPData::data()->setpppdArgumentDefaults(); | 127 | PPPData::data()->setpppdArgumentDefaults(); |
128 | init(); | 128 | init(); |
129 | 129 | ||
130 | // restore old list | 130 | // restore old list |
131 | PPPData::data()->setpppdArgument(arglist); | 131 | PPPData::data()->setpppdArgument(arglist); |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | void PPPdArguments::closebutton() { | 135 | void PPPdArguments::closebutton() { |
136 | QStringList arglist; | 136 | QStringList arglist; |
137 | for(uint i=0; i < arguments->count(); i++) | 137 | for(uint i=0; i < arguments->count(); i++) |
138 | arglist.append(arguments->text(i)); | 138 | arglist.append(arguments->text(i)); |
139 | PPPData::data()->setpppdArgument(arglist); | 139 | PPPData::data()->setpppdArgument(arglist); |
140 | 140 | ||
141 | done(0); | 141 | done(0); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | void PPPdArguments::init() { | 145 | void PPPdArguments::init() { |
146 | while(arguments->count()) | 146 | while(arguments->count()) |
147 | arguments->removeItem(0); | 147 | arguments->removeItem(0); |
148 | 148 | ||
149 | QStringList &arglist = PPPData::data()->pppdArgument(); | 149 | QStringList &arglist = PPPData::data()->pppdArgument(); |
150 | for ( QStringList::Iterator it = arglist.begin(); | 150 | for ( QStringList::Iterator it = arglist.begin(); |
151 | it != arglist.end(); | 151 | it != arglist.end(); |
152 | ++it ) | 152 | ++it ) |
153 | arguments->insertItem(*it); | 153 | arguments->insertItem(*it); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | void PPPdArguments::textChanged(const QString &s) { | 157 | void PPPdArguments::textChanged(const QString &s) { |
158 | add->setEnabled(s.length() > 0); | 158 | add->setEnabled(s.length() > 0); |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void PPPdArguments::itemSelected(int idx) { | 162 | void PPPdArguments::itemSelected(int idx) { |
163 | remove->setEnabled(idx != -1); | 163 | remove->setEnabled(idx != -1); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||