Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/kpppwidget.cpp | 461 |
1 files changed, 235 insertions, 226 deletions
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index f8a8dc3..289e9f5 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp | |||
@@ -28,24 +28,25 @@ | |||
28 | 28 | ||
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qevent.h> | 32 | #include <qevent.h> |
33 | #include <qdialog.h> | 33 | #include <qdialog.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
38 | #include <qdialog.h> | 38 | #include <qdialog.h> |
39 | #include <qwhatsthis.h> | 39 | #include <qwhatsthis.h> |
40 | #include <qcheckbox.h> | ||
40 | 41 | ||
41 | // #include <kaboutdata.h> | 42 | // #include <kaboutdata.h> |
42 | // #include <kapplication.h> | 43 | // #include <kapplication.h> |
43 | #include <qbuttongroup.h> | 44 | #include <qbuttongroup.h> |
44 | //#include <kcmdlineargs.h> | 45 | //#include <kcmdlineargs.h> |
45 | //#include <kconfig.h> | 46 | //#include <kconfig.h> |
46 | //#include <kdebug.h> | 47 | //#include <kdebug.h> |
47 | #define i18n QObject::tr | 48 | #define i18n QObject::tr |
48 | //#include <kiconloader.h> // For BarIcon | 49 | //#include <kiconloader.h> // For BarIcon |
49 | //#include <klocale.h> | 50 | //#include <klocale.h> |
50 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
51 | // #include <kseparator.h> | 52 | // #include <kseparator.h> |
@@ -61,229 +62,237 @@ | |||
61 | 62 | ||
62 | #include "runtests.h" | 63 | #include "runtests.h" |
63 | 64 | ||
64 | //#include "main.h" | 65 | //#include "main.h" |
65 | #include "auth.h" | 66 | #include "auth.h" |
66 | #include "modem.h" | 67 | #include "modem.h" |
67 | //#include "ppplog.h" | 68 | //#include "ppplog.h" |
68 | //#include "opener.h" | 69 | //#include "opener.h" |
69 | //#include "requester.h" | 70 | //#include "requester.h" |
70 | //#include "pppstats.h" | 71 | //#include "pppstats.h" |
71 | #include "pppdata.h" | 72 | #include "pppdata.h" |
72 | #include "general.h" | 73 | #include "general.h" |
74 | #include "interface.h" | ||
73 | 75 | ||
74 | #define execute_command system | 76 | #define execute_command system |
75 | 77 | ||
76 | KPPPWidget *p_kppp = 0; | 78 | KPPPWidget *p_kppp = 0; |
77 | 79 | ||
78 | KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl ) | 80 | KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) |
79 | : QDialog(parent, name, modal, fl) | 81 | : QDialog(parent, name, modal, fl), _pppdata(pd) |
80 | // , acct(0) | ||
81 | // , m_bCmdlAccount (false) | ||
82 | { | 82 | { |
83 | // tabWindow = 0; | 83 | // tabWindow = 0; |
84 | p_kppp = this; | 84 | p_kppp = this; |
85 | // before doing anything else, run a few tests | 85 | // before doing anything else, run a few tests |
86 | if (!_pppdata->setModemDevice( i->getInterfaceName() )) | ||
87 | _pppdata->setModemDevice("/dev/modem"); | ||
88 | qDebug("PPPConfigWidget::PPPConfigWidget"); | ||
89 | qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); | ||
90 | if (!_pppdata->setAccount( i->getHardwareName() )) | ||
91 | _pppdata->setAccount( 0 ); | ||
92 | |||
93 | qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); | ||
94 | qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); | ||
86 | 95 | ||
87 | int result = runTests(); | 96 | int result = runTests(); |
88 | if(result == TEST_CRITICAL) | 97 | if(result == TEST_CRITICAL) |
89 | exit(4); | 98 | exit(4); |
90 | 99 | ||
91 | // installEventFilter(this); | 100 | // installEventFilter(this); |
92 | 101 | ||
93 | // QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); | 102 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); |
94 | 103 | ||
95 | // QGridLayout *l1 = new QGridLayout(3, 4); | 104 | QGridLayout *l1 = new QGridLayout(3, 4); |
96 | // tl->addLayout(l1); | 105 | tl->addLayout(l1); |
97 | // l1->addColSpacing(0, 10); | 106 | l1->addColSpacing(0, 10); |
98 | // l1->addColSpacing(3, 10); | 107 | l1->addColSpacing(3, 10); |
99 | // l1->setColStretch(1, 3); | 108 | l1->setColStretch(1, 3); |
100 | // l1->setColStretch(2, 4); | 109 | l1->setColStretch(2, 4); |
101 | 110 | ||
102 | // label1 = new QLabel(i18n("C&onnect to: "), this); | 111 | label1 = new QLabel(i18n("C&onnect to: "), this); |
103 | // l1->addWidget(label1, 0, 1); | 112 | l1->addWidget(label1, 0, 1); |
104 | 113 | ||
105 | // connectto_c = new QComboBox(false, this); | 114 | connectto_c = new QComboBox(false, this); |
106 | // label1->setBuddy(connectto_c); | 115 | label1->setBuddy(connectto_c); |
107 | 116 | ||
108 | // connect(connectto_c, SIGNAL(activated(int)), | 117 | connect(connectto_c, SIGNAL(activated(int)), |
109 | // SLOT(newdefaultaccount(int))); | 118 | SLOT(newdefaultaccount(int))); |
110 | // l1->addWidget(connectto_c, 0, 2); | 119 | l1->addWidget(connectto_c, 0, 2); |
111 | 120 | ||
112 | // ID_Label = new QLabel(i18n("&Login ID:"), this); | 121 | ID_Label = new QLabel(i18n("&Login ID:"), this); |
113 | // l1->addWidget(ID_Label, 1, 1); | 122 | l1->addWidget(ID_Label, 1, 1); |
114 | 123 | ||
115 | // // the entry line for usernames | 124 | // the entry line for usernames |
116 | // ID_Edit = new QLineEdit(this); | 125 | ID_Edit = new QLineEdit(this); |
117 | // ID_Label->setBuddy(ID_Edit); | 126 | ID_Label->setBuddy(ID_Edit); |
118 | // l1->addWidget(ID_Edit, 1, 2); | 127 | l1->addWidget(ID_Edit, 1, 2); |
119 | // connect(ID_Edit, SIGNAL(returnPressed()), | 128 | connect(ID_Edit, SIGNAL(returnPressed()), |
120 | // this, SLOT(enterPressedInID())); | 129 | this, SLOT(enterPressedInID())); |
121 | // QString tmp = i18n("<p>Type in the username that you got from your\n" | 130 | QString tmp = i18n("<p>Type in the username that you got from your\n" |
122 | // "ISP. This is especially important for PAP\n" | 131 | "ISP. This is especially important for PAP\n" |
123 | // "and CHAP. You may omit this when you use\n" | 132 | "and CHAP. You may omit this when you use\n" |
124 | // "terminal-based or script-based authentication.\n" | 133 | "terminal-based or script-based authentication.\n" |
125 | // "\n" | 134 | "\n" |
126 | // "<b>Important</b>: case is important here:\n" | 135 | "<b>Important</b>: case is important here:\n" |
127 | // "<i>myusername</i> is not the same as <i>MyUserName</i>!"); | 136 | "<i>myusername</i> is not the same as <i>MyUserName</i>!"); |
128 | 137 | ||
129 | // QWhatsThis::add(ID_Label,tmp); | 138 | QWhatsThis::add(ID_Label,tmp); |
130 | // QWhatsThis::add(ID_Edit,tmp); | 139 | QWhatsThis::add(ID_Edit,tmp); |
131 | 140 | ||
132 | // PW_Label = new QLabel(i18n("&Password:"), this); | 141 | PW_Label = new QLabel(i18n("&Password:"), this); |
133 | // l1->addWidget(PW_Label, 2, 1); | 142 | l1->addWidget(PW_Label, 2, 1); |
134 | 143 | ||
135 | // PW_Edit= new QLineEdit(this); | 144 | PW_Edit= new QLineEdit(this); |
136 | // PW_Label->setBuddy(PW_Edit); | 145 | PW_Label->setBuddy(PW_Edit); |
137 | // PW_Edit->setEchoMode(QLineEdit::Password); | 146 | PW_Edit->setEchoMode(QLineEdit::Password); |
138 | // l1->addWidget(PW_Edit, 2, 2); | 147 | l1->addWidget(PW_Edit, 2, 2); |
139 | // connect(PW_Edit, SIGNAL(returnPressed()), | 148 | connect(PW_Edit, SIGNAL(returnPressed()), |
140 | // this, SLOT(enterPressedInPW())); | 149 | this, SLOT(enterPressedInPW())); |
141 | 150 | ||
142 | // tmp = i18n("<p>Type in the password that you got from your\n" | 151 | tmp = i18n("<p>Type in the password that you got from your\n" |
143 | // "ISP. This is especially important for PAP\n" | 152 | "ISP. This is especially important for PAP\n" |
144 | // "and CHAP. You may omit this when you use\n" | 153 | "and CHAP. You may omit this when you use\n" |
145 | // "terminal-based or script-based authentication.\n" | 154 | "terminal-based or script-based authentication.\n" |
146 | // "\n" | 155 | "\n" |
147 | // "<b>Important</b>: case is important here:\n" | 156 | "<b>Important</b>: case is important here:\n" |
148 | // "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); | 157 | "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); |
149 | 158 | ||
150 | // QWhatsThis::add(PW_Label,tmp); | 159 | QWhatsThis::add(PW_Label,tmp); |
151 | // QWhatsThis::add(PW_Edit,tmp); | 160 | QWhatsThis::add(PW_Edit,tmp); |
152 | 161 | ||
153 | // QHBoxLayout *l3 = new QHBoxLayout; | 162 | QHBoxLayout *l3 = new QHBoxLayout; |
154 | // tl->addSpacing(5); | 163 | tl->addSpacing(5); |
155 | // tl->addLayout(l3); | 164 | tl->addLayout(l3); |
156 | // tl->addSpacing(5); | 165 | tl->addSpacing(5); |
157 | // l3->addSpacing(10); | 166 | l3->addSpacing(10); |
158 | // log = new QCheckBox(i18n("Show lo&g window"), this); | 167 | log = new QCheckBox(i18n("Show lo&g window"), this); |
159 | // connect(log, SIGNAL(toggled(bool)), | 168 | connect(log, SIGNAL(toggled(bool)), |
160 | // this, SLOT(log_window_toggled(bool))); | 169 | this, SLOT(log_window_toggled(bool))); |
161 | // log->setChecked(PPPData::data()->get_show_log_window()); | 170 | log->setChecked(_pppdata->get_show_log_window()); |
162 | // l3->addWidget(log); | 171 | l3->addWidget(log); |
163 | 172 | ||
164 | // QWhatsThis::add(log, | 173 | QWhatsThis::add(log, |
165 | // i18n("<p>This controls whether a log window is shown.\n" | 174 | i18n("<p>This controls whether a log window is shown.\n" |
166 | // "A log window shows the communication between\n" | 175 | "A log window shows the communication between\n" |
167 | // "<i>kppp</i> and your modem. This will help you\n" | 176 | "<i>kppp</i> and your modem. This will help you\n" |
168 | // "in tracking down problems.\n" | 177 | "in tracking down problems.\n" |
169 | // "\n" | 178 | "\n" |
170 | // "Turn it off if <i>kppp</i> routinely connects without\n" | 179 | "Turn it off if <i>kppp</i> routinely connects without\n" |
171 | // "problems")); | 180 | "problems")); |
172 | 181 | ||
173 | // // fline = new QSeparator( KSeparator::HLine, this); | 182 | // fline = new QSeparator( KSeparator::HLine, this); |
174 | // // tl->addWidget(fline); | 183 | // tl->addWidget(fline); |
175 | 184 | ||
176 | // QHBoxLayout *l2 = new QHBoxLayout(this); | 185 | QHBoxLayout *l2 = new QHBoxLayout(this); |
177 | // tl->addLayout(l2); | 186 | tl->addLayout(l2); |
178 | 187 | ||
179 | // int minw = 0; | 188 | int minw = 0; |
180 | // quit_b = new QPushButton(i18n("&Quit"), this); | 189 | quit_b = new QPushButton(i18n("&Quit"), this); |
181 | // // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); | 190 | // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); |
182 | // connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); | 191 | connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); |
183 | // if(quit_b->sizeHint().width() > minw) | 192 | if(quit_b->sizeHint().width() > minw) |
184 | // minw = quit_b->sizeHint().width(); | 193 | minw = quit_b->sizeHint().width(); |
185 | 194 | ||
186 | // setup_b = new QPushButton(i18n("&Setup..."), this); | 195 | setup_b = new QPushButton(i18n("&Setup..."), this); |
187 | // // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); | 196 | // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); |
188 | // connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); | 197 | connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); |
189 | // if(setup_b->sizeHint().width() > minw) | 198 | if(setup_b->sizeHint().width() > minw) |
190 | // minw = setup_b->sizeHint().width(); | 199 | minw = setup_b->sizeHint().width(); |
191 | 200 | ||
192 | 201 | ||
193 | 202 | ||
194 | // if(PPPData::data()->access() != KConfig::ReadWrite) | 203 | // if(_pppdata->access() != KConfig::ReadWrite) |
195 | // setup_b->setEnabled(false); | 204 | // setup_b->setEnabled(false); |
196 | 205 | ||
197 | // help_b = new QPushButton(i18n("&Help"), this); | 206 | // help_b = new QPushButton(i18n("&Help"), this); |
198 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); | 207 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); |
199 | 208 | ||
200 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); | 209 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); |
201 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); | 210 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); |
202 | // help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); | 211 | // help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); |
203 | 212 | ||
204 | // if(help_b->sizeHint().width() > minw) | 213 | // if(help_b->sizeHint().width() > minw) |
205 | // minw = help_b->sizeHint().width(); | 214 | // minw = help_b->sizeHint().width(); |
206 | 215 | ||
207 | // connect_b = new QPushButton(i18n("&Connect"), this); | 216 | connect_b = new QPushButton(i18n("&Connect"), this); |
208 | // connect_b->setDefault(true); | 217 | connect_b->setDefault(true); |
209 | // connect_b->setFocus(); | 218 | connect_b->setFocus(); |
210 | // connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); | 219 | connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); |
211 | // if(connect_b->sizeHint().width() > minw) | 220 | if(connect_b->sizeHint().width() > minw) |
212 | // minw = connect_b->sizeHint().width(); | 221 | minw = connect_b->sizeHint().width(); |
213 | 222 | ||
214 | // quit_b->setFixedWidth(minw); | 223 | quit_b->setFixedWidth(minw); |
215 | // setup_b->setFixedWidth(minw); | 224 | setup_b->setFixedWidth(minw); |
216 | // // help_b->setFixedWidth(help_b->sizeHint().width()); | 225 | // help_b->setFixedWidth(help_b->sizeHint().width()); |
217 | // connect_b->setFixedWidth(minw); | 226 | connect_b->setFixedWidth(minw); |
218 | 227 | ||
219 | // l2->addWidget(quit_b); | 228 | l2->addWidget(quit_b); |
220 | // l2->addWidget(setup_b); | 229 | l2->addWidget(setup_b); |
221 | // // l2->addWidget(help_b); | 230 | // l2->addWidget(help_b); |
222 | // l2->addSpacing(20); | 231 | l2->addSpacing(20); |
223 | // l2->addWidget(connect_b); | 232 | l2->addWidget(connect_b); |
224 | 233 | ||
225 | setFixedSize(sizeHint()); | 234 | setFixedSize(sizeHint()); |
226 | 235 | ||
227 | (void)new Modem; | 236 | (void)new Modem(_pppdata); |
228 | 237 | ||
229 | // we also connect cmld_start to the beginConnect so that I can run | 238 | // we also connect cmld_start to the beginConnect so that I can run |
230 | // the dialer through a command line argument | 239 | // the dialer through a command line argument |
231 | connect(this,SIGNAL(cmdl_start()),this,SLOT(beginConnect())); | 240 | connect(this,SIGNAL(cmdl_start()),this,SLOT(beginConnect())); |
232 | 241 | ||
233 | // stats = new PPPStats; | 242 | // stats = new PPPStats; |
234 | 243 | ||
235 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 244 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
236 | 245 | ||
237 | // constructor of con_win reads position from config file | 246 | // constructor of con_win reads position from config file |
238 | // con_win = new ConWindow(0, "conw", this); | 247 | con_win = new ConWindow(_pppdata, 0, "conw", this); |
239 | // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon()); | 248 | // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon()); |
240 | 249 | ||
241 | // statdlg = new PPPStatsDlg(0, "stats", this, stats); | 250 | // statdlg = new PPPStatsDlg(0, "stats", this, stats); |
242 | // statdlg->hide(); | 251 | // statdlg->hide(); |
243 | 252 | ||
244 | // load up the accounts combo box | 253 | // load up the accounts combo box |
245 | 254 | ||
246 | // resetaccounts(); | 255 | // resetaccounts(); |
247 | // con = new ConnectWidget(0, "con"); | 256 | con = new ConnectWidget(_pppdata, 0, "con"); |
248 | //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() ); | 257 | //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() ); |
249 | // connect(this, SIGNAL(begin_connect()),con, SLOT(preinit())); | 258 | connect(this, SIGNAL(begin_connect()),con, SLOT(preinit())); |
250 | // Is this the best we can do here? it's not right. | 259 | // Is this the best we can do here? it's not right. |
251 | // QRect desk = QApplication::desktop()->screenGeometry( | 260 | // QRect desk = QApplication::desktop()->screenGeometry( |
252 | // QApplication::desktop()->screenNumber(topLevelWidget())); | 261 | // QApplication::desktop()->screenNumber(topLevelWidget())); |
253 | // con->setGeometry(desk.center().x()-175, desk.center().y()-55, 350,110); | 262 | // con->setGeometry(desk.center().x()-175, desk.center().y()-55, 350,110); |
254 | 263 | ||
255 | // connect the ConnectWidgets various signals | 264 | // connect the ConnectWidgets various signals |
256 | // // connect(con, SIGNAL(startAccounting()), | 265 | connect(con, SIGNAL(startAccounting()), |
257 | // // this, SLOT(startAccounting())); | 266 | this, SLOT(startAccounting())); |
258 | // // connect(con, SIGNAL(stopAccounting()), | 267 | connect(con, SIGNAL(stopAccounting()), |
259 | // // this, SLOT(stopAccounting())); | 268 | this, SLOT(stopAccounting())); |
260 | // connect(qApp, SIGNAL(saveYourself()), | 269 | connect(qApp, SIGNAL(saveYourself()), |
261 | // this, SLOT(saveMyself())); | 270 | this, SLOT(saveMyself())); |
262 | // connect(qApp, SIGNAL(shutDown()), | 271 | connect(qApp, SIGNAL(shutDown()), |
263 | // this, SLOT(shutDown())); | 272 | this, SLOT(shutDown())); |
264 | 273 | ||
265 | 274 | ||
266 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 275 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
267 | 276 | ||
268 | // m_strCmdlAccount = args->getOption("c"); | 277 | // m_strCmdlAccount = args->getOption("c"); |
269 | // m_bQuitOnDisconnect = args->isSet("q"); | 278 | // m_bQuitOnDisconnect = args->isSet("q"); |
270 | 279 | ||
271 | // if(!m_strCmdlAccount.isEmpty()) { | 280 | // if(!m_strCmdlAccount.isEmpty()) { |
272 | // m_bCmdlAccount = true; | 281 | // m_bCmdlAccount = true; |
273 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; | 282 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; |
274 | // } | 283 | // } |
275 | 284 | ||
276 | // if(m_bCmdlAccount){ | 285 | // if(m_bCmdlAccount){ |
277 | // bool result = PPPData::data()->setAccount(m_strCmdlAccount); | 286 | // bool result = _pppdata->setAccount(m_strCmdlAccount); |
278 | // if (!result){ | 287 | // if (!result){ |
279 | // QString string; | 288 | // QString string; |
280 | // string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); | 289 | // string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); |
281 | // KMessageBox::error(this, string); | 290 | // KMessageBox::error(this, string); |
282 | // m_bCmdlAccount = false; | 291 | // m_bCmdlAccount = false; |
283 | // this->show(); | 292 | // this->show(); |
284 | // } else { | 293 | // } else { |
285 | // beginConnect(); | 294 | // beginConnect(); |
286 | // } | 295 | // } |
287 | // } else | 296 | // } else |
288 | // expandbutton(); | 297 | // expandbutton(); |
289 | // show(); | 298 | // show(); |
@@ -337,454 +346,454 @@ KPPPWidget::~KPPPWidget() | |||
337 | 346 | ||
338 | void KPPPWidget::enterPressedInID() { | 347 | void KPPPWidget::enterPressedInID() { |
339 | PW_Edit->setFocus(); | 348 | PW_Edit->setFocus(); |
340 | } | 349 | } |
341 | 350 | ||
342 | 351 | ||
343 | void KPPPWidget::enterPressedInPW() { | 352 | void KPPPWidget::enterPressedInPW() { |
344 | connect_b->setFocus(); | 353 | connect_b->setFocus(); |
345 | } | 354 | } |
346 | 355 | ||
347 | // triggered by the session manager | 356 | // triggered by the session manager |
348 | void KPPPWidget::saveMyself() { | 357 | void KPPPWidget::saveMyself() { |
349 | PPPData::data()->save(); | 358 | _pppdata->save(); |
350 | } | 359 | } |
351 | 360 | ||
352 | void KPPPWidget::shutDown() { | 361 | void KPPPWidget::shutDown() { |
353 | interruptConnection(); | 362 | interruptConnection(); |
354 | saveMyself(); | 363 | saveMyself(); |
355 | } | 364 | } |
356 | 365 | ||
357 | void KPPPWidget::log_window_toggled(bool on) { | 366 | void KPPPWidget::log_window_toggled(bool on) { |
358 | PPPData::data()->set_show_log_window(on); | 367 | _pppdata->set_show_log_window(on); |
359 | } | 368 | } |
360 | 369 | ||
361 | 370 | ||
362 | 371 | ||
363 | 372 | ||
364 | // void KPPPWidget::resetaccounts() { | 373 | // void KPPPWidget::resetaccounts() { |
365 | // connectto_c->clear(); | 374 | // connectto_c->clear(); |
366 | 375 | ||
367 | // int count = PPPData::data()->count(); | 376 | // int count = _pppdata->count(); |
368 | 377 | ||
369 | // // enable/disable controls | 378 | // // enable/disable controls |
370 | // connectto_c->setEnabled(count > 0); | 379 | // connectto_c->setEnabled(count > 0); |
371 | // connect_b->setEnabled(count > 0); | 380 | // connect_b->setEnabled(count > 0); |
372 | // log->setEnabled(count > 0); | 381 | // log->setEnabled(count > 0); |
373 | // ID_Edit->setEnabled(count > 0); | 382 | // ID_Edit->setEnabled(count > 0); |
374 | // PW_Edit->setEnabled(count > 0); | 383 | // PW_Edit->setEnabled(count > 0); |
375 | 384 | ||
376 | // //load the accounts | 385 | // //load the accounts |
377 | // for(int i=0; i < count; i++) { | 386 | // for(int i=0; i < count; i++) { |
378 | // PPPData::data()->setAccountbyIndex(i); | 387 | // _pppdata->setAccountbyIndex(i); |
379 | // connectto_c->insertItem(PPPData::data()->accname()); | 388 | // connectto_c->insertItem(_pppdata->accname()); |
380 | // } | 389 | // } |
381 | 390 | ||
382 | // //set the default account | 391 | // //set the default account |
383 | // if(!PPPData::data()->defaultAccount().isEmpty()) { | 392 | // if(!_pppdata->defaultAccount().isEmpty()) { |
384 | // for(int i=0; i < count; i++) | 393 | // for(int i=0; i < count; i++) |
385 | // if(PPPData::data()->defaultAccount() == connectto_c->text(i)) { | 394 | // if(_pppdata->defaultAccount() == connectto_c->text(i)) { |
386 | // connectto_c->setCurrentItem(i); | 395 | // connectto_c->setCurrentItem(i); |
387 | // PPPData::data()->setAccountbyIndex(i); | 396 | // _pppdata->setAccountbyIndex(i); |
388 | 397 | ||
389 | // ID_Edit->setText(PPPData::data()->storedUsername()); | 398 | // ID_Edit->setText(_pppdata->storedUsername()); |
390 | // PW_Edit->setText(PPPData::data()->storedPassword()); | 399 | // PW_Edit->setText(_pppdata->storedPassword()); |
391 | // } | 400 | // } |
392 | // } | 401 | // } |
393 | // else | 402 | // else |
394 | // if(count > 0) { | 403 | // if(count > 0) { |
395 | // PPPData::data()->setDefaultAccount(connectto_c->text(0)); | 404 | // _pppdata->setDefaultAccount(connectto_c->text(0)); |
396 | // PPPData::data()->save(); | 405 | // _pppdata->save(); |
397 | // ID_Edit->setText(PPPData::data()->storedUsername()); | 406 | // ID_Edit->setText(_pppdata->storedUsername()); |
398 | // PW_Edit->setText(PPPData::data()->storedPassword()); | 407 | // PW_Edit->setText(_pppdata->storedPassword()); |
399 | // } | 408 | // } |
400 | 409 | ||
401 | // connect(ID_Edit, SIGNAL(textChanged(const QString &)), | 410 | // connect(ID_Edit, SIGNAL(textChanged(const QString &)), |
402 | // this, SLOT(usernameChanged(const QString &))); | 411 | // this, SLOT(usernameChanged(const QString &))); |
403 | 412 | ||
404 | // connect(PW_Edit, SIGNAL(textChanged(const QString &)), | 413 | // connect(PW_Edit, SIGNAL(textChanged(const QString &)), |
405 | // this, SLOT(passwordChanged(const QString &))); | 414 | // this, SLOT(passwordChanged(const QString &))); |
406 | 415 | ||
407 | // if (ID_Edit->text().isEmpty()) | 416 | // if (ID_Edit->text().isEmpty()) |
408 | // ID_Edit->setFocus(); | 417 | // ID_Edit->setFocus(); |
409 | // else if (PW_Edit->text().isEmpty()) | 418 | // else if (PW_Edit->text().isEmpty()) |
410 | // PW_Edit->setFocus(); | 419 | // PW_Edit->setFocus(); |
411 | // } | 420 | // } |
412 | 421 | ||
413 | 422 | ||
414 | void KPPPWidget::interruptConnection() { | 423 | void KPPPWidget::interruptConnection() { |
415 | // interrupt dial up | 424 | // interrupt dial up |
416 | // if (con->isVisible()) | 425 | // |
417 | // emit con->cancelbutton(); | 426 | |
427 | if (con->isVisible()) | ||
428 | emit con->cancelbutton(); | ||
418 | 429 | ||
419 | // disconnect if online | 430 | // disconnect if online |
420 | if (PPPData::data()->pppdRunning()) | 431 | if (_pppdata->pppdRunning()) |
421 | emit disconnect(); | 432 | emit disconnect(); |
422 | } | 433 | } |
423 | 434 | ||
424 | 435 | ||
425 | void KPPPWidget::sigPPPDDied() { | 436 | void KPPPWidget::sigPPPDDied() { |
426 | qDebug( "Received a SIGUSR1" ); | 437 | qDebug( "Received a SIGUSR1" ); |
427 | 438 | ||
428 | // if we are not connected pppdpid is -1 so have have to check for that | 439 | // if we are not connected pppdpid is -1 so have have to check for that |
429 | // in the followin line to make sure that we don't raise a false alarm | 440 | // in the followin line to make sure that we don't raise a false alarm |
430 | // such as would be the case when the log file viewer exits. | 441 | // such as would be the case when the log file viewer exits. |
431 | if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) { | 442 | if(_pppdata->pppdRunning() || _pppdata->pppdError()) { |
432 | qDebug( "It was pppd that died" ); | 443 | qDebug( "It was pppd that died" ); |
433 | 444 | ||
434 | // when we killpppd() on Cancel in ConnectWidget | 445 | // when we killpppd() on Cancel in ConnectWidget |
435 | // we set pppid to -1 so we won't | 446 | // we set pppid to -1 so we won't |
436 | // enter this block | 447 | // enter this block |
437 | 448 | ||
438 | // just to be sure | 449 | // just to be sure |
439 | 450 | ||
440 | Modem::modem->removeSecret(AUTH_PAP); | 451 | Modem::modem->removeSecret(AUTH_PAP); |
441 | Modem::modem->removeSecret(AUTH_CHAP); | 452 | Modem::modem->removeSecret(AUTH_CHAP); |
442 | 453 | ||
443 | PPPData::data()->setpppdRunning(false); | 454 | _pppdata->setpppdRunning(false); |
444 | 455 | ||
445 | qDebug( "Executing command on disconnect since pppd has died." ); | 456 | qDebug( "Executing command on disconnect since pppd has died." ); |
446 | QApplication::flushX(); | 457 | QApplication::flushX(); |
447 | execute_command(PPPData::data()->command_on_disconnect()); | 458 | execute_command(_pppdata->command_on_disconnect()); |
448 | 459 | ||
449 | // stopAccounting(); | 460 | // stopAccounting(); |
450 | 461 | ||
451 | // con_win->stopClock(); | 462 | con_win->stopClock(); |
452 | // DockWidget::dock_widget->stop_stats(); | 463 | // DockWidget::dock_widget->stop_stats(); |
453 | // DockWidget::dock_widget->hide(); | 464 | // DockWidget::dock_widget->hide(); |
454 | 465 | ||
455 | if(!PPPData::data()->pppdError()) | 466 | if(!_pppdata->pppdError()) |
456 | PPPData::data()->setpppdError(E_PPPD_DIED); | 467 | _pppdata->setpppdError(E_PPPD_DIED); |
457 | removedns(); | 468 | removedns(); |
458 | Modem::modem->unlockdevice(); | 469 | Modem::modem->unlockdevice(); |
459 | // con->pppdDied(); | 470 | // |
471 | con->pppdDied(); | ||
460 | 472 | ||
461 | if(!PPPData::data()->automatic_redial()) { | 473 | if(!_pppdata->automatic_redial()) { |
462 | quit_b->setFocus(); | 474 | quit_b->setFocus(); |
463 | show(); | 475 | show(); |
464 | // con_win->stopClock(); | 476 | con_win->stopClock(); |
465 | //stopAccounting(); | 477 | //stopAccounting(); |
466 | // con_win->hide(); | 478 | con_win->hide(); |
467 | // con->hide(); | 479 | con->hide(); |
468 | 480 | ||
469 | PPPData::data()->setpppdRunning(false); | 481 | _pppdata->setpppdRunning(false); |
470 | // // not in a signal handler !!! KNotifyClient::beep(); | 482 | // // not in a signal handler !!! KNotifyClient::beep(); |
471 | QString msg; | 483 | QString msg; |
472 | if (PPPData::data()->pppdError() == E_IF_TIMEOUT) | 484 | if (_pppdata->pppdError() == E_IF_TIMEOUT) |
473 | msg = i18n("Timeout expired while waiting for the PPP interface " | 485 | msg = i18n("Timeout expired while waiting for the PPP interface " |
474 | "to come up!"); | 486 | "to come up!"); |
475 | else { | 487 | else { |
476 | msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); | 488 | msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); |
477 | Modem::modem->pppdExitStatus(); | 489 | Modem::modem->pppdExitStatus(); |
478 | if (Modem::modem->lastStatus != 99) {// more recent pppds only | 490 | if (Modem::modem->lastStatus != 99) {// more recent pppds only |
479 | msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); | 491 | msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); |
480 | msg += i18n("</p><p>See 'man pppd' for an explanation of the error " | 492 | msg += i18n("</p><p>See 'man pppd' for an explanation of the error " |
481 | "codes or take a look at the kppp FAQ on " | 493 | "codes or take a look at the kppp FAQ on " |
482 | " <a href=http://devel-home.kde.org/~kppp/index.html>" | 494 | " <a href=http://devel-home.kde.org/~kppp/index.html>" |
483 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); | 495 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); |
484 | } | 496 | } |
485 | } | 497 | } |
486 | 498 | ||
487 | // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) | 499 | // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) |
488 | // // PPPL_ShowLog(); | 500 | // // PPPL_ShowLog(); |
489 | // } else { /* reconnect on disconnect */ | 501 | // } else { /* reconnect on disconnect */ |
490 | if (false){ | 502 | if (false){ |
491 | qDebug( "Trying to reconnect... " ); | 503 | qDebug( "Trying to reconnect... " ); |
492 | 504 | ||
493 | if(PPPData::data()->authMethod() == AUTH_PAP || | 505 | if(_pppdata->authMethod() == AUTH_PAP || |
494 | PPPData::data()->authMethod() == AUTH_CHAP || | 506 | _pppdata->authMethod() == AUTH_CHAP || |
495 | PPPData::data()->authMethod() == AUTH_PAPCHAP) | 507 | _pppdata->authMethod() == AUTH_PAPCHAP) |
496 | Modem::modem->setSecret(PPPData::data()->authMethod(), | 508 | Modem::modem->setSecret(_pppdata->authMethod(), |
497 | encodeWord(PPPData::data()->storedUsername()), | 509 | encodeWord(_pppdata->storedUsername()), |
498 | encodeWord(PPPData::data()->password())); | 510 | encodeWord(_pppdata->password())); |
499 | 511 | ||
500 | // con_win->hide(); | 512 | con_win->hide(); |
501 | // con_win->stopClock(); | 513 | con_win->stopClock(); |
502 | //stopAccounting(); | 514 | //stopAccounting(); |
503 | PPPData::data()->setpppdRunning(false); | 515 | _pppdata->setpppdRunning(false); |
504 | // not in a signal handler !!!KNotifyClient::beep(); | 516 | // not in a signal handler !!!KNotifyClient::beep(); |
505 | emit cmdl_start(); | 517 | emit cmdl_start(); |
506 | } | 518 | } |
507 | } | 519 | } |
508 | PPPData::data()->setpppdError(0); | 520 | _pppdata->setpppdError(0); |
509 | } | 521 | } |
510 | } | 522 | } |
511 | 523 | ||
512 | // void KPPPWidget::sigChld() { | 524 | // void KPPPWidget::sigChld() { |
513 | // qDebug( "sigchld()" ); | 525 | // qDebug( "sigchld()" ); |
514 | // // pid_t id = wait(0L); | 526 | // // pid_t id = wait(0L); |
515 | // // if(id == helperPid && helperPid != -1) { | 527 | // // if(id == helperPid && helperPid != -1) { |
516 | // // kdDebug(5002) << "It was the setuid child that died" << endl; | 528 | // // kdDebug(5002) << "It was the setuid child that died" << endl; |
517 | // // helperPid = -1; | 529 | // // helperPid = -1; |
518 | // QString msg = i18n("kppp's helper process just died.\n" | 530 | // QString msg = i18n("kppp's helper process just died.\n" |
519 | // "Since a further execution would be pointless, " | 531 | // "Since a further execution would be pointless, " |
520 | // "kppp will shut down now."); | 532 | // "kppp will shut down now."); |
521 | // QMessageBox::warning(0L,"error", msg); | 533 | // QMessageBox::warning(0L,"error", msg); |
522 | // //remove_pidfile(); | 534 | // //remove_pidfile(); |
523 | // exit(1); | 535 | // exit(1); |
524 | // // } | 536 | // // } |
525 | // } | 537 | // } |
526 | 538 | ||
527 | 539 | ||
528 | void KPPPWidget::newdefaultaccount(int i) { | 540 | void KPPPWidget::newdefaultaccount(int i) { |
529 | PPPData::data()->setDefaultAccount(connectto_c->text(i)); | 541 | _pppdata->setDefaultAccount(connectto_c->text(i)); |
530 | PPPData::data()->save(); | 542 | _pppdata->save(); |
531 | ID_Edit->setText(PPPData::data()->storedUsername()); | 543 | ID_Edit->setText(_pppdata->storedUsername()); |
532 | PW_Edit->setText(PPPData::data()->storedPassword()); | 544 | PW_Edit->setText(_pppdata->storedPassword()); |
533 | } | 545 | } |
534 | 546 | ||
535 | 547 | ||
536 | 548 | ||
537 | 549 | ||
538 | void KPPPWidget::beginConnect() { | 550 | void KPPPWidget::beginConnect() { |
539 | // make sure to connect to the account that is selected in the combo box | 551 | // make sure to connect to the account that is selected in the combo box |
540 | // (exeption: an account given by a command line argument) | 552 | // (exeption: an account given by a command line argument) |
541 | // if(!m_bCmdlAccount) { | 553 | // if(!m_bCmdlAccount) { |
542 | // PPPData::data()->setAccount(connectto_c->currentText()); | 554 | // _pppdata->setAccount(connectto_c->currentText()); |
543 | // PPPData::data()->setPassword(PW_Edit->text()); | 555 | // _pppdata->setPassword(PW_Edit->text()); |
544 | // } else { | 556 | // } else { |
545 | PPPData::data()->setPassword(PPPData::data()->storedPassword()); | 557 | _pppdata->setPassword(_pppdata->storedPassword()); |
546 | // } | 558 | // } |
547 | 559 | ||
548 | QFileInfo info(pppdPath()); | 560 | QFileInfo info(pppdPath()); |
549 | 561 | ||
550 | if(!info.exists()){ | 562 | if(!info.exists()){ |
551 | QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" | 563 | QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" |
552 | "Make sure that pppd is installed and " | 564 | "Make sure that pppd is installed and " |
553 | "that you have entered the correct path.")); | 565 | "that you have entered the correct path.")); |
554 | return; | 566 | return; |
555 | } | 567 | } |
556 | #if 0 | 568 | #if 0 |
557 | if(!info.isExecutable()){ | 569 | if(!info.isExecutable()){ |
558 | 570 | ||
559 | QString string; | 571 | QString string; |
560 | string = i18n("kppp cannot execute:\n %1\n" | 572 | string = i18n("kppp cannot execute:\n %1\n" |
561 | "Please make sure that you have given kppp " | 573 | "Please make sure that you have given kppp " |
562 | "setuid permission and that " | 574 | "setuid permission and that " |
563 | "pppd is executable.").arg(PPPData::data()->pppdPath()); | 575 | "pppd is executable.").arg(_pppdata->pppdPath()); |
564 | KMessageBox::error(this, string); | 576 | KMessageBox::error(this, string); |
565 | return; | 577 | return; |
566 | 578 | ||
567 | } | 579 | } |
568 | #endif | 580 | #endif |
569 | 581 | ||
570 | QFileInfo info2(PPPData::data()->modemDevice()); | 582 | QFileInfo info2(_pppdata->modemDevice()); |
571 | 583 | ||
572 | if(!info2.exists()){ | 584 | if(!info2.exists()){ |
573 | QString string; | 585 | QString string; |
574 | string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " | 586 | string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " |
575 | "your modem device properly " | 587 | "your modem device properly " |
576 | "and/or adjust the location of the modem device on " | 588 | "and/or adjust the location of the modem device on " |
577 | "the modem tab of " | 589 | "the modem tab of " |
578 | "the setup dialog.").arg(PPPData::data()->modemDevice()); | 590 | "the setup dialog.").arg(_pppdata->modemDevice()); |
579 | QMessageBox::warning(this, "error", string); | 591 | QMessageBox::warning(this, "error", string); |
580 | return; | 592 | return; |
581 | } | 593 | } |
582 | 594 | ||
583 | // if this is a PAP or CHAP account, ensure that username is | 595 | // if this is a PAP or CHAP account, ensure that username is |
584 | // supplied | 596 | // supplied |
585 | if(PPPData::data()->authMethod() == AUTH_PAP || | 597 | if(_pppdata->authMethod() == AUTH_PAP || |
586 | PPPData::data()->authMethod() == AUTH_CHAP || | 598 | _pppdata->authMethod() == AUTH_CHAP || |
587 | PPPData::data()->authMethod() == AUTH_PAPCHAP ) { | 599 | _pppdata->authMethod() == AUTH_PAPCHAP ) { |
588 | if(ID_Edit->text().isEmpty()) { | 600 | if(ID_Edit->text().isEmpty()) { |
589 | QMessageBox::warning(this,"error", | 601 | QMessageBox::warning(this,"error", |
590 | i18n( | 602 | i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!")); |
591 | "You have selected the authentication " | 603 | // FIXME: return; |
592 | "method PAP or CHAP. This requires that you " | ||
593 | "supply a username and a password!")); | ||
594 | return; | ||
595 | } else { | 604 | } else { |
596 | if(!Modem::modem->setSecret(PPPData::data()->authMethod(), | 605 | if(!Modem::modem->setSecret(_pppdata->authMethod(), |
597 | encodeWord(PPPData::data()->storedUsername()), | 606 | encodeWord(_pppdata->storedUsername()), |
598 | encodeWord(PPPData::data()->password()))) { | 607 | encodeWord(_pppdata->password()))) { |
599 | QString s; | 608 | QString s; |
600 | s = i18n("Cannot create PAP/CHAP authentication\n" | 609 | s = i18n("Cannot create PAP/CHAP authentication\n" |
601 | "file \"%1\"").arg(PAP_AUTH_FILE); | 610 | "file \"%1\"").arg(PAP_AUTH_FILE); |
602 | QMessageBox::warning(this, "error", s); | 611 | QMessageBox::warning(this, "error", s); |
603 | return; | 612 | return; |
604 | } | 613 | } |
605 | } | 614 | } |
606 | } | 615 | } |
607 | 616 | ||
608 | if (PPPData::data()->phonenumber().isEmpty()) { | 617 | if (_pppdata->phonenumber().isEmpty()) { |
609 | QString s = i18n("You must specify a telephone number!"); | 618 | QString s = i18n("You must specify a telephone number!"); |
610 | QMessageBox::warning(this, "error", s); | 619 | QMessageBox::warning(this, "error", s); |
611 | return; | 620 | return; |
612 | } | 621 | } |
613 | 622 | ||
614 | this->hide(); | 623 | this->hide(); |
615 | 624 | ||
616 | QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); | 625 | QString tit = i18n("Connecting to: %1").arg(_pppdata->accname()); |
617 | // con->setCaption(tit); | 626 | // con->setCaption(tit); |
618 | 627 | ||
619 | // con->show(); | 628 | // con->show(); |
620 | 629 | ||
621 | 630 | ||
622 | emit begin_connect(); | 631 | emit begin_connect(); |
623 | } | 632 | } |
624 | 633 | ||
625 | 634 | ||
626 | void KPPPWidget::disconnect() { | 635 | void KPPPWidget::disconnect() { |
627 | if (!PPPData::data()->command_before_disconnect().isEmpty()) { | 636 | if (!_pppdata->command_before_disconnect().isEmpty()) { |
628 | // con_win->hide(); | 637 | con_win->hide(); |
629 | // con->show(); | 638 | con->show(); |
630 | // con->setCaption(i18n("Disconnecting...")); | 639 | con->setCaption(i18n("Disconnecting...")); |
631 | // con->setMsg(i18n("Executing command before disconnection.")); | 640 | con->setMsg(i18n("Executing command before disconnection.")); |
632 | 641 | ||
633 | qApp->processEvents(); | 642 | qApp->processEvents(); |
634 | QApplication::flushX(); | 643 | QApplication::flushX(); |
635 | // pid_t id = | 644 | // pid_t id = |
636 | execute_command(PPPData::data()->command_before_disconnect()); | 645 | execute_command(_pppdata->command_before_disconnect()); |
637 | // int i, status; | 646 | // int i, status; |
638 | 647 | ||
639 | // do { | 648 | // do { |
640 | // kapp->processEvents(); | 649 | // kapp->processEvents(); |
641 | // i = waitpid(id, &status, WNOHANG); | 650 | // i = waitpid(id, &status, WNOHANG); |
642 | // usleep(500000); | 651 | // usleep(500000); |
643 | // } while (i == 0 && errno == 0); | 652 | // } while (i == 0 && errno == 0); |
644 | 653 | ||
645 | // con->hide(); | 654 | con->hide(); |
646 | } | 655 | } |
647 | 656 | ||
648 | qApp->processEvents(); | 657 | qApp->processEvents(); |
649 | 658 | ||
650 | // statdlg->stop_stats(); | 659 | // statdlg->stop_stats(); |
651 | Modem::modem->killPPPDaemon(); | 660 | Modem::modem->killPPPDaemon(); |
652 | 661 | ||
653 | QApplication::flushX(); | 662 | QApplication::flushX(); |
654 | execute_command(PPPData::data()->command_on_disconnect()); | 663 | execute_command(_pppdata->command_on_disconnect()); |
655 | 664 | ||
656 | Modem::modem->removeSecret(AUTH_PAP); | 665 | Modem::modem->removeSecret(AUTH_PAP); |
657 | Modem::modem->removeSecret(AUTH_CHAP); | 666 | Modem::modem->removeSecret(AUTH_CHAP); |
658 | 667 | ||
659 | removedns(); | 668 | removedns(); |
660 | Modem::modem->unlockdevice(); | 669 | Modem::modem->unlockdevice(); |
661 | 670 | ||
662 | // con_win->stopClock(); | 671 | con_win->stopClock(); |
663 | // p_kppp->stopAccounting(); | 672 | // p_kppp->stopAccounting(); |
664 | // con_win->hide(); | 673 | con_win->hide(); |
665 | 674 | ||
666 | // DockWidget::dock_widget->stop_stats(); | 675 | // DockWidget::dock_widget->stop_stats(); |
667 | // DockWidget::dock_widget->hide(); | 676 | // DockWidget::dock_widget->hide(); |
668 | 677 | ||
669 | // if(m_bQuitOnDisconnect) | 678 | // if(m_bQuitOnDisconnect) |
670 | // kapp->exit(0); | 679 | // kapp->exit(0); |
671 | // else { | 680 | // else { |
672 | this->quit_b->setFocus(); | 681 | this->quit_b->setFocus(); |
673 | this->show(); | 682 | this->show(); |
674 | // } | 683 | // } |
675 | } | 684 | } |
676 | 685 | ||
677 | 686 | ||
678 | // void KPPPWidget::helpbutton() { | 687 | // void KPPPWidget::helpbutton() { |
679 | // kapp->invokeHelp(); | 688 | // kapp->invokeHelp(); |
680 | // } | 689 | // } |
681 | 690 | ||
682 | 691 | ||
683 | void KPPPWidget::quitbutton() { | 692 | void KPPPWidget::quitbutton() { |
684 | if(PPPData::data()->pppdRunning()) { | 693 | if(_pppdata->pppdRunning()) { |
685 | int ok = QMessageBox::warning(this, | 694 | int ok = QMessageBox::warning(this, |
686 | i18n("Exiting kPPP will close your PPP Session."), | 695 | i18n("Exiting kPPP will close your PPP Session."), |
687 | i18n("Quit kPPP?")); | 696 | i18n("Quit kPPP?")); |
688 | if(ok == QMessageBox::Yes) { | 697 | if(ok == QMessageBox::Yes) { |
689 | Modem::modem->killPPPDaemon(); | 698 | Modem::modem->killPPPDaemon(); |
690 | QApplication::flushX(); | 699 | QApplication::flushX(); |
691 | execute_command(PPPData::data()->command_on_disconnect()); | 700 | execute_command(_pppdata->command_on_disconnect()); |
692 | removedns(); | 701 | removedns(); |
693 | Modem::modem->unlockdevice(); | 702 | Modem::modem->unlockdevice(); |
694 | } | 703 | } |
695 | } else { | 704 | } else { |
696 | if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword()) | 705 | if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) |
697 | PPPData::data()->setStoredPassword(""); | 706 | _pppdata->setStoredPassword(""); |
698 | } | 707 | } |
699 | PPPData::data()->save(); | 708 | _pppdata->save(); |
700 | qApp->quit(); | 709 | qApp->quit(); |
701 | } | 710 | } |
702 | 711 | ||
703 | 712 | ||
704 | // void KPPPWidget::rulesetLoadError() { | 713 | // void KPPPWidget::rulesetLoadError() { |
705 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); | 714 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); |
706 | // } | 715 | // } |
707 | 716 | ||
708 | 717 | ||
709 | // void KPPPWidget::startAccounting() { | 718 | // void KPPPWidget::startAccounting() { |
710 | // // volume accounting | 719 | // // volume accounting |
711 | // stats->totalbytes = 0; | 720 | // stats->totalbytes = 0; |
712 | 721 | ||
713 | // kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl; | 722 | // kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl; |
714 | 723 | ||
715 | // // load the ruleset | 724 | // // load the ruleset |
716 | // if(!PPPData::data()->AcctEnabled()) | 725 | // if(!_pppdata->AcctEnabled()) |
717 | // return; | 726 | // return; |
718 | 727 | ||
719 | // QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile()); | 728 | // QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); |
720 | // // if(::access(d.data(), X_OK) != 0) | 729 | // // if(::access(d.data(), X_OK) != 0) |
721 | // acct = new Accounting(this, stats); | 730 | // acct = new Accounting(this, stats); |
722 | // // else | 731 | // // else |
723 | // // acct = new ExecutableAccounting(this); | 732 | // // acct = new ExecutableAccounting(this); |
724 | 733 | ||
725 | // // connect to the accounting object | 734 | // // connect to the accounting object |
726 | // connect(acct, SIGNAL(changed(QString, QString)), | 735 | // connect(acct, SIGNAL(changed(QString, QString)), |
727 | // con_win, SLOT(slotAccounting(QString, QString))); | 736 | // con_win, SLOT(slotAccounting(QString, QString))); |
728 | 737 | ||
729 | // // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) { | 738 | // // if(!acct->loadRuleSet(_pppdata->accountingFile())) { |
730 | // // QString s= i18n("Can not load the accounting " | 739 | // // QString s= i18n("Can not load the accounting " |
731 | // // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile()); | 740 | // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); |
732 | 741 | ||
733 | // // starting the messagebox with a timer will prevent us | 742 | // // starting the messagebox with a timer will prevent us |
734 | // // from blocking the calling function ConnectWidget::timerEvent | 743 | // // from blocking the calling function ConnectWidget::timerEvent |
735 | // ruleset_load_errmsg = s; | 744 | // ruleset_load_errmsg = s; |
736 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); | 745 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); |
737 | // return; | 746 | // return; |
738 | // } | 747 | // } |
739 | // //else | 748 | // //else |
740 | // // acct->slotStart(); | 749 | // // acct->slotStart(); |
741 | // } | 750 | // } |
742 | 751 | ||
743 | // void KPPPWidget::stopAccounting() { | 752 | // void KPPPWidget::stopAccounting() { |
744 | // // store volume accounting | 753 | // // store volume accounting |
745 | // // if(stats->totalbytes != 0) | 754 | // // if(stats->totalbytes != 0) |
746 | // // PPPData::data()->setTotalBytes(stats->totalbytes); | 755 | // // _pppdata->setTotalBytes(stats->totalbytes); |
747 | 756 | ||
748 | // if(!PPPData::data()->AcctEnabled()) | 757 | // if(!_pppdata->AcctEnabled()) |
749 | // return; | 758 | // return; |
750 | 759 | ||
751 | // // if(acct != 0) { | 760 | // // if(acct != 0) { |
752 | // // acct->slotStop(); | 761 | // // acct->slotStop(); |
753 | // // delete acct; | 762 | // // delete acct; |
754 | // // acct = 0; | 763 | // // acct = 0; |
755 | // // } | 764 | // // } |
756 | // } | 765 | // } |
757 | 766 | ||
758 | 767 | ||
759 | // void KPPPWidget::showStats() { | 768 | // void KPPPWidget::showStats() { |
760 | // if(statdlg) { | 769 | // if(statdlg) { |
761 | // statdlg->show(); | 770 | // statdlg->show(); |
762 | // statdlg->raise(); | 771 | // statdlg->raise(); |
763 | // } | 772 | // } |
764 | // } | 773 | // } |
765 | 774 | ||
766 | 775 | ||
767 | void KPPPWidget::usernameChanged(const QString &) { | 776 | void KPPPWidget::usernameChanged(const QString &) { |
768 | // store username for later use | 777 | // store username for later use |
769 | PPPData::data()->setStoredUsername(ID_Edit->text()); | 778 | _pppdata->setStoredUsername(ID_Edit->text()); |
770 | } | 779 | } |
771 | 780 | ||
772 | 781 | ||
773 | void KPPPWidget::passwordChanged(const QString &) { | 782 | void KPPPWidget::passwordChanged(const QString &) { |
774 | // store the password if so requested | 783 | // store the password if so requested |
775 | if(PPPData::data()->storePassword()) | 784 | if(_pppdata->storePassword()) |
776 | PPPData::data()->setStoredPassword(PW_Edit->text()); | 785 | _pppdata->setStoredPassword(PW_Edit->text()); |
777 | else | 786 | else |
778 | PPPData::data()->setStoredPassword(""); | 787 | _pppdata->setStoredPassword(""); |
779 | } | 788 | } |
780 | 789 | ||
781 | 790 | ||
782 | void KPPPWidget::setPW_Edit(const QString &pw) { | 791 | void KPPPWidget::setPW_Edit(const QString &pw) { |
783 | PW_Edit->setText(pw); | 792 | PW_Edit->setText(pw); |
784 | } | 793 | } |
785 | 794 | ||
786 | 795 | ||
787 | // void KPPPWidget::resetCosts(const QString &s) { | 796 | // void KPPPWidget::resetCosts(const QString &s) { |
788 | // AccountingBase::resetCosts(s); | 797 | // AccountingBase::resetCosts(s); |
789 | // } | 798 | // } |
790 | 799 | ||
@@ -806,25 +815,25 @@ QString KPPPWidget::encodeWord(const QString &s) { | |||
806 | 815 | ||
807 | // void KPPPWidget::setQuitOnDisconnect (bool b) | 816 | // void KPPPWidget::setQuitOnDisconnect (bool b) |
808 | // { | 817 | // { |
809 | // m_bQuitOnDisconnect = b; | 818 | // m_bQuitOnDisconnect = b; |
810 | // } | 819 | // } |
811 | 820 | ||
812 | void KPPPWidget::showNews() { | 821 | void KPPPWidget::showNews() { |
813 | #ifdef KPPP_SHOW_NEWS | 822 | #ifdef KPPP_SHOW_NEWS |
814 | /* | 823 | /* |
815 | * Introduce the QuickHelp feature to new users of this version | 824 | * Introduce the QuickHelp feature to new users of this version |
816 | */ | 825 | */ |
817 | #define QUICKHELP_HINT "Hint_QuickHelp" | 826 | #define QUICKHELP_HINT "Hint_QuickHelp" |
818 | if(PPPData::data()->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { | 827 | if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { |
819 | QDialog dlg(0, 0, true); | 828 | QDialog dlg(0, 0, true); |
820 | dlg.setCaption(i18n("Recent Changes in KPPP")); | 829 | dlg.setCaption(i18n("Recent Changes in KPPP")); |
821 | 830 | ||
822 | QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); | 831 | QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); |
823 | QHBoxLayout *l1 = new QHBoxLayout(10); | 832 | QHBoxLayout *l1 = new QHBoxLayout(10); |
824 | QVBoxLayout *l2 = new QVBoxLayout(10); | 833 | QVBoxLayout *l2 = new QVBoxLayout(10); |
825 | tl->addLayout(l1); | 834 | tl->addLayout(l1); |
826 | 835 | ||
827 | QLabel *icon = new QLabel(&dlg); | 836 | QLabel *icon = new QLabel(&dlg); |
828 | icon->setPixmap(BarIcon("exclamation")); | 837 | icon->setPixmap(BarIcon("exclamation")); |
829 | icon->setFixedSize(icon->sizeHint()); | 838 | icon->setFixedSize(icon->sizeHint()); |
830 | l1->addWidget(icon); | 839 | l1->addWidget(icon); |
@@ -858,22 +867,22 @@ void KPPPWidget::showNews() { | |||
858 | l2->addWidget(cb); | 867 | l2->addWidget(cb); |
859 | tl->addWidget(bbox); | 868 | tl->addWidget(bbox); |
860 | 869 | ||
861 | QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n" | 870 | QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n" |
862 | "This window will stay open until you\n" | 871 | "This window will stay open until you\n" |
863 | "click a mouse button or a press a key.\n"); | 872 | "click a mouse button or a press a key.\n"); |
864 | 873 | ||
865 | QWhatsThis::add(cb,tmp); | 874 | QWhatsThis::add(cb,tmp); |
866 | QWhatsThis::add(l, tmp); | 875 | QWhatsThis::add(l, tmp); |
867 | 876 | ||
868 | dlg.exec(); | 877 | dlg.exec(); |
869 | if(cb->isChecked()) { | 878 | if(cb->isChecked()) { |
870 | PPPData::data()->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); | 879 | _pppdata->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); |
871 | PPPData::data()->save(); | 880 | _pppdata->save(); |
872 | } | 881 | } |
873 | } | 882 | } |
874 | #endif | 883 | #endif |
875 | } | 884 | } |
876 | 885 | ||
877 | 886 | ||
878 | //#include "kpppwidget.moc" | 887 | //#include "kpppwidget.moc" |
879 | 888 | ||