author | tille <tille> | 2003-06-02 14:25:18 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-02 14:25:18 (UTC) |
commit | c1e61c513803b05eea14de18604ef05d2f73d5a7 (patch) (unidiff) | |
tree | 9b4abc263eda4a6d0e9610bc22074f0d787c28e5 | |
parent | c74e5cd0fc051750c3d88cba0178f62b8ce3b5bb (diff) | |
download | opie-c1e61c513803b05eea14de18604ef05d2f73d5a7.zip opie-c1e61c513803b05eea14de18604ef05d2f73d5a7.tar.gz opie-c1e61c513803b05eea14de18604ef05d2f73d5a7.tar.bz2 |
save pppd arguments
-rw-r--r-- | noncore/settings/networksettings/ppp/TODO | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdargs.cpp | 31 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdargs.h | 2 |
4 files changed, 11 insertions, 28 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO index 9425628..529d236 100644 --- a/noncore/settings/networksettings/ppp/TODO +++ b/noncore/settings/networksettings/ppp/TODO | |||
@@ -1,8 +1,7 @@ | |||
1 | - add possibility to input username and password ;) | 1 | - add possibility to input username and password ;) |
2 | - impl. PPPData::copyaccount & PPPData::deleteAccount | 2 | - impl. PPPData::copyaccount & PPPData::deleteAccount |
3 | - update modem attribute inputs when modem has changed | 3 | - update modem attribute inputs when modem has changed |
4 | - fix layout of edit account | 4 | - fix layout of edit account, i.e. get it shown maximised |
5 | - save pppd arguments in edit account | ||
6 | - popup configure modem with the correct account prselected | 5 | - popup configure modem with the correct account prselected |
7 | not quite shure why it does not work... IMHO it should work | 6 | not quite shure why it does not work... IMHO it should work |
8 | - remove interfaces | 7 | - remove interfaces |
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 10bc25c..45d6e4f 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -86,274 +86,273 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount | |||
86 | lpn1->addWidget(up); | 86 | lpn1->addWidget(up); |
87 | lpn1->addWidget(down); | 87 | lpn1->addWidget(down); |
88 | connect(add, SIGNAL(clicked()), | 88 | connect(add, SIGNAL(clicked()), |
89 | this, SLOT(addNumber())); | 89 | this, SLOT(addNumber())); |
90 | connect(del, SIGNAL(clicked()), | 90 | connect(del, SIGNAL(clicked()), |
91 | this, SLOT(delNumber())); | 91 | this, SLOT(delNumber())); |
92 | connect(up, SIGNAL(clicked()), | 92 | connect(up, SIGNAL(clicked()), |
93 | this, SLOT(upNumber())); | 93 | this, SLOT(upNumber())); |
94 | connect(down, SIGNAL(clicked()), | 94 | connect(down, SIGNAL(clicked()), |
95 | this, SLOT(downNumber())); | 95 | this, SLOT(downNumber())); |
96 | connect(numbers, SIGNAL(highlighted(int)), | 96 | connect(numbers, SIGNAL(highlighted(int)), |
97 | this, SLOT(selectionChanged(int))); | 97 | this, SLOT(selectionChanged(int))); |
98 | numbersChanged(); | 98 | numbersChanged(); |
99 | 99 | ||
100 | tmp = tr("<p>Specifies the phone numbers to dial. You\n" | 100 | tmp = tr("<p>Specifies the phone numbers to dial. You\n" |
101 | "can supply multiple numbers here, simply\n" | 101 | "can supply multiple numbers here, simply\n" |
102 | "click on \"Add\". You can arrange the\n" | 102 | "click on \"Add\". You can arrange the\n" |
103 | "order the numbers are tried by using the\n" | 103 | "order the numbers are tried by using the\n" |
104 | "arrow buttons.\n\n" | 104 | "arrow buttons.\n\n" |
105 | "When a number is busy or fails, <i>kppp</i> will \n" | 105 | "When a number is busy or fails, <i>kppp</i> will \n" |
106 | "try the next number and so on"); | 106 | "try the next number and so on"); |
107 | 107 | ||
108 | QWhatsThis::add(number_label,tmp); | 108 | QWhatsThis::add(number_label,tmp); |
109 | QWhatsThis::add(numbers,tmp); | 109 | QWhatsThis::add(numbers,tmp); |
110 | 110 | ||
111 | auth_l = new QLabel(tr("Authentication:"), this); | 111 | auth_l = new QLabel(tr("Authentication:"), this); |
112 | tl->addWidget(auth_l, 3, 0); | 112 | tl->addWidget(auth_l, 3, 0); |
113 | 113 | ||
114 | auth = new QComboBox(this); | 114 | auth = new QComboBox(this); |
115 | auth->insertItem(tr("Script-based")); | 115 | auth->insertItem(tr("Script-based")); |
116 | auth->insertItem(tr("PAP")); | 116 | auth->insertItem(tr("PAP")); |
117 | auth->insertItem(tr("Terminal-based")); | 117 | auth->insertItem(tr("Terminal-based")); |
118 | auth->insertItem(tr("CHAP")); | 118 | auth->insertItem(tr("CHAP")); |
119 | auth->insertItem(tr("PAP/CHAP")); | 119 | auth->insertItem(tr("PAP/CHAP")); |
120 | tl->addWidget(auth, 3, 1); | 120 | tl->addWidget(auth, 3, 1); |
121 | tmp = tr("<p>Specifies the method used to identify yourself to\n" | 121 | tmp = tr("<p>Specifies the method used to identify yourself to\n" |
122 | "the PPP server. Most universities still use\n" | 122 | "the PPP server. Most universities still use\n" |
123 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" | 123 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" |
124 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" | 124 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" |
125 | "unsure, contact your ISP.\n" | 125 | "unsure, contact your ISP.\n" |
126 | "\n" | 126 | "\n" |
127 | "If you can choose between PAP and CHAP,\n" | 127 | "If you can choose between PAP and CHAP,\n" |
128 | "choose CHAP, because it's much safer. If you don't know\n" | 128 | "choose CHAP, because it's much safer. If you don't know\n" |
129 | "whether PAP or CHAP is right, choose PAP/CHAP."); | 129 | "whether PAP or CHAP is right, choose PAP/CHAP."); |
130 | 130 | ||
131 | QWhatsThis::add(auth_l,tmp); | 131 | QWhatsThis::add(auth_l,tmp); |
132 | QWhatsThis::add(auth,tmp); | 132 | QWhatsThis::add(auth,tmp); |
133 | 133 | ||
134 | store_password = new QCheckBox(tr("Store password"), this); | 134 | store_password = new QCheckBox(tr("Store password"), this); |
135 | store_password->setChecked(true); | 135 | store_password->setChecked(true); |
136 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); | 136 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); |
137 | QWhatsThis::add(store_password, | 137 | QWhatsThis::add(store_password, |
138 | tr("<p>When this is turned on, your ISP password\n" | 138 | tr("<p>When this is turned on, your ISP password\n" |
139 | "will be saved in <i>kppp</i>'s config file, so\n" | 139 | "will be saved in <i>kppp</i>'s config file, so\n" |
140 | "you do not need to type it in every time.\n" | 140 | "you do not need to type it in every time.\n" |
141 | "\n" | 141 | "\n" |
142 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" | 142 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" |
143 | "plain text in the config file, which is\n" | 143 | "plain text in the config file, which is\n" |
144 | "readable only to you. Make sure nobody\n" | 144 | "readable only to you. Make sure nobody\n" |
145 | "gains access to this file!")); | 145 | "gains access to this file!")); |
146 | 146 | ||
147 | pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this); | 147 | pppdargs = new QPushButton(tr("Customize pppd Arguments..."), this); |
148 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); | 148 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); |
149 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); | 149 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); |
150 | 150 | ||
151 | // Set defaults if editing an existing connection | 151 | // Set defaults if editing an existing connection |
152 | if(!isnewaccount) { | 152 | if(!isnewaccount) { |
153 | connectname_l->setText(_pppdata->accname()); | 153 | connectname_l->setText(_pppdata->accname()); |
154 | 154 | ||
155 | // insert the phone numbers into the listbox | 155 | // insert the phone numbers into the listbox |
156 | QString n = _pppdata->phonenumber(); | 156 | QString n = _pppdata->phonenumber(); |
157 | QString tmp = ""; | 157 | QString tmp = ""; |
158 | uint idx = 0; | 158 | uint idx = 0; |
159 | while(idx != n.length()) { | 159 | while(idx != n.length()) { |
160 | if(n[idx] == ':') { | 160 | if(n[idx] == ':') { |
161 | if(tmp.length() > 0) | 161 | if(tmp.length() > 0) |
162 | numbers->insertItem(tmp); | 162 | numbers->insertItem(tmp); |
163 | tmp = ""; | 163 | tmp = ""; |
164 | } else | 164 | } else |
165 | tmp += n[idx]; | 165 | tmp += n[idx]; |
166 | idx++; | 166 | idx++; |
167 | } | 167 | } |
168 | if(tmp.length() > 0) | 168 | if(tmp.length() > 0) |
169 | numbers->insertItem(tmp); | 169 | numbers->insertItem(tmp); |
170 | 170 | ||
171 | auth->setCurrentItem(_pppdata->authMethod()); | 171 | auth->setCurrentItem(_pppdata->authMethod()); |
172 | store_password->setChecked(_pppdata->storePassword()); | 172 | store_password->setChecked(_pppdata->storePassword()); |
173 | } else { | 173 | } else { |
174 | // select PAP/CHAP as default | 174 | // select PAP/CHAP as default |
175 | auth->setCurrentItem(AUTH_PAPCHAP); | 175 | auth->setCurrentItem(AUTH_PAPCHAP); |
176 | } | 176 | } |
177 | 177 | ||
178 | numbersChanged(); | 178 | numbersChanged(); |
179 | tl->activate(); | 179 | tl->activate(); |
180 | } | 180 | } |
181 | 181 | ||
182 | |||
183 | bool DialWidget::save() { | 182 | bool DialWidget::save() { |
184 | //first check to make sure that the account name is unique! | 183 | //first check to make sure that the account name is unique! |
185 | if(connectname_l->text().isEmpty() || | 184 | if(connectname_l->text().isEmpty() || |
186 | !_pppdata->isUniqueAccname(connectname_l->text())) { | 185 | !_pppdata->isUniqueAccname(connectname_l->text())) { |
187 | return false; | 186 | return false; |
188 | } else { | 187 | } else { |
189 | _pppdata->setAccname(connectname_l->text()); | 188 | _pppdata->setAccname(connectname_l->text()); |
190 | 189 | ||
191 | QString number = ""; | 190 | QString number = ""; |
192 | for(uint i = 0; i < numbers->count(); i++) { | 191 | for(uint i = 0; i < numbers->count(); i++) { |
193 | if(i != 0) | 192 | if(i != 0) |
194 | number += ":"; | 193 | number += ":"; |
195 | number += numbers->text(i); | 194 | number += numbers->text(i); |
196 | } | 195 | } |
197 | 196 | ||
198 | _pppdata->setPhonenumber(number); | 197 | _pppdata->setPhonenumber(number); |
199 | _pppdata->setAuthMethod(auth->currentItem()); | 198 | _pppdata->setAuthMethod(auth->currentItem()); |
200 | _pppdata->setStorePassword(store_password->isChecked()); | 199 | _pppdata->setStorePassword(store_password->isChecked()); |
201 | return true; | 200 | return true; |
202 | } | 201 | } |
203 | } | 202 | } |
204 | 203 | ||
205 | 204 | ||
206 | void DialWidget::numbersChanged() { | 205 | void DialWidget::numbersChanged() { |
207 | int sel = numbers->currentItem(); | 206 | int sel = numbers->currentItem(); |
208 | 207 | ||
209 | del->setEnabled(sel != -1); | 208 | del->setEnabled(sel != -1); |
210 | up->setEnabled(sel != -1 && sel != 0); | 209 | up->setEnabled(sel != -1 && sel != 0); |
211 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); | 210 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); |
212 | } | 211 | } |
213 | 212 | ||
214 | 213 | ||
215 | void DialWidget::selectionChanged(int) { | 214 | void DialWidget::selectionChanged(int) { |
216 | numbersChanged(); | 215 | numbersChanged(); |
217 | } | 216 | } |
218 | 217 | ||
219 | 218 | ||
220 | void DialWidget::addNumber() { | 219 | void DialWidget::addNumber() { |
221 | PhoneNumberDialog dlg(this); | 220 | PhoneNumberDialog dlg(this); |
222 | if(dlg.exec()) { | 221 | if(dlg.exec()) { |
223 | numbers->insertItem(dlg.phoneNumber()); | 222 | numbers->insertItem(dlg.phoneNumber()); |
224 | numbersChanged(); | 223 | numbersChanged(); |
225 | } | 224 | } |
226 | } | 225 | } |
227 | 226 | ||
228 | 227 | ||
229 | void DialWidget::delNumber() { | 228 | void DialWidget::delNumber() { |
230 | if(numbers->currentItem() != -1) { | 229 | if(numbers->currentItem() != -1) { |
231 | numbers->removeItem(numbers->currentItem()); | 230 | numbers->removeItem(numbers->currentItem()); |
232 | numbersChanged(); | 231 | numbersChanged(); |
233 | } | 232 | } |
234 | } | 233 | } |
235 | 234 | ||
236 | 235 | ||
237 | void DialWidget::upNumber() { | 236 | void DialWidget::upNumber() { |
238 | int idx = numbers->currentItem(); | 237 | int idx = numbers->currentItem(); |
239 | if(idx != -1) { | 238 | if(idx != -1) { |
240 | QString item = numbers->text(idx); | 239 | QString item = numbers->text(idx); |
241 | numbers->removeItem(idx); | 240 | numbers->removeItem(idx); |
242 | numbers->insertItem(item, idx-1); | 241 | numbers->insertItem(item, idx-1); |
243 | numbers->setCurrentItem(idx-1); | 242 | numbers->setCurrentItem(idx-1); |
244 | numbersChanged(); | 243 | numbersChanged(); |
245 | } | 244 | } |
246 | } | 245 | } |
247 | 246 | ||
248 | 247 | ||
249 | void DialWidget::downNumber() { | 248 | void DialWidget::downNumber() { |
250 | int idx = numbers->currentItem(); | 249 | int idx = numbers->currentItem(); |
251 | if(idx != -1) { | 250 | if(idx != -1) { |
252 | QString item = numbers->text(idx); | 251 | QString item = numbers->text(idx); |
253 | numbers->removeItem(idx); | 252 | numbers->removeItem(idx); |
254 | numbers->insertItem(item, idx+1); | 253 | numbers->insertItem(item, idx+1); |
255 | numbers->setCurrentItem(idx+1); | 254 | numbers->setCurrentItem(idx+1); |
256 | numbersChanged(); | 255 | numbersChanged(); |
257 | } | 256 | } |
258 | } | 257 | } |
259 | 258 | ||
260 | 259 | ||
261 | void DialWidget::pppdargsbutton() { | 260 | void DialWidget::pppdargsbutton() { |
262 | PPPdArguments pa(_pppdata, this); | 261 | PPPdArguments pa(_pppdata, this); |
263 | pa.exec(); | 262 | pa.exec(); |
264 | } | 263 | } |
265 | 264 | ||
266 | 265 | ||
267 | 266 | ||
268 | ///////////////////////////////////////////////////////////////////////////// | 267 | ///////////////////////////////////////////////////////////////////////////// |
269 | // ExecWidget | 268 | // ExecWidget |
270 | ///////////////////////////////////////////////////////////////////////////// | 269 | ///////////////////////////////////////////////////////////////////////////// |
271 | ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) : | 270 | ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) : |
272 | QWidget(parent, name), _pppdata(pd) | 271 | QWidget(parent, name), _pppdata(pd) |
273 | { | 272 | { |
274 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 273 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
275 | 274 | ||
276 | QLabel *l = new QLabel( tr("Here you can select commands to run at certain stages of the connection. The commands are run with your real user id, so you cannot run any commands here requiring root permissions (unless, of course, you are root).<br><br>Be sure to supply the whole path to the program otherwise we might be unable to find it."), this); | 275 | QLabel *l = new QLabel( tr("Here you can select commands to run at certain stages of the connection. The commands are run with your real user id, so you cannot run any commands here requiring root permissions (unless, of course, you are root).<br><br>Be sure to supply the whole path to the program otherwise we might be unable to find it."), this); |
277 | 276 | ||
278 | tl->addWidget(l); | 277 | tl->addWidget(l); |
279 | tl->addStretch(1); | 278 | tl->addStretch(1); |
280 | 279 | ||
281 | QGridLayout *l1 = new QGridLayout(4, 2, 10); | 280 | QGridLayout *l1 = new QGridLayout(4, 2, 10); |
282 | tl->addLayout(l1); | 281 | tl->addLayout(l1); |
283 | l1->setColStretch(0, 0); | 282 | l1->setColStretch(0, 0); |
284 | l1->setColStretch(1, 1); | 283 | l1->setColStretch(1, 1); |
285 | 284 | ||
286 | before_connect_l = new QLabel(tr("Before connect:"), this); | 285 | before_connect_l = new QLabel(tr("Before connect:"), this); |
287 | before_connect_l->setAlignment(AlignVCenter); | 286 | before_connect_l->setAlignment(AlignVCenter); |
288 | l1->addWidget(before_connect_l, 0, 0); | 287 | l1->addWidget(before_connect_l, 0, 0); |
289 | before_connect = new QLineEdit(this); | 288 | before_connect = new QLineEdit(this); |
290 | // before_connect->setMaxLength(COMMAND_SIZE); | 289 | // before_connect->setMaxLength(COMMAND_SIZE); |
291 | l1->addWidget(before_connect, 0, 1); | 290 | l1->addWidget(before_connect, 0, 1); |
292 | QString tmp = tr("Allows you to run a program <b>before</b> a connection\n" | 291 | QString tmp = tr("Allows you to run a program <b>before</b> a connection\n" |
293 | "is established. It is called immediately before\n" | 292 | "is established. It is called immediately before\n" |
294 | "dialing has begun.\n\n" | 293 | "dialing has begun.\n\n" |
295 | "This might be useful, e.g. to stop HylaFAX blocking the\n" | 294 | "This might be useful, e.g. to stop HylaFAX blocking the\n" |
296 | "modem."); | 295 | "modem."); |
297 | 296 | ||
298 | QWhatsThis::add(before_connect_l,tmp); | 297 | QWhatsThis::add(before_connect_l,tmp); |
299 | QWhatsThis::add(before_connect,tmp); | 298 | QWhatsThis::add(before_connect,tmp); |
300 | 299 | ||
301 | command_label = new QLabel(tr("Upon connect:"), this); | 300 | command_label = new QLabel(tr("Upon connect:"), this); |
302 | command_label->setAlignment(AlignVCenter); | 301 | command_label->setAlignment(AlignVCenter); |
303 | l1->addWidget(command_label, 1, 0); | 302 | l1->addWidget(command_label, 1, 0); |
304 | command = new QLineEdit(this); | 303 | command = new QLineEdit(this); |
305 | // command->setMaxLength(COMMAND_SIZE); | 304 | // command->setMaxLength(COMMAND_SIZE); |
306 | l1->addWidget(command, 1, 1); | 305 | l1->addWidget(command, 1, 1); |
307 | tmp = tr("Allows you to run a program <b>after</b> a connection\n" | 306 | tmp = tr("Allows you to run a program <b>after</b> a connection\n" |
308 | "is established. When your program is called, all\n" | 307 | "is established. When your program is called, all\n" |
309 | "preparations for an Internet connection are finished.\n" | 308 | "preparations for an Internet connection are finished.\n" |
310 | "\n" | 309 | "\n" |
311 | "Very useful for fetching mail and news"); | 310 | "Very useful for fetching mail and news"); |
312 | 311 | ||
313 | QWhatsThis::add(command_label,tmp); | 312 | QWhatsThis::add(command_label,tmp); |
314 | QWhatsThis::add(command,tmp); | 313 | QWhatsThis::add(command,tmp); |
315 | 314 | ||
316 | predisconnect_label = new QLabel(tr("Before disconnect:"), | 315 | predisconnect_label = new QLabel(tr("Before disconnect:"), |
317 | this); | 316 | this); |
318 | predisconnect_label->setAlignment(AlignVCenter); | 317 | predisconnect_label->setAlignment(AlignVCenter); |
319 | l1->addWidget(predisconnect_label, 2, 0); | 318 | l1->addWidget(predisconnect_label, 2, 0); |
320 | predisconnect = new QLineEdit(this); | 319 | predisconnect = new QLineEdit(this); |
321 | // predisconnect->setMaxLength(COMMAND_SIZE); | 320 | // predisconnect->setMaxLength(COMMAND_SIZE); |
322 | l1->addWidget(predisconnect, 2, 1); | 321 | l1->addWidget(predisconnect, 2, 1); |
323 | tmp = tr("Allows you to run a program <b>before</b> a connection\n" | 322 | tmp = tr("Allows you to run a program <b>before</b> a connection\n" |
324 | "is closed. The connection will stay open until\n" | 323 | "is closed. The connection will stay open until\n" |
325 | "the program exits."); | 324 | "the program exits."); |
326 | 325 | ||
327 | QWhatsThis::add(predisconnect_label,tmp); | 326 | QWhatsThis::add(predisconnect_label,tmp); |
328 | QWhatsThis::add(predisconnect,tmp); | 327 | QWhatsThis::add(predisconnect,tmp); |
329 | 328 | ||
330 | discommand_label = new QLabel(tr("Upon disconnect:"), | 329 | discommand_label = new QLabel(tr("Upon disconnect:"), |
331 | this); | 330 | this); |
332 | discommand_label->setAlignment(AlignVCenter); | 331 | discommand_label->setAlignment(AlignVCenter); |
333 | l1->addWidget(discommand_label, 3, 0); | 332 | l1->addWidget(discommand_label, 3, 0); |
334 | 333 | ||
335 | discommand = new QLineEdit(this); | 334 | discommand = new QLineEdit(this); |
336 | // discommand->setMaxLength(COMMAND_SIZE); | 335 | // discommand->setMaxLength(COMMAND_SIZE); |
337 | l1->addWidget(discommand, 3, 1); | 336 | l1->addWidget(discommand, 3, 1); |
338 | tmp = tr("Allows you to run a program <b>after</b> a connection\n" | 337 | tmp = tr("Allows you to run a program <b>after</b> a connection\n" |
339 | "has been closed."); | 338 | "has been closed."); |
340 | 339 | ||
341 | QWhatsThis::add(discommand_label,tmp); | 340 | QWhatsThis::add(discommand_label,tmp); |
342 | QWhatsThis::add(discommand,tmp); | 341 | QWhatsThis::add(discommand,tmp); |
343 | 342 | ||
344 | // extra space between entries | 343 | // extra space between entries |
345 | l1->addRowSpacing(1, 5); | 344 | l1->addRowSpacing(1, 5); |
346 | l1->addRowSpacing(3, 5); | 345 | l1->addRowSpacing(3, 5); |
347 | 346 | ||
348 | tl->addStretch(1); | 347 | tl->addStretch(1); |
349 | tl->activate(); | 348 | tl->activate(); |
350 | 349 | ||
351 | // Set defaults if editing an existing connection | 350 | // Set defaults if editing an existing connection |
352 | if(!isnewaccount) { | 351 | if(!isnewaccount) { |
353 | before_connect->setText(_pppdata->command_before_connect()); | 352 | before_connect->setText(_pppdata->command_before_connect()); |
354 | command->setText(_pppdata->command_on_connect()); | 353 | command->setText(_pppdata->command_on_connect()); |
355 | discommand->setText(_pppdata->command_on_disconnect()); | 354 | discommand->setText(_pppdata->command_on_disconnect()); |
356 | predisconnect->setText(_pppdata->command_before_disconnect()); | 355 | predisconnect->setText(_pppdata->command_before_disconnect()); |
357 | } | 356 | } |
358 | } | 357 | } |
359 | 358 | ||
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp index d1143cf..66a4d82 100644 --- a/noncore/settings/networksettings/ppp/pppdargs.cpp +++ b/noncore/settings/networksettings/ppp/pppdargs.cpp | |||
@@ -1,166 +1,151 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
11 | * | 11 | * |
12 | * | 12 | * |
13 | * This library is free software; you can redistribute it and/or | 13 | * This library is free software; you can redistribute it and/or |
14 | * modify it under the terms of the GNU Library General Public | 14 | * modify it under the terms of the GNU Library General Public |
15 | * License as published by the Free Software Foundation; either | 15 | * License as published by the Free Software Foundation; either |
16 | * version 2 of the License, or (at your option) any later version. | 16 | * version 2 of the License, or (at your option) any later version. |
17 | * | 17 | * |
18 | * This library is distributed in the hope that it will be useful, | 18 | * This library is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 | * Library General Public License for more details. | 21 | * Library General Public License for more details. |
22 | * | 22 | * |
23 | * You should have received a copy of the GNU Library General Public | 23 | * You should have received a copy of the GNU Library General Public |
24 | * License along with this program; if not, write to the Free | 24 | * License along with this program; if not, write to the Free |
25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | //#include <kwin.h> | ||
31 | #include <qapplication.h> | 30 | #include <qapplication.h> |
32 | #include "pppdargs.h" | 31 | #include "pppdargs.h" |
33 | #include "pppdata.h" | 32 | #include "pppdata.h" |
34 | //#include <klocale.h> | 33 | |
35 | #define i18n QObject::tr | ||
36 | 34 | ||
37 | PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name) | 35 | PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name) |
38 | : QDialog(parent, name, TRUE), _pppdata(pd) | 36 | : QDialog(parent, name, TRUE), _pppdata(pd) |
39 | { | 37 | { |
40 | setCaption(i18n("Customize pppd Arguments")); | 38 | setCaption(tr("Customize pppd Arguments")); |
41 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 39 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
42 | QVBoxLayout *l = new QVBoxLayout(this, 10, 10); | 40 | QVBoxLayout *l = new QVBoxLayout(this, 10, 10); |
43 | QHBoxLayout *tl = new QHBoxLayout(10); | 41 | QHBoxLayout *tl = new QHBoxLayout(10); |
44 | l->addLayout(tl); | 42 | l->addLayout(tl); |
45 | QVBoxLayout *l1 = new QVBoxLayout(); | 43 | QVBoxLayout *l1 = new QVBoxLayout(); |
46 | QVBoxLayout *l2 = new QVBoxLayout(); | 44 | QVBoxLayout *l2 = new QVBoxLayout(); |
47 | tl->addLayout(l1, 1); | 45 | tl->addLayout(l1, 1); |
48 | tl->addLayout(l2, 0); | 46 | tl->addLayout(l2, 0); |
49 | 47 | ||
50 | QHBoxLayout *l11 = new QHBoxLayout(10); | 48 | QHBoxLayout *l11 = new QHBoxLayout(10); |
51 | l1->addLayout(l11); | 49 | l1->addLayout(l11); |
52 | 50 | ||
53 | argument_label = new QLabel(i18n("Argument:"), this); | 51 | argument_label = new QLabel(tr("Argument:"), this); |
54 | l11->addWidget(argument_label); | 52 | l11->addWidget(argument_label); |
55 | 53 | ||
56 | argument = new QLineEdit(this); | 54 | argument = new QLineEdit(this); |
57 | connect(argument, SIGNAL(returnPressed()), | 55 | connect(argument, SIGNAL(returnPressed()), |
58 | SLOT(addbutton())); | 56 | SLOT(addbutton())); |
59 | l11->addWidget(argument); | 57 | l11->addWidget(argument); |
60 | connect(argument, SIGNAL(textChanged(const QString &)), | 58 | connect(argument, SIGNAL(textChanged(const QString &)), |
61 | this, SLOT(textChanged(const QString &))); | 59 | this, SLOT(textChanged(const QString &))); |
62 | 60 | ||
63 | arguments = new QListBox(this); | 61 | arguments = new QListBox(this); |
64 | arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); | 62 | arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); |
65 | connect(arguments, SIGNAL(highlighted(int)), | 63 | connect(arguments, SIGNAL(highlighted(int)), |
66 | this, SLOT(itemSelected(int))); | 64 | this, SLOT(itemSelected(int))); |
67 | l1->addWidget(arguments, 1); | 65 | l1->addWidget(arguments, 1); |
68 | 66 | ||
69 | add = new QPushButton(i18n("Add"), this); | 67 | add = new QPushButton(tr("Add"), this); |
70 | connect(add, SIGNAL(clicked()), SLOT(addbutton())); | 68 | connect(add, SIGNAL(clicked()), SLOT(addbutton())); |
71 | l2->addWidget(add); | 69 | l2->addWidget(add); |
72 | l2->addStretch(1); | 70 | l2->addStretch(1); |
73 | 71 | ||
74 | remove = new QPushButton(i18n("Remove"), this); | 72 | remove = new QPushButton(tr("Remove"), this); |
75 | connect(remove, SIGNAL(clicked()), SLOT(removebutton())); | 73 | connect(remove, SIGNAL(clicked()), SLOT(removebutton())); |
76 | l2->addWidget(remove); | 74 | l2->addWidget(remove); |
77 | 75 | ||
78 | defaults = new QPushButton(i18n("Defaults"), this); | 76 | defaults = new QPushButton(tr("Defaults"), this); |
79 | connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); | 77 | connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); |
80 | l2->addWidget(defaults); | 78 | l2->addWidget(defaults); |
81 | 79 | ||
82 | l->addSpacing(5); | 80 | l->addSpacing(5); |
83 | 81 | ||
84 | // QButtonGroup *bbox = new QButtonGroup(this); | ||
85 | // // bbox->addStretch(1); | ||
86 | // closebtn = new QPushButton( bbox, i18n("OK")); | ||
87 | // bbox->insert(closebtn); | ||
88 | // connect(closebtn, SIGNAL(clicked()), SLOT(closebutton())); | ||
89 | // QPushButton *cancel = new QPushButton( bbox, i18n("Cancel")); | ||
90 | // bbox->insert(cancel); | ||
91 | // connect(cancel, SIGNAL(clicked()), | ||
92 | // this, SLOT(reject())); | ||
93 | // bbox->layout(); | ||
94 | // l->addWidget(bbox); | ||
95 | |||
96 | // setFixedSize(sizeHint()); | ||
97 | 82 | ||
98 | //load info from gpppdata | 83 | //load info from gpppdata |
99 | init(); | 84 | init(); |
100 | 85 | ||
101 | add->setEnabled(false); | 86 | add->setEnabled(false); |
102 | remove->setEnabled(false); | 87 | remove->setEnabled(false); |
103 | argument->setFocus(); | 88 | argument->setFocus(); |
104 | } | 89 | } |
105 | 90 | ||
106 | 91 | ||
107 | void PPPdArguments::addbutton() { | 92 | void PPPdArguments::addbutton() { |
108 | if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { | 93 | if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { |
109 | arguments->insertItem(argument->text()); | 94 | arguments->insertItem(argument->text()); |
110 | argument->setText(""); | 95 | argument->setText(""); |
111 | } | 96 | } |
112 | } | 97 | } |
113 | 98 | ||
114 | 99 | ||
115 | void PPPdArguments::removebutton() { | 100 | void PPPdArguments::removebutton() { |
116 | if(arguments->currentItem() >= 0) | 101 | if(arguments->currentItem() >= 0) |
117 | arguments->removeItem(arguments->currentItem()); | 102 | arguments->removeItem(arguments->currentItem()); |
118 | } | 103 | } |
119 | 104 | ||
120 | 105 | ||
121 | void PPPdArguments::defaultsbutton() { | 106 | void PPPdArguments::defaultsbutton() { |
122 | // all of this is a hack | 107 | // all of this is a hack |
123 | // save current list | 108 | // save current list |
124 | QStringList arglist(_pppdata->pppdArgument()); | 109 | QStringList arglist(_pppdata->pppdArgument()); |
125 | 110 | ||
126 | // get defaults | 111 | // get defaults |
127 | _pppdata->setpppdArgumentDefaults(); | 112 | _pppdata->setpppdArgumentDefaults(); |
128 | init(); | 113 | init(); |
129 | 114 | ||
130 | // restore old list | 115 | // restore old list |
131 | _pppdata->setpppdArgument(arglist); | 116 | _pppdata->setpppdArgument(arglist); |
132 | } | 117 | } |
133 | 118 | ||
134 | 119 | ||
135 | void PPPdArguments::closebutton() { | 120 | void PPPdArguments::accept() { |
136 | QStringList arglist; | 121 | QStringList arglist; |
137 | for(uint i=0; i < arguments->count(); i++) | 122 | for(uint i=0; i < arguments->count(); i++) |
138 | arglist.append(arguments->text(i)); | 123 | arglist.append(arguments->text(i)); |
139 | _pppdata->setpppdArgument(arglist); | 124 | _pppdata->setpppdArgument(arglist); |
140 | 125 | ||
141 | done(0); | 126 | QDialog::accept(); |
142 | } | 127 | } |
143 | 128 | ||
144 | 129 | ||
145 | void PPPdArguments::init() { | 130 | void PPPdArguments::init() { |
146 | while(arguments->count()) | 131 | while(arguments->count()) |
147 | arguments->removeItem(0); | 132 | arguments->removeItem(0); |
148 | 133 | ||
149 | QStringList &arglist = _pppdata->pppdArgument(); | 134 | QStringList &arglist = _pppdata->pppdArgument(); |
150 | for ( QStringList::Iterator it = arglist.begin(); | 135 | for ( QStringList::Iterator it = arglist.begin(); |
151 | it != arglist.end(); | 136 | it != arglist.end(); |
152 | ++it ) | 137 | ++it ) |
153 | arguments->insertItem(*it); | 138 | arguments->insertItem(*it); |
154 | } | 139 | } |
155 | 140 | ||
156 | 141 | ||
157 | void PPPdArguments::textChanged(const QString &s) { | 142 | void PPPdArguments::textChanged(const QString &s) { |
158 | add->setEnabled(s.length() > 0); | 143 | add->setEnabled(s.length() > 0); |
159 | } | 144 | } |
160 | 145 | ||
161 | 146 | ||
162 | void PPPdArguments::itemSelected(int idx) { | 147 | void PPPdArguments::itemSelected(int idx) { |
163 | remove->setEnabled(idx != -1); | 148 | remove->setEnabled(idx != -1); |
164 | } | 149 | } |
165 | 150 | ||
166 | 151 | ||
diff --git a/noncore/settings/networksettings/ppp/pppdargs.h b/noncore/settings/networksettings/ppp/pppdargs.h index 75f0c9d..065b03c 100644 --- a/noncore/settings/networksettings/ppp/pppdargs.h +++ b/noncore/settings/networksettings/ppp/pppdargs.h | |||
@@ -1,78 +1,78 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
11 | * | 11 | * |
12 | * | 12 | * |
13 | * This library is free software; you can redistribute it and/or | 13 | * This library is free software; you can redistribute it and/or |
14 | * modify it under the terms of the GNU Library General Public | 14 | * modify it under the terms of the GNU Library General Public |
15 | * License as published by the Free Software Foundation; either | 15 | * License as published by the Free Software Foundation; either |
16 | * version 2 of the License, or (at your option) any later version. | 16 | * version 2 of the License, or (at your option) any later version. |
17 | * | 17 | * |
18 | * This library is distributed in the hope that it will be useful, | 18 | * This library is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 | * Library General Public License for more details. | 21 | * Library General Public License for more details. |
22 | * | 22 | * |
23 | * You should have received a copy of the GNU Library General Public | 23 | * You should have received a copy of the GNU Library General Public |
24 | * License along with this program; if not, write to the Free | 24 | * License along with this program; if not, write to the Free |
25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef _PPPDARGS_H_ | 28 | #ifndef _PPPDARGS_H_ |
29 | #define _PPPDARGS_H_ | 29 | #define _PPPDARGS_H_ |
30 | 30 | ||
31 | #include <qdialog.h> | 31 | #include <qdialog.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qlistbox.h> | 34 | #include <qlistbox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | class PPPData; | 36 | class PPPData; |
37 | 37 | ||
38 | class PPPdArguments : public QDialog { | 38 | class PPPdArguments : public QDialog { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | public: | 40 | public: |
41 | PPPdArguments(PPPData*,QWidget *parent=0, const char *name=0); | 41 | PPPdArguments(PPPData*,QWidget *parent=0, const char *name=0); |
42 | ~PPPdArguments() {} | 42 | ~PPPdArguments() {} |
43 | 43 | ||
44 | private slots: | 44 | private slots: |
45 | void addbutton(); | 45 | void addbutton(); |
46 | void removebutton(); | 46 | void removebutton(); |
47 | void defaultsbutton(); | 47 | void defaultsbutton(); |
48 | void closebutton(); | 48 | virtual void accept(); |
49 | void textChanged(const QString &); | 49 | void textChanged(const QString &); |
50 | void itemSelected(int); | 50 | void itemSelected(int); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | void init(); | 53 | void init(); |
54 | 54 | ||
55 | QLabel *argument_label; | 55 | QLabel *argument_label; |
56 | 56 | ||
57 | QLineEdit *argument; | 57 | QLineEdit *argument; |
58 | 58 | ||
59 | QPushButton *add; | 59 | QPushButton *add; |
60 | QPushButton *remove; | 60 | QPushButton *remove; |
61 | QPushButton *defaults; | 61 | QPushButton *defaults; |
62 | 62 | ||
63 | QListBox *arguments; | 63 | QListBox *arguments; |
64 | 64 | ||
65 | QPushButton *closebtn; | 65 | QPushButton *closebtn; |
66 | PPPData *_pppdata; | 66 | PPPData *_pppdata; |
67 | }; | 67 | }; |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | 78 | ||