author | kergoth <kergoth> | 2003-08-09 17:14:54 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:14:54 (UTC) |
commit | a7e015198a8c5ad3b6e144a9032b059086253e00 (patch) (unidiff) | |
tree | b712b6f11310d88744fe393a92b3160b741a7efe /noncore/settings/networksettings/ppp/kpppwidget.cpp | |
parent | beba0e73306815337bf04dee39502233595e9739 (diff) | |
download | opie-a7e015198a8c5ad3b6e144a9032b059086253e00.zip opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.gz opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.bz2 |
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/settings/networksettings/ppp/kpppwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/kpppwidget.cpp | 89 |
1 files changed, 39 insertions, 50 deletions
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index 7b5c74d..e466358 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp | |||
@@ -1,337 +1,326 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * kPPP: A pppd front end for the KDE project | 3 | * kPPP: A pppd front end for the KDE project |
4 | * | 4 | * |
5 | * $Id$ | 5 | * $Id$ |
6 | * | 6 | * |
7 | * Copyright (C) 1997 Bernd Johannes Wuebben | 7 | * Copyright (C) 1997 Bernd Johannes Wuebben |
8 | * wuebben@math.cornell.edu | 8 | * wuebben@math.cornell.edu |
9 | * | 9 | * |
10 | * Copyright (C) 1998-2002 Harri Porten <porten@kde.org> | 10 | * Copyright (C) 1998-2002 Harri Porten <porten@kde.org> |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU Library General Public | 13 | * modify it under the terms of the GNU Library General Public |
14 | * License as published by the Free Software Foundation; either | 14 | * License as published by the Free Software Foundation; either |
15 | * version 2 of the License, or (at your option) any later version. | 15 | * version 2 of the License, or (at your option) any later version. |
16 | * | 16 | * |
17 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 | * Library General Public License for more details. | 20 | * Library General Public License for more details. |
21 | * | 21 | * |
22 | * You should have received a copy of the GNU Library General Public | 22 | * You should have received a copy of the GNU Library General Public |
23 | * License along with this program; if not, write to the Free | 23 | * License along with this program; if not, write to the Free |
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "kpppwidget.h" | 27 | #include "kpppwidget.h" |
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 | #include <qcheckbox.h> |
41 | 41 | ||
42 | // #include <kaboutdata.h> | 42 | // #include <kaboutdata.h> |
43 | // #include <kapplication.h> | 43 | // #include <kapplication.h> |
44 | #include <qbuttongroup.h> | 44 | #include <qbuttongroup.h> |
45 | //#include <kcmdlineargs.h> | ||
46 | //#include <kconfig.h> | ||
47 | //#include <kdebug.h> | ||
48 | #define i18n QObject::tr | ||
49 | //#include <kiconloader.h> // For BarIcon | ||
50 | //#include <klocale.h> | ||
51 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
52 | // #include <kseparator.h> | ||
53 | // #include <kstandarddirs.h> | ||
54 | // #include <kwin.h> | ||
55 | // #include <khelpmenu.h> | ||
56 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
57 | //#include <kguiitem.h> | ||
58 | 47 | ||
59 | #include <stdlib.h> | 48 | #include <stdlib.h> |
60 | #include <errno.h> | 49 | #include <errno.h> |
61 | #include <signal.h> | 50 | #include <signal.h> |
62 | 51 | ||
63 | #include "runtests.h" | 52 | #include "runtests.h" |
64 | 53 | ||
65 | //#include "main.h" | 54 | //#include "main.h" |
66 | #include "auth.h" | 55 | #include "auth.h" |
67 | #include "modem.h" | 56 | #include "modem.h" |
68 | //#include "ppplog.h" | 57 | //#include "ppplog.h" |
69 | //#include "opener.h" | 58 | //#include "opener.h" |
70 | //#include "requester.h" | 59 | //#include "requester.h" |
71 | //#include "pppstats.h" | 60 | //#include "pppstats.h" |
72 | #include "pppdata.h" | 61 | #include "pppdata.h" |
73 | #include "general.h" | 62 | #include "general.h" |
74 | #include "interface.h" | 63 | #include "interface.h" |
75 | 64 | ||
76 | #define execute_command system | 65 | #define execute_command system |
77 | 66 | ||
78 | KPPPWidget *p_kppp = 0; | 67 | KPPPWidget *p_kppp = 0; |
79 | 68 | ||
80 | KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) | 69 | KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl ) |
81 | : QDialog(parent, name, modal, fl), _pppdata(pd) | 70 | : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd) |
82 | { | 71 | { |
83 | // tabWindow = 0; | 72 | // tabWindow = 0; |
84 | p_kppp = this; | 73 | p_kppp = this; |
85 | // before doing anything else, run a few tests | 74 | // before doing anything else, run a few tests |
86 | if (!_pppdata->setModemDevice( i->getInterfaceName() )) | 75 | if (!_pppdata->setModemDevice( i->getInterfaceName() )) |
87 | _pppdata->setModemDevice("/dev/modem"); | 76 | _pppdata->setModemDevice("/dev/modem"); |
88 | qDebug("PPPConfigWidget::PPPConfigWidget"); | 77 | qDebug("PPPConfigWidget::PPPConfigWidget"); |
89 | qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); | 78 | qDebug(" interface->getHardwareName >%s<", i->getHardwareName().latin1()); |
90 | if (!_pppdata->setAccount( i->getHardwareName() )) | 79 | if (!_pppdata->setAccount( i->getHardwareName() )) |
91 | _pppdata->setAccount( 0 ); | 80 | _pppdata->setAccount( 0 ); |
92 | 81 | ||
93 | qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); | 82 | qDebug(" _pppdata->accname >%s<",_pppdata->accname().latin1()); |
94 | qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); | 83 | qDebug(" _pppdata->currentAccountID() >%i<",_pppdata->currentAccountID()); |
95 | 84 | ||
96 | int result = runTests(); | 85 | int result = runTests(); |
97 | if(result == TEST_CRITICAL) | 86 | if(result == TEST_CRITICAL) |
98 | exit(4); | 87 | exit(4); |
99 | 88 | ||
100 | // installEventFilter(this); | 89 | // installEventFilter(this); |
101 | 90 | ||
102 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); | 91 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); |
103 | 92 | ||
104 | QGridLayout *l1 = new QGridLayout(3, 4); | 93 | QGridLayout *l1 = new QGridLayout(3, 4); |
105 | tl->addLayout(l1); | 94 | tl->addLayout(l1); |
106 | l1->addColSpacing(0, 10); | 95 | l1->addColSpacing(0, 10); |
107 | l1->addColSpacing(3, 10); | 96 | l1->addColSpacing(3, 10); |
108 | l1->setColStretch(1, 3); | 97 | l1->setColStretch(1, 3); |
109 | l1->setColStretch(2, 4); | 98 | l1->setColStretch(2, 4); |
110 | 99 | ||
111 | label1 = new QLabel(i18n("C&onnect to: "), this); | 100 | label1 = new QLabel(QObject::tr("C&onnect to: "), this); |
112 | l1->addWidget(label1, 0, 1); | 101 | l1->addWidget(label1, 0, 1); |
113 | 102 | ||
114 | connectto_c = new QComboBox(false, this); | 103 | connectto_c = new QComboBox(false, this); |
115 | label1->setBuddy(connectto_c); | 104 | label1->setBuddy(connectto_c); |
116 | 105 | ||
117 | connect(connectto_c, SIGNAL(activated(int)), | 106 | connect(connectto_c, SIGNAL(activated(int)), |
118 | SLOT(newdefaultaccount(int))); | 107 | SLOT(newdefaultaccount(int))); |
119 | l1->addWidget(connectto_c, 0, 2); | 108 | l1->addWidget(connectto_c, 0, 2); |
120 | 109 | ||
121 | ID_Label = new QLabel(i18n("&Login ID:"), this); | 110 | ID_Label = new QLabel(QObject::tr("&Login ID:"), this); |
122 | l1->addWidget(ID_Label, 1, 1); | 111 | l1->addWidget(ID_Label, 1, 1); |
123 | 112 | ||
124 | // the entry line for usernames | 113 | // the entry line for usernames |
125 | ID_Edit = new QLineEdit(this); | 114 | ID_Edit = new QLineEdit(this); |
126 | ID_Label->setBuddy(ID_Edit); | 115 | ID_Label->setBuddy(ID_Edit); |
127 | l1->addWidget(ID_Edit, 1, 2); | 116 | l1->addWidget(ID_Edit, 1, 2); |
128 | connect(ID_Edit, SIGNAL(returnPressed()), | 117 | connect(ID_Edit, SIGNAL(returnPressed()), |
129 | this, SLOT(enterPressedInID())); | 118 | this, SLOT(enterPressedInID())); |
130 | QString tmp = i18n("<p>Type in the username that you got from your\n" | 119 | QString tmp = QObject::tr("<p>Type in the username that you got from your\n" |
131 | "ISP. This is especially important for PAP\n" | 120 | "ISP. This is especially important for PAP\n" |
132 | "and CHAP. You may omit this when you use\n" | 121 | "and CHAP. You may omit this when you use\n" |
133 | "terminal-based or script-based authentication.\n" | 122 | "terminal-based or script-based authentication.\n" |
134 | "\n" | 123 | "\n" |
135 | "<b>Important</b>: case is important here:\n" | 124 | "<b>Important</b>: case is important here:\n" |
136 | "<i>myusername</i> is not the same as <i>MyUserName</i>!"); | 125 | "<i>myusername</i> is not the same as <i>MyUserName</i>!"); |
137 | 126 | ||
138 | QWhatsThis::add(ID_Label,tmp); | 127 | QWhatsThis::add(ID_Label,tmp); |
139 | QWhatsThis::add(ID_Edit,tmp); | 128 | QWhatsThis::add(ID_Edit,tmp); |
140 | 129 | ||
141 | PW_Label = new QLabel(i18n("&Password:"), this); | 130 | PW_Label = new QLabel(QObject::tr("&Password:"), this); |
142 | l1->addWidget(PW_Label, 2, 1); | 131 | l1->addWidget(PW_Label, 2, 1); |
143 | 132 | ||
144 | PW_Edit= new QLineEdit(this); | 133 | PW_Edit= new QLineEdit(this); |
145 | PW_Label->setBuddy(PW_Edit); | 134 | PW_Label->setBuddy(PW_Edit); |
146 | PW_Edit->setEchoMode(QLineEdit::Password); | 135 | PW_Edit->setEchoMode(QLineEdit::Password); |
147 | l1->addWidget(PW_Edit, 2, 2); | 136 | l1->addWidget(PW_Edit, 2, 2); |
148 | connect(PW_Edit, SIGNAL(returnPressed()), | 137 | connect(PW_Edit, SIGNAL(returnPressed()), |
149 | this, SLOT(enterPressedInPW())); | 138 | this, SLOT(enterPressedInPW())); |
150 | 139 | ||
151 | tmp = i18n("<p>Type in the password that you got from your\n" | 140 | tmp = QObject::tr("<p>Type in the password that you got from your\n" |
152 | "ISP. This is especially important for PAP\n" | 141 | "ISP. This is especially important for PAP\n" |
153 | "and CHAP. You may omit this when you use\n" | 142 | "and CHAP. You may omit this when you use\n" |
154 | "terminal-based or script-based authentication.\n" | 143 | "terminal-based or script-based authentication.\n" |
155 | "\n" | 144 | "\n" |
156 | "<b>Important</b>: case is important here:\n" | 145 | "<b>Important</b>: case is important here:\n" |
157 | "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); | 146 | "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); |
158 | 147 | ||
159 | QWhatsThis::add(PW_Label,tmp); | 148 | QWhatsThis::add(PW_Label,tmp); |
160 | QWhatsThis::add(PW_Edit,tmp); | 149 | QWhatsThis::add(PW_Edit,tmp); |
161 | 150 | ||
162 | QHBoxLayout *l3 = new QHBoxLayout; | 151 | QHBoxLayout *l3 = new QHBoxLayout; |
163 | tl->addSpacing(5); | 152 | tl->addSpacing(5); |
164 | tl->addLayout(l3); | 153 | tl->addLayout(l3); |
165 | tl->addSpacing(5); | 154 | tl->addSpacing(5); |
166 | l3->addSpacing(10); | 155 | l3->addSpacing(10); |
167 | log = new QCheckBox(i18n("Show lo&g window"), this); | 156 | log = new QCheckBox(QObject::tr("Show lo&g window"), this); |
168 | connect(log, SIGNAL(toggled(bool)), | 157 | connect(log, SIGNAL(toggled(bool)), |
169 | this, SLOT(log_window_toggled(bool))); | 158 | this, SLOT(log_window_toggled(bool))); |
170 | log->setChecked(_pppdata->get_show_log_window()); | 159 | log->setChecked(_pppdata->get_show_log_window()); |
171 | l3->addWidget(log); | 160 | l3->addWidget(log); |
172 | 161 | ||
173 | QWhatsThis::add(log, | 162 | QWhatsThis::add(log, |
174 | i18n("<p>This controls whether a log window is shown.\n" | 163 | QObject::tr("<p>This controls whether a log window is shown.\n" |
175 | "A log window shows the communication between\n" | 164 | "A log window shows the communication between\n" |
176 | "<i>kppp</i> and your modem. This will help you\n" | 165 | "<i>kppp</i> and your modem. This will help you\n" |
177 | "in tracking down problems.\n" | 166 | "in tracking down problems.\n" |
178 | "\n" | 167 | "\n" |
179 | "Turn it off if <i>kppp</i> routinely connects without\n" | 168 | "Turn it off if <i>kppp</i> routinely connects without\n" |
180 | "problems")); | 169 | "problems")); |
181 | 170 | ||
182 | // fline = new QSeparator( KSeparator::HLine, this); | 171 | // fline = new QSeparator( KSeparator::HLine, this); |
183 | // tl->addWidget(fline); | 172 | // tl->addWidget(fline); |
184 | 173 | ||
185 | QHBoxLayout *l2 = new QHBoxLayout(this); | 174 | QHBoxLayout *l2 = new QHBoxLayout(this); |
186 | tl->addLayout(l2); | 175 | tl->addLayout(l2); |
187 | 176 | ||
188 | int minw = 0; | 177 | int minw = 0; |
189 | quit_b = new QPushButton(i18n("&Quit"), this); | 178 | quit_b = new QPushButton(QObject::tr("&Quit"), this); |
190 | // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); | 179 | // quit_b-> setGuiItem (KGuiItem(QObject::tr("&Quit"), "exit" ) ); |
191 | connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); | 180 | connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); |
192 | if(quit_b->sizeHint().width() > minw) | 181 | if(quit_b->sizeHint().width() > minw) |
193 | minw = quit_b->sizeHint().width(); | 182 | minw = quit_b->sizeHint().width(); |
194 | 183 | ||
195 | setup_b = new QPushButton(i18n("&Setup..."), this); | 184 | setup_b = new QPushButton(QObject::tr("&Setup..."), this); |
196 | // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); | 185 | // setup_b->setGuiItem (KGuiItem(QObject::tr("&Setup...")) ); |
197 | connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); | 186 | connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); |
198 | if(setup_b->sizeHint().width() > minw) | 187 | if(setup_b->sizeHint().width() > minw) |
199 | minw = setup_b->sizeHint().width(); | 188 | minw = setup_b->sizeHint().width(); |
200 | 189 | ||
201 | 190 | ||
202 | 191 | ||
203 | // if(_pppdata->access() != KConfig::ReadWrite) | 192 | // if(_pppdata->access() != KConfig::ReadWrite) |
204 | // setup_b->setEnabled(false); | 193 | // setup_b->setEnabled(false); |
205 | 194 | ||
206 | // help_b = new QPushButton(i18n("&Help"), this); | 195 | // help_b = new QPushButton(QObject::tr("&Help"), this); |
207 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); | 196 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); |
208 | 197 | ||
209 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); | 198 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); |
210 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); | 199 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); |
211 | // help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); | 200 | // help_b->setGuiItem (KGuiItem(QObject::tr("&Help"), "help" ) ); |
212 | 201 | ||
213 | // if(help_b->sizeHint().width() > minw) | 202 | // if(help_b->sizeHint().width() > minw) |
214 | // minw = help_b->sizeHint().width(); | 203 | // minw = help_b->sizeHint().width(); |
215 | 204 | ||
216 | connect_b = new QPushButton(i18n("&Connect"), this); | 205 | connect_b = new QPushButton(QObject::tr("&Connect"), this); |
217 | connect_b->setDefault(true); | 206 | connect_b->setDefault(true); |
218 | connect_b->setFocus(); | 207 | connect_b->setFocus(); |
219 | connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); | 208 | connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); |
220 | if(connect_b->sizeHint().width() > minw) | 209 | if(connect_b->sizeHint().width() > minw) |
221 | minw = connect_b->sizeHint().width(); | 210 | minw = connect_b->sizeHint().width(); |
222 | 211 | ||
223 | quit_b->setFixedWidth(minw); | 212 | quit_b->setFixedWidth(minw); |
224 | setup_b->setFixedWidth(minw); | 213 | setup_b->setFixedWidth(minw); |
225 | // help_b->setFixedWidth(help_b->sizeHint().width()); | 214 | // help_b->setFixedWidth(help_b->sizeHint().width()); |
226 | connect_b->setFixedWidth(minw); | 215 | connect_b->setFixedWidth(minw); |
227 | 216 | ||
228 | l2->addWidget(quit_b); | 217 | l2->addWidget(quit_b); |
229 | l2->addWidget(setup_b); | 218 | l2->addWidget(setup_b); |
230 | // l2->addWidget(help_b); | 219 | // l2->addWidget(help_b); |
231 | l2->addSpacing(20); | 220 | l2->addSpacing(20); |
232 | l2->addWidget(connect_b); | 221 | l2->addWidget(connect_b); |
233 | 222 | ||
234 | setFixedSize(sizeHint()); | 223 | setFixedSize(sizeHint()); |
235 | 224 | ||
236 | (void)new Modem(_pppdata); | 225 | (void)new Modem(_pppdata); |
237 | 226 | ||
238 | // we also connect cmld_start to the beginConnect so that I can run | 227 | // we also connect cmld_start to the beginConnect so that I can run |
239 | // the dialer through a command line argument | 228 | // the dialer through a command line argument |
240 | connect(this,SIGNAL(cmdl_start()),this,SLOT(beginConnect())); | 229 | connect(this,SIGNAL(cmdl_start()),this,SLOT(beginConnect())); |
241 | 230 | ||
242 | // stats = new PPPStats; | 231 | // stats = new PPPStats; |
243 | 232 | ||
244 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 233 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
245 | 234 | ||
246 | // constructor of con_win reads position from config file | 235 | // constructor of con_win reads position from config file |
247 | con_win = new ConWindow(_pppdata, 0, "conw", this); | 236 | con_win = new ConWindow(_pppdata, 0, "conw", this); |
248 | // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon()); | 237 | // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon()); |
249 | 238 | ||
250 | // statdlg = new PPPStatsDlg(0, "stats", this, stats); | 239 | // statdlg = new PPPStatsDlg(0, "stats", this, stats); |
251 | // statdlg->hide(); | 240 | // statdlg->hide(); |
252 | 241 | ||
253 | // load up the accounts combo box | 242 | // load up the accounts combo box |
254 | 243 | ||
255 | // resetaccounts(); | 244 | // resetaccounts(); |
256 | con = new ConnectWidget(_pppdata, 0, "con"); | 245 | con = new ConnectWidget(_pppdata, 0, "con"); |
257 | //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() ); | 246 | //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() ); |
258 | connect(this, SIGNAL(begin_connect()),con, SLOT(preinit())); | 247 | connect(this, SIGNAL(begin_connect()),con, SLOT(preinit())); |
259 | // Is this the best we can do here? it's not right. | 248 | // Is this the best we can do here? it's not right. |
260 | // QRect desk = QApplication::desktop()->screenGeometry( | 249 | // QRect desk = QApplication::desktop()->screenGeometry( |
261 | // QApplication::desktop()->screenNumber(topLevelWidget())); | 250 | // QApplication::desktop()->screenNumber(topLevelWidget())); |
262 | // con->setGeometry(desk.center().x()-175, desk.center().y()-55, 350,110); | 251 | // con->setGeometry(desk.center().x()-175, desk.center().y()-55, 350,110); |
263 | 252 | ||
264 | // connect the ConnectWidgets various signals | 253 | // connect the ConnectWidgets various signals |
265 | connect(con, SIGNAL(startAccounting()), | 254 | connect(con, SIGNAL(startAccounting()), |
266 | this, SLOT(startAccounting())); | 255 | this, SLOT(startAccounting())); |
267 | connect(con, SIGNAL(stopAccounting()), | 256 | connect(con, SIGNAL(stopAccounting()), |
268 | this, SLOT(stopAccounting())); | 257 | this, SLOT(stopAccounting())); |
269 | connect(qApp, SIGNAL(saveYourself()), | 258 | connect(qApp, SIGNAL(saveYourself()), |
270 | this, SLOT(saveMyself())); | 259 | this, SLOT(saveMyself())); |
271 | connect(qApp, SIGNAL(shutDown()), | 260 | connect(qApp, SIGNAL(shutDown()), |
272 | this, SLOT(shutDown())); | 261 | this, SLOT(shutDown())); |
273 | 262 | ||
274 | 263 | ||
275 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 264 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
276 | 265 | ||
277 | // m_strCmdlAccount = args->getOption("c"); | 266 | // m_strCmdlAccount = args->getOption("c"); |
278 | // m_bQuitOnDisconnect = args->isSet("q"); | 267 | // m_bQuitOnDisconnect = args->isSet("q"); |
279 | 268 | ||
280 | // if(!m_strCmdlAccount.isEmpty()) { | 269 | // if(!m_strCmdlAccount.isEmpty()) { |
281 | // m_bCmdlAccount = true; | 270 | // m_bCmdlAccount = true; |
282 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; | 271 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; |
283 | // } | 272 | // } |
284 | 273 | ||
285 | // if(m_bCmdlAccount){ | 274 | // if(m_bCmdlAccount){ |
286 | // bool result = _pppdata->setAccount(m_strCmdlAccount); | 275 | // bool result = _pppdata->setAccount(m_strCmdlAccount); |
287 | // if (!result){ | 276 | // if (!result){ |
288 | // QString string; | 277 | // QString string; |
289 | // string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); | 278 | // string = QObject::tr("No such Account:\n%1").arg(m_strCmdlAccount); |
290 | // KMessageBox::error(this, string); | 279 | // KMessageBox::error(this, string); |
291 | // m_bCmdlAccount = false; | 280 | // m_bCmdlAccount = false; |
292 | // this->show(); | 281 | // this->show(); |
293 | // } else { | 282 | // } else { |
294 | // beginConnect(); | 283 | // beginConnect(); |
295 | // } | 284 | // } |
296 | // } else | 285 | // } else |
297 | // expandbutton(); | 286 | // expandbutton(); |
298 | // show(); | 287 | // show(); |
299 | 288 | ||
300 | 289 | ||
301 | //#define KPPP_SHOW_NEWS | 290 | //#define KPPP_SHOW_NEWS |
302 | #ifdef KPPP_SHOW_NEWS | 291 | #ifdef KPPP_SHOW_NEWS |
303 | // keep user informed about recent changes | 292 | // keep user informed about recent changes |
304 | if(!m_bCmdlAccount) | 293 | if(!m_bCmdlAccount) |
305 | showNews(); | 294 | showNews(); |
306 | #endif | 295 | #endif |
307 | } | 296 | } |
308 | 297 | ||
309 | KPPPWidget::~KPPPWidget() | 298 | KPPPWidget::~KPPPWidget() |
310 | { | 299 | { |
311 | p_kppp = 0; | 300 | p_kppp = 0; |
312 | // delete stats; | 301 | // delete stats; |
313 | } | 302 | } |
314 | 303 | ||
315 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { | 304 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { |
316 | // if(e->type() == QEvent::User) { | 305 | // if(e->type() == QEvent::User) { |
317 | // switch(((SignalEvent*)e)->sigType()) { | 306 | // switch(((SignalEvent*)e)->sigType()) { |
318 | // case SIGINT: | 307 | // case SIGINT: |
319 | // qDebug( "Received a SIGINT" ); | 308 | // qDebug( "Received a SIGINT" ); |
320 | // interruptConnection(); | 309 | // interruptConnection(); |
321 | // break; | 310 | // break; |
322 | // case SIGCHLD: | 311 | // case SIGCHLD: |
323 | // sigChld(); | 312 | // sigChld(); |
324 | // break; | 313 | // break; |
325 | // case SIGUSR1: | 314 | // case SIGUSR1: |
326 | // sigPPPDDied(); | 315 | // sigPPPDDied(); |
327 | // break; | 316 | // break; |
328 | // } | 317 | // } |
329 | // return true; | 318 | // return true; |
330 | // } | 319 | // } |
331 | 320 | ||
332 | // if(o == connect_b) { | 321 | // if(o == connect_b) { |
333 | // if(e->type() == QEvent::KeyPress) { | 322 | // if(e->type() == QEvent::KeyPress) { |
334 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { | 323 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { |
335 | // beginConnect(); | 324 | // beginConnect(); |
336 | // return true; | 325 | // return true; |
337 | // } | 326 | // } |
@@ -437,452 +426,452 @@ void KPPPWidget::sigPPPDDied() { | |||
437 | qDebug( "Received a SIGUSR1" ); | 426 | qDebug( "Received a SIGUSR1" ); |
438 | 427 | ||
439 | // if we are not connected pppdpid is -1 so have have to check for that | 428 | // if we are not connected pppdpid is -1 so have have to check for that |
440 | // in the followin line to make sure that we don't raise a false alarm | 429 | // in the followin line to make sure that we don't raise a false alarm |
441 | // such as would be the case when the log file viewer exits. | 430 | // such as would be the case when the log file viewer exits. |
442 | if(_pppdata->pppdRunning() || _pppdata->pppdError()) { | 431 | if(_pppdata->pppdRunning() || _pppdata->pppdError()) { |
443 | qDebug( "It was pppd that died" ); | 432 | qDebug( "It was pppd that died" ); |
444 | 433 | ||
445 | // when we killpppd() on Cancel in ConnectWidget | 434 | // when we killpppd() on Cancel in ConnectWidget |
446 | // we set pppid to -1 so we won't | 435 | // we set pppid to -1 so we won't |
447 | // enter this block | 436 | // enter this block |
448 | 437 | ||
449 | // just to be sure | 438 | // just to be sure |
450 | 439 | ||
451 | Modem::modem->removeSecret(AUTH_PAP); | 440 | Modem::modem->removeSecret(AUTH_PAP); |
452 | Modem::modem->removeSecret(AUTH_CHAP); | 441 | Modem::modem->removeSecret(AUTH_CHAP); |
453 | 442 | ||
454 | _pppdata->setpppdRunning(false); | 443 | _pppdata->setpppdRunning(false); |
455 | 444 | ||
456 | qDebug( "Executing command on disconnect since pppd has died." ); | 445 | qDebug( "Executing command on disconnect since pppd has died." ); |
457 | QApplication::flushX(); | 446 | QApplication::flushX(); |
458 | execute_command(_pppdata->command_on_disconnect()); | 447 | execute_command(_pppdata->command_on_disconnect()); |
459 | 448 | ||
460 | // stopAccounting(); | 449 | // stopAccounting(); |
461 | 450 | ||
462 | con_win->stopClock(); | 451 | con_win->stopClock(); |
463 | // DockWidget::dock_widget->stop_stats(); | 452 | // DockWidget::dock_widget->stop_stats(); |
464 | // DockWidget::dock_widget->hide(); | 453 | // DockWidget::dock_widget->hide(); |
465 | 454 | ||
466 | if(!_pppdata->pppdError()) | 455 | if(!_pppdata->pppdError()) |
467 | _pppdata->setpppdError(E_PPPD_DIED); | 456 | _pppdata->setpppdError(E_PPPD_DIED); |
468 | removedns(); | 457 | removedns(); |
469 | Modem::modem->unlockdevice(); | 458 | Modem::modem->unlockdevice(); |
470 | // | 459 | // |
471 | con->pppdDied(); | 460 | con->pppdDied(); |
472 | 461 | ||
473 | if(!_pppdata->automatic_redial()) { | 462 | if(!_pppdata->automatic_redial()) { |
474 | quit_b->setFocus(); | 463 | quit_b->setFocus(); |
475 | show(); | 464 | show(); |
476 | con_win->stopClock(); | 465 | con_win->stopClock(); |
477 | //stopAccounting(); | 466 | //stopAccounting(); |
478 | con_win->hide(); | 467 | con_win->hide(); |
479 | con->hide(); | 468 | con->hide(); |
480 | 469 | ||
481 | _pppdata->setpppdRunning(false); | 470 | _pppdata->setpppdRunning(false); |
482 | // // not in a signal handler !!! KNotifyClient::beep(); | 471 | // // not in a signal handler !!! KNotifyClient::beep(); |
483 | QString msg; | 472 | QString msg; |
484 | if (_pppdata->pppdError() == E_IF_TIMEOUT) | 473 | if (_pppdata->pppdError() == E_IF_TIMEOUT) |
485 | msg = i18n("Timeout expired while waiting for the PPP interface " | 474 | msg = QObject::tr("Timeout expired while waiting for the PPP interface " |
486 | "to come up!"); | 475 | "to come up!"); |
487 | else { | 476 | else { |
488 | msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); | 477 | msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>"); |
489 | Modem::modem->pppdExitStatus(); | 478 | Modem::modem->pppdExitStatus(); |
490 | if (Modem::modem->lastStatus != 99) {// more recent pppds only | 479 | if (Modem::modem->lastStatus != 99) {// more recent pppds only |
491 | msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); | 480 | msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); |
492 | msg += i18n("</p><p>See 'man pppd' for an explanation of the error " | 481 | msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " |
493 | "codes or take a look at the kppp FAQ on " | 482 | "codes or take a look at the kppp FAQ on " |
494 | " <a href=http://devel-home.kde.org/~kppp/index.html>" | 483 | " <a href=http://devel-home.kde.org/~kppp/index.html>" |
495 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); | 484 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); |
496 | } | 485 | } |
497 | } | 486 | } |
498 | 487 | ||
499 | // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) | 488 | // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) |
500 | // // PPPL_ShowLog(); | 489 | // // PPPL_ShowLog(); |
501 | // } else { /* reconnect on disconnect */ | 490 | // } else { /* reconnect on disconnect */ |
502 | if (false){ | 491 | if (false){ |
503 | qDebug( "Trying to reconnect... " ); | 492 | qDebug( "Trying to reconnect... " ); |
504 | 493 | ||
505 | if(_pppdata->authMethod() == AUTH_PAP || | 494 | if(_pppdata->authMethod() == AUTH_PAP || |
506 | _pppdata->authMethod() == AUTH_CHAP || | 495 | _pppdata->authMethod() == AUTH_CHAP || |
507 | _pppdata->authMethod() == AUTH_PAPCHAP) | 496 | _pppdata->authMethod() == AUTH_PAPCHAP) |
508 | Modem::modem->setSecret(_pppdata->authMethod(), | 497 | Modem::modem->setSecret(_pppdata->authMethod(), |
509 | encodeWord(_pppdata->storedUsername()), | 498 | encodeWord(_pppdata->storedUsername()), |
510 | encodeWord(_pppdata->password())); | 499 | encodeWord(_pppdata->password())); |
511 | 500 | ||
512 | con_win->hide(); | 501 | con_win->hide(); |
513 | con_win->stopClock(); | 502 | con_win->stopClock(); |
514 | //stopAccounting(); | 503 | //stopAccounting(); |
515 | _pppdata->setpppdRunning(false); | 504 | _pppdata->setpppdRunning(false); |
516 | // not in a signal handler !!!KNotifyClient::beep(); | 505 | // not in a signal handler !!!KNotifyClient::beep(); |
517 | emit cmdl_start(); | 506 | emit cmdl_start(); |
518 | } | 507 | } |
519 | } | 508 | } |
520 | _pppdata->setpppdError(0); | 509 | _pppdata->setpppdError(0); |
521 | } | 510 | } |
522 | } | 511 | } |
523 | 512 | ||
524 | // void KPPPWidget::sigChld() { | 513 | // void KPPPWidget::sigChld() { |
525 | // qDebug( "sigchld()" ); | 514 | // qDebug( "sigchld()" ); |
526 | // // pid_t id = wait(0L); | 515 | // // pid_t id = wait(0L); |
527 | // // if(id == helperPid && helperPid != -1) { | 516 | // // if(id == helperPid && helperPid != -1) { |
528 | // // kdDebug(5002) << "It was the setuid child that died" << endl; | 517 | // // kdDebug(5002) << "It was the setuid child that died" << endl; |
529 | // // helperPid = -1; | 518 | // // helperPid = -1; |
530 | // QString msg = i18n("kppp's helper process just died.\n" | 519 | // QString msg = QObject::tr("kppp's helper process just died.\n" |
531 | // "Since a further execution would be pointless, " | 520 | // "Since a further execution would be pointless, " |
532 | // "kppp will shut down now."); | 521 | // "kppp will shut down now."); |
533 | // QMessageBox::warning(0L,"error", msg); | 522 | // QMessageBox::warning(0L,"error", msg); |
534 | // //remove_pidfile(); | 523 | // //remove_pidfile(); |
535 | // exit(1); | 524 | // exit(1); |
536 | // // } | 525 | // // } |
537 | // } | 526 | // } |
538 | 527 | ||
539 | 528 | ||
540 | void KPPPWidget::newdefaultaccount(int i) { | 529 | void KPPPWidget::newdefaultaccount(int i) { |
541 | _pppdata->setDefaultAccount(connectto_c->text(i)); | 530 | _pppdata->setDefaultAccount(connectto_c->text(i)); |
542 | _pppdata->save(); | 531 | _pppdata->save(); |
543 | ID_Edit->setText(_pppdata->storedUsername()); | 532 | ID_Edit->setText(_pppdata->storedUsername()); |
544 | PW_Edit->setText(_pppdata->storedPassword()); | 533 | PW_Edit->setText(_pppdata->storedPassword()); |
545 | } | 534 | } |
546 | 535 | ||
547 | 536 | ||
548 | 537 | ||
549 | 538 | ||
550 | void KPPPWidget::beginConnect() { | 539 | void KPPPWidget::beginConnect() { |
551 | // make sure to connect to the account that is selected in the combo box | 540 | // make sure to connect to the account that is selected in the combo box |
552 | // (exeption: an account given by a command line argument) | 541 | // (exeption: an account given by a command line argument) |
553 | // if(!m_bCmdlAccount) { | 542 | // if(!m_bCmdlAccount) { |
554 | // _pppdata->setAccount(connectto_c->currentText()); | 543 | // _pppdata->setAccount(connectto_c->currentText()); |
555 | // _pppdata->setPassword(PW_Edit->text()); | 544 | // _pppdata->setPassword(PW_Edit->text()); |
556 | // } else { | 545 | // } else { |
557 | _pppdata->setPassword(_pppdata->storedPassword()); | 546 | _pppdata->setPassword(_pppdata->storedPassword()); |
558 | // } | 547 | // } |
559 | 548 | ||
560 | QFileInfo info(pppdPath()); | 549 | QFileInfo info(pppdPath()); |
561 | 550 | ||
562 | if(!info.exists()){ | 551 | if(!info.exists()){ |
563 | QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" | 552 | QMessageBox::warning(this, "error", QObject::tr("Cannot find the PPP daemon!\n" |
564 | "Make sure that pppd is installed and " | 553 | "Make sure that pppd is installed and " |
565 | "that you have entered the correct path.")); | 554 | "that you have entered the correct path.")); |
566 | return; | 555 | return; |
567 | } | 556 | } |
568 | #if 0 | 557 | #if 0 |
569 | if(!info.isExecutable()){ | 558 | if(!info.isExecutable()){ |
570 | 559 | ||
571 | QString string; | 560 | QString string; |
572 | string = i18n("kppp cannot execute:\n %1\n" | 561 | string = QObject::tr("kppp cannot execute:\n %1\n" |
573 | "Please make sure that you have given kppp " | 562 | "Please make sure that you have given kppp " |
574 | "setuid permission and that " | 563 | "setuid permission and that " |
575 | "pppd is executable.").arg(_pppdata->pppdPath()); | 564 | "pppd is executable.").arg(_pppdata->pppdPath()); |
576 | KMessageBox::error(this, string); | 565 | KMessageBox::error(this, string); |
577 | return; | 566 | return; |
578 | 567 | ||
579 | } | 568 | } |
580 | #endif | 569 | #endif |
581 | 570 | ||
582 | QFileInfo info2(_pppdata->modemDevice()); | 571 | QFileInfo info2(_pppdata->modemDevice()); |
583 | 572 | ||
584 | if(!info2.exists()){ | 573 | if(!info2.exists()){ |
585 | QString string; | 574 | QString string; |
586 | string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " | 575 | string = QObject::tr("kppp can not find:\n %1\nPlease make sure you have setup " |
587 | "your modem device properly " | 576 | "your modem device properly " |
588 | "and/or adjust the location of the modem device on " | 577 | "and/or adjust the location of the modem device on " |
589 | "the modem tab of " | 578 | "the modem tab of " |
590 | "the setup dialog.").arg(_pppdata->modemDevice()); | 579 | "the setup dialog.").arg(_pppdata->modemDevice()); |
591 | QMessageBox::warning(this, "error", string); | 580 | QMessageBox::warning(this, "error", string); |
592 | return; | 581 | return; |
593 | } | 582 | } |
594 | 583 | ||
595 | // if this is a PAP or CHAP account, ensure that username is | 584 | // if this is a PAP or CHAP account, ensure that username is |
596 | // supplied | 585 | // supplied |
597 | if(_pppdata->authMethod() == AUTH_PAP || | 586 | if(_pppdata->authMethod() == AUTH_PAP || |
598 | _pppdata->authMethod() == AUTH_CHAP || | 587 | _pppdata->authMethod() == AUTH_CHAP || |
599 | _pppdata->authMethod() == AUTH_PAPCHAP ) { | 588 | _pppdata->authMethod() == AUTH_PAPCHAP ) { |
600 | if(ID_Edit->text().isEmpty()) { | 589 | if(ID_Edit->text().isEmpty()) { |
601 | QMessageBox::warning(this,"error", | 590 | QMessageBox::warning(this,"error", |
602 | i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!")); | 591 | QObject::tr("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!")); |
603 | return; | 592 | return; |
604 | } else { | 593 | } else { |
605 | if(!Modem::modem->setSecret(_pppdata->authMethod(), | 594 | if(!Modem::modem->setSecret(_pppdata->authMethod(), |
606 | encodeWord(_pppdata->storedUsername()), | 595 | encodeWord(_pppdata->storedUsername()), |
607 | encodeWord(_pppdata->password()))) { | 596 | encodeWord(_pppdata->password()))) { |
608 | QString s; | 597 | QString s; |
609 | s = i18n("Cannot create PAP/CHAP authentication\n" | 598 | s = QObject::tr("Cannot create PAP/CHAP authentication\n" |
610 | "file \"%1\"").arg(PAP_AUTH_FILE); | 599 | "file \"%1\"").arg(PAP_AUTH_FILE); |
611 | QMessageBox::warning(this, "error", s); | 600 | QMessageBox::warning(this, "error", s); |
612 | return; | 601 | return; |
613 | } | 602 | } |
614 | } | 603 | } |
615 | } | 604 | } |
616 | 605 | ||
617 | if (_pppdata->phonenumber().isEmpty()) { | 606 | if (_pppdata->phonenumber().isEmpty()) { |
618 | QString s = i18n("You must specify a telephone number!"); | 607 | QString s = QObject::tr("You must specify a telephone number!"); |
619 | QMessageBox::warning(this, "error", s); | 608 | QMessageBox::warning(this, "error", s); |
620 | return; | 609 | return; |
621 | } | 610 | } |
622 | 611 | ||
623 | this->hide(); | 612 | this->hide(); |
624 | 613 | ||
625 | QString tit = i18n("Connecting to: %1").arg(_pppdata->accname()); | 614 | QString tit = QObject::tr("Connecting to: %1").arg(_pppdata->accname()); |
626 | // con->setCaption(tit); | 615 | // con->setCaption(tit); |
627 | 616 | ||
628 | // con->show(); | 617 | // con->show(); |
629 | 618 | ||
630 | 619 | ||
631 | emit begin_connect(); | 620 | emit begin_connect(); |
632 | } | 621 | } |
633 | 622 | ||
634 | 623 | ||
635 | void KPPPWidget::disconnect() { | 624 | void KPPPWidget::disconnect() { |
636 | if (!_pppdata->command_before_disconnect().isEmpty()) { | 625 | if (!_pppdata->command_before_disconnect().isEmpty()) { |
637 | con_win->hide(); | 626 | con_win->hide(); |
638 | con->show(); | 627 | con->show(); |
639 | con->setCaption(i18n("Disconnecting...")); | 628 | con->setCaption(QObject::tr("Disconnecting...")); |
640 | con->setMsg(i18n("Executing command before disconnection.")); | 629 | con->setMsg(QObject::tr("Executing command before disconnection.")); |
641 | 630 | ||
642 | qApp->processEvents(); | 631 | qApp->processEvents(); |
643 | QApplication::flushX(); | 632 | QApplication::flushX(); |
644 | // pid_t id = | 633 | // pid_t id = |
645 | execute_command(_pppdata->command_before_disconnect()); | 634 | execute_command(_pppdata->command_before_disconnect()); |
646 | // int i, status; | 635 | // int i, status; |
647 | 636 | ||
648 | // do { | 637 | // do { |
649 | // kapp->processEvents(); | 638 | // kapp->processEvents(); |
650 | // i = waitpid(id, &status, WNOHANG); | 639 | // i = waitpid(id, &status, WNOHANG); |
651 | // usleep(500000); | 640 | // usleep(500000); |
652 | // } while (i == 0 && errno == 0); | 641 | // } while (i == 0 && errno == 0); |
653 | 642 | ||
654 | con->hide(); | 643 | con->hide(); |
655 | } | 644 | } |
656 | 645 | ||
657 | qApp->processEvents(); | 646 | qApp->processEvents(); |
658 | 647 | ||
659 | // statdlg->stop_stats(); | 648 | // statdlg->stop_stats(); |
660 | Modem::modem->killPPPDaemon(); | 649 | Modem::modem->killPPPDaemon(); |
661 | 650 | ||
662 | QApplication::flushX(); | 651 | QApplication::flushX(); |
663 | execute_command(_pppdata->command_on_disconnect()); | 652 | execute_command(_pppdata->command_on_disconnect()); |
664 | 653 | ||
665 | Modem::modem->removeSecret(AUTH_PAP); | 654 | Modem::modem->removeSecret(AUTH_PAP); |
666 | Modem::modem->removeSecret(AUTH_CHAP); | 655 | Modem::modem->removeSecret(AUTH_CHAP); |
667 | 656 | ||
668 | removedns(); | 657 | removedns(); |
669 | Modem::modem->unlockdevice(); | 658 | Modem::modem->unlockdevice(); |
670 | 659 | ||
671 | con_win->stopClock(); | 660 | con_win->stopClock(); |
672 | // p_kppp->stopAccounting(); | 661 | // p_kppp->stopAccounting(); |
673 | con_win->hide(); | 662 | con_win->hide(); |
674 | 663 | ||
675 | // DockWidget::dock_widget->stop_stats(); | 664 | // DockWidget::dock_widget->stop_stats(); |
676 | // DockWidget::dock_widget->hide(); | 665 | // DockWidget::dock_widget->hide(); |
677 | 666 | ||
678 | // if(m_bQuitOnDisconnect) | 667 | // if(m_bQuitOnDisconnect) |
679 | // kapp->exit(0); | 668 | // kapp->exit(0); |
680 | // else { | 669 | // else { |
681 | this->quit_b->setFocus(); | 670 | this->quit_b->setFocus(); |
682 | this->show(); | 671 | this->show(); |
683 | // } | 672 | // } |
684 | } | 673 | } |
685 | 674 | ||
686 | 675 | ||
687 | // void KPPPWidget::helpbutton() { | 676 | // void KPPPWidget::helpbutton() { |
688 | // kapp->invokeHelp(); | 677 | // kapp->invokeHelp(); |
689 | // } | 678 | // } |
690 | 679 | ||
691 | 680 | ||
692 | void KPPPWidget::quitbutton() { | 681 | void KPPPWidget::quitbutton() { |
693 | if(_pppdata->pppdRunning()) { | 682 | if(_pppdata->pppdRunning()) { |
694 | int ok = QMessageBox::warning(this, | 683 | int ok = QMessageBox::warning(this, |
695 | i18n("Exiting kPPP will close your PPP Session."), | 684 | QObject::tr("Exiting kPPP will close your PPP Session."), |
696 | i18n("Quit kPPP?")); | 685 | QObject::tr("Quit kPPP?")); |
697 | if(ok == QMessageBox::Yes) { | 686 | if(ok == QMessageBox::Yes) { |
698 | Modem::modem->killPPPDaemon(); | 687 | Modem::modem->killPPPDaemon(); |
699 | QApplication::flushX(); | 688 | QApplication::flushX(); |
700 | execute_command(_pppdata->command_on_disconnect()); | 689 | execute_command(_pppdata->command_on_disconnect()); |
701 | removedns(); | 690 | removedns(); |
702 | Modem::modem->unlockdevice(); | 691 | Modem::modem->unlockdevice(); |
703 | } | 692 | } |
704 | } else { | 693 | } else { |
705 | if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) | 694 | if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) |
706 | _pppdata->setStoredPassword(""); | 695 | _pppdata->setStoredPassword(""); |
707 | } | 696 | } |
708 | _pppdata->save(); | 697 | _pppdata->save(); |
709 | qApp->quit(); | 698 | qApp->quit(); |
710 | } | 699 | } |
711 | 700 | ||
712 | 701 | ||
713 | // void KPPPWidget::rulesetLoadError() { | 702 | // void KPPPWidget::rulesetLoadError() { |
714 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); | 703 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); |
715 | // } | 704 | // } |
716 | 705 | ||
717 | 706 | ||
718 | // void KPPPWidget::startAccounting() { | 707 | // void KPPPWidget::startAccounting() { |
719 | // // volume accounting | 708 | // // volume accounting |
720 | // stats->totalbytes = 0; | 709 | // stats->totalbytes = 0; |
721 | 710 | ||
722 | // kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl; | 711 | // kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl; |
723 | 712 | ||
724 | // // load the ruleset | 713 | // // load the ruleset |
725 | // if(!_pppdata->AcctEnabled()) | 714 | // if(!_pppdata->AcctEnabled()) |
726 | // return; | 715 | // return; |
727 | 716 | ||
728 | // QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); | 717 | // QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); |
729 | // // if(::access(d.data(), X_OK) != 0) | 718 | // // if(::access(d.data(), X_OK) != 0) |
730 | // acct = new Accounting(this, stats); | 719 | // acct = new Accounting(this, stats); |
731 | // // else | 720 | // // else |
732 | // // acct = new ExecutableAccounting(this); | 721 | // // acct = new ExecutableAccounting(this); |
733 | 722 | ||
734 | // // connect to the accounting object | 723 | // // connect to the accounting object |
735 | // connect(acct, SIGNAL(changed(QString, QString)), | 724 | // connect(acct, SIGNAL(changed(QString, QString)), |
736 | // con_win, SLOT(slotAccounting(QString, QString))); | 725 | // con_win, SLOT(slotAccounting(QString, QString))); |
737 | 726 | ||
738 | // // if(!acct->loadRuleSet(_pppdata->accountingFile())) { | 727 | // // if(!acct->loadRuleSet(_pppdata->accountingFile())) { |
739 | // // QString s= i18n("Can not load the accounting " | 728 | // // QString s= QObject::tr("Can not load the accounting " |
740 | // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); | 729 | // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); |
741 | 730 | ||
742 | // // starting the messagebox with a timer will prevent us | 731 | // // starting the messagebox with a timer will prevent us |
743 | // // from blocking the calling function ConnectWidget::timerEvent | 732 | // // from blocking the calling function ConnectWidget::timerEvent |
744 | // ruleset_load_errmsg = s; | 733 | // ruleset_load_errmsg = s; |
745 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); | 734 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); |
746 | // return; | 735 | // return; |
747 | // } | 736 | // } |
748 | // //else | 737 | // //else |
749 | // // acct->slotStart(); | 738 | // // acct->slotStart(); |
750 | // } | 739 | // } |
751 | 740 | ||
752 | // void KPPPWidget::stopAccounting() { | 741 | // void KPPPWidget::stopAccounting() { |
753 | // // store volume accounting | 742 | // // store volume accounting |
754 | // // if(stats->totalbytes != 0) | 743 | // // if(stats->totalbytes != 0) |
755 | // // _pppdata->setTotalBytes(stats->totalbytes); | 744 | // // _pppdata->setTotalBytes(stats->totalbytes); |
756 | 745 | ||
757 | // if(!_pppdata->AcctEnabled()) | 746 | // if(!_pppdata->AcctEnabled()) |
758 | // return; | 747 | // return; |
759 | 748 | ||
760 | // // if(acct != 0) { | 749 | // // if(acct != 0) { |
761 | // // acct->slotStop(); | 750 | // // acct->slotStop(); |
762 | // // delete acct; | 751 | // // delete acct; |
763 | // // acct = 0; | 752 | // // acct = 0; |
764 | // // } | 753 | // // } |
765 | // } | 754 | // } |
766 | 755 | ||
767 | 756 | ||
768 | // void KPPPWidget::showStats() { | 757 | // void KPPPWidget::showStats() { |
769 | // if(statdlg) { | 758 | // if(statdlg) { |
770 | // statdlg->show(); | 759 | // statdlg->show(); |
771 | // statdlg->raise(); | 760 | // statdlg->raise(); |
772 | // } | 761 | // } |
773 | // } | 762 | // } |
774 | 763 | ||
775 | 764 | ||
776 | void KPPPWidget::usernameChanged(const QString &) { | 765 | void KPPPWidget::usernameChanged(const QString &) { |
777 | // store username for later use | 766 | // store username for later use |
778 | _pppdata->setStoredUsername(ID_Edit->text()); | 767 | _pppdata->setStoredUsername(ID_Edit->text()); |
779 | } | 768 | } |
780 | 769 | ||
781 | 770 | ||
782 | void KPPPWidget::passwordChanged(const QString &) { | 771 | void KPPPWidget::passwordChanged(const QString &) { |
783 | // store the password if so requested | 772 | // store the password if so requested |
784 | if(_pppdata->storePassword()) | 773 | if(_pppdata->storePassword()) |
785 | _pppdata->setStoredPassword(PW_Edit->text()); | 774 | _pppdata->setStoredPassword(PW_Edit->text()); |
786 | else | 775 | else |
787 | _pppdata->setStoredPassword(""); | 776 | _pppdata->setStoredPassword(""); |
788 | } | 777 | } |
789 | 778 | ||
790 | 779 | ||
791 | void KPPPWidget::setPW_Edit(const QString &pw) { | 780 | void KPPPWidget::setPW_Edit(const QString &pw) { |
792 | PW_Edit->setText(pw); | 781 | PW_Edit->setText(pw); |
793 | } | 782 | } |
794 | 783 | ||
795 | 784 | ||
796 | // void KPPPWidget::resetCosts(const QString &s) { | 785 | // void KPPPWidget::resetCosts(const QString &s) { |
797 | // AccountingBase::resetCosts(s); | 786 | // AccountingBase::resetCosts(s); |
798 | // } | 787 | // } |
799 | 788 | ||
800 | 789 | ||
801 | // void KPPPWidget::resetVolume(const QString &s) { | 790 | // void KPPPWidget::resetVolume(const QString &s) { |
802 | // AccountingBase::resetVolume(s); | 791 | // AccountingBase::resetVolume(s); |
803 | // } | 792 | // } |
804 | 793 | ||
805 | /** | 794 | /** |
806 | * pppd's getword() function knows about escape characters. | 795 | * pppd's getword() function knows about escape characters. |
807 | * If we write the username and password to the secrets file | 796 | * If we write the username and password to the secrets file |
808 | * we'll therefore have to escape back slashes. | 797 | * we'll therefore have to escape back slashes. |
809 | */ | 798 | */ |
810 | QString KPPPWidget::encodeWord(const QString &s) { | 799 | QString KPPPWidget::encodeWord(const QString &s) { |
811 | QString r = s; | 800 | QString r = s; |
812 | r.replace(QRegExp("\\"), "\\\\"); | 801 | r.replace(QRegExp("\\"), "\\\\"); |
813 | return r; | 802 | return r; |
814 | } | 803 | } |
815 | 804 | ||
816 | // void KPPPWidget::setQuitOnDisconnect (bool b) | 805 | // void KPPPWidget::setQuitOnDisconnect (bool b) |
817 | // { | 806 | // { |
818 | // m_bQuitOnDisconnect = b; | 807 | // m_bQuitOnDisconnect = b; |
819 | // } | 808 | // } |
820 | 809 | ||
821 | void KPPPWidget::showNews() { | 810 | void KPPPWidget::showNews() { |
822 | #ifdef KPPP_SHOW_NEWS | 811 | #ifdef KPPP_SHOW_NEWS |
823 | /* | 812 | /* |
824 | * Introduce the QuickHelp feature to new users of this version | 813 | * Introduce the QuickHelp feature to new users of this version |
825 | */ | 814 | */ |
826 | #define QUICKHELP_HINT "Hint_QuickHelp" | 815 | #define QUICKHELP_HINT "Hint_QuickHelp" |
827 | if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { | 816 | if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { |
828 | QDialog dlg(0, 0, true); | 817 | QDialog dlg(0, 0, true); |
829 | dlg.setCaption(i18n("Recent Changes in KPPP")); | 818 | dlg.setCaption(QObject::tr("Recent Changes in KPPP")); |
830 | 819 | ||
831 | QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); | 820 | QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); |
832 | QHBoxLayout *l1 = new QHBoxLayout(10); | 821 | QHBoxLayout *l1 = new QHBoxLayout(10); |
833 | QVBoxLayout *l2 = new QVBoxLayout(10); | 822 | QVBoxLayout *l2 = new QVBoxLayout(10); |
834 | tl->addLayout(l1); | 823 | tl->addLayout(l1); |
835 | 824 | ||
836 | QLabel *icon = new QLabel(&dlg); | 825 | QLabel *icon = new QLabel(&dlg); |
837 | icon->setPixmap(BarIcon("exclamation")); | 826 | icon->setPixmap(BarIcon("exclamation")); |
838 | icon->setFixedSize(icon->sizeHint()); | 827 | icon->setFixedSize(icon->sizeHint()); |
839 | l1->addWidget(icon); | 828 | l1->addWidget(icon); |
840 | l1->addLayout(l2); | 829 | l1->addLayout(l2); |
841 | 830 | ||
842 | QLabel *l = new QLabel(i18n("From version 1.4.8 on, kppp has a new feature\n" | 831 | QLabel *l = new QLabel(QObject::tr("From version 1.4.8 on, kppp has a new feature\n" |
843 | "called \"Quickhelp\". It's similar to a tooltip,\n" | 832 | "called \"Quickhelp\". It's similar to a tooltip,\n" |
844 | "but you can activate it whenever you want.\n" | 833 | "but you can activate it whenever you want.\n" |
845 | "\n" | 834 | "\n" |
846 | "To activate it, simply click on a control like\n" | 835 | "To activate it, simply click on a control like\n" |
847 | "a button or a label with the right mouse button.\n" | 836 | "a button or a label with the right mouse button.\n" |
848 | "If the item supports Quickhelp, a popup menu\n" | 837 | "If the item supports Quickhelp, a popup menu\n" |
849 | "will appear leading to Quickhelp.\n" | 838 | "will appear leading to Quickhelp.\n" |
850 | "\n" | 839 | "\n" |
851 | "To test it, right-click somewhere in this text."), | 840 | "To test it, right-click somewhere in this text."), |
852 | &dlg); | 841 | &dlg); |
853 | 842 | ||
854 | QCheckBox *cb = new QCheckBox(i18n("Don't show this hint again"), &dlg); | 843 | QCheckBox *cb = new QCheckBox(QObject::tr("Don't show this hint again"), &dlg); |
855 | cb->setFixedSize(cb->sizeHint()); | 844 | cb->setFixedSize(cb->sizeHint()); |
856 | 845 | ||
857 | KButtonBox *bbox = new KButtonBox(&dlg); | 846 | KButtonBox *bbox = new KButtonBox(&dlg); |
858 | bbox->addStretch(1); | 847 | bbox->addStretch(1); |
859 | QPushButton *ok = bbox->addButton(i18n("OK")); | 848 | QPushButton *ok = bbox->addButton(QObject::tr("OK")); |
860 | ok->setDefault(true); | 849 | ok->setDefault(true); |
861 | dlg.connect(ok, SIGNAL(clicked()), | 850 | dlg.connect(ok, SIGNAL(clicked()), |
862 | &dlg, SLOT(accept())); | 851 | &dlg, SLOT(accept())); |
863 | bbox->addStretch(1); | 852 | bbox->addStretch(1); |
864 | bbox->layout(); | 853 | bbox->layout(); |
865 | 854 | ||
866 | l2->addWidget(l); | 855 | l2->addWidget(l); |
867 | l2->addWidget(cb); | 856 | l2->addWidget(cb); |
868 | tl->addWidget(bbox); | 857 | tl->addWidget(bbox); |
869 | 858 | ||
870 | QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n" | 859 | QString tmp = QObject::tr("This is an example of <b>QuickHelp</b>.\n" |
871 | "This window will stay open until you\n" | 860 | "This window will stay open until you\n" |
872 | "click a mouse button or a press a key.\n"); | 861 | "click a mouse button or a press a key.\n"); |
873 | 862 | ||
874 | QWhatsThis::add(cb,tmp); | 863 | QWhatsThis::add(cb,tmp); |
875 | QWhatsThis::add(l, tmp); | 864 | QWhatsThis::add(l, tmp); |
876 | 865 | ||
877 | dlg.exec(); | 866 | dlg.exec(); |
878 | if(cb->isChecked()) { | 867 | if(cb->isChecked()) { |
879 | _pppdata->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); | 868 | _pppdata->writeConfig(GENERAL_GRP, QUICKHELP_HINT, 1); |
880 | _pppdata->save(); | 869 | _pppdata->save(); |
881 | } | 870 | } |
882 | } | 871 | } |
883 | #endif | 872 | #endif |
884 | } | 873 | } |
885 | 874 | ||
886 | 875 | ||
887 | //#include "kpppwidget.moc" | 876 | //#include "kpppwidget.moc" |
888 | 877 | ||