author | tille <tille> | 2003-05-25 18:19:04 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-25 18:19:04 (UTC) |
commit | 2ec401058a04c15d2725c94d38226d0ac4505496 (patch) (unidiff) | |
tree | bbe34da6b452cb01f31e5a08acf114c8c9641c32 | |
parent | 7e1dce1560e45ef7fad91a8da2d0d96c1b166df9 (diff) | |
download | opie-2ec401058a04c15d2725c94d38226d0ac4505496.zip opie-2ec401058a04c15d2725c94d38226d0ac4505496.tar.gz opie-2ec401058a04c15d2725c94d38226d0ac4505496.tar.bz2 |
saves configured interfaces now
-rw-r--r-- | noncore/settings/networksettings/ppp/TODO | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/accounts.cpp | 42 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppconfig.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 54 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.h | 23 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 23 |
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 | |||
@@ -55,11 +55,5 @@ AccountWidget::AccountWidget( QWidget *parent, const char *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)), |
@@ -70,4 +64,2 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name ) | |||
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); |
@@ -75,7 +67,2 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name ) | |||
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); |
@@ -174,3 +161,6 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name ) | |||
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 | ||
@@ -186,23 +176,7 @@ void AccountWidget::slotListBoxSelect(int idx) { | |||
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 | } |
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 | |||
@@ -28,4 +28,9 @@ PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent, | |||
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; |
@@ -57,2 +62,5 @@ void 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() ); |
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 | |||
@@ -57,3 +57,3 @@ PPPData* PPPData::data() | |||
57 | PPPData::PPPData() | 57 | PPPData::PPPData() |
58 | : //config(0L), | 58 | : modemDeviceGroup(-1), |
59 | highcount(-1), // start out with no entries | 59 | highcount(-1), // start out with no entries |
@@ -62,4 +62,3 @@ PPPData::PPPData() | |||
62 | pppdisrunning(false), | 62 | pppdisrunning(false), |
63 | pppderror(0), | 63 | pppderror(0) |
64 | modemDeviceGroup(-1) | ||
65 | { | 64 | { |
@@ -331,3 +330,2 @@ const QString PPPData::modemDevice() { | |||
331 | bool PPPData::setModemDevice(const QString &n) { | 330 | bool PPPData::setModemDevice(const QString &n) { |
332 | //FIXME: change modem group | ||
333 | bool ret = false; | 331 | bool ret = false; |
@@ -806,3 +804,3 @@ int PPPData::newaccount() { | |||
806 | int PPPData::copyaccount(int i) { | 804 | int PPPData::copyaccount(int i) { |
807 | 805 | // FIXME | |
808 | // if(highcount >= MAX_ACCOUNTS) | 806 | // if(highcount >= MAX_ACCOUNTS) |
@@ -1223,26 +1221,32 @@ QString PPPData::modemGroup() | |||
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) { | 1226 | QMap<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) { | 1240 | void 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 | |||
@@ -33,5 +33,6 @@ | |||
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 | ||
@@ -60,2 +61,3 @@ class Config; | |||
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" |
@@ -142,9 +144,2 @@ class Config; | |||
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 |
@@ -153,7 +148,6 @@ class Config; | |||
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 | ||
@@ -172,2 +166,4 @@ public: | |||
172 | 166 | ||
167 | QMap<QString,QString> getConfiguredInterfaces(); | ||
168 | void setConfiguredInterfaces( QMap<QString,QString> ); | ||
173 | 169 | ||
@@ -191,2 +187,3 @@ public: | |||
191 | 187 | ||
188 | int currentAccountID() { return caccount; }; | ||
192 | const QString defaultAccount(); | 189 | const QString defaultAccount(); |
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 | |||
@@ -12,6 +12,12 @@ PPPModule::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 | } |
@@ -22,5 +28,10 @@ PPPModule::PPPModule() : Module() | |||
22 | PPPModule::~PPPModule(){ | 28 | PPPModule::~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 | } |