Diffstat (limited to 'noncore/settings/networksettings/ppp/accounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/accounts.cpp | 158 |
1 files changed, 62 insertions, 96 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index fa1c43b..28d8732 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -1,357 +1,323 @@ | |||
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 | * 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 <qdir.h> | 27 | #include <qdir.h> |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | #include <qtabdialog.h> | 31 | #include <qtabdialog.h> |
32 | #include <qwhatsthis.h> | 32 | #include <qwhatsthis.h> |
33 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
34 | 34 | ||
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #include <qbuttongroup.h> | 36 | #include <qbuttongroup.h> |
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | #include <qvgroupbox.h> | 38 | #include <qvgroupbox.h> |
39 | 39 | ||
40 | #include "accounts.h" | 40 | #include "accounts.h" |
41 | #include "authwidget.h" | 41 | #include "authwidget.h" |
42 | #include "pppdata.h" | 42 | #include "pppdata.h" |
43 | #include "edit.h" | 43 | #include "edit.h" |
44 | 44 | ||
45 | void parseargs(char* buf, char** args); | 45 | void parseargs(char* buf, char** args); |
46 | 46 | ||
47 | AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name ) | 47 | |
48 | : QWidget( parent, name )//, _pppdata(pd) | 48 | AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WFlags f ) |
49 | : ChooserWidget( pd, parent, name, f ) | ||
49 | { | 50 | { |
50 | _pppdata = pd; | ||
51 | QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); | ||
52 | accountlist_l = new QListBox(this); | ||
53 | |||
54 | connect(accountlist_l, SIGNAL(highlighted(int)), | ||
55 | this, SLOT(slotListBoxSelect(int))); | ||
56 | connect(accountlist_l, SIGNAL(selected(int)), | ||
57 | this, SLOT(editaccount())); | ||
58 | l1->addWidget(accountlist_l, 10); | ||
59 | |||
60 | edit_b = new QPushButton(tr("&Edit..."), this); | ||
61 | connect(edit_b, SIGNAL(clicked()), SLOT(editaccount())); | ||
62 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected account")); | ||
63 | l1->addWidget(edit_b); | ||
64 | 51 | ||
65 | new_b = new QPushButton(tr("&New..."), this); | 52 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected account")); |
66 | connect(new_b, SIGNAL(clicked()), SLOT(newaccount())); | ||
67 | l1->addWidget(new_b); | ||
68 | QWhatsThis::add(new_b, tr("Create a new dialup connection\n" | 53 | QWhatsThis::add(new_b, tr("Create a new dialup connection\n" |
69 | "to the Internet")); | 54 | "to the Internet")); |
70 | |||
71 | copy_b = new QPushButton(tr("Co&py"), this); | ||
72 | connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount())); | ||
73 | l1->addWidget(copy_b); | ||
74 | QWhatsThis::add(copy_b, | 55 | QWhatsThis::add(copy_b, |
75 | tr("Makes a copy of the selected account. All\n" | 56 | tr("Makes a copy of the selected account. All\n" |
76 | "settings of the selected account are copied\n" | 57 | "settings of the selected account are copied\n" |
77 | "to a new account, that you can modify to fit your\n" | 58 | "to a new account, that you can modify to fit your\n" |
78 | "needs")); | 59 | "needs")); |
79 | |||
80 | delete_b = new QPushButton(tr("De&lete"), this); | ||
81 | connect(delete_b, SIGNAL(clicked()), SLOT(deleteaccount())); | ||
82 | l1->addWidget(delete_b); | ||
83 | QWhatsThis::add(delete_b, | 60 | QWhatsThis::add(delete_b, |
84 | tr("<p>Deletes the selected account\n\n" | 61 | tr("<p>Deletes the selected account\n\n" |
85 | "<font color=\"red\"><b>Use with care!</b></font>")); | 62 | "<font color=\"red\"><b>Use with care!</b></font>")); |
86 | 63 | ||
87 | QHBoxLayout *l12 = new QHBoxLayout; | ||
88 | l1->addStretch(1); | ||
89 | l1->addLayout(l12); | ||
90 | 64 | ||
91 | int currAccId = _pppdata->currentAccountID(); | ||
92 | qDebug("currentAccountID %i", currAccId); | ||
93 | 65 | ||
94 | //load up account list from gppdata to the list box | 66 | copy_b->setEnabled( false ); //FIXME |
95 | if(_pppdata->count() > 0) { | 67 | // delete_b->setEnabled( false ); //FIXME |
96 | for(int i=0; i <= _pppdata->count()-1; i++) { | ||
97 | _pppdata->setAccountbyIndex(i); | ||
98 | accountlist_l->insertItem(_pppdata->accname()); | ||
99 | } | ||
100 | } | ||
101 | _pppdata->setAccountbyIndex( currAccId ); | ||
102 | 68 | ||
103 | qDebug("setting listview index to %i",_pppdata->currentAccountID() ); | 69 | listListbox->insertStringList(_pppdata->getAccountList()); |
104 | accountlist_l->setCurrentItem( _pppdata->currentAccountID() ); | ||
105 | slotListBoxSelect( _pppdata->currentAccountID() ); | ||
106 | 70 | ||
107 | l1->activate(); | 71 | for (uint i = 0; i < listListbox->count(); i++){ |
72 | if ( listListbox->text(i) == _pppdata->accname() ) | ||
73 | listListbox->setCurrentItem( i ); | ||
74 | } | ||
108 | } | 75 | } |
109 | 76 | ||
110 | 77 | ||
111 | 78 | ||
112 | void AccountWidget::slotListBoxSelect(int idx) { | 79 | void AccountWidget::slotListBoxSelect(int idx) { |
113 | delete_b->setEnabled((bool)(idx != -1)); | 80 | bool ok = _pppdata->setAccount( listListbox->text(idx) ); |
114 | edit_b->setEnabled((bool)(idx != -1)); | 81 | ok = (bool)(idx != -1); |
115 | copy_b->setEnabled((bool)(idx != -1)); | 82 | delete_b->setEnabled(ok); |
116 | if(idx!=-1) { | 83 | edit_b->setEnabled(ok); |
117 | qDebug("setting account to %i", idx); | 84 | //FIXME copy_b->setEnabled(ok); |
118 | QString account = _pppdata->accname(); | ||
119 | _pppdata->setAccountbyIndex(accountlist_l->currentItem()); | ||
120 | } | ||
121 | } | 85 | } |
122 | 86 | ||
123 | void AccountWidget::editaccount() { | 87 | void AccountWidget::edit() { |
124 | _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem())); | 88 | _pppdata->setAccount(listListbox->text(listListbox->currentItem())); |
125 | 89 | ||
126 | int result = doTab(); | 90 | int result = doTab(); |
127 | 91 | ||
128 | if(result == QDialog::Accepted) { | 92 | if(result == QDialog::Accepted) { |
129 | accountlist_l->changeItem(_pppdata->accname(),accountlist_l->currentItem()); | 93 | listListbox->changeItem(_pppdata->accname(),listListbox->currentItem()); |
130 | // emit resetaccounts(); | 94 | // emit resetaccounts(); |
131 | _pppdata->save(); | 95 | _pppdata->save(); |
132 | } | 96 | } |
133 | } | 97 | } |
134 | 98 | ||
135 | 99 | ||
136 | void AccountWidget::newaccount() { | 100 | void AccountWidget::create() { |
137 | 101 | ||
138 | if(accountlist_l->count() == MAX_ACCOUNTS) { | 102 | // if(listListbox->count() == MAX_ACCOUNTS) { |
139 | QMessageBox::information(this, "sorry", | 103 | // QMessageBox::information(this, "sorry", |
140 | tr("Maximum number of accounts reached.")); | 104 | // tr("Maximum number of accounts reached.")); |
141 | return; | 105 | // return; |
142 | } | 106 | // } |
143 | 107 | ||
144 | int result; | 108 | int result; |
145 | if (_pppdata->newaccount() == -1){ | 109 | if (_pppdata->newaccount() == -1){ |
146 | qDebug("_pppdata->newaccount() == -1"); | 110 | qDebug("_pppdata->newaccount() == -1"); |
147 | return; | 111 | return; |
148 | } | 112 | } |
149 | result = doTab(); | 113 | result = doTab(); |
150 | 114 | ||
151 | if(result == QDialog::Accepted) { | 115 | if(result == QDialog::Accepted) { |
152 | accountlist_l->insertItem(_pppdata->accname()); | 116 | listListbox->insertItem(_pppdata->accname()); |
153 | accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),true); | 117 | listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true); |
154 | 118 | ||
155 | _pppdata->save(); | 119 | _pppdata->save(); |
156 | } else | 120 | } else |
157 | _pppdata->deleteAccount(); | 121 | _pppdata->deleteAccount(); |
158 | } | 122 | } |
159 | 123 | ||
160 | 124 | ||
161 | void AccountWidget::copyaccount() { | 125 | void AccountWidget::copy() { |
162 | if(accountlist_l->count() == MAX_ACCOUNTS) { | 126 | // if(listListbox->count() == MAX_ACCOUNTS) { |
163 | QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); | 127 | // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); |
164 | return; | 128 | // return; |
165 | } | 129 | // } |
166 | 130 | ||
167 | if(accountlist_l->currentItem()<0) { | 131 | if(listListbox->currentItem()<0) { |
168 | QMessageBox::information(this, "sorry", tr("No account selected.")); | 132 | QMessageBox::information(this, "sorry", tr("No account selected.")); |
169 | return; | 133 | return; |
170 | } | 134 | } |
171 | 135 | ||
172 | _pppdata->copyaccount(accountlist_l->currentItem()); | 136 | _pppdata->copyaccount(listListbox->currentText()); |
173 | 137 | ||
174 | accountlist_l->insertItem(_pppdata->accname()); | 138 | listListbox->insertItem(_pppdata->accname()); |
175 | // emit resetaccounts(); | 139 | // emit resetaccounts(); |
176 | _pppdata->save(); | 140 | _pppdata->save(); |
177 | } | 141 | } |
178 | 142 | ||
179 | 143 | ||
180 | void AccountWidget::deleteaccount() { | 144 | void AccountWidget::remove() { |
181 | 145 | ||
182 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") | 146 | QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") |
183 | .arg(accountlist_l->text(accountlist_l->currentItem())); | 147 | .arg(listListbox->text(listListbox->currentItem())); |
184 | 148 | ||
185 | if(QMessageBox::warning(this,tr("Confirm"),s, | 149 | if(QMessageBox::warning(this,tr("Confirm"),s, |
186 | QMessageBox::Yes,QMessageBox::No | 150 | QMessageBox::Yes,QMessageBox::No |
187 | ) != QMessageBox::Yes) | 151 | ) != QMessageBox::Yes) |
188 | return; | 152 | return; |
189 | 153 | ||
190 | if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem()))) | 154 | if(_pppdata->deleteAccount(listListbox->text(listListbox->currentItem()))) |
191 | accountlist_l->removeItem(accountlist_l->currentItem()); | 155 | listListbox->removeItem(listListbox->currentItem()); |
192 | 156 | ||
193 | emit resetaccounts(); | ||
194 | _pppdata->save(); | ||
195 | 157 | ||
196 | slotListBoxSelect(accountlist_l->currentItem()); | 158 | // emit resetaccounts(); |
159 | // _pppdata->save(); | ||
160 | |||
161 | |||
162 | slotListBoxSelect(listListbox->currentItem()); | ||
197 | 163 | ||
198 | } | 164 | } |
199 | 165 | ||
200 | 166 | ||
201 | int AccountWidget::doTab(){ | 167 | int AccountWidget::doTab(){ |
202 | QDialog *dlg = new QDialog( 0, "newAccount", true ); | 168 | QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp ); |
203 | QVBoxLayout *layout = new QVBoxLayout( dlg ); | 169 | QVBoxLayout *layout = new QVBoxLayout( dlg ); |
204 | layout->setSpacing( 0 ); | 170 | layout->setSpacing( 0 ); |
205 | layout->setMargin( 1 ); | 171 | layout->setMargin( 1 ); |
206 | 172 | ||
207 | tabWindow = new QTabWidget( dlg, "tabWindow" ); | 173 | QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" ); |
208 | layout->addWidget( tabWindow ); | 174 | layout->addWidget( tabWindow ); |
209 | 175 | ||
210 | bool isnewaccount; | 176 | bool isnewaccount; |
211 | 177 | ||
212 | if(_pppdata->accname().isEmpty()) { | 178 | if(_pppdata->accname().isEmpty()) { |
213 | dlg->setCaption(tr("New Account")); | 179 | dlg->setCaption(tr("New Account")); |
214 | isnewaccount = true; | 180 | isnewaccount = true; |
215 | } else { | 181 | } else { |
216 | QString tit = tr("Edit Account: "); | 182 | QString tit = tr("Edit Account: "); |
217 | tit += _pppdata->accname(); | 183 | tit += _pppdata->accname(); |
218 | dlg->setCaption(tit); | 184 | dlg->setCaption(tit); |
219 | isnewaccount = false; | 185 | isnewaccount = false; |
220 | } | 186 | } |
221 | 187 | ||
222 | // // DIAL WIDGET | 188 | // // DIAL WIDGET |
223 | dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); | 189 | dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); |
224 | tabWindow->addTab( dial_w, tr("Dial") ); | 190 | tabWindow->addTab( dial_w, tr("Dial") ); |
225 | 191 | ||
226 | // // AUTH WIDGET | 192 | // // AUTH WIDGET |
227 | auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); | 193 | auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); |
228 | tabWindow->addTab( auth_w, tr("Authentication") ); | 194 | tabWindow->addTab( auth_w, tr("Authentication") ); |
229 | 195 | ||
230 | // // IP WIDGET | 196 | // // IP WIDGET |
231 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); | 197 | ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); |
232 | tabWindow->addTab( ip_w, tr("IP") ); | 198 | tabWindow->addTab( ip_w, tr("IP") ); |
233 | 199 | ||
234 | // // GATEWAY WIDGET | 200 | // // GATEWAY WIDGET |
235 | gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup")); | 201 | gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup")); |
236 | tabWindow->addTab( gateway_w, tr("Gateway") ); | 202 | tabWindow->addTab( gateway_w, tr("Gateway") ); |
237 | 203 | ||
238 | // // DNS WIDGET | 204 | // // DNS WIDGET |
239 | dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") ); | 205 | dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") ); |
240 | tabWindow->addTab( dns_w, tr("DNS") ); | 206 | tabWindow->addTab( dns_w, tr("DNS") ); |
241 | 207 | ||
242 | // // EXECUTE WIDGET | 208 | // // EXECUTE WIDGET |
243 | ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); | 209 | ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); |
244 | tabWindow->addTab( exec_w, tr("Execute") ); | 210 | tabWindow->addTab( exec_w, tr("Execute") ); |
245 | 211 | ||
246 | int result = 0; | 212 | int result = 0; |
247 | bool ok = false; | 213 | bool ok = false; |
248 | 214 | ||
249 | while (!ok){ | 215 | while (!ok){ |
250 | dlg->showMaximized(); | 216 | dlg->showMaximized(); |
251 | result = dlg->exec(); | 217 | result = dlg->exec(); |
252 | ok = true; | 218 | ok = true; |
253 | 219 | ||
254 | if(result == QDialog::Accepted) { | 220 | if(result == QDialog::Accepted) { |
255 | if (!auth_w->check()){ | 221 | if (!auth_w->check()){ |
256 | ok = false; | 222 | ok = false; |
257 | } else if(!dial_w->save()) { | 223 | } else if(!dial_w->save()) { |
258 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); | 224 | QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); |
259 | ok = false; | 225 | ok = false; |
260 | }else{ | 226 | }else{ |
261 | ip_w->save(); | 227 | ip_w->save(); |
262 | dns_w->save(); | 228 | dns_w->save(); |
263 | gateway_w->save(); | 229 | gateway_w->save(); |
264 | auth_w->save(); | 230 | auth_w->save(); |
265 | exec_w->save(); | 231 | exec_w->save(); |
266 | } | 232 | } |
267 | } | 233 | } |
268 | } | 234 | } |
269 | 235 | ||
270 | delete dlg; | 236 | delete dlg; |
271 | 237 | ||
272 | return result; | 238 | return result; |
273 | } | 239 | } |
274 | 240 | ||
275 | 241 | ||
276 | QString AccountWidget::prettyPrintVolume(unsigned int n) { | 242 | // QString AccountWidget::prettyPrintVolume(unsigned int n) { |
277 | int idx = 0; | 243 | // int idx = 0; |
278 | const QString quant[] = {tr("Byte"), tr("KB"), | 244 | // const QString quant[] = {tr("Byte"), tr("KB"), |
279 | tr("MB"), tr("GB"), QString::null}; | 245 | // tr("MB"), tr("GB"), QString::null}; |
280 | 246 | ||
281 | float n1 = n; | 247 | // float n1 = n; |
282 | while(n >= 1024 && quant[idx] != QString::null) { | 248 | // while(n >= 1024 && quant[idx] != QString::null) { |
283 | idx++; | 249 | // idx++; |
284 | n /= 1024; | 250 | // n /= 1024; |
285 | } | 251 | // } |
286 | 252 | ||
287 | int i = idx; | 253 | // int i = idx; |
288 | while(i--) | 254 | // while(i--) |
289 | n1 = n1 / 1024.0; | 255 | // n1 = n1 / 1024.0; |
290 | 256 | ||
291 | QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); | 257 | // QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); |
292 | s += " " + quant[idx]; | 258 | // s += " " + quant[idx]; |
293 | return s; | 259 | // return s; |
294 | } | 260 | // } |
295 | 261 | ||
296 | 262 | ||
297 | ///////////////////////////////////////////////////////////////////////////// | 263 | ///////////////////////////////////////////////////////////////////////////// |
298 | // | 264 | // |
299 | // Queries the user what to reset: costs, volume or both | 265 | // Queries the user what to reset: costs, volume or both |
300 | // | 266 | // |
301 | ///////////////////////////////////////////////////////////////////////////// | 267 | ///////////////////////////////////////////////////////////////////////////// |
302 | // QueryReset::QueryReset(QWidget *parent) : QDialog(parent, 0, true) { | 268 | // QueryReset::QueryReset(QWidget *parent) : QDialog(parent, 0, true) { |
303 | // // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 269 | // // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
304 | // setCaption(tr("Reset Accounting")); | 270 | // setCaption(tr("Reset Accounting")); |
305 | 271 | ||
306 | // QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); | 272 | // QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); |
307 | // QVGroupBox *f = new QVGroupBox(tr("What to Reset"), this); | 273 | // QVGroupBox *f = new QVGroupBox(tr("What to Reset"), this); |
308 | 274 | ||
309 | // QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); | 275 | // QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); |
310 | // // costs = new QCheckBox(tr("Reset the accumulated phone costs"), f); | 276 | // // costs = new QCheckBox(tr("Reset the accumulated phone costs"), f); |
311 | // // costs->setChecked(true); | 277 | // // costs->setChecked(true); |
312 | // // l1->addWidget(costs); | 278 | // // l1->addWidget(costs); |
313 | // // QWhatsThis::add(costs, tr("Check this to set the phone costs\n" | 279 | // // QWhatsThis::add(costs, tr("Check this to set the phone costs\n" |
314 | // // "to zero. Typically you'll want to\n" | 280 | // // "to zero. Typically you'll want to\n" |
315 | // // "do this once a month.")); | 281 | // // "do this once a month.")); |
316 | 282 | ||
317 | // // volume = new QCheckBox(tr("Reset volume accounting"), f); | 283 | // // volume = new QCheckBox(tr("Reset volume accounting"), f); |
318 | // // volume->setChecked(true); | 284 | // // volume->setChecked(true); |
319 | // // l1->addWidget(volume); | 285 | // // l1->addWidget(volume); |
320 | // // QWhatsThis::add(volume, tr("Check this to set the volume accounting\n" | 286 | // // QWhatsThis::add(volume, tr("Check this to set the volume accounting\n" |
321 | // // "to zero. Typically you'll want to do this\n" | 287 | // // "to zero. Typically you'll want to do this\n" |
322 | // // "once a month.")); | 288 | // // "once a month.")); |
323 | 289 | ||
324 | // l1->activate(); | 290 | // l1->activate(); |
325 | 291 | ||
326 | // // this activates the f-layout and sets minimumSize() | 292 | // // this activates the f-layout and sets minimumSize() |
327 | // f->show(); | 293 | // f->show(); |
328 | 294 | ||
329 | // tl->addWidget(f); | 295 | // tl->addWidget(f); |
330 | 296 | ||
331 | // QButtonGroup *bbox = new QButtonGroup(this); | 297 | // QButtonGroup *bbox = new QButtonGroup(this); |
332 | // // bbox->addStretch(1); | 298 | // // bbox->addStretch(1); |
333 | // QPushButton *ok = new QPushButton( bbox, tr("OK") ); | 299 | // QPushButton *ok = new QPushButton( bbox, tr("OK") ); |
334 | // bbox->insert(ok); | 300 | // bbox->insert(ok); |
335 | // ok->setDefault(true); | 301 | // ok->setDefault(true); |
336 | // QPushButton *cancel = new QPushButton( bbox, tr("Cancel") ); | 302 | // QPushButton *cancel = new QPushButton( bbox, tr("Cancel") ); |
337 | // bbox->insert(cancel); | 303 | // bbox->insert(cancel); |
338 | 304 | ||
339 | // connect(ok, SIGNAL(clicked()), | 305 | // connect(ok, SIGNAL(clicked()), |
340 | // this, SLOT(accepted())); | 306 | // this, SLOT(accepted())); |
341 | // connect(cancel, SIGNAL(clicked()), | 307 | // connect(cancel, SIGNAL(clicked()), |
342 | // this, SLOT(reject())); | 308 | // this, SLOT(reject())); |
343 | 309 | ||
344 | // bbox->layout(); | 310 | // bbox->layout(); |
345 | // tl->addWidget(bbox); | 311 | // tl->addWidget(bbox); |
346 | 312 | ||
347 | // } | 313 | // } |
348 | 314 | ||
349 | 315 | ||
350 | // void QueryReset::accepted() { | 316 | // void QueryReset::accepted() { |
351 | // int result = costs->isChecked() ? COSTS : 0; | 317 | // int result = costs->isChecked() ? COSTS : 0; |
352 | // result += volume->isChecked() ? VOLUME : 0; | 318 | // result += volume->isChecked() ? VOLUME : 0; |
353 | 319 | ||
354 | // done(result); | 320 | // done(result); |
355 | // } | 321 | // } |
356 | 322 | ||
357 | 323 | ||