summaryrefslogtreecommitdiff
authortille <tille>2003-05-25 18:19:04 (UTC)
committer tille <tille>2003-05-25 18:19:04 (UTC)
commit2ec401058a04c15d2725c94d38226d0ac4505496 (patch) (unidiff)
treebbe34da6b452cb01f31e5a08acf114c8c9641c32
parent7e1dce1560e45ef7fad91a8da2d0d96c1b166df9 (diff)
downloadopie-2ec401058a04c15d2725c94d38226d0ac4505496.zip
opie-2ec401058a04c15d2725c94d38226d0ac4505496.tar.gz
opie-2ec401058a04c15d2725c94d38226d0ac4505496.tar.bz2
saves configured interfaces now
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/TODO6
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp42
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp8
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp54
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h23
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp23
6 files changed, 78 insertions, 78 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO
new file mode 100644
index 0000000..2410880
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/TODO
@@ -0,0 +1,6 @@
1- impl. PPPData::copyaccount & PPPData::deleteAccount
2- update modem attribute inputs when modem has changed
3- fix layout of edit account
4- save pppd arguments in edit account
5- popup configure modem with the correct account prselected
6 not quite shure why it does not work... IMHO it should work
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index 19db9ef..11d4739 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -1,399 +1,373 @@
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> 38//#include <klocale.h>
39#define i18n QObject::tr 39#define i18n QObject::tr
40//#include <kglobal.h> 40//#include <kglobal.h>
41//#include <kwin.h> 41//#include <kwin.h>
42//#include <kdialogbase.h> 42//#include <kdialogbase.h>
43#include <qvgroupbox.h> 43#include <qvgroupbox.h>
44 44
45#include "pppdata.h" 45#include "pppdata.h"
46#include "accounts.h" 46#include "accounts.h"
47//#include "accounting.h" 47//#include "accounting.h"
48//#include "providerdb.h" 48//#include "providerdb.h"
49#include "edit.h" 49#include "edit.h"
50 50
51void parseargs(char* buf, char** args); 51void parseargs(char* buf, char** args);
52 52
53AccountWidget::AccountWidget( QWidget *parent, const char *name ) 53AccountWidget::AccountWidget( QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name )
55{ 55{
56// int min = 0;
57 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 56 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
58
59 // add a hbox
60// QHBoxLayout *l11 = new QHBoxLayout;
61// l1->addLayout(l11);
62
63 accountlist_l = new QListBox(this); 57 accountlist_l = new QListBox(this);
64// accountlist_l->setMinimumSize(160, 128); 58
65 connect(accountlist_l, SIGNAL(highlighted(int)), 59 connect(accountlist_l, SIGNAL(highlighted(int)),
66 this, SLOT(slotListBoxSelect(int))); 60 this, SLOT(slotListBoxSelect(int)));
67 connect(accountlist_l, SIGNAL(selected(int)), 61 connect(accountlist_l, SIGNAL(selected(int)),
68 this, SLOT(editaccount())); 62 this, SLOT(editaccount()));
69 l1->addWidget(accountlist_l, 10); 63 l1->addWidget(accountlist_l, 10);
70 64
71// QVBoxLayout *l111 = new QVBoxLayout(this);
72// l11->addLayout(l111, 1);
73 edit_b = new QPushButton(i18n("&Edit..."), this); 65 edit_b = new QPushButton(i18n("&Edit..."), this);
74 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount())); 66 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount()));
75 QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account")); 67 QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account"));
76
77// min = edit_b->sizeHint().width();
78// min = QMAX(70,min);
79// edit_b->setMinimumWidth(min);
80
81 l1->addWidget(edit_b); 68 l1->addWidget(edit_b);
82 69
83 new_b = new QPushButton(i18n("&New..."), this); 70 new_b = new QPushButton(i18n("&New..."), this);
84 connect(new_b, SIGNAL(clicked()), SLOT(newaccount())); 71 connect(new_b, SIGNAL(clicked()), SLOT(newaccount()));
85 l1->addWidget(new_b); 72 l1->addWidget(new_b);
86 QWhatsThis::add(new_b, i18n("Create a new dialup connection\n" 73 QWhatsThis::add(new_b, i18n("Create a new dialup connection\n"
87 "to the Internet")); 74 "to the Internet"));
88 75
89 copy_b = new QPushButton(i18n("Co&py"), this); 76 copy_b = new QPushButton(i18n("Co&py"), this);
90 connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount())); 77 connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount()));
91 l1->addWidget(copy_b); 78 l1->addWidget(copy_b);
92 QWhatsThis::add(copy_b, 79 QWhatsThis::add(copy_b,
93 i18n("Makes a copy of the selected account. All\n" 80 i18n("Makes a copy of the selected account. All\n"
94 "settings of the selected account are copied\n" 81 "settings of the selected account are copied\n"
95 "to a new account, that you can modify to fit your\n" 82 "to a new account, that you can modify to fit your\n"
96 "needs")); 83 "needs"));
97 84
98 delete_b = new QPushButton(i18n("De&lete"), this); 85 delete_b = new QPushButton(i18n("De&lete"), this);
99 connect(delete_b, SIGNAL(clicked()), SLOT(deleteaccount())); 86 connect(delete_b, SIGNAL(clicked()), SLOT(deleteaccount()));
100 l1->addWidget(delete_b); 87 l1->addWidget(delete_b);
101 QWhatsThis::add(delete_b, 88 QWhatsThis::add(delete_b,
102 i18n("<p>Deletes the selected account\n\n" 89 i18n("<p>Deletes the selected account\n\n"
103 "<font color=\"red\"><b>Use with care!</b></font>")); 90 "<font color=\"red\"><b>Use with care!</b></font>"));
104 91
105 QHBoxLayout *l12 = new QHBoxLayout; 92 QHBoxLayout *l12 = new QHBoxLayout;
106 l1->addStretch(1); 93 l1->addStretch(1);
107 l1->addLayout(l12); 94 l1->addLayout(l12);
108 95
109// QVBoxLayout *l121 = new QVBoxLayout; 96// QVBoxLayout *l121 = new QVBoxLayout;
110// l12->addLayout(l121); 97// l12->addLayout(l121);
111// l121->addStretch(1); 98// l121->addStretch(1);
112 // costlabel = new QLabel(i18n("Phone costs:"), parent); 99 // costlabel = new QLabel(i18n("Phone costs:"), parent);
113// costlabel->setEnabled(FALSE); 100// costlabel->setEnabled(FALSE);
114// l121->addWidget(costlabel); 101// l121->addWidget(costlabel);
115 102
116// costedit = new QLineEdit(parent); 103// costedit = new QLineEdit(parent);
117// costedit->setFocusPolicy(QWidget::NoFocus); 104// costedit->setFocusPolicy(QWidget::NoFocus);
118// costedit->setFixedHeight(costedit->sizeHint().height()); 105// costedit->setFixedHeight(costedit->sizeHint().height());
119// costedit->setEnabled(FALSE); 106// costedit->setEnabled(FALSE);
120// l121->addWidget(costedit); 107// l121->addWidget(costedit);
121// l121->addStretch(1); 108// l121->addStretch(1);
122// QString tmp = i18n("<p>This shows the accumulated phone costs\n" 109// QString tmp = i18n("<p>This shows the accumulated phone costs\n"
123 // "for the selected account.\n" 110 // "for the selected account.\n"
124 // "\n" 111 // "\n"
125 // "<b>Important</b>: If you have more than one \n" 112 // "<b>Important</b>: If you have more than one \n"
126 // "account - beware, this is <b>NOT</b> the sum \n" 113 // "account - beware, this is <b>NOT</b> the sum \n"
127 // "of the phone costs of all your accounts!"); 114 // "of the phone costs of all your accounts!");
128// QWhatsThis::add(costlabel, tmp); 115// QWhatsThis::add(costlabel, tmp);
129// QWhatsThis::add(costedit, tmp); 116// QWhatsThis::add(costedit, tmp);
130 117
131// vollabel = new QLabel(i18n("Volume:"), parent); 118// vollabel = new QLabel(i18n("Volume:"), parent);
132// vollabel->setEnabled(FALSE); 119// vollabel->setEnabled(FALSE);
133// l121->addWidget(vollabel); 120// l121->addWidget(vollabel);
134 121
135// voledit = new QLineEdit(parent,"voledit"); 122// voledit = new QLineEdit(parent,"voledit");
136// voledit->setFocusPolicy(QWidget::NoFocus); 123// voledit->setFocusPolicy(QWidget::NoFocus);
137// voledit->setFixedHeight(voledit->sizeHint().height()); 124// voledit->setFixedHeight(voledit->sizeHint().height());
138// voledit->setEnabled(FALSE); 125// voledit->setEnabled(FALSE);
139// l121->addWidget(voledit); 126// l121->addWidget(voledit);
140// tmp = i18n("<p>This shows the number of bytes transferred\n" 127// tmp = i18n("<p>This shows the number of bytes transferred\n"
141 // "for the selected account (not for all of your\n" 128 // "for the selected account (not for all of your\n"
142 // "accounts. You can select what to display in\n" 129 // "accounts. You can select what to display in\n"
143 // "the accounting dialog.\n" 130 // "the accounting dialog.\n"
144 // "\n" 131 // "\n"
145 // "<a href=\"#volaccounting\">More on volume accounting</a>"); 132 // "<a href=\"#volaccounting\">More on volume accounting</a>");
146 133
147// QWhatsThis::add(vollabel,tmp); 134// QWhatsThis::add(vollabel,tmp);
148// QWhatsThis::add(voledit, tmp); 135// QWhatsThis::add(voledit, tmp);
149 136
150// QVBoxLayout *l122 = new QVBoxLayout; 137// QVBoxLayout *l122 = new QVBoxLayout;
151// l12->addStretch(1); 138// l12->addStretch(1);
152// l12->addLayout(l122); 139// l12->addLayout(l122);
153 140
154// l122->addStretch(1); 141// l122->addStretch(1);
155// reset = new QPushButton(i18n("&Reset..."), parent); 142// reset = new QPushButton(i18n("&Reset..."), parent);
156// reset->setEnabled(FALSE); 143// reset->setEnabled(FALSE);
157// connect(reset, SIGNAL(clicked()), 144// connect(reset, SIGNAL(clicked()),
158 // this, SLOT(resetClicked())); 145 // this, SLOT(resetClicked()));
159// l122->addWidget(reset); 146// l122->addWidget(reset);
160 147
161// log = new QPushButton(i18n("&View Logs"), this); 148// log = new QPushButton(i18n("&View Logs"), this);
162// connect(log, SIGNAL(clicked()), 149// connect(log, SIGNAL(clicked()),
163 // this, SLOT(viewLogClicked())); 150 // this, SLOT(viewLogClicked()));
164// l122->addWidget(log); 151// l122->addWidget(log);
165// l122->addStretch(1); 152// l122->addStretch(1);
166 153
167 //load up account list from gppdata to the list box 154 //load up account list from gppdata to the list box
168 if(PPPData::data()->count() > 0) { 155 if(PPPData::data()->count() > 0) {
169 for(int i=0; i <= PPPData::data()->count()-1; i++) { 156 for(int i=0; i <= PPPData::data()->count()-1; i++) {
170 PPPData::data()->setAccountbyIndex(i); 157 PPPData::data()->setAccountbyIndex(i);
171 accountlist_l->insertItem(PPPData::data()->accname()); 158 accountlist_l->insertItem(PPPData::data()->accname());
172 } 159 }
173 } 160 }
174 161
175 slotListBoxSelect(accountlist_l->currentItem()); 162// slotListBoxSelect(accountlist_l->currentItem());
163 qDebug("setting listview index to %i",PPPData::data()->currentAccountID() );
164 accountlist_l->setCurrentItem( PPPData::data()->currentAccountID() );
165// slotListBoxSelect( PPPData::data()->currentAccountID());
176 166
177 l1->activate(); 167 l1->activate();
178} 168}
179 169
180 170
181 171
182void AccountWidget::slotListBoxSelect(int idx) { 172void AccountWidget::slotListBoxSelect(int idx) {
183 delete_b->setEnabled((bool)(idx != -1)); 173 delete_b->setEnabled((bool)(idx != -1));
184 edit_b->setEnabled((bool)(idx != -1)); 174 edit_b->setEnabled((bool)(idx != -1));
185 copy_b->setEnabled((bool)(idx != -1)); 175 copy_b->setEnabled((bool)(idx != -1));
186 if(idx!=-1) { 176 if(idx!=-1) {
177 qDebug("setting account to %i", idx);
187 QString account = PPPData::data()->accname(); 178 QString account = PPPData::data()->accname();
188 PPPData::data()->setAccountbyIndex(accountlist_l->currentItem()); 179 PPPData::data()->setAccountbyIndex(accountlist_l->currentItem());
189// reset->setEnabled(TRUE); 180 // PPPData::data()->setAccount(account);
190// costlabel->setEnabled(TRUE); 181 }
191// costedit->setEnabled(TRUE);
192// costedit->setText(AccountingBase::getCosts(accountlist_l->text(accountlist_l->currentItem())));
193
194// vollabel->setEnabled(TRUE);
195// voledit->setEnabled(TRUE);
196// int bytes = PPPData::data()->totalBytes();
197// voledit->setText(prettyPrintVolume(bytes));
198 PPPData::data()->setAccount(account);
199 } else{
200 // reset->setEnabled(FALSE);
201// costlabel->setEnabled(FALSE);
202// costedit->setText("");
203// costedit->setEnabled(FALSE);
204// vollabel->setEnabled(FALSE);
205// voledit->setText("");
206// voledit->setEnabled(FALSE);
207 }
208} 182}
209 183
210 184
211// void AccountWidget::viewLogClicked(){ 185// void AccountWidget::viewLogClicked(){
212 186
213// QApplication::flushX(); 187// QApplication::flushX();
214// if(fork() == 0) { 188// if(fork() == 0) {
215// setgid(getgid()); 189// setgid(getgid());
216// setuid(getuid()); 190// setuid(getuid());
217// system("kppplogview -kppp"); 191// system("kppplogview -kppp");
218// _exit(0); 192// _exit(0);
219// } 193// }
220// } 194// }
221 195
222 196
223// void AccountWidget::resetClicked(){ 197// void AccountWidget::resetClicked(){
224// if(accountlist_l->currentItem() == -1) 198// if(accountlist_l->currentItem() == -1)
225// return; 199// return;
226 200
227// // QueryReset dlg(this); 201// // QueryReset dlg(this);
228// // int what = dlg.exec(); 202// // int what = dlg.exec();
229 203
230// // if(what && QueryReset::COSTS) { 204// // if(what && QueryReset::COSTS) {
231// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem())); 205// // emit resetCosts(accountlist_l->text(accountlist_l->currentItem()));
232// // costedit->setText("0"); 206// // costedit->setText("0");
233// // } 207// // }
234 208
235// // if(what && QueryReset::VOLUME) { 209// // if(what && QueryReset::VOLUME) {
236// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem())); 210// // emit resetVolume(accountlist_l->text(accountlist_l->currentItem()));
237// // voledit->setText(prettyPrintVolume(0)); 211// // voledit->setText(prettyPrintVolume(0));
238// // } 212// // }
239// } 213// }
240 214
241 215
242void AccountWidget::editaccount() { 216void AccountWidget::editaccount() {
243 PPPData::data()->setAccount(accountlist_l->text(accountlist_l->currentItem())); 217 PPPData::data()->setAccount(accountlist_l->text(accountlist_l->currentItem()));
244 218
245 int result = doTab(); 219 int result = doTab();
246 220
247 if(result == QDialog::Accepted) { 221 if(result == QDialog::Accepted) {
248 accountlist_l->changeItem(PPPData::data()->accname(),accountlist_l->currentItem()); 222 accountlist_l->changeItem(PPPData::data()->accname(),accountlist_l->currentItem());
249// emit resetaccounts(); 223// emit resetaccounts();
250 PPPData::data()->save(); 224 PPPData::data()->save();
251 } 225 }
252} 226}
253 227
254 228
255void AccountWidget::newaccount() { 229void AccountWidget::newaccount() {
256 if(accountlist_l->count() == MAX_ACCOUNTS) { 230 if(accountlist_l->count() == MAX_ACCOUNTS) {
257 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached.")); 231 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached."));
258 return; 232 return;
259 } 233 }
260 234
261 int result; 235 int result;
262// int query = QMessageBox::information(this, 236// int query = QMessageBox::information(this,
263// i18n("Do you want to use the wizard to create the new account or the " 237// i18n("Do you want to use the wizard to create the new account or the "
264 // "standard, dialog-based setup?\n" 238 // "standard, dialog-based setup?\n"
265 // "The wizard is easier and sufficient in most cases. If you need " 239 // "The wizard is easier and sufficient in most cases. If you need "
266 // "very special settings, you might want to try the standard, " 240 // "very special settings, you might want to try the standard, "
267 // "dialog-based setup."), 241 // "dialog-based setup."),
268 // i18n("Create New Account"), 242 // i18n("Create New Account"),
269 // i18n("Wizard"), i18n("Dialog Setup"), i18n("Cancel")); 243 // i18n("Wizard"), i18n("Dialog Setup"), i18n("Cancel"));
270 244
271// switch(query) { 245// switch(query) {
272// case QMessageBox::Yes: 246// case QMessageBox::Yes:
273// { 247// {
274// if (PPPData::data()->newaccount() == -1) 248// if (PPPData::data()->newaccount() == -1)
275 // return; 249 // return;
276// // ProviderDB pdb(this); 250// // ProviderDB pdb(this);
277// // result = pdb.exec(); 251// // result = pdb.exec();
278// break; 252// break;
279// } 253// }
280// case QMessageBox::No: 254// case QMessageBox::No:
281 if (PPPData::data()->newaccount() == -1){ 255 if (PPPData::data()->newaccount() == -1){
282 qDebug("PPPData::data()->newaccount() == -1"); 256 qDebug("PPPData::data()->newaccount() == -1");
283 return; 257 return;
284 } 258 }
285 result = doTab(); 259 result = doTab();
286// break; 260// break;
287// default: 261// default:
288// return; 262// return;
289// } 263// }
290 264
291 if(result == QDialog::Accepted) { 265 if(result == QDialog::Accepted) {
292 accountlist_l->insertItem(PPPData::data()->accname()); 266 accountlist_l->insertItem(PPPData::data()->accname());
293 accountlist_l->setSelected(accountlist_l->findItem(PPPData::data()->accname()), 267 accountlist_l->setSelected(accountlist_l->findItem(PPPData::data()->accname()),
294 true); 268 true);
295// emit resetaccounts(); 269// emit resetaccounts();
296 PPPData::data()->save(); 270 PPPData::data()->save();
297 } else 271 } else
298 PPPData::data()->deleteAccount(); 272 PPPData::data()->deleteAccount();
299} 273}
300 274
301 275
302void AccountWidget::copyaccount() { 276void AccountWidget::copyaccount() {
303 if(accountlist_l->count() == MAX_ACCOUNTS) { 277 if(accountlist_l->count() == MAX_ACCOUNTS) {
304 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached.")); 278 QMessageBox::information(this, "sorry", i18n("Maximum number of accounts reached."));
305 return; 279 return;
306 } 280 }
307 281
308 if(accountlist_l->currentItem()<0) { 282 if(accountlist_l->currentItem()<0) {
309 QMessageBox::information(this, "sorry", i18n("No account selected.")); 283 QMessageBox::information(this, "sorry", i18n("No account selected."));
310 return; 284 return;
311 } 285 }
312 286
313 PPPData::data()->copyaccount(accountlist_l->currentItem()); 287 PPPData::data()->copyaccount(accountlist_l->currentItem());
314 288
315 accountlist_l->insertItem(PPPData::data()->accname()); 289 accountlist_l->insertItem(PPPData::data()->accname());
316// emit resetaccounts(); 290// emit resetaccounts();
317 PPPData::data()->save(); 291 PPPData::data()->save();
318} 292}
319 293
320 294
321void AccountWidget::deleteaccount() { 295void AccountWidget::deleteaccount() {
322 296
323 QString s = i18n("Are you sure you want to delete\nthe account \"%1\"?") 297 QString s = i18n("Are you sure you want to delete\nthe account \"%1\"?")
324 .arg(accountlist_l->text(accountlist_l->currentItem())); 298 .arg(accountlist_l->text(accountlist_l->currentItem()));
325 299
326 if(QMessageBox::warning(this, s, i18n("Confirm")) != QMessageBox::Yes) 300 if(QMessageBox::warning(this, s, i18n("Confirm")) != QMessageBox::Yes)
327 return; 301 return;
328 302
329 if(PPPData::data()->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) 303 if(PPPData::data()->deleteAccount(accountlist_l->text(accountlist_l->currentItem())))
330 accountlist_l->removeItem(accountlist_l->currentItem()); 304 accountlist_l->removeItem(accountlist_l->currentItem());
331 305
332 emit resetaccounts(); 306 emit resetaccounts();
333 PPPData::data()->save(); 307 PPPData::data()->save();
334 308
335 slotListBoxSelect(accountlist_l->currentItem()); 309 slotListBoxSelect(accountlist_l->currentItem());
336 310
337} 311}
338 312
339 313
340int AccountWidget::doTab(){ 314int AccountWidget::doTab(){
341 QDialog *dlg = new QDialog( this, "newAccount", true ); 315 QDialog *dlg = new QDialog( this, "newAccount", true );
342 QVBoxLayout *layout = new QVBoxLayout( dlg ); 316 QVBoxLayout *layout = new QVBoxLayout( dlg );
343 layout->setSpacing( 0 ); 317 layout->setSpacing( 0 );
344 layout->setMargin( 1 ); 318 layout->setMargin( 1 );
345 319
346 tabWindow = new QTabWidget( dlg, "tabWindow" ); 320 tabWindow = new QTabWidget( dlg, "tabWindow" );
347 layout->addWidget( tabWindow ); 321 layout->addWidget( tabWindow );
348 322
349 bool isnewaccount; 323 bool isnewaccount;
350 324
351 if(PPPData::data()->accname().isEmpty()) { 325 if(PPPData::data()->accname().isEmpty()) {
352 dlg->setCaption(i18n("New Account")); 326 dlg->setCaption(i18n("New Account"));
353 isnewaccount = true; 327 isnewaccount = true;
354 } else { 328 } else {
355 QString tit = i18n("Edit Account: "); 329 QString tit = i18n("Edit Account: ");
356 tit += PPPData::data()->accname(); 330 tit += PPPData::data()->accname();
357 dlg->setCaption(tit); 331 dlg->setCaption(tit);
358 isnewaccount = false; 332 isnewaccount = false;
359 } 333 }
360 334
361 dial_w = new DialWidget( tabWindow, isnewaccount, "Dial Setup"); 335 dial_w = new DialWidget( tabWindow, isnewaccount, "Dial Setup");
362 tabWindow->addTab( dial_w, i18n("Dial") ); 336 tabWindow->addTab( dial_w, i18n("Dial") );
363 ip_w = new IPWidget( tabWindow, isnewaccount, i18n("IP Setup")); 337 ip_w = new IPWidget( tabWindow, isnewaccount, i18n("IP Setup"));
364 tabWindow->addTab( ip_w, i18n("IP") ); 338 tabWindow->addTab( ip_w, i18n("IP") );
365 gateway_w = new GatewayWidget( tabWindow, isnewaccount, i18n("Gateway Setup")); 339 gateway_w = new GatewayWidget( tabWindow, isnewaccount, i18n("Gateway Setup"));
366 tabWindow->addTab( gateway_w, i18n("Gateway") ); 340 tabWindow->addTab( gateway_w, i18n("Gateway") );
367 dns_w = new DNSWidget( tabWindow, isnewaccount, i18n("DNS Servers") ); 341 dns_w = new DNSWidget( tabWindow, isnewaccount, i18n("DNS Servers") );
368 tabWindow->addTab( dns_w, i18n("DNS") ); 342 tabWindow->addTab( dns_w, i18n("DNS") );
369 script_w = new ScriptWidget( tabWindow, isnewaccount, i18n("Edit Login Script")); 343 script_w = new ScriptWidget( tabWindow, isnewaccount, i18n("Edit Login Script"));
370 tabWindow->addTab( script_w, i18n("Login Script") ); 344 tabWindow->addTab( script_w, i18n("Login Script") );
371 ExecWidget *exec_w = new ExecWidget( tabWindow, isnewaccount, i18n("Execute Programs")); 345 ExecWidget *exec_w = new ExecWidget( tabWindow, isnewaccount, i18n("Execute Programs"));
372 tabWindow->addTab( exec_w, i18n("Execute") ); 346 tabWindow->addTab( exec_w, i18n("Execute") );
373// acct = new AccountingSelector( tabWindow, isnewaccount ); 347// acct = new AccountingSelector( tabWindow, isnewaccount );
374// tabWindow->addTab( acct, i18n("Accounting")); 348// tabWindow->addTab( acct, i18n("Accounting"));
375 349
376 int result = 0; 350 int result = 0;
377 bool ok = false; 351 bool ok = false;
378 qDebug("AccountWidget::doTab dlg->showMinimized"); 352 qDebug("AccountWidget::doTab dlg->showMinimized");
379 dlg->showMinimized(); 353 dlg->showMinimized();
380 while (!ok){ 354 while (!ok){
381 355
382 result = dlg->exec(); 356 result = dlg->exec();
383 ok = true; 357 ok = true;
384 358
385 if(result == QDialog::Accepted) { 359 if(result == QDialog::Accepted) {
386 if (script_w->check()) { 360 if (script_w->check()) {
387 if(dial_w->save()) { 361 if(dial_w->save()) {
388 ip_w->save(); 362 ip_w->save();
389 dns_w->save(); 363 dns_w->save();
390 gateway_w->save(); 364 gateway_w->save();
391 script_w->save(); 365 script_w->save();
392 exec_w->save(); 366 exec_w->save();
393 // acct->save(); 367 // acct->save();
394 } else { 368 } else {
395 QMessageBox::critical(this, "error", i18n( "You must enter a unique\n" 369 QMessageBox::critical(this, "error", i18n( "You must enter a unique\n"
396 "account name")); 370 "account name"));
397 ok = false; 371 ok = false;
398 } 372 }
399 } else { 373 } else {
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index e2521a6..4c5f7aa 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -1,69 +1,77 @@
1 1
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qmessagebox.h> 3#include <qmessagebox.h>
4#include <qtabwidget.h> 4#include <qtabwidget.h>
5 5
6#include "accounts.h" 6#include "accounts.h"
7#include "general.h" 7#include "general.h"
8#include "interface.h" 8#include "interface.h"
9#include "modem.h" 9#include "modem.h"
10#include "pppconfig.h" 10#include "pppconfig.h"
11#include "pppdata.h" 11#include "pppdata.h"
12#include "runtests.h" 12#include "runtests.h"
13 13
14PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent, 14PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
15 const char *name, 15 const char *name,
16 bool modal, WFlags fl ) 16 bool modal, WFlags fl )
17 : QDialog(parent, name, modal, fl) 17 : QDialog(parent, name, modal, fl)
18{ 18{
19 setCaption(tr("Configure Modem")); 19 setCaption(tr("Configure Modem"));
20 int result = runTests(); 20 int result = runTests();
21 if(result == TEST_CRITICAL){ 21 if(result == TEST_CRITICAL){
22 QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") ); 22 QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") );
23 return; 23 return;
24 } 24 }
25 25
26 interface = iface; 26 interface = iface;
27 if (!PPPData::data()->setModemDevice( interface->getInterfaceName() )) 27 if (!PPPData::data()->setModemDevice( interface->getInterfaceName() ))
28 PPPData::data()->setModemDevice("/dev/modem"); 28 PPPData::data()->setModemDevice("/dev/modem");
29 qDebug("PPPConfigWidget::PPPConfigWidget");
30 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
29 if (!PPPData::data()->setAccount( interface->getHardwareName() )) 31 if (!PPPData::data()->setAccount( interface->getHardwareName() ))
30 PPPData::data()->setAccount( 0 ); 32 PPPData::data()->setAccount( 0 );
33
34 qDebug(" PPPData::data()->accname >%s<",PPPData::data()->accname().latin1());
35 qDebug(" PPPData::data()->currentAccountID() >%i<",PPPData::data()->currentAccountID());
31 (void)new Modem; 36 (void)new Modem;
32 37
33 QVBoxLayout *layout = new QVBoxLayout( this ); 38 QVBoxLayout *layout = new QVBoxLayout( this );
34 layout->setSpacing( 0 ); 39 layout->setSpacing( 0 );
35 layout->setMargin( 1 ); 40 layout->setMargin( 1 );
36 tabWindow = new QTabWidget( this, "tabWidget" ); 41 tabWindow = new QTabWidget( this, "tabWidget" );
37 layout->addWidget( tabWindow ); 42 layout->addWidget( tabWindow );
38 43
39 accounts = new AccountWidget( tabWindow, "accounts" ); 44 accounts = new AccountWidget( tabWindow, "accounts" );
40 tabWindow->addTab( accounts, tr("&Accounts") ); 45 tabWindow->addTab( accounts, tr("&Accounts") );
41 modem1 = new ModemWidget( tabWindow, "modem1" ); 46 modem1 = new ModemWidget( tabWindow, "modem1" );
42 tabWindow->addTab( modem1, tr("&Device") ); 47 tabWindow->addTab( modem1, tr("&Device") );
43 modem2 = new ModemWidget2( tabWindow, "modem2" ); 48 modem2 = new ModemWidget2( tabWindow, "modem2" );
44 tabWindow->addTab( modem2, tr("&Modem") ); 49 tabWindow->addTab( modem2, tr("&Modem") );
45// graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) ); 50// graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) );
46// general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) ); 51// general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) );
47 52
48} 53}
49 54
50 55
51PPPConfigWidget::~PPPConfigWidget() 56PPPConfigWidget::~PPPConfigWidget()
52{ 57{
53 58
54} 59}
55 60
56void PPPConfigWidget::accept() 61void PPPConfigWidget::accept()
57{ 62{
63 qDebug("PPPConfigWidget::accept");
64 qDebug(" PPPData::data()->accname >%s<",PPPData::data()->accname().latin1());
65 qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
58 interface->setInterfaceName( PPPData::data()->modemDevice() ); 66 interface->setInterfaceName( PPPData::data()->modemDevice() );
59 interface->setHardwareName( PPPData::data()->accname() ); 67 interface->setHardwareName( PPPData::data()->accname() );
60 PPPData::data()->save(); 68 PPPData::data()->save();
61 QDialog::accept(); 69 QDialog::accept();
62} 70}
63 71
64 72
65void PPPConfigWidget::reject() 73void PPPConfigWidget::reject()
66{ 74{
67 PPPData::data()->cancel(); 75 PPPData::data()->cancel();
68 QDialog::reject(); 76 QDialog::reject();
69} 77}
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 109e3b7..3f1675c 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -1,524 +1,522 @@
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 "pppdata.h" 27#include "pppdata.h"
28#include "runtests.h" 28#include "runtests.h"
29#include "devices.h" 29#include "devices.h"
30//#include <klocale.h> 30//#include <klocale.h>
31#define i18n QObject::tr 31#define i18n QObject::tr
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qapplication.h> 34#include <qapplication.h>
35// #include <klocale.h> 35// #include <klocale.h>
36// #include <kconfig.h> 36// #include <kconfig.h>
37// #include <kmessagebox.h> 37// #include <kmessagebox.h>
38// #include <kapplication.h> 38// #include <kapplication.h>
39#include <assert.h> 39#include <assert.h>
40 40
41PPPData *PPPData::_data = 0; 41PPPData *PPPData::_data = 0;
42Config *PPPData::config = 0; 42Config *PPPData::config = 0;
43 43
44PPPData* PPPData::data() 44PPPData* PPPData::data()
45{ 45{
46 if (!_data){ 46 if (!_data){
47 qDebug("PPPData::data() creates new Instance"); 47 qDebug("PPPData::data() creates new Instance");
48 _data = new PPPData(); 48 _data = new PPPData();
49 } 49 }
50 if (!_data->config){ 50 if (!_data->config){
51 qDebug("PPPData::data() opens conffile"); 51 qDebug("PPPData::data() opens conffile");
52 _data->open(); 52 _data->open();
53 } 53 }
54 return _data; 54 return _data;
55} 55}
56 56
57PPPData::PPPData() 57PPPData::PPPData()
58 : //config(0L), 58 : modemDeviceGroup(-1),
59 highcount(-1), // start out with no entries 59 highcount(-1), // start out with no entries
60 caccount(-1), // set the current account index also 60 caccount(-1), // set the current account index also
61 suidprocessid(-1), // process ID of setuid child 61 suidprocessid(-1), // process ID of setuid child
62 pppdisrunning(false), 62 pppdisrunning(false),
63 pppderror(0), 63 pppderror(0)
64 modemDeviceGroup(-1)
65{ 64{
66} 65}
67 66
68 67
69// 68//
70// open configuration file 69// open configuration file
71// 70//
72bool PPPData::open() { 71bool PPPData::open() {
73 qDebug("opening configfile NetworkSetupPPP"); 72 qDebug("opening configfile NetworkSetupPPP");
74 if (config) return true; 73 if (config) return true;
75 config = new Config("NetworkSetupPPP"); 74 config = new Config("NetworkSetupPPP");
76 75
77 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; 76 highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
78 77
79 if (highcount > MAX_ACCOUNTS) 78 if (highcount > MAX_ACCOUNTS)
80 highcount = MAX_ACCOUNTS; 79 highcount = MAX_ACCOUNTS;
81 80
82 if(highcount >= 0 && defaultAccount().isEmpty()) { 81 if(highcount >= 0 && defaultAccount().isEmpty()) {
83 setAccountbyIndex(0); 82 setAccountbyIndex(0);
84 setDefaultAccount(accname()); 83 setDefaultAccount(accname());
85 } else if(!setAccount(defaultAccount())) 84 } else if(!setAccount(defaultAccount()))
86 setDefaultAccount(accname()); 85 setDefaultAccount(accname());
87 86
88 // start out with internal debugging disabled 87 // start out with internal debugging disabled
89 // the user is still free to specify `debug' on his own 88 // the user is still free to specify `debug' on his own
90 setPPPDebug(false); 89 setPPPDebug(false);
91 90
92 ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); 91 ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch);
93 92
94 return true; 93 return true;
95} 94}
96 95
97 96
98// 97//
99// save configuration 98// save configuration
100// 99//
101void PPPData::save() { 100void PPPData::save() {
102 101
103 if (config) { 102 if (config) {
104 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); 103 writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
105 delete config; 104 delete config;
106 config = 0; 105 config = 0;
107 qDebug("worte confi NetworkSetupPPP"); 106 qDebug("worte confi NetworkSetupPPP");
108 } 107 }
109 if (_data){ 108 if (_data){
110 delete _data; 109 delete _data;
111 _data = 0; 110 _data = 0;
112 } 111 }
113 112
114} 113}
115 114
116 115
117// 116//
118// cancel changes 117// cancel changes
119// 118//
120void PPPData::cancel() { 119void PPPData::cancel() {
121 120
122// if (config) { 121// if (config) {
123// config->rollback(); 122// config->rollback();
124// config->reparseConfiguration(); 123// config->reparseConfiguration();
125// } 124// }
126 125
127} 126}
128 127
129 128
130// // currently differentiates between READWRITE and NONE only 129// // currently differentiates between READWRITE and NONE only
131// int PPPData::access() const { 130// int PPPData::access() const {
132 131
133// return 1;//config->getConfigState(); 132// return 1;//config->getConfigState();
134// } 133// }
135 134
136 135
137// functions to read/write date to configuration file 136// functions to read/write date to configuration file
138QString PPPData::readConfig(const QString &group, const QString &key, 137QString PPPData::readConfig(const QString &group, const QString &key,
139 const QString &defvalue = "") 138 const QString &defvalue = "")
140{ 139{
141// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); 140// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
142 if (config) { 141 if (config) {
143 config->setGroup(group); 142 config->setGroup(group);
144 return config->readEntry(key, defvalue); 143 return config->readEntry(key, defvalue);
145 } else 144 } else
146 return defvalue; 145 return defvalue;
147} 146}
148 147
149 148
150int PPPData::readNumConfig(const QString &group, const QString &key, 149int PPPData::readNumConfig(const QString &group, const QString &key,
151 int defvalue) { 150 int defvalue) {
152 if (config) { 151 if (config) {
153 config->setGroup(group); 152 config->setGroup(group);
154 return config->readNumEntry(key, defvalue); 153 return config->readNumEntry(key, defvalue);
155 } else 154 } else
156 return defvalue; 155 return defvalue;
157 156
158} 157}
159 158
160 159
161bool PPPData::readListConfig(const QString &group, const QString &key, 160bool PPPData::readListConfig(const QString &group, const QString &key,
162 QStringList &list, char sep) { 161 QStringList &list, char sep) {
163 list.clear(); 162 list.clear();
164 if (config) { 163 if (config) {
165 config->setGroup(group); 164 config->setGroup(group);
166 list = config->readListEntry(key, sep); 165 list = config->readListEntry(key, sep);
167 return true; 166 return true;
168 } else 167 } else
169 return false; 168 return false;
170} 169}
171 170
172 171
173void PPPData::writeConfig(const QString &group, const QString &key, 172void PPPData::writeConfig(const QString &group, const QString &key,
174 const QString &value) { 173 const QString &value) {
175 if (config) { 174 if (config) {
176 config->setGroup(group); 175 config->setGroup(group);
177 config->writeEntry(key, value); 176 config->writeEntry(key, value);
178 } 177 }
179} 178}
180 179
181 180
182void PPPData::writeConfig(const QString &group, const QString &key, int value) { 181void PPPData::writeConfig(const QString &group, const QString &key, int value) {
183 if (config) { 182 if (config) {
184 config->setGroup(group); 183 config->setGroup(group);
185 config->writeEntry(key, value); 184 config->writeEntry(key, value);
186 } 185 }
187} 186}
188 187
189 188
190void PPPData::writeListConfig(const QString &group, const QString &key, 189void PPPData::writeListConfig(const QString &group, const QString &key,
191 QStringList &list, char sep) { 190 QStringList &list, char sep) {
192 if (config) { 191 if (config) {
193 config->setGroup(group); 192 config->setGroup(group);
194 config->writeEntry(key, list, sep); 193 config->writeEntry(key, list, sep);
195 } 194 }
196} 195}
197 196
198 197
199// 198//
200// functions to set/return general information 199// functions to set/return general information
201// 200//
202QString PPPData::password() const { 201QString PPPData::password() const {
203 return passwd; 202 return passwd;
204} 203}
205 204
206 205
207void PPPData::setPassword(const QString &pw) { 206void PPPData::setPassword(const QString &pw) {
208 passwd = pw; 207 passwd = pw;
209} 208}
210 209
211 210
212const QString PPPData::defaultAccount() { 211const QString PPPData::defaultAccount() {
213 return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY); 212 return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY);
214} 213}
215 214
216 215
217void PPPData::setDefaultAccount(const QString &n) { 216void PPPData::setDefaultAccount(const QString &n) {
218 writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n); 217 writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n);
219 218
220 //now set the current account index to the default account 219 //now set the current account index to the default account
221 setAccount(defaultAccount()); 220 setAccount(defaultAccount());
222} 221}
223 222
224 223
225bool PPPData::get_show_clock_on_caption() { 224bool PPPData::get_show_clock_on_caption() {
226 return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true); 225 return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true);
227} 226}
228 227
229 228
230void PPPData::set_show_clock_on_caption(bool set) { 229void PPPData::set_show_clock_on_caption(bool set) {
231 writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); 230 writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set);
232} 231}
233 232
234 233
235bool PPPData::get_xserver_exit_disconnect() { 234bool PPPData::get_xserver_exit_disconnect() {
236 return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); 235 return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true);
237} 236}
238 237
239 238
240void PPPData::setPPPDebug(bool set) { 239void PPPData::setPPPDebug(bool set) {
241 writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); 240 writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set);
242} 241}
243 242
244 243
245bool PPPData::getPPPDebug() { 244bool PPPData::getPPPDebug() {
246 return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); 245 return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false);
247} 246}
248 247
249 248
250void PPPData::set_xserver_exit_disconnect(bool set) { 249void PPPData::set_xserver_exit_disconnect(bool set) {
251 writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); 250 writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set);
252} 251}
253 252
254 253
255bool PPPData::quit_on_disconnect() { 254bool PPPData::quit_on_disconnect() {
256 return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); 255 return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false);
257} 256}
258 257
259 258
260void PPPData::set_quit_on_disconnect(bool set) { 259void PPPData::set_quit_on_disconnect(bool set) {
261 writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); 260 writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set);
262} 261}
263 262
264 263
265bool PPPData::get_show_log_window() { 264bool PPPData::get_show_log_window() {
266 return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); 265 return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false);
267} 266}
268 267
269 268
270void PPPData::set_show_log_window(bool set) { 269void PPPData::set_show_log_window(bool set) {
271 writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); 270 writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set);
272} 271}
273 272
274 273
275bool PPPData::automatic_redial() { 274bool PPPData::automatic_redial() {
276 return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); 275 return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE);
277} 276}
278 277
279 278
280void PPPData::set_automatic_redial(bool set) { 279void PPPData::set_automatic_redial(bool set) {
281 writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); 280 writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set);
282} 281}
283 282
284 283
285bool PPPData::get_iconify_on_connect() { 284bool PPPData::get_iconify_on_connect() {
286 return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); 285 return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE);
287} 286}
288 287
289 288
290void PPPData::set_iconify_on_connect(bool set) { 289void PPPData::set_iconify_on_connect(bool set) {
291 writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); 290 writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set);
292} 291}
293 292
294 293
295bool PPPData::get_dock_into_panel() { 294bool PPPData::get_dock_into_panel() {
296 return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); 295 return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false);
297} 296}
298 297
299 298
300void PPPData::set_dock_into_panel(bool set) { 299void PPPData::set_dock_into_panel(bool set) {
301 writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); 300 writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set);
302} 301}
303 302
304 303
305QString PPPData::pppdVersion() { 304QString PPPData::pppdVersion() {
306 return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); 305 return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch);
307} 306}
308 307
309bool PPPData::pppdVersionMin(int ver, int mod, int patch) { 308bool PPPData::pppdVersionMin(int ver, int mod, int patch) {
310 // check if pppd version fulfills minimum requirement 309 // check if pppd version fulfills minimum requirement
311 return (pppdVer > ver 310 return (pppdVer > ver
312 || (pppdVer == ver && pppdMod > mod) 311 || (pppdVer == ver && pppdMod > mod)
313 || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); 312 || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch));
314} 313}
315 314
316int PPPData::pppdTimeout() { 315int PPPData::pppdTimeout() {
317 return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); 316 return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT);
318} 317}
319 318
320 319
321void PPPData::setpppdTimeout(int n) { 320void PPPData::setpppdTimeout(int n) {
322 writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); 321 writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n);
323} 322}
324 323
325 324
326const QString PPPData::modemDevice() { 325const QString PPPData::modemDevice() {
327 return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); 326 return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]);
328} 327}
329 328
330 329
331bool PPPData::setModemDevice(const QString &n) { 330bool PPPData::setModemDevice(const QString &n) {
332 //FIXME: change modem group
333 bool ret = false; 331 bool ret = false;
334 for (int i = 0; devices[i]; i++) 332 for (int i = 0; devices[i]; i++)
335 if (devices[i] == n){ 333 if (devices[i] == n){
336 modemDeviceGroup = i; 334 modemDeviceGroup = i;
337 writeConfig(modemGroup(), MODEMDEV_KEY, n); 335 writeConfig(modemGroup(), MODEMDEV_KEY, n);
338 ret = true; 336 ret = true;
339 } 337 }
340 return ret; 338 return ret;
341} 339}
342 340
343 341
344const QString PPPData::flowcontrol() { 342const QString PPPData::flowcontrol() {
345 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); 343 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS");
346} 344}
347 345
348 346
349void PPPData::setFlowcontrol(const QString &n) { 347void PPPData::setFlowcontrol(const QString &n) {
350 writeConfig(modemGroup(), FLOWCONTROL_KEY, n); 348 writeConfig(modemGroup(), FLOWCONTROL_KEY, n);
351} 349}
352 350
353 351
354const QString PPPData::speed() { 352const QString PPPData::speed() {
355 QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); 353 QString s = readConfig(modemGroup(), SPEED_KEY, "57600");
356 // undo the damage of a bug in former versions. It left an empty Speed= 354 // undo the damage of a bug in former versions. It left an empty Speed=
357 // entry in kppprc. kppp did set the serial port to 57600 as default but 355 // entry in kppprc. kppp did set the serial port to 57600 as default but
358 // pppd wouldn't receive the speed via the command line. 356 // pppd wouldn't receive the speed via the command line.
359 if(s.toUInt() == 0) 357 if(s.toUInt() == 0)
360 s = "57600"; 358 s = "57600";
361 return s; 359 return s;
362} 360}
363 361
364 362
365void PPPData::setSpeed(const QString &n) { 363void PPPData::setSpeed(const QString &n) {
366 writeConfig(modemGroup(), SPEED_KEY, n); 364 writeConfig(modemGroup(), SPEED_KEY, n);
367} 365}
368 366
369 367
370#if 0 368#if 0
371void PPPData::setUseCDLine(const int n) { 369void PPPData::setUseCDLine(const int n) {
372 writeConfig(modemGroup(),USECDLINE_KEY,n); 370 writeConfig(modemGroup(),USECDLINE_KEY,n);
373} 371}
374 372
375 373
376int PPPData::UseCDLine() { 374int PPPData::UseCDLine() {
377 return readNumConfig(modemGroup(),USECDLINE_KEY,0); 375 return readNumConfig(modemGroup(),USECDLINE_KEY,0);
378} 376}
379#endif 377#endif
380 378
381const QString PPPData::modemEscapeStr() { 379const QString PPPData::modemEscapeStr() {
382 return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); 380 return readConfig(modemGroup(),ESCAPESTR_KEY,"+++");
383} 381}
384 382
385 383
386void PPPData::setModemEscapeStr(const QString &n) { 384void PPPData::setModemEscapeStr(const QString &n) {
387 writeConfig(modemGroup(),ESCAPESTR_KEY,n); 385 writeConfig(modemGroup(),ESCAPESTR_KEY,n);
388} 386}
389 387
390 388
391const QString PPPData::modemEscapeResp() { 389const QString PPPData::modemEscapeResp() {
392 return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); 390 return readConfig(modemGroup(),ESCAPERESP_KEY,"OK");
393} 391}
394 392
395 393
396void PPPData::setModemEscapeResp(const QString &n) { 394void PPPData::setModemEscapeResp(const QString &n) {
397 writeConfig(modemGroup(),ESCAPERESP_KEY,n); 395 writeConfig(modemGroup(),ESCAPERESP_KEY,n);
398} 396}
399 397
400 398
401int PPPData::modemEscapeGuardTime() { 399int PPPData::modemEscapeGuardTime() {
402 return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); 400 return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50);
403} 401}
404 402
405 403
406void PPPData::setModemEscapeGuardTime(int n) { 404void PPPData::setModemEscapeGuardTime(int n) {
407 writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); 405 writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n);
408} 406}
409 407
410 408
411bool PPPData::modemLockFile() { 409bool PPPData::modemLockFile() {
412 return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); 410 return readNumConfig(modemGroup(), LOCKFILE_KEY, 1);
413} 411}
414 412
415 413
416void PPPData::setModemLockFile(bool set) { 414void PPPData::setModemLockFile(bool set) {
417 writeConfig(modemGroup(), LOCKFILE_KEY, set); 415 writeConfig(modemGroup(), LOCKFILE_KEY, set);
418} 416}
419 417
420 418
421int PPPData::modemTimeout() { 419int PPPData::modemTimeout() {
422 return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); 420 return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT);
423} 421}
424 422
425 423
426void PPPData::setModemTimeout(int n) { 424void PPPData::setModemTimeout(int n) {
427 writeConfig(modemGroup(), TIMEOUT_KEY, n); 425 writeConfig(modemGroup(), TIMEOUT_KEY, n);
428} 426}
429 427
430 428
431int PPPData::modemToneDuration() { 429int PPPData::modemToneDuration() {
432 return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); 430 return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION);
433} 431}
434 432
435 433
436void PPPData::setModemToneDuration(int n) { 434void PPPData::setModemToneDuration(int n) {
437 writeConfig(modemGroup(), TONEDURATION_KEY, n); 435 writeConfig(modemGroup(), TONEDURATION_KEY, n);
438} 436}
439 437
440 438
441int PPPData::busyWait() { 439int PPPData::busyWait() {
442 return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); 440 return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT);
443} 441}
444 442
445 443
446void PPPData::setbusyWait(int n) { 444void PPPData::setbusyWait(int n) {
447 writeConfig(modemGroup(), BUSYWAIT_KEY, n); 445 writeConfig(modemGroup(), BUSYWAIT_KEY, n);
448} 446}
449 447
450 448
451// 449//
452//Advanced "Modem" dialog 450//Advanced "Modem" dialog
453// 451//
454// defaults: InitString=ATZ, InitString1="" etc. 452// defaults: InitString=ATZ, InitString1="" etc.
455const QString PPPData::modemInitStr(int i) { 453const QString PPPData::modemInitStr(int i) {
456 assert(i >= 0 && i < NumInitStrings); 454 assert(i >= 0 && i < NumInitStrings);
457 if(i == 0) 455 if(i == 0)
458 return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); 456 return readConfig(modemGroup(), INITSTR_KEY, "ATZ");
459 else 457 else
460 return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); 458 return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), "");
461} 459}
462 460
463 461
464void PPPData::setModemInitStr(int i, const QString &n) { 462void PPPData::setModemInitStr(int i, const QString &n) {
465 assert(i >= 0 && i < NumInitStrings); 463 assert(i >= 0 && i < NumInitStrings);
466 QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); 464 QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : "");
467 writeConfig(modemGroup(), k, n); 465 writeConfig(modemGroup(), k, n);
468} 466}
469 467
470 468
471const QString PPPData::modemInitResp() { 469const QString PPPData::modemInitResp() {
472 return readConfig(modemGroup(), INITRESP_KEY, "OK"); 470 return readConfig(modemGroup(), INITRESP_KEY, "OK");
473} 471}
474 472
475 473
476void PPPData::setModemInitResp(const QString &n) { 474void PPPData::setModemInitResp(const QString &n) {
477 writeConfig(modemGroup(), INITRESP_KEY, n); 475 writeConfig(modemGroup(), INITRESP_KEY, n);
478} 476}
479 477
480 478
481int PPPData::modemPreInitDelay() { 479int PPPData::modemPreInitDelay() {
482 return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); 480 return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50);
483} 481}
484 482
485 483
486void PPPData::setModemPreInitDelay(int n) { 484void PPPData::setModemPreInitDelay(int n) {
487 writeConfig(modemGroup(), PREINITDELAY_KEY, n); 485 writeConfig(modemGroup(), PREINITDELAY_KEY, n);
488} 486}
489 487
490 488
491int PPPData::modemInitDelay() { 489int PPPData::modemInitDelay() {
492 return readNumConfig(modemGroup(), INITDELAY_KEY, 50); 490 return readNumConfig(modemGroup(), INITDELAY_KEY, 50);
493} 491}
494 492
495 493
496void PPPData::setModemInitDelay(int n) { 494void PPPData::setModemInitDelay(int n) {
497 writeConfig(modemGroup(), INITDELAY_KEY, n); 495 writeConfig(modemGroup(), INITDELAY_KEY, n);
498} 496}
499 497
500QString PPPData::modemNoDialToneDetectionStr() { 498QString PPPData::modemNoDialToneDetectionStr() {
501 return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); 499 return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3");
502} 500}
503 501
504void PPPData::setModemNoDialToneDetectionStr(const QString &n) { 502void PPPData::setModemNoDialToneDetectionStr(const QString &n) {
505 writeConfig(modemGroup(), NODTDETECT_KEY, n); 503 writeConfig(modemGroup(), NODTDETECT_KEY, n);
506} 504}
507 505
508const QString PPPData::modemDialStr() { 506const QString PPPData::modemDialStr() {
509 return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); 507 return readConfig(modemGroup(), DIALSTR_KEY, "ATDT");
510} 508}
511 509
512 510
513void PPPData::setModemDialStr(const QString &n) { 511void PPPData::setModemDialStr(const QString &n) {
514 writeConfig(modemGroup(), DIALSTR_KEY, n); 512 writeConfig(modemGroup(), DIALSTR_KEY, n);
515} 513}
516 514
517 515
518const QString PPPData::modemConnectResp() { 516const QString PPPData::modemConnectResp() {
519 return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); 517 return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT");
520} 518}
521 519
522 520
523void PPPData::setModemConnectResp(const QString &n) { 521void PPPData::setModemConnectResp(const QString &n) {
524 writeConfig(modemGroup(), CONNECTRESP_KEY, n); 522 writeConfig(modemGroup(), CONNECTRESP_KEY, n);
@@ -615,385 +613,385 @@ QString PPPData::volumeInitString() {
615 QString s; 613 QString s;
616 614
617 switch(volume()) { 615 switch(volume()) {
618 case 0: 616 case 0:
619 s = volumeOff(); 617 s = volumeOff();
620 break; 618 break;
621 case 1: 619 case 1:
622 s = volumeMedium(); 620 s = volumeMedium();
623 break; 621 break;
624 case 2: 622 case 2:
625 s = volumeHigh(); 623 s = volumeHigh();
626 break; 624 break;
627 default: 625 default:
628 s = volumeMedium(); 626 s = volumeMedium();
629 } 627 }
630 628
631 return s; 629 return s;
632} 630}
633 631
634 632
635int PPPData::volume() { 633int PPPData::volume() {
636 return readNumConfig(modemGroup(), VOLUME_KEY, 1); 634 return readNumConfig(modemGroup(), VOLUME_KEY, 1);
637} 635}
638 636
639 637
640void PPPData::setVolume(int i) { 638void PPPData::setVolume(int i) {
641 writeConfig(modemGroup(), VOLUME_KEY, i); 639 writeConfig(modemGroup(), VOLUME_KEY, i);
642} 640}
643 641
644int PPPData::waitForDialTone() { 642int PPPData::waitForDialTone() {
645 return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); 643 return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1);
646} 644}
647 645
648void PPPData::setWaitForDialTone(int i) { 646void PPPData::setWaitForDialTone(int i) {
649 writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); 647 writeConfig(modemGroup(), DIALTONEWAIT_KEY, i);
650} 648}
651 649
652void PPPData::setModemAnswerStr(const QString &n) { 650void PPPData::setModemAnswerStr(const QString &n) {
653 writeConfig(modemGroup(), ANSWERSTR_KEY, n); 651 writeConfig(modemGroup(), ANSWERSTR_KEY, n);
654} 652}
655 653
656 654
657const QString PPPData::modemRingResp() { 655const QString PPPData::modemRingResp() {
658 return readConfig(modemGroup(), RINGRESP_KEY, "RING"); 656 return readConfig(modemGroup(), RINGRESP_KEY, "RING");
659} 657}
660 658
661 659
662void PPPData::setModemRingResp(const QString &n) { 660void PPPData::setModemRingResp(const QString &n) {
663 writeConfig(modemGroup(), RINGRESP_KEY, n); 661 writeConfig(modemGroup(), RINGRESP_KEY, n);
664} 662}
665 663
666 664
667const QString PPPData::modemAnswerResp() { 665const QString PPPData::modemAnswerResp() {
668 return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); 666 return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT");
669} 667}
670 668
671 669
672void PPPData::setModemAnswerResp(const QString &n) { 670void PPPData::setModemAnswerResp(const QString &n) {
673 writeConfig(modemGroup(), ANSWERRESP_KEY, n); 671 writeConfig(modemGroup(), ANSWERRESP_KEY, n);
674} 672}
675 673
676 674
677const QString PPPData::enter() { 675const QString PPPData::enter() {
678 return readConfig(modemGroup(), ENTER_KEY, "CR"); 676 return readConfig(modemGroup(), ENTER_KEY, "CR");
679} 677}
680 678
681 679
682void PPPData::setEnter(const QString &n) { 680void PPPData::setEnter(const QString &n) {
683 writeConfig(modemGroup(), ENTER_KEY, n); 681 writeConfig(modemGroup(), ENTER_KEY, n);
684} 682}
685 683
686 684
687// 685//
688// functions to set/return account information 686// functions to set/return account information
689// 687//
690 688
691//returns number of accounts 689//returns number of accounts
692int PPPData::count() const { 690int PPPData::count() const {
693 return highcount + 1; 691 return highcount + 1;
694} 692}
695 693
696 694
697bool PPPData::setAccount(const QString &aname) { 695bool PPPData::setAccount(const QString &aname) {
698 for(int i = 0; i <= highcount; i++) { 696 for(int i = 0; i <= highcount; i++) {
699 setAccountbyIndex(i); 697 setAccountbyIndex(i);
700 if(accname() == aname) { 698 if(accname() == aname) {
701 caccount = i; 699 caccount = i;
702 return true; 700 return true;
703 } 701 }
704 } 702 }
705 return false; 703 return false;
706} 704}
707 705
708 706
709bool PPPData::setAccountbyIndex(int i) { 707bool PPPData::setAccountbyIndex(int i) {
710 if(i >= 0 && i <= highcount) { 708 if(i >= 0 && i <= highcount) {
711 caccount = i; 709 caccount = i;
712 cgroup.sprintf("%s%i", ACCOUNT_GRP, i); 710 cgroup.sprintf("%s%i", ACCOUNT_GRP, i);
713 return true; 711 return true;
714 } 712 }
715 return false; 713 return false;
716} 714}
717 715
718 716
719bool PPPData::isUniqueAccname(const QString &n) { 717bool PPPData::isUniqueAccname(const QString &n) {
720 int current = caccount; 718 int current = caccount;
721 for(int i=0; i <= highcount; i++) { 719 for(int i=0; i <= highcount; i++) {
722 setAccountbyIndex(i); 720 setAccountbyIndex(i);
723 if(accname() == n && i != current) { 721 if(accname() == n && i != current) {
724 setAccountbyIndex(current); 722 setAccountbyIndex(current);
725 return false; 723 return false;
726 } 724 }
727 } 725 }
728 setAccountbyIndex(current); 726 setAccountbyIndex(current);
729 return true; 727 return true;
730} 728}
731 729
732 730
733bool PPPData::deleteAccount() { 731bool PPPData::deleteAccount() {
734 //FIXME: 732 //FIXME:
735// if(caccount < 0) 733// if(caccount < 0)
736 return false; 734 return false;
737 735
738// QMap <QString, QString> map; 736// QMap <QString, QString> map;
739// QMap <QString, QString>::Iterator it; 737// QMap <QString, QString>::Iterator it;
740 738
741// // set all entries of the current account to "" 739// // set all entries of the current account to ""
742// map = config->entryMap(cgroup); 740// map = config->entryMap(cgroup);
743// it = map.begin(); 741// it = map.begin();
744// while (it != map.end()) { 742// while (it != map.end()) {
745// config->writeEntry(it.key(), ""); 743// config->writeEntry(it.key(), "");
746// it++; 744// it++;
747// } 745// }
748 746
749// // shift the succeeding accounts 747// // shift the succeeding accounts
750// for(int i = caccount+1; i <= highcount; i++) { 748// for(int i = caccount+1; i <= highcount; i++) {
751// setAccountbyIndex(i); 749// setAccountbyIndex(i);
752// map = config->entryMap(cgroup); 750// map = config->entryMap(cgroup);
753// it = map.begin(); 751// it = map.begin();
754// setAccountbyIndex(i-1); 752// setAccountbyIndex(i-1);
755// config->setGroup(cgroup); 753// config->setGroup(cgroup);
756// while (it != map.end()) { 754// while (it != map.end()) {
757// config->writeEntry(it.key(), *it); 755// config->writeEntry(it.key(), *it);
758// it++; 756// it++;
759// } 757// }
760// } 758// }
761 759
762// // make sure the top account is cleared 760// // make sure the top account is cleared
763// setAccountbyIndex(highcount); 761// setAccountbyIndex(highcount);
764// map = config->entryMap(cgroup); 762// map = config->entryMap(cgroup);
765// it = map.begin(); 763// it = map.begin();
766// config->setGroup(cgroup); 764// config->setGroup(cgroup);
767// while (it.key() != QString::null) { 765// while (it.key() != QString::null) {
768// config->writeEntry(it.key(), ""); 766// config->writeEntry(it.key(), "");
769// it++; 767// it++;
770// } 768// }
771 769
772// highcount--; 770// highcount--;
773// if(caccount > highcount) 771// if(caccount > highcount)
774// caccount = highcount; 772// caccount = highcount;
775 773
776// setAccountbyIndex(caccount); 774// setAccountbyIndex(caccount);
777 775
778// return true; 776// return true;
779} 777}
780 778
781 779
782bool PPPData::deleteAccount(const QString &aname) { 780bool PPPData::deleteAccount(const QString &aname) {
783 if(!setAccount(aname)) 781 if(!setAccount(aname))
784 return false; 782 return false;
785 783
786 deleteAccount(); 784 deleteAccount();
787 785
788 return true; 786 return true;
789} 787}
790 788
791 789
792int PPPData::newaccount() { 790int PPPData::newaccount() {
793 791
794 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); 792 qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS);
795 if(!config) open(); 793 if(!config) open();
796 if (highcount >= MAX_ACCOUNTS) return -1; 794 if (highcount >= MAX_ACCOUNTS) return -1;
797 795
798 highcount++; 796 highcount++;
799 setAccountbyIndex(highcount); 797 setAccountbyIndex(highcount);
800 798
801 setpppdArgumentDefaults(); 799 setpppdArgumentDefaults();
802 qDebug("PPPData::newaccount -> %i",caccount); 800 qDebug("PPPData::newaccount -> %i",caccount);
803 return caccount; 801 return caccount;
804} 802}
805 803
806int PPPData::copyaccount(int i) { 804int PPPData::copyaccount(int i) {
807 805// FIXME
808// if(highcount >= MAX_ACCOUNTS) 806// if(highcount >= MAX_ACCOUNTS)
809 return -1; 807 return -1;
810 808
811// setAccountbyIndex(i); 809// setAccountbyIndex(i);
812 810
813// QMap <QString, QString> map = config->entryMap(cgroup); 811// QMap <QString, QString> map = config->entryMap(cgroup);
814// QMap <QString, QString>::ConstIterator it = map.begin(); 812// QMap <QString, QString>::ConstIterator it = map.begin();
815 813
816// QString newname = i18n("%1_copy").arg(accname()); 814// QString newname = i18n("%1_copy").arg(accname());
817 815
818// newaccount(); 816// newaccount();
819 817
820// while (it != map.end()) { 818// while (it != map.end()) {
821// config->writeEntry(it.key(), *it); 819// config->writeEntry(it.key(), *it);
822// it++; 820// it++;
823// } 821// }
824 822
825// setAccname(newname); 823// setAccname(newname);
826 824
827// return caccount; 825// return caccount;
828} 826}
829 827
830 828
831const QString PPPData::accname() { 829const QString PPPData::accname() {
832 return readConfig(cgroup, NAME_KEY); 830 return readConfig(cgroup, NAME_KEY);
833} 831}
834 832
835void PPPData::setAccname(const QString &n) { 833void PPPData::setAccname(const QString &n) {
836 if(!cgroup.isNull()) { 834 if(!cgroup.isNull()) {
837 // are we manipulating the default account's name ? then change it, too. 835 // are we manipulating the default account's name ? then change it, too.
838 bool def = accname() == defaultAccount(); 836 bool def = accname() == defaultAccount();
839 writeConfig(cgroup, NAME_KEY, n); 837 writeConfig(cgroup, NAME_KEY, n);
840 if (def) 838 if (def)
841 setDefaultAccount(n); 839 setDefaultAccount(n);
842 } 840 }
843} 841}
844 842
845 843
846#define SEPARATOR_CHAR '&' 844#define SEPARATOR_CHAR '&'
847QStringList &PPPData::phonenumbers() { 845QStringList &PPPData::phonenumbers() {
848 846
849 readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); 847 readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR);
850 return phonelist; 848 return phonelist;
851 849
852} 850}
853 851
854 852
855const QString PPPData::phonenumber() { 853const QString PPPData::phonenumber() {
856 return readConfig(cgroup, PHONENUMBER_KEY); 854 return readConfig(cgroup, PHONENUMBER_KEY);
857} 855}
858 856
859 857
860void PPPData::setPhonenumber(const QString &n) { 858void PPPData::setPhonenumber(const QString &n) {
861 writeConfig(cgroup, PHONENUMBER_KEY, n); 859 writeConfig(cgroup, PHONENUMBER_KEY, n);
862} 860}
863 861
864 862
865const QString PPPData::dialPrefix() { 863const QString PPPData::dialPrefix() {
866 return readConfig(cgroup, DIAL_PREFIX_KEY, ""); 864 return readConfig(cgroup, DIAL_PREFIX_KEY, "");
867} 865}
868 866
869 867
870void PPPData::setDialPrefix(const QString &s) { 868void PPPData::setDialPrefix(const QString &s) {
871 writeConfig(cgroup, DIAL_PREFIX_KEY, s); 869 writeConfig(cgroup, DIAL_PREFIX_KEY, s);
872} 870}
873 871
874 872
875int PPPData::authMethod() { 873int PPPData::authMethod() {
876 return readNumConfig(cgroup, AUTH_KEY, 0); 874 return readNumConfig(cgroup, AUTH_KEY, 0);
877} 875}
878 876
879 877
880void PPPData::setAuthMethod(int value) { 878void PPPData::setAuthMethod(int value) {
881 writeConfig(cgroup, AUTH_KEY, value); 879 writeConfig(cgroup, AUTH_KEY, value);
882} 880}
883 881
884 882
885const QString PPPData::storedUsername() { 883const QString PPPData::storedUsername() {
886 return readConfig(cgroup, STORED_USERNAME_KEY, ""); 884 return readConfig(cgroup, STORED_USERNAME_KEY, "");
887} 885}
888 886
889 887
890void PPPData::setStoredUsername(const QString &b) { 888void PPPData::setStoredUsername(const QString &b) {
891 writeConfig(cgroup, STORED_USERNAME_KEY, b); 889 writeConfig(cgroup, STORED_USERNAME_KEY, b);
892} 890}
893 891
894 892
895const QString PPPData::storedPassword() { 893const QString PPPData::storedPassword() {
896 return readConfig(cgroup, STORED_PASSWORD_KEY, ""); 894 return readConfig(cgroup, STORED_PASSWORD_KEY, "");
897} 895}
898 896
899 897
900void PPPData::setStoredPassword(const QString &b) { 898void PPPData::setStoredPassword(const QString &b) {
901 writeConfig(cgroup, STORED_PASSWORD_KEY, b); 899 writeConfig(cgroup, STORED_PASSWORD_KEY, b);
902} 900}
903 901
904 902
905bool PPPData::storePassword() { 903bool PPPData::storePassword() {
906 return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); 904 return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1);
907} 905}
908 906
909 907
910const QString PPPData::command_before_connect() { 908const QString PPPData::command_before_connect() {
911 return readConfig(cgroup, BEFORE_CONNECT_KEY); 909 return readConfig(cgroup, BEFORE_CONNECT_KEY);
912} 910}
913 911
914 912
915void PPPData::setCommand_before_connect(const QString &n) { 913void PPPData::setCommand_before_connect(const QString &n) {
916 writeConfig(cgroup, BEFORE_CONNECT_KEY, n); 914 writeConfig(cgroup, BEFORE_CONNECT_KEY, n);
917} 915}
918 916
919 917
920void PPPData::setStorePassword(bool b) { 918void PPPData::setStorePassword(bool b) {
921 writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); 919 writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b);
922} 920}
923 921
924 922
925const QString PPPData::command_on_connect() { 923const QString PPPData::command_on_connect() {
926 return readConfig(cgroup, COMMAND_KEY); 924 return readConfig(cgroup, COMMAND_KEY);
927} 925}
928 926
929 927
930void PPPData::setCommand_on_connect(const QString &n) { 928void PPPData::setCommand_on_connect(const QString &n) {
931 writeConfig(cgroup, COMMAND_KEY, n); 929 writeConfig(cgroup, COMMAND_KEY, n);
932} 930}
933 931
934 932
935const QString PPPData::command_on_disconnect() { 933const QString PPPData::command_on_disconnect() {
936 return readConfig(cgroup, DISCONNECT_COMMAND_KEY); 934 return readConfig(cgroup, DISCONNECT_COMMAND_KEY);
937} 935}
938 936
939 937
940void PPPData::setCommand_on_disconnect(const QString &n) { 938void PPPData::setCommand_on_disconnect(const QString &n) {
941 writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); 939 writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n);
942} 940}
943 941
944 942
945const QString PPPData::command_before_disconnect() { 943const QString PPPData::command_before_disconnect() {
946 return readConfig(cgroup, BEFORE_DISCONNECT_KEY); 944 return readConfig(cgroup, BEFORE_DISCONNECT_KEY);
947} 945}
948 946
949 947
950void PPPData::setCommand_before_disconnect(const QString &n) { 948void PPPData::setCommand_before_disconnect(const QString &n) {
951 writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); 949 writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n);
952} 950}
953 951
954 952
955const QString PPPData::ipaddr() { 953const QString PPPData::ipaddr() {
956 return readConfig(cgroup, IPADDR_KEY); 954 return readConfig(cgroup, IPADDR_KEY);
957} 955}
958 956
959 957
960void PPPData::setIpaddr(const QString &n) { 958void PPPData::setIpaddr(const QString &n) {
961 writeConfig(cgroup, IPADDR_KEY, n); 959 writeConfig(cgroup, IPADDR_KEY, n);
962} 960}
963 961
964 962
965const QString PPPData::subnetmask() { 963const QString PPPData::subnetmask() {
966 return readConfig(cgroup, SUBNETMASK_KEY); 964 return readConfig(cgroup, SUBNETMASK_KEY);
967} 965}
968 966
969 967
970void PPPData::setSubnetmask(const QString &n) { 968void PPPData::setSubnetmask(const QString &n) {
971 writeConfig(cgroup, SUBNETMASK_KEY, n); 969 writeConfig(cgroup, SUBNETMASK_KEY, n);
972} 970}
973 971
974 972
975bool PPPData::autoname() { 973bool PPPData::autoname() {
976 return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); 974 return (bool) readNumConfig(cgroup, AUTONAME_KEY, false);
977} 975}
978 976
979 977
980void PPPData::setAutoname(bool set) { 978void PPPData::setAutoname(bool set) {
981 writeConfig(cgroup, AUTONAME_KEY, (int) set); 979 writeConfig(cgroup, AUTONAME_KEY, (int) set);
982} 980}
983 981
984 982
985bool PPPData::AcctEnabled() { 983bool PPPData::AcctEnabled() {
986 return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); 984 return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false);
987} 985}
988 986
989 987
990void PPPData::setAcctEnabled(bool set) { 988void PPPData::setAcctEnabled(bool set) {
991 writeConfig(cgroup, ACCTENABLED_KEY, (int) set); 989 writeConfig(cgroup, ACCTENABLED_KEY, (int) set);
992} 990}
993 991
994 992
995int PPPData::VolAcctEnabled() { 993int PPPData::VolAcctEnabled() {
996 return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0); 994 return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0);
997} 995}
998 996
999 997
@@ -1032,217 +1030,223 @@ bool PPPData::autoDNS() {
1032void PPPData::setAutoDNS(bool set) { 1030void PPPData::setAutoDNS(bool set) {
1033 writeConfig(cgroup, AUTODNS_KEY, (int) set); 1031 writeConfig(cgroup, AUTODNS_KEY, (int) set);
1034} 1032}
1035 1033
1036 1034
1037void PPPData::setExDNSDisabled(bool set) { 1035void PPPData::setExDNSDisabled(bool set) {
1038 writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set); 1036 writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set);
1039} 1037}
1040 1038
1041 1039
1042bool PPPData::exDNSDisabled() { 1040bool PPPData::exDNSDisabled() {
1043 return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0); 1041 return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0);
1044} 1042}
1045 1043
1046 1044
1047QStringList &PPPData::dns() { 1045QStringList &PPPData::dns() {
1048 static QStringList dnslist; 1046 static QStringList dnslist;
1049 1047
1050 readListConfig(cgroup, DNS_KEY, dnslist); 1048 readListConfig(cgroup, DNS_KEY, dnslist);
1051 while(dnslist.count() > MAX_DNS_ENTRIES) 1049 while(dnslist.count() > MAX_DNS_ENTRIES)
1052 dnslist.remove(dnslist.last()); 1050 dnslist.remove(dnslist.last());
1053 1051
1054 return dnslist; 1052 return dnslist;
1055} 1053}
1056 1054
1057 1055
1058void PPPData::setDns(QStringList &list) { 1056void PPPData::setDns(QStringList &list) {
1059 writeListConfig(cgroup, DNS_KEY, list); 1057 writeListConfig(cgroup, DNS_KEY, list);
1060} 1058}
1061 1059
1062 1060
1063const QString PPPData::domain() { 1061const QString PPPData::domain() {
1064 return readConfig(cgroup, DOMAIN_KEY); 1062 return readConfig(cgroup, DOMAIN_KEY);
1065} 1063}
1066 1064
1067 1065
1068void PPPData::setDomain(const QString &n ) { 1066void PPPData::setDomain(const QString &n ) {
1069 writeConfig(cgroup, DOMAIN_KEY, n); 1067 writeConfig(cgroup, DOMAIN_KEY, n);
1070} 1068}
1071 1069
1072 1070
1073QStringList &PPPData::scriptType() { 1071QStringList &PPPData::scriptType() {
1074 static QStringList typelist; 1072 static QStringList typelist;
1075 1073
1076 readListConfig(cgroup, SCRIPTCOM_KEY, typelist); 1074 readListConfig(cgroup, SCRIPTCOM_KEY, typelist);
1077 while(typelist.count() > MAX_SCRIPT_ENTRIES) 1075 while(typelist.count() > MAX_SCRIPT_ENTRIES)
1078 typelist.remove(typelist.last()); 1076 typelist.remove(typelist.last());
1079 1077
1080 return typelist; 1078 return typelist;
1081} 1079}
1082 1080
1083 1081
1084void PPPData::setScriptType(QStringList &list) { 1082void PPPData::setScriptType(QStringList &list) {
1085 writeListConfig(cgroup, SCRIPTCOM_KEY, list); 1083 writeListConfig(cgroup, SCRIPTCOM_KEY, list);
1086} 1084}
1087 1085
1088 1086
1089QStringList &PPPData::script() { 1087QStringList &PPPData::script() {
1090 static QStringList scriptlist; 1088 static QStringList scriptlist;
1091 1089
1092 readListConfig(cgroup, SCRIPTARG_KEY, scriptlist); 1090 readListConfig(cgroup, SCRIPTARG_KEY, scriptlist);
1093 while(scriptlist.count() > MAX_SCRIPT_ENTRIES) 1091 while(scriptlist.count() > MAX_SCRIPT_ENTRIES)
1094 scriptlist.remove(scriptlist.last()); 1092 scriptlist.remove(scriptlist.last());
1095 1093
1096 return scriptlist; 1094 return scriptlist;
1097} 1095}
1098 1096
1099 1097
1100void PPPData::setScript(QStringList &list) { 1098void PPPData::setScript(QStringList &list) {
1101 writeListConfig(cgroup, SCRIPTARG_KEY, list); 1099 writeListConfig(cgroup, SCRIPTARG_KEY, list);
1102} 1100}
1103 1101
1104 1102
1105// const QString PPPData::accountingFile() { 1103// const QString PPPData::accountingFile() {
1106// return readConfig(cgroup, ACCTFILE_KEY); 1104// return readConfig(cgroup, ACCTFILE_KEY);
1107// } 1105// }
1108 1106
1109 1107
1110// void PPPData::setAccountingFile(const QString &n) { 1108// void PPPData::setAccountingFile(const QString &n) {
1111// writeConfig(cgroup, ACCTFILE_KEY, n); 1109// writeConfig(cgroup, ACCTFILE_KEY, n);
1112// } 1110// }
1113 1111
1114 1112
1115// const QString PPPData::totalCosts() { 1113// const QString PPPData::totalCosts() {
1116// return readConfig(cgroup, TOTALCOSTS_KEY); 1114// return readConfig(cgroup, TOTALCOSTS_KEY);
1117// } 1115// }
1118 1116
1119 1117
1120// void PPPData::setTotalCosts(const QString &n) { 1118// void PPPData::setTotalCosts(const QString &n) {
1121// writeConfig(cgroup, TOTALCOSTS_KEY, n); 1119// writeConfig(cgroup, TOTALCOSTS_KEY, n);
1122// } 1120// }
1123 1121
1124 1122
1125// int PPPData::totalBytes() { 1123// int PPPData::totalBytes() {
1126// return readNumConfig(cgroup, TOTALBYTES_KEY, 0); 1124// return readNumConfig(cgroup, TOTALBYTES_KEY, 0);
1127// } 1125// }
1128 1126
1129// void PPPData::setTotalBytes(int n) { 1127// void PPPData::setTotalBytes(int n) {
1130// writeConfig(cgroup, TOTALBYTES_KEY, n); 1128// writeConfig(cgroup, TOTALBYTES_KEY, n);
1131// } 1129// }
1132 1130
1133 1131
1134QStringList &PPPData::pppdArgument() { 1132QStringList &PPPData::pppdArgument() {
1135 static QStringList arglist; 1133 static QStringList arglist;
1136 1134
1137 while(arglist.count() > MAX_PPPD_ARGUMENTS) 1135 while(arglist.count() > MAX_PPPD_ARGUMENTS)
1138 arglist.remove(arglist.last()); 1136 arglist.remove(arglist.last());
1139 readListConfig(cgroup, PPPDARG_KEY, arglist); 1137 readListConfig(cgroup, PPPDARG_KEY, arglist);
1140 1138
1141 return arglist; 1139 return arglist;
1142} 1140}
1143 1141
1144 1142
1145void PPPData::setpppdArgument(QStringList &args) { 1143void PPPData::setpppdArgument(QStringList &args) {
1146 writeListConfig(cgroup, PPPDARG_KEY, args); 1144 writeListConfig(cgroup, PPPDARG_KEY, args);
1147} 1145}
1148 1146
1149 1147
1150void PPPData::setpppdArgumentDefaults() { 1148void PPPData::setpppdArgumentDefaults() {
1151 QStringList arg; 1149 QStringList arg;
1152 setpppdArgument(arg); 1150 setpppdArgument(arg);
1153} 1151}
1154 1152
1155 1153
1156// // graphing widget 1154// // graphing widget
1157// void PPPData::setGraphingOptions(bool enable, 1155// void PPPData::setGraphingOptions(bool enable,
1158 // QColor bg, 1156 // QColor bg,
1159 // QColor text, 1157 // QColor text,
1160 // QColor in, 1158 // QColor in,
1161 // QColor out) 1159 // QColor out)
1162// { 1160// {
1163// if(config) { 1161// if(config) {
1164// config->setGroup(GRAPH_GRP); 1162// config->setGroup(GRAPH_GRP);
1165// config->writeEntry(GENABLED, enable); 1163// config->writeEntry(GENABLED, enable);
1166// // config->writeEntry(GCOLOR_BG, bg); 1164// // config->writeEntry(GCOLOR_BG, bg);
1167// // config->writeEntry(GCOLOR_TEXT, text); 1165// // config->writeEntry(GCOLOR_TEXT, text);
1168// // config->writeEntry(GCOLOR_IN, in); 1166// // config->writeEntry(GCOLOR_IN, in);
1169// // config->writeEntry(GCOLOR_OUT, out); 1167// // config->writeEntry(GCOLOR_OUT, out);
1170// } 1168// }
1171// } 1169// }
1172 1170
1173// void PPPData::graphingOptions(bool &enable, 1171// void PPPData::graphingOptions(bool &enable,
1174 // QColor &bg, 1172 // QColor &bg,
1175 // QColor &text, 1173 // QColor &text,
1176 // QColor &in, 1174 // QColor &in,
1177 // QColor &out) 1175 // QColor &out)
1178// { 1176// {
1179// QColor c; 1177// QColor c;
1180 1178
1181// if(config) { 1179// if(config) {
1182// config->setGroup(GRAPH_GRP); 1180// config->setGroup(GRAPH_GRP);
1183// enable = config->readBoolEntry(GENABLED, true); 1181// enable = config->readBoolEntry(GENABLED, true);
1184// bg = Qt::white; 1182// bg = Qt::white;
1185// //bg = config->readColorEntry(GCOLOR_BG, &c); 1183// //bg = config->readColorEntry(GCOLOR_BG, &c);
1186// text = Qt::black; 1184// text = Qt::black;
1187// //text = config->readColorEntry(GCOLOR_TEXT, &c); 1185// //text = config->readColorEntry(GCOLOR_TEXT, &c);
1188// in = Qt::blue; 1186// in = Qt::blue;
1189// //in = config->readColorEntry(GCOLOR_IN, &c); 1187// //in = config->readColorEntry(GCOLOR_IN, &c);
1190// out = Qt::red; 1188// out = Qt::red;
1191// //out = config->readColorEntry(GCOLOR_OUT, &c); 1189// //out = config->readColorEntry(GCOLOR_OUT, &c);
1192// } 1190// }
1193// } 1191// }
1194 1192
1195 1193
1196// bool PPPData::graphingEnabled() { 1194// bool PPPData::graphingEnabled() {
1197// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); 1195// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true);
1198// } 1196// }
1199 1197
1200 1198
1201 1199
1202// 1200//
1203//functions to change/set the child pppd process info 1201//functions to change/set the child pppd process info
1204// 1202//
1205bool PPPData::pppdRunning() const { 1203bool PPPData::pppdRunning() const {
1206 return pppdisrunning; 1204 return pppdisrunning;
1207} 1205}
1208 1206
1209void PPPData::setpppdRunning(bool set) { 1207void PPPData::setpppdRunning(bool set) {
1210 pppdisrunning = set; 1208 pppdisrunning = set;
1211} 1209}
1212 1210
1213int PPPData::pppdError() const { 1211int PPPData::pppdError() const {
1214 return pppderror; 1212 return pppderror;
1215} 1213}
1216 1214
1217void PPPData::setpppdError(int err) { 1215void PPPData::setpppdError(int err) {
1218 pppderror = err; 1216 pppderror = err;
1219} 1217}
1220 1218
1221QString PPPData::modemGroup() 1219QString PPPData::modemGroup()
1222{ 1220{
1223 if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup); 1221 if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup);
1224 return QString("MODEM_GRP_%1").arg(modemDeviceGroup); 1222 return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup);
1225} 1223}
1226 1224
1227// //
1228// // window position
1229// //
1230// void PPPData::winPosConWin(int& p_x, int& p_y) {
1231// p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160);
1232// p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55);
1233// }
1234 1225
1235// void PPPData::setWinPosConWin(int p_x, int p_y) { 1226QMap<QString,QString> PPPData::getConfiguredInterfaces()
1236// writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x); 1227{
1237// writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y); 1228 QMap<QString,QString> ifaces;
1238// } 1229 int count = readNumConfig( ACCLIST_GRP, ACCOUNTS_COUNT, -1 );
1230 QString accGrp;
1231 for (int i = 0; i < count; i++){
1232 accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
1233 ifaces.insert( readConfig( accGrp, ACOUNTS_DEV, "error" ),
1234 readConfig( accGrp, ACOUNTS_ACC, "error" ) );
1235 }
1239 1236
1240// void PPPData::winPosStatWin(int& p_x, int& p_y) { 1237 return ifaces;
1241// p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160); 1238}
1242// p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55);
1243// }
1244 1239
1245// void PPPData::setWinPosStatWin(int p_x, int p_y) { 1240void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
1246// writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x); 1241{
1247// writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y); 1242 QMap<QString,QString>::Iterator it;
1248// } 1243 QString accGrp;
1244 int i = 0;
1245 for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){
1246 accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
1247 writeConfig( accGrp, ACOUNTS_DEV, it.key() );
1248 writeConfig( accGrp, ACOUNTS_ACC, it.data() );
1249 }
1250 writeConfig( ACCLIST_GRP, ACCOUNTS_COUNT, i );
1251
1252}
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index 41dfbd8..c1c7e69 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -1,383 +1,380 @@
1/* -*- C++ -*- 1/* -*- C++ -*-
2 * 2 *
3 * kPPP: A pppd front end for the KDE project 3 * kPPP: A pppd front end for the KDE project
4 * 4 *
5 * $Id$ 5 * $Id$
6 * 6 *
7 * Copyright (C) 1997 Bernd Johannes Wuebben 7 * Copyright (C) 1997 Bernd Johannes Wuebben
8 * wuebben@math.cornell.edu 8 * wuebben@math.cornell.edu
9 * 9 *
10 * based on EzPPP: 10 * based on EzPPP:
11 * Copyright (C) 1997 Jay Painter 11 * Copyright (C) 1997 Jay Painter
12 * 12 *
13 * This program is free software; you can redistribute it and/or 13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public 14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either 15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version. 16 * version 2 of the License, or (at your option) any later version.
17 * 17 *
18 * This program is distributed in the hope that it will be useful, 18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details. 21 * Library General Public License for more details.
22 * 22 *
23 * You should have received a copy of the GNU Library General Public 23 * You should have received a copy of the GNU Library General Public
24 * License along with this program; if not, write to the Free 24 * License along with this program; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 26 */
27 27
28#ifndef _PPPDATA_H_ 28#ifndef _PPPDATA_H_
29#define _PPPDATA_H_ 29#define _PPPDATA_H_
30 30
31#include <unistd.h> 31#include <unistd.h>
32#include <sys/types.h> 32#include <sys/types.h>
33 33
34#include <qcolor.h>
35#include <qmap.h>
34#include <qstring.h> 36#include <qstring.h>
35#include <qstringlist.h> 37#include <qstringlist.h>
36#include <qcolor.h>
37 38
38#include "kpppconfig.h" 39#include "kpppconfig.h"
39 40
40class Config; 41class Config;
41 42
42// string lengths 43// string lengths
43 44
44#define PATH_SIZE 120 45#define PATH_SIZE 120
45#define MODEMSTR_SIZE 80 46#define MODEMSTR_SIZE 80
46#define ACCNAME_SIZE 50 47#define ACCNAME_SIZE 50
47#define PHONENUMBER_SIZE 60 48#define PHONENUMBER_SIZE 60
48#define COMMAND_SIZE 255 49#define COMMAND_SIZE 255
49#define IPADDR_SIZE 15 50#define IPADDR_SIZE 15
50#define DOMAIN_SIZE 50 51#define DOMAIN_SIZE 50
51#define TIMEOUT_SIZE 60 52#define TIMEOUT_SIZE 60
52 53
53// 54//
54// keys for config file 55// keys for config file
55// 56//
56 57
57// groups 58// groups
58#define GENERAL_GRP "PPP_General" 59#define GENERAL_GRP "PPP_General"
59#define MODEM_GRP "PPP_Modem" 60#define MODEM_GRP "PPP_Modem"
60#define ACCOUNT_GRP "PPP_Account" 61#define ACCOUNT_GRP "PPP_Account"
62#define ACCLIST_GRP "PPP_Accounts_List"
61//#define GRAPH_GRP "Graph" 63//#define GRAPH_GRP "Graph"
62//#define WINPOS_GRP "WindowPosition" 64//#define WINPOS_GRP "WindowPosition"
63 65
64// general 66// general
65#define DEFAULTACCOUNT_KEY "DefaultAccount" 67#define DEFAULTACCOUNT_KEY "DefaultAccount"
66#define PPPDVERSION_KEY "pppdVersion" 68#define PPPDVERSION_KEY "pppdVersion"
67#define PPPDTIMEOUT_KEY "pppdTimeout" 69#define PPPDTIMEOUT_KEY "pppdTimeout"
68#define SHOWCLOCK_KEY "ShowClock" 70#define SHOWCLOCK_KEY "ShowClock"
69#define SHOWLOGWIN_KEY "ShowLogWindow" 71#define SHOWLOGWIN_KEY "ShowLogWindow"
70#define AUTOREDIAL_KEY "AutomaticRedial" 72#define AUTOREDIAL_KEY "AutomaticRedial"
71#define DISCONNECT_KEY "DisconnectOnXServerExit" 73#define DISCONNECT_KEY "DisconnectOnXServerExit"
72#define QUITONDISCONNECT_KEY "QuitOnDisconnect" 74#define QUITONDISCONNECT_KEY "QuitOnDisconnect"
73#define NUMACCOUNTS_KEY "NumberOfAccounts" 75#define NUMACCOUNTS_KEY "NumberOfAccounts"
74 #define ID_KEY "ID" 76 #define ID_KEY "ID"
75 77
76// modem 78// modem
77#define MODEMDEV_KEY "Device" 79#define MODEMDEV_KEY "Device"
78#define LOCKFILE_KEY "UseLockFile" 80#define LOCKFILE_KEY "UseLockFile"
79#define FLOWCONTROL_KEY "FlowControl" 81#define FLOWCONTROL_KEY "FlowControl"
80#define SPEED_KEY "Speed" 82#define SPEED_KEY "Speed"
81#define TIMEOUT_KEY "Timeout" 83#define TIMEOUT_KEY "Timeout"
82#define TONEDURATION_KEY "ToneDuration" 84#define TONEDURATION_KEY "ToneDuration"
83#define BUSYWAIT_KEY "BusyWait" 85#define BUSYWAIT_KEY "BusyWait"
84#define INITSTR_KEY "InitString" 86#define INITSTR_KEY "InitString"
85#define INITRESP_KEY "InitResponse" 87#define INITRESP_KEY "InitResponse"
86#define PREINITDELAY_KEY "PreInitDelay" 88#define PREINITDELAY_KEY "PreInitDelay"
87#define INITDELAY_KEY "InitDelay" 89#define INITDELAY_KEY "InitDelay"
88#define NODTDETECT_KEY "NoDialToneDetection" 90#define NODTDETECT_KEY "NoDialToneDetection"
89#define DIALTONEWAIT_KEY "WaitForDialTone" 91#define DIALTONEWAIT_KEY "WaitForDialTone"
90#define DIALSTR_KEY "DialString" 92#define DIALSTR_KEY "DialString"
91#define CONNECTRESP_KEY "ConnectResponse" 93#define CONNECTRESP_KEY "ConnectResponse"
92#define BUSYRESP_KEY "BusyResponse" 94#define BUSYRESP_KEY "BusyResponse"
93#define NOCARRIERRESP_KEY "NoCarrierResponse" 95#define NOCARRIERRESP_KEY "NoCarrierResponse"
94#define NODIALTONERESP_KEY "NoDialToneResp" 96#define NODIALTONERESP_KEY "NoDialToneResp"
95#define HANGUPSTR_KEY "HangupString" 97#define HANGUPSTR_KEY "HangupString"
96#define HANGUPRESP_KEY "HangUpResponse" 98#define HANGUPRESP_KEY "HangUpResponse"
97#define ANSWERSTR_KEY "AnswerString" 99#define ANSWERSTR_KEY "AnswerString"
98#define RINGRESP_KEY "RingResponse" 100#define RINGRESP_KEY "RingResponse"
99#define ANSWERRESP_KEY "AnswerResponse" 101#define ANSWERRESP_KEY "AnswerResponse"
100#define ENTER_KEY "Enter" 102#define ENTER_KEY "Enter"
101#define ESCAPESTR_KEY "EscapeString" 103#define ESCAPESTR_KEY "EscapeString"
102#define ESCAPERESP_KEY "EscapeResponse" 104#define ESCAPERESP_KEY "EscapeResponse"
103#define ESCAPEGUARDTIME_KEY "EscapeGuardTime" 105#define ESCAPEGUARDTIME_KEY "EscapeGuardTime"
104#define USECDLINE_KEY "UseCDLine" 106#define USECDLINE_KEY "UseCDLine"
105#define VOLUME_HIGH "VolumeHigh" 107#define VOLUME_HIGH "VolumeHigh"
106#define VOLUME_MEDIUM "VolumeMedium" 108#define VOLUME_MEDIUM "VolumeMedium"
107#define VOLUME_OFF "VolumeOff" 109#define VOLUME_OFF "VolumeOff"
108#define VOLUME_KEY "Volume" 110#define VOLUME_KEY "Volume"
109 111
110// account 112// account
111#define NAME_KEY "Name" 113#define NAME_KEY "Name"
112#define PHONENUMBER_KEY "Phonenumber" 114#define PHONENUMBER_KEY "Phonenumber"
113#define DIAL_PREFIX_KEY "DialPrefix" 115#define DIAL_PREFIX_KEY "DialPrefix"
114#define AUTH_KEY "Authentication" 116#define AUTH_KEY "Authentication"
115#define STORED_PASSWORD_KEY "Password" 117#define STORED_PASSWORD_KEY "Password"
116#define STORED_USERNAME_KEY "Username" 118#define STORED_USERNAME_KEY "Username"
117#define STORE_PASSWORD_KEY "StorePassword" 119#define STORE_PASSWORD_KEY "StorePassword"
118#define BEFORE_CONNECT_KEY "BeforeConnect" 120#define BEFORE_CONNECT_KEY "BeforeConnect"
119#define COMMAND_KEY "Command" 121#define COMMAND_KEY "Command"
120#define DISCONNECT_COMMAND_KEY "DisconnectCommand" 122#define DISCONNECT_COMMAND_KEY "DisconnectCommand"
121#define BEFORE_DISCONNECT_KEY "BeforeDisconnect" 123#define BEFORE_DISCONNECT_KEY "BeforeDisconnect"
122#define IPADDR_KEY "IPAddr" 124#define IPADDR_KEY "IPAddr"
123#define SUBNETMASK_KEY "SubnetMask" 125#define SUBNETMASK_KEY "SubnetMask"
124#define ACCTENABLED_KEY "AccountingEnabled" 126#define ACCTENABLED_KEY "AccountingEnabled"
125#define VOLACCTENABLED_KEY "VolumeAccountingEnabled" 127#define VOLACCTENABLED_KEY "VolumeAccountingEnabled"
126#define ACCTFILE_KEY "AccountingFile" 128#define ACCTFILE_KEY "AccountingFile"
127#define AUTONAME_KEY "AutoName" 129#define AUTONAME_KEY "AutoName"
128#define GATEWAY_KEY "Gateway" 130#define GATEWAY_KEY "Gateway"
129#define DEFAULTROUTE_KEY "DefaultRoute" 131#define DEFAULTROUTE_KEY "DefaultRoute"
130#define DOMAIN_KEY "Domain" 132#define DOMAIN_KEY "Domain"
131#define DNS_KEY "DNS" 133#define DNS_KEY "DNS"
132#define AUTODNS_KEY "AutoDNS" 134#define AUTODNS_KEY "AutoDNS"
133#define EXDNSDISABLED_KEY "ExDNSDisabled" 135#define EXDNSDISABLED_KEY "ExDNSDisabled"
134#define SCRIPTCOM_KEY "ScriptCommands" 136#define SCRIPTCOM_KEY "ScriptCommands"
135#define SCRIPTARG_KEY "ScriptArguments" 137#define SCRIPTARG_KEY "ScriptArguments"
136#define PPPDARG_KEY "pppdArguments" 138#define PPPDARG_KEY "pppdArguments"
137#define PPP_DEBUG_OPTION "PPPDebug" 139#define PPP_DEBUG_OPTION "PPPDebug"
138#define ICONIFY_ON_CONNECT_KEY "iconifyOnConnect" 140#define ICONIFY_ON_CONNECT_KEY "iconifyOnConnect"
139#define DOCKING_KEY "DockIntoPanel" 141#define DOCKING_KEY "DockIntoPanel"
140#define TOTALCOSTS_KEY "TotalCosts" 142#define TOTALCOSTS_KEY "TotalCosts"
141#define TOTALBYTES_KEY "TotalBytes" 143#define TOTALBYTES_KEY "TotalBytes"
142 144
143// graph colors
144#define GENABLED "Enabled"
145#define GCOLOR_BG "Background"
146#define GCOLOR_TEXT "Text"
147#define GCOLOR_IN "InBytes"
148#define GCOLOR_OUT "OutBytes"
149
150// pppd errors 145// pppd errors
151#define E_IF_TIMEOUT 1 146#define E_IF_TIMEOUT 1
152#define E_PPPD_DIED 2 147#define E_PPPD_DIED 2
153 148
154// window position 149// account list
155#define WINPOS_CONWIN_X "WindowPositionConWinX" 150#define ACCOUNTS_COUNT "Accounts_Count"
156#define WINPOS_CONWIN_Y "WindowPositionConWinY" 151#define ACOUNTS_DEV "Accounts_Modem"
157#define WINPOS_STATWIN_X "WindowPositionStatWinX" 152#define ACOUNTS_ACC "Accounts_Account"
158#define WINPOS_STATWIN_Y "WindowPositionStatWinY"
159 153
160class PPPData { 154class PPPData {
161public: 155public:
162 PPPData(); 156 PPPData();
163 ~PPPData() {}; 157 ~PPPData() {};
164 static PPPData* data(); 158 static PPPData* data();
165 159
166 enum { NumInitStrings = 2 }; 160 enum { NumInitStrings = 2 };
167 161
168 // general functions 162 // general functions
169 bool open(); 163 bool open();
170 void save(); 164 void save();
171 void cancel(); 165 void cancel();
172 166
167 QMap<QString,QString> getConfiguredInterfaces();
168 void setConfiguredInterfaces( QMap<QString,QString> );
173 169
174 // function to read/write date to configuration file 170 // function to read/write date to configuration file
175 QString readConfig(const QString &, const QString &, const QString &); 171 QString readConfig(const QString &, const QString &, const QString &);
176 int readNumConfig(const QString &, const QString &, int); 172 int readNumConfig(const QString &, const QString &, int);
177 bool readListConfig(const QString &, const QString &, 173 bool readListConfig(const QString &, const QString &,
178 QStringList &, char sep = ','); 174 QStringList &, char sep = ',');
179 void writeConfig(const QString &, const QString &, const QString &); 175 void writeConfig(const QString &, const QString &, const QString &);
180 void writeConfig(const QString &, const QString &, int); 176 void writeConfig(const QString &, const QString &, int);
181 void writeListConfig(const QString &, const QString &, 177 void writeListConfig(const QString &, const QString &,
182 QStringList &, char sep = ','); 178 QStringList &, char sep = ',');
183 179
184 // return the current account group 180 // return the current account group
185 QString currentGroup() { return cgroup; } 181 QString currentGroup() { return cgroup; }
186 QString modemGroup(); 182 QString modemGroup();
187 183
188 // functions to set/get general kppp info 184 // functions to set/get general kppp info
189 QString password() const; 185 QString password() const;
190 void setPassword(const QString &); 186 void setPassword(const QString &);
191 187
188 int currentAccountID() { return caccount; };
192 const QString defaultAccount(); 189 const QString defaultAccount();
193 void setDefaultAccount(const QString &); 190 void setDefaultAccount(const QString &);
194 191
195 void set_xserver_exit_disconnect(bool set); 192 void set_xserver_exit_disconnect(bool set);
196 bool get_xserver_exit_disconnect(); 193 bool get_xserver_exit_disconnect();
197 194
198 void setPPPDebug(bool set); 195 void setPPPDebug(bool set);
199 bool getPPPDebug(); 196 bool getPPPDebug();
200 197
201 void set_quit_on_disconnect(bool); 198 void set_quit_on_disconnect(bool);
202 bool quit_on_disconnect(); 199 bool quit_on_disconnect();
203 200
204 void set_show_clock_on_caption(bool set); 201 void set_show_clock_on_caption(bool set);
205 bool get_show_clock_on_caption(); 202 bool get_show_clock_on_caption();
206 203
207 void set_show_log_window(bool set); 204 void set_show_log_window(bool set);
208 bool get_show_log_window(); 205 bool get_show_log_window();
209 206
210 void set_automatic_redial(bool set); 207 void set_automatic_redial(bool set);
211 bool automatic_redial(); 208 bool automatic_redial();
212 209
213 void set_iconify_on_connect(bool set); 210 void set_iconify_on_connect(bool set);
214 bool get_iconify_on_connect(); 211 bool get_iconify_on_connect();
215 212
216 void set_dock_into_panel(bool set); 213 void set_dock_into_panel(bool set);
217 bool get_dock_into_panel(); 214 bool get_dock_into_panel();
218 215
219 const QString enter(); 216 const QString enter();
220 void setEnter(const QString &); 217 void setEnter(const QString &);
221 218
222 QString pppdVersion(); 219 QString pppdVersion();
223 bool pppdVersionMin(int ver, int mod, int patch); 220 bool pppdVersionMin(int ver, int mod, int patch);
224 221
225 int pppdTimeout(); 222 int pppdTimeout();
226 void setpppdTimeout(int); 223 void setpppdTimeout(int);
227 224
228 int busyWait(); 225 int busyWait();
229 void setbusyWait(int); 226 void setbusyWait(int);
230 227
231 bool modemLockFile(); 228 bool modemLockFile();
232 void setModemLockFile(bool set); 229 void setModemLockFile(bool set);
233 230
234 int modemEscapeGuardTime(); 231 int modemEscapeGuardTime();
235 void setModemEscapeGuardTime(int i); 232 void setModemEscapeGuardTime(int i);
236 233
237 void setModemEscapeStr(const QString &); 234 void setModemEscapeStr(const QString &);
238 const QString modemEscapeStr(); 235 const QString modemEscapeStr();
239 236
240 void setModemEscapeResp(const QString &); 237 void setModemEscapeResp(const QString &);
241 const QString modemEscapeResp(); 238 const QString modemEscapeResp();
242 239
243 const QString modemDevice(); 240 const QString modemDevice();
244 bool setModemDevice(const QString &); 241 bool setModemDevice(const QString &);
245 242
246 const QString flowcontrol(); 243 const QString flowcontrol();
247 void setFlowcontrol(const QString &); 244 void setFlowcontrol(const QString &);
248 245
249 int modemTimeout(); 246 int modemTimeout();
250 void setModemTimeout(int); 247 void setModemTimeout(int);
251 248
252 int modemToneDuration(); 249 int modemToneDuration();
253 void setModemToneDuration(int); 250 void setModemToneDuration(int);
254 251
255 QString volumeInitString(); 252 QString volumeInitString();
256 int volume(); 253 int volume();
257 void setVolume(int); 254 void setVolume(int);
258 255
259 int waitForDialTone(); 256 int waitForDialTone();
260 void setWaitForDialTone(int i); 257 void setWaitForDialTone(int i);
261 258
262 // modem command strings/responses 259 // modem command strings/responses
263 const QString modemInitStr(int i); 260 const QString modemInitStr(int i);
264 void setModemInitStr(int i, const QString &); 261 void setModemInitStr(int i, const QString &);
265 262
266 const QString modemInitResp(); 263 const QString modemInitResp();
267 void setModemInitResp(const QString &); 264 void setModemInitResp(const QString &);
268 265
269 int modemPreInitDelay(); 266 int modemPreInitDelay();
270 void setModemPreInitDelay(int); 267 void setModemPreInitDelay(int);
271 268
272 int modemInitDelay(); 269 int modemInitDelay();
273 void setModemInitDelay(int); 270 void setModemInitDelay(int);
274 271
275 QString modemNoDialToneDetectionStr(); 272 QString modemNoDialToneDetectionStr();
276 void setModemNoDialToneDetectionStr(const QString &); 273 void setModemNoDialToneDetectionStr(const QString &);
277 274
278 const QString modemDialStr(); 275 const QString modemDialStr();
279 void setModemDialStr(const QString &); 276 void setModemDialStr(const QString &);
280 277
281 const QString modemConnectResp(); 278 const QString modemConnectResp();
282 void setModemConnectResp(const QString &); 279 void setModemConnectResp(const QString &);
283 280
284 const QString modemBusyResp(); 281 const QString modemBusyResp();
285 void setModemBusyResp(const QString &); 282 void setModemBusyResp(const QString &);
286 283
287 const QString modemNoCarrierResp(); 284 const QString modemNoCarrierResp();
288 void setModemNoCarrierResp(const QString &); 285 void setModemNoCarrierResp(const QString &);
289 286
290 const QString modemNoDialtoneResp(); 287 const QString modemNoDialtoneResp();
291 void setModemNoDialtoneResp(const QString &); 288 void setModemNoDialtoneResp(const QString &);
292 289
293 const QString modemHangupStr(); 290 const QString modemHangupStr();
294 void setModemHangupStr(const QString &); 291 void setModemHangupStr(const QString &);
295 292
296 const QString modemHangupResp(); 293 const QString modemHangupResp();
297 void setModemHangupResp(const QString &); 294 void setModemHangupResp(const QString &);
298 295
299 const QString modemAnswerStr(); 296 const QString modemAnswerStr();
300 void setModemAnswerStr(const QString &); 297 void setModemAnswerStr(const QString &);
301 298
302 const QString modemRingResp(); 299 const QString modemRingResp();
303 void setModemRingResp(const QString &); 300 void setModemRingResp(const QString &);
304 301
305 const QString modemAnswerResp(); 302 const QString modemAnswerResp();
306 void setModemAnswerResp(const QString &); 303 void setModemAnswerResp(const QString &);
307 304
308 QString volumeOff(); 305 QString volumeOff();
309 void setVolumeOff(const QString &); 306 void setVolumeOff(const QString &);
310 307
311 QString volumeMedium(); 308 QString volumeMedium();
312 void setVolumeMedium(const QString &); 309 void setVolumeMedium(const QString &);
313 310
314 QString volumeHigh(); 311 QString volumeHigh();
315 void setVolumeHigh(const QString &); 312 void setVolumeHigh(const QString &);
316 313
317#if 0 314#if 0
318 void setUseCDLine(const int n); 315 void setUseCDLine(const int n);
319 int UseCDLine(); 316 int UseCDLine();
320#endif 317#endif
321 318
322 // functions to set/get account information 319 // functions to set/get account information
323 int count() const; 320 int count() const;
324 bool setAccount(const QString &); 321 bool setAccount(const QString &);
325 bool setAccountbyIndex(int); 322 bool setAccountbyIndex(int);
326 323
327 bool isUniqueAccname(const QString &); 324 bool isUniqueAccname(const QString &);
328 325
329 bool deleteAccount(); 326 bool deleteAccount();
330 bool deleteAccount(const QString &); 327 bool deleteAccount(const QString &);
331 int newaccount(); 328 int newaccount();
332 int copyaccount(int i); 329 int copyaccount(int i);
333 330
334 const QString accname(); 331 const QString accname();
335 void setAccname(const QString &); 332 void setAccname(const QString &);
336 333
337 QStringList &phonenumbers(); 334 QStringList &phonenumbers();
338 const QString phonenumber(); 335 const QString phonenumber();
339 void setPhonenumber(const QString &); 336 void setPhonenumber(const QString &);
340 337
341 const QString dialPrefix(); 338 const QString dialPrefix();
342 void setDialPrefix(const QString &); 339 void setDialPrefix(const QString &);
343 340
344 int authMethod(); 341 int authMethod();
345 void setAuthMethod(int); 342 void setAuthMethod(int);
346 343
347 const QString storedUsername(); 344 const QString storedUsername();
348 void setStoredUsername(const QString &); 345 void setStoredUsername(const QString &);
349 346
350 const QString storedPassword(); 347 const QString storedPassword();
351 void setStoredPassword(const QString &); 348 void setStoredPassword(const QString &);
352 349
353 bool storePassword(); 350 bool storePassword();
354 void setStorePassword(bool); 351 void setStorePassword(bool);
355 352
356 const QString speed(); 353 const QString speed();
357 void setSpeed(const QString &); 354 void setSpeed(const QString &);
358 355
359 const QString command_before_connect(); 356 const QString command_before_connect();
360 void setCommand_before_connect(const QString &); 357 void setCommand_before_connect(const QString &);
361 358
362 const QString command_on_connect(); 359 const QString command_on_connect();
363 void setCommand_on_connect(const QString &); 360 void setCommand_on_connect(const QString &);
364 361
365 const QString command_on_disconnect(); 362 const QString command_on_disconnect();
366 void setCommand_on_disconnect(const QString &); 363 void setCommand_on_disconnect(const QString &);
367 364
368 const QString command_before_disconnect(); 365 const QString command_before_disconnect();
369 void setCommand_before_disconnect(const QString &); 366 void setCommand_before_disconnect(const QString &);
370 367
371 const QString ipaddr(); 368 const QString ipaddr();
372 void setIpaddr(const QString &); 369 void setIpaddr(const QString &);
373 370
374 const QString subnetmask(); 371 const QString subnetmask();
375 void setSubnetmask(const QString &); 372 void setSubnetmask(const QString &);
376 373
377 bool AcctEnabled(); 374 bool AcctEnabled();
378 void setAcctEnabled(bool set); 375 void setAcctEnabled(bool set);
379 376
380 int VolAcctEnabled(); 377 int VolAcctEnabled();
381 void setVolAcctEnabled(int set); 378 void setVolAcctEnabled(int set);
382 379
383 bool autoDNS(); 380 bool autoDNS();
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index 3a97535..7cbccc2 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,128 +1,139 @@
1#include "pppconfig.h" 1#include "pppconfig.h"
2#include "pppmodule.h" 2#include "pppmodule.h"
3#include "pppdata.h" 3#include "pppdata.h"
4#include "kpppwidget.h" 4#include "kpppwidget.h"
5#include "interfaceinformationimp.h" 5#include "interfaceinformationimp.h"
6//#include "devices.h" 6//#include "devices.h"
7 7
8/** 8/**
9 * Constructor, find all of the possible interfaces 9 * Constructor, find all of the possible interfaces
10 */ 10 */
11PPPModule::PPPModule() : Module() 11PPPModule::PPPModule() : Module()
12{ 12{
13 QMap<QString,QString> ifaces = PPPData::data()->getConfiguredInterfaces();
14 QMap<QString,QString>::Iterator it;
13 Interface *iface; 15 Interface *iface;
14 iface = new Interface( 0, "device" ); 16 qDebug("getting interfaces");
15 iface->setHardwareName( "account" ); 17 for( it = ifaces.begin(); it != ifaces.end(); ++it ){
16 list.append( iface ); 18 qDebug("ifaces %s", it.key().latin1());
19 iface = new Interface( 0, it.key() );
20 iface->setHardwareName( it.data() );
21 list.append( iface );
22 }
17} 23}
18 24
19/** 25/**
20 * Delete any interfaces that we own. 26 * Delete any interfaces that we own.
21 */ 27 */
22PPPModule::~PPPModule(){ 28PPPModule::~PPPModule(){
23 Interface *i; 29 QMap<QString,QString> ifaces;
24 for ( i=list.first(); i != 0; i=list.next() ) 30 Interface *i;
25 delete i; 31 for ( i=list.first(); i != 0; i=list.next() ){
32 ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
33 delete i;
34 }
35 PPPData::data()->setConfiguredInterfaces( ifaces );
36 PPPData::data()->save();
26} 37}
27 38
28/** 39/**
29 * Change the current profile 40 * Change the current profile
30 */ 41 */
31void PPPModule::setProfile(const QString &newProfile){ 42void PPPModule::setProfile(const QString &newProfile){
32 profile = newProfile; 43 profile = newProfile;
33} 44}
34 45
35/** 46/**
36 * get the icon name for this device. 47 * get the icon name for this device.
37 * @param Interface* can be used in determining the icon. 48 * @param Interface* can be used in determining the icon.
38 * @return QString the icon name (minus .png, .gif etc) 49 * @return QString the icon name (minus .png, .gif etc)
39 */ 50 */
40QString PPPModule::getPixmapName(Interface* ){ 51QString PPPModule::getPixmapName(Interface* ){
41 return "ppp"; 52 return "ppp";
42} 53}
43 54
44/** 55/**
45 * Check to see if the interface i is owned by this module. 56 * Check to see if the interface i is owned by this module.
46 * @param Interface* interface to check against 57 * @param Interface* interface to check against
47 * @return bool true if i is owned by this module, false otherwise. 58 * @return bool true if i is owned by this module, false otherwise.
48 */ 59 */
49bool PPPModule::isOwner(Interface *i){ 60bool PPPModule::isOwner(Interface *i){
50 return list.find( i ) != -1; 61 return list.find( i ) != -1;
51} 62}
52 63
53/** 64/**
54 * Create, and return the WLANConfigure Module 65 * Create, and return the WLANConfigure Module
55 * @return QWidget* pointer to this modules configure. 66 * @return QWidget* pointer to this modules configure.
56 */ 67 */
57QWidget *PPPModule::configure(Interface *i){ 68QWidget *PPPModule::configure(Interface *i){
58 qDebug("return ModemWidget"); 69 qDebug("return ModemWidget");
59 PPPConfigWidget *pppconfig = new PPPConfigWidget( i, 0, "PPPConfig", 70 PPPConfigWidget *pppconfig = new PPPConfigWidget( i, 0, "PPPConfig",
60 false, 71 false,
61 Qt::WDestructiveClose ); 72 Qt::WDestructiveClose );
62 return pppconfig; 73 return pppconfig;
63} 74}
64 75
65/** 76/**
66 * Create, and return the Information Module 77 * Create, and return the Information Module
67 * @return QWidget* pointer to this modules info. 78 * @return QWidget* pointer to this modules info.
68 */ 79 */
69QWidget *PPPModule::information(Interface *i){ 80QWidget *PPPModule::information(Interface *i){
70 // We don't have any advanced pppd information widget yet :-D 81 // We don't have any advanced pppd information widget yet :-D
71 // TODO ^ 82 // TODO ^
72 qDebug("return PPPModule::information"); 83 qDebug("return PPPModule::information");
73 InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i); 84 InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i);
74 return information; 85 return information;
75} 86}
76 87
77/** 88/**
78 * Get all active (up or down) interfaces 89 * Get all active (up or down) interfaces
79 * @return QList<Interface> A list of interfaces that exsist that havn't 90 * @return QList<Interface> A list of interfaces that exsist that havn't
80 * been called by isOwner() 91 * been called by isOwner()
81 */ 92 */
82QList<Interface> PPPModule::getInterfaces(){ 93QList<Interface> PPPModule::getInterfaces(){
83 // List all of the files in the peer directory 94 // List all of the files in the peer directory
84 qDebug("PPPModule::getInterfaces"); 95 qDebug("PPPModule::getInterfaces");
85 return list; 96 return list;
86} 97}
87 98
88/** 99/**
89 * Attempt to add a new interface as defined by name 100 * Attempt to add a new interface as defined by name
90 * @param name the name of the type of interface that should be created given 101 * @param name the name of the type of interface that should be created given
91 * by possibleNewInterfaces(); 102 * by possibleNewInterfaces();
92 * @return Interface* NULL if it was unable to be created. 103 * @return Interface* NULL if it was unable to be created.
93 */ 104 */
94Interface *PPPModule::addNewInterface(const QString &newInterface){ 105Interface *PPPModule::addNewInterface(const QString &newInterface){
95 106
96 qDebug("try to add iface %s",newInterface.latin1()); 107 qDebug("try to add iface %s",newInterface.latin1());
97 108
98 Interface *iface; 109 Interface *iface;
99 iface = new Interface(); 110 iface = new Interface();
100 PPPConfigWidget imp(iface, 0, "PPPConfigImp", true); 111 PPPConfigWidget imp(iface, 0, "PPPConfigImp", true);
101 imp.showMaximized(); 112 imp.showMaximized();
102 if(imp.exec() == QDialog::Accepted ){ 113 if(imp.exec() == QDialog::Accepted ){
103 iface->setModuleOwner( this ); 114 iface->setModuleOwner( this );
104 list.append( iface ); 115 list.append( iface );
105 return iface; 116 return iface;
106 }else { 117 }else {
107 delete iface; 118 delete iface;
108 iface = NULL; 119 iface = NULL;
109 } 120 }
110 return iface; 121 return iface;
111} 122}
112 123
113/** 124/**
114 * Attempts to remove the interface, doesn't delete i 125 * Attempts to remove the interface, doesn't delete i
115 * @return bool true if successfull, false otherwise. 126 * @return bool true if successfull, false otherwise.
116 */ 127 */
117bool PPPModule::remove(Interface*){ 128bool PPPModule::remove(Interface*){
118 // Can't remove a hardware device, you can stop it though. 129 // Can't remove a hardware device, you can stop it though.
119 return false; 130 return false;
120} 131}
121 132
122void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) 133void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
123{ 134{
124 newIfaces.insert(QObject::tr("PPP") , 135 newIfaces.insert(QObject::tr("PPP") ,
125 QObject::tr("generic ppp device")); 136 QObject::tr("generic ppp device"));
126} 137}
127 138
128 139