-rw-r--r-- | noncore/settings/networksettings/ppp/conwindow.cpp | 110 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/ppp.pro | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppconfig.cpp | 27 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppconfig.h | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 54 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.h | 16 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 24 |
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 | |||
@@ -73,269 +73,269 @@ ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget ) | |||
73 | 73 | ||
74 | clocktimer = new QTimer(this); | 74 | clocktimer = new QTimer(this); |
75 | connect(clocktimer, SIGNAL(timeout()), SLOT(timeclick())); | 75 | connect(clocktimer, SIGNAL(timeout()), SLOT(timeclick())); |
76 | 76 | ||
77 | // read window position from config file | 77 | // read window position from config file |
78 | // int p_x, p_y; | 78 | // int p_x, p_y; |
79 | // PPPData::data()->winPosConWin(p_x, p_y); | 79 | // PPPData::data()->winPosConWin(p_x, p_y); |
80 | // setGeometry(p_x, p_y, 320, 110); | 80 | // setGeometry(p_x, p_y, 320, 110); |
81 | } | 81 | } |
82 | 82 | ||
83 | ConWindow::~ConWindow() { | 83 | ConWindow::~ConWindow() { |
84 | stopClock(); | 84 | stopClock(); |
85 | } | 85 | } |
86 | 86 | ||
87 | // save window position when window was closed | 87 | // save window position when window was closed |
88 | bool ConWindow::event(QEvent *e) { | 88 | bool ConWindow::event(QEvent *e) { |
89 | if (e->type() == QEvent::Hide) | 89 | if (e->type() == QEvent::Hide) |
90 | { | 90 | { |
91 | // PPPData::data()->setWinPosConWin(x(), y()); | 91 | // PPPData::data()->setWinPosConWin(x(), y()); |
92 | return true; | 92 | return true; |
93 | } | 93 | } |
94 | else | 94 | else |
95 | return QWidget::event(e); | 95 | return QWidget::event(e); |
96 | } | 96 | } |
97 | 97 | ||
98 | QString ConWindow::prettyPrintVolume(unsigned int n) { | 98 | QString ConWindow::prettyPrintVolume(unsigned int n) { |
99 | int idx = 0; | 99 | int idx = 0; |
100 | const QString quant[] = {i18n("Byte"), i18n("KB"), | 100 | const QString quant[] = {i18n("Byte"), i18n("KB"), |
101 | i18n("MB"), i18n("GB"), QString::null}; | 101 | i18n("MB"), i18n("GB"), QString::null}; |
102 | 102 | ||
103 | float n1 = n; | 103 | float n1 = n; |
104 | while(n >= 1024 && quant[idx] != QString::null) { | 104 | while(n >= 1024 && quant[idx] != QString::null) { |
105 | idx++; | 105 | idx++; |
106 | n /= 1024; | 106 | n /= 1024; |
107 | } | 107 | } |
108 | 108 | ||
109 | int i = idx; | 109 | int i = idx; |
110 | while(i--) | 110 | while(i--) |
111 | n1 = n1 / 1024.0; | 111 | n1 = n1 / 1024.0; |
112 | 112 | ||
113 | QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); //KGlobal::locale()->formatNumber( n1, idx==0 ? 0 : 1 ); | 113 | QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); //KGlobal::locale()->formatNumber( n1, idx==0 ? 0 : 1 ); |
114 | s += " " + quant[idx]; | 114 | s += " " + quant[idx]; |
115 | return s; | 115 | return s; |
116 | } | 116 | } |
117 | 117 | ||
118 | void ConWindow::accounting(bool on) { | 118 | void ConWindow::accounting(bool on) { |
119 | // cache accounting settings | 119 | // cache accounting settings |
120 | accountingEnabled = on; | 120 | accountingEnabled = on; |
121 | volumeAccountingEnabled = PPPData::data()->VolAcctEnabled(); | 121 | volumeAccountingEnabled = PPPData::data()->VolAcctEnabled(); |
122 | 122 | ||
123 | // delete old layout | 123 | // delete old layout |
124 | if(tl1 != 0) | 124 | if(tl1 != 0) |
125 | delete tl1; | 125 | delete tl1; |
126 | 126 | ||
127 | // add layout now | 127 | // add layout now |
128 | tl1 = new QVBoxLayout(this, 10, 10); | 128 | tl1 = new QVBoxLayout(this, 10, 10); |
129 | tl1->addSpacing(5); | 129 | tl1->addSpacing(5); |
130 | QHBoxLayout *tl = new QHBoxLayout; | 130 | QHBoxLayout *tl = new QHBoxLayout; |
131 | tl1->addLayout(tl); | 131 | tl1->addLayout(tl); |
132 | tl->addSpacing(20); | 132 | tl->addSpacing(20); |
133 | QGridLayout *l1; | 133 | QGridLayout *l1; |
134 | 134 | ||
135 | int vol_lines = 0; | 135 | int vol_lines = 0; |
136 | if(PPPData::data()->VolAcctEnabled()) | 136 | if(PPPData::data()->VolAcctEnabled()) |
137 | vol_lines = 1; | 137 | vol_lines = 1; |
138 | 138 | ||
139 | if(accountingEnabled) | 139 | if(accountingEnabled) |
140 | l1 = new QGridLayout(4 + vol_lines, 2, 5); | 140 | l1 = new QGridLayout(4 + vol_lines, 2, 5); |
141 | else | 141 | else |
142 | l1 = new QGridLayout(2 + vol_lines, 2, 5); | 142 | l1 = new QGridLayout(2 + vol_lines, 2, 5); |
143 | tl->addLayout(l1); | 143 | tl->addLayout(l1); |
144 | l1->setColStretch(0, 0); | 144 | l1->setColStretch(0, 0); |
145 | l1->setColStretch(1, 1); | 145 | l1->setColStretch(1, 1); |
146 | 146 | ||
147 | info2->setAlignment(AlignRight|AlignVCenter); | 147 | info2->setAlignment(AlignRight|AlignVCenter); |
148 | timelabel2->setAlignment(AlignRight|AlignVCenter); | 148 | timelabel2->setAlignment(AlignRight|AlignVCenter); |
149 | session_bill->setAlignment(AlignRight|AlignVCenter); | 149 | session_bill->setAlignment(AlignRight|AlignVCenter); |
150 | total_bill->setAlignment(AlignRight|AlignVCenter); | 150 | total_bill->setAlignment(AlignRight|AlignVCenter); |
151 | volinfo->setAlignment(AlignRight|AlignVCenter); | 151 | volinfo->setAlignment(AlignRight|AlignVCenter); |
152 | // make sure that there's enough space for the bills | 152 | // make sure that there's enough space for the bills |
153 | QString s1 = session_bill->text(); | 153 | QString s1 = session_bill->text(); |
154 | QString s2 = total_bill->text(); | 154 | QString s2 = total_bill->text(); |
155 | QString s3 = volinfo->text(); | 155 | QString s3 = volinfo->text(); |
156 | 156 | ||
157 | session_bill->setText("888888.88 XXX"); | 157 | session_bill->setText("888888.88 XXX"); |
158 | total_bill->setText("888888.88 XXX"); | 158 | total_bill->setText("888888.88 XXX"); |
159 | volinfo->setText("8888.8 MB"); | 159 | volinfo->setText("8888.8 MB"); |
160 | session_bill->setFixedSize(session_bill->sizeHint()); | 160 | session_bill->setFixedSize(session_bill->sizeHint()); |
161 | total_bill->setFixedSize(total_bill->sizeHint()); | 161 | total_bill->setFixedSize(total_bill->sizeHint()); |
162 | volinfo->setFixedSize(volinfo->sizeHint()); | 162 | volinfo->setFixedSize(volinfo->sizeHint()); |
163 | session_bill->setText(s1); | 163 | session_bill->setText(s1); |
164 | total_bill->setText(s2); | 164 | total_bill->setText(s2); |
165 | volinfo->setText(s3); | 165 | volinfo->setText(s3); |
166 | 166 | ||
167 | l1->addWidget(info1, 0, 0); | 167 | l1->addWidget(info1, 0, 0); |
168 | l1->addWidget(info2, 0, 1); | 168 | l1->addWidget(info2, 0, 1); |
169 | l1->addWidget(timelabel1, 1, 0); | 169 | l1->addWidget(timelabel1, 1, 0); |
170 | l1->addWidget(timelabel2, 1, 1); | 170 | l1->addWidget(timelabel2, 1, 1); |
171 | if(accountingEnabled) { | 171 | if(accountingEnabled) { |
172 | session_bill_l->show(); | 172 | session_bill_l->show(); |
173 | session_bill->show(); | 173 | session_bill->show(); |
174 | total_bill_l->show(); | 174 | total_bill_l->show(); |
175 | total_bill->show(); | 175 | total_bill->show(); |
176 | l1->addWidget(session_bill_l, 2, 0); | 176 | l1->addWidget(session_bill_l, 2, 0); |
177 | l1->addWidget(session_bill, 2, 1); | 177 | l1->addWidget(session_bill, 2, 1); |
178 | l1->addWidget(total_bill_l, 3, 0); | 178 | l1->addWidget(total_bill_l, 3, 0); |
179 | l1->addWidget(total_bill, 3, 1); | 179 | l1->addWidget(total_bill, 3, 1); |
180 | 180 | ||
181 | if(volumeAccountingEnabled) { | 181 | if(volumeAccountingEnabled) { |
182 | vollabel->show(); | 182 | vollabel->show(); |
183 | volinfo->show(); | 183 | volinfo->show(); |
184 | l1->addWidget(vollabel, 4, 0); | 184 | l1->addWidget(vollabel, 4, 0); |
185 | l1->addWidget(volinfo, 4, 1); | 185 | l1->addWidget(volinfo, 4, 1); |
186 | } else { | 186 | } else { |
187 | vollabel->hide(); | 187 | vollabel->hide(); |
188 | volinfo->hide(); | 188 | volinfo->hide(); |
189 | } | 189 | } |
190 | 190 | ||
191 | } else { | 191 | } else { |
192 | session_bill_l->hide(); | 192 | session_bill_l->hide(); |
193 | session_bill->hide(); | 193 | session_bill->hide(); |
194 | total_bill_l->hide(); | 194 | total_bill_l->hide(); |
195 | total_bill->hide(); | 195 | total_bill->hide(); |
196 | 196 | ||
197 | if(volumeAccountingEnabled) { | 197 | if(volumeAccountingEnabled) { |
198 | vollabel->show(); | 198 | vollabel->show(); |
199 | volinfo->show(); | 199 | volinfo->show(); |
200 | l1->addWidget(vollabel, 2, 0); | 200 | l1->addWidget(vollabel, 2, 0); |
201 | l1->addWidget(volinfo, 2, 1); | 201 | l1->addWidget(volinfo, 2, 1); |
202 | } else { | 202 | } else { |
203 | vollabel->hide(); | 203 | vollabel->hide(); |
204 | volinfo->hide(); | 204 | volinfo->hide(); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | tl->addSpacing(10); | 208 | tl->addSpacing(10); |
209 | QVBoxLayout *l2 = new QVBoxLayout(5); | 209 | QVBoxLayout *l2 = new QVBoxLayout(5); |
210 | tl->addLayout(l2); | 210 | tl->addLayout(l2); |
211 | l2->addStretch(1); | 211 | l2->addStretch(1); |
212 | // l2->addWidget(statsbutton); | 212 | // l2->addWidget(statsbutton); |
213 | l2->addWidget(cancelbutton); | 213 | l2->addWidget(cancelbutton); |
214 | 214 | ||
215 | l2->addStretch(1); | 215 | l2->addStretch(1); |
216 | 216 | ||
217 | tl1->addSpacing(5); | 217 | tl1->addSpacing(5); |
218 | 218 | ||
219 | setFixedSize(sizeHint()); | 219 | setFixedSize(sizeHint()); |
220 | /* | 220 | /* |
221 | do not overwrite position read from config | 221 | do not overwrite position read from config |
222 | setGeometry((QApplication::desktop()->width() - width()) / 2, | 222 | setGeometry((QApplication::desktop()->width() - width()) / 2, |
223 | (QApplication::desktop()->height() - height())/2, | 223 | (QApplication::desktop()->height() - height())/2, |
224 | width(), | 224 | width(), |
225 | height()); | 225 | height()); |
226 | */ | 226 | */ |
227 | } | 227 | } |
228 | 228 | ||
229 | 229 | ||
230 | void ConWindow::dock() { | 230 | void ConWindow::dock() { |
231 | // DockWidget::dock_widget->show(); | 231 | // DockWidget::dock_widget->show(); |
232 | this->hide(); | 232 | this->hide(); |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | void ConWindow::startClock() { | 236 | void ConWindow::startClock() { |
237 | minutes = 0; | 237 | minutes = 0; |
238 | seconds = 0; | 238 | seconds = 0; |
239 | hours = 0; | 239 | hours = 0; |
240 | QString title ; | 240 | QString title ; |
241 | 241 | ||
242 | title = PPPData::data()->accname(); | 242 | title = PPPData::data()->accname(); |
243 | 243 | ||
244 | if(PPPData::data()->get_show_clock_on_caption()){ | 244 | if(PPPData::data()->get_show_clock_on_caption()){ |
245 | title += " 00:00" ; | 245 | title += " 00:00" ; |
246 | } | 246 | } |
247 | this->setCaption(title); | 247 | this->setCaption(title); |
248 | 248 | ||
249 | timelabel2->setText("00:00:00"); | 249 | timelabel2->setText("00:00:00"); |
250 | clocktimer->start(1000); | 250 | clocktimer->start(1000); |
251 | } | 251 | } |
252 | 252 | ||
253 | 253 | ||
254 | void ConWindow::setConnectionSpeed(const QString &speed) { | 254 | void ConWindow::setConnectionSpeed(const QString &speed) { |
255 | info2->setText(speed); | 255 | info2->setText(speed); |
256 | } | 256 | } |
257 | 257 | ||
258 | 258 | ||
259 | void ConWindow::stopClock() { | 259 | void ConWindow::stopClock() { |
260 | clocktimer->stop(); | 260 | clocktimer->stop(); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | void ConWindow::timeclick() { | 264 | void 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 | ||
325 | void ConWindow::closeEvent( QCloseEvent *e ){ | 325 | void 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()) |
332 | dock(); | 332 | dock(); |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void ConWindow::slotAccounting(QString total, QString session) { | 336 | void ConWindow::slotAccounting(QString total, QString session) { |
337 | total_bill->setText(total); | 337 | total_bill->setText(total); |
338 | session_bill->setText(session); | 338 | session_bill->setText(session); |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
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 | # |
3 | TEMPLATE = lib | 3 | TEMPLATE = 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 |
6 | DESTDIR = $(OPIEDIR)/plugins/networksettings | 6 | DESTDIR = $(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 |
13 | LIBS += -lqpe -L../interfaces/ -linterfaces | 13 | LIBS += -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 | ||
20 | include ( $(OPIEDIR)/include.pro ) | 20 | include ( $(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,62 +1,69 @@ | |||
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 | ||
13 | PPPConfigWidget::PPPConfigWidget( QWidget *parent, const char *name, | 14 | PPPConfigWidget::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" ); |
39 | tabWindow->addTab( modem2, tr("&Modem") ); | 44 | tabWindow->addTab( modem2, tr("&Modem") ); |
40 | // graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) ); | 45 | // graph = new GraphSetup( tabWindow->addPage( tr("&Graph"), tr("Throughput Graph" ) ) ); |
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 | ||
46 | PPPConfigWidget::~PPPConfigWidget() | 51 | PPPConfigWidget::~PPPConfigWidget() |
47 | { | 52 | { |
48 | 53 | ||
49 | } | 54 | } |
50 | 55 | ||
51 | void PPPConfigWidget::accept() | 56 | void 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 | ||
58 | void PPPConfigWidget::reject() | 65 | void 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 | ||
6 | class QTabWidget; | 6 | class QTabWidget; |
7 | class Interface; | ||
7 | class AccountWidget; | 8 | class AccountWidget; |
8 | class GeneralWidget; | 9 | class GeneralWidget; |
9 | class ModemWidget; | 10 | class ModemWidget; |
10 | class ModemWidget2; | 11 | class ModemWidget2; |
11 | 12 | ||
12 | class PPPConfigWidget : public QDialog { | 13 | class PPPConfigWidget : public QDialog { |
13 | Q_OBJECT | 14 | Q_OBJECT |
14 | public: | 15 | public: |
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 | ||
21 | protected slots: | 22 | protected 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 | |||
@@ -1,523 +1,532 @@ | |||
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 | ||
41 | PPPData *PPPData::_data = 0; | 41 | PPPData *PPPData::_data = 0; |
42 | Config *PPPData::config = 0; | 42 | Config *PPPData::config = 0; |
43 | 43 | ||
44 | PPPData* PPPData::data() | 44 | PPPData* 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 | ||
57 | PPPData::PPPData() | 57 | PPPData::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 | // |
71 | bool PPPData::open() { | 72 | bool 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 | ||
76 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; | 77 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; |
77 | 78 | ||
78 | if (highcount > MAX_ACCOUNTS) | 79 | if (highcount > MAX_ACCOUNTS) |
79 | highcount = MAX_ACCOUNTS; | 80 | highcount = MAX_ACCOUNTS; |
80 | 81 | ||
81 | if(highcount >= 0 && defaultAccount().isEmpty()) { | 82 | if(highcount >= 0 && defaultAccount().isEmpty()) { |
82 | setAccountbyIndex(0); | 83 | setAccountbyIndex(0); |
83 | setDefaultAccount(accname()); | 84 | setDefaultAccount(accname()); |
84 | } else if(!setAccount(defaultAccount())) | 85 | } else if(!setAccount(defaultAccount())) |
85 | setDefaultAccount(accname()); | 86 | setDefaultAccount(accname()); |
86 | 87 | ||
87 | // start out with internal debugging disabled | 88 | // start out with internal debugging disabled |
88 | // the user is still free to specify `debug' on his own | 89 | // the user is still free to specify `debug' on his own |
89 | setPPPDebug(false); | 90 | setPPPDebug(false); |
90 | 91 | ||
91 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); | 92 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); |
92 | 93 | ||
93 | return true; | 94 | return true; |
94 | } | 95 | } |
95 | 96 | ||
96 | 97 | ||
97 | // | 98 | // |
98 | // save configuration | 99 | // save configuration |
99 | // | 100 | // |
100 | void PPPData::save() { | 101 | void PPPData::save() { |
101 | 102 | ||
102 | if (config) { | 103 | if (config) { |
103 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); | 104 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); |
104 | delete config; | 105 | delete config; |
105 | config = 0; | 106 | config = 0; |
106 | qDebug("worte confi NetworkSetupPPP"); | 107 | qDebug("worte confi NetworkSetupPPP"); |
107 | } | 108 | } |
108 | if (_data){ | 109 | if (_data){ |
109 | delete _data; | 110 | delete _data; |
110 | _data = 0; | 111 | _data = 0; |
111 | } | 112 | } |
112 | 113 | ||
113 | } | 114 | } |
114 | 115 | ||
115 | 116 | ||
116 | // | 117 | // |
117 | // cancel changes | 118 | // cancel changes |
118 | // | 119 | // |
119 | void PPPData::cancel() { | 120 | void PPPData::cancel() { |
120 | 121 | ||
121 | // if (config) { | 122 | // if (config) { |
122 | // config->rollback(); | 123 | // config->rollback(); |
123 | // config->reparseConfiguration(); | 124 | // config->reparseConfiguration(); |
124 | // } | 125 | // } |
125 | 126 | ||
126 | } | 127 | } |
127 | 128 | ||
128 | 129 | ||
129 | // // currently differentiates between READWRITE and NONE only | 130 | // // currently differentiates between READWRITE and NONE only |
130 | // int PPPData::access() const { | 131 | // int PPPData::access() const { |
131 | 132 | ||
132 | // return 1;//config->getConfigState(); | 133 | // return 1;//config->getConfigState(); |
133 | // } | 134 | // } |
134 | 135 | ||
135 | 136 | ||
136 | // functions to read/write date to configuration file | 137 | // functions to read/write date to configuration file |
137 | QString PPPData::readConfig(const QString &group, const QString &key, | 138 | QString PPPData::readConfig(const QString &group, const QString &key, |
138 | const QString &defvalue = "") | 139 | const QString &defvalue = "") |
139 | { | 140 | { |
140 | // qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); | 141 | // qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1()); |
141 | if (config) { | 142 | if (config) { |
142 | config->setGroup(group); | 143 | config->setGroup(group); |
143 | return config->readEntry(key, defvalue); | 144 | return config->readEntry(key, defvalue); |
144 | } else | 145 | } else |
145 | return defvalue; | 146 | return defvalue; |
146 | } | 147 | } |
147 | 148 | ||
148 | 149 | ||
149 | int PPPData::readNumConfig(const QString &group, const QString &key, | 150 | int PPPData::readNumConfig(const QString &group, const QString &key, |
150 | int defvalue) { | 151 | int defvalue) { |
151 | if (config) { | 152 | if (config) { |
152 | config->setGroup(group); | 153 | config->setGroup(group); |
153 | return config->readNumEntry(key, defvalue); | 154 | return config->readNumEntry(key, defvalue); |
154 | } else | 155 | } else |
155 | return defvalue; | 156 | return defvalue; |
156 | 157 | ||
157 | } | 158 | } |
158 | 159 | ||
159 | 160 | ||
160 | bool PPPData::readListConfig(const QString &group, const QString &key, | 161 | bool PPPData::readListConfig(const QString &group, const QString &key, |
161 | QStringList &list, char sep) { | 162 | QStringList &list, char sep) { |
162 | list.clear(); | 163 | list.clear(); |
163 | if (config) { | 164 | if (config) { |
164 | config->setGroup(group); | 165 | config->setGroup(group); |
165 | list = config->readListEntry(key, sep); | 166 | list = config->readListEntry(key, sep); |
166 | return true; | 167 | return true; |
167 | } else | 168 | } else |
168 | return false; | 169 | return false; |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | void PPPData::writeConfig(const QString &group, const QString &key, | 173 | void PPPData::writeConfig(const QString &group, const QString &key, |
173 | const QString &value) { | 174 | const QString &value) { |
174 | if (config) { | 175 | if (config) { |
175 | config->setGroup(group); | 176 | config->setGroup(group); |
176 | config->writeEntry(key, value); | 177 | config->writeEntry(key, value); |
177 | } | 178 | } |
178 | } | 179 | } |
179 | 180 | ||
180 | 181 | ||
181 | void PPPData::writeConfig(const QString &group, const QString &key, int value) { | 182 | void PPPData::writeConfig(const QString &group, const QString &key, int value) { |
182 | if (config) { | 183 | if (config) { |
183 | config->setGroup(group); | 184 | config->setGroup(group); |
184 | config->writeEntry(key, value); | 185 | config->writeEntry(key, value); |
185 | } | 186 | } |
186 | } | 187 | } |
187 | 188 | ||
188 | 189 | ||
189 | void PPPData::writeListConfig(const QString &group, const QString &key, | 190 | void PPPData::writeListConfig(const QString &group, const QString &key, |
190 | QStringList &list, char sep) { | 191 | QStringList &list, char sep) { |
191 | if (config) { | 192 | if (config) { |
192 | config->setGroup(group); | 193 | config->setGroup(group); |
193 | config->writeEntry(key, list, sep); | 194 | config->writeEntry(key, list, sep); |
194 | } | 195 | } |
195 | } | 196 | } |
196 | 197 | ||
197 | 198 | ||
198 | // | 199 | // |
199 | // functions to set/return general information | 200 | // functions to set/return general information |
200 | // | 201 | // |
201 | QString PPPData::password() const { | 202 | QString PPPData::password() const { |
202 | return passwd; | 203 | return passwd; |
203 | } | 204 | } |
204 | 205 | ||
205 | 206 | ||
206 | void PPPData::setPassword(const QString &pw) { | 207 | void PPPData::setPassword(const QString &pw) { |
207 | passwd = pw; | 208 | passwd = pw; |
208 | } | 209 | } |
209 | 210 | ||
210 | 211 | ||
211 | const QString PPPData::defaultAccount() { | 212 | const QString PPPData::defaultAccount() { |
212 | return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY); | 213 | return readConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY); |
213 | } | 214 | } |
214 | 215 | ||
215 | 216 | ||
216 | void PPPData::setDefaultAccount(const QString &n) { | 217 | void PPPData::setDefaultAccount(const QString &n) { |
217 | writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n); | 218 | writeConfig(GENERAL_GRP, DEFAULTACCOUNT_KEY, n); |
218 | 219 | ||
219 | //now set the current account index to the default account | 220 | //now set the current account index to the default account |
220 | setAccount(defaultAccount()); | 221 | setAccount(defaultAccount()); |
221 | } | 222 | } |
222 | 223 | ||
223 | 224 | ||
224 | bool PPPData::get_show_clock_on_caption() { | 225 | bool PPPData::get_show_clock_on_caption() { |
225 | return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true); | 226 | return (bool) readNumConfig(GENERAL_GRP, SHOWCLOCK_KEY, true); |
226 | } | 227 | } |
227 | 228 | ||
228 | 229 | ||
229 | void PPPData::set_show_clock_on_caption(bool set) { | 230 | void PPPData::set_show_clock_on_caption(bool set) { |
230 | writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); | 231 | writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); |
231 | } | 232 | } |
232 | 233 | ||
233 | 234 | ||
234 | bool PPPData::get_xserver_exit_disconnect() { | 235 | bool PPPData::get_xserver_exit_disconnect() { |
235 | return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); | 236 | return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); |
236 | } | 237 | } |
237 | 238 | ||
238 | 239 | ||
239 | void PPPData::setPPPDebug(bool set) { | 240 | void PPPData::setPPPDebug(bool set) { |
240 | writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); | 241 | writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); |
241 | } | 242 | } |
242 | 243 | ||
243 | 244 | ||
244 | bool PPPData::getPPPDebug() { | 245 | bool PPPData::getPPPDebug() { |
245 | return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); | 246 | return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); |
246 | } | 247 | } |
247 | 248 | ||
248 | 249 | ||
249 | void PPPData::set_xserver_exit_disconnect(bool set) { | 250 | void PPPData::set_xserver_exit_disconnect(bool set) { |
250 | writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); | 251 | writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); |
251 | } | 252 | } |
252 | 253 | ||
253 | 254 | ||
254 | bool PPPData::quit_on_disconnect() { | 255 | bool PPPData::quit_on_disconnect() { |
255 | return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); | 256 | return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); |
256 | } | 257 | } |
257 | 258 | ||
258 | 259 | ||
259 | void PPPData::set_quit_on_disconnect(bool set) { | 260 | void PPPData::set_quit_on_disconnect(bool set) { |
260 | writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); | 261 | writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); |
261 | } | 262 | } |
262 | 263 | ||
263 | 264 | ||
264 | bool PPPData::get_show_log_window() { | 265 | bool PPPData::get_show_log_window() { |
265 | return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); | 266 | return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); |
266 | } | 267 | } |
267 | 268 | ||
268 | 269 | ||
269 | void PPPData::set_show_log_window(bool set) { | 270 | void PPPData::set_show_log_window(bool set) { |
270 | writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); | 271 | writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); |
271 | } | 272 | } |
272 | 273 | ||
273 | 274 | ||
274 | bool PPPData::automatic_redial() { | 275 | bool PPPData::automatic_redial() { |
275 | return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); | 276 | return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); |
276 | } | 277 | } |
277 | 278 | ||
278 | 279 | ||
279 | void PPPData::set_automatic_redial(bool set) { | 280 | void PPPData::set_automatic_redial(bool set) { |
280 | writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); | 281 | writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); |
281 | } | 282 | } |
282 | 283 | ||
283 | 284 | ||
284 | bool PPPData::get_iconify_on_connect() { | 285 | bool PPPData::get_iconify_on_connect() { |
285 | return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); | 286 | return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); |
286 | } | 287 | } |
287 | 288 | ||
288 | 289 | ||
289 | void PPPData::set_iconify_on_connect(bool set) { | 290 | void PPPData::set_iconify_on_connect(bool set) { |
290 | writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); | 291 | writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); |
291 | } | 292 | } |
292 | 293 | ||
293 | 294 | ||
294 | bool PPPData::get_dock_into_panel() { | 295 | bool PPPData::get_dock_into_panel() { |
295 | return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); | 296 | return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); |
296 | } | 297 | } |
297 | 298 | ||
298 | 299 | ||
299 | void PPPData::set_dock_into_panel(bool set) { | 300 | void PPPData::set_dock_into_panel(bool set) { |
300 | writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); | 301 | writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); |
301 | } | 302 | } |
302 | 303 | ||
303 | 304 | ||
304 | QString PPPData::pppdVersion() { | 305 | QString PPPData::pppdVersion() { |
305 | return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); | 306 | return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); |
306 | } | 307 | } |
307 | 308 | ||
308 | bool PPPData::pppdVersionMin(int ver, int mod, int patch) { | 309 | bool PPPData::pppdVersionMin(int ver, int mod, int patch) { |
309 | // check if pppd version fulfills minimum requirement | 310 | // check if pppd version fulfills minimum requirement |
310 | return (pppdVer > ver | 311 | return (pppdVer > ver |
311 | || (pppdVer == ver && pppdMod > mod) | 312 | || (pppdVer == ver && pppdMod > mod) |
312 | || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); | 313 | || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); |
313 | } | 314 | } |
314 | 315 | ||
315 | int PPPData::pppdTimeout() { | 316 | int PPPData::pppdTimeout() { |
316 | return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); | 317 | return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); |
317 | } | 318 | } |
318 | 319 | ||
319 | 320 | ||
320 | void PPPData::setpppdTimeout(int n) { | 321 | void PPPData::setpppdTimeout(int n) { |
321 | writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); | 322 | writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); |
322 | } | 323 | } |
323 | 324 | ||
324 | 325 | ||
325 | const QString PPPData::modemDevice() { | 326 | const 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 | ||
330 | void PPPData::setModemDevice(const QString &n) { | 331 | bool 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 | ||
335 | const QString PPPData::flowcontrol() { | 344 | const QString PPPData::flowcontrol() { |
336 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); | 345 | return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); |
337 | } | 346 | } |
338 | 347 | ||
339 | 348 | ||
340 | void PPPData::setFlowcontrol(const QString &n) { | 349 | void PPPData::setFlowcontrol(const QString &n) { |
341 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); | 350 | writeConfig(modemGroup(), FLOWCONTROL_KEY, n); |
342 | } | 351 | } |
343 | 352 | ||
344 | 353 | ||
345 | const QString PPPData::speed() { | 354 | const QString PPPData::speed() { |
346 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); | 355 | QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); |
347 | // undo the damage of a bug in former versions. It left an empty Speed= | 356 | // undo the damage of a bug in former versions. It left an empty Speed= |
348 | // entry in kppprc. kppp did set the serial port to 57600 as default but | 357 | // entry in kppprc. kppp did set the serial port to 57600 as default but |
349 | // pppd wouldn't receive the speed via the command line. | 358 | // pppd wouldn't receive the speed via the command line. |
350 | if(s.toUInt() == 0) | 359 | if(s.toUInt() == 0) |
351 | s = "57600"; | 360 | s = "57600"; |
352 | return s; | 361 | return s; |
353 | } | 362 | } |
354 | 363 | ||
355 | 364 | ||
356 | void PPPData::setSpeed(const QString &n) { | 365 | void PPPData::setSpeed(const QString &n) { |
357 | writeConfig(modemGroup(), SPEED_KEY, n); | 366 | writeConfig(modemGroup(), SPEED_KEY, n); |
358 | } | 367 | } |
359 | 368 | ||
360 | 369 | ||
361 | #if 0 | 370 | #if 0 |
362 | void PPPData::setUseCDLine(const int n) { | 371 | void PPPData::setUseCDLine(const int n) { |
363 | writeConfig(modemGroup(),USECDLINE_KEY,n); | 372 | writeConfig(modemGroup(),USECDLINE_KEY,n); |
364 | } | 373 | } |
365 | 374 | ||
366 | 375 | ||
367 | int PPPData::UseCDLine() { | 376 | int PPPData::UseCDLine() { |
368 | return readNumConfig(modemGroup(),USECDLINE_KEY,0); | 377 | return readNumConfig(modemGroup(),USECDLINE_KEY,0); |
369 | } | 378 | } |
370 | #endif | 379 | #endif |
371 | 380 | ||
372 | const QString PPPData::modemEscapeStr() { | 381 | const QString PPPData::modemEscapeStr() { |
373 | return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); | 382 | return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); |
374 | } | 383 | } |
375 | 384 | ||
376 | 385 | ||
377 | void PPPData::setModemEscapeStr(const QString &n) { | 386 | void PPPData::setModemEscapeStr(const QString &n) { |
378 | writeConfig(modemGroup(),ESCAPESTR_KEY,n); | 387 | writeConfig(modemGroup(),ESCAPESTR_KEY,n); |
379 | } | 388 | } |
380 | 389 | ||
381 | 390 | ||
382 | const QString PPPData::modemEscapeResp() { | 391 | const QString PPPData::modemEscapeResp() { |
383 | return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); | 392 | return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); |
384 | } | 393 | } |
385 | 394 | ||
386 | 395 | ||
387 | void PPPData::setModemEscapeResp(const QString &n) { | 396 | void PPPData::setModemEscapeResp(const QString &n) { |
388 | writeConfig(modemGroup(),ESCAPERESP_KEY,n); | 397 | writeConfig(modemGroup(),ESCAPERESP_KEY,n); |
389 | } | 398 | } |
390 | 399 | ||
391 | 400 | ||
392 | int PPPData::modemEscapeGuardTime() { | 401 | int PPPData::modemEscapeGuardTime() { |
393 | return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); | 402 | return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); |
394 | } | 403 | } |
395 | 404 | ||
396 | 405 | ||
397 | void PPPData::setModemEscapeGuardTime(int n) { | 406 | void PPPData::setModemEscapeGuardTime(int n) { |
398 | writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); | 407 | writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); |
399 | } | 408 | } |
400 | 409 | ||
401 | 410 | ||
402 | bool PPPData::modemLockFile() { | 411 | bool PPPData::modemLockFile() { |
403 | return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); | 412 | return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); |
404 | } | 413 | } |
405 | 414 | ||
406 | 415 | ||
407 | void PPPData::setModemLockFile(bool set) { | 416 | void PPPData::setModemLockFile(bool set) { |
408 | writeConfig(modemGroup(), LOCKFILE_KEY, set); | 417 | writeConfig(modemGroup(), LOCKFILE_KEY, set); |
409 | } | 418 | } |
410 | 419 | ||
411 | 420 | ||
412 | int PPPData::modemTimeout() { | 421 | int PPPData::modemTimeout() { |
413 | return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); | 422 | return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); |
414 | } | 423 | } |
415 | 424 | ||
416 | 425 | ||
417 | void PPPData::setModemTimeout(int n) { | 426 | void PPPData::setModemTimeout(int n) { |
418 | writeConfig(modemGroup(), TIMEOUT_KEY, n); | 427 | writeConfig(modemGroup(), TIMEOUT_KEY, n); |
419 | } | 428 | } |
420 | 429 | ||
421 | 430 | ||
422 | int PPPData::modemToneDuration() { | 431 | int PPPData::modemToneDuration() { |
423 | return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); | 432 | return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); |
424 | } | 433 | } |
425 | 434 | ||
426 | 435 | ||
427 | void PPPData::setModemToneDuration(int n) { | 436 | void PPPData::setModemToneDuration(int n) { |
428 | writeConfig(modemGroup(), TONEDURATION_KEY, n); | 437 | writeConfig(modemGroup(), TONEDURATION_KEY, n); |
429 | } | 438 | } |
430 | 439 | ||
431 | 440 | ||
432 | int PPPData::busyWait() { | 441 | int PPPData::busyWait() { |
433 | return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); | 442 | return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); |
434 | } | 443 | } |
435 | 444 | ||
436 | 445 | ||
437 | void PPPData::setbusyWait(int n) { | 446 | void PPPData::setbusyWait(int n) { |
438 | writeConfig(modemGroup(), BUSYWAIT_KEY, n); | 447 | writeConfig(modemGroup(), BUSYWAIT_KEY, n); |
439 | } | 448 | } |
440 | 449 | ||
441 | 450 | ||
442 | // | 451 | // |
443 | //Advanced "Modem" dialog | 452 | //Advanced "Modem" dialog |
444 | // | 453 | // |
445 | // defaults: InitString=ATZ, InitString1="" etc. | 454 | // defaults: InitString=ATZ, InitString1="" etc. |
446 | const QString PPPData::modemInitStr(int i) { | 455 | const QString PPPData::modemInitStr(int i) { |
447 | assert(i >= 0 && i < NumInitStrings); | 456 | assert(i >= 0 && i < NumInitStrings); |
448 | if(i == 0) | 457 | if(i == 0) |
449 | return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); | 458 | return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); |
450 | else | 459 | else |
451 | return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); | 460 | return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); |
452 | } | 461 | } |
453 | 462 | ||
454 | 463 | ||
455 | void PPPData::setModemInitStr(int i, const QString &n) { | 464 | void PPPData::setModemInitStr(int i, const QString &n) { |
456 | assert(i >= 0 && i < NumInitStrings); | 465 | assert(i >= 0 && i < NumInitStrings); |
457 | QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); | 466 | QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); |
458 | writeConfig(modemGroup(), k, n); | 467 | writeConfig(modemGroup(), k, n); |
459 | } | 468 | } |
460 | 469 | ||
461 | 470 | ||
462 | const QString PPPData::modemInitResp() { | 471 | const QString PPPData::modemInitResp() { |
463 | return readConfig(modemGroup(), INITRESP_KEY, "OK"); | 472 | return readConfig(modemGroup(), INITRESP_KEY, "OK"); |
464 | } | 473 | } |
465 | 474 | ||
466 | 475 | ||
467 | void PPPData::setModemInitResp(const QString &n) { | 476 | void PPPData::setModemInitResp(const QString &n) { |
468 | writeConfig(modemGroup(), INITRESP_KEY, n); | 477 | writeConfig(modemGroup(), INITRESP_KEY, n); |
469 | } | 478 | } |
470 | 479 | ||
471 | 480 | ||
472 | int PPPData::modemPreInitDelay() { | 481 | int PPPData::modemPreInitDelay() { |
473 | return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); | 482 | return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); |
474 | } | 483 | } |
475 | 484 | ||
476 | 485 | ||
477 | void PPPData::setModemPreInitDelay(int n) { | 486 | void PPPData::setModemPreInitDelay(int n) { |
478 | writeConfig(modemGroup(), PREINITDELAY_KEY, n); | 487 | writeConfig(modemGroup(), PREINITDELAY_KEY, n); |
479 | } | 488 | } |
480 | 489 | ||
481 | 490 | ||
482 | int PPPData::modemInitDelay() { | 491 | int PPPData::modemInitDelay() { |
483 | return readNumConfig(modemGroup(), INITDELAY_KEY, 50); | 492 | return readNumConfig(modemGroup(), INITDELAY_KEY, 50); |
484 | } | 493 | } |
485 | 494 | ||
486 | 495 | ||
487 | void PPPData::setModemInitDelay(int n) { | 496 | void PPPData::setModemInitDelay(int n) { |
488 | writeConfig(modemGroup(), INITDELAY_KEY, n); | 497 | writeConfig(modemGroup(), INITDELAY_KEY, n); |
489 | } | 498 | } |
490 | 499 | ||
491 | QString PPPData::modemNoDialToneDetectionStr() { | 500 | QString PPPData::modemNoDialToneDetectionStr() { |
492 | return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); | 501 | return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); |
493 | } | 502 | } |
494 | 503 | ||
495 | void PPPData::setModemNoDialToneDetectionStr(const QString &n) { | 504 | void PPPData::setModemNoDialToneDetectionStr(const QString &n) { |
496 | writeConfig(modemGroup(), NODTDETECT_KEY, n); | 505 | writeConfig(modemGroup(), NODTDETECT_KEY, n); |
497 | } | 506 | } |
498 | 507 | ||
499 | const QString PPPData::modemDialStr() { | 508 | const QString PPPData::modemDialStr() { |
500 | return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); | 509 | return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); |
501 | } | 510 | } |
502 | 511 | ||
503 | 512 | ||
504 | void PPPData::setModemDialStr(const QString &n) { | 513 | void PPPData::setModemDialStr(const QString &n) { |
505 | writeConfig(modemGroup(), DIALSTR_KEY, n); | 514 | writeConfig(modemGroup(), DIALSTR_KEY, n); |
506 | } | 515 | } |
507 | 516 | ||
508 | 517 | ||
509 | const QString PPPData::modemConnectResp() { | 518 | const QString PPPData::modemConnectResp() { |
510 | return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); | 519 | return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); |
511 | } | 520 | } |
512 | 521 | ||
513 | 522 | ||
514 | void PPPData::setModemConnectResp(const QString &n) { | 523 | void PPPData::setModemConnectResp(const QString &n) { |
515 | writeConfig(modemGroup(), CONNECTRESP_KEY, n); | 524 | writeConfig(modemGroup(), CONNECTRESP_KEY, n); |
516 | } | 525 | } |
517 | 526 | ||
518 | 527 | ||
519 | const QString PPPData::modemBusyResp() { | 528 | const QString PPPData::modemBusyResp() { |
520 | return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY"); | 529 | return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY"); |
521 | } | 530 | } |
522 | 531 | ||
523 | 532 | ||
@@ -904,335 +913,336 @@ const QString PPPData::command_before_connect() { | |||
904 | 913 | ||
905 | 914 | ||
906 | void PPPData::setCommand_before_connect(const QString &n) { | 915 | void PPPData::setCommand_before_connect(const QString &n) { |
907 | writeConfig(cgroup, BEFORE_CONNECT_KEY, n); | 916 | writeConfig(cgroup, BEFORE_CONNECT_KEY, n); |
908 | } | 917 | } |
909 | 918 | ||
910 | 919 | ||
911 | void PPPData::setStorePassword(bool b) { | 920 | void PPPData::setStorePassword(bool b) { |
912 | writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); | 921 | writeConfig(cgroup, STORE_PASSWORD_KEY, (int)b); |
913 | } | 922 | } |
914 | 923 | ||
915 | 924 | ||
916 | const QString PPPData::command_on_connect() { | 925 | const QString PPPData::command_on_connect() { |
917 | return readConfig(cgroup, COMMAND_KEY); | 926 | return readConfig(cgroup, COMMAND_KEY); |
918 | } | 927 | } |
919 | 928 | ||
920 | 929 | ||
921 | void PPPData::setCommand_on_connect(const QString &n) { | 930 | void PPPData::setCommand_on_connect(const QString &n) { |
922 | writeConfig(cgroup, COMMAND_KEY, n); | 931 | writeConfig(cgroup, COMMAND_KEY, n); |
923 | } | 932 | } |
924 | 933 | ||
925 | 934 | ||
926 | const QString PPPData::command_on_disconnect() { | 935 | const QString PPPData::command_on_disconnect() { |
927 | return readConfig(cgroup, DISCONNECT_COMMAND_KEY); | 936 | return readConfig(cgroup, DISCONNECT_COMMAND_KEY); |
928 | } | 937 | } |
929 | 938 | ||
930 | 939 | ||
931 | void PPPData::setCommand_on_disconnect(const QString &n) { | 940 | void PPPData::setCommand_on_disconnect(const QString &n) { |
932 | writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); | 941 | writeConfig(cgroup, DISCONNECT_COMMAND_KEY, n); |
933 | } | 942 | } |
934 | 943 | ||
935 | 944 | ||
936 | const QString PPPData::command_before_disconnect() { | 945 | const QString PPPData::command_before_disconnect() { |
937 | return readConfig(cgroup, BEFORE_DISCONNECT_KEY); | 946 | return readConfig(cgroup, BEFORE_DISCONNECT_KEY); |
938 | } | 947 | } |
939 | 948 | ||
940 | 949 | ||
941 | void PPPData::setCommand_before_disconnect(const QString &n) { | 950 | void PPPData::setCommand_before_disconnect(const QString &n) { |
942 | writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); | 951 | writeConfig(cgroup, BEFORE_DISCONNECT_KEY, n); |
943 | } | 952 | } |
944 | 953 | ||
945 | 954 | ||
946 | const QString PPPData::ipaddr() { | 955 | const QString PPPData::ipaddr() { |
947 | return readConfig(cgroup, IPADDR_KEY); | 956 | return readConfig(cgroup, IPADDR_KEY); |
948 | } | 957 | } |
949 | 958 | ||
950 | 959 | ||
951 | void PPPData::setIpaddr(const QString &n) { | 960 | void PPPData::setIpaddr(const QString &n) { |
952 | writeConfig(cgroup, IPADDR_KEY, n); | 961 | writeConfig(cgroup, IPADDR_KEY, n); |
953 | } | 962 | } |
954 | 963 | ||
955 | 964 | ||
956 | const QString PPPData::subnetmask() { | 965 | const QString PPPData::subnetmask() { |
957 | return readConfig(cgroup, SUBNETMASK_KEY); | 966 | return readConfig(cgroup, SUBNETMASK_KEY); |
958 | } | 967 | } |
959 | 968 | ||
960 | 969 | ||
961 | void PPPData::setSubnetmask(const QString &n) { | 970 | void PPPData::setSubnetmask(const QString &n) { |
962 | writeConfig(cgroup, SUBNETMASK_KEY, n); | 971 | writeConfig(cgroup, SUBNETMASK_KEY, n); |
963 | } | 972 | } |
964 | 973 | ||
965 | 974 | ||
966 | bool PPPData::autoname() { | 975 | bool PPPData::autoname() { |
967 | return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); | 976 | return (bool) readNumConfig(cgroup, AUTONAME_KEY, false); |
968 | } | 977 | } |
969 | 978 | ||
970 | 979 | ||
971 | void PPPData::setAutoname(bool set) { | 980 | void PPPData::setAutoname(bool set) { |
972 | writeConfig(cgroup, AUTONAME_KEY, (int) set); | 981 | writeConfig(cgroup, AUTONAME_KEY, (int) set); |
973 | } | 982 | } |
974 | 983 | ||
975 | 984 | ||
976 | bool PPPData::AcctEnabled() { | 985 | bool PPPData::AcctEnabled() { |
977 | return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); | 986 | return (bool) readNumConfig(cgroup, ACCTENABLED_KEY, false); |
978 | } | 987 | } |
979 | 988 | ||
980 | 989 | ||
981 | void PPPData::setAcctEnabled(bool set) { | 990 | void PPPData::setAcctEnabled(bool set) { |
982 | writeConfig(cgroup, ACCTENABLED_KEY, (int) set); | 991 | writeConfig(cgroup, ACCTENABLED_KEY, (int) set); |
983 | } | 992 | } |
984 | 993 | ||
985 | 994 | ||
986 | int PPPData::VolAcctEnabled() { | 995 | int PPPData::VolAcctEnabled() { |
987 | return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0); | 996 | return readNumConfig(cgroup, VOLACCTENABLED_KEY, 0); |
988 | } | 997 | } |
989 | 998 | ||
990 | 999 | ||
991 | void PPPData::setVolAcctEnabled(int set) { | 1000 | void PPPData::setVolAcctEnabled(int set) { |
992 | writeConfig(cgroup, VOLACCTENABLED_KEY, set); | 1001 | writeConfig(cgroup, VOLACCTENABLED_KEY, set); |
993 | } | 1002 | } |
994 | 1003 | ||
995 | 1004 | ||
996 | const QString PPPData::gateway() { | 1005 | const QString PPPData::gateway() { |
997 | return readConfig(cgroup, GATEWAY_KEY); | 1006 | return readConfig(cgroup, GATEWAY_KEY); |
998 | } | 1007 | } |
999 | 1008 | ||
1000 | 1009 | ||
1001 | void PPPData::setGateway(const QString &n ) { | 1010 | void PPPData::setGateway(const QString &n ) { |
1002 | writeConfig(cgroup, GATEWAY_KEY, n); | 1011 | writeConfig(cgroup, GATEWAY_KEY, n); |
1003 | } | 1012 | } |
1004 | 1013 | ||
1005 | 1014 | ||
1006 | bool PPPData::defaultroute() { | 1015 | bool PPPData::defaultroute() { |
1007 | // default route is by default 'on'. | 1016 | // default route is by default 'on'. |
1008 | return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true); | 1017 | return (bool) readNumConfig(cgroup, DEFAULTROUTE_KEY, true); |
1009 | } | 1018 | } |
1010 | 1019 | ||
1011 | 1020 | ||
1012 | void PPPData::setDefaultroute(bool set) { | 1021 | void PPPData::setDefaultroute(bool set) { |
1013 | writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set); | 1022 | writeConfig(cgroup, DEFAULTROUTE_KEY, (int) set); |
1014 | } | 1023 | } |
1015 | 1024 | ||
1016 | 1025 | ||
1017 | bool PPPData::autoDNS() { | 1026 | bool PPPData::autoDNS() { |
1018 | bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); | 1027 | bool set = (bool) readNumConfig(cgroup, AUTODNS_KEY, true); |
1019 | return (set && PPPData::data()->pppdVersionMin(2, 3, 7)); | 1028 | return (set && PPPData::data()->pppdVersionMin(2, 3, 7)); |
1020 | } | 1029 | } |
1021 | 1030 | ||
1022 | 1031 | ||
1023 | void PPPData::setAutoDNS(bool set) { | 1032 | void PPPData::setAutoDNS(bool set) { |
1024 | writeConfig(cgroup, AUTODNS_KEY, (int) set); | 1033 | writeConfig(cgroup, AUTODNS_KEY, (int) set); |
1025 | } | 1034 | } |
1026 | 1035 | ||
1027 | 1036 | ||
1028 | void PPPData::setExDNSDisabled(bool set) { | 1037 | void PPPData::setExDNSDisabled(bool set) { |
1029 | writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set); | 1038 | writeConfig(cgroup, EXDNSDISABLED_KEY, (int) set); |
1030 | } | 1039 | } |
1031 | 1040 | ||
1032 | 1041 | ||
1033 | bool PPPData::exDNSDisabled() { | 1042 | bool PPPData::exDNSDisabled() { |
1034 | return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0); | 1043 | return (bool) readNumConfig(cgroup, EXDNSDISABLED_KEY,0); |
1035 | } | 1044 | } |
1036 | 1045 | ||
1037 | 1046 | ||
1038 | QStringList &PPPData::dns() { | 1047 | QStringList &PPPData::dns() { |
1039 | static QStringList dnslist; | 1048 | static QStringList dnslist; |
1040 | 1049 | ||
1041 | readListConfig(cgroup, DNS_KEY, dnslist); | 1050 | readListConfig(cgroup, DNS_KEY, dnslist); |
1042 | while(dnslist.count() > MAX_DNS_ENTRIES) | 1051 | while(dnslist.count() > MAX_DNS_ENTRIES) |
1043 | dnslist.remove(dnslist.last()); | 1052 | dnslist.remove(dnslist.last()); |
1044 | 1053 | ||
1045 | return dnslist; | 1054 | return dnslist; |
1046 | } | 1055 | } |
1047 | 1056 | ||
1048 | 1057 | ||
1049 | void PPPData::setDns(QStringList &list) { | 1058 | void PPPData::setDns(QStringList &list) { |
1050 | writeListConfig(cgroup, DNS_KEY, list); | 1059 | writeListConfig(cgroup, DNS_KEY, list); |
1051 | } | 1060 | } |
1052 | 1061 | ||
1053 | 1062 | ||
1054 | const QString PPPData::domain() { | 1063 | const QString PPPData::domain() { |
1055 | return readConfig(cgroup, DOMAIN_KEY); | 1064 | return readConfig(cgroup, DOMAIN_KEY); |
1056 | } | 1065 | } |
1057 | 1066 | ||
1058 | 1067 | ||
1059 | void PPPData::setDomain(const QString &n ) { | 1068 | void PPPData::setDomain(const QString &n ) { |
1060 | writeConfig(cgroup, DOMAIN_KEY, n); | 1069 | writeConfig(cgroup, DOMAIN_KEY, n); |
1061 | } | 1070 | } |
1062 | 1071 | ||
1063 | 1072 | ||
1064 | QStringList &PPPData::scriptType() { | 1073 | QStringList &PPPData::scriptType() { |
1065 | static QStringList typelist; | 1074 | static QStringList typelist; |
1066 | 1075 | ||
1067 | readListConfig(cgroup, SCRIPTCOM_KEY, typelist); | 1076 | readListConfig(cgroup, SCRIPTCOM_KEY, typelist); |
1068 | while(typelist.count() > MAX_SCRIPT_ENTRIES) | 1077 | while(typelist.count() > MAX_SCRIPT_ENTRIES) |
1069 | typelist.remove(typelist.last()); | 1078 | typelist.remove(typelist.last()); |
1070 | 1079 | ||
1071 | return typelist; | 1080 | return typelist; |
1072 | } | 1081 | } |
1073 | 1082 | ||
1074 | 1083 | ||
1075 | void PPPData::setScriptType(QStringList &list) { | 1084 | void PPPData::setScriptType(QStringList &list) { |
1076 | writeListConfig(cgroup, SCRIPTCOM_KEY, list); | 1085 | writeListConfig(cgroup, SCRIPTCOM_KEY, list); |
1077 | } | 1086 | } |
1078 | 1087 | ||
1079 | 1088 | ||
1080 | QStringList &PPPData::script() { | 1089 | QStringList &PPPData::script() { |
1081 | static QStringList scriptlist; | 1090 | static QStringList scriptlist; |
1082 | 1091 | ||
1083 | readListConfig(cgroup, SCRIPTARG_KEY, scriptlist); | 1092 | readListConfig(cgroup, SCRIPTARG_KEY, scriptlist); |
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 | ||
1091 | void PPPData::setScript(QStringList &list) { | 1100 | void PPPData::setScript(QStringList &list) { |
1092 | writeListConfig(cgroup, SCRIPTARG_KEY, list); | 1101 | writeListConfig(cgroup, SCRIPTARG_KEY, list); |
1093 | } | 1102 | } |
1094 | 1103 | ||
1095 | 1104 | ||
1096 | const 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 | ||
1101 | void 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 | ||
1106 | const 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 | ||
1111 | void 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 | ||
1116 | int PPPData::totalBytes() { | 1125 | // int PPPData::totalBytes() { |
1117 | return readNumConfig(cgroup, TOTALBYTES_KEY, 0); | 1126 | // return readNumConfig(cgroup, TOTALBYTES_KEY, 0); |
1118 | } | 1127 | // } |
1119 | 1128 | ||
1120 | void 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 | ||
1125 | QStringList &PPPData::pppdArgument() { | 1134 | QStringList &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 | ||
1135 | 1144 | ||
1136 | void PPPData::setpppdArgument(QStringList &args) { | 1145 | void PPPData::setpppdArgument(QStringList &args) { |
1137 | writeListConfig(cgroup, PPPDARG_KEY, args); | 1146 | writeListConfig(cgroup, PPPDARG_KEY, args); |
1138 | } | 1147 | } |
1139 | 1148 | ||
1140 | 1149 | ||
1141 | void PPPData::setpppdArgumentDefaults() { | 1150 | void PPPData::setpppdArgumentDefaults() { |
1142 | QStringList arg; | 1151 | QStringList arg; |
1143 | setpppdArgument(arg); | 1152 | setpppdArgument(arg); |
1144 | } | 1153 | } |
1145 | 1154 | ||
1146 | 1155 | ||
1147 | // // graphing widget | 1156 | // // graphing widget |
1148 | // void PPPData::setGraphingOptions(bool enable, | 1157 | // void PPPData::setGraphingOptions(bool enable, |
1149 | // QColor bg, | 1158 | // QColor bg, |
1150 | // QColor text, | 1159 | // QColor text, |
1151 | // QColor in, | 1160 | // QColor in, |
1152 | // QColor out) | 1161 | // QColor out) |
1153 | // { | 1162 | // { |
1154 | // if(config) { | 1163 | // if(config) { |
1155 | // config->setGroup(GRAPH_GRP); | 1164 | // config->setGroup(GRAPH_GRP); |
1156 | // config->writeEntry(GENABLED, enable); | 1165 | // config->writeEntry(GENABLED, enable); |
1157 | // // config->writeEntry(GCOLOR_BG, bg); | 1166 | // // config->writeEntry(GCOLOR_BG, bg); |
1158 | // // config->writeEntry(GCOLOR_TEXT, text); | 1167 | // // config->writeEntry(GCOLOR_TEXT, text); |
1159 | // // config->writeEntry(GCOLOR_IN, in); | 1168 | // // config->writeEntry(GCOLOR_IN, in); |
1160 | // // config->writeEntry(GCOLOR_OUT, out); | 1169 | // // config->writeEntry(GCOLOR_OUT, out); |
1161 | // } | 1170 | // } |
1162 | // } | 1171 | // } |
1163 | 1172 | ||
1164 | // void PPPData::graphingOptions(bool &enable, | 1173 | // void PPPData::graphingOptions(bool &enable, |
1165 | // QColor &bg, | 1174 | // QColor &bg, |
1166 | // QColor &text, | 1175 | // QColor &text, |
1167 | // QColor &in, | 1176 | // QColor &in, |
1168 | // QColor &out) | 1177 | // QColor &out) |
1169 | // { | 1178 | // { |
1170 | // QColor c; | 1179 | // QColor c; |
1171 | 1180 | ||
1172 | // if(config) { | 1181 | // if(config) { |
1173 | // config->setGroup(GRAPH_GRP); | 1182 | // config->setGroup(GRAPH_GRP); |
1174 | // enable = config->readBoolEntry(GENABLED, true); | 1183 | // enable = config->readBoolEntry(GENABLED, true); |
1175 | // bg = Qt::white; | 1184 | // bg = Qt::white; |
1176 | // //bg = config->readColorEntry(GCOLOR_BG, &c); | 1185 | // //bg = config->readColorEntry(GCOLOR_BG, &c); |
1177 | // text = Qt::black; | 1186 | // text = Qt::black; |
1178 | // //text = config->readColorEntry(GCOLOR_TEXT, &c); | 1187 | // //text = config->readColorEntry(GCOLOR_TEXT, &c); |
1179 | // in = Qt::blue; | 1188 | // in = Qt::blue; |
1180 | // //in = config->readColorEntry(GCOLOR_IN, &c); | 1189 | // //in = config->readColorEntry(GCOLOR_IN, &c); |
1181 | // out = Qt::red; | 1190 | // out = Qt::red; |
1182 | // //out = config->readColorEntry(GCOLOR_OUT, &c); | 1191 | // //out = config->readColorEntry(GCOLOR_OUT, &c); |
1183 | // } | 1192 | // } |
1184 | // } | 1193 | // } |
1185 | 1194 | ||
1186 | 1195 | ||
1187 | // bool PPPData::graphingEnabled() { | 1196 | // bool PPPData::graphingEnabled() { |
1188 | // return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); | 1197 | // return (bool) readNumConfig(GRAPH_GRP, GENABLED, true); |
1189 | // } | 1198 | // } |
1190 | 1199 | ||
1191 | 1200 | ||
1192 | 1201 | ||
1193 | // | 1202 | // |
1194 | //functions to change/set the child pppd process info | 1203 | //functions to change/set the child pppd process info |
1195 | // | 1204 | // |
1196 | bool PPPData::pppdRunning() const { | 1205 | bool PPPData::pppdRunning() const { |
1197 | return pppdisrunning; | 1206 | return pppdisrunning; |
1198 | } | 1207 | } |
1199 | 1208 | ||
1200 | void PPPData::setpppdRunning(bool set) { | 1209 | void PPPData::setpppdRunning(bool set) { |
1201 | pppdisrunning = set; | 1210 | pppdisrunning = set; |
1202 | } | 1211 | } |
1203 | 1212 | ||
1204 | int PPPData::pppdError() const { | 1213 | int PPPData::pppdError() const { |
1205 | return pppderror; | 1214 | return pppderror; |
1206 | } | 1215 | } |
1207 | 1216 | ||
1208 | void PPPData::setpppdError(int err) { | 1217 | void PPPData::setpppdError(int err) { |
1209 | pppderror = err; | 1218 | pppderror = err; |
1210 | } | 1219 | } |
1211 | 1220 | ||
1212 | QString PPPData::modemGroup() | 1221 | QString 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); |
1227 | // writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y); | 1237 | // writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y); |
1228 | // } | 1238 | // } |
1229 | 1239 | ||
1230 | // void PPPData::winPosStatWin(int& p_x, int& p_y) { | 1240 | // void PPPData::winPosStatWin(int& p_x, int& p_y) { |
1231 | // p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160); | 1241 | // p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160); |
1232 | // p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55); | 1242 | // p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55); |
1233 | // } | 1243 | // } |
1234 | 1244 | ||
1235 | // void PPPData::setWinPosStatWin(int p_x, int p_y) { | 1245 | // void PPPData::setWinPosStatWin(int p_x, int p_y) { |
1236 | // writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x); | 1246 | // writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x); |
1237 | // writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y); | 1247 | // writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y); |
1238 | // } | 1248 | // } |
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 | |||
@@ -52,417 +52,417 @@ class Config; | |||
52 | 52 | ||
53 | // | 53 | // |
54 | // keys for config file | 54 | // keys for config file |
55 | // | 55 | // |
56 | 56 | ||
57 | // groups | 57 | // groups |
58 | #define GENERAL_GRP "PPP_General" | 58 | #define GENERAL_GRP "PPP_General" |
59 | #define MODEM_GRP "PPP_Modem" | 59 | #define MODEM_GRP "PPP_Modem" |
60 | #define ACCOUNT_GRP "PPP_Account" | 60 | #define ACCOUNT_GRP "PPP_Account" |
61 | //#define GRAPH_GRP "Graph" | 61 | //#define GRAPH_GRP "Graph" |
62 | //#define WINPOS_GRP "WindowPosition" | 62 | //#define WINPOS_GRP "WindowPosition" |
63 | 63 | ||
64 | // general | 64 | // general |
65 | #define DEFAULTACCOUNT_KEY "DefaultAccount" | 65 | #define DEFAULTACCOUNT_KEY "DefaultAccount" |
66 | #define PPPDVERSION_KEY "pppdVersion" | 66 | #define PPPDVERSION_KEY "pppdVersion" |
67 | #define PPPDTIMEOUT_KEY "pppdTimeout" | 67 | #define PPPDTIMEOUT_KEY "pppdTimeout" |
68 | #define SHOWCLOCK_KEY "ShowClock" | 68 | #define SHOWCLOCK_KEY "ShowClock" |
69 | #define SHOWLOGWIN_KEY "ShowLogWindow" | 69 | #define SHOWLOGWIN_KEY "ShowLogWindow" |
70 | #define AUTOREDIAL_KEY "AutomaticRedial" | 70 | #define AUTOREDIAL_KEY "AutomaticRedial" |
71 | #define DISCONNECT_KEY "DisconnectOnXServerExit" | 71 | #define DISCONNECT_KEY "DisconnectOnXServerExit" |
72 | #define QUITONDISCONNECT_KEY "QuitOnDisconnect" | 72 | #define QUITONDISCONNECT_KEY "QuitOnDisconnect" |
73 | #define NUMACCOUNTS_KEY "NumberOfAccounts" | 73 | #define NUMACCOUNTS_KEY "NumberOfAccounts" |
74 | #define ID_KEY "ID" | 74 | #define ID_KEY "ID" |
75 | 75 | ||
76 | // modem | 76 | // modem |
77 | #define MODEMDEV_KEY "Device" | 77 | #define MODEMDEV_KEY "Device" |
78 | #define LOCKFILE_KEY "UseLockFile" | 78 | #define LOCKFILE_KEY "UseLockFile" |
79 | #define FLOWCONTROL_KEY "FlowControl" | 79 | #define FLOWCONTROL_KEY "FlowControl" |
80 | #define SPEED_KEY "Speed" | 80 | #define SPEED_KEY "Speed" |
81 | #define TIMEOUT_KEY "Timeout" | 81 | #define TIMEOUT_KEY "Timeout" |
82 | #define TONEDURATION_KEY "ToneDuration" | 82 | #define TONEDURATION_KEY "ToneDuration" |
83 | #define BUSYWAIT_KEY "BusyWait" | 83 | #define BUSYWAIT_KEY "BusyWait" |
84 | #define INITSTR_KEY "InitString" | 84 | #define INITSTR_KEY "InitString" |
85 | #define INITRESP_KEY "InitResponse" | 85 | #define INITRESP_KEY "InitResponse" |
86 | #define PREINITDELAY_KEY "PreInitDelay" | 86 | #define PREINITDELAY_KEY "PreInitDelay" |
87 | #define INITDELAY_KEY "InitDelay" | 87 | #define INITDELAY_KEY "InitDelay" |
88 | #define NODTDETECT_KEY "NoDialToneDetection" | 88 | #define NODTDETECT_KEY "NoDialToneDetection" |
89 | #define DIALTONEWAIT_KEY "WaitForDialTone" | 89 | #define DIALTONEWAIT_KEY "WaitForDialTone" |
90 | #define DIALSTR_KEY "DialString" | 90 | #define DIALSTR_KEY "DialString" |
91 | #define CONNECTRESP_KEY "ConnectResponse" | 91 | #define CONNECTRESP_KEY "ConnectResponse" |
92 | #define BUSYRESP_KEY "BusyResponse" | 92 | #define BUSYRESP_KEY "BusyResponse" |
93 | #define NOCARRIERRESP_KEY "NoCarrierResponse" | 93 | #define NOCARRIERRESP_KEY "NoCarrierResponse" |
94 | #define NODIALTONERESP_KEY "NoDialToneResp" | 94 | #define NODIALTONERESP_KEY "NoDialToneResp" |
95 | #define HANGUPSTR_KEY "HangupString" | 95 | #define HANGUPSTR_KEY "HangupString" |
96 | #define HANGUPRESP_KEY "HangUpResponse" | 96 | #define HANGUPRESP_KEY "HangUpResponse" |
97 | #define ANSWERSTR_KEY "AnswerString" | 97 | #define ANSWERSTR_KEY "AnswerString" |
98 | #define RINGRESP_KEY "RingResponse" | 98 | #define RINGRESP_KEY "RingResponse" |
99 | #define ANSWERRESP_KEY "AnswerResponse" | 99 | #define ANSWERRESP_KEY "AnswerResponse" |
100 | #define ENTER_KEY "Enter" | 100 | #define ENTER_KEY "Enter" |
101 | #define ESCAPESTR_KEY "EscapeString" | 101 | #define ESCAPESTR_KEY "EscapeString" |
102 | #define ESCAPERESP_KEY "EscapeResponse" | 102 | #define ESCAPERESP_KEY "EscapeResponse" |
103 | #define ESCAPEGUARDTIME_KEY "EscapeGuardTime" | 103 | #define ESCAPEGUARDTIME_KEY "EscapeGuardTime" |
104 | #define USECDLINE_KEY "UseCDLine" | 104 | #define USECDLINE_KEY "UseCDLine" |
105 | #define VOLUME_HIGH "VolumeHigh" | 105 | #define VOLUME_HIGH "VolumeHigh" |
106 | #define VOLUME_MEDIUM "VolumeMedium" | 106 | #define VOLUME_MEDIUM "VolumeMedium" |
107 | #define VOLUME_OFF "VolumeOff" | 107 | #define VOLUME_OFF "VolumeOff" |
108 | #define VOLUME_KEY "Volume" | 108 | #define VOLUME_KEY "Volume" |
109 | 109 | ||
110 | // account | 110 | // account |
111 | #define NAME_KEY "Name" | 111 | #define NAME_KEY "Name" |
112 | #define PHONENUMBER_KEY "Phonenumber" | 112 | #define PHONENUMBER_KEY "Phonenumber" |
113 | #define DIAL_PREFIX_KEY "DialPrefix" | 113 | #define DIAL_PREFIX_KEY "DialPrefix" |
114 | #define AUTH_KEY "Authentication" | 114 | #define AUTH_KEY "Authentication" |
115 | #define STORED_PASSWORD_KEY "Password" | 115 | #define STORED_PASSWORD_KEY "Password" |
116 | #define STORED_USERNAME_KEY "Username" | 116 | #define STORED_USERNAME_KEY "Username" |
117 | #define STORE_PASSWORD_KEY "StorePassword" | 117 | #define STORE_PASSWORD_KEY "StorePassword" |
118 | #define BEFORE_CONNECT_KEY "BeforeConnect" | 118 | #define BEFORE_CONNECT_KEY "BeforeConnect" |
119 | #define COMMAND_KEY "Command" | 119 | #define COMMAND_KEY "Command" |
120 | #define DISCONNECT_COMMAND_KEY "DisconnectCommand" | 120 | #define DISCONNECT_COMMAND_KEY "DisconnectCommand" |
121 | #define BEFORE_DISCONNECT_KEY "BeforeDisconnect" | 121 | #define BEFORE_DISCONNECT_KEY "BeforeDisconnect" |
122 | #define IPADDR_KEY "IPAddr" | 122 | #define IPADDR_KEY "IPAddr" |
123 | #define SUBNETMASK_KEY "SubnetMask" | 123 | #define SUBNETMASK_KEY "SubnetMask" |
124 | #define ACCTENABLED_KEY "AccountingEnabled" | 124 | #define ACCTENABLED_KEY "AccountingEnabled" |
125 | #define VOLACCTENABLED_KEY "VolumeAccountingEnabled" | 125 | #define VOLACCTENABLED_KEY "VolumeAccountingEnabled" |
126 | #define ACCTFILE_KEY "AccountingFile" | 126 | #define ACCTFILE_KEY "AccountingFile" |
127 | #define AUTONAME_KEY "AutoName" | 127 | #define AUTONAME_KEY "AutoName" |
128 | #define GATEWAY_KEY "Gateway" | 128 | #define GATEWAY_KEY "Gateway" |
129 | #define DEFAULTROUTE_KEY "DefaultRoute" | 129 | #define DEFAULTROUTE_KEY "DefaultRoute" |
130 | #define DOMAIN_KEY "Domain" | 130 | #define DOMAIN_KEY "Domain" |
131 | #define DNS_KEY "DNS" | 131 | #define DNS_KEY "DNS" |
132 | #define AUTODNS_KEY "AutoDNS" | 132 | #define AUTODNS_KEY "AutoDNS" |
133 | #define EXDNSDISABLED_KEY "ExDNSDisabled" | 133 | #define EXDNSDISABLED_KEY "ExDNSDisabled" |
134 | #define SCRIPTCOM_KEY "ScriptCommands" | 134 | #define SCRIPTCOM_KEY "ScriptCommands" |
135 | #define SCRIPTARG_KEY "ScriptArguments" | 135 | #define SCRIPTARG_KEY "ScriptArguments" |
136 | #define PPPDARG_KEY "pppdArguments" | 136 | #define PPPDARG_KEY "pppdArguments" |
137 | #define PPP_DEBUG_OPTION "PPPDebug" | 137 | #define PPP_DEBUG_OPTION "PPPDebug" |
138 | #define ICONIFY_ON_CONNECT_KEY "iconifyOnConnect" | 138 | #define ICONIFY_ON_CONNECT_KEY "iconifyOnConnect" |
139 | #define DOCKING_KEY "DockIntoPanel" | 139 | #define DOCKING_KEY "DockIntoPanel" |
140 | #define TOTALCOSTS_KEY "TotalCosts" | 140 | #define TOTALCOSTS_KEY "TotalCosts" |
141 | #define TOTALBYTES_KEY "TotalBytes" | 141 | #define TOTALBYTES_KEY "TotalBytes" |
142 | 142 | ||
143 | // graph colors | 143 | // graph colors |
144 | #define GENABLED "Enabled" | 144 | #define GENABLED "Enabled" |
145 | #define GCOLOR_BG "Background" | 145 | #define GCOLOR_BG "Background" |
146 | #define GCOLOR_TEXT "Text" | 146 | #define GCOLOR_TEXT "Text" |
147 | #define GCOLOR_IN "InBytes" | 147 | #define GCOLOR_IN "InBytes" |
148 | #define GCOLOR_OUT "OutBytes" | 148 | #define GCOLOR_OUT "OutBytes" |
149 | 149 | ||
150 | // pppd errors | 150 | // pppd errors |
151 | #define E_IF_TIMEOUT 1 | 151 | #define E_IF_TIMEOUT 1 |
152 | #define E_PPPD_DIED 2 | 152 | #define E_PPPD_DIED 2 |
153 | 153 | ||
154 | // window position | 154 | // window position |
155 | #define WINPOS_CONWIN_X "WindowPositionConWinX" | 155 | #define WINPOS_CONWIN_X "WindowPositionConWinX" |
156 | #define WINPOS_CONWIN_Y "WindowPositionConWinY" | 156 | #define WINPOS_CONWIN_Y "WindowPositionConWinY" |
157 | #define WINPOS_STATWIN_X "WindowPositionStatWinX" | 157 | #define WINPOS_STATWIN_X "WindowPositionStatWinX" |
158 | #define WINPOS_STATWIN_Y "WindowPositionStatWinY" | 158 | #define WINPOS_STATWIN_Y "WindowPositionStatWinY" |
159 | 159 | ||
160 | class PPPData { | 160 | class PPPData { |
161 | public: | 161 | public: |
162 | PPPData(); | 162 | PPPData(); |
163 | ~PPPData() {}; | 163 | ~PPPData() {}; |
164 | static PPPData* data(); | 164 | static PPPData* data(); |
165 | 165 | ||
166 | enum { NumInitStrings = 2 }; | 166 | enum { NumInitStrings = 2 }; |
167 | 167 | ||
168 | // general functions | 168 | // general functions |
169 | bool open(); | 169 | bool open(); |
170 | void save(); | 170 | void save(); |
171 | void cancel(); | 171 | void cancel(); |
172 | 172 | ||
173 | 173 | ||
174 | // function to read/write date to configuration file | 174 | // function to read/write date to configuration file |
175 | QString readConfig(const QString &, const QString &, const QString &); | 175 | QString readConfig(const QString &, const QString &, const QString &); |
176 | int readNumConfig(const QString &, const QString &, int); | 176 | int readNumConfig(const QString &, const QString &, int); |
177 | bool readListConfig(const QString &, const QString &, | 177 | bool readListConfig(const QString &, const QString &, |
178 | QStringList &, char sep = ','); | 178 | QStringList &, char sep = ','); |
179 | void writeConfig(const QString &, const QString &, const QString &); | 179 | void writeConfig(const QString &, const QString &, const QString &); |
180 | void writeConfig(const QString &, const QString &, int); | 180 | void writeConfig(const QString &, const QString &, int); |
181 | void writeListConfig(const QString &, const QString &, | 181 | void writeListConfig(const QString &, const QString &, |
182 | QStringList &, char sep = ','); | 182 | QStringList &, char sep = ','); |
183 | 183 | ||
184 | // return the current account group | 184 | // return the current account group |
185 | QString currentGroup() { return cgroup; } | 185 | QString currentGroup() { return cgroup; } |
186 | QString modemGroup(); | 186 | QString modemGroup(); |
187 | 187 | ||
188 | // functions to set/get general kppp info | 188 | // functions to set/get general kppp info |
189 | QString password() const; | 189 | QString password() const; |
190 | void setPassword(const QString &); | 190 | void setPassword(const QString &); |
191 | 191 | ||
192 | const QString defaultAccount(); | 192 | const QString defaultAccount(); |
193 | void setDefaultAccount(const QString &); | 193 | void setDefaultAccount(const QString &); |
194 | 194 | ||
195 | void set_xserver_exit_disconnect(bool set); | 195 | void set_xserver_exit_disconnect(bool set); |
196 | bool get_xserver_exit_disconnect(); | 196 | bool get_xserver_exit_disconnect(); |
197 | 197 | ||
198 | void setPPPDebug(bool set); | 198 | void setPPPDebug(bool set); |
199 | bool getPPPDebug(); | 199 | bool getPPPDebug(); |
200 | 200 | ||
201 | void set_quit_on_disconnect(bool); | 201 | void set_quit_on_disconnect(bool); |
202 | bool quit_on_disconnect(); | 202 | bool quit_on_disconnect(); |
203 | 203 | ||
204 | void set_show_clock_on_caption(bool set); | 204 | void set_show_clock_on_caption(bool set); |
205 | bool get_show_clock_on_caption(); | 205 | bool get_show_clock_on_caption(); |
206 | 206 | ||
207 | void set_show_log_window(bool set); | 207 | void set_show_log_window(bool set); |
208 | bool get_show_log_window(); | 208 | bool get_show_log_window(); |
209 | 209 | ||
210 | void set_automatic_redial(bool set); | 210 | void set_automatic_redial(bool set); |
211 | bool automatic_redial(); | 211 | bool automatic_redial(); |
212 | 212 | ||
213 | void set_iconify_on_connect(bool set); | 213 | void set_iconify_on_connect(bool set); |
214 | bool get_iconify_on_connect(); | 214 | bool get_iconify_on_connect(); |
215 | 215 | ||
216 | void set_dock_into_panel(bool set); | 216 | void set_dock_into_panel(bool set); |
217 | bool get_dock_into_panel(); | 217 | bool get_dock_into_panel(); |
218 | 218 | ||
219 | const QString enter(); | 219 | const QString enter(); |
220 | void setEnter(const QString &); | 220 | void setEnter(const QString &); |
221 | 221 | ||
222 | QString pppdVersion(); | 222 | QString pppdVersion(); |
223 | bool pppdVersionMin(int ver, int mod, int patch); | 223 | bool pppdVersionMin(int ver, int mod, int patch); |
224 | 224 | ||
225 | int pppdTimeout(); | 225 | int pppdTimeout(); |
226 | void setpppdTimeout(int); | 226 | void setpppdTimeout(int); |
227 | 227 | ||
228 | int busyWait(); | 228 | int busyWait(); |
229 | void setbusyWait(int); | 229 | void setbusyWait(int); |
230 | 230 | ||
231 | bool modemLockFile(); | 231 | bool modemLockFile(); |
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(); |
257 | void setVolume(int); | 257 | void setVolume(int); |
258 | 258 | ||
259 | int waitForDialTone(); | 259 | int waitForDialTone(); |
260 | void setWaitForDialTone(int i); | 260 | void setWaitForDialTone(int i); |
261 | 261 | ||
262 | // modem command strings/responses | 262 | // modem command strings/responses |
263 | const QString modemInitStr(int i); | 263 | const QString modemInitStr(int i); |
264 | void setModemInitStr(int i, const QString &); | 264 | void setModemInitStr(int i, const QString &); |
265 | 265 | ||
266 | const QString modemInitResp(); | 266 | const QString modemInitResp(); |
267 | void setModemInitResp(const QString &); | 267 | void setModemInitResp(const QString &); |
268 | 268 | ||
269 | int modemPreInitDelay(); | 269 | int modemPreInitDelay(); |
270 | void setModemPreInitDelay(int); | 270 | void setModemPreInitDelay(int); |
271 | 271 | ||
272 | int modemInitDelay(); | 272 | int modemInitDelay(); |
273 | void setModemInitDelay(int); | 273 | void setModemInitDelay(int); |
274 | 274 | ||
275 | QString modemNoDialToneDetectionStr(); | 275 | QString modemNoDialToneDetectionStr(); |
276 | void setModemNoDialToneDetectionStr(const QString &); | 276 | void setModemNoDialToneDetectionStr(const QString &); |
277 | 277 | ||
278 | const QString modemDialStr(); | 278 | const QString modemDialStr(); |
279 | void setModemDialStr(const QString &); | 279 | void setModemDialStr(const QString &); |
280 | 280 | ||
281 | const QString modemConnectResp(); | 281 | const QString modemConnectResp(); |
282 | void setModemConnectResp(const QString &); | 282 | void setModemConnectResp(const QString &); |
283 | 283 | ||
284 | const QString modemBusyResp(); | 284 | const QString modemBusyResp(); |
285 | void setModemBusyResp(const QString &); | 285 | void setModemBusyResp(const QString &); |
286 | 286 | ||
287 | const QString modemNoCarrierResp(); | 287 | const QString modemNoCarrierResp(); |
288 | void setModemNoCarrierResp(const QString &); | 288 | void setModemNoCarrierResp(const QString &); |
289 | 289 | ||
290 | const QString modemNoDialtoneResp(); | 290 | const QString modemNoDialtoneResp(); |
291 | void setModemNoDialtoneResp(const QString &); | 291 | void setModemNoDialtoneResp(const QString &); |
292 | 292 | ||
293 | const QString modemHangupStr(); | 293 | const QString modemHangupStr(); |
294 | void setModemHangupStr(const QString &); | 294 | void setModemHangupStr(const QString &); |
295 | 295 | ||
296 | const QString modemHangupResp(); | 296 | const QString modemHangupResp(); |
297 | void setModemHangupResp(const QString &); | 297 | void setModemHangupResp(const QString &); |
298 | 298 | ||
299 | const QString modemAnswerStr(); | 299 | const QString modemAnswerStr(); |
300 | void setModemAnswerStr(const QString &); | 300 | void setModemAnswerStr(const QString &); |
301 | 301 | ||
302 | const QString modemRingResp(); | 302 | const QString modemRingResp(); |
303 | void setModemRingResp(const QString &); | 303 | void setModemRingResp(const QString &); |
304 | 304 | ||
305 | const QString modemAnswerResp(); | 305 | const QString modemAnswerResp(); |
306 | void setModemAnswerResp(const QString &); | 306 | void setModemAnswerResp(const QString &); |
307 | 307 | ||
308 | QString volumeOff(); | 308 | QString volumeOff(); |
309 | void setVolumeOff(const QString &); | 309 | void setVolumeOff(const QString &); |
310 | 310 | ||
311 | QString volumeMedium(); | 311 | QString volumeMedium(); |
312 | void setVolumeMedium(const QString &); | 312 | void setVolumeMedium(const QString &); |
313 | 313 | ||
314 | QString volumeHigh(); | 314 | QString volumeHigh(); |
315 | void setVolumeHigh(const QString &); | 315 | void setVolumeHigh(const QString &); |
316 | 316 | ||
317 | #if 0 | 317 | #if 0 |
318 | void setUseCDLine(const int n); | 318 | void setUseCDLine(const int n); |
319 | int UseCDLine(); | 319 | int UseCDLine(); |
320 | #endif | 320 | #endif |
321 | 321 | ||
322 | // functions to set/get account information | 322 | // functions to set/get account information |
323 | int count() const; | 323 | int count() const; |
324 | bool setAccount(const QString &); | 324 | bool setAccount(const QString &); |
325 | bool setAccountbyIndex(int); | 325 | bool setAccountbyIndex(int); |
326 | 326 | ||
327 | bool isUniqueAccname(const QString &); | 327 | bool isUniqueAccname(const QString &); |
328 | 328 | ||
329 | bool deleteAccount(); | 329 | bool deleteAccount(); |
330 | bool deleteAccount(const QString &); | 330 | bool deleteAccount(const QString &); |
331 | int newaccount(); | 331 | int newaccount(); |
332 | int copyaccount(int i); | 332 | int copyaccount(int i); |
333 | 333 | ||
334 | const QString accname(); | 334 | const QString accname(); |
335 | void setAccname(const QString &); | 335 | void setAccname(const QString &); |
336 | 336 | ||
337 | QStringList &phonenumbers(); | 337 | QStringList &phonenumbers(); |
338 | const QString phonenumber(); | 338 | const QString phonenumber(); |
339 | void setPhonenumber(const QString &); | 339 | void setPhonenumber(const QString &); |
340 | 340 | ||
341 | const QString dialPrefix(); | 341 | const QString dialPrefix(); |
342 | void setDialPrefix(const QString &); | 342 | void setDialPrefix(const QString &); |
343 | 343 | ||
344 | int authMethod(); | 344 | int authMethod(); |
345 | void setAuthMethod(int); | 345 | void setAuthMethod(int); |
346 | 346 | ||
347 | const QString storedUsername(); | 347 | const QString storedUsername(); |
348 | void setStoredUsername(const QString &); | 348 | void setStoredUsername(const QString &); |
349 | 349 | ||
350 | const QString storedPassword(); | 350 | const QString storedPassword(); |
351 | void setStoredPassword(const QString &); | 351 | void setStoredPassword(const QString &); |
352 | 352 | ||
353 | bool storePassword(); | 353 | bool storePassword(); |
354 | void setStorePassword(bool); | 354 | void setStorePassword(bool); |
355 | 355 | ||
356 | const QString speed(); | 356 | const QString speed(); |
357 | void setSpeed(const QString &); | 357 | void setSpeed(const QString &); |
358 | 358 | ||
359 | const QString command_before_connect(); | 359 | const QString command_before_connect(); |
360 | void setCommand_before_connect(const QString &); | 360 | void setCommand_before_connect(const QString &); |
361 | 361 | ||
362 | const QString command_on_connect(); | 362 | const QString command_on_connect(); |
363 | void setCommand_on_connect(const QString &); | 363 | void setCommand_on_connect(const QString &); |
364 | 364 | ||
365 | const QString command_on_disconnect(); | 365 | const QString command_on_disconnect(); |
366 | void setCommand_on_disconnect(const QString &); | 366 | void setCommand_on_disconnect(const QString &); |
367 | 367 | ||
368 | const QString command_before_disconnect(); | 368 | const QString command_before_disconnect(); |
369 | void setCommand_before_disconnect(const QString &); | 369 | void setCommand_before_disconnect(const QString &); |
370 | 370 | ||
371 | const QString ipaddr(); | 371 | const QString ipaddr(); |
372 | void setIpaddr(const QString &); | 372 | void setIpaddr(const QString &); |
373 | 373 | ||
374 | const QString subnetmask(); | 374 | const QString subnetmask(); |
375 | void setSubnetmask(const QString &); | 375 | void setSubnetmask(const QString &); |
376 | 376 | ||
377 | bool AcctEnabled(); | 377 | bool AcctEnabled(); |
378 | void setAcctEnabled(bool set); | 378 | void setAcctEnabled(bool set); |
379 | 379 | ||
380 | int VolAcctEnabled(); | 380 | int VolAcctEnabled(); |
381 | void setVolAcctEnabled(int set); | 381 | void setVolAcctEnabled(int set); |
382 | 382 | ||
383 | bool autoDNS(); | 383 | bool autoDNS(); |
384 | void setAutoDNS(bool set); | 384 | void setAutoDNS(bool set); |
385 | 385 | ||
386 | bool exDNSDisabled(); | 386 | bool exDNSDisabled(); |
387 | void setExDNSDisabled(bool set); | 387 | void setExDNSDisabled(bool set); |
388 | 388 | ||
389 | bool autoname(); | 389 | bool autoname(); |
390 | void setAutoname(bool set); | 390 | void setAutoname(bool set); |
391 | 391 | ||
392 | const QString gateway(); | 392 | const QString gateway(); |
393 | void setGateway(const QString &); | 393 | void setGateway(const QString &); |
394 | 394 | ||
395 | bool defaultroute(); | 395 | bool defaultroute(); |
396 | void setDefaultroute(bool set); | 396 | void setDefaultroute(bool set); |
397 | 397 | ||
398 | QStringList &dns(); | 398 | QStringList &dns(); |
399 | void setDns(QStringList &); | 399 | void setDns(QStringList &); |
400 | 400 | ||
401 | const QString domain(); | 401 | const QString domain(); |
402 | void setDomain(const QString &); | 402 | void setDomain(const QString &); |
403 | 403 | ||
404 | QStringList &scriptType(); | 404 | QStringList &scriptType(); |
405 | void setScriptType(QStringList &); | 405 | void setScriptType(QStringList &); |
406 | 406 | ||
407 | QStringList &script(); | 407 | QStringList &script(); |
408 | void setScript(QStringList &); | 408 | void setScript(QStringList &); |
409 | 409 | ||
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 | ||
450 | private: | 450 | private: |
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; |
466 | }; | 466 | }; |
467 | 467 | ||
468 | #endif | 468 | #endif |
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 | |||
@@ -1,126 +1,128 @@ | |||
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 | */ |
11 | PPPModule::PPPModule() : Module() | 11 | PPPModule::PPPModule() : Module() |
12 | { | 12 | { |
13 | Interface *iface; | 13 | Interface *iface; |
14 | iface = new Interface( 0, "device" ); | 14 | iface = new Interface( 0, "device" ); |
15 | iface->setHardwareName( "account" ); | 15 | iface->setHardwareName( "account" ); |
16 | list.append( iface ); | 16 | list.append( iface ); |
17 | } | 17 | } |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Delete any interfaces that we own. | 20 | * Delete any interfaces that we own. |
21 | */ | 21 | */ |
22 | PPPModule::~PPPModule(){ | 22 | PPPModule::~PPPModule(){ |
23 | Interface *i; | 23 | Interface *i; |
24 | for ( i=list.first(); i != 0; i=list.next() ) | 24 | for ( i=list.first(); i != 0; i=list.next() ) |
25 | delete i; | 25 | delete i; |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Change the current profile | 29 | * Change the current profile |
30 | */ | 30 | */ |
31 | void PPPModule::setProfile(const QString &newProfile){ | 31 | void PPPModule::setProfile(const QString &newProfile){ |
32 | profile = newProfile; | 32 | profile = newProfile; |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * get the icon name for this device. | 36 | * get the icon name for this device. |
37 | * @param Interface* can be used in determining the icon. | 37 | * @param Interface* can be used in determining the icon. |
38 | * @return QString the icon name (minus .png, .gif etc) | 38 | * @return QString the icon name (minus .png, .gif etc) |
39 | */ | 39 | */ |
40 | QString PPPModule::getPixmapName(Interface* ){ | 40 | QString PPPModule::getPixmapName(Interface* ){ |
41 | return "ppp"; | 41 | return "ppp"; |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Check to see if the interface i is owned by this module. | 45 | * Check to see if the interface i is owned by this module. |
46 | * @param Interface* interface to check against | 46 | * @param Interface* interface to check against |
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 | */ |
49 | bool PPPModule::isOwner(Interface *i){ | 49 | bool 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 | */ |
57 | QWidget *PPPModule::configure(Interface *i){ | 57 | QWidget *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 | */ |
68 | QWidget *PPPModule::information(Interface *i){ | 69 | QWidget *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 | */ |
81 | QList<Interface> PPPModule::getInterfaces(){ | 82 | QList<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 | */ |
93 | Interface *PPPModule::addNewInterface(const QString &newInterface){ | 94 | Interface *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 | */ |
115 | bool PPPModule::remove(Interface*){ | 117 | bool 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 | ||
120 | void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) | 122 | void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) |
121 | { | 123 | { |
122 | newIfaces.insert(QObject::tr("PPP") , | 124 | newIfaces.insert(QObject::tr("PPP") , |
123 | QObject::tr("generic ppp device")); | 125 | QObject::tr("generic ppp device")); |
124 | } | 126 | } |
125 | 127 | ||
126 | 128 | ||