author | harlekin <harlekin> | 2003-06-10 13:46:02 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-06-10 13:46:02 (UTC) |
commit | 8ffea5d37080bd173d55a458296c1fc461a54d13 (patch) (unidiff) | |
tree | 0c7f4a1129ed35d00742e55527ee4e4af59b562b | |
parent | 6189cb95c39acdd5b27e09f9d0798d91fa182e5a (diff) | |
download | opie-8ffea5d37080bd173d55a458296c1fc461a54d13.zip opie-8ffea5d37080bd173d55a458296c1fc461a54d13.tar.gz opie-8ffea5d37080bd173d55a458296c1fc461a54d13.tar.bz2 |
layout fixes
-rw-r--r-- | noncore/settings/networksettings/ppp/accounts.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index 7760d5e..04905e8 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -184,129 +184,129 @@ void AccountWidget::deleteaccount() { | |||
184 | 184 | ||
185 | if(QMessageBox::warning(this, s, tr("Confirm")) != QMessageBox::Yes) | 185 | if(QMessageBox::warning(this, s, tr("Confirm")) != QMessageBox::Yes) |
186 | return; | 186 | return; |
187 | 187 | ||
188 | if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) | 188 | if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) |
189 | accountlist_l->removeItem(accountlist_l->currentItem()); | 189 | accountlist_l->removeItem(accountlist_l->currentItem()); |
190 | 190 | ||
191 | emit resetaccounts(); | 191 | emit resetaccounts(); |
192 | _pppdata->save(); | 192 | _pppdata->save(); |
193 | 193 | ||
194 | slotListBoxSelect(accountlist_l->currentItem()); | 194 | slotListBoxSelect(accountlist_l->currentItem()); |
195 | 195 | ||
196 | } | 196 | } |
197 | 197 | ||
198 | 198 | ||
199 | int AccountWidget::doTab(){ | 199 | int AccountWidget::doTab(){ |
200 | QDialog *dlg = new QDialog( 0, "newAccount", true ); | 200 | QDialog *dlg = new QDialog( 0, "newAccount", true ); |
201 | QVBoxLayout *layout = new QVBoxLayout( dlg ); | 201 | QVBoxLayout *layout = new QVBoxLayout( dlg ); |
202 | layout->setSpacing( 0 ); | 202 | layout->setSpacing( 0 ); |
203 | layout->setMargin( 1 ); | 203 | layout->setMargin( 1 ); |
204 | 204 | ||
205 | tabWindow = new QTabWidget( dlg, "tabWindow" ); | 205 | tabWindow = new QTabWidget( dlg, "tabWindow" ); |
206 | layout->addWidget( tabWindow ); | 206 | layout->addWidget( tabWindow ); |
207 | 207 | ||
208 | bool isnewaccount; | 208 | bool isnewaccount; |
209 | 209 | ||
210 | if(_pppdata->accname().isEmpty()) { | 210 | if(_pppdata->accname().isEmpty()) { |
211 | dlg->setCaption(tr("New Account")); | 211 | dlg->setCaption(tr("New Account")); |
212 | isnewaccount = true; | 212 | isnewaccount = true; |
213 | } else { | 213 | } else { |
214 | QString tit = tr("Edit Account: "); | 214 | QString tit = tr("Edit Account: "); |
215 | tit += _pppdata->accname(); | 215 | tit += _pppdata->accname(); |
216 | dlg->setCaption(tit); | 216 | dlg->setCaption(tit); |
217 | isnewaccount = false; | 217 | isnewaccount = false; |
218 | } | 218 | } |
219 | 219 | ||
220 | // // DIAL WIDGET | 220 | // // DIAL WIDGET |
221 | dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); | 221 | dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); |
222 | tabWindow->addTab( dial_w, tr("Dial") ); | 222 | tabWindow->addTab( dial_w, tr("Dial") ); |
223 | 223 | ||
224 | // // AUTH WIDGET | 224 | // // AUTH WIDGET |
225 | auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); | 225 | auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); |
226 | tabWindow->addTab( auth_w, tr("Authentication") ); | 226 | tabWindow->addTab( auth_w, tr("Authentication") ); |
227 | 227 | ||
228 | // // IP WIDGET | 228 | // // IP WIDGET |
229 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); | 229 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); |
230 | tabWindow->addTab( ip_w, tr("IP") ); | 230 | tabWindow->addTab( ip_w, tr("IP") ); |
231 | 231 | ||
232 | // // GATEWAY WIDGET | 232 | // // GATEWAY WIDGET |
233 | gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup")); | 233 | gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup")); |
234 | tabWindow->addTab( gateway_w, tr("Gateway") ); | 234 | tabWindow->addTab( gateway_w, tr("Gateway") ); |
235 | 235 | ||
236 | // // DNS WIDGET | 236 | // // DNS WIDGET |
237 | dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") ); | 237 | dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") ); |
238 | tabWindow->addTab( dns_w, tr("DNS") ); | 238 | tabWindow->addTab( dns_w, tr("DNS") ); |
239 | 239 | ||
240 | // // EXECUTE WIDGET | 240 | // // EXECUTE WIDGET |
241 | ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); | 241 | ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); |
242 | tabWindow->addTab( exec_w, tr("Execute") ); | 242 | tabWindow->addTab( exec_w, tr("Execute") ); |
243 | 243 | ||
244 | int result = 0; | 244 | int result = 0; |
245 | bool ok = false; | 245 | bool ok = false; |
246 | 246 | ||
247 | while (!ok){ | 247 | while (!ok){ |
248 | // dlg->showMinimized(); | 248 | dlg->showMaximized(); |
249 | result = dlg->exec(); | 249 | result = dlg->exec(); |
250 | ok = true; | 250 | ok = true; |
251 | 251 | ||
252 | if(result == QDialog::Accepted) { | 252 | if(result == QDialog::Accepted) { |
253 | if (!auth_w->check()){ | 253 | if (!auth_w->check()){ |
254 | ok = false; | 254 | ok = false; |
255 | } else if(!dial_w->save()) { | 255 | } else if(!dial_w->save()) { |
256 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); | 256 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); |
257 | ok = false; | 257 | ok = false; |
258 | }else{ | 258 | }else{ |
259 | ip_w->save(); | 259 | ip_w->save(); |
260 | dns_w->save(); | 260 | dns_w->save(); |
261 | gateway_w->save(); | 261 | gateway_w->save(); |
262 | auth_w->save(); | 262 | auth_w->save(); |
263 | exec_w->save(); | 263 | exec_w->save(); |
264 | } | 264 | } |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | delete dlg; | 268 | delete dlg; |
269 | 269 | ||
270 | return result; | 270 | return result; |
271 | } | 271 | } |
272 | 272 | ||
273 | 273 | ||
274 | QString AccountWidget::prettyPrintVolume(unsigned int n) { | 274 | QString AccountWidget::prettyPrintVolume(unsigned int n) { |
275 | int idx = 0; | 275 | int idx = 0; |
276 | const QString quant[] = {tr("Byte"), tr("KB"), | 276 | const QString quant[] = {tr("Byte"), tr("KB"), |
277 | tr("MB"), tr("GB"), QString::null}; | 277 | tr("MB"), tr("GB"), QString::null}; |
278 | 278 | ||
279 | float n1 = n; | 279 | float n1 = n; |
280 | while(n >= 1024 && quant[idx] != QString::null) { | 280 | while(n >= 1024 && quant[idx] != QString::null) { |
281 | idx++; | 281 | idx++; |
282 | n /= 1024; | 282 | n /= 1024; |
283 | } | 283 | } |
284 | 284 | ||
285 | int i = idx; | 285 | int i = idx; |
286 | while(i--) | 286 | while(i--) |
287 | n1 = n1 / 1024.0; | 287 | n1 = n1 / 1024.0; |
288 | 288 | ||
289 | QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); | 289 | QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); |
290 | s += " " + quant[idx]; | 290 | s += " " + quant[idx]; |
291 | return s; | 291 | return s; |
292 | } | 292 | } |
293 | 293 | ||
294 | 294 | ||
295 | ///////////////////////////////////////////////////////////////////////////// | 295 | ///////////////////////////////////////////////////////////////////////////// |
296 | // | 296 | // |
297 | // Queries the user what to reset: costs, volume or both | 297 | // Queries the user what to reset: costs, volume or both |
298 | // | 298 | // |
299 | ///////////////////////////////////////////////////////////////////////////// | 299 | ///////////////////////////////////////////////////////////////////////////// |
300 | // QueryReset::QueryReset(QWidget *parent) : QDialog(parent, 0, true) { | 300 | // QueryReset::QueryReset(QWidget *parent) : QDialog(parent, 0, true) { |
301 | // // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 301 | // // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
302 | // setCaption(tr("Reset Accounting")); | 302 | // setCaption(tr("Reset Accounting")); |
303 | 303 | ||
304 | // QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); | 304 | // QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); |
305 | // QVGroupBox *f = new QVGroupBox(tr("What to Reset"), this); | 305 | // QVGroupBox *f = new QVGroupBox(tr("What to Reset"), this); |
306 | 306 | ||
307 | // QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); | 307 | // QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); |
308 | // // costs = new QCheckBox(tr("Reset the accumulated phone costs"), f); | 308 | // // costs = new QCheckBox(tr("Reset the accumulated phone costs"), f); |
309 | // // costs->setChecked(true); | 309 | // // costs->setChecked(true); |
310 | // // l1->addWidget(costs); | 310 | // // l1->addWidget(costs); |
311 | // // QWhatsThis::add(costs, tr("Check this to set the phone costs\n" | 311 | // // QWhatsThis::add(costs, tr("Check this to set the phone costs\n" |
312 | // // "to zero. Typically you'll want to\n" | 312 | // // "to zero. Typically you'll want to\n" |
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index b880978..0c96253 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -154,128 +154,129 @@ bool DialWidget::save() { | |||
154 | 154 | ||
155 | _pppdata->setPhonenumber(number); | 155 | _pppdata->setPhonenumber(number); |
156 | return true; | 156 | return true; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void DialWidget::numbersChanged() { | 161 | void DialWidget::numbersChanged() { |
162 | int sel = numbers->currentItem(); | 162 | int sel = numbers->currentItem(); |
163 | 163 | ||
164 | del->setEnabled(sel != -1); | 164 | del->setEnabled(sel != -1); |
165 | up->setEnabled(sel != -1 && sel != 0); | 165 | up->setEnabled(sel != -1 && sel != 0); |
166 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); | 166 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); |
167 | } | 167 | } |
168 | 168 | ||
169 | 169 | ||
170 | void DialWidget::selectionChanged(int) { | 170 | void DialWidget::selectionChanged(int) { |
171 | numbersChanged(); | 171 | numbersChanged(); |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | void DialWidget::addNumber() { | 175 | void DialWidget::addNumber() { |
176 | PhoneNumberDialog dlg(this); | 176 | PhoneNumberDialog dlg(this); |
177 | if(dlg.exec()) { | 177 | if(dlg.exec()) { |
178 | numbers->insertItem(dlg.phoneNumber()); | 178 | numbers->insertItem(dlg.phoneNumber()); |
179 | numbersChanged(); | 179 | numbersChanged(); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | void DialWidget::delNumber() { | 184 | void DialWidget::delNumber() { |
185 | if(numbers->currentItem() != -1) { | 185 | if(numbers->currentItem() != -1) { |
186 | numbers->removeItem(numbers->currentItem()); | 186 | numbers->removeItem(numbers->currentItem()); |
187 | numbersChanged(); | 187 | numbersChanged(); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | void DialWidget::upNumber() { | 192 | void DialWidget::upNumber() { |
193 | int idx = numbers->currentItem(); | 193 | int idx = numbers->currentItem(); |
194 | if(idx != -1) { | 194 | if(idx != -1) { |
195 | QString item = numbers->text(idx); | 195 | QString item = numbers->text(idx); |
196 | numbers->removeItem(idx); | 196 | numbers->removeItem(idx); |
197 | numbers->insertItem(item, idx-1); | 197 | numbers->insertItem(item, idx-1); |
198 | numbers->setCurrentItem(idx-1); | 198 | numbers->setCurrentItem(idx-1); |
199 | numbersChanged(); | 199 | numbersChanged(); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | void DialWidget::downNumber() { | 204 | void DialWidget::downNumber() { |
205 | int idx = numbers->currentItem(); | 205 | int idx = numbers->currentItem(); |
206 | if(idx != -1) { | 206 | if(idx != -1) { |
207 | QString item = numbers->text(idx); | 207 | QString item = numbers->text(idx); |
208 | numbers->removeItem(idx); | 208 | numbers->removeItem(idx); |
209 | numbers->insertItem(item, idx+1); | 209 | numbers->insertItem(item, idx+1); |
210 | numbers->setCurrentItem(idx+1); | 210 | numbers->setCurrentItem(idx+1); |
211 | numbersChanged(); | 211 | numbersChanged(); |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | void DialWidget::pppdargsbutton() { | 216 | void DialWidget::pppdargsbutton() { |
217 | PPPdArguments pa(_pppdata, this); | 217 | PPPdArguments pa(_pppdata, this); |
218 | pa.showMaximized(); | ||
218 | pa.exec(); | 219 | pa.exec(); |
219 | } | 220 | } |
220 | 221 | ||
221 | 222 | ||
222 | 223 | ||
223 | ///////////////////////////////////////////////////////////////////////////// | 224 | ///////////////////////////////////////////////////////////////////////////// |
224 | // ExecWidget | 225 | // ExecWidget |
225 | ///////////////////////////////////////////////////////////////////////////// | 226 | ///////////////////////////////////////////////////////////////////////////// |
226 | ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) : | 227 | ExecWidget::ExecWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name) : |
227 | QWidget(parent, name), _pppdata(pd) | 228 | QWidget(parent, name), _pppdata(pd) |
228 | { | 229 | { |
229 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 230 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
230 | 231 | ||
231 | 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); | 232 | 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); |
232 | 233 | ||
233 | tl->addWidget(l); | 234 | tl->addWidget(l); |
234 | tl->addStretch(1); | 235 | tl->addStretch(1); |
235 | 236 | ||
236 | QGridLayout *l1 = new QGridLayout(4, 2, 10); | 237 | QGridLayout *l1 = new QGridLayout(4, 2, 10); |
237 | tl->addLayout(l1); | 238 | tl->addLayout(l1); |
238 | l1->setColStretch(0, 0); | 239 | l1->setColStretch(0, 0); |
239 | l1->setColStretch(1, 1); | 240 | l1->setColStretch(1, 1); |
240 | 241 | ||
241 | before_connect_l = new QLabel(tr("Before connect:"), this); | 242 | before_connect_l = new QLabel(tr("Before connect:"), this); |
242 | before_connect_l->setAlignment(AlignVCenter); | 243 | before_connect_l->setAlignment(AlignVCenter); |
243 | l1->addWidget(before_connect_l, 0, 0); | 244 | l1->addWidget(before_connect_l, 0, 0); |
244 | before_connect = new QLineEdit(this); | 245 | before_connect = new QLineEdit(this); |
245 | // before_connect->setMaxLength(COMMAND_SIZE); | 246 | // before_connect->setMaxLength(COMMAND_SIZE); |
246 | l1->addWidget(before_connect, 0, 1); | 247 | l1->addWidget(before_connect, 0, 1); |
247 | QString tmp = tr("Allows you to run a program <b>before</b> a connection\n" | 248 | QString tmp = tr("Allows you to run a program <b>before</b> a connection\n" |
248 | "is established. It is called immediately before\n" | 249 | "is established. It is called immediately before\n" |
249 | "dialing has begun.\n\n" | 250 | "dialing has begun.\n\n" |
250 | "This might be useful, e.g. to stop HylaFAX blocking the\n" | 251 | "This might be useful, e.g. to stop HylaFAX blocking the\n" |
251 | "modem."); | 252 | "modem."); |
252 | 253 | ||
253 | QWhatsThis::add(before_connect_l,tmp); | 254 | QWhatsThis::add(before_connect_l,tmp); |
254 | QWhatsThis::add(before_connect,tmp); | 255 | QWhatsThis::add(before_connect,tmp); |
255 | 256 | ||
256 | command_label = new QLabel(tr("Upon connect:"), this); | 257 | command_label = new QLabel(tr("Upon connect:"), this); |
257 | command_label->setAlignment(AlignVCenter); | 258 | command_label->setAlignment(AlignVCenter); |
258 | l1->addWidget(command_label, 1, 0); | 259 | l1->addWidget(command_label, 1, 0); |
259 | command = new QLineEdit(this); | 260 | command = new QLineEdit(this); |
260 | // command->setMaxLength(COMMAND_SIZE); | 261 | // command->setMaxLength(COMMAND_SIZE); |
261 | l1->addWidget(command, 1, 1); | 262 | l1->addWidget(command, 1, 1); |
262 | tmp = tr("Allows you to run a program <b>after</b> a connection\n" | 263 | tmp = tr("Allows you to run a program <b>after</b> a connection\n" |
263 | "is established. When your program is called, all\n" | 264 | "is established. When your program is called, all\n" |
264 | "preparations for an Internet connection are finished.\n" | 265 | "preparations for an Internet connection are finished.\n" |
265 | "\n" | 266 | "\n" |
266 | "Very useful for fetching mail and news"); | 267 | "Very useful for fetching mail and news"); |
267 | 268 | ||
268 | QWhatsThis::add(command_label,tmp); | 269 | QWhatsThis::add(command_label,tmp); |
269 | QWhatsThis::add(command,tmp); | 270 | QWhatsThis::add(command,tmp); |
270 | 271 | ||
271 | predisconnect_label = new QLabel(tr("Before disconnect:"), | 272 | predisconnect_label = new QLabel(tr("Before disconnect:"), |
272 | this); | 273 | this); |
273 | predisconnect_label->setAlignment(AlignVCenter); | 274 | predisconnect_label->setAlignment(AlignVCenter); |
274 | l1->addWidget(predisconnect_label, 2, 0); | 275 | l1->addWidget(predisconnect_label, 2, 0); |
275 | predisconnect = new QLineEdit(this); | 276 | predisconnect = new QLineEdit(this); |
276 | // predisconnect->setMaxLength(COMMAND_SIZE); | 277 | // predisconnect->setMaxLength(COMMAND_SIZE); |
277 | l1->addWidget(predisconnect, 2, 1); | 278 | l1->addWidget(predisconnect, 2, 1); |
278 | tmp = tr("Allows you to run a program <b>before</b> a connection\n" | 279 | tmp = tr("Allows you to run a program <b>before</b> a connection\n" |
279 | "is closed. The connection will stay open until\n" | 280 | "is closed. The connection will stay open until\n" |
280 | "the program exits."); | 281 | "the program exits."); |
281 | 282 | ||