summaryrefslogtreecommitdiff
authortille <tille>2003-05-25 14:25:23 (UTC)
committer tille <tille>2003-05-25 14:25:23 (UTC)
commit61c6231cdcde59f8a3ecff31b9fab37f7e9d8852 (patch) (unidiff)
tree4724031209e2263c872ad6160ea61a793f09ed1e
parentefa6dfa3428746451dd5a9b5e1ba57806ae96dba (diff)
downloadopie-61c6231cdcde59f8a3ecff31b9fab37f7e9d8852.zip
opie-61c6231cdcde59f8a3ecff31b9fab37f7e9d8852.tar.gz
opie-61c6231cdcde59f8a3ecff31b9fab37f7e9d8852.tar.bz2
save device specific settings
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/conwindow.cpp110
-rw-r--r--noncore/settings/networksettings/ppp/ppp.pro4
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp27
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.h4
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp54
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h16
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp24
7 files changed, 130 insertions, 109 deletions
diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp
index ad89005..20d705d 100644
--- a/noncore/settings/networksettings/ppp/conwindow.cpp
+++ b/noncore/settings/networksettings/ppp/conwindow.cpp
@@ -253,79 +253,79 @@ void ConWindow::startClock() {
253 253
254void ConWindow::setConnectionSpeed(const QString &speed) { 254void ConWindow::setConnectionSpeed(const QString &speed) {
255 info2->setText(speed); 255 info2->setText(speed);
256} 256}
257 257
258 258
259void ConWindow::stopClock() { 259void ConWindow::stopClock() {
260 clocktimer->stop(); 260 clocktimer->stop();
261} 261}
262 262
263 263
264void ConWindow::timeclick() { 264void ConWindow::timeclick() {
265 QString tooltip = i18n("Connection: %1\n" 265// QString tooltip = i18n("Connection: %1\n"
266 "Connected at: %2\n" 266 // "Connected at: %2\n"
267 "Time connected: %3") 267 // "Time connected: %3")
268 .arg(PPPData::data()->accname()).arg(info2->text()) 268 // .arg(PPPData::data()->accname()).arg(info2->text())
269 .arg(time_string2); 269 // .arg(time_string2);
270 270
271 if(accountingEnabled) 271// if(accountingEnabled)
272 tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2") 272// tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2")
273 .arg(session_bill->text()).arg(total_bill->text()); 273 // .arg(session_bill->text()).arg(total_bill->text());
274 // volume accounting 274// // volume accounting
275 if(volumeAccountingEnabled) { 275// if(volumeAccountingEnabled) {
276 276
277 volinfo->setEnabled(TRUE); 277// volinfo->setEnabled(TRUE);
278 int bytes = PPPData::data()->totalBytes(); 278// int bytes = PPPData::data()->totalBytes();
279 volinfo->setText(prettyPrintVolume(bytes)); 279// volinfo->setText(prettyPrintVolume(bytes));
280 } 280// }
281 281
282 seconds++; 282// seconds++;
283 283
284 if(seconds >= 60 ) { 284// if(seconds >= 60 ) {
285 minutes ++; 285// minutes ++;
286 seconds = 0; 286// seconds = 0;
287 } 287// }
288 288
289 if (minutes >= 60){ 289// if (minutes >= 60){
290 minutes = 0; 290// minutes = 0;
291 hours ++; 291// hours ++;
292 } 292// }
293 293
294 if( hours >= 24){ 294// if( hours >= 24){
295 days ++; 295// days ++;
296 hours = 0; 296// hours = 0;
297 } 297// }
298 298
299 time_string.sprintf("%02d:%02d",hours,minutes); 299// time_string.sprintf("%02d:%02d",hours,minutes);
300 time_string2 = ""; 300// time_string2 = "";
301 if (days) 301// if (days)
302 time_string2.sprintf("%d d %02d:%02d:%02d", 302// time_string2.sprintf("%d d %02d:%02d:%02d",
303 days,hours,minutes,seconds); 303 // days,hours,minutes,seconds);
304 304
305 else 305// else
306 time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds); 306// time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
307 307
308 caption_string = PPPData::data()->accname(); 308// caption_string = PPPData::data()->accname();
309 caption_string += " "; 309// caption_string += " ";
310 caption_string += time_string; 310// caption_string += time_string;
311 311
312 312
313 timelabel2->setText(time_string2); 313// timelabel2->setText(time_string2);
314 314
315 if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){ 315// if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){
316 // we update the Caption only once per minute not every second 316// // we update the Caption only once per minute not every second
317 // otherwise I get a flickering icon 317// // otherwise I get a flickering icon
318 this->setCaption(caption_string); 318// this->setCaption(caption_string);
319 } 319// }
320 320
321// QToolTip::add(DockWidget::dock_widget, tooltip); 321// QToolTip::add(DockWidget::dock_widget, tooltip);
322} 322}
323 323
324 324
325void ConWindow::closeEvent( QCloseEvent *e ){ 325void ConWindow::closeEvent( QCloseEvent *e ){
326 // we don't want to lose the 326 // we don't want to lose the
327 // conwindow since this is our last connection kppp. 327 // conwindow since this is our last connection kppp.
328 // if we lost it we could only kill the program by hand to get on with life. 328 // if we lost it we could only kill the program by hand to get on with life.
329 e->ignore(); 329 e->ignore();
330 330
331 if(PPPData::data()->get_dock_into_panel()) 331 if(PPPData::data()->get_dock_into_panel())
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro
index e3c58d6..ac438dd 100644
--- a/noncore/settings/networksettings/ppp/ppp.pro
+++ b/noncore/settings/networksettings/ppp/ppp.pro
@@ -1,20 +1,20 @@
1#TEMPLATE = app 1#TEMPLATE = app
2# 2#
3TEMPLATE = lib 3TEMPLATE = lib
4#CONFIG += qt warn_on release 4#CONFIG += qt warn_on release
5 CONFIG += qt warn_on debug 5 CONFIG += qt warn_on debug
6DESTDIR = $(OPIEDIR)/plugins/networksettings 6DESTDIR = $(OPIEDIR)/plugins/networksettings
7 HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h kpppwidget.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h 7 HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h kpppwidget.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h
8# knuminput.h knumvalidator.h 8#
9 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp kpppwidget.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp 9 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp kpppwidget.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp
10#knuminput.cpp knumvalidator.cpp 10#
11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 11 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
12 DEPENDPATH+= $(OPIEDIR)/include 12 DEPENDPATH+= $(OPIEDIR)/include
13LIBS += -lqpe -L../interfaces/ -linterfaces 13LIBS += -lqpe -L../interfaces/ -linterfaces
14 INTERFACES= 14 INTERFACES=
15 TARGET = pppplugin 15 TARGET = pppplugin
16 VERSION = 1.0.0 16 VERSION = 1.0.0
17 17
18 18
19 19
20include ( $(OPIEDIR)/include.pro ) 20include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index c0f1fef..e2521a6 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -1,38 +1,43 @@
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"
9#include "modem.h"
8#include "pppconfig.h" 10#include "pppconfig.h"
9#include "pppdata.h" 11#include "pppdata.h"
10#include "runtests.h" 12#include "runtests.h"
11#include "modem.h"
12 13
13PPPConfigWidget::PPPConfigWidget( QWidget *parent, const char *name, 14PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
15 const char *name,
14 bool modal, WFlags fl ) 16 bool modal, WFlags fl )
15 : QDialog(parent, name, modal, fl) 17 : QDialog(parent, name, modal, fl)
16{ 18{
17 setCaption(tr("Configure Modem")); 19 setCaption(tr("Configure Modem"));
18 int result = runTests(); 20 int result = runTests();
19 if(result == TEST_CRITICAL){ 21 if(result == TEST_CRITICAL){
20 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") );
21 return; 23 return;
22 } 24 }
23
24// setFixedSize(sizeHint());
25 25
26 (void)new Modem; 26 interface = iface;
27 if (!PPPData::data()->setModemDevice( interface->getInterfaceName() ))
28 PPPData::data()->setModemDevice("/dev/modem");
29 if (!PPPData::data()->setAccount( interface->getHardwareName() ))
30 PPPData::data()->setAccount( 0 );
31 (void)new Modem;
27 32
28 QVBoxLayout *layout = new QVBoxLayout( this ); 33 QVBoxLayout *layout = new QVBoxLayout( this );
29 layout->setSpacing( 0 ); 34 layout->setSpacing( 0 );
30 layout->setMargin( 1 ); 35 layout->setMargin( 1 );
31 tabWindow = new QTabWidget( this, "tabWidget" ); 36 tabWindow = new QTabWidget( this, "tabWidget" );
32 layout->addWidget( tabWindow ); 37 layout->addWidget( tabWindow );
33 38
34 accounts = new AccountWidget( tabWindow, "accounts" ); 39 accounts = new AccountWidget( tabWindow, "accounts" );
35 tabWindow->addTab( accounts, tr("&Accounts") ); 40 tabWindow->addTab( accounts, tr("&Accounts") );
36 modem1 = new ModemWidget( tabWindow, "modem1" ); 41 modem1 = new ModemWidget( tabWindow, "modem1" );
37 tabWindow->addTab( modem1, tr("&Device") ); 42 tabWindow->addTab( modem1, tr("&Device") );
38 modem2 = new ModemWidget2( tabWindow, "modem2" ); 43 modem2 = new ModemWidget2( tabWindow, "modem2" );
@@ -41,22 +46,24 @@ PPPConfigWidget::PPPConfigWidget( QWidget *parent, const char *name,
41// general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) ); 46// general = new GeneralWidget( tabWindow->addPage( tr("M&isc"), tr("Miscellaneous Settings") ) );
42 47
43} 48}
44 49
45 50
46PPPConfigWidget::~PPPConfigWidget() 51PPPConfigWidget::~PPPConfigWidget()
47{ 52{
48 53
49} 54}
50 55
51void PPPConfigWidget::accept() 56void PPPConfigWidget::accept()
52{ 57{
58 interface->setInterfaceName( PPPData::data()->modemDevice() );
59 interface->setHardwareName( PPPData::data()->accname() );
53 PPPData::data()->save(); 60 PPPData::data()->save();
54 QDialog::accept(); 61 QDialog::accept();
55} 62}
56 63
57 64
58void PPPConfigWidget::reject() 65void PPPConfigWidget::reject()
59{ 66{
60 PPPData::data()->cancel(); 67 PPPData::data()->cancel();
61 QDialog::reject(); 68 QDialog::reject();
62} 69}
diff --git a/noncore/settings/networksettings/ppp/pppconfig.h b/noncore/settings/networksettings/ppp/pppconfig.h
index ec64878..b324b6d 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.h
+++ b/noncore/settings/networksettings/ppp/pppconfig.h
@@ -1,34 +1,36 @@
1#ifndef _PPPCONFIG_H_ 1#ifndef _PPPCONFIG_H_
2#define _PPPCONFIG_H_ 2#define _PPPCONFIG_H_
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5 5
6class QTabWidget; 6class QTabWidget;
7class Interface;
7class AccountWidget; 8class AccountWidget;
8class GeneralWidget; 9class GeneralWidget;
9class ModemWidget; 10class ModemWidget;
10class ModemWidget2; 11class ModemWidget2;
11 12
12class PPPConfigWidget : public QDialog { 13class PPPConfigWidget : public QDialog {
13 Q_OBJECT 14 Q_OBJECT
14public: 15public:
15 16
16 PPPConfigWidget( QWidget *parent=0, const char *name=0, 17 PPPConfigWidget( Interface*, QWidget *parent=0, const char *name=0,
17 bool modal = false, WFlags fl = 0 ); 18 bool modal = false, WFlags fl = 0 );
18 ~PPPConfigWidget(); 19 ~PPPConfigWidget();
19 20
20 21
21protected slots: 22protected slots:
22 virtual void accept(); 23 virtual void accept();
23 virtual void reject(); 24 virtual void reject();
24 25
25 private: 26 private:
27 Interface *interface;
26 QTabWidget *tabWindow; 28 QTabWidget *tabWindow;
27 AccountWidget *accounts; 29 AccountWidget *accounts;
28 GeneralWidget *general; 30 GeneralWidget *general;
29 ModemWidget *modem1; 31 ModemWidget *modem1;
30 ModemWidget2 *modem2; 32 ModemWidget2 *modem2;
31}; 33};
32 34
33 35
34#endif 36#endif
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index bb1c8ed..109e3b7 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -51,25 +51,26 @@ PPPData* PPPData::data()
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 : //config(0L),
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)
64{ 65{
65} 66}
66 67
67 68
68// 69//
69// open configuration file 70// open configuration file
70// 71//
71bool PPPData::open() { 72bool PPPData::open() {
72 qDebug("opening configfile NetworkSetupPPP"); 73 qDebug("opening configfile NetworkSetupPPP");
73 if (config) return true; 74 if (config) return true;
74 config = new Config("NetworkSetupPPP"); 75 config = new Config("NetworkSetupPPP");
75 76
@@ -318,26 +319,34 @@ int PPPData::pppdTimeout() {
318 319
319 320
320void PPPData::setpppdTimeout(int n) { 321void PPPData::setpppdTimeout(int n) {
321 writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); 322 writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n);
322} 323}
323 324
324 325
325const QString PPPData::modemDevice() { 326const QString PPPData::modemDevice() {
326 return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); 327 return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]);
327} 328}
328 329
329 330
330void PPPData::setModemDevice(const QString &n) { 331bool PPPData::setModemDevice(const QString &n) {
331 writeConfig(modemGroup(), MODEMDEV_KEY, n); 332 //FIXME: change modem group
333 bool ret = false;
334 for (int i = 0; devices[i]; i++)
335 if (devices[i] == n){
336 modemDeviceGroup = i;
337 writeConfig(modemGroup(), MODEMDEV_KEY, n);
338 ret = true;
339 }
340 return ret;
332} 341}
333 342
334 343
335const QString PPPData::flowcontrol() { 344const QString PPPData::flowcontrol() {
336 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); 345 return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS");
337} 346}
338 347
339 348
340void PPPData::setFlowcontrol(const QString &n) { 349void PPPData::setFlowcontrol(const QString &n) {
341 writeConfig(modemGroup(), FLOWCONTROL_KEY, n); 350 writeConfig(modemGroup(), FLOWCONTROL_KEY, n);
342} 351}
343 352
@@ -1084,51 +1093,51 @@ QStringList &PPPData::script() {
1084 while(scriptlist.count() > MAX_SCRIPT_ENTRIES) 1093 while(scriptlist.count() > MAX_SCRIPT_ENTRIES)
1085 scriptlist.remove(scriptlist.last()); 1094 scriptlist.remove(scriptlist.last());
1086 1095
1087 return scriptlist; 1096 return scriptlist;
1088} 1097}
1089 1098
1090 1099
1091void PPPData::setScript(QStringList &list) { 1100void PPPData::setScript(QStringList &list) {
1092 writeListConfig(cgroup, SCRIPTARG_KEY, list); 1101 writeListConfig(cgroup, SCRIPTARG_KEY, list);
1093} 1102}
1094 1103
1095 1104
1096const QString PPPData::accountingFile() { 1105// const QString PPPData::accountingFile() {
1097 return readConfig(cgroup, ACCTFILE_KEY); 1106// return readConfig(cgroup, ACCTFILE_KEY);
1098} 1107// }
1099 1108
1100 1109
1101void PPPData::setAccountingFile(const QString &n) { 1110// void PPPData::setAccountingFile(const QString &n) {
1102 writeConfig(cgroup, ACCTFILE_KEY, n); 1111// writeConfig(cgroup, ACCTFILE_KEY, n);
1103} 1112// }
1104 1113
1105 1114
1106const QString PPPData::totalCosts() { 1115// const QString PPPData::totalCosts() {
1107 return readConfig(cgroup, TOTALCOSTS_KEY); 1116// return readConfig(cgroup, TOTALCOSTS_KEY);
1108} 1117// }
1109 1118
1110 1119
1111void PPPData::setTotalCosts(const QString &n) { 1120// void PPPData::setTotalCosts(const QString &n) {
1112 writeConfig(cgroup, TOTALCOSTS_KEY, n); 1121// writeConfig(cgroup, TOTALCOSTS_KEY, n);
1113} 1122// }
1114 1123
1115 1124
1116int PPPData::totalBytes() { 1125// int PPPData::totalBytes() {
1117 return readNumConfig(cgroup, TOTALBYTES_KEY, 0); 1126// return readNumConfig(cgroup, TOTALBYTES_KEY, 0);
1118} 1127// }
1119 1128
1120void PPPData::setTotalBytes(int n) { 1129// void PPPData::setTotalBytes(int n) {
1121 writeConfig(cgroup, TOTALBYTES_KEY, n); 1130// writeConfig(cgroup, TOTALBYTES_KEY, n);
1122} 1131// }
1123 1132
1124 1133
1125QStringList &PPPData::pppdArgument() { 1134QStringList &PPPData::pppdArgument() {
1126 static QStringList arglist; 1135 static QStringList arglist;
1127 1136
1128 while(arglist.count() > MAX_PPPD_ARGUMENTS) 1137 while(arglist.count() > MAX_PPPD_ARGUMENTS)
1129 arglist.remove(arglist.last()); 1138 arglist.remove(arglist.last());
1130 readListConfig(cgroup, PPPDARG_KEY, arglist); 1139 readListConfig(cgroup, PPPDARG_KEY, arglist);
1131 1140
1132 return arglist; 1141 return arglist;
1133} 1142}
1134 1143
@@ -1202,25 +1211,26 @@ void PPPData::setpppdRunning(bool set) {
1202} 1211}
1203 1212
1204int PPPData::pppdError() const { 1213int PPPData::pppdError() const {
1205 return pppderror; 1214 return pppderror;
1206} 1215}
1207 1216
1208void PPPData::setpppdError(int err) { 1217void PPPData::setpppdError(int err) {
1209 pppderror = err; 1218 pppderror = err;
1210} 1219}
1211 1220
1212QString PPPData::modemGroup() 1221QString PPPData::modemGroup()
1213{ 1222{
1214 return MODEM_GRP; 1223 if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup);
1224 return QString("MODEM_GRP_%1").arg(modemDeviceGroup);
1215} 1225}
1216 1226
1217// // 1227// //
1218// // window position 1228// // window position
1219// // 1229// //
1220// void PPPData::winPosConWin(int& p_x, int& p_y) { 1230// void PPPData::winPosConWin(int& p_x, int& p_y) {
1221// p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160); 1231// p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160);
1222// p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55); 1232// p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55);
1223// } 1233// }
1224 1234
1225// void PPPData::setWinPosConWin(int p_x, int p_y) { 1235// void PPPData::setWinPosConWin(int p_x, int p_y) {
1226// writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x); 1236// writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x);
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index c4d7bc3..41dfbd8 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -232,25 +232,25 @@ public:
232 void setModemLockFile(bool set); 232 void setModemLockFile(bool set);
233 233
234 int modemEscapeGuardTime(); 234 int modemEscapeGuardTime();
235 void setModemEscapeGuardTime(int i); 235 void setModemEscapeGuardTime(int i);
236 236
237 void setModemEscapeStr(const QString &); 237 void setModemEscapeStr(const QString &);
238 const QString modemEscapeStr(); 238 const QString modemEscapeStr();
239 239
240 void setModemEscapeResp(const QString &); 240 void setModemEscapeResp(const QString &);
241 const QString modemEscapeResp(); 241 const QString modemEscapeResp();
242 242
243 const QString modemDevice(); 243 const QString modemDevice();
244 void setModemDevice(const QString &); 244 bool setModemDevice(const QString &);
245 245
246 const QString flowcontrol(); 246 const QString flowcontrol();
247 void setFlowcontrol(const QString &); 247 void setFlowcontrol(const QString &);
248 248
249 int modemTimeout(); 249 int modemTimeout();
250 void setModemTimeout(int); 250 void setModemTimeout(int);
251 251
252 int modemToneDuration(); 252 int modemToneDuration();
253 void setModemToneDuration(int); 253 void setModemToneDuration(int);
254 254
255 QString volumeInitString(); 255 QString volumeInitString();
256 int volume(); 256 int volume();
@@ -410,56 +410,56 @@ public:
410 QStringList &pppdArgument(); 410 QStringList &pppdArgument();
411 void setpppdArgumentDefaults(); 411 void setpppdArgumentDefaults();
412 void setpppdArgument(QStringList &); 412 void setpppdArgument(QStringList &);
413 413
414 //functions to change/set the child pppd process info 414 //functions to change/set the child pppd process info
415 bool pppdRunning() const; 415 bool pppdRunning() const;
416 void setpppdRunning(bool set); 416 void setpppdRunning(bool set);
417 417
418 int pppdError() const; 418 int pppdError() const;
419 void setpppdError(int err); 419 void setpppdError(int err);
420 420
421 // functions to set/query the accounting info 421 // functions to set/query the accounting info
422 const QString accountingFile(); 422// const QString accountingFile();
423 void setAccountingFile(const QString &); 423// void setAccountingFile(const QString &);
424 424
425 const QString totalCosts(); 425// const QString totalCosts();
426 void setTotalCosts(const QString &); 426// void setTotalCosts(const QString &);
427 427
428 int totalBytes(); 428// int totalBytes();
429 void setTotalBytes(int); 429// void setTotalBytes(int);
430 430
431// // graphing widget 431// // graphing widget
432// void setGraphingOptions(bool enabled, 432// void setGraphingOptions(bool enabled,
433 // QColor bg, 433 // QColor bg,
434 // QColor text, 434 // QColor text,
435 // QColor in, 435 // QColor in,
436 // QColor out); 436 // QColor out);
437// void graphingOptions(bool &enabled, 437// void graphingOptions(bool &enabled,
438 // QColor &bg, 438 // QColor &bg,
439 // QColor &text, 439 // QColor &text,
440 // QColor &in, 440 // QColor &in,
441 // QColor &out); 441 // QColor &out);
442// bool graphingEnabled(); 442// bool graphingEnabled();
443 443
444// // window positions 444// // window positions
445// void winPosConWin(int &, int &); 445// void winPosConWin(int &, int &);
446// void setWinPosConWin(int, int); 446// void setWinPosConWin(int, int);
447// void winPosStatWin(int &, int &); 447// void winPosStatWin(int &, int &);
448// void setWinPosStatWin(int, int); 448// void setWinPosStatWin(int, int);
449 449
450private: 450private:
451 451
452 static PPPData *_data; 452 static PPPData *_data;
453 453 int modemDeviceGroup;
454 QString passwd; 454 QString passwd;
455 static Config* config; // configuration object 455 static Config* config; // configuration object
456 int highcount; // index of highest account 456 int highcount; // index of highest account
457 int caccount; // index of the current account 457 int caccount; // index of the current account
458 QString cgroup; // name of current config group 458 QString cgroup; // name of current config group
459 pid_t suidprocessid; // process ID of setuid child 459 pid_t suidprocessid; // process ID of setuid child
460 bool pppdisrunning; // pppd process 460 bool pppdisrunning; // pppd process
461 // daemon 461 // daemon
462 int pppderror; // error encounterd running pppd 462 int pppderror; // error encounterd running pppd
463 int pppdVer, pppdMod, pppdPatch; // pppd version 463 int pppdVer, pppdMod, pppdPatch; // pppd version
464 464
465 QStringList phonelist; 465 QStringList phonelist;
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index fb2f3e5..3a97535 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -47,74 +47,76 @@ QString PPPModule::getPixmapName(Interface* ){
47 * @return bool true if i is owned by this module, false otherwise. 47 * @return bool true if i is owned by this module, false otherwise.
48 */ 48 */
49bool PPPModule::isOwner(Interface *i){ 49bool PPPModule::isOwner(Interface *i){
50 return list.find( i ) != -1; 50 return list.find( i ) != -1;
51} 51}
52 52
53/** 53/**
54 * Create, and return the WLANConfigure Module 54 * Create, and return the WLANConfigure Module
55 * @return QWidget* pointer to this modules configure. 55 * @return QWidget* pointer to this modules configure.
56 */ 56 */
57QWidget *PPPModule::configure(Interface *i){ 57QWidget *PPPModule::configure(Interface *i){
58 qDebug("return ModemWidget"); 58 qDebug("return ModemWidget");
59 PPPConfigWidget *pppconfig = new PPPConfigWidget( 0, "PPPConfig", false, 59 PPPConfigWidget *pppconfig = new PPPConfigWidget( i, 0, "PPPConfig",
60 false,
60 Qt::WDestructiveClose ); 61 Qt::WDestructiveClose );
61 return pppconfig; 62 return pppconfig;
62} 63}
63 64
64/** 65/**
65 * Create, and return the Information Module 66 * Create, and return the Information Module
66 * @return QWidget* pointer to this modules info. 67 * @return QWidget* pointer to this modules info.
67 */ 68 */
68QWidget *PPPModule::information(Interface *i){ 69QWidget *PPPModule::information(Interface *i){
69 // We don't have any advanced pppd information widget yet :-D 70 // We don't have any advanced pppd information widget yet :-D
70 // TODO ^ 71 // TODO ^
71 qDebug("return PPPModule::information"); 72 qDebug("return PPPModule::information");
72 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i); 73 InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i);
73 return information; 74 return information;
74} 75}
75 76
76/** 77/**
77 * Get all active (up or down) interfaces 78 * Get all active (up or down) interfaces
78 * @return QList<Interface> A list of interfaces that exsist that havn't 79 * @return QList<Interface> A list of interfaces that exsist that havn't
79 * been called by isOwner() 80 * been called by isOwner()
80 */ 81 */
81QList<Interface> PPPModule::getInterfaces(){ 82QList<Interface> PPPModule::getInterfaces(){
82 // List all of the files in the peer directory 83 // List all of the files in the peer directory
83 qDebug("PPPModule::getInterfaces"); 84 qDebug("PPPModule::getInterfaces");
84 return list; 85 return list;
85} 86}
86 87
87/** 88/**
88 * Attempt to add a new interface as defined by name 89 * Attempt to add a new interface as defined by name
89 * @param name the name of the type of interface that should be created given 90 * @param name the name of the type of interface that should be created given
90 * by possibleNewInterfaces(); 91 * by possibleNewInterfaces();
91 * @return Interface* NULL if it was unable to be created. 92 * @return Interface* NULL if it was unable to be created.
92 */ 93 */
93Interface *PPPModule::addNewInterface(const QString &newInterface){ 94Interface *PPPModule::addNewInterface(const QString &newInterface){
94 95
95 qDebug("try to add iface %s",newInterface.latin1()); 96 qDebug("try to add iface %s",newInterface.latin1());
96 97
97 PPPConfigWidget imp(0, "PPPConfigImp", true); 98 Interface *iface;
99 iface = new Interface();
100 PPPConfigWidget imp(iface, 0, "PPPConfigImp", true);
98 imp.showMaximized(); 101 imp.showMaximized();
99 if(imp.exec() == QDialog::Accepted ){ 102 if(imp.exec() == QDialog::Accepted ){
100 qDebug("ACCEPTED"); 103 iface->setModuleOwner( this );
101 PPPData::data()->save(); 104 list.append( iface );
102 Interface *iface; 105 return iface;
103 iface = new Interface( 0, PPPData::data()->modemDevice() ); 106 }else {
104 iface->setHardwareName( PPPData::data()->accname() ); 107 delete iface;
105 list.append( iface ); 108 iface = NULL;
106 return iface;
107 } 109 }
108 return NULL; 110 return iface;
109} 111}
110 112
111/** 113/**
112 * Attempts to remove the interface, doesn't delete i 114 * Attempts to remove the interface, doesn't delete i
113 * @return bool true if successfull, false otherwise. 115 * @return bool true if successfull, false otherwise.
114 */ 116 */
115bool PPPModule::remove(Interface*){ 117bool PPPModule::remove(Interface*){
116 // Can't remove a hardware device, you can stop it though. 118 // Can't remove a hardware device, you can stop it though.
117 return false; 119 return false;
118} 120}
119 121
120void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) 122void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)