summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/TODO1
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp375
-rw-r--r--noncore/settings/networksettings/ppp/accounts.h58
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp164
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp2
5 files changed, 242 insertions, 358 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO
index 1136c2d..9425628 100644
--- a/noncore/settings/networksettings/ppp/TODO
+++ b/noncore/settings/networksettings/ppp/TODO
@@ -1,7 +1,8 @@
1- add possibility to input username and password ;) 1- add possibility to input username and password ;)
2- impl. PPPData::copyaccount & PPPData::deleteAccount 2- impl. PPPData::copyaccount & PPPData::deleteAccount
3- update modem attribute inputs when modem has changed 3- update modem attribute inputs when modem has changed
4- fix layout of edit account 4- fix layout of edit account
5- save pppd arguments in edit account 5- save pppd arguments in edit account
6- popup configure modem with the correct account prselected 6- popup configure modem with the correct account prselected
7 not quite shure why it does not work... IMHO it should work 7 not quite shure why it does not work... IMHO it should work
8- remove interfaces
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index 3fa2f84..f704c84 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -1,469 +1,384 @@
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 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public 13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either 14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version. 15 * version 2 of the License, or (at your option) any later version.
16 * 16 *
17 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details. 20 * Library General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU Library General Public 22 * You should have received a copy of the GNU Library General Public
23 * License along with this program; if not, write to the Free 23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 25 */
26 26
27#include <qdir.h> 27#include <qdir.h>
28#include <stdlib.h> 28#include <stdlib.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31#include <qtabdialog.h> 31#include <qtabdialog.h>
32#include <qwhatsthis.h> 32#include <qwhatsthis.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34 34
35#include <qapplication.h> 35#include <qapplication.h>
36#include <qbuttongroup.h> 36#include <qbuttongroup.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38//#include <klocale.h>
39#define i18n QObject::tr
40//#include <kglobal.h>
41//#include <kwin.h>
42//#include <kdialogbase.h>
43#include <qvgroupbox.h> 38#include <qvgroupbox.h>
44 39
45#include "pppdata.h" 40#include "pppdata.h"
46#include "accounts.h" 41#include "accounts.h"
47//#include "accounting.h"
48//#include "providerdb.h"
49#include "edit.h" 42#include "edit.h"
50 43
51void parseargs(char* buf, char** args); 44void parseargs(char* buf, char** args);
52 45
53AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) 46AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
54 : QWidget( parent, name ), _pppdata(pd) 47 : QWidget( parent, name ), _pppdata(pd)
55{ 48{
56 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 49 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
57 accountlist_l = new QListBox(this); 50 accountlist_l = new QListBox(this);
58 51
59 connect(accountlist_l, SIGNAL(highlighted(int)), 52 connect(accountlist_l, SIGNAL(highlighted(int)),
60 this, SLOT(slotListBoxSelect(int))); 53 this, SLOT(slotListBoxSelect(int)));
61 connect(accountlist_l, SIGNAL(selected(int)), 54 connect(accountlist_l, SIGNAL(selected(int)),
62 this, SLOT(editaccount())); 55 this, SLOT(editaccount()));
63 l1->addWidget(accountlist_l, 10); 56 l1->addWidget(accountlist_l, 10);
64 57
65 edit_b = new QPushButton(i18n("&Edit..."), this); 58 edit_b = new QPushButton(tr("&Edit..."), this);
66 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount())); 59 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount()));
67 QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account")); 60 QWhatsThis::add(edit_b, tr("Allows you to modify the selected account"));
68 l1->addWidget(edit_b); 61 l1->addWidget(edit_b);
69 62
70 new_b = new QPushButton(i18n("&New..."), this); 63 new_b = new QPushButton(tr("&New..."), this);
71 connect(new_b, SIGNAL(clicked()), SLOT(newaccount())); 64 connect(new_b, SIGNAL(clicked()), SLOT(newaccount()));
72 l1->addWidget(new_b); 65 l1->addWidget(new_b);
73 QWhatsThis::add(new_b, i18n("Create a new dialup connection\n" 66 QWhatsThis::add(new_b, tr("Create a new dialup connection\n"
74 "to the Internet")); 67 "to the Internet"));
75 68
76 copy_b = new QPushButton(i18n("Co&py"), this); 69 copy_b = new QPushButton(tr("Co&py"), this);
77 connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount())); 70 connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount()));
78 l1->addWidget(copy_b); 71 l1->addWidget(copy_b);
79 QWhatsThis::add(copy_b, 72 QWhatsThis::add(copy_b,
80 i18n("Makes a copy of the selected account. All\n" 73 tr("Makes a copy of the selected account. All\n"
81 "settings of the selected account are copied\n" 74 "settings of the selected account are copied\n"
82 "to a new account, that you can modify to fit your\n" 75 "to a new account, that you can modify to fit your\n"
83 "needs")); 76 "needs"));
84 77
85 delete_b = new QPushButton(i18n("De&lete"), this); 78 delete_b = new QPushButton(tr("De&lete"), this);
86 connect(delete_b, SIGNAL(clicked()), SLOT(deleteaccount())); 79 connect(delete_b, SIGNAL(clicked()), SLOT(deleteaccount()));
87 l1->addWidget(delete_b); 80 l1->addWidget(delete_b);
88 QWhatsThis::add(delete_b, 81 QWhatsThis::add(delete_b,
89 i18n("<p>Deletes the selected account\n\n" 82 tr("<p>Deletes the selected account\n\n"
90 "<font color=\"red\"><b>Use with care!</b></font>")); 83 "<font color=\"red\"><b>Use with care!</b></font>"));
91 84
92 QHBoxLayout *l12 = new QHBoxLayout; 85 QHBoxLayout *l12 = new QHBoxLayout;
93 l1->addStretch(1); 86 l1->addStretch(1);
94 l1->addLayout(l12); 87 l1->addLayout(l12);
95 88
96// QVBoxLayout *l121 = new QVBoxLayout;
97// l12->addLayout(l121);
98// l121->addStretch(1);
99 // costlabel = new QLabel(i18n("Phone costs:"), parent);
100// costlabel->setEnabled(FALSE);
101// l121->addWidget(costlabel);
102
103// costedit = new QLineEdit(parent);
104// costedit->setFocusPolicy(QWidget::NoFocus);
105// costedit->setFixedHeight(costedit->sizeHint().height());
106// costedit->setEnabled(FALSE);
107// l121->addWidget(costedit);
108// l121->addStretch(1);
109// QString tmp = i18n("<p>This shows the accumulated phone costs\n"
110 // "for the selected account.\n"
111 // "\n"
112 // "<b>Important</b>: If you have more than one \n"
113 // "account - beware, this is <b>NOT</b> the sum \n"
114 // "of the phone costs of all your accounts!");
115// QWhatsThis::add(costlabel, tmp);
116// QWhatsThis::add(costedit, tmp);
117
118// vollabel = new QLabel(i18n("Volume:"), parent);
119// vollabel->setEnabled(FALSE);
120// l121->addWidget(vollabel);
121
122// voledit = new QLineEdit(parent,"voledit");
123// voledit->setFocusPolicy(QWidget::NoFocus);
124// voledit->setFixedHeight(voledit->sizeHint().height());
125// voledit->setEnabled(FALSE);
126// l121->addWidget(voledit);
127// tmp = i18n("<p>This shows the number of bytes transferred\n"
128 // "for the selected account (not for all of your\n"
129 // "accounts. You can select what to display in\n"
130 // "the accounting dialog.\n"
131 // "\n"
132 // "<a href=\"#volaccounting\">More on volume accounting</a>");
133
134// QWhatsThis::add(vollabel,tmp);
135// QWhatsThis::add(voledit, tmp);
136
137// QVBoxLayout *l122 = new QVBoxLayout;
138// l12->addStretch(1);
139// l12->addLayout(l122);
140
141// l122->addStretch(1);
142// reset = new QPushButton(i18n("&Reset..."), parent);
143// reset->setEnabled(FALSE);
144// connect(reset, SIGNAL(clicked()),
145 // this, SLOT(resetClicked()));
146// l122->addWidget(reset);
147
148// log = new QPushButton(i18n("&View Logs"), this);
149// connect(log, SIGNAL(clicked()),
150 // this, SLOT(viewLogClicked()));
151// l122->addWidget(log);
152// l122->addStretch(1);
153
154 //load up account list from gppdata to the list box 89 //load up account list from gppdata to the list box
155 if(_pppdata->count() > 0) { 90 if(_pppdata->count() > 0) {
156 for(int i=0; i <= _pppdata->count()-1; i++) { 91 for(int i=0; i <= _pppdata->count()-1; i++) {
157 _pppdata->setAccountbyIndex(i); 92 _pppdata->setAccountbyIndex(i);
158 accountlist_l->insertItem(_pppdata->accname()); 93 accountlist_l->insertItem(_pppdata->accname());
159 } 94 }
160 } 95 }
161 96
162// slotListBoxSelect(accountlist_l->currentItem()); 97
163 qDebug("setting listview index to %i",_pppdata->currentAccountID() ); 98 qDebug("setting listview index to %i",_pppdata->currentAccountID() );
164 accountlist_l->setCurrentItem( _pppdata->currentAccountID() ); 99 accountlist_l->setCurrentItem( _pppdata->currentAccountID() );
165// slotListBoxSelect( _pppdata->currentAccountID()); 100 slotListBoxSelect( _pppdata->currentAccountID());
166 101
167 l1->activate(); 102 l1->activate();
168} 103}
169 104
170 105
171 106
172void AccountWidget::slotListBoxSelect(int idx) { 107void AccountWidget::slotListBoxSelect(int idx) {
173 delete_b->setEnabled((bool)(idx != -1)); 108 delete_b->setEnabled((bool)(idx != -1));
174 edit_b->setEnabled((bool)(idx != -1)); 109 edit_b->setEnabled((bool)(idx != -1));
175 copy_b->setEnabled((bool)(idx != -1)); 110 copy_b->setEnabled((bool)(idx != -1));
176 if(idx!=-1) { 111 if(idx!=-1) {
177 qDebug("setting account to %i", idx); 112 qDebug("setting account to %i", idx);
178 QString account = _pppdata->accname(); 113 QString account = _pppdata->accname();
179 _pppdata->setAccountbyIndex(accountlist_l->currentItem()); 114 _pppdata->setAccountbyIndex(accountlist_l->currentItem());
180 // _pppdata->setAccount(account); 115 // _pppdata->setAccount(account);
181 } 116 }
182} 117}
183 118
184 119
185// void AccountWidget::viewLogClicked(){ 120// void AccountWidget::viewLogClicked(){
186 121
187// QApplication::flushX(); 122// QApplication::flushX();
188// if(fork() == 0) { 123// if(fork() == 0) {
189// setgid(getgid()); 124// setgid(getgid());
190// setuid(getuid()); 125// setuid(getuid());
191// system("kppplogview -kppp"); 126// system("kppplogview -kppp");
192// _exit(0); 127// _exit(0);
193// } 128// }
194// } 129// }
195 130
196 131
197// void AccountWidget::resetClicked(){ 132// void AccountWidget::resetClicked(){
198// if(accountlist_l->currentItem() == -1) 133// if(accountlist_l->currentItem() == -1)
199// return; 134// return;
200 135
201// // QueryReset dlg(this); 136// // QueryReset dlg(this);
202// // int what = dlg.exec(); 137// // int what = dlg.exec();
203 138
204// // if(what && QueryReset::COSTS) { 139// // if(what && QueryReset::COSTS) {
205// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem())); 140// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem()));
206// // costedit->setText("0"); 141// // costedit->setText("0");
207// // } 142// // }
208 143
209// // if(what && QueryReset::VOLUME) { 144// // if(what && QueryReset::VOLUME) {
210// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem())); 145// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem()));
211// // voledit->setText(prettyPrintVolume(0)); 146// // voledit->setText(prettyPrintVolume(0));
212// // } 147// // }
213// } 148// }
214 149
215 150
216void AccountWidget::editaccount() { 151void AccountWidget::editaccount() {
217 _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem())); 152 _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem()));
218 153
219 int result = doTab(); 154 int result = doTab();
220 155
221 if(result == QDialog::Accepted) { 156 if(result == QDialog::Accepted) {
222 accountlist_l->changeItem(_pppdata->accname(),accountlist_l->currentItem()); 157 accountlist_l->changeItem(_pppdata->accname(),accountlist_l->currentItem());
223// emit resetaccounts(); 158// emit resetaccounts();
224 _pppdata->save(); 159 _pppdata->save();
225 } 160 }
226} 161}
227 162
228 163
229void AccountWidget::newaccount() { 164void AccountWidget::newaccount() {
230 if(accountlist_l->count() == MAX_ACCOUNTS) {
231 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached."));
232 return;
233 }
234 165
235 int result; 166 if(accountlist_l->count() == MAX_ACCOUNTS) {
236// int query = QMessageBox::information(this, 167 QMessageBox::information(this, "sorry",
237// i18n("Do you want to use the wizard to create the new account or the " 168 tr("Maximum number of accounts reached."));
238 // "standard, dialog-based setup?\n" 169 return;
239 // "The wizard is easier and sufficient in most cases. If you need " 170 }
240 // "very special settings, you might want to try the standard, " 171
241 // "dialog-based setup."), 172 int result;
242 // i18n("Create New Account"), 173 if (_pppdata->newaccount() == -1){
243 // i18n("Wizard"), i18n("Dialog Setup"), i18n("Cancel")); 174 qDebug("_pppdata->newaccount() == -1");
244 175 return;
245// switch(query) { 176 }
246// case QMessageBox::Yes:
247// {
248// if (_pppdata->newaccount() == -1)
249 // return;
250// // ProviderDB pdb(this);
251// // result = pdb.exec();
252// break;
253// }
254// case QMessageBox::No:
255 if (_pppdata->newaccount() == -1){
256 qDebug("_pppdata->newaccount() == -1");
257 return;
258 }
259 result = doTab(); 177 result = doTab();
260// break;
261// default:
262// return;
263// }
264 178
265 if(result == QDialog::Accepted) { 179 if(result == QDialog::Accepted) {
266 accountlist_l->insertItem(_pppdata->accname()); 180 accountlist_l->insertItem(_pppdata->accname());
267 accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()), 181 accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),true);
268 true); 182
269// emit resetaccounts(); 183 _pppdata->save();
270 _pppdata->save(); 184 } else
271 } else 185 _pppdata->deleteAccount();
272 _pppdata->deleteAccount();
273} 186}
274 187
275 188
276void AccountWidget::copyaccount() { 189void AccountWidget::copyaccount() {
277 if(accountlist_l->count() == MAX_ACCOUNTS) { 190 if(accountlist_l->count() == MAX_ACCOUNTS) {
278 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached.")); 191 QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
279 return; 192 return;
280 } 193 }
281 194
282 if(accountlist_l->currentItem()<0) { 195 if(accountlist_l->currentItem()<0) {
283 QMessageBox::information(this, "sorry", i18n("No account selected.")); 196 QMessageBox::information(this, "sorry", tr("No account selected."));
284 return; 197 return;
285 } 198 }
286 199
287 _pppdata->copyaccount(accountlist_l->currentItem()); 200 _pppdata->copyaccount(accountlist_l->currentItem());
288 201
289 accountlist_l->insertItem(_pppdata->accname()); 202 accountlist_l->insertItem(_pppdata->accname());
290// emit resetaccounts(); 203// emit resetaccounts();
291 _pppdata->save(); 204 _pppdata->save();
292} 205}
293 206
294 207
295void AccountWidget::deleteaccount() { 208void AccountWidget::deleteaccount() {
296 209
297 QString s = i18n("Are you sure you want to delete\nthe account \"%1\"?") 210 QString s = tr("Are you sure you want to delete\nthe account \"%1\"?")
298 .arg(accountlist_l->text(accountlist_l->currentItem())); 211 .arg(accountlist_l->text(accountlist_l->currentItem()));
299 212
300 if(QMessageBox::warning(this, s, i18n("Confirm")) != QMessageBox::Yes) 213 if(QMessageBox::warning(this, s, tr("Confirm")) != QMessageBox::Yes)
301 return; 214 return;
302 215
303 if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) 216 if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem())))
304 accountlist_l->removeItem(accountlist_l->currentItem()); 217 accountlist_l->removeItem(accountlist_l->currentItem());
305 218
306 emit resetaccounts(); 219 emit resetaccounts();
307 _pppdata->save(); 220 _pppdata->save();
308 221
309 slotListBoxSelect(accountlist_l->currentItem()); 222 slotListBoxSelect(accountlist_l->currentItem());
310 223
311} 224}
312 225
313 226
314int AccountWidget::doTab(){ 227int AccountWidget::doTab(){
315 QDialog *dlg = new QDialog( this, "newAccount", true ); 228 QDialog *dlg = new QDialog( 0, "newAccount", true );
316 QVBoxLayout *layout = new QVBoxLayout( dlg ); 229 QVBoxLayout *layout = new QVBoxLayout( dlg );
317 layout->setSpacing( 0 ); 230 layout->setSpacing( 0 );
318 layout->setMargin( 1 ); 231 layout->setMargin( 1 );
319 232
320 tabWindow = new QTabWidget( dlg, "tabWindow" ); 233 tabWindow = new QTabWidget( dlg, "tabWindow" );
321 layout->addWidget( tabWindow ); 234 layout->addWidget( tabWindow );
322 235
323 bool isnewaccount; 236 bool isnewaccount;
324 237
325 if(_pppdata->accname().isEmpty()) { 238 if(_pppdata->accname().isEmpty()) {
326 dlg->setCaption(i18n("New Account")); 239 dlg->setCaption(tr("New Account"));
327 isnewaccount = true; 240 isnewaccount = true;
328 } else { 241 } else {
329 QString tit = i18n("Edit Account: "); 242 QString tit = tr("Edit Account: ");
330 tit += _pppdata->accname(); 243 tit += _pppdata->accname();
331 dlg->setCaption(tit); 244 dlg->setCaption(tit);
332 isnewaccount = false; 245 isnewaccount = false;
333 } 246 }
334
335 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup");
336 tabWindow->addTab( dial_w, i18n("Dial") );
337 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, i18n("IP Setup"));
338 tabWindow->addTab( ip_w, i18n("IP") );
339 gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, i18n("Gateway Setup"));
340 tabWindow->addTab( gateway_w, i18n("Gateway") );
341 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, i18n("DNS Servers") );
342 tabWindow->addTab( dns_w, i18n("DNS") );
343 script_w = new ScriptWidget( _pppdata, tabWindow, isnewaccount, i18n("Edit Login Script"));
344 tabWindow->addTab( script_w, i18n("Login Script") );
345 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, i18n("Execute Programs"));
346 tabWindow->addTab( exec_w, i18n("Execute") );
347// acct = new AccountingSelector( tabWindow, isnewaccount );
348// tabWindow->addTab( acct, i18n("Accounting"));
349
350 int result = 0;
351 bool ok = false;
352 qDebug("AccountWidget::doTab dlg->showMinimized");
353 dlg->showMinimized();
354 while (!ok){
355
356 result = dlg->exec();
357 ok = true;
358 247
359 if(result == QDialog::Accepted) { 248// // DIAL WIDGET
360 if (script_w->check()) { 249 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup");
361 if(dial_w->save()) { 250 tabWindow->addTab( dial_w, tr("Dial") );
362 ip_w->save(); 251
363 dns_w->save(); 252// // IP WIDGET
364 gateway_w->save(); 253 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup"));
365 script_w->save(); 254 tabWindow->addTab( ip_w, tr("IP") );
366 exec_w->save(); 255
367 // acct->save(); 256// // GATEWAY WIDGET
368 } else { 257 gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup"));
369 QMessageBox::critical(this, "error", i18n( "You must enter a unique\n" 258 tabWindow->addTab( gateway_w, tr("Gateway") );
370 "account name")); 259
371 ok = false; 260// // DNS WIDGET
372 } 261 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") );
373 } else { 262 tabWindow->addTab( dns_w, tr("DNS") );
374 QMessageBox::critical(this, "error", i18n("Login script has unbalanced " 263
375 "loop Start/End")); 264// // SCRIPT WIDGET
376 ok = false; 265 script_w = new ScriptWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script"));
377 } 266 tabWindow->addTab( script_w, tr("Login Script") );
267
268// // EXECUTE WIDGET
269 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs"));
270 tabWindow->addTab( exec_w, tr("Execute") );
271
272 int result = 0;
273 bool ok = false;
274
275 while (!ok){
276 // dlg->showMinimized();
277 result = dlg->exec();
278 ok = true;
279
280 if(result == QDialog::Accepted) {
281 if (!script_w->check()){
282 QMessageBox::critical(this, "error", tr("<qt>Login script has unbalanced loop Start/End<qt>"));
283 ok = false;
284 } else if(!dial_w->save()) {
285 QMessageBox::critical(this, "error", tr( "You must enter a unique account name"));
286 ok = false;
287 }else{
288 ip_w->save();
289 dns_w->save();
290 gateway_w->save();
291 script_w->save();
292 exec_w->save();
293 }
294 }
378 } 295 }
379 }
380 296
381 delete tabWindow; 297 delete dlg;
382 return result; 298
299 return result;
383} 300}
384 301
385 302
386QString AccountWidget::prettyPrintVolume(unsigned int n) { 303QString AccountWidget::prettyPrintVolume(unsigned int n) {
387 int idx = 0; 304 int idx = 0;
388 const QString quant[] = {i18n("Byte"), i18n("KB"), 305 const QString quant[] = {tr("Byte"), tr("KB"),
389 i18n("MB"), i18n("GB"), QString::null}; 306 tr("MB"), tr("GB"), QString::null};
390 307
391 float n1 = n; 308 float n1 = n;
392 while(n >= 1024 && quant[idx] != QString::null) { 309 while(n >= 1024 && quant[idx] != QString::null) {
393 idx++; 310 idx++;
394 n /= 1024; 311 n /= 1024;
395 } 312 }
396 313
397 int i = idx; 314 int i = idx;
398 while(i--) 315 while(i--)
399 n1 = n1 / 1024.0; 316 n1 = n1 / 1024.0;
400 317
401 QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); 318 QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 );
402 s += " " + quant[idx]; 319 s += " " + quant[idx];
403 return s; 320 return s;
404} 321}
405 322
406 323
407///////////////////////////////////////////////////////////////////////////// 324/////////////////////////////////////////////////////////////////////////////
408// 325//
409// Queries the user what to reset: costs, volume or both 326// Queries the user what to reset: costs, volume or both
410// 327//
411///////////////////////////////////////////////////////////////////////////// 328/////////////////////////////////////////////////////////////////////////////
412QueryReset::QueryReset(QWidget *parent) : QDialog(parent, 0, true) { 329// QueryReset::QueryReset(QWidget *parent) : QDialog(parent, 0, true) {
413// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 330// // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
414 setCaption(i18n("Reset Accounting")); 331// setCaption(tr("Reset Accounting"));
415 332
416 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 333// QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
417 QVGroupBox *f = new QVGroupBox(i18n("What to Reset"), this); 334// QVGroupBox *f = new QVGroupBox(tr("What to Reset"), this);
418 335
419 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 336// QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
420// costs = new QCheckBox(i18n("Reset the accumulated phone costs"), f); 337// // costs = new QCheckBox(tr("Reset the accumulated phone costs"), f);
421// costs->setChecked(true); 338// // costs->setChecked(true);
422// l1->addWidget(costs); 339// // l1->addWidget(costs);
423// QWhatsThis::add(costs, i18n("Check this to set the phone costs\n" 340// // QWhatsThis::add(costs, tr("Check this to set the phone costs\n"
424 // "to zero. Typically you'll want to\n" 341 // // "to zero. Typically you'll want to\n"
425 // "do this once a month.")); 342 // // "do this once a month."));
426 343
427// volume = new QCheckBox(i18n("Reset volume accounting"), f); 344// // volume = new QCheckBox(tr("Reset volume accounting"), f);
428// volume->setChecked(true); 345// // volume->setChecked(true);
429// l1->addWidget(volume); 346// // l1->addWidget(volume);
430// QWhatsThis::add(volume, i18n("Check this to set the volume accounting\n" 347// // QWhatsThis::add(volume, tr("Check this to set the volume accounting\n"
431 // "to zero. Typically you'll want to do this\n" 348 // // "to zero. Typically you'll want to do this\n"
432 // "once a month.")); 349 // // "once a month."));
433 350
434 l1->activate(); 351// l1->activate();
352
353// // this activates the f-layout and sets minimumSize()
354// f->show();
355
356// tl->addWidget(f);
357
358// QButtonGroup *bbox = new QButtonGroup(this);
359// // bbox->addStretch(1);
360// QPushButton *ok = new QPushButton( bbox, tr("OK") );
361// bbox->insert(ok);
362// ok->setDefault(true);
363// QPushButton *cancel = new QPushButton( bbox, tr("Cancel") );
364// bbox->insert(cancel);
365
366// connect(ok, SIGNAL(clicked()),
367 // this, SLOT(accepted()));
368// connect(cancel, SIGNAL(clicked()),
369 // this, SLOT(reject()));
370
371// bbox->layout();
372// tl->addWidget(bbox);
435 373
436 // this activates the f-layout and sets minimumSize() 374// }
437 f->show();
438
439 tl->addWidget(f);
440
441 QButtonGroup *bbox = new QButtonGroup(this);
442// bbox->addStretch(1);
443 QPushButton *ok = new QPushButton( bbox, i18n("OK") );
444 bbox->insert(ok);
445 ok->setDefault(true);
446 QPushButton *cancel = new QPushButton( bbox, i18n("Cancel") );
447 bbox->insert(cancel);
448
449 connect(ok, SIGNAL(clicked()),
450 this, SLOT(accepted()));
451 connect(cancel, SIGNAL(clicked()),
452 this, SLOT(reject()));
453
454 bbox->layout();
455 tl->addWidget(bbox);
456
457 // TODO: activate if KGroupBox is fixed
458 // setFixedSize(sizeHint());
459}
460 375
461 376
462void QueryReset::accepted() { 377// void QueryReset::accepted() {
463 int result = costs->isChecked() ? COSTS : 0; 378// int result = costs->isChecked() ? COSTS : 0;
464 result += volume->isChecked() ? VOLUME : 0; 379// result += volume->isChecked() ? VOLUME : 0;
465 380
466 done(result); 381// done(result);
467} 382// }
468 383
469 384
diff --git a/noncore/settings/networksettings/ppp/accounts.h b/noncore/settings/networksettings/ppp/accounts.h
index 5e8509d..eae3922 100644
--- a/noncore/settings/networksettings/ppp/accounts.h
+++ b/noncore/settings/networksettings/ppp/accounts.h
@@ -11,102 +11,90 @@
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public 13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either 14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version. 15 * version 2 of the License, or (at your option) any later version.
16 * 16 *
17 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details. 20 * Library General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU Library General Public 22 * You should have received a copy of the GNU Library General Public
23 * License along with this program; if not, write to the Free 23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 25 */
26 26
27#ifndef _ACCOUNTS_H_ 27#ifndef _ACCOUNTS_H_
28#define _ACCOUNTS_H_ 28#define _ACCOUNTS_H_
29 29
30#include <qwidget.h> 30#include <qwidget.h>
31#include <qdialog.h> 31#include <qdialog.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qlistbox.h> 33#include <qlistbox.h>
34//#include "acctselect.h" 34//#include "acctselect.h"
35 35
36class QDialog; 36class QDialog;
37class QCheckBox; 37class QCheckBox;
38class QLineEdit; 38class QLineEdit;
39class QTabWidget; 39class QTabWidget;
40class DialWidget; 40class DialWidget;
41class ScriptWidget; 41class ScriptWidget;
42class IPWidget; 42class IPWidget;
43class DNSWidget; 43class DNSWidget;
44class GatewayWidget; 44class GatewayWidget;
45class PPPData; 45class PPPData;
46 46
47class AccountWidget : public QWidget { 47class AccountWidget : public QWidget {
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
50 AccountWidget( PPPData *pd, QWidget *parent=0, const char *name=0 ); 50 AccountWidget( PPPData *pd, QWidget *parent=0, const char *name=0 );
51 ~AccountWidget() {} 51 ~AccountWidget() {}
52 52
53private slots: 53private slots:
54 void editaccount(); 54 void editaccount();
55 void copyaccount(); 55 void copyaccount();
56 void newaccount(); 56 void newaccount();
57 void deleteaccount(); 57 void deleteaccount();
58 void slotListBoxSelect(int); 58 void slotListBoxSelect(int);
59// void resetClicked();
60// void viewLogClicked();
61 59
62private: 60private:
63 int doTab(); 61 int doTab();
64 62
65signals: 63signals:
66 void resetaccounts(); 64 void resetaccounts();
67// void resetCosts(const QString &);
68// void resetVolume(const QString &);
69 65
70private: 66private:
71 QString prettyPrintVolume(unsigned int); 67 QString prettyPrintVolume(unsigned int);
72 68
73 PPPData *_pppdata; 69 PPPData *_pppdata;
74 QTabWidget *tabWindow; 70 QTabWidget *tabWindow;
75 DialWidget *dial_w; 71 DialWidget *dial_w;
76// AccountingSelector *acct; 72 IPWidget *ip_w;
77 IPWidget *ip_w; 73 DNSWidget *dns_w;
78 DNSWidget *dns_w; 74 GatewayWidget *gateway_w;
79 GatewayWidget *gateway_w; 75 ScriptWidget *script_w;
80 ScriptWidget *script_w; 76
81 77 QListBox *accountlist_l;
82// QPushButton *reset; 78 QPushButton *edit_b;
83// QPushButton *log; 79 QPushButton *copy_b;
84// QLabel *costlabel; 80 QPushButton *new_b;
85// QLineEdit *costedit; 81 QPushButton *delete_b;
86// QLabel *vollabel;
87// QLineEdit *voledit;
88
89 QListBox *accountlist_l;
90 QPushButton *edit_b;
91 QPushButton *copy_b;
92 QPushButton *new_b;
93 QPushButton *delete_b;
94}; 82};
95 83
96 84
97class QueryReset : public QDialog { 85// class QueryReset : public QDialog {
98 Q_OBJECT 86// Q_OBJECT
99public: 87// public:
100 QueryReset(QWidget *parent); 88// QueryReset(QWidget *parent);
101 89
102 enum {COSTS=1, VOLUME=2}; 90// enum {COSTS=1, VOLUME=2};
103 91
104private slots: 92// private slots:
105 void accepted(); 93// void accepted();
106 94
107private: 95// private:
108 QCheckBox *costs, *volume; 96// QCheckBox *costs, *volume;
109}; 97// };
110 98
111#endif 99#endif
112 100
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 8ae714e..10bc25c 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -1,200 +1,195 @@
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>
34#include <qbuttongroup.h> 33#include <qbuttongroup.h>
35//#include <klocale.h>
36#define i18n QObject::tr
37#include <qvgroupbox.h> 34#include <qvgroupbox.h>
38#include <qhbox.h> 35#include <qhbox.h>
39#include <qdialog.h> 36#include <qdialog.h>
40//#include <kwin.h>
41 37
42#include "edit.h" 38#include "edit.h"
43#include "pppdata.h" 39#include "pppdata.h"
44//#include "newwidget.h"
45#include "iplined.h" 40#include "iplined.h"
46#include "auth.h" 41#include "auth.h"
47 42
48DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount 43DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
49 , const char *name ) 44 , const char *name )
50 : QWidget(parent, name), _pppdata(pd) 45 : QWidget(parent, name), _pppdata(pd)
51{ 46{
52 const int GRIDROWS = 6; 47 const int GRIDROWS = 6;
53 48
54 QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); 49 QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint());
55 50
56 connect_label = new QLabel(i18n("Connection name:"), this); 51 connect_label = new QLabel(tr("Connection name:"), this);
57 tl->addWidget(connect_label, 0, 0); 52 tl->addWidget(connect_label, 0, 0);
58 53
59 connectname_l = new QLineEdit(this); 54 connectname_l = new QLineEdit(this);
60// connectname_l->setMaxLength(ACCNAME_SIZE); 55// connectname_l->setMaxLength(ACCNAME_SIZE);
61 tl->addWidget(connectname_l, 0, 1); 56 tl->addWidget(connectname_l, 0, 1);
62 QString tmp = i18n("Type in a unique name for this connection"); 57 QString tmp = tr("Type in a unique name for this connection");
63 58
64 QWhatsThis::add(connect_label,tmp); 59 QWhatsThis::add(connect_label,tmp);
65 QWhatsThis::add(connectname_l,tmp); 60 QWhatsThis::add(connectname_l,tmp);
66 61
67 62
68 number_label = new QLabel(i18n("Phone number:"), this); 63 number_label = new QLabel(tr("Phone number:"), this);
69 number_label->setAlignment(AlignTop|AlignLeft); 64 number_label->setAlignment(AlignTop|AlignLeft);
70 tl->addWidget(number_label, 1, 0); 65 tl->addWidget(number_label, 1, 0);
71 66
72 QHBoxLayout *lpn = new QHBoxLayout(5); 67 QHBoxLayout *lpn = new QHBoxLayout(5);
73 tl->addLayout(lpn, 1, 1); 68 tl->addLayout(lpn, 1, 1);
74 numbers = new QListBox(this); 69 numbers = new QListBox(this);
75// numbers->setMinimumSize(120, 70); 70// numbers->setMinimumSize(120, 70);
76 lpn->addWidget(numbers); 71 lpn->addWidget(numbers);
77 QVBoxLayout *lpn1 = new QVBoxLayout; 72 QVBoxLayout *lpn1 = new QVBoxLayout;
78 lpn->addLayout(lpn1); 73 lpn->addLayout(lpn1);
79 add = new QPushButton(i18n("&Add..."), this); 74 add = new QPushButton(tr("&Add..."), this);
80 del = new QPushButton(i18n("&Remove"), this); 75 del = new QPushButton(tr("&Remove"), this);
81 76
82 up = new QPushButton(this); 77 up = new QPushButton(this);
83//FIXME: QPixmap pm = BarIcon("up"); 78//FIXME: QPixmap pm = BarIcon("up");
84// up->setPixmap(pm); 79// up->setPixmap(pm);
85 down = new QPushButton(this); 80 down = new QPushButton(this);
86//FIXME: pm = BarIcon("down"); 81//FIXME: pm = BarIcon("down");
87// down->setPixmap(pm); 82// down->setPixmap(pm);
88 lpn1->addWidget(add); 83 lpn1->addWidget(add);
89 lpn1->addWidget(del); 84 lpn1->addWidget(del);
90 lpn1->addStretch(1); 85 lpn1->addStretch(1);
91 lpn1->addWidget(up); 86 lpn1->addWidget(up);
92 lpn1->addWidget(down); 87 lpn1->addWidget(down);
93 connect(add, SIGNAL(clicked()), 88 connect(add, SIGNAL(clicked()),
94 this, SLOT(addNumber())); 89 this, SLOT(addNumber()));
95 connect(del, SIGNAL(clicked()), 90 connect(del, SIGNAL(clicked()),
96 this, SLOT(delNumber())); 91 this, SLOT(delNumber()));
97 connect(up, SIGNAL(clicked()), 92 connect(up, SIGNAL(clicked()),
98 this, SLOT(upNumber())); 93 this, SLOT(upNumber()));
99 connect(down, SIGNAL(clicked()), 94 connect(down, SIGNAL(clicked()),
100 this, SLOT(downNumber())); 95 this, SLOT(downNumber()));
101 connect(numbers, SIGNAL(highlighted(int)), 96 connect(numbers, SIGNAL(highlighted(int)),
102 this, SLOT(selectionChanged(int))); 97 this, SLOT(selectionChanged(int)));
103 numbersChanged(); 98 numbersChanged();
104 99
105 tmp = i18n("<p>Specifies the phone numbers to dial. You\n" 100 tmp = tr("<p>Specifies the phone numbers to dial. You\n"
106 "can supply multiple numbers here, simply\n" 101 "can supply multiple numbers here, simply\n"
107 "click on \"Add\". You can arrange the\n" 102 "click on \"Add\". You can arrange the\n"
108 "order the numbers are tried by using the\n" 103 "order the numbers are tried by using the\n"
109 "arrow buttons.\n\n" 104 "arrow buttons.\n\n"
110 "When a number is busy or fails, <i>kppp</i> will \n" 105 "When a number is busy or fails, <i>kppp</i> will \n"
111 "try the next number and so on"); 106 "try the next number and so on");
112 107
113 QWhatsThis::add(number_label,tmp); 108 QWhatsThis::add(number_label,tmp);
114 QWhatsThis::add(numbers,tmp); 109 QWhatsThis::add(numbers,tmp);
115 110
116 auth_l = new QLabel(i18n("Authentication:"), this); 111 auth_l = new QLabel(tr("Authentication:"), this);
117 tl->addWidget(auth_l, 3, 0); 112 tl->addWidget(auth_l, 3, 0);
118 113
119 auth = new QComboBox(this); 114 auth = new QComboBox(this);
120 auth->insertItem(i18n("Script-based")); 115 auth->insertItem(tr("Script-based"));
121 auth->insertItem(i18n("PAP")); 116 auth->insertItem(tr("PAP"));
122 auth->insertItem(i18n("Terminal-based")); 117 auth->insertItem(tr("Terminal-based"));
123 auth->insertItem(i18n("CHAP")); 118 auth->insertItem(tr("CHAP"));
124 auth->insertItem(i18n("PAP/CHAP")); 119 auth->insertItem(tr("PAP/CHAP"));
125 tl->addWidget(auth, 3, 1); 120 tl->addWidget(auth, 3, 1);
126 tmp = i18n("<p>Specifies the method used to identify yourself to\n" 121 tmp = tr("<p>Specifies the method used to identify yourself to\n"
127 "the PPP server. Most universities still use\n" 122 "the PPP server. Most universities still use\n"
128 "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" 123 "<b>Terminal</b>- or <b>Script</b>-based authentication,\n"
129 "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" 124 "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n"
130 "unsure, contact your ISP.\n" 125 "unsure, contact your ISP.\n"
131 "\n" 126 "\n"
132 "If you can choose between PAP and CHAP,\n" 127 "If you can choose between PAP and CHAP,\n"
133 "choose CHAP, because it's much safer. If you don't know\n" 128 "choose CHAP, because it's much safer. If you don't know\n"
134 "whether PAP or CHAP is right, choose PAP/CHAP."); 129 "whether PAP or CHAP is right, choose PAP/CHAP.");
135 130
136 QWhatsThis::add(auth_l,tmp); 131 QWhatsThis::add(auth_l,tmp);
137 QWhatsThis::add(auth,tmp); 132 QWhatsThis::add(auth,tmp);
138 133
139 store_password = new QCheckBox(i18n("Store password"), this); 134 store_password = new QCheckBox(tr("Store password"), this);
140 store_password->setChecked(true); 135 store_password->setChecked(true);
141 tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); 136 tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight);
142 QWhatsThis::add(store_password, 137 QWhatsThis::add(store_password,
143 i18n("<p>When this is turned on, your ISP password\n" 138 tr("<p>When this is turned on, your ISP password\n"
144 "will be saved in <i>kppp</i>'s config file, so\n" 139 "will be saved in <i>kppp</i>'s config file, so\n"
145 "you do not need to type it in every time.\n" 140 "you do not need to type it in every time.\n"
146 "\n" 141 "\n"
147 "<b><font color=\"red\">Warning:</font> your password will be stored as\n" 142 "<b><font color=\"red\">Warning:</font> your password will be stored as\n"
148 "plain text in the config file, which is\n" 143 "plain text in the config file, which is\n"
149 "readable only to you. Make sure nobody\n" 144 "readable only to you. Make sure nobody\n"
150 "gains access to this file!")); 145 "gains access to this file!"));
151 146
152 pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); 147 pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this);
153 connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); 148 connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton()));
154 tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); 149 tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter);
155 150
156 // Set defaults if editing an existing connection 151 // Set defaults if editing an existing connection
157 if(!isnewaccount) { 152 if(!isnewaccount) {
158 connectname_l->setText(_pppdata->accname()); 153 connectname_l->setText(_pppdata->accname());
159 154
160 // insert the phone numbers into the listbox 155 // insert the phone numbers into the listbox
161 QString n = _pppdata->phonenumber(); 156 QString n = _pppdata->phonenumber();
162 QString tmp = ""; 157 QString tmp = "";
163 uint idx = 0; 158 uint idx = 0;
164 while(idx != n.length()) { 159 while(idx != n.length()) {
165 if(n[idx] == ':') { 160 if(n[idx] == ':') {
166 if(tmp.length() > 0) 161 if(tmp.length() > 0)
167 numbers->insertItem(tmp); 162 numbers->insertItem(tmp);
168 tmp = ""; 163 tmp = "";
169 } else 164 } else
170 tmp += n[idx]; 165 tmp += n[idx];
171 idx++; 166 idx++;
172 } 167 }
173 if(tmp.length() > 0) 168 if(tmp.length() > 0)
174 numbers->insertItem(tmp); 169 numbers->insertItem(tmp);
175 170
176 auth->setCurrentItem(_pppdata->authMethod()); 171 auth->setCurrentItem(_pppdata->authMethod());
177 store_password->setChecked(_pppdata->storePassword()); 172 store_password->setChecked(_pppdata->storePassword());
178 } else { 173 } else {
179 // select PAP/CHAP as default 174 // select PAP/CHAP as default
180 auth->setCurrentItem(AUTH_PAPCHAP); 175 auth->setCurrentItem(AUTH_PAPCHAP);
181 } 176 }
182 177
183 numbersChanged(); 178 numbersChanged();
184 tl->activate(); 179 tl->activate();
185} 180}
186 181
187 182
188bool DialWidget::save() { 183bool DialWidget::save() {
189 //first check to make sure that the account name is unique! 184 //first check to make sure that the account name is unique!
190 if(connectname_l->text().isEmpty() || 185 if(connectname_l->text().isEmpty() ||
191 !_pppdata->isUniqueAccname(connectname_l->text())) { 186 !_pppdata->isUniqueAccname(connectname_l->text())) {
192 return false; 187 return false;
193 } else { 188 } else {
194 _pppdata->setAccname(connectname_l->text()); 189 _pppdata->setAccname(connectname_l->text());
195 190
196 QString number = ""; 191 QString number = "";
197 for(uint i = 0; i < numbers->count(); i++) { 192 for(uint i = 0; i < numbers->count(); i++) {
198 if(i != 0) 193 if(i != 0)
199 number += ":"; 194 number += ":";
200 number += numbers->text(i); 195 number += numbers->text(i);
@@ -233,661 +228,646 @@ void DialWidget::addNumber() {
233 228
234void DialWidget::delNumber() { 229void DialWidget::delNumber() {
235 if(numbers->currentItem() != -1) { 230 if(numbers->currentItem() != -1) {
236 numbers->removeItem(numbers->currentItem()); 231 numbers->removeItem(numbers->currentItem());
237 numbersChanged(); 232 numbersChanged();
238 } 233 }
239} 234}
240 235
241 236
242void DialWidget::upNumber() { 237void DialWidget::upNumber() {
243 int idx = numbers->currentItem(); 238 int idx = numbers->currentItem();
244 if(idx != -1) { 239 if(idx != -1) {
245 QString item = numbers->text(idx); 240 QString item = numbers->text(idx);
246 numbers->removeItem(idx); 241 numbers->removeItem(idx);
247 numbers->insertItem(item, idx-1); 242 numbers->insertItem(item, idx-1);
248 numbers->setCurrentItem(idx-1); 243 numbers->setCurrentItem(idx-1);
249 numbersChanged(); 244 numbersChanged();
250 } 245 }
251} 246}
252 247
253 248
254void DialWidget::downNumber() { 249void DialWidget::downNumber() {
255 int idx = numbers->currentItem(); 250 int idx = numbers->currentItem();
256 if(idx != -1) { 251 if(idx != -1) {
257 QString item = numbers->text(idx); 252 QString item = numbers->text(idx);
258 numbers->removeItem(idx); 253 numbers->removeItem(idx);
259 numbers->insertItem(item, idx+1); 254 numbers->insertItem(item, idx+1);
260 numbers->setCurrentItem(idx+1); 255 numbers->setCurrentItem(idx+1);
261 numbersChanged(); 256 numbersChanged();
262 } 257 }
263} 258}
264 259
265 260
266void DialWidget::pppdargsbutton() { 261void DialWidget::pppdargsbutton() {
267 PPPdArguments pa(_pppdata, this); 262 PPPdArguments pa(_pppdata, this);
268 pa.exec(); 263 pa.exec();
269} 264}
270 265
271 266
272 267
273///////////////////////////////////////////////////////////////////////////// 268/////////////////////////////////////////////////////////////////////////////
274// ExecWidget 269// ExecWidget
275///////////////////////////////////////////////////////////////////////////// 270/////////////////////////////////////////////////////////////////////////////
276ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) : 271ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) :
277 QWidget(parent, name), _pppdata(pd) 272 QWidget(parent, name), _pppdata(pd)
278{ 273{
279 QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); 274 QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
280 275
281 QLabel *l = new QLabel(\ 276 QLabel *l = new QLabel( tr("Here you can select commands to run at certain stages of the connection. The commands are run with your real user id, so you cannot run any commands here requiring root permissions (unless, of course, you are root).<br><br>Be sure to supply the whole path to the program otherwise we might be unable to find it."), this);
282i18n("Here you can select commands to run at certain stages of the\n" 277
283 "connection. The commands are run with your real user id, so\n"
284 "you cannot run any commands here requiring root permissions\n"
285 "(unless, of course, you are root).\n\n"
286 "Be sure to supply the whole path to the program otherwise\n"
287 "kppp might be unable to find it."), this);
288// l->setMinimumHeight(l->sizeHint().height());
289 tl->addWidget(l); 278 tl->addWidget(l);
290 tl->addStretch(1); 279 tl->addStretch(1);
291 280
292 QGridLayout *l1 = new QGridLayout(4, 2, 10); 281 QGridLayout *l1 = new QGridLayout(4, 2, 10);
293 tl->addLayout(l1); 282 tl->addLayout(l1);
294 l1->setColStretch(0, 0); 283 l1->setColStretch(0, 0);
295 l1->setColStretch(1, 1); 284 l1->setColStretch(1, 1);
296 285
297 before_connect_l = new QLabel(i18n("Before connect:"), this); 286 before_connect_l = new QLabel(tr("Before connect:"), this);
298 before_connect_l->setAlignment(AlignVCenter); 287 before_connect_l->setAlignment(AlignVCenter);
299 l1->addWidget(before_connect_l, 0, 0); 288 l1->addWidget(before_connect_l, 0, 0);
300 before_connect = new QLineEdit(this); 289 before_connect = new QLineEdit(this);
301// before_connect->setMaxLength(COMMAND_SIZE); 290// before_connect->setMaxLength(COMMAND_SIZE);
302 l1->addWidget(before_connect, 0, 1); 291 l1->addWidget(before_connect, 0, 1);
303 QString tmp = i18n("Allows you to run a program <b>before</b> a connection\n" 292 QString tmp = tr("Allows you to run a program <b>before</b> a connection\n"
304 "is established. It is called immediately before\n" 293 "is established. It is called immediately before\n"
305 "dialing has begun.\n\n" 294 "dialing has begun.\n\n"
306 "This might be useful, e.g. to stop HylaFAX blocking the\n" 295 "This might be useful, e.g. to stop HylaFAX blocking the\n"
307 "modem."); 296 "modem.");
308 297
309 QWhatsThis::add(before_connect_l,tmp); 298 QWhatsThis::add(before_connect_l,tmp);
310 QWhatsThis::add(before_connect,tmp); 299 QWhatsThis::add(before_connect,tmp);
311 300
312 command_label = new QLabel(i18n("Upon connect:"), this); 301 command_label = new QLabel(tr("Upon connect:"), this);
313 command_label->setAlignment(AlignVCenter); 302 command_label->setAlignment(AlignVCenter);
314 l1->addWidget(command_label, 1, 0); 303 l1->addWidget(command_label, 1, 0);
315 command = new QLineEdit(this); 304 command = new QLineEdit(this);
316// command->setMaxLength(COMMAND_SIZE); 305// command->setMaxLength(COMMAND_SIZE);
317 l1->addWidget(command, 1, 1); 306 l1->addWidget(command, 1, 1);
318 tmp = i18n("Allows you to run a program <b>after</b> a connection\n" 307 tmp = tr("Allows you to run a program <b>after</b> a connection\n"
319 "is established. When your program is called, all\n" 308 "is established. When your program is called, all\n"
320 "preparations for an Internet connection are finished.\n" 309 "preparations for an Internet connection are finished.\n"
321 "\n" 310 "\n"
322 "Very useful for fetching mail and news"); 311 "Very useful for fetching mail and news");
323 312
324 QWhatsThis::add(command_label,tmp); 313 QWhatsThis::add(command_label,tmp);
325 QWhatsThis::add(command,tmp); 314 QWhatsThis::add(command,tmp);
326 315
327 predisconnect_label = new QLabel(i18n("Before disconnect:"), 316 predisconnect_label = new QLabel(tr("Before disconnect:"),
328 this); 317 this);
329 predisconnect_label->setAlignment(AlignVCenter); 318 predisconnect_label->setAlignment(AlignVCenter);
330 l1->addWidget(predisconnect_label, 2, 0); 319 l1->addWidget(predisconnect_label, 2, 0);
331 predisconnect = new QLineEdit(this); 320 predisconnect = new QLineEdit(this);
332// predisconnect->setMaxLength(COMMAND_SIZE); 321// predisconnect->setMaxLength(COMMAND_SIZE);
333 l1->addWidget(predisconnect, 2, 1); 322 l1->addWidget(predisconnect, 2, 1);
334 tmp = i18n("Allows you to run a program <b>before</b> a connection\n" 323 tmp = tr("Allows you to run a program <b>before</b> a connection\n"
335 "is closed. The connection will stay open until\n" 324 "is closed. The connection will stay open until\n"
336 "the program exits."); 325 "the program exits.");
337 326
338 QWhatsThis::add(predisconnect_label,tmp); 327 QWhatsThis::add(predisconnect_label,tmp);
339 QWhatsThis::add(predisconnect,tmp); 328 QWhatsThis::add(predisconnect,tmp);
340 329
341 discommand_label = new QLabel(i18n("Upon disconnect:"), 330 discommand_label = new QLabel(tr("Upon disconnect:"),
342 this); 331 this);
343 discommand_label->setAlignment(AlignVCenter); 332 discommand_label->setAlignment(AlignVCenter);
344 l1->addWidget(discommand_label, 3, 0); 333 l1->addWidget(discommand_label, 3, 0);
345 334
346 discommand = new QLineEdit(this); 335 discommand = new QLineEdit(this);
347// discommand->setMaxLength(COMMAND_SIZE); 336// discommand->setMaxLength(COMMAND_SIZE);
348 l1->addWidget(discommand, 3, 1); 337 l1->addWidget(discommand, 3, 1);
349 tmp = i18n("Allows you to run a program <b>after</b> a connection\n" 338 tmp = tr("Allows you to run a program <b>after</b> a connection\n"
350 "has been closed."); 339 "has been closed.");
351 340
352 QWhatsThis::add(discommand_label,tmp); 341 QWhatsThis::add(discommand_label,tmp);
353 QWhatsThis::add(discommand,tmp); 342 QWhatsThis::add(discommand,tmp);
354 343
355 // extra space between entries 344 // extra space between entries
356 l1->addRowSpacing(1, 5); 345 l1->addRowSpacing(1, 5);
357 l1->addRowSpacing(3, 5); 346 l1->addRowSpacing(3, 5);
358 347
359 tl->addStretch(1); 348 tl->addStretch(1);
360 tl->activate(); 349 tl->activate();
361 350
362 // Set defaults if editing an existing connection 351 // Set defaults if editing an existing connection
363 if(!isnewaccount) { 352 if(!isnewaccount) {
364 before_connect->setText(_pppdata->command_before_connect()); 353 before_connect->setText(_pppdata->command_before_connect());
365 command->setText(_pppdata->command_on_connect()); 354 command->setText(_pppdata->command_on_connect());
366 discommand->setText(_pppdata->command_on_disconnect()); 355 discommand->setText(_pppdata->command_on_disconnect());
367 predisconnect->setText(_pppdata->command_before_disconnect()); 356 predisconnect->setText(_pppdata->command_before_disconnect());
368 } 357 }
369} 358}
370 359
371 360
372bool ExecWidget::save() { 361bool ExecWidget::save() {
373 _pppdata->setCommand_before_connect(before_connect->text()); 362 _pppdata->setCommand_before_connect(before_connect->text());
374 _pppdata->setCommand_on_connect(command->text()); 363 _pppdata->setCommand_on_connect(command->text());
375 _pppdata->setCommand_before_disconnect(predisconnect->text()); 364 _pppdata->setCommand_before_disconnect(predisconnect->text());
376 _pppdata->setCommand_on_disconnect(discommand->text()); 365 _pppdata->setCommand_on_disconnect(discommand->text());
377 return true; 366 return true;
378} 367}
379 368
380 369
381 370
382///////////////////////////////////////////////////////////////////////////// 371/////////////////////////////////////////////////////////////////////////////
383// 372//
384// IPWidget 373// IPWidget
385// 374//
386///////////////////////////////////////////////////////////////////////////// 375/////////////////////////////////////////////////////////////////////////////
387IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) 376IPWidget::IPWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
388 : QWidget(parent, name), _pppdata(pd) 377 : QWidget(parent, name), _pppdata(pd)
389{ 378{
390 QVBoxLayout *topLayout = new QVBoxLayout(this); 379 QVBoxLayout *topLayout = new QVBoxLayout(this);
391 topLayout->setSpacing( 3 );//KDialog::spacingHint()); 380 topLayout->setSpacing( 3 );//KDialog::spacingHint());
392 381
393 box = new QVGroupBox(i18n("Configuration"), this); 382 box = new QVGroupBox(tr("Configuration"), this);
394// box->setInsideSpacing( 1 );//KDialog::spacingHint()); 383// box->setInsideSpacing( 1 );//KDialog::spacingHint());
395 384
396 rb = new QButtonGroup(this); 385 rb = new QButtonGroup(this);
397 rb->hide(); 386 rb->hide();
398 connect(rb, SIGNAL(clicked(int)), 387 connect(rb, SIGNAL(clicked(int)),
399 SLOT(hitIPSelect(int))); 388 SLOT(hitIPSelect(int)));
400 389
401 dynamicadd_rb = new QRadioButton(box); 390 dynamicadd_rb = new QRadioButton(box);
402 dynamicadd_rb->setText(i18n("Dynamic IP address")); 391 dynamicadd_rb->setText(tr("Dynamic IP address"));
403 QWhatsThis::add(dynamicadd_rb, 392 QWhatsThis::add(dynamicadd_rb,
404 i18n("Select this option when your computer gets an\n" 393 tr("Select this option when your computer gets an\n"
405 "internet address (IP) every time a\n" 394 "internet address (IP) every time a\n"
406 "connection is made.\n" 395 "connection is made.\n"
407 "\n" 396 "\n"
408 "Almost every Internet Service Provider uses\n" 397 "Almost every Internet Service Provider uses\n"
409 "this method, so this should be turned on.")); 398 "this method, so this should be turned on."));
410 399
411 staticadd_rb = new QRadioButton(box); 400 staticadd_rb = new QRadioButton(box);
412 staticadd_rb->setText(i18n("Static IP address")); 401 staticadd_rb->setText(tr("Static IP address"));
413 rb->insert(dynamicadd_rb, 0); 402 rb->insert(dynamicadd_rb, 0);
414 rb->insert(staticadd_rb, 1); 403 rb->insert(staticadd_rb, 1);
415 QWhatsThis::add(staticadd_rb, 404 QWhatsThis::add(staticadd_rb,
416 i18n("Select this option when your computer has a\n" 405 tr("Select this option when your computer has a\n"
417 "fixed internet address (IP). Most computers\n" 406 "fixed internet address (IP). Most computers\n"
418 "don't have this, so you should probably select\n" 407 "don't have this, so you should probably select\n"
419 "dynamic IP addressing unless you know what you\n" 408 "dynamic IP addressing unless you know what you\n"
420 "are doing.")); 409 "are doing."));
421 410
422 QWidget *ipWidget = new QWidget(box); 411 QWidget *ipWidget = new QWidget(box);
423 QGridLayout *ipLayout = new QGridLayout(ipWidget, 2, 2); 412 QGridLayout *ipLayout = new QGridLayout(ipWidget, 2, 2);
424 ipLayout->setSpacing( 2 );//KDialog::spacingHint()); 413 ipLayout->setSpacing( 2 );//KDialog::spacingHint());
425 414
426 ipaddress_label = new QLabel(i18n("IP address:"), ipWidget); 415 ipaddress_label = new QLabel(tr("IP address:"), ipWidget);
427 QString tmp = i18n("If your computer has a permanent internet\n" 416 QString tmp = tr("If your computer has a permanent internet\n"
428 "address, you must supply your IP address here."); 417 "address, you must supply your IP address here.");
429 ipLayout->addWidget(ipaddress_label, 0, 0); 418 ipLayout->addWidget(ipaddress_label, 0, 0);
430 419
431 ipaddress_l = new IPLineEdit(ipWidget); 420 ipaddress_l = new IPLineEdit(ipWidget);
432 ipLayout->addWidget(ipaddress_l, 0, 1); 421 ipLayout->addWidget(ipaddress_l, 0, 1);
433 422
434 QWhatsThis::add(ipaddress_label,tmp); 423 QWhatsThis::add(ipaddress_label,tmp);
435 QWhatsThis::add(ipaddress_l,tmp); 424 QWhatsThis::add(ipaddress_l,tmp);
436 425
437 sub_label = new QLabel(i18n("Subnet mask:"), ipWidget); 426 sub_label = new QLabel(tr("Subnet mask:"), ipWidget);
438 tmp = i18n("<p>If your computer has a static Internet address,\n" 427 tmp = tr("<p>If your computer has a static Internet address,\n"
439 "you must supply a network mask here. In almost\n" 428 "you must supply a network mask here. In almost\n"
440 "all cases this netmask will be <b>255.255.255.0</b>,\n" 429 "all cases this netmask will be <b>255.255.255.0</b>,\n"
441 "but your mileage may vary.\n" 430 "but your mileage may vary.\n"
442 "\n" 431 "\n"
443 "If unsure, contact your Internet Service Provider"); 432 "If unsure, contact your Internet Service Provider");
444 ipLayout->addWidget(sub_label, 1, 0); 433 ipLayout->addWidget(sub_label, 1, 0);
445 434
446 subnetmask_l = new IPLineEdit(ipWidget); 435 subnetmask_l = new IPLineEdit(ipWidget);
447 ipLayout->addWidget(subnetmask_l, 1, 1); 436 ipLayout->addWidget(subnetmask_l, 1, 1);
448 437
449 QWhatsThis::add(sub_label,tmp); 438 QWhatsThis::add(sub_label,tmp);
450 QWhatsThis::add(subnetmask_l,tmp); 439 QWhatsThis::add(subnetmask_l,tmp);
451 440
452 autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this); 441 autoname = new QCheckBox(tr("Auto-configure hostname from this IP"), this);
453 autoname->setChecked(_pppdata->autoname()); 442 autoname->setChecked(_pppdata->autoname());
454 connect(autoname,SIGNAL(toggled(bool)), 443 connect(autoname,SIGNAL(toggled(bool)),
455 this,SLOT(autoname_t(bool))); 444 this,SLOT(autoname_t(bool)));
456 445
457 QWhatsThis::add(autoname, 446 QWhatsThis::add(autoname,
458 i18n("<p>Whenever you connect, this reconfigures\n" 447 tr("<p>Whenever you connect, this reconfigures\n"
459 "your hostname to match the IP address you\n" 448 "your hostname to match the IP address you\n"
460 "got from the PPP server. This may be useful\n" 449 "got from the PPP server. This may be useful\n"
461 "if you need to use a protocol which depends\n" 450 "if you need to use a protocol which depends\n"
462 "on this information, but it can also cause several\n" 451 "on this information, but it can also cause several\n"
463 "<a href=\"kppp-7.html#autohostname\">problems</a>.\n" 452 "<a href=\"kppp-7.html#autohostname\">problems</a>.\n"
464 "\n" 453 "\n"
465 "Don't enable this unless you really need it.")); 454 "Don't enable this unless you really need it."));
466 455
467 topLayout->addWidget(box); 456 topLayout->addWidget(box);
468 topLayout->addWidget(autoname); 457 topLayout->addWidget(autoname);
469 topLayout->addStretch(); 458 topLayout->addStretch();
470 459
471 //load info from gpppdata 460 //load info from gpppdata
472 if(!isnewaccount) { 461 if(!isnewaccount) {
473 if(_pppdata->ipaddr() == "0.0.0.0" && 462 if(_pppdata->ipaddr() == "0.0.0.0" &&
474 _pppdata->subnetmask() == "0.0.0.0") { 463 _pppdata->subnetmask() == "0.0.0.0") {
475 dynamicadd_rb->setChecked(true); 464 dynamicadd_rb->setChecked(true);
476 hitIPSelect(0); 465 hitIPSelect(0);
477 autoname->setChecked(_pppdata->autoname()); 466 autoname->setChecked(_pppdata->autoname());
478 } 467 }
479 else { 468 else {
480 ipaddress_l->setText(_pppdata->ipaddr()); 469 ipaddress_l->setText(_pppdata->ipaddr());
481 subnetmask_l->setText(_pppdata->subnetmask()); 470 subnetmask_l->setText(_pppdata->subnetmask());
482 staticadd_rb->setChecked(true); 471 staticadd_rb->setChecked(true);
483 autoname->setChecked(false); 472 autoname->setChecked(false);
484 } 473 }
485 } 474 }
486 else { 475 else {
487 dynamicadd_rb->setChecked(true); 476 dynamicadd_rb->setChecked(true);
488 hitIPSelect(0); 477 hitIPSelect(0);
489 } 478 }
490 479
491} 480}
492 481
493void IPWidget::autoname_t(bool on) { 482void IPWidget::autoname_t(bool on) {
494 static bool was_warned = false; 483 static bool was_warned = false;
495 484
496 // big-fat warning when selecting the auto configure hostname option 485 // big-fat warning when selecting the auto configure hostname option
497 if(on && !was_warned) { 486 if(on && !was_warned) {
498 QMessageBox::information(this, 487 QMessageBox::information(this,
499 i18n("Selecting this option might cause some weird " 488 tr("Selecting this option might cause some weird "
500 "problems with the X-server and applications " 489 "problems with the X-server and applications "
501 "while kppp is connected. Don't use it until " 490 "while kppp is connected. Don't use it until "
502 "you know what you are doing!\n" 491 "you know what you are doing!\n"
503 "For more information take a look at the " 492 "For more information take a look at the "
504 "handbook (or help) in the section \"Frequently " 493 "handbook (or help) in the section \"Frequently "
505 "asked questions\"."), 494 "asked questions\"."),
506 i18n("Warning")); 495 tr("Warning"));
507 was_warned = true; 496 was_warned = true;
508 } 497 }
509} 498}
510 499
511 500
512void IPWidget::save() { 501void IPWidget::save() {
513 if(dynamicadd_rb->isChecked()) { 502 if(dynamicadd_rb->isChecked()) {
514 _pppdata->setIpaddr("0.0.0.0"); 503 _pppdata->setIpaddr("0.0.0.0");
515 _pppdata->setSubnetmask("0.0.0.0"); 504 _pppdata->setSubnetmask("0.0.0.0");
516 } else { 505 } else {
517 _pppdata->setIpaddr(ipaddress_l->text()); 506 _pppdata->setIpaddr(ipaddress_l->text());
518 _pppdata->setSubnetmask(subnetmask_l->text()); 507 _pppdata->setSubnetmask(subnetmask_l->text());
519 } 508 }
520 _pppdata->setAutoname(autoname->isChecked()); 509 _pppdata->setAutoname(autoname->isChecked());
521} 510}
522 511
523 512
524void IPWidget::hitIPSelect( int i ) { 513void IPWidget::hitIPSelect( int i ) {
525 if(i == 0) { 514 if(i == 0) {
526 ipaddress_label->setEnabled(false); 515 ipaddress_label->setEnabled(false);
527 sub_label->setEnabled(false); 516 sub_label->setEnabled(false);
528 ipaddress_l->setEnabled(false); 517 ipaddress_l->setEnabled(false);
529 subnetmask_l->setEnabled(false); 518 subnetmask_l->setEnabled(false);
530 } 519 }
531 else { 520 else {
532 ipaddress_label->setEnabled(true); 521 ipaddress_label->setEnabled(true);
533 sub_label->setEnabled(true); 522 sub_label->setEnabled(true);
534 ipaddress_l->setEnabled(true); 523 ipaddress_l->setEnabled(true);
535 subnetmask_l->setEnabled(true); 524 subnetmask_l->setEnabled(true);
536 } 525 }
537} 526}
538 527
539 528
540 529
541DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) 530DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
542 : QWidget(parent, name), _pppdata(pd) 531 : QWidget(parent, name), _pppdata(pd)
543{ 532{
544 // box = new QGroupBox(this); 533 QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );
545 QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );//, KDialog::spacingHint());
546 534
547 dnsdomain_label = new QLabel(i18n("Domain name:"), this); 535 dnsdomain_label = new QLabel(tr("Domain name:"), this);
548 tl->addWidget(dnsdomain_label, 0, 0); 536 tl->addWidget(dnsdomain_label, 0, 0);
549 537
550 dnsdomain = new QLineEdit(this); 538 dnsdomain = new QLineEdit(this);
551// dnsdomain->setMaxLength(DOMAIN_SIZE); 539
552 tl->addWidget(dnsdomain, 0, 1); 540 tl->addWidget(dnsdomain, 0, 1);
553 QString tmp = i18n("If you enter a domain name here, this domain\n" 541 QString tmp = tr("If you enter a domain name here, this domain\n"
554 "name is used for your computer while you are\n" 542 "name is used for your computer while you are\n"
555 "connected. When the connection is closed, the\n" 543 "connected. When the connection is closed, the\n"
556 "original domain name of your computer is\n" 544 "original domain name of your computer is\n"
557 "restored.\n" 545 "restored.\n"
558 "\n" 546 "\n"
559 "If you leave this field blank, no changes are\n" 547 "If you leave this field blank, no changes are\n"
560 "made to the domain name."); 548 "made to the domain name.");
561 549
562 QWhatsThis::add(dnsdomain_label,tmp); 550 QWhatsThis::add(dnsdomain_label,tmp);
563 QWhatsThis::add(dnsdomain,tmp); 551 QWhatsThis::add(dnsdomain,tmp);
564 552
565 conf_label = new QLabel(i18n("Configuration:"), this); 553 conf_label = new QLabel(tr("Configuration:"), this);
566 tl->addWidget(conf_label, 1, 0); 554 tl->addWidget(conf_label, 1, 0);
567 555
568 bg = new QButtonGroup("Group", this); 556 bg = new QButtonGroup("Group", this);
569 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int))); 557 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int)));
570 bg->hide(); 558 bg->hide();
571 559
572 autodns = new QRadioButton(i18n("Automatic"), this); 560 autodns = new QRadioButton(tr("Automatic"), this);
573 bg->insert(autodns, 0); 561 bg->insert(autodns, 0);
574 tl->addWidget(autodns, 1, 1); 562 tl->addWidget(autodns, 1, 1);
575 // no automatic DNS detection for pppd < 2.3.7
576 if(!_pppdata->pppdVersionMin(2, 3, 7)) 563 if(!_pppdata->pppdVersionMin(2, 3, 7))
577 autodns->setEnabled(false); 564 autodns->setEnabled(false);
578 565
579 mandns = new QRadioButton(i18n("Manual"), this); 566 mandns = new QRadioButton(tr("Manual"), this);
580 bg->insert(mandns, 1); 567 bg->insert(mandns, 1);
581 tl->addWidget(mandns, 2, 1); 568 tl->addWidget(mandns, 2, 1);
582 569
583 dns_label = new QLabel(i18n("DNS IP address:"), this); 570 dns_label = new QLabel(tr("DNS IP address:"), this);
584 tl->addWidget(dns_label, 3, 0); 571 tl->addWidget(dns_label, 3, 0);
585 572
586 QHBoxLayout *l2 = new QHBoxLayout; 573 QHBoxLayout *l2 = new QHBoxLayout;
587 tl->addLayout(l2, 3, 1); 574 tl->addLayout(l2, 3, 1);
588 dnsipaddr = new IPLineEdit(this); 575 dnsipaddr = new IPLineEdit(this);
589 connect(dnsipaddr, SIGNAL(returnPressed()), 576 connect(dnsipaddr, SIGNAL(returnPressed()),
590 SLOT(adddns())); 577 SLOT(adddns()));
591 connect(dnsipaddr, SIGNAL(textChanged(const QString &)), 578 connect(dnsipaddr, SIGNAL(textChanged(const QString &)),
592 SLOT(DNS_Edit_Changed(const QString &))); 579 SLOT(DNS_Edit_Changed(const QString &)));
593 l2->addWidget(dnsipaddr, 1); 580 l2->addWidget(dnsipaddr, 1);
594 l2->addStretch(1); 581 l2->addStretch(1);
595 tmp = i18n("<p>Allows you to specify a new DNS server to be\n" 582 tmp = tr("<p>Allows you to specify a new DNS server to be\n"
596 "used while you are connected. When the\n" 583 "used while you are connected. When the\n"
597 "connection is closed, this DNS entry will be\n" 584 "connection is closed, this DNS entry will be\n"
598 "removed again.\n" 585 "removed again.\n"
599 "\n" 586 "\n"
600 "To add a DNS server, type in the IP address of\n" 587 "To add a DNS server, type in the IP address of\n"
601 "the DNS server here and click on <b>Add</b>"); 588 "the DNS server here and click on <b>Add</b>");
602 589
603 QWhatsThis::add(dns_label, tmp); 590 QWhatsThis::add(dns_label, tmp);
604 QWhatsThis::add(dnsipaddr, tmp); 591 QWhatsThis::add(dnsipaddr, tmp);
605 592
606 QHBoxLayout *l1 = new QHBoxLayout; 593 QHBoxLayout *l1 = new QHBoxLayout;
607 tl->addLayout(l1, 4, 1); 594 tl->addLayout(l1, 4, 1);
608 add = new QPushButton(i18n("Add"), this); 595 add = new QPushButton(tr("Add"), this);
609 connect(add, SIGNAL(clicked()), SLOT(adddns())); 596 connect(add, SIGNAL(clicked()), SLOT(adddns()));
610// int width = add->sizeHint().width();
611// width = QMAX(width,60);
612// add->setMinimumWidth(width);
613 l1->addWidget(add); 597 l1->addWidget(add);
614 l1->addStretch(1); 598// l1->addStretch(1);
615 QWhatsThis::add(add, 599 QWhatsThis::add(add,
616 i18n("Click this button to add the DNS server\n" 600 tr("Click this button to add the DNS server\n"
617 "specified in the field above. The entry\n" 601 "specified in the field above. The entry\n"
618 "will then be added to the list below")); 602 "will then be added to the list below"));
619 603
620 remove = new QPushButton(i18n("Remove"), this); 604 remove = new QPushButton(tr("Remove"), this);
621 connect(remove, SIGNAL(clicked()), SLOT(removedns())); 605 connect(remove, SIGNAL(clicked()), SLOT(removedns()));
622// width = remove->sizeHint().width();
623// width = QMAX(width,60);
624// remove->setMinimumWidth(width);
625 l1->addWidget(remove); 606 l1->addWidget(remove);
626 QWhatsThis::add(remove, 607 QWhatsThis::add(remove,
627 i18n("Click this button to remove the selected DNS\n" 608 tr("Click this button to remove the selected DNS\n"
628 "server entry from the list below")); 609 "server entry from the list below"));
629 610
630 servers_label = new QLabel(i18n("DNS address list:"), this); 611 servers_label = new QLabel(tr("DNS address list:"), this);
631 servers_label->setAlignment(AlignTop|AlignLeft); 612 servers_label->setAlignment(AlignTop|AlignLeft);
632 tl->addWidget(servers_label, 5, 0); 613 tl->addWidget(servers_label, 5, 0);
633 614
634 dnsservers = new QListBox(this); 615 dnsservers = new QListBox(this);
635 dnsservers->setMinimumSize(150, 80); 616 dnsservers->setMinimumSize(150, 80);
636 connect(dnsservers, SIGNAL(highlighted(int)), 617 connect(dnsservers, SIGNAL(highlighted(int)),
637 SLOT(DNS_Entry_Selected(int))); 618 SLOT(DNS_Entry_Selected(int)));
638 tl->addWidget(dnsservers, 5, 1); 619 tl->addWidget(dnsservers, 5, 1);
639 tmp = i18n("<p>This shows all defined DNS servers to use\n" 620 tmp = tr("<p>This shows all defined DNS servers to use\n"
640 "while you are connected. Use the <b>Add</b> and\n" 621 "while you are connected. Use the <b>Add</b> and\n"
641 "<b>Remove</b> buttons to modify the list"); 622 "<b>Remove</b> buttons to modify the list");
642 623
643 QWhatsThis::add(servers_label,tmp); 624 QWhatsThis::add(servers_label,tmp);
644 QWhatsThis::add(dnsservers,tmp); 625 QWhatsThis::add(dnsservers,tmp);
645 626
646 exdnsdisabled_toggle = new QCheckBox(i18n( \ 627 exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this);
647"Disable existing DNS servers during connection"), 628 // exdnsdisabled_toggle = new QCheckBox(tr("Disable existing DNS servers during connection"), this);
648 this);
649 exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled()); 629 exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled());
650 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); 630 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter);
651 QWhatsThis::add(exdnsdisabled_toggle, 631 QWhatsThis::add(exdnsdisabled_toggle,
652 i18n("<p>When this option is selected, all DNS\n" 632 tr("<p>When this option is selected, all DNS\n"
653 "servers specified in <tt>/etc/resolv.conf</tt> are\n" 633 "servers specified in <tt>/etc/resolv.conf</tt> are\n"
654 "temporary disabled while the dialup connection\n" 634 "temporary disabled while the dialup connection\n"
655 "is established. After the connection is\n" 635 "is established. After the connection is\n"
656 "closed, the servers will be re-enabled\n" 636 "closed, the servers will be re-enabled\n"
657 "\n" 637 "\n"
658 "Typically, there is no reason to use this\n" 638 "Typically, there is no reason to use this\n"
659 "option, but it may become useful under \n" 639 "option, but it may become useful under \n"
660 "some circumstances.")); 640 "some circumstances."));
661 641
662 642
663 // restore data if editing 643 // restore data if editing
664 if(!isnewaccount) { 644 if(!isnewaccount) {
665 dnsservers->insertStringList(_pppdata->dns()); 645 dnsservers->insertStringList(_pppdata->dns());
666 dnsdomain->setText(_pppdata->domain()); 646 dnsdomain->setText(_pppdata->domain());
667 } 647 }
668 648
669 int mode = _pppdata->autoDNS() ? 0 : 1; 649 int mode = _pppdata->autoDNS() ? 0 : 1;
670 bg->setButton(mode); 650 bg->setButton(mode);
671 DNS_Mode_Selected(mode); 651 DNS_Mode_Selected(mode);
672 652
673 tl->activate(); 653 tl->activate();
674} 654}
675 655
676void DNSWidget::DNS_Edit_Changed(const QString &text) { 656void DNSWidget::DNS_Edit_Changed(const QString &text) {
677 QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); 657 QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
678 add->setEnabled(text.find(r) != -1); 658 add->setEnabled(text.find(r) != -1);
679} 659}
680 660
681void DNSWidget::DNS_Entry_Selected(int) { 661void DNSWidget::DNS_Entry_Selected(int) {
682 remove->setEnabled(true); 662 remove->setEnabled(true);
683} 663}
684 664
685void DNSWidget::DNS_Mode_Selected(int mode) { 665void DNSWidget::DNS_Mode_Selected(int mode) {
686 bool on = (mode == 1); 666 bool on = (mode == 1);
687 dns_label->setEnabled(on); 667 dns_label->setEnabled(on);
688 servers_label->setEnabled(on); 668 servers_label->setEnabled(on);
689 dnsipaddr->setText(""); 669 dnsipaddr->setText("");
690 dnsipaddr->setEnabled(on); 670 dnsipaddr->setEnabled(on);
691 add->setEnabled(false); 671 add->setEnabled(false);
692 remove->setEnabled(dnsservers->count()>0 && on); 672 remove->setEnabled(dnsservers->count()>0 && on);
693 dnsservers->clearSelection(); 673 dnsservers->clearSelection();
694 dnsservers->setEnabled(on); 674 dnsservers->setEnabled(on);
695 dnsservers->triggerUpdate(false); 675 dnsservers->triggerUpdate(false);
696} 676}
697 677
698void DNSWidget::save() { 678void DNSWidget::save() {
699 _pppdata->setAutoDNS(bg->id(bg->selected()) == 0); 679 _pppdata->setAutoDNS(bg->id(bg->selected()) == 0);
700 QStringList serverlist; 680 QStringList serverlist;
701 for(uint i=0; i < dnsservers->count(); i++) 681 for(uint i=0; i < dnsservers->count(); i++)
702 serverlist.append(dnsservers->text(i)); 682 serverlist.append(dnsservers->text(i));
703 _pppdata->setDns(serverlist); 683 _pppdata->setDns(serverlist);
704 684
705 // strip leading dot 685 // strip leading dot
706 QString s(dnsdomain->text()); 686 QString s(dnsdomain->text());
707 if(s.left(1) == ".") 687 if(s.left(1) == ".")
708 _pppdata->setDomain(s.mid(1)); 688 _pppdata->setDomain(s.mid(1));
709 else 689 else
710 _pppdata->setDomain(dnsdomain->text()); 690 _pppdata->setDomain(dnsdomain->text());
711 691
712 _pppdata->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); 692 _pppdata->setExDNSDisabled(exdnsdisabled_toggle->isChecked());
713} 693}
714 694
715 695
716void DNSWidget::adddns() { 696void DNSWidget::adddns() {
717 if(dnsservers->count() < MAX_DNS_ENTRIES) { 697 if(dnsservers->count() < MAX_DNS_ENTRIES) {
718 dnsservers->insertItem(dnsipaddr->text()); 698 dnsservers->insertItem(dnsipaddr->text());
719 dnsipaddr->setText(""); 699 dnsipaddr->setText("");
720 } 700 }
721} 701}
722 702
723 703
724void DNSWidget::removedns() { 704void DNSWidget::removedns() {
725 int i; 705 int i;
726 i = dnsservers->currentItem(); 706 i = dnsservers->currentItem();
727 if(i != -1) 707 if(i != -1)
728 dnsservers->removeItem(i); 708 dnsservers->removeItem(i);
729 remove->setEnabled(dnsservers->count()>0); 709 remove->setEnabled(dnsservers->count()>0);
730} 710}
731 711
732 712
733// 713//
734// GatewayWidget 714// GatewayWidget
735// 715//
736GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) 716GatewayWidget::GatewayWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
737 : QWidget(parent, name), _pppdata(pd) 717 : QWidget(parent, name), _pppdata(pd)
738{ 718{
739 QVBoxLayout *topLayout = new QVBoxLayout(this); 719 QVBoxLayout *topLayout = new QVBoxLayout(this);
740 topLayout->setSpacing( 2 );//KDialog::spacingHint()); 720 topLayout->setSpacing( 2 );
721 topLayout->setMargin( 0 );
741 722
742 box = new QVGroupBox(i18n("Configuration"), this); 723 box = new QVGroupBox(tr("Configuration"), this);
743// box->setInsideSpacing( 2 );//KDialog::spacingHint());
744 724
745 rb = new QButtonGroup(this); 725 rb = new QButtonGroup(this);
746 rb->hide(); 726 rb->hide();
747 connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); 727 connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int)));
748 728
749 defaultgateway = new QRadioButton(box); 729 defaultgateway = new QRadioButton(box);
750 defaultgateway->setText(i18n("Default gateway")); 730 defaultgateway->setText(tr("Default gateway"));
751 rb->insert(defaultgateway, 0); 731 rb->insert(defaultgateway, 0);
752 QWhatsThis::add(defaultgateway, 732 QWhatsThis::add(defaultgateway,
753 i18n("This makes the PPP peer computer (the computer\n" 733 tr("This makes the PPP peer computer (the computer\n"
754 "you are connected to with your modem) to act as\n" 734 "you are connected to with your modem) to act as\n"
755 "a gateway. Your computer will send all packets not\n" 735 "a gateway. Your computer will send all packets not\n"
756 "going to a computer inside your local net to this\n" 736 "going to a computer inside your local net to this\n"
757 "computer, which will route these packets.\n" 737 "computer, which will route these packets.\n"
758 "\n" 738 "\n"
759 "This is the default for most ISPs, so you should\n" 739 "This is the default for most ISPs, so you should\n"
760 "probably leave this option on.")); 740 "probably leave this option on."));
761 741
762 742
763 staticgateway = new QRadioButton(box); 743 staticgateway = new QRadioButton(box);
764 staticgateway->setText(i18n("Static gateway")); 744 staticgateway->setText(tr("Static gateway"));
765 rb->insert(staticgateway, 1); 745 rb->insert(staticgateway, 1);
766 QWhatsThis::add(staticgateway, 746 QWhatsThis::add(staticgateway,
767 i18n("<p>Allows you to specify which computer you want\n" 747 tr("<p>Allows you to specify which computer you want\n"
768 "to use as gateway (see <i>Default Gateway</i> above)")); 748 "to use as gateway (see <i>Default Gateway</i> above)"));
769 749
770 QHBox *gateBox = new QHBox(box); 750 QHBox *gateBox = new QHBox(box);
771 gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); 751 gate_label = new QLabel(tr("Gateway IP address:"), gateBox);
772 gatewayaddr = new IPLineEdit(gateBox); 752 gatewayaddr = new IPLineEdit(gateBox);
773 753
774 defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), 754 defaultroute = new QCheckBox(tr("Assign the default route to this gateway"),
775 this); 755 this);
776 QWhatsThis::add(defaultroute, 756 QWhatsThis::add(defaultroute,
777 i18n("If this option is enabled, all packets not\n" 757 tr("If this option is enabled, all packets not\n"
778 "going to the local net are routed through\n" 758 "going to the local net are routed through\n"
779 "the PPP connection.\n" 759 "the PPP connection.\n"
780 "\n" 760 "\n"
781 "Normally, you should turn this on")); 761 "Normally, you should turn this on"));
782 762
783 topLayout->addWidget(box); 763 topLayout->addWidget(box);
784 topLayout->addWidget(defaultroute); 764 topLayout->addWidget(defaultroute);
785 topLayout->addStretch(); 765 topLayout->addStretch();
786 766
787 //load info from gpppdata 767 //load info from gpppdata
788 if(!isnewaccount) { 768 if(!isnewaccount) {
789 if(_pppdata->gateway() == "0.0.0.0") { 769 if(_pppdata->gateway() == "0.0.0.0") {
790 defaultgateway->setChecked(true); 770 defaultgateway->setChecked(true);
791 hitGatewaySelect(0); 771 hitGatewaySelect(0);
792 } 772 }
793 else { 773 else {
794 gatewayaddr->setText(_pppdata->gateway()); 774 gatewayaddr->setText(_pppdata->gateway());
795 staticgateway->setChecked(true); 775 staticgateway->setChecked(true);
796 } 776 }
797 defaultroute->setChecked(_pppdata->defaultroute()); 777 defaultroute->setChecked(_pppdata->defaultroute());
798 } 778 }
799 else { 779 else {
800 defaultgateway->setChecked(true); 780 defaultgateway->setChecked(true);
801 hitGatewaySelect(0); 781 hitGatewaySelect(0);
802 defaultroute->setChecked(true); 782 defaultroute->setChecked(true);
803 } 783 }
804} 784}
805 785
806void GatewayWidget::save() { 786void GatewayWidget::save() {
807 _pppdata->setGateway(gatewayaddr->text()); 787 _pppdata->setGateway(gatewayaddr->text());
808 _pppdata->setDefaultroute(defaultroute->isChecked()); 788 _pppdata->setDefaultroute(defaultroute->isChecked());
809} 789}
810 790
811 791
812void GatewayWidget::hitGatewaySelect( int i ) { 792void GatewayWidget::hitGatewaySelect( int i ) {
813 if(i == 0) { 793 if(i == 0) {
814 gatewayaddr->setText("0.0.0.0"); 794 gatewayaddr->setText("0.0.0.0");
815 gatewayaddr->setEnabled(false); 795 gatewayaddr->setEnabled(false);
816 gate_label->setEnabled(false); 796 gate_label->setEnabled(false);
817 } 797 }
818 else { 798 else {
819 gatewayaddr->setEnabled(true); 799 gatewayaddr->setEnabled(true);
820 gatewayaddr->setText(""); 800 gatewayaddr->setText("");
821 gate_label->setEnabled(true); 801 gate_label->setEnabled(true);
822 } 802 }
823} 803}
824 804
825 805
826 806
827ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) 807ScriptWidget::ScriptWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
828 : QWidget(parent, name),_pppdata(pd) 808 : QWidget(parent, name),_pppdata(pd)
829{ 809{
830 810
831 QVBoxLayout *tl = new QVBoxLayout(this, 0 ); 811 QVBoxLayout *tl = new QVBoxLayout(this, 0 );
832 se = new ScriptEdit(this); 812 se = new ScriptEdit(this);
833 connect(se, SIGNAL(returnPressed()), SLOT(addButton())); 813 connect(se, SIGNAL(returnPressed()), SLOT(addButton()));
834 tl->addWidget(se); 814 tl->addWidget(se);
835 815
836 // insert equal-sized buttons 816 // insert equal-sized buttons
837 QHBoxLayout *hl = new QHBoxLayout( this ); 817 QHBoxLayout *hl = new QHBoxLayout( this );
838 tl->addLayout( hl ); 818 tl->addLayout( hl );
839 add = new QPushButton( i18n("Add"), this ); 819 add = new QPushButton( tr("Add"), this );
840 hl->addWidget( add ); 820 hl->addWidget( add );
841 connect(add, SIGNAL(clicked()), SLOT(addButton())); 821 connect(add, SIGNAL(clicked()), SLOT(addButton()));
842 insert = new QPushButton( i18n("Insert"), this ); 822 insert = new QPushButton( tr("Insert"), this );
843 hl->addWidget( insert ); 823 hl->addWidget( insert );
844 connect(insert, SIGNAL(clicked()), SLOT(insertButton())); 824 connect(insert, SIGNAL(clicked()), SLOT(insertButton()));
845 remove = new QPushButton( i18n("Remove"), this ); 825 remove = new QPushButton( tr("Remove"), this );
846 hl->addWidget( remove ); 826 hl->addWidget( remove );
847 connect(remove, SIGNAL(clicked()), SLOT(removeButton())); 827 connect(remove, SIGNAL(clicked()), SLOT(removeButton()));
848 828
849 QHBoxLayout *l12 = new QHBoxLayout(0); 829 QHBoxLayout *l12 = new QHBoxLayout(0);
850 tl->addLayout(l12); 830 tl->addLayout(l12);
851 stl = new QListBox(this); 831 stl = new QListBox(this);
852// stl->setVScrollBarMode( QScrollView::AlwaysOff ); 832// stl->setVScrollBarMode( QScrollView::AlwaysOff );
853 connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); 833 connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int)));
854// stl->setMinimumSize(QSize(70, 140)); 834// stl->setMinimumSize(QSize(70, 140));
855 835
856 sl = new QListBox(this); 836 sl = new QListBox(this);
857// sl->setVScrollBarMode( QScrollView::AlwaysOff ); 837// sl->setVScrollBarMode( QScrollView::AlwaysOff );
858 connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); 838 connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int)));
859// sl->setMinimumSize(QSize(150, 140)); 839// sl->setMinimumSize(QSize(150, 140));
860 840
861 slb = new QScrollBar(this); 841 slb = new QScrollBar(this);
862// slb->setFixedWidth(slb->sizeHint().width()); 842// slb->setFixedWidth(slb->sizeHint().width());
863 connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); 843 connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int)));
864 844
865 l12->addWidget(stl, 1); 845 l12->addWidget(stl, 1);
866 l12->addWidget(sl, 3); 846 l12->addWidget(sl, 3);
867 l12->addWidget(slb, 0); 847 l12->addWidget(slb, 0);
868 848
869 //load data from gpppdata 849 //load data from gpppdata
870 if(!isnewaccount) { 850 if(!isnewaccount) {
871 QStringList &comlist = _pppdata->scriptType(); 851 QStringList &comlist = _pppdata->scriptType();
872 QStringList &arglist = _pppdata->script(); 852 QStringList &arglist = _pppdata->script();
873 QStringList::Iterator itcom = comlist.begin(); 853 QStringList::Iterator itcom = comlist.begin();
874 QStringList::Iterator itarg = arglist.begin(); 854 QStringList::Iterator itarg = arglist.begin();
875 855
876 for ( ; 856 for ( ;
877 itcom != comlist.end() && itarg != arglist.end(); 857 itcom != comlist.end() && itarg != arglist.end();
878 ++itcom, ++itarg ) 858 ++itcom, ++itarg )
879 { 859 {
880 stl->insertItem(*itcom); 860 stl->insertItem(*itcom);
881 sl->insertItem(*itarg); 861 sl->insertItem(*itarg);
882 } 862 }
883 } 863 }
884 864
885 insert->setEnabled(false); 865 insert->setEnabled(false);
886 remove->setEnabled(false); 866 remove->setEnabled(false);
887 adjustScrollBar(); 867 adjustScrollBar();
888 tl->activate(); 868 tl->activate();
889} 869}
890 870
891bool ScriptWidget::check() { 871bool ScriptWidget::check() {
892 uint lstart = 0; 872 uint lstart = 0;
893 uint lend = 0; 873 uint lend = 0;
@@ -1110,89 +1090,89 @@ void ScriptWidget::insertButton() {
1110 stl->insertItem("LoopStart", stl->currentItem()); 1090 stl->insertItem("LoopStart", stl->currentItem());
1111 sl->insertItem(se->text(), sl->currentItem()); 1091 sl->insertItem(se->text(), sl->currentItem());
1112 break; 1092 break;
1113 1093
1114 case ScriptEdit::LoopEnd: 1094 case ScriptEdit::LoopEnd:
1115 stl->insertItem("LoopEnd", stl->currentItem()); 1095 stl->insertItem("LoopEnd", stl->currentItem());
1116 sl->insertItem(se->text(), sl->currentItem()); 1096 sl->insertItem(se->text(), sl->currentItem());
1117 break; 1097 break;
1118 1098
1119 case ScriptEdit::Scan: 1099 case ScriptEdit::Scan:
1120 stl->insertItem("Scan", stl->currentItem()); 1100 stl->insertItem("Scan", stl->currentItem());
1121 sl->insertItem(se->text(), sl->currentItem()); 1101 sl->insertItem(se->text(), sl->currentItem());
1122 break; 1102 break;
1123 1103
1124 case ScriptEdit::Save: 1104 case ScriptEdit::Save:
1125 stl->insertItem("Save", stl->currentItem()); 1105 stl->insertItem("Save", stl->currentItem());
1126 sl->insertItem(se->text(), sl->currentItem()); 1106 sl->insertItem(se->text(), sl->currentItem());
1127 break; 1107 break;
1128 1108
1129 default: 1109 default:
1130 break; 1110 break;
1131 } 1111 }
1132 adjustScrollBar(); 1112 adjustScrollBar();
1133 se->setText(""); 1113 se->setText("");
1134} 1114}
1135 1115
1136 1116
1137void ScriptWidget::removeButton() { 1117void ScriptWidget::removeButton() {
1138 if(sl->currentItem() >= 0) { 1118 if(sl->currentItem() >= 0) {
1139 int stlc = stl->currentItem(); 1119 int stlc = stl->currentItem();
1140 sl->removeItem(sl->currentItem()); 1120 sl->removeItem(sl->currentItem());
1141 stl->removeItem(stlc); 1121 stl->removeItem(stlc);
1142 adjustScrollBar(); 1122 adjustScrollBar();
1143 insert->setEnabled(sl->currentItem() != -1); 1123 insert->setEnabled(sl->currentItem() != -1);
1144 remove->setEnabled(sl->currentItem() != -1); 1124 remove->setEnabled(sl->currentItem() != -1);
1145 } 1125 }
1146} 1126}
1147 1127
1148 1128
1149 1129
1150///////////////////////////////////////////////////////////////////////////// 1130/////////////////////////////////////////////////////////////////////////////
1151// 1131//
1152// Used to specify a new phone number 1132// Used to specify a new phone number
1153// 1133//
1154///////////////////////////////////////////////////////////////////////////// 1134/////////////////////////////////////////////////////////////////////////////
1155PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) 1135PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
1156 : QDialog(parent,"PhoneNumberDialog",true) 1136 : QDialog(parent,"PhoneNumberDialog",true)
1157{ 1137{
1158 setCaption( i18n("Add Phone Number") ); 1138 setCaption( tr("Add Phone Number") );
1159 1139
1160 1140
1161 QVBoxLayout *layout = new QVBoxLayout( this ); 1141 QVBoxLayout *layout = new QVBoxLayout( this );
1162 layout->setSpacing( 3 ); 1142 layout->setSpacing( 3 );
1163 layout->setMargin( 3 ); 1143 layout->setMargin( 3 );
1164 1144
1165// QHBox *hbox = new QHBox(this); 1145// QHBox *hbox = new QHBox(this);
1166// setMainWidget(hbox); 1146// setMainWidget(hbox);
1167 1147
1168// hbox->setSpacing( 2 );//KDialog::spacingHint()); 1148// hbox->setSpacing( 2 );//KDialog::spacingHint());
1169 1149
1170 QLabel *label = new QLabel(this, tr("Enter a phone number:")); 1150 QLabel *label = new QLabel(this, tr("Enter a phone number:"));
1171 layout->addWidget( label ); 1151 layout->addWidget( label );
1172 1152
1173 le = new QLineEdit(this, "lineEdit"); 1153 le = new QLineEdit(this, "lineEdit");
1174 layout->addWidget( le ); 1154 layout->addWidget( le );
1175 1155
1176 connect(le, SIGNAL(textChanged(const QString &)), 1156 connect(le, SIGNAL(textChanged(const QString &)),
1177 this, SLOT(textChanged(const QString &))); 1157 this, SLOT(textChanged(const QString &)));
1178 1158
1179 le->setFocus(); 1159 le->setFocus();
1180 textChanged(""); 1160 textChanged("");
1181 1161
1182 1162
1183} 1163}
1184 1164
1185 1165
1186QString PhoneNumberDialog::phoneNumber() { 1166QString PhoneNumberDialog::phoneNumber() {
1187 QString s = le->text(); 1167 QString s = le->text();
1188 1168
1189 return s; 1169 return s;
1190} 1170}
1191 1171
1192 1172
1193void PhoneNumberDialog::textChanged(const QString &s) { 1173void PhoneNumberDialog::textChanged(const QString &s) {
1194// enableButtonOK(s.length() > 0); 1174// enableButtonOK(s.length() > 0);
1195} 1175}
1196 1176
1197 1177
1198//#include "edit.moc" 1178//#include "edit.moc"
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 7a6524f..517dd8b 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -85,97 +85,97 @@ void PPPData::save()
85 Config cfg = config(); 85 Config cfg = config();
86 for( QMap<QString,QString>::Iterator it = stringEntries.begin(); 86 for( QMap<QString,QString>::Iterator it = stringEntries.begin();
87 it != stringEntries.end(); ++it ){ 87 it != stringEntries.end(); ++it ){
88 QString val = it.data(); 88 QString val = it.data();
89 key = it.key(); 89 key = it.key();
90// qDebug("saving %s -> %s", key.latin1(), val.latin1() ); 90// qDebug("saving %s -> %s", key.latin1(), val.latin1() );
91 keys = QStringList::split( "SEPARATOR", key ); 91 keys = QStringList::split( "SEPARATOR", key );
92 qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); 92 qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
93 cfg.setGroup(keys[0]); 93 cfg.setGroup(keys[0]);
94 cfg.writeEntry(keys[1], val); 94 cfg.writeEntry(keys[1], val);
95 } 95 }
96 for( QMap<QString,int>::Iterator it = intEntries.begin(); 96 for( QMap<QString,int>::Iterator it = intEntries.begin();
97 it != intEntries.end(); ++it ){ 97 it != intEntries.end(); ++it ){
98 int val = it.data(); 98 int val = it.data();
99 key = it.key(); 99 key = it.key();
100// qDebug("saving %s -> %i", key.latin1(), val ); 100// qDebug("saving %s -> %i", key.latin1(), val );
101 keys = QStringList::split( "SEPARATOR", key ); 101 keys = QStringList::split( "SEPARATOR", key );
102 qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); 102 qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val );
103 cfg.setGroup(keys[0]); 103 cfg.setGroup(keys[0]);
104 cfg.writeEntry(keys[1], val); 104 cfg.writeEntry(keys[1], val);
105 } 105 }
106 for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); 106 for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
107 it != listEntries.end(); ++it ){ 107 it != listEntries.end(); ++it ){
108 QStringList val = it.data(); 108 QStringList val = it.data();
109 key = it.key(); 109 key = it.key();
110 QChar sep = sepEntries[key]; 110 QChar sep = sepEntries[key];
111// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); 111// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() );
112 keys = QStringList::split( "SEPARATOR", key ); 112 keys = QStringList::split( "SEPARATOR", key );
113 qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() ); 113 qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() );
114 cfg.setGroup(keys[0]); 114 cfg.setGroup(keys[0]);
115 cfg.writeEntry(keys[1], val, sep); 115 cfg.writeEntry(keys[1], val, sep);
116 } 116 }
117} 117}
118 118
119 119
120// 120//
121// cancel changes 121// cancel changes
122// 122//
123void PPPData::cancel() { 123void PPPData::cancel() {
124 stringEntries.clear(); 124 stringEntries.clear();
125 intEntries.clear(); 125 intEntries.clear();
126 listEntries.clear(); 126 listEntries.clear();
127} 127}
128 128
129// functions to read/write date to configuration file 129// functions to read/write date to configuration file
130QString PPPData::readConfig(const QString &group, const QString &key, 130QString PPPData::readConfig(const QString &group, const QString &key,
131 const QString &defvalue = "") 131 const QString &defvalue = "")
132{ 132{
133 qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); 133// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
134 QString idx = SEP.arg(group).arg(key); 134 QString idx = SEP.arg(group).arg(key);
135 if (stringEntries.find(idx) != stringEntries.end()) 135 if (stringEntries.find(idx) != stringEntries.end())
136 return stringEntries[idx]; 136 return stringEntries[idx];
137 Config cfg = config(); 137 Config cfg = config();
138 cfg.setGroup(group); 138 cfg.setGroup(group);
139 return cfg.readEntry(key, defvalue); 139 return cfg.readEntry(key, defvalue);
140} 140}
141 141
142 142
143int PPPData::readNumConfig(const QString &group, const QString &key, 143int PPPData::readNumConfig(const QString &group, const QString &key,
144 int defvalue) 144 int defvalue)
145{ 145{
146 QString idx = SEP.arg(group).arg(key); 146 QString idx = SEP.arg(group).arg(key);
147 if (intEntries.find(idx) != intEntries.end()) 147 if (intEntries.find(idx) != intEntries.end())
148 return intEntries[idx]; 148 return intEntries[idx];
149 Config cfg = config(); 149 Config cfg = config();
150 cfg.setGroup(group); 150 cfg.setGroup(group);
151 return cfg.readNumEntry(key, defvalue); 151 return cfg.readNumEntry(key, defvalue);
152 152
153// if (config) { 153// if (config) {
154// config->setGroup(group); 154// config->setGroup(group);
155// return config->readNumEntry(key, defvalue); 155// return config->readNumEntry(key, defvalue);
156// } else 156// } else
157// return defvalue; 157// return defvalue;
158 158
159} 159}
160 160
161 161
162bool PPPData::readListConfig(const QString &group, const QString &key, 162bool PPPData::readListConfig(const QString &group, const QString &key,
163 QStringList &list, char sep) { 163 QStringList &list, char sep) {
164 list.clear(); 164 list.clear();
165 QString idx = SEP.arg(group).arg(key); 165 QString idx = SEP.arg(group).arg(key);
166 if (listEntries.find(idx) != listEntries.end()){ 166 if (listEntries.find(idx) != listEntries.end()){
167 list = listEntries[idx]; 167 list = listEntries[idx];
168 return true; 168 return true;
169 } 169 }
170 Config cfg = config(); 170 Config cfg = config();
171 cfg.setGroup(group); 171 cfg.setGroup(group);
172 list = cfg.readListEntry(key, sep); 172 list = cfg.readListEntry(key, sep);
173 if (list.count() > 0) return true; 173 if (list.count() > 0) return true;
174 return false; 174 return false;
175 175
176// if (config) { 176// if (config) {
177// config->setGroup(group); 177// config->setGroup(group);
178// list = config->readListEntry(key, sep); 178// list = config->readListEntry(key, sep);
179// return true; 179// return true;
180// } else 180// } else
181// return false; 181// return false;