Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/kpppwidget.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index 2f9feda..8d70cd4 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp | |||
@@ -137,82 +137,82 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl | |||
137 | // PW_Edit->setEchoMode(QLineEdit::Password); | 137 | // PW_Edit->setEchoMode(QLineEdit::Password); |
138 | // l1->addWidget(PW_Edit, 2, 2); | 138 | // l1->addWidget(PW_Edit, 2, 2); |
139 | // connect(PW_Edit, SIGNAL(returnPressed()), | 139 | // connect(PW_Edit, SIGNAL(returnPressed()), |
140 | // this, SLOT(enterPressedInPW())); | 140 | // this, SLOT(enterPressedInPW())); |
141 | 141 | ||
142 | // tmp = i18n("<p>Type in the password that you got from your\n" | 142 | // tmp = i18n("<p>Type in the password that you got from your\n" |
143 | // "ISP. This is especially important for PAP\n" | 143 | // "ISP. This is especially important for PAP\n" |
144 | // "and CHAP. You may omit this when you use\n" | 144 | // "and CHAP. You may omit this when you use\n" |
145 | // "terminal-based or script-based authentication.\n" | 145 | // "terminal-based or script-based authentication.\n" |
146 | // "\n" | 146 | // "\n" |
147 | // "<b>Important</b>: case is important here:\n" | 147 | // "<b>Important</b>: case is important here:\n" |
148 | // "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); | 148 | // "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); |
149 | 149 | ||
150 | // QWhatsThis::add(PW_Label,tmp); | 150 | // QWhatsThis::add(PW_Label,tmp); |
151 | // QWhatsThis::add(PW_Edit,tmp); | 151 | // QWhatsThis::add(PW_Edit,tmp); |
152 | 152 | ||
153 | // QHBoxLayout *l3 = new QHBoxLayout; | 153 | // QHBoxLayout *l3 = new QHBoxLayout; |
154 | // tl->addSpacing(5); | 154 | // tl->addSpacing(5); |
155 | // tl->addLayout(l3); | 155 | // tl->addLayout(l3); |
156 | // tl->addSpacing(5); | 156 | // tl->addSpacing(5); |
157 | // l3->addSpacing(10); | 157 | // l3->addSpacing(10); |
158 | // log = new QCheckBox(i18n("Show lo&g window"), this); | 158 | // log = new QCheckBox(i18n("Show lo&g window"), this); |
159 | // connect(log, SIGNAL(toggled(bool)), | 159 | // connect(log, SIGNAL(toggled(bool)), |
160 | // this, SLOT(log_window_toggled(bool))); | 160 | // this, SLOT(log_window_toggled(bool))); |
161 | // log->setChecked(gpppdata.get_show_log_window()); | 161 | // log->setChecked(PPPData::data()->get_show_log_window()); |
162 | // l3->addWidget(log); | 162 | // l3->addWidget(log); |
163 | 163 | ||
164 | // QWhatsThis::add(log, | 164 | // QWhatsThis::add(log, |
165 | // i18n("<p>This controls whether a log window is shown.\n" | 165 | // i18n("<p>This controls whether a log window is shown.\n" |
166 | // "A log window shows the communication between\n" | 166 | // "A log window shows the communication between\n" |
167 | // "<i>kppp</i> and your modem. This will help you\n" | 167 | // "<i>kppp</i> and your modem. This will help you\n" |
168 | // "in tracking down problems.\n" | 168 | // "in tracking down problems.\n" |
169 | // "\n" | 169 | // "\n" |
170 | // "Turn it off if <i>kppp</i> routinely connects without\n" | 170 | // "Turn it off if <i>kppp</i> routinely connects without\n" |
171 | // "problems")); | 171 | // "problems")); |
172 | 172 | ||
173 | // // fline = new QSeparator( KSeparator::HLine, this); | 173 | // // fline = new QSeparator( KSeparator::HLine, this); |
174 | // // tl->addWidget(fline); | 174 | // // tl->addWidget(fline); |
175 | 175 | ||
176 | // QHBoxLayout *l2 = new QHBoxLayout(this); | 176 | // QHBoxLayout *l2 = new QHBoxLayout(this); |
177 | // tl->addLayout(l2); | 177 | // tl->addLayout(l2); |
178 | 178 | ||
179 | // int minw = 0; | 179 | // int minw = 0; |
180 | // quit_b = new QPushButton(i18n("&Quit"), this); | 180 | // quit_b = new QPushButton(i18n("&Quit"), this); |
181 | // // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); | 181 | // // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); |
182 | // connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); | 182 | // connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); |
183 | // if(quit_b->sizeHint().width() > minw) | 183 | // if(quit_b->sizeHint().width() > minw) |
184 | // minw = quit_b->sizeHint().width(); | 184 | // minw = quit_b->sizeHint().width(); |
185 | 185 | ||
186 | // setup_b = new QPushButton(i18n("&Setup..."), this); | 186 | // setup_b = new QPushButton(i18n("&Setup..."), this); |
187 | // // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); | 187 | // // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); |
188 | // connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); | 188 | // connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); |
189 | // if(setup_b->sizeHint().width() > minw) | 189 | // if(setup_b->sizeHint().width() > minw) |
190 | // minw = setup_b->sizeHint().width(); | 190 | // minw = setup_b->sizeHint().width(); |
191 | 191 | ||
192 | 192 | ||
193 | 193 | ||
194 | // if(gpppdata.access() != KConfig::ReadWrite) | 194 | // if(PPPData::data()->access() != KConfig::ReadWrite) |
195 | // setup_b->setEnabled(false); | 195 | // setup_b->setEnabled(false); |
196 | 196 | ||
197 | // help_b = new QPushButton(i18n("&Help"), this); | 197 | // help_b = new QPushButton(i18n("&Help"), this); |
198 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); | 198 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); |
199 | 199 | ||
200 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); | 200 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); |
201 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); | 201 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); |
202 | // help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); | 202 | // help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); |
203 | 203 | ||
204 | // if(help_b->sizeHint().width() > minw) | 204 | // if(help_b->sizeHint().width() > minw) |
205 | // minw = help_b->sizeHint().width(); | 205 | // minw = help_b->sizeHint().width(); |
206 | 206 | ||
207 | // connect_b = new QPushButton(i18n("&Connect"), this); | 207 | // connect_b = new QPushButton(i18n("&Connect"), this); |
208 | // connect_b->setDefault(true); | 208 | // connect_b->setDefault(true); |
209 | // connect_b->setFocus(); | 209 | // connect_b->setFocus(); |
210 | // connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); | 210 | // connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); |
211 | // if(connect_b->sizeHint().width() > minw) | 211 | // if(connect_b->sizeHint().width() > minw) |
212 | // minw = connect_b->sizeHint().width(); | 212 | // minw = connect_b->sizeHint().width(); |
213 | 213 | ||
214 | // quit_b->setFixedWidth(minw); | 214 | // quit_b->setFixedWidth(minw); |
215 | // setup_b->setFixedWidth(minw); | 215 | // setup_b->setFixedWidth(minw); |
216 | // // help_b->setFixedWidth(help_b->sizeHint().width()); | 216 | // // help_b->setFixedWidth(help_b->sizeHint().width()); |
217 | // connect_b->setFixedWidth(minw); | 217 | // connect_b->setFixedWidth(minw); |
218 | 218 | ||
@@ -270,49 +270,49 @@ KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl | |||
270 | // // connect(con, SIGNAL(stopAccounting()), | 270 | // // connect(con, SIGNAL(stopAccounting()), |
271 | // // this, SLOT(stopAccounting())); | 271 | // // this, SLOT(stopAccounting())); |
272 | // connect(qApp, SIGNAL(saveYourself()), | 272 | // connect(qApp, SIGNAL(saveYourself()), |
273 | // this, SLOT(saveMyself())); | 273 | // this, SLOT(saveMyself())); |
274 | // connect(qApp, SIGNAL(shutDown()), | 274 | // connect(qApp, SIGNAL(shutDown()), |
275 | // this, SLOT(shutDown())); | 275 | // this, SLOT(shutDown())); |
276 | 276 | ||
277 | // debugwindow->setGeometry(desk.center().x()+190, desk.center().y()-55, | 277 | // debugwindow->setGeometry(desk.center().x()+190, desk.center().y()-55, |
278 | // debugwindow->width(),debugwindow->height()); | 278 | // debugwindow->width(),debugwindow->height()); |
279 | 279 | ||
280 | // move(desk.center().x()-width()/2, desk.center().y()-height()/2); | 280 | // move(desk.center().x()-width()/2, desk.center().y()-height()/2); |
281 | 281 | ||
282 | 282 | ||
283 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 283 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
284 | 284 | ||
285 | // m_strCmdlAccount = args->getOption("c"); | 285 | // m_strCmdlAccount = args->getOption("c"); |
286 | // m_bQuitOnDisconnect = args->isSet("q"); | 286 | // m_bQuitOnDisconnect = args->isSet("q"); |
287 | 287 | ||
288 | // if(!m_strCmdlAccount.isEmpty()) { | 288 | // if(!m_strCmdlAccount.isEmpty()) { |
289 | // m_bCmdlAccount = true; | 289 | // m_bCmdlAccount = true; |
290 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; | 290 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; |
291 | // } | 291 | // } |
292 | 292 | ||
293 | // if(m_bCmdlAccount){ | 293 | // if(m_bCmdlAccount){ |
294 | // bool result = gpppdata.setAccount(m_strCmdlAccount); | 294 | // bool result = PPPData::data()->setAccount(m_strCmdlAccount); |
295 | // if (!result){ | 295 | // if (!result){ |
296 | // QString string; | 296 | // QString string; |
297 | // string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); | 297 | // string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); |
298 | // KMessageBox::error(this, string); | 298 | // KMessageBox::error(this, string); |
299 | // m_bCmdlAccount = false; | 299 | // m_bCmdlAccount = false; |
300 | // this->show(); | 300 | // this->show(); |
301 | // } else { | 301 | // } else { |
302 | // beginConnect(); | 302 | // beginConnect(); |
303 | // } | 303 | // } |
304 | // } else | 304 | // } else |
305 | // expandbutton(); | 305 | // expandbutton(); |
306 | // show(); | 306 | // show(); |
307 | 307 | ||
308 | 308 | ||
309 | //#define KPPP_SHOW_NEWS | 309 | //#define KPPP_SHOW_NEWS |
310 | #ifdef KPPP_SHOW_NEWS | 310 | #ifdef KPPP_SHOW_NEWS |
311 | // keep user informed about recent changes | 311 | // keep user informed about recent changes |
312 | if(!m_bCmdlAccount) | 312 | if(!m_bCmdlAccount) |
313 | showNews(); | 313 | showNews(); |
314 | #endif | 314 | #endif |
315 | } | 315 | } |
316 | 316 | ||
317 | KPPPWidget::~KPPPWidget() | 317 | KPPPWidget::~KPPPWidget() |
318 | { | 318 | { |
@@ -342,527 +342,527 @@ KPPPWidget::~KPPPWidget() | |||
342 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { | 342 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { |
343 | // beginConnect(); | 343 | // beginConnect(); |
344 | // return true; | 344 | // return true; |
345 | // } | 345 | // } |
346 | // } | 346 | // } |
347 | // } | 347 | // } |
348 | 348 | ||
349 | // return false; | 349 | // return false; |
350 | // } | 350 | // } |
351 | 351 | ||
352 | 352 | ||
353 | 353 | ||
354 | 354 | ||
355 | void KPPPWidget::enterPressedInID() { | 355 | void KPPPWidget::enterPressedInID() { |
356 | PW_Edit->setFocus(); | 356 | PW_Edit->setFocus(); |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | void KPPPWidget::enterPressedInPW() { | 360 | void KPPPWidget::enterPressedInPW() { |
361 | connect_b->setFocus(); | 361 | connect_b->setFocus(); |
362 | } | 362 | } |
363 | 363 | ||
364 | // triggered by the session manager | 364 | // triggered by the session manager |
365 | void KPPPWidget::saveMyself() { | 365 | void KPPPWidget::saveMyself() { |
366 | gpppdata.save(); | 366 | PPPData::data()->save(); |
367 | } | 367 | } |
368 | 368 | ||
369 | void KPPPWidget::shutDown() { | 369 | void KPPPWidget::shutDown() { |
370 | interruptConnection(); | 370 | interruptConnection(); |
371 | saveMyself(); | 371 | saveMyself(); |
372 | } | 372 | } |
373 | 373 | ||
374 | void KPPPWidget::log_window_toggled(bool on) { | 374 | void KPPPWidget::log_window_toggled(bool on) { |
375 | gpppdata.set_show_log_window(on); | 375 | PPPData::data()->set_show_log_window(on); |
376 | } | 376 | } |
377 | 377 | ||
378 | 378 | ||
379 | 379 | ||
380 | 380 | ||
381 | // void KPPPWidget::resetaccounts() { | 381 | // void KPPPWidget::resetaccounts() { |
382 | // connectto_c->clear(); | 382 | // connectto_c->clear(); |
383 | 383 | ||
384 | // int count = gpppdata.count(); | 384 | // int count = PPPData::data()->count(); |
385 | 385 | ||
386 | // // enable/disable controls | 386 | // // enable/disable controls |
387 | // connectto_c->setEnabled(count > 0); | 387 | // connectto_c->setEnabled(count > 0); |
388 | // connect_b->setEnabled(count > 0); | 388 | // connect_b->setEnabled(count > 0); |
389 | // log->setEnabled(count > 0); | 389 | // log->setEnabled(count > 0); |
390 | // ID_Edit->setEnabled(count > 0); | 390 | // ID_Edit->setEnabled(count > 0); |
391 | // PW_Edit->setEnabled(count > 0); | 391 | // PW_Edit->setEnabled(count > 0); |
392 | 392 | ||
393 | // //load the accounts | 393 | // //load the accounts |
394 | // for(int i=0; i < count; i++) { | 394 | // for(int i=0; i < count; i++) { |
395 | // gpppdata.setAccountbyIndex(i); | 395 | // PPPData::data()->setAccountbyIndex(i); |
396 | // connectto_c->insertItem(gpppdata.accname()); | 396 | // connectto_c->insertItem(PPPData::data()->accname()); |
397 | // } | 397 | // } |
398 | 398 | ||
399 | // //set the default account | 399 | // //set the default account |
400 | // if(!gpppdata.defaultAccount().isEmpty()) { | 400 | // if(!PPPData::data()->defaultAccount().isEmpty()) { |
401 | // for(int i=0; i < count; i++) | 401 | // for(int i=0; i < count; i++) |
402 | // if(gpppdata.defaultAccount() == connectto_c->text(i)) { | 402 | // if(PPPData::data()->defaultAccount() == connectto_c->text(i)) { |
403 | // connectto_c->setCurrentItem(i); | 403 | // connectto_c->setCurrentItem(i); |
404 | // gpppdata.setAccountbyIndex(i); | 404 | // PPPData::data()->setAccountbyIndex(i); |
405 | 405 | ||
406 | // ID_Edit->setText(gpppdata.storedUsername()); | 406 | // ID_Edit->setText(PPPData::data()->storedUsername()); |
407 | // PW_Edit->setText(gpppdata.storedPassword()); | 407 | // PW_Edit->setText(PPPData::data()->storedPassword()); |
408 | // } | 408 | // } |
409 | // } | 409 | // } |
410 | // else | 410 | // else |
411 | // if(count > 0) { | 411 | // if(count > 0) { |
412 | // gpppdata.setDefaultAccount(connectto_c->text(0)); | 412 | // PPPData::data()->setDefaultAccount(connectto_c->text(0)); |
413 | // gpppdata.save(); | 413 | // PPPData::data()->save(); |
414 | // ID_Edit->setText(gpppdata.storedUsername()); | 414 | // ID_Edit->setText(PPPData::data()->storedUsername()); |
415 | // PW_Edit->setText(gpppdata.storedPassword()); | 415 | // PW_Edit->setText(PPPData::data()->storedPassword()); |
416 | // } | 416 | // } |
417 | 417 | ||
418 | // connect(ID_Edit, SIGNAL(textChanged(const QString &)), | 418 | // connect(ID_Edit, SIGNAL(textChanged(const QString &)), |
419 | // this, SLOT(usernameChanged(const QString &))); | 419 | // this, SLOT(usernameChanged(const QString &))); |
420 | 420 | ||
421 | // connect(PW_Edit, SIGNAL(textChanged(const QString &)), | 421 | // connect(PW_Edit, SIGNAL(textChanged(const QString &)), |
422 | // this, SLOT(passwordChanged(const QString &))); | 422 | // this, SLOT(passwordChanged(const QString &))); |
423 | 423 | ||
424 | // if (ID_Edit->text().isEmpty()) | 424 | // if (ID_Edit->text().isEmpty()) |
425 | // ID_Edit->setFocus(); | 425 | // ID_Edit->setFocus(); |
426 | // else if (PW_Edit->text().isEmpty()) | 426 | // else if (PW_Edit->text().isEmpty()) |
427 | // PW_Edit->setFocus(); | 427 | // PW_Edit->setFocus(); |
428 | // } | 428 | // } |
429 | 429 | ||
430 | 430 | ||
431 | void KPPPWidget::interruptConnection() { | 431 | void KPPPWidget::interruptConnection() { |
432 | // interrupt dial up | 432 | // interrupt dial up |
433 | // if (con->isVisible()) | 433 | // if (con->isVisible()) |
434 | // emit con->cancelbutton(); | 434 | // emit con->cancelbutton(); |
435 | 435 | ||
436 | // disconnect if online | 436 | // disconnect if online |
437 | if (gpppdata.pppdRunning()) | 437 | if (PPPData::data()->pppdRunning()) |
438 | emit disconnect(); | 438 | emit disconnect(); |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
442 | void KPPPWidget::sigPPPDDied() { | 442 | void KPPPWidget::sigPPPDDied() { |
443 | qDebug( "Received a SIGUSR1" ); | 443 | qDebug( "Received a SIGUSR1" ); |
444 | 444 | ||
445 | // if we are not connected pppdpid is -1 so have have to check for that | 445 | // if we are not connected pppdpid is -1 so have have to check for that |
446 | // in the followin line to make sure that we don't raise a false alarm | 446 | // in the followin line to make sure that we don't raise a false alarm |
447 | // such as would be the case when the log file viewer exits. | 447 | // such as would be the case when the log file viewer exits. |
448 | if(gpppdata.pppdRunning() || gpppdata.pppdError()) { | 448 | if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) { |
449 | qDebug( "It was pppd that died" ); | 449 | qDebug( "It was pppd that died" ); |
450 | 450 | ||
451 | // when we killpppd() on Cancel in ConnectWidget | 451 | // when we killpppd() on Cancel in ConnectWidget |
452 | // we set pppid to -1 so we won't | 452 | // we set pppid to -1 so we won't |
453 | // enter this block | 453 | // enter this block |
454 | 454 | ||
455 | // just to be sure | 455 | // just to be sure |
456 | 456 | ||
457 | Modem::modem->removeSecret(AUTH_PAP); | 457 | Modem::modem->removeSecret(AUTH_PAP); |
458 | Modem::modem->removeSecret(AUTH_CHAP); | 458 | Modem::modem->removeSecret(AUTH_CHAP); |
459 | 459 | ||
460 | gpppdata.setpppdRunning(false); | 460 | PPPData::data()->setpppdRunning(false); |
461 | 461 | ||
462 | qDebug( "Executing command on disconnect since pppd has died." ); | 462 | qDebug( "Executing command on disconnect since pppd has died." ); |
463 | QApplication::flushX(); | 463 | QApplication::flushX(); |
464 | execute_command(gpppdata.command_on_disconnect()); | 464 | execute_command(PPPData::data()->command_on_disconnect()); |
465 | 465 | ||
466 | // stopAccounting(); | 466 | // stopAccounting(); |
467 | 467 | ||
468 | // con_win->stopClock(); | 468 | // con_win->stopClock(); |
469 | // DockWidget::dock_widget->stop_stats(); | 469 | // DockWidget::dock_widget->stop_stats(); |
470 | // DockWidget::dock_widget->hide(); | 470 | // DockWidget::dock_widget->hide(); |
471 | 471 | ||
472 | if(!gpppdata.pppdError()) | 472 | if(!PPPData::data()->pppdError()) |
473 | gpppdata.setpppdError(E_PPPD_DIED); | 473 | PPPData::data()->setpppdError(E_PPPD_DIED); |
474 | removedns(); | 474 | removedns(); |
475 | Modem::modem->unlockdevice(); | 475 | Modem::modem->unlockdevice(); |
476 | // con->pppdDied(); | 476 | // con->pppdDied(); |
477 | 477 | ||
478 | if(!gpppdata.automatic_redial()) { | 478 | if(!PPPData::data()->automatic_redial()) { |
479 | quit_b->setFocus(); | 479 | quit_b->setFocus(); |
480 | show(); | 480 | show(); |
481 | // con_win->stopClock(); | 481 | // con_win->stopClock(); |
482 | //stopAccounting(); | 482 | //stopAccounting(); |
483 | // con_win->hide(); | 483 | // con_win->hide(); |
484 | // con->hide(); | 484 | // con->hide(); |
485 | 485 | ||
486 | gpppdata.setpppdRunning(false); | 486 | PPPData::data()->setpppdRunning(false); |
487 | // // not in a signal handler !!! KNotifyClient::beep(); | 487 | // // not in a signal handler !!! KNotifyClient::beep(); |
488 | QString msg; | 488 | QString msg; |
489 | if (gpppdata.pppdError() == E_IF_TIMEOUT) | 489 | if (PPPData::data()->pppdError() == E_IF_TIMEOUT) |
490 | msg = i18n("Timeout expired while waiting for the PPP interface " | 490 | msg = i18n("Timeout expired while waiting for the PPP interface " |
491 | "to come up!"); | 491 | "to come up!"); |
492 | else { | 492 | else { |
493 | msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); | 493 | msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); |
494 | Modem::modem->pppdExitStatus(); | 494 | Modem::modem->pppdExitStatus(); |
495 | if (Modem::modem->lastStatus != 99) {// more recent pppds only | 495 | if (Modem::modem->lastStatus != 99) {// more recent pppds only |
496 | msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); | 496 | msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); |
497 | msg += i18n("</p><p>See 'man pppd' for an explanation of the error " | 497 | msg += i18n("</p><p>See 'man pppd' for an explanation of the error " |
498 | "codes or take a look at the kppp FAQ on " | 498 | "codes or take a look at the kppp FAQ on " |
499 | " <a href=http://devel-home.kde.org/~kppp/index.html>" | 499 | " <a href=http://devel-home.kde.org/~kppp/index.html>" |
500 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); | 500 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); |
501 | } | 501 | } |
502 | } | 502 | } |
503 | 503 | ||
504 | // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) | 504 | // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) |
505 | // // PPPL_ShowLog(); | 505 | // // PPPL_ShowLog(); |
506 | // } else { /* reconnect on disconnect */ | 506 | // } else { /* reconnect on disconnect */ |
507 | if (false){ | 507 | if (false){ |
508 | qDebug( "Trying to reconnect... " ); | 508 | qDebug( "Trying to reconnect... " ); |
509 | 509 | ||
510 | if(gpppdata.authMethod() == AUTH_PAP || | 510 | if(PPPData::data()->authMethod() == AUTH_PAP || |
511 | gpppdata.authMethod() == AUTH_CHAP || | 511 | PPPData::data()->authMethod() == AUTH_CHAP || |
512 | gpppdata.authMethod() == AUTH_PAPCHAP) | 512 | PPPData::data()->authMethod() == AUTH_PAPCHAP) |
513 | Modem::modem->setSecret(gpppdata.authMethod(), | 513 | Modem::modem->setSecret(PPPData::data()->authMethod(), |
514 | encodeWord(gpppdata.storedUsername()), | 514 | encodeWord(PPPData::data()->storedUsername()), |
515 | encodeWord(gpppdata.password())); | 515 | encodeWord(PPPData::data()->password())); |
516 | 516 | ||
517 | // con_win->hide(); | 517 | // con_win->hide(); |
518 | // con_win->stopClock(); | 518 | // con_win->stopClock(); |
519 | //stopAccounting(); | 519 | //stopAccounting(); |
520 | gpppdata.setpppdRunning(false); | 520 | PPPData::data()->setpppdRunning(false); |
521 | // not in a signal handler !!!KNotifyClient::beep(); | 521 | // not in a signal handler !!!KNotifyClient::beep(); |
522 | emit cmdl_start(); | 522 | emit cmdl_start(); |
523 | } | 523 | } |
524 | } | 524 | } |
525 | gpppdata.setpppdError(0); | 525 | PPPData::data()->setpppdError(0); |
526 | } | 526 | } |
527 | } | 527 | } |
528 | 528 | ||
529 | // void KPPPWidget::sigChld() { | 529 | // void KPPPWidget::sigChld() { |
530 | // qDebug( "sigchld()" ); | 530 | // qDebug( "sigchld()" ); |
531 | // // pid_t id = wait(0L); | 531 | // // pid_t id = wait(0L); |
532 | // // if(id == helperPid && helperPid != -1) { | 532 | // // if(id == helperPid && helperPid != -1) { |
533 | // // kdDebug(5002) << "It was the setuid child that died" << endl; | 533 | // // kdDebug(5002) << "It was the setuid child that died" << endl; |
534 | // // helperPid = -1; | 534 | // // helperPid = -1; |
535 | // QString msg = i18n("kppp's helper process just died.\n" | 535 | // QString msg = i18n("kppp's helper process just died.\n" |
536 | // "Since a further execution would be pointless, " | 536 | // "Since a further execution would be pointless, " |
537 | // "kppp will shut down now."); | 537 | // "kppp will shut down now."); |
538 | // QMessageBox::warning(0L,"error", msg); | 538 | // QMessageBox::warning(0L,"error", msg); |
539 | // //remove_pidfile(); | 539 | // //remove_pidfile(); |
540 | // exit(1); | 540 | // exit(1); |
541 | // // } | 541 | // // } |
542 | // } | 542 | // } |
543 | 543 | ||
544 | 544 | ||
545 | void KPPPWidget::newdefaultaccount(int i) { | 545 | void KPPPWidget::newdefaultaccount(int i) { |
546 | gpppdata.setDefaultAccount(connectto_c->text(i)); | 546 | PPPData::data()->setDefaultAccount(connectto_c->text(i)); |
547 | gpppdata.save(); | 547 | PPPData::data()->save(); |
548 | ID_Edit->setText(gpppdata.storedUsername()); | 548 | ID_Edit->setText(PPPData::data()->storedUsername()); |
549 | PW_Edit->setText(gpppdata.storedPassword()); | 549 | PW_Edit->setText(PPPData::data()->storedPassword()); |
550 | } | 550 | } |
551 | 551 | ||
552 | 552 | ||
553 | 553 | ||
554 | 554 | ||
555 | void KPPPWidget::beginConnect() { | 555 | void KPPPWidget::beginConnect() { |
556 | // make sure to connect to the account that is selected in the combo box | 556 | // make sure to connect to the account that is selected in the combo box |
557 | // (exeption: an account given by a command line argument) | 557 | // (exeption: an account given by a command line argument) |
558 | // if(!m_bCmdlAccount) { | 558 | // if(!m_bCmdlAccount) { |
559 | // gpppdata.setAccount(connectto_c->currentText()); | 559 | // PPPData::data()->setAccount(connectto_c->currentText()); |
560 | // gpppdata.setPassword(PW_Edit->text()); | 560 | // PPPData::data()->setPassword(PW_Edit->text()); |
561 | // } else { | 561 | // } else { |
562 | gpppdata.setPassword(gpppdata.storedPassword()); | 562 | PPPData::data()->setPassword(PPPData::data()->storedPassword()); |
563 | // } | 563 | // } |
564 | 564 | ||
565 | QFileInfo info(pppdPath()); | 565 | QFileInfo info(pppdPath()); |
566 | 566 | ||
567 | if(!info.exists()){ | 567 | if(!info.exists()){ |
568 | QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" | 568 | QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" |
569 | "Make sure that pppd is installed and " | 569 | "Make sure that pppd is installed and " |
570 | "that you have entered the correct path.")); | 570 | "that you have entered the correct path.")); |
571 | return; | 571 | return; |
572 | } | 572 | } |
573 | #if 0 | 573 | #if 0 |
574 | if(!info.isExecutable()){ | 574 | if(!info.isExecutable()){ |
575 | 575 | ||
576 | QString string; | 576 | QString string; |
577 | string = i18n("kppp cannot execute:\n %1\n" | 577 | string = i18n("kppp cannot execute:\n %1\n" |
578 | "Please make sure that you have given kppp " | 578 | "Please make sure that you have given kppp " |
579 | "setuid permission and that " | 579 | "setuid permission and that " |
580 | "pppd is executable.").arg(gpppdata.pppdPath()); | 580 | "pppd is executable.").arg(PPPData::data()->pppdPath()); |
581 | KMessageBox::error(this, string); | 581 | KMessageBox::error(this, string); |
582 | return; | 582 | return; |
583 | 583 | ||
584 | } | 584 | } |
585 | #endif | 585 | #endif |
586 | 586 | ||
587 | QFileInfo info2(gpppdata.modemDevice()); | 587 | QFileInfo info2(PPPData::data()->modemDevice()); |
588 | 588 | ||
589 | if(!info2.exists()){ | 589 | if(!info2.exists()){ |
590 | QString string; | 590 | QString string; |
591 | string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " | 591 | string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " |
592 | "your modem device properly " | 592 | "your modem device properly " |
593 | "and/or adjust the location of the modem device on " | 593 | "and/or adjust the location of the modem device on " |
594 | "the modem tab of " | 594 | "the modem tab of " |
595 | "the setup dialog.").arg(gpppdata.modemDevice()); | 595 | "the setup dialog.").arg(PPPData::data()->modemDevice()); |
596 | QMessageBox::warning(this, "error", string); | 596 | QMessageBox::warning(this, "error", string); |
597 | return; | 597 | return; |
598 | } | 598 | } |
599 | 599 | ||
600 | // if this is a PAP or CHAP account, ensure that username is | 600 | // if this is a PAP or CHAP account, ensure that username is |
601 | // supplied | 601 | // supplied |
602 | if(gpppdata.authMethod() == AUTH_PAP || | 602 | if(PPPData::data()->authMethod() == AUTH_PAP || |
603 | gpppdata.authMethod() == AUTH_CHAP || | 603 | PPPData::data()->authMethod() == AUTH_CHAP || |
604 | gpppdata.authMethod() == AUTH_PAPCHAP ) { | 604 | PPPData::data()->authMethod() == AUTH_PAPCHAP ) { |
605 | if(ID_Edit->text().isEmpty()) { | 605 | if(ID_Edit->text().isEmpty()) { |
606 | QMessageBox::warning(this,"error", | 606 | QMessageBox::warning(this,"error", |
607 | i18n( | 607 | i18n( |
608 | "You have selected the authentication " | 608 | "You have selected the authentication " |
609 | "method PAP or CHAP. This requires that you " | 609 | "method PAP or CHAP. This requires that you " |
610 | "supply a username and a password!")); | 610 | "supply a username and a password!")); |
611 | return; | 611 | return; |
612 | } else { | 612 | } else { |
613 | if(!Modem::modem->setSecret(gpppdata.authMethod(), | 613 | if(!Modem::modem->setSecret(PPPData::data()->authMethod(), |
614 | encodeWord(gpppdata.storedUsername()), | 614 | encodeWord(PPPData::data()->storedUsername()), |
615 | encodeWord(gpppdata.password()))) { | 615 | encodeWord(PPPData::data()->password()))) { |
616 | QString s; | 616 | QString s; |
617 | s = i18n("Cannot create PAP/CHAP authentication\n" | 617 | s = i18n("Cannot create PAP/CHAP authentication\n" |
618 | "file \"%1\"").arg(PAP_AUTH_FILE); | 618 | "file \"%1\"").arg(PAP_AUTH_FILE); |
619 | QMessageBox::warning(this, "error", s); | 619 | QMessageBox::warning(this, "error", s); |
620 | return; | 620 | return; |
621 | } | 621 | } |
622 | } | 622 | } |
623 | } | 623 | } |
624 | 624 | ||
625 | if (gpppdata.phonenumber().isEmpty()) { | 625 | if (PPPData::data()->phonenumber().isEmpty()) { |
626 | QString s = i18n("You must specify a telephone number!"); | 626 | QString s = i18n("You must specify a telephone number!"); |
627 | QMessageBox::warning(this, "error", s); | 627 | QMessageBox::warning(this, "error", s); |
628 | return; | 628 | return; |
629 | } | 629 | } |
630 | 630 | ||
631 | this->hide(); | 631 | this->hide(); |
632 | 632 | ||
633 | QString tit = i18n("Connecting to: %1").arg(gpppdata.accname()); | 633 | QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); |
634 | // con->setCaption(tit); | 634 | // con->setCaption(tit); |
635 | 635 | ||
636 | // con->show(); | 636 | // con->show(); |
637 | 637 | ||
638 | bool show_debug = gpppdata.get_show_log_window(); | 638 | bool show_debug = PPPData::data()->get_show_log_window(); |
639 | // con->debug->setOn(show_debug);// toggle button | 639 | // con->debug->setOn(show_debug);// toggle button |
640 | debugwindow->clear(); | 640 | debugwindow->clear(); |
641 | if (!show_debug) | 641 | if (!show_debug) |
642 | debugwindow->hide(); | 642 | debugwindow->hide(); |
643 | else { | 643 | else { |
644 | debugwindow->show(); | 644 | debugwindow->show(); |
645 | // con->raise(); | 645 | // con->raise(); |
646 | } | 646 | } |
647 | 647 | ||
648 | emit begin_connect(); | 648 | emit begin_connect(); |
649 | } | 649 | } |
650 | 650 | ||
651 | 651 | ||
652 | void KPPPWidget::disconnect() { | 652 | void KPPPWidget::disconnect() { |
653 | if (!gpppdata.command_before_disconnect().isEmpty()) { | 653 | if (!PPPData::data()->command_before_disconnect().isEmpty()) { |
654 | // con_win->hide(); | 654 | // con_win->hide(); |
655 | // con->show(); | 655 | // con->show(); |
656 | // con->setCaption(i18n("Disconnecting...")); | 656 | // con->setCaption(i18n("Disconnecting...")); |
657 | // con->setMsg(i18n("Executing command before disconnection.")); | 657 | // con->setMsg(i18n("Executing command before disconnection.")); |
658 | 658 | ||
659 | qApp->processEvents(); | 659 | qApp->processEvents(); |
660 | QApplication::flushX(); | 660 | QApplication::flushX(); |
661 | // pid_t id = | 661 | // pid_t id = |
662 | execute_command(gpppdata.command_before_disconnect()); | 662 | execute_command(PPPData::data()->command_before_disconnect()); |
663 | // int i, status; | 663 | // int i, status; |
664 | 664 | ||
665 | // do { | 665 | // do { |
666 | // kapp->processEvents(); | 666 | // kapp->processEvents(); |
667 | // i = waitpid(id, &status, WNOHANG); | 667 | // i = waitpid(id, &status, WNOHANG); |
668 | // usleep(500000); | 668 | // usleep(500000); |
669 | // } while (i == 0 && errno == 0); | 669 | // } while (i == 0 && errno == 0); |
670 | 670 | ||
671 | // con->hide(); | 671 | // con->hide(); |
672 | } | 672 | } |
673 | 673 | ||
674 | qApp->processEvents(); | 674 | qApp->processEvents(); |
675 | 675 | ||
676 | // statdlg->stop_stats(); | 676 | // statdlg->stop_stats(); |
677 | Modem::modem->killPPPDaemon(); | 677 | Modem::modem->killPPPDaemon(); |
678 | 678 | ||
679 | QApplication::flushX(); | 679 | QApplication::flushX(); |
680 | execute_command(gpppdata.command_on_disconnect()); | 680 | execute_command(PPPData::data()->command_on_disconnect()); |
681 | 681 | ||
682 | Modem::modem->removeSecret(AUTH_PAP); | 682 | Modem::modem->removeSecret(AUTH_PAP); |
683 | Modem::modem->removeSecret(AUTH_CHAP); | 683 | Modem::modem->removeSecret(AUTH_CHAP); |
684 | 684 | ||
685 | removedns(); | 685 | removedns(); |
686 | Modem::modem->unlockdevice(); | 686 | Modem::modem->unlockdevice(); |
687 | 687 | ||
688 | // con_win->stopClock(); | 688 | // con_win->stopClock(); |
689 | // p_kppp->stopAccounting(); | 689 | // p_kppp->stopAccounting(); |
690 | // con_win->hide(); | 690 | // con_win->hide(); |
691 | 691 | ||
692 | // DockWidget::dock_widget->stop_stats(); | 692 | // DockWidget::dock_widget->stop_stats(); |
693 | // DockWidget::dock_widget->hide(); | 693 | // DockWidget::dock_widget->hide(); |
694 | 694 | ||
695 | // if(m_bQuitOnDisconnect) | 695 | // if(m_bQuitOnDisconnect) |
696 | // kapp->exit(0); | 696 | // kapp->exit(0); |
697 | // else { | 697 | // else { |
698 | this->quit_b->setFocus(); | 698 | this->quit_b->setFocus(); |
699 | this->show(); | 699 | this->show(); |
700 | // } | 700 | // } |
701 | } | 701 | } |
702 | 702 | ||
703 | 703 | ||
704 | // void KPPPWidget::helpbutton() { | 704 | // void KPPPWidget::helpbutton() { |
705 | // kapp->invokeHelp(); | 705 | // kapp->invokeHelp(); |
706 | // } | 706 | // } |
707 | 707 | ||
708 | 708 | ||
709 | void KPPPWidget::quitbutton() { | 709 | void KPPPWidget::quitbutton() { |
710 | if(gpppdata.pppdRunning()) { | 710 | if(PPPData::data()->pppdRunning()) { |
711 | int ok = QMessageBox::warning(this, | 711 | int ok = QMessageBox::warning(this, |
712 | i18n("Exiting kPPP will close your PPP Session."), | 712 | i18n("Exiting kPPP will close your PPP Session."), |
713 | i18n("Quit kPPP?")); | 713 | i18n("Quit kPPP?")); |
714 | if(ok == QMessageBox::Yes) { | 714 | if(ok == QMessageBox::Yes) { |
715 | Modem::modem->killPPPDaemon(); | 715 | Modem::modem->killPPPDaemon(); |
716 | QApplication::flushX(); | 716 | QApplication::flushX(); |
717 | execute_command(gpppdata.command_on_disconnect()); | 717 | execute_command(PPPData::data()->command_on_disconnect()); |
718 | removedns(); | 718 | removedns(); |
719 | Modem::modem->unlockdevice(); | 719 | Modem::modem->unlockdevice(); |
720 | } | 720 | } |
721 | } else { | 721 | } else { |
722 | if (!gpppdata.accname().isEmpty() && !gpppdata.storePassword()) | 722 | if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword()) |
723 | gpppdata.setStoredPassword(""); | 723 | PPPData::data()->setStoredPassword(""); |
724 | } | 724 | } |
725 | gpppdata.save(); | 725 | PPPData::data()->save(); |
726 | qApp->quit(); | 726 | qApp->quit(); |
727 | } | 727 | } |
728 | 728 | ||
729 | 729 | ||
730 | // void KPPPWidget::rulesetLoadError() { | 730 | // void KPPPWidget::rulesetLoadError() { |
731 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); | 731 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); |
732 | // } | 732 | // } |
733 | 733 | ||
734 | 734 | ||
735 | // void KPPPWidget::startAccounting() { | 735 | // void KPPPWidget::startAccounting() { |
736 | // // volume accounting | 736 | // // volume accounting |
737 | // stats->totalbytes = 0; | 737 | // stats->totalbytes = 0; |
738 | 738 | ||
739 | // kdDebug() << "AcctEnabled: " << gpppdata.AcctEnabled() << endl; | 739 | // kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl; |
740 | 740 | ||
741 | // // load the ruleset | 741 | // // load the ruleset |
742 | // if(!gpppdata.AcctEnabled()) | 742 | // if(!PPPData::data()->AcctEnabled()) |
743 | // return; | 743 | // return; |
744 | 744 | ||
745 | // QString d = AccountingBase::getAccountingFile(gpppdata.accountingFile()); | 745 | // QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile()); |
746 | // // if(::access(d.data(), X_OK) != 0) | 746 | // // if(::access(d.data(), X_OK) != 0) |
747 | // acct = new Accounting(this, stats); | 747 | // acct = new Accounting(this, stats); |
748 | // // else | 748 | // // else |
749 | // // acct = new ExecutableAccounting(this); | 749 | // // acct = new ExecutableAccounting(this); |
750 | 750 | ||
751 | // // connect to the accounting object | 751 | // // connect to the accounting object |
752 | // connect(acct, SIGNAL(changed(QString, QString)), | 752 | // connect(acct, SIGNAL(changed(QString, QString)), |
753 | // con_win, SLOT(slotAccounting(QString, QString))); | 753 | // con_win, SLOT(slotAccounting(QString, QString))); |
754 | 754 | ||
755 | // // if(!acct->loadRuleSet(gpppdata.accountingFile())) { | 755 | // // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) { |
756 | // // QString s= i18n("Can not load the accounting " | 756 | // // QString s= i18n("Can not load the accounting " |
757 | // // "ruleset \"%1\"!").arg(gpppdata.accountingFile()); | 757 | // // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile()); |
758 | 758 | ||
759 | // // starting the messagebox with a timer will prevent us | 759 | // // starting the messagebox with a timer will prevent us |
760 | // // from blocking the calling function ConnectWidget::timerEvent | 760 | // // from blocking the calling function ConnectWidget::timerEvent |
761 | // ruleset_load_errmsg = s; | 761 | // ruleset_load_errmsg = s; |
762 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); | 762 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); |
763 | // return; | 763 | // return; |
764 | // } | 764 | // } |
765 | // //else | 765 | // //else |
766 | // // acct->slotStart(); | 766 | // // acct->slotStart(); |
767 | // } | 767 | // } |
768 | 768 | ||
769 | // void KPPPWidget::stopAccounting() { | 769 | // void KPPPWidget::stopAccounting() { |
770 | // // store volume accounting | 770 | // // store volume accounting |
771 | // // if(stats->totalbytes != 0) | 771 | // // if(stats->totalbytes != 0) |
772 | // // gpppdata.setTotalBytes(stats->totalbytes); | 772 | // // PPPData::data()->setTotalBytes(stats->totalbytes); |
773 | 773 | ||
774 | // if(!gpppdata.AcctEnabled()) | 774 | // if(!PPPData::data()->AcctEnabled()) |
775 | // return; | 775 | // return; |
776 | 776 | ||
777 | // // if(acct != 0) { | 777 | // // if(acct != 0) { |
778 | // // acct->slotStop(); | 778 | // // acct->slotStop(); |
779 | // // delete acct; | 779 | // // delete acct; |
780 | // // acct = 0; | 780 | // // acct = 0; |
781 | // // } | 781 | // // } |
782 | // } | 782 | // } |
783 | 783 | ||
784 | 784 | ||
785 | // void KPPPWidget::showStats() { | 785 | // void KPPPWidget::showStats() { |
786 | // if(statdlg) { | 786 | // if(statdlg) { |
787 | // statdlg->show(); | 787 | // statdlg->show(); |
788 | // statdlg->raise(); | 788 | // statdlg->raise(); |
789 | // } | 789 | // } |
790 | // } | 790 | // } |
791 | 791 | ||
792 | 792 | ||
793 | void KPPPWidget::usernameChanged(const QString &) { | 793 | void KPPPWidget::usernameChanged(const QString &) { |
794 | // store username for later use | 794 | // store username for later use |
795 | gpppdata.setStoredUsername(ID_Edit->text()); | 795 | PPPData::data()->setStoredUsername(ID_Edit->text()); |
796 | } | 796 | } |
797 | 797 | ||
798 | 798 | ||
799 | void KPPPWidget::passwordChanged(const QString &) { | 799 | void KPPPWidget::passwordChanged(const QString &) { |
800 | // store the password if so requested | 800 | // store the password if so requested |
801 | if(gpppdata.storePassword()) | 801 | if(PPPData::data()->storePassword()) |
802 | gpppdata.setStoredPassword(PW_Edit->text()); | 802 | PPPData::data()->setStoredPassword(PW_Edit->text()); |
803 | else | 803 | else |
804 | gpppdata.setStoredPassword(""); | 804 | PPPData::data()->setStoredPassword(""); |
805 | } | 805 | } |
806 | 806 | ||
807 | 807 | ||
808 | void KPPPWidget::setPW_Edit(const QString &pw) { | 808 | void KPPPWidget::setPW_Edit(const QString &pw) { |
809 | PW_Edit->setText(pw); | 809 | PW_Edit->setText(pw); |
810 | } | 810 | } |
811 | 811 | ||
812 | 812 | ||
813 | // void KPPPWidget::resetCosts(const QString &s) { | 813 | // void KPPPWidget::resetCosts(const QString &s) { |
814 | // AccountingBase::resetCosts(s); | 814 | // AccountingBase::resetCosts(s); |
815 | // } | 815 | // } |
816 | 816 | ||
817 | 817 | ||
818 | // void KPPPWidget::resetVolume(const QString &s) { | 818 | // void KPPPWidget::resetVolume(const QString &s) { |
819 | // AccountingBase::resetVolume(s); | 819 | // AccountingBase::resetVolume(s); |
820 | // } | 820 | // } |
821 | 821 | ||
822 | /** | 822 | /** |
823 | * pppd's getword() function knows about escape characters. | 823 | * pppd's getword() function knows about escape characters. |
824 | * If we write the username and password to the secrets file | 824 | * If we write the username and password to the secrets file |
825 | * we'll therefore have to escape back slashes. | 825 | * we'll therefore have to escape back slashes. |
826 | */ | 826 | */ |
827 | QString KPPPWidget::encodeWord(const QString &s) { | 827 | QString KPPPWidget::encodeWord(const QString &s) { |
828 | QString r = s; | 828 | QString r = s; |
829 | r.replace(QRegExp("\\"), "\\\\"); | 829 | r.replace(QRegExp("\\"), "\\\\"); |
830 | return r; | 830 | return r; |
831 | } | 831 | } |
832 | 832 | ||
833 | // void KPPPWidget::setQuitOnDisconnect (bool b) | 833 | // void KPPPWidget::setQuitOnDisconnect (bool b) |
834 | // { | 834 | // { |
835 | // m_bQuitOnDisconnect = b; | 835 | // m_bQuitOnDisconnect = b; |
836 | // } | 836 | // } |
837 | 837 | ||
838 | void KPPPWidget::showNews() { | 838 | void KPPPWidget::showNews() { |
839 | #ifdef KPPP_SHOW_NEWS | 839 | #ifdef KPPP_SHOW_NEWS |
840 | /* | 840 | /* |
841 | * Introduce the QuickHelp feature to new users of this version | 841 | * Introduce the QuickHelp feature to new users of this version |
842 | */ | 842 | */ |
843 | #define QUICKHELP_HINT "Hint_QuickHelp" | 843 | #define QUICKHELP_HINT "Hint_QuickHelp" |
844 | if(gpppdata.readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { | 844 | if(PPPData::data()->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { |
845 | QDialog dlg(0, 0, true); | 845 | QDialog dlg(0, 0, true); |
846 | dlg.setCaption(i18n("Recent Changes in KPPP")); | 846 | dlg.setCaption(i18n("Recent Changes in KPPP")); |
847 | 847 | ||
848 | QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); | 848 | QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); |
849 | QHBoxLayout *l1 = new QHBoxLayout(10); | 849 | QHBoxLayout *l1 = new QHBoxLayout(10); |
850 | QVBoxLayout *l2 = new QVBoxLayout(10); | 850 | QVBoxLayout *l2 = new QVBoxLayout(10); |
851 | tl->addLayout(l1); | 851 | tl->addLayout(l1); |
852 | 852 | ||
853 | QLabel *icon = new QLabel(&dlg); | 853 | QLabel *icon = new QLabel(&dlg); |
854 | icon->setPixmap(BarIcon("exclamation")); | 854 | icon->setPixmap(BarIcon("exclamation")); |
855 | icon->setFixedSize(icon->sizeHint()); | 855 | icon->setFixedSize(icon->sizeHint()); |
856 | l1->addWidget(icon); | 856 | l1->addWidget(icon); |
857 | l1->addLayout(l2); | 857 | l1->addLayout(l2); |
858 | 858 | ||
859 | QLabel *l = new QLabel(i18n("From version 1.4.8 on, kppp has a new feature\n" | 859 | QLabel *l = new QLabel(i18n("From version 1.4.8 on, kppp has a new feature\n" |
860 | "called \"Quickhelp\". It's similar to a tooltip,\n" | 860 | "called \"Quickhelp\". It's similar to a tooltip,\n" |
861 | "but you can activate it whenever you want.\n" | 861 | "but you can activate it whenever you want.\n" |
862 | "\n" | 862 | "\n" |
863 | "To activate it, simply click on a control like\n" | 863 | "To activate it, simply click on a control like\n" |
864 | "a button or a label with the right mouse button.\n" | 864 | "a button or a label with the right mouse button.\n" |
865 | "If the item supports Quickhelp, a popup menu\n" | 865 | "If the item supports Quickhelp, a popup menu\n" |
866 | "will appear leading to Quickhelp.\n" | 866 | "will appear leading to Quickhelp.\n" |
867 | "\n" | 867 | "\n" |
868 | "To test it, right-click somewhere in this text."), | 868 | "To test it, right-click somewhere in this text."), |
@@ -872,34 +872,34 @@ void KPPPWidget::showNews() { | |||
872 | cb->setFixedSize(cb->sizeHint()); | 872 | cb->setFixedSize(cb->sizeHint()); |
873 | 873 | ||
874 | KButtonBox *bbox = new KButtonBox(&dlg); | 874 | KButtonBox *bbox = new KButtonBox(&dlg); |
875 | bbox->addStretch(1); | 875 | bbox->addStretch(1); |
876 | QPushButton *ok = bbox->addButton(i18n("OK")); | 876 | QPushButton *ok = bbox->addButton(i18n("OK")); |
877 | ok->setDefault(true); | 877 | ok->setDefault(true); |
878 | dlg.connect(ok, SIGNAL(clicked()), | 878 | dlg.connect(ok, SIGNAL(clicked()), |
879 | &dlg, SLOT(accept())); | 879 | &dlg, SLOT(accept())); |
880 | bbox->addStretch(1); | 880 | bbox->addStretch(1); |
881 | bbox->layout(); | 881 | bbox->layout(); |
882 | 882 | ||
883 | l2->addWidget(l); | 883 | l2->addWidget(l); |
884 | l2->addWidget(cb); | 884 | l2->addWidget(cb); |
885 | tl->addWidget(bbox); | 885 | tl->addWidget(bbox); |
886 | 886 | ||
887 | QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n" | 887 | QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n" |
888 | "This window will stay open until you\n" | 888 | "This window will stay open until you\n" |
889 | "click a mouse button or a press a key.\n"); | 889 | "click a mouse button or a press a key.\n"); |
890 | 890 | ||
891 | QWhatsThis::add(cb,tmp); | 891 | QWhatsThis::add(cb,tmp); |
892 | QWhatsThis::add(l, tmp); | 892 | QWhatsThis::add(l, tmp); |
893 | 893 | ||
894 | dlg.exec(); | 894 | dlg.exec(); |
895 | if(cb->isChecked()) { | 895 | if(cb->isChecked()) { |
896 | gpppdata.writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); | 896 | PPPData::data()->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); |
897 | gpppdata.save(); | 897 | PPPData::data()->save(); |
898 | } | 898 | } |
899 | } | 899 | } |
900 | #endif | 900 | #endif |
901 | } | 901 | } |
902 | 902 | ||
903 | 903 | ||
904 | //#include "kpppwidget.moc" | 904 | //#include "kpppwidget.moc" |
905 | 905 | ||