Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 397 |
1 files changed, 295 insertions, 102 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index 8f45e54..f4727c1 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp | |||
@@ -5,137 +5,148 @@ | |||
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 | ||
32 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
33 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
34 | #include <qapplication.h> | 33 | #include <qapplication.h> |
35 | // #include <klocale.h> | 34 | // #include <klocale.h> |
36 | // #include <kconfig.h> | 35 | // #include <kconfig.h> |
37 | // #include <kmessagebox.h> | 36 | // #include <kmessagebox.h> |
38 | // #include <kapplication.h> | 37 | // #include <kapplication.h> |
39 | #include <assert.h> | 38 | #include <assert.h> |
40 | 39 | ||
41 | #define SEPARATOR -sseepp- | 40 | #define SEPARATOR -sseepp- |
42 | #define SEP QString("%1SEPARATOR%1") | 41 | #define SEP QString("%1SEPARATOR%1") |
43 | 42 | ||
44 | PPPData::PPPData() | 43 | PPPData::PPPData() |
45 | : modemDeviceGroup(-1), | 44 | : passwd(""), |
46 | passwd(""), | 45 | _modemName(""), |
47 | highcount(-1), // start out with no entries | 46 | highcount(-1), // start out with no entries |
48 | caccount(-1), // set the current account index also | 47 | highcountdev(-1), // start out with no entries |
48 | // caccount(-1), // set the current account index also | ||
49 | suidprocessid(-1), // process ID of setuid child | 49 | suidprocessid(-1), // process ID of setuid child |
50 | pppdisrunning(false), | 50 | pppdisrunning(false), |
51 | pppderror(0) | 51 | pppderror(0) |
52 | { | 52 | { |
53 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; | 53 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; |
54 | highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1; | ||
55 | Config cfg = config(); | ||
56 | cfg.setGroup(GENERAL_GRP); | ||
57 | accountList = cfg.readListEntry(ACCOUNT_LIST, ',' ); | ||
58 | deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' ); | ||
59 | qDebug("PPPData::PPPData has a accountList %s", accountList.join("---").latin1()); | ||
60 | qDebug("PPPData::PPPData has a deviceList %s", deviceList.join("---").latin1()); | ||
54 | 61 | ||
55 | if (highcount > MAX_ACCOUNTS) | 62 | // if (highcount > MAX_ACCOUNTS) |
56 | highcount = MAX_ACCOUNTS; | 63 | // highcount = MAX_ACCOUNTS; |
57 | 64 | ||
58 | if(highcount >= 0 && defaultAccount().isEmpty()) { | 65 | // if(highcount >= 0 && defaultAccount().isEmpty()) { |
59 | setAccountbyIndex(0); | 66 | // setAccountbyIndex(0); |
60 | setDefaultAccount(accname()); | 67 | // setDefaultAccount(accname()); |
61 | } else if(!setAccount(defaultAccount())) | 68 | // } else if(!setAccount(defaultAccount())) |
62 | setDefaultAccount(accname()); | 69 | setDefaultAccount(accname()); |
63 | 70 | ||
64 | // start out with internal debugging disabled | 71 | // start out with internal debugging disabled |
65 | // the user is still free to specify `debug' on his own | 72 | // the user is still free to specify `debug' on his own |
66 | setPPPDebug(false); | 73 | setPPPDebug(false); |
67 | 74 | ||
68 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); | 75 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); |
69 | 76 | ||
70 | } | 77 | } |
71 | 78 | ||
72 | Config PPPData::config() | 79 | Config PPPData::config() |
73 | { | 80 | { |
74 | return Config("NetworkSetupPPP"); | 81 | return Config("NetworkSetupPPP"); |
75 | } | 82 | } |
76 | 83 | ||
77 | // | 84 | // |
78 | // save configuration | 85 | // save configuration |
79 | // | 86 | // |
80 | void PPPData::save() | 87 | void PPPData::save() |
81 | { | 88 | { |
82 | qDebug("PPPData saving data"); | 89 | qDebug("PPPData saving data"); |
83 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); | 90 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); |
91 | writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1); | ||
84 | QString key; | 92 | QString key; |
85 | QStringList keys; | 93 | QStringList keys; |
86 | Config cfg = config(); | 94 | Config cfg = config(); |
95 | cfg.setGroup(GENERAL_GRP); | ||
96 | cfg.writeEntry(ACCOUNT_LIST, accountList, ',' ); | ||
97 | cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' ); | ||
98 | |||
87 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | 99 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); |
88 | it != stringEntries.end(); ++it ){ | 100 | it != stringEntries.end(); ++it ){ |
89 | QString val = it.data(); | 101 | QString val = it.data(); |
90 | key = it.key(); | 102 | key = it.key(); |
91 | // qDebug("saving %s -> %s", key.latin1(), val.latin1() ); | 103 | // qDebug("saving %s -> %s", key.latin1(), val.latin1() ); |
92 | keys = QStringList::split( "SEPARATOR", key ); | 104 | keys = QStringList::split( "SEPARATOR", key ); |
93 | qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); | 105 | //qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); |
94 | cfg.setGroup(keys[0]); | 106 | cfg.setGroup(keys[0]); |
95 | cfg.writeEntry(keys[1], val); | 107 | cfg.writeEntry(keys[1], val); |
96 | } | 108 | } |
97 | for( QMap<QString,int>::Iterator it = intEntries.begin(); | 109 | for( QMap<QString,int>::Iterator it = intEntries.begin(); |
98 | it != intEntries.end(); ++it ){ | 110 | it != intEntries.end(); ++it ){ |
99 | int val = it.data(); | 111 | int val = it.data(); |
100 | key = it.key(); | 112 | key = it.key(); |
101 | // qDebug("saving %s -> %i", key.latin1(), val ); | 113 | // qDebug("saving %s -> %i", key.latin1(), val ); |
102 | keys = QStringList::split( "SEPARATOR", key ); | 114 | keys = QStringList::split( "SEPARATOR", key ); |
103 | qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); | 115 | //qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val ); |
104 | cfg.setGroup(keys[0]); | 116 | cfg.setGroup(keys[0]); |
105 | cfg.writeEntry(keys[1], val); | 117 | cfg.writeEntry(keys[1], val); |
106 | } | 118 | } |
107 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); | 119 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); |
108 | it != listEntries.end(); ++it ){ | 120 | it != listEntries.end(); ++it ){ |
109 | QStringList val = it.data(); | 121 | QStringList val = it.data(); |
110 | key = it.key(); | 122 | key = it.key(); |
111 | QChar sep = sepEntries[key]; | 123 | QChar sep = sepEntries[key]; |
112 | // qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); | 124 | // qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() ); |
113 | keys = QStringList::split( "SEPARATOR", key ); | 125 | keys = QStringList::split( "SEPARATOR", key ); |
114 | qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() ); | ||
115 | cfg.setGroup(keys[0]); | 126 | cfg.setGroup(keys[0]); |
116 | cfg.writeEntry(keys[1], val, sep); | 127 | cfg.writeEntry(keys[1], val, sep); |
117 | } | 128 | } |
118 | } | 129 | } |
119 | 130 | ||
120 | 131 | ||
121 | // | 132 | // |
122 | // cancel changes | 133 | // cancel changes |
123 | // | 134 | // |
124 | void PPPData::cancel() { | 135 | void PPPData::cancel() { |
125 | stringEntries.clear(); | 136 | stringEntries.clear(); |
126 | intEntries.clear(); | 137 | intEntries.clear(); |
127 | listEntries.clear(); | 138 | listEntries.clear(); |
128 | } | 139 | } |
129 | 140 | ||
130 | // functions to read/write date to configuration file | 141 | // functions to read/write date to configuration file |
131 | QString PPPData::readConfig(const QString &group, const QString &key, | 142 | QString PPPData::readConfig(const QString &group, const QString &key, |
132 | const QString &defvalue = "") | 143 | const QString &defvalue = "") |
133 | { | 144 | { |
134 | // qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); | 145 | // qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); |
135 | QString idx = SEP.arg(group).arg(key); | 146 | QString idx = SEP.arg(group).arg(key); |
136 | if (stringEntries.find(idx) != stringEntries.end()) | 147 | if (stringEntries.find(idx) != stringEntries.end()) |
137 | return stringEntries[idx]; | 148 | return stringEntries[idx]; |
138 | Config cfg = config(); | 149 | Config cfg = config(); |
139 | cfg.setGroup(group); | 150 | cfg.setGroup(group); |
140 | return cfg.readEntry(key, defvalue); | 151 | return cfg.readEntry(key, defvalue); |
141 | } | 152 | } |
@@ -323,63 +334,75 @@ void PPPData::set_automatic_redial(bool set) { | |||
323 | 334 | ||
324 | 335 | ||
325 | QString PPPData::pppdVersion() { | 336 | QString PPPData::pppdVersion() { |
326 | return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); | 337 | return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); |
327 | } | 338 | } |
328 | 339 | ||
329 | bool PPPData::pppdVersionMin(int ver, int mod, int patch) { | 340 | bool PPPData::pppdVersionMin(int ver, int mod, int patch) { |
330 | // check if pppd version fulfills minimum requirement | 341 | // check if pppd version fulfills minimum requirement |
331 | return (pppdVer > ver | 342 | return (pppdVer > ver |
332 | || (pppdVer == ver && pppdMod > mod) | 343 | || (pppdVer == ver && pppdMod > mod) |
333 | || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); | 344 | || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); |
334 | } | 345 | } |
335 | 346 | ||
336 | int PPPData::pppdTimeout() { | 347 | int PPPData::pppdTimeout() { |
337 | return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); | 348 | return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); |
338 | } | 349 | } |
339 | 350 | ||
340 | 351 | ||
341 | void PPPData::setpppdTimeout(int n) { | 352 | void PPPData::setpppdTimeout(int n) { |
342 | writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); | 353 | writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); |
343 | } | 354 | } |
344 | 355 | ||
345 | 356 | ||
346 | const QString PPPData::modemDevice() { | 357 | const QString PPPData::modemDevice() { |
347 | return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); | 358 | return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" ); |
348 | } | 359 | } |
349 | 360 | ||
350 | 361 | ||
362 | // const QString PPPData::modemName() | ||
363 | // { | ||
364 | // return readConfig(modemGroup(), MODEMNAME_KEY); | ||
365 | // } | ||
366 | |||
367 | // bool PPPData::setModemName(const QString &n) { | ||
368 | // qDebug("Setting modem name to >%s<", n.latin1()); | ||
369 | // _modemName = n; | ||
370 | // writeConfig(cgroup, MODEMNAME_KEY, n); | ||
371 | // return true; //FIXME | ||
372 | // } | ||
373 | |||
374 | // bool PPPData::changeModemName(const QString &n) { | ||
375 | // qDebug("Setting modem name to >%s<", n.latin1()); | ||
376 | // _modemName = n; | ||
377 | // writeConfig(modemGroup(), MODEMNAME_KEY, n); | ||
378 | // return true; //FIXME | ||
379 | // } | ||
380 | |||
351 | bool PPPData::setModemDevice(const QString &n) { | 381 | bool PPPData::setModemDevice(const QString &n) { |
352 | qDebug("Setting modem dev to >%s<", n.latin1()); | 382 | qDebug("Setting modem dev to >%s<", n.latin1()); |
353 | bool ret = false; | 383 | writeConfig(modemGroup(), MODEMDEV_KEY, n); |
354 | for (int i = 0; devices[i]; i++) | 384 | return true; //FIXME |
355 | if (devices[i] == n){ | ||
356 | modemDeviceGroup = i; | ||
357 | writeConfig(modemGroup(), MODEMDEV_KEY, n); | ||
358 | ret = true; | ||
359 | } | ||
360 | qDebug(ret?"SUCCESS":"FAILURE"); | ||
361 | return ret; | ||
362 | } | 385 | } |
363 | 386 | ||
364 | 387 | ||
365 | const QString PPPData::flowcontrol() { | 388 | const QString PPPData::flowcontrol() { |
366 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); | 389 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); |
367 | } | 390 | } |
368 | 391 | ||
369 | 392 | ||
370 | void PPPData::setFlowcontrol(const QString &n) { | 393 | void PPPData::setFlowcontrol(const QString &n) { |
371 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); | 394 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); |
372 | } | 395 | } |
373 | 396 | ||
374 | 397 | ||
375 | const QString PPPData::speed() { | 398 | const QString PPPData::speed() { |
376 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); | 399 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); |
377 | // undo the damage of a bug in former versions. It left an empty Speed= | 400 | // undo the damage of a bug in former versions. It left an empty Speed= |
378 | // entry in kppprc. kppp did set the serial port to 57600 as default but | 401 | // entry in kppprc. kppp did set the serial port to 57600 as default but |
379 | // pppd wouldn't receive the speed via the command line. | 402 | // pppd wouldn't receive the speed via the command line. |
380 | if(s.toUInt() == 0) | 403 | if(s.toUInt() == 0) |
381 | s = "57600"; | 404 | s = "57600"; |
382 | return s; | 405 | return s; |
383 | } | 406 | } |
384 | 407 | ||
385 | 408 | ||
@@ -696,195 +719,220 @@ void PPPData::setModemAnswerResp(const QString &n) { | |||
696 | 719 | ||
697 | 720 | ||
698 | const QString PPPData::enter() { | 721 | const QString PPPData::enter() { |
699 | return readConfig(modemGroup(), ENTER_KEY, "CR"); | 722 | return readConfig(modemGroup(), ENTER_KEY, "CR"); |
700 | } | 723 | } |
701 | 724 | ||
702 | 725 | ||
703 | void PPPData::setEnter(const QString &n) { | 726 | void PPPData::setEnter(const QString &n) { |
704 | writeConfig(modemGroup(), ENTER_KEY, n); | 727 | writeConfig(modemGroup(), ENTER_KEY, n); |
705 | } | 728 | } |
706 | 729 | ||
707 | 730 | ||
708 | // | 731 | // |
709 | // functions to set/return account information | 732 | // functions to set/return account information |
710 | // | 733 | // |
711 | 734 | ||
712 | //returns number of accounts | 735 | //returns number of accounts |
713 | int PPPData::count() const { | 736 | int PPPData::count() const { |
714 | return highcount + 1; | 737 | return highcount + 1; |
715 | } | 738 | } |
716 | 739 | ||
717 | 740 | ||
718 | bool PPPData::setAccount(const QString &aname) { | 741 | bool PPPData::setAccount(const QString &aname) { |
719 | qDebug("setting account to >%s<", aname.latin1()); | 742 | qDebug("setting account to >%s<", aname.latin1()); |
720 | for(int i = 0; i <= highcount; i++) { | 743 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { |
721 | setAccountbyIndex(i); | 744 | cgroup = *it; |
722 | if(accname() == aname) { | 745 | qDebug("PPPData::setAccount %s", cgroup.latin1()); |
723 | caccount = i; | 746 | qDebug( "iterator %s", (*it).latin1() ); |
724 | qDebug("SUCCESS"); | 747 | if(accname() == aname) { |
725 | return true; | 748 | qDebug("SUCCESS"); |
749 | return true; | ||
750 | } | ||
751 | |||
726 | } | 752 | } |
727 | } | 753 | qDebug("FAILURE"); |
728 | qDebug("FAILURE"); | 754 | return false; |
729 | return false; | ||
730 | } | 755 | } |
731 | 756 | ||
732 | 757 | /* | |
733 | bool PPPData::setAccountbyIndex(int i) { | 758 | bool PPPData::setAccountbyIndex(int i) { |
734 | if(i >= 0 && i <= highcount) { | 759 | if(i >= 0 && i <= highcount) { |
760 | QString tmp; | ||
761 | tmp.sprintf("%s%i", ACCOUNT_GRP, i); | ||
762 | if (_deleted.find(tmp)!=_deleted.end()) return false; | ||
735 | caccount = i; | 763 | caccount = i; |
736 | cgroup.sprintf("%s%i", ACCOUNT_GRP, i); | 764 | cgroup = tmp; |
737 | return true; | 765 | return true; |
738 | } | 766 | } |
739 | return false; | 767 | return false; |
740 | } | 768 | } |
741 | 769 | */ | |
742 | 770 | ||
743 | bool PPPData::isUniqueAccname(const QString &n) { | 771 | bool PPPData::isUniqueAccname(const QString &n) { |
744 | int current = caccount; | 772 | QString save_cgroup = cgroup; |
745 | for(int i=0; i <= highcount; i++) { | 773 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { |
746 | setAccountbyIndex(i); | 774 | cgroup = *it; |
747 | if(accname() == n && i != current) { | 775 | qDebug("PPPData::setAccount %s", cgroup.latin1()); |
748 | setAccountbyIndex(current); | 776 | qDebug( "%s \n", (*it).latin1() ); |
749 | return false; | 777 | if(accname() == n && cgroup != save_cgroup) { |
750 | } | 778 | cgroup = save_cgroup; |
779 | qDebug("SUCCESS"); | ||
780 | return false; | ||
781 | } | ||
782 | |||
751 | } | 783 | } |
752 | setAccountbyIndex(current); | 784 | cgroup = save_cgroup; |
753 | return true; | 785 | return true; |
754 | } | 786 | } |
755 | 787 | ||
756 | 788 | ||
757 | bool PPPData::deleteAccount() { | 789 | bool PPPData::isUniqueDevname(const QString &n) { |
758 | //FIXME: PPPData::deleteAccount | 790 | QString save_mName = _modemName; |
759 | // if(caccount < 0) | 791 | qDebug("PPPData::isUniqueDevname checking if %s is unique", n.latin1()); |
760 | return false; | 792 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { |
761 | 793 | _modemName = *it; | |
762 | // QMap <QString, QString> map; | 794 | qDebug("PPPData::isUniqueDevname %s == %s", n.latin1() , devname().latin1()); |
763 | // QMap <QString, QString>::Iterator it; | 795 | if(devname() == n && _modemName != save_mName) { |
764 | 796 | _modemName = save_mName; | |
765 | // // set all entries of the current account to "" | 797 | qDebug("NOT UNIQUE"); |
766 | // map = config->entryMap(cgroup); | 798 | return false; |
767 | // it = map.begin(); | 799 | } |
768 | // while (it != map.end()) { | ||
769 | // config->writeEntry(it.key(), ""); | ||
770 | // it++; | ||
771 | // } | ||
772 | 800 | ||
773 | // // shift the succeeding accounts | 801 | } |
774 | // for(int i = caccount+1; i <= highcount; i++) { | 802 | _modemName = save_mName; |
775 | // setAccountbyIndex(i); | 803 | return true; |
776 | // map = config->entryMap(cgroup); | 804 | } |
777 | // it = map.begin(); | ||
778 | // setAccountbyIndex(i-1); | ||
779 | // config->setGroup(cgroup); | ||
780 | // while (it != map.end()) { | ||
781 | // config->writeEntry(it.key(), *it); | ||
782 | // it++; | ||
783 | // } | ||
784 | // } | ||
785 | 805 | ||
786 | // // make sure the top account is cleared | ||
787 | // setAccountbyIndex(highcount); | ||
788 | // map = config->entryMap(cgroup); | ||
789 | // it = map.begin(); | ||
790 | // config->setGroup(cgroup); | ||
791 | // while (it.key() != QString::null) { | ||
792 | // config->writeEntry(it.key(), ""); | ||
793 | // it++; | ||
794 | // } | ||
795 | 806 | ||
796 | // highcount--; | 807 | bool PPPData::deleteAccount() { |
797 | // if(caccount > highcount) | 808 | // FIXME: check if this account exists in a config... |
798 | // caccount = highcount; | 809 | Config cfg = PPPData::config(); |
810 | cfg.setGroup(cgroup); | ||
811 | cfg.clearGroup(); | ||
812 | accountList.remove(cgroup); | ||
799 | 813 | ||
800 | // setAccountbyIndex(caccount); | 814 | QString key; |
815 | QStringList keys; | ||
816 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | ||
817 | it != stringEntries.end(); ++it ){ | ||
818 | QString val = it.data(); | ||
819 | key = it.key(); | ||
820 | keys = QStringList::split( "SEPARATOR", key ); | ||
821 | if(keys[0]==cgroup){ | ||
822 | stringEntries.remove( it ); | ||
823 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); | ||
824 | } | ||
825 | } | ||
826 | for( QMap<QString,int>::Iterator it = intEntries.begin(); | ||
827 | it != intEntries.end(); ++it ){ | ||
828 | int val = it.data(); | ||
829 | key = it.key(); | ||
830 | keys = QStringList::split( "SEPARATOR", key ); | ||
831 | if(keys[0]==cgroup){ | ||
832 | intEntries.remove( it ); | ||
833 | qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); | ||
834 | } | ||
835 | } | ||
836 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); | ||
837 | it != listEntries.end(); ++it ){ | ||
838 | QStringList val = it.data(); | ||
839 | key = it.key(); | ||
840 | if(keys[0]==cgroup){ | ||
841 | listEntries.remove( it ); | ||
842 | sepEntries.remove( key ); | ||
843 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); | ||
844 | } | ||
845 | } | ||
801 | 846 | ||
802 | // return true; | 847 | return true; |
803 | } | 848 | } |
804 | 849 | ||
805 | 850 | ||
806 | bool PPPData::deleteAccount(const QString &aname) { | 851 | bool PPPData::deleteAccount(const QString &aname) { |
807 | if(!setAccount(aname)) | 852 | if(!setAccount(aname)) |
808 | return false; | 853 | return false; |
809 | 854 | ||
810 | deleteAccount(); | 855 | deleteAccount(); |
811 | 856 | ||
812 | return true; | 857 | return true; |
813 | } | 858 | } |
814 | 859 | ||
815 | 860 | ||
816 | int PPPData::newaccount() { | 861 | int PPPData::newaccount() { |
817 | 862 | ||
818 | qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); | 863 | qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS); |
819 | // if(!config) open(); | 864 | // if(!config) open(); |
820 | if (highcount >= MAX_ACCOUNTS) return -1; | 865 | // if (highcount >= MAX_ACCOUNTS) return -1; |
821 | 866 | ||
822 | highcount++; | ||
823 | setAccountbyIndex(highcount); | ||
824 | 867 | ||
868 | QString tmp; | ||
869 | tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount); | ||
870 | cgroup = QString(tmp); | ||
871 | accountList << tmp; | ||
872 | qDebug("PPPData::newaccount() Group: >%s<",cgroup.latin1()); | ||
825 | setpppdArgumentDefaults(); | 873 | setpppdArgumentDefaults(); |
826 | qDebug("PPPData::newaccount -> %i",caccount); | 874 | return highcount; |
827 | return caccount; | ||
828 | } | 875 | } |
829 | 876 | ||
830 | int PPPData::copyaccount(int i) { | 877 | int PPPData::copyaccount(const QString&) { |
831 | // FIXME: PPPData::copyaccount | 878 | // FIXME: PPPData::copyaccount |
832 | // if(highcount >= MAX_ACCOUNTS) | 879 | // if(highcount >= MAX_ACCOUNTS) |
833 | return -1; | 880 | return -1; |
834 | 881 | ||
835 | // setAccountbyIndex(i); | 882 | // setAccountbyIndex(i); |
836 | 883 | ||
837 | // QMap <QString, QString> map = config->entryMap(cgroup); | 884 | // QMap <QString, QString> map = config->entryMap(cgroup); |
838 | // QMap <QString, QString>::ConstIterator it = map.begin(); | 885 | // QMap <QString, QString>::ConstIterator it = map.begin(); |
839 | 886 | ||
840 | // QString newname = i18n("%1_copy").arg(accname()); | 887 | // QString newname = QObject::tr("%1_copy").arg(accname()); |
841 | 888 | ||
842 | // newaccount(); | 889 | // newaccount(); |
843 | 890 | ||
844 | // while (it != map.end()) { | 891 | // while (it != map.end()) { |
845 | // config->writeEntry(it.key(), *it); | 892 | // config->writeEntry(it.key(), *it); |
846 | // it++; | 893 | // it++; |
847 | // } | 894 | // } |
848 | 895 | ||
849 | // setAccname(newname); | 896 | // setAccname(newname); |
850 | 897 | ||
851 | // return caccount; | 898 | // return caccount; |
852 | } | 899 | } |
853 | 900 | ||
854 | 901 | ||
855 | const QString PPPData::accname() { | 902 | const QString PPPData::accname() { |
856 | return readConfig(cgroup, NAME_KEY); | 903 | return readConfig(cgroup, NAME_KEY); |
857 | } | 904 | } |
858 | 905 | ||
859 | void PPPData::setAccname(const QString &n) { | 906 | void PPPData::setAccname(const QString &n) { |
860 | if(!cgroup.isNull()) { | 907 | if(!cgroup.isNull()) { |
861 | // are we manipulating the default account's name ? then change it, too. | 908 | // are we manipulating the default account's name ? then change it, too. |
862 | bool def = accname() == defaultAccount(); | 909 | bool def = accname() == defaultAccount(); |
863 | writeConfig(cgroup, NAME_KEY, n); | 910 | writeConfig(cgroup, NAME_KEY, n); |
864 | if (def) | 911 | if (def) |
865 | setDefaultAccount(n); | 912 | setDefaultAccount(n); |
866 | } | 913 | } |
914 | writeConfig(cgroup, NAME_KEY, n); | ||
867 | } | 915 | } |
868 | 916 | ||
869 | 917 | ||
870 | #define SEPARATOR_CHAR '&' | 918 | #define SEPARATOR_CHAR '&' |
871 | QStringList &PPPData::phonenumbers() { | 919 | QStringList &PPPData::phonenumbers() { |
872 | 920 | ||
873 | readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); | 921 | readListConfig(cgroup, PHONENUMBER_KEY, phonelist, SEPARATOR_CHAR); |
874 | return phonelist; | 922 | return phonelist; |
875 | 923 | ||
876 | } | 924 | } |
877 | 925 | ||
878 | 926 | ||
879 | const QString PPPData::phonenumber() { | 927 | const QString PPPData::phonenumber() { |
880 | return readConfig(cgroup, PHONENUMBER_KEY); | 928 | return readConfig(cgroup, PHONENUMBER_KEY); |
881 | } | 929 | } |
882 | 930 | ||
883 | 931 | ||
884 | void PPPData::setPhonenumber(const QString &n) { | 932 | void PPPData::setPhonenumber(const QString &n) { |
885 | writeConfig(cgroup, PHONENUMBER_KEY, n); | 933 | writeConfig(cgroup, PHONENUMBER_KEY, n); |
886 | } | 934 | } |
887 | 935 | ||
888 | 936 | ||
889 | const QString PPPData::dialPrefix() { | 937 | const QString PPPData::dialPrefix() { |
890 | return readConfig(cgroup, DIAL_PREFIX_KEY, ""); | 938 | return readConfig(cgroup, DIAL_PREFIX_KEY, ""); |
@@ -1155,48 +1203,49 @@ void PPPData::setScript(QStringList &list) { | |||
1155 | 1203 | ||
1156 | // void PPPData::setTotalBytes(int n) { | 1204 | // void PPPData::setTotalBytes(int n) { |
1157 | // writeConfig(cgroup, TOTALBYTES_KEY, n); | 1205 | // writeConfig(cgroup, TOTALBYTES_KEY, n); |
1158 | // } | 1206 | // } |
1159 | 1207 | ||
1160 | 1208 | ||
1161 | QStringList &PPPData::pppdArgument() { | 1209 | QStringList &PPPData::pppdArgument() { |
1162 | static QStringList arglist; | 1210 | static QStringList arglist; |
1163 | 1211 | ||
1164 | while(arglist.count() > MAX_PPPD_ARGUMENTS) | 1212 | while(arglist.count() > MAX_PPPD_ARGUMENTS) |
1165 | arglist.remove(arglist.last()); | 1213 | arglist.remove(arglist.last()); |
1166 | readListConfig(cgroup, PPPDARG_KEY, arglist); | 1214 | readListConfig(cgroup, PPPDARG_KEY, arglist); |
1167 | 1215 | ||
1168 | return arglist; | 1216 | return arglist; |
1169 | } | 1217 | } |
1170 | 1218 | ||
1171 | 1219 | ||
1172 | void PPPData::setpppdArgument(QStringList &args) { | 1220 | void PPPData::setpppdArgument(QStringList &args) { |
1173 | writeListConfig(cgroup, PPPDARG_KEY, args); | 1221 | writeListConfig(cgroup, PPPDARG_KEY, args); |
1174 | } | 1222 | } |
1175 | 1223 | ||
1176 | 1224 | ||
1177 | void PPPData::setpppdArgumentDefaults() { | 1225 | void PPPData::setpppdArgumentDefaults() { |
1178 | QStringList arg; | 1226 | QStringList arg; |
1227 | arg << "lcp-echo-failure 0"; | ||
1179 | setpppdArgument(arg); | 1228 | setpppdArgument(arg); |
1180 | } | 1229 | } |
1181 | 1230 | ||
1182 | 1231 | ||
1183 | // // graphing widget | 1232 | // // graphing widget |
1184 | // void PPPData::setGraphingOptions(bool enable, | 1233 | // void PPPData::setGraphingOptions(bool enable, |
1185 | // QColor bg, | 1234 | // QColor bg, |
1186 | // QColor text, | 1235 | // QColor text, |
1187 | // QColor in, | 1236 | // QColor in, |
1188 | // QColor out) | 1237 | // QColor out) |
1189 | // { | 1238 | // { |
1190 | // if(config) { | 1239 | // if(config) { |
1191 | // config->setGroup(GRAPH_GRP); | 1240 | // config->setGroup(GRAPH_GRP); |
1192 | // config->writeEntry(GENABLED, enable); | 1241 | // config->writeEntry(GENABLED, enable); |
1193 | // // config->writeEntry(GCOLOR_BG, bg); | 1242 | // // config->writeEntry(GCOLOR_BG, bg); |
1194 | // // config->writeEntry(GCOLOR_TEXT, text); | 1243 | // // config->writeEntry(GCOLOR_TEXT, text); |
1195 | // // config->writeEntry(GCOLOR_IN, in); | 1244 | // // config->writeEntry(GCOLOR_IN, in); |
1196 | // // config->writeEntry(GCOLOR_OUT, out); | 1245 | // // config->writeEntry(GCOLOR_OUT, out); |
1197 | // } | 1246 | // } |
1198 | // } | 1247 | // } |
1199 | 1248 | ||
1200 | // void PPPData::graphingOptions(bool &enable, | 1249 | // void PPPData::graphingOptions(bool &enable, |
1201 | // QColor &bg, | 1250 | // QColor &bg, |
1202 | // QColor &text, | 1251 | // QColor &text, |
@@ -1226,77 +1275,221 @@ void PPPData::setpppdArgumentDefaults() { | |||
1226 | 1275 | ||
1227 | 1276 | ||
1228 | 1277 | ||
1229 | // | 1278 | // |
1230 | //functions to change/set the child pppd process info | 1279 | //functions to change/set the child pppd process info |
1231 | // | 1280 | // |
1232 | bool PPPData::pppdRunning() const { | 1281 | bool PPPData::pppdRunning() const { |
1233 | return pppdisrunning; | 1282 | return pppdisrunning; |
1234 | } | 1283 | } |
1235 | 1284 | ||
1236 | void PPPData::setpppdRunning(bool set) { | 1285 | void PPPData::setpppdRunning(bool set) { |
1237 | pppdisrunning = set; | 1286 | pppdisrunning = set; |
1238 | } | 1287 | } |
1239 | 1288 | ||
1240 | int PPPData::pppdError() const { | 1289 | int PPPData::pppdError() const { |
1241 | return pppderror; | 1290 | return pppderror; |
1242 | } | 1291 | } |
1243 | 1292 | ||
1244 | void PPPData::setpppdError(int err) { | 1293 | void PPPData::setpppdError(int err) { |
1245 | pppderror = err; | 1294 | pppderror = err; |
1246 | } | 1295 | } |
1247 | 1296 | ||
1248 | QString PPPData::modemGroup() | 1297 | QString PPPData::modemGroup() |
1249 | { | 1298 | { |
1250 | if (modemDeviceGroup<0){ | 1299 | if (_modemName.isEmpty()) |
1251 | qDebug("wrong modem %i\n using 0",modemDeviceGroup); | 1300 | _modemName = deviceList[0]; |
1252 | modemDeviceGroup = 0; //FIXME! | 1301 | return _modemName; |
1253 | } | ||
1254 | return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup); | ||
1255 | } | 1302 | } |
1256 | 1303 | ||
1257 | 1304 | ||
1258 | QMap<QString,QString> PPPData::getConfiguredInterfaces() | 1305 | QMap<QString,QString> PPPData::getConfiguredInterfaces() |
1259 | { | 1306 | { |
1260 | QMap<QString,QString> ifaces; | 1307 | QMap<QString,QString> ifaces; |
1261 | Config config = PPPData::config(); | 1308 | Config config = PPPData::config(); |
1262 | config.setGroup(ACCLIST_GRP); | 1309 | config.setGroup(ACCLIST_GRP); |
1263 | int count = config.readNumEntry( ACCOUNTS_COUNT, -1 ); | 1310 | int count = config.readNumEntry( ACCOUNTS_COUNT, -1 ); |
1264 | QString accGrp, dev, acc; | 1311 | QString accGrp, dev, acc; |
1265 | for (int i = 0; i < count; i++){ | 1312 | for (int i = 0; i < count; i++){ |
1266 | accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); | 1313 | accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i); |
1267 | config.setGroup(accGrp); | 1314 | config.setGroup(accGrp); |
1268 | dev = config.readEntry( ACOUNTS_DEV, "error" ); | 1315 | dev = config.readEntry( ACOUNTS_DEV, "error" ); |
1269 | acc = config.readEntry( ACOUNTS_ACC, "error" ); | 1316 | acc = config.readEntry( ACOUNTS_ACC, "error" ); |
1270 | ifaces.insert( dev, acc ); | 1317 | ifaces.insert( dev, acc ); |
1271 | } | 1318 | } |
1272 | 1319 | ||
1273 | return ifaces; | 1320 | return ifaces; |
1274 | } | 1321 | } |
1275 | 1322 | ||
1276 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) | 1323 | void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces ) |
1277 | { | 1324 | { |
1278 | QMap<QString,QString>::Iterator it; | 1325 | QMap<QString,QString>::Iterator it; |
1279 | int i = 0; | 1326 | int i = 0; |
1280 | Config cfg = config(); | 1327 | Config cfg = config(); |
1281 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ | 1328 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ |
1282 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); | 1329 | cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i++)); |
1283 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); | 1330 | cfg.writeEntry( ACOUNTS_DEV, it.key() ); |
1284 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); | 1331 | cfg.writeEntry( ACOUNTS_ACC, it.data() ); |
1285 | qDebug("I %i",i); | 1332 | qDebug("I %i",i); |
1286 | } | 1333 | } |
1287 | cfg.setGroup( ACCLIST_GRP ); | 1334 | cfg.setGroup( ACCLIST_GRP ); |
1288 | qDebug("saved %i account settings", i); | 1335 | qDebug("saved %i account settings", i); |
1289 | cfg.writeEntry( ACCOUNTS_COUNT, i ); | 1336 | cfg.writeEntry( ACCOUNTS_COUNT, i ); |
1290 | 1337 | ||
1291 | } | 1338 | } |
1292 | 1339 | ||
1293 | /** | 1340 | /** |
1294 | * pppd's getword() function knows about escape characters. | 1341 | * pppd's getword() function knows about escape characters. |
1295 | * If we write the username and password to the secrets file | 1342 | * If we write the username and password to the secrets file |
1296 | * we'll therefore have to escape back slashes. | 1343 | * we'll therefore have to escape back slashes. |
1297 | */ | 1344 | */ |
1298 | QString PPPData::encodeWord(const QString &s) { | 1345 | QString PPPData::encodeWord(const QString &s) { |
1299 | QString r = s; | 1346 | QString r = s; |
1300 | r.replace(QRegExp("\\"), "\\\\"); | 1347 | r.replace(QRegExp("\\"), "\\\\"); |
1301 | return r; | 1348 | return r; |
1302 | } | 1349 | } |
1350 | |||
1351 | QStringList PPPData::getDevicesList() | ||
1352 | { | ||
1353 | Config cfg("NetworkSetupPPP"); | ||
1354 | cfg.setGroup("Devices_General"); | ||
1355 | return cfg.readListEntry(DEVICES_LIST,DEVICES_LIST_SEP); | ||
1356 | } | ||
1357 | |||
1358 | QStringList PPPData::getAccountList() | ||
1359 | { | ||
1360 | QStringList list; | ||
1361 | QString save_cgroup; | ||
1362 | save_cgroup = cgroup; | ||
1363 | for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) { | ||
1364 | cgroup = *it; | ||
1365 | list << accname(); | ||
1366 | } | ||
1367 | cgroup = save_cgroup; | ||
1368 | return list; | ||
1369 | }; | ||
1370 | |||
1371 | |||
1372 | const QString PPPData::devname() | ||
1373 | { | ||
1374 | QString tmp = readConfig(modemGroup(), MODEMNAME_KEY ); | ||
1375 | qDebug("PPPData::devname() of %s is %s", modemGroup().latin1(), tmp.latin1()); | ||
1376 | return tmp; | ||
1377 | } | ||
1378 | |||
1379 | void PPPData::setDevname(const QString &n) { | ||
1380 | // if(!cgroup.isNull()) { | ||
1381 | // // are we manipulating the default account's name ? then change it, too. | ||
1382 | // bool def = accname() == defaultAccount(); | ||
1383 | // writeConfig(cgroup, NAME_KEY, n); | ||
1384 | // if (def) | ||
1385 | // setDefaultAccount(n); | ||
1386 | // } | ||
1387 | writeConfig(modemGroup(), MODEMNAME_KEY, n ); | ||
1388 | } | ||
1389 | |||
1390 | |||
1391 | bool PPPData::setDevice(const QString &dev ) | ||
1392 | { | ||
1393 | qDebug("setting device to >%s<", dev.latin1()); | ||
1394 | QString save_mName = _modemName; | ||
1395 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { | ||
1396 | _modemName = *it; | ||
1397 | qDebug("PPPData::setDevice %s is named %s", _modemName.latin1(), devname().latin1() ); | ||
1398 | qDebug( "iterator %s", (*it).latin1() ); | ||
1399 | if(devname() == dev) { | ||
1400 | qDebug("SUCCESS"); | ||
1401 | return true; | ||
1402 | } | ||
1403 | |||
1404 | } | ||
1405 | _modemName = save_mName; | ||
1406 | qDebug("FAILURE"); | ||
1407 | return false; | ||
1408 | } | ||
1409 | |||
1410 | bool PPPData::deleteDevice() | ||
1411 | { | ||
1412 | // FIXME: check if this account exists in a config... | ||
1413 | Config cfg = PPPData::config(); | ||
1414 | cfg.setGroup(modemGroup()); | ||
1415 | cfg.clearGroup(); | ||
1416 | deviceList.remove(modemGroup()); | ||
1417 | |||
1418 | QString key; | ||
1419 | QStringList keys; | ||
1420 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | ||
1421 | it != stringEntries.end(); ++it ){ | ||
1422 | QString val = it.data(); | ||
1423 | key = it.key(); | ||
1424 | keys = QStringList::split( "SEPARATOR", key ); | ||
1425 | if(keys[0]==modemGroup()){ | ||
1426 | stringEntries.remove( it ); | ||
1427 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() ); | ||
1428 | } | ||
1429 | } | ||
1430 | for( QMap<QString,int>::Iterator it = intEntries.begin(); | ||
1431 | it != intEntries.end(); ++it ){ | ||
1432 | int val = it.data(); | ||
1433 | key = it.key(); | ||
1434 | keys = QStringList::split( "SEPARATOR", key ); | ||
1435 | if(keys[0]==modemGroup()){ | ||
1436 | intEntries.remove( it ); | ||
1437 | qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val ); | ||
1438 | } | ||
1439 | } | ||
1440 | for( QMap<QString,QStringList>::Iterator it = listEntries.begin(); | ||
1441 | it != listEntries.end(); ++it ){ | ||
1442 | QStringList val = it.data(); | ||
1443 | key = it.key(); | ||
1444 | if(keys[0]==modemGroup()){ | ||
1445 | listEntries.remove( it ); | ||
1446 | sepEntries.remove( key ); | ||
1447 | qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() ); | ||
1448 | } | ||
1449 | } | ||
1450 | |||
1451 | return true; | ||
1452 | |||
1453 | } | ||
1454 | |||
1455 | bool PPPData::deleteDevice(const QString &dev) | ||
1456 | { | ||
1457 | if(!setDevice(dev)) | ||
1458 | return false; | ||
1459 | |||
1460 | return deleteDevice(); | ||
1461 | } | ||
1462 | |||
1463 | int PPPData::newdevice() | ||
1464 | { | ||
1465 | |||
1466 | qDebug("PPPData::newdevice highcount %i",highcountdev); | ||
1467 | |||
1468 | |||
1469 | QString tmp; | ||
1470 | tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev); | ||
1471 | _modemName = QString(tmp); | ||
1472 | deviceList << tmp; | ||
1473 | qDebug("PPPData::newdevice() Group: >%s<",cgroup.latin1()); | ||
1474 | return highcountdev; | ||
1475 | } | ||
1476 | |||
1477 | int PPPData::copydevice(const QString&) | ||
1478 | { | ||
1479 | return false; | ||
1480 | } | ||
1481 | |||
1482 | |||
1483 | QStringList PPPData::getDevicesNamesList() | ||
1484 | { | ||
1485 | QStringList list; | ||
1486 | QString save_mName = _modemName; | ||
1487 | qDebug("PPPData::getDevicesNamesList has %s", deviceList.join("---").latin1()); | ||
1488 | for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) { | ||
1489 | _modemName = *it; | ||
1490 | qDebug("PPPData::getDevicesNamesList adding %s as %s",_modemName.latin1(), devname().latin1()); | ||
1491 | list << devname(); | ||
1492 | } | ||
1493 | _modemName = save_mName; | ||
1494 | return list; | ||
1495 | }; | ||