author | tille <tille> | 2003-05-30 15:06:17 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-30 15:06:17 (UTC) |
commit | 8699d02f6c152afed9490e7e7a4315044261e6e8 (patch) (unidiff) | |
tree | d2ee2ba401c7a9db0e33beaf0617a1456fe01d50 /noncore/settings/networksettings/ppp/conwindow.cpp | |
parent | d8cec07fe5e54a68afe4feca574f9f4d2433e0c1 (diff) | |
download | opie-8699d02f6c152afed9490e7e7a4315044261e6e8.zip opie-8699d02f6c152afed9490e7e7a4315044261e6e8.tar.gz opie-8699d02f6c152afed9490e7e7a4315044261e6e8.tar.bz2 |
modem and pppdata is now member of interfaceppp
Diffstat (limited to 'noncore/settings/networksettings/ppp/conwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/conwindow.cpp | 245 |
1 files changed, 121 insertions, 124 deletions
diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp index 20d705d..9136ca0 100644 --- a/noncore/settings/networksettings/ppp/conwindow.cpp +++ b/noncore/settings/networksettings/ppp/conwindow.cpp | |||
@@ -31,19 +31,16 @@ | |||
31 | #define i18n QObject::tr | 31 | #define i18n QObject::tr |
32 | // #include <kglobal.h> | 32 | // #include <kglobal.h> |
33 | 33 | ||
34 | extern PPPData gpppdata; | ||
35 | 34 | ||
36 | ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget ) | 35 | ConWindow::ConWindow(PPPData *pd, QWidget *parent, const char *name, |
37 | // PPPStats *st) | 36 | QDialog *mainwidget ) |
38 | : QWidget(parent, name, 0), | 37 | : QWidget(parent, name, 0), |
39 | minutes(0), | 38 | minutes(0), |
40 | seconds(0), | 39 | seconds(0), |
41 | hours(0), | 40 | hours(0), |
42 | days(0), | 41 | days(0), |
43 | tl1(0), | 42 | tl1(0), |
44 | // stats(st), | 43 | _pppdata(pd) |
45 | accountingEnabled(false), | ||
46 | volumeAccountingEnabled(false) | ||
47 | { | 44 | { |
48 | info1 = new QLabel(i18n("Connected at:"), this); | 45 | info1 = new QLabel(i18n("Connected at:"), this); |
49 | info2 = new QLabel("", this); | 46 | info2 = new QLabel("", this); |
@@ -115,122 +112,122 @@ QString ConWindow::prettyPrintVolume(unsigned int n) { | |||
115 | return s; | 112 | return s; |
116 | } | 113 | } |
117 | 114 | ||
118 | void ConWindow::accounting(bool on) { | 115 | // void ConWindow::accounting(bool on) { |
119 | // cache accounting settings | 116 | // // cache accounting settings |
120 | accountingEnabled = on; | 117 | // accountingEnabled = on; |
121 | volumeAccountingEnabled = PPPData::data()->VolAcctEnabled(); | 118 | // // volumeAccountingEnabled = PPPData::data()->VolAcctEnabled(); |
122 | |||
123 | // delete old layout | ||
124 | if(tl1 != 0) | ||
125 | delete tl1; | ||
126 | |||
127 | // add layout now | ||
128 | tl1 = new QVBoxLayout(this, 10, 10); | ||
129 | tl1->addSpacing(5); | ||
130 | QHBoxLayout *tl = new QHBoxLayout; | ||
131 | tl1->addLayout(tl); | ||
132 | tl->addSpacing(20); | ||
133 | QGridLayout *l1; | ||
134 | |||
135 | int vol_lines = 0; | ||
136 | if(PPPData::data()->VolAcctEnabled()) | ||
137 | vol_lines = 1; | ||
138 | |||
139 | if(accountingEnabled) | ||
140 | l1 = new QGridLayout(4 + vol_lines, 2, 5); | ||
141 | else | ||
142 | l1 = new QGridLayout(2 + vol_lines, 2, 5); | ||
143 | tl->addLayout(l1); | ||
144 | l1->setColStretch(0, 0); | ||
145 | l1->setColStretch(1, 1); | ||
146 | |||
147 | info2->setAlignment(AlignRight|AlignVCenter); | ||
148 | timelabel2->setAlignment(AlignRight|AlignVCenter); | ||
149 | session_bill->setAlignment(AlignRight|AlignVCenter); | ||
150 | total_bill->setAlignment(AlignRight|AlignVCenter); | ||
151 | volinfo->setAlignment(AlignRight|AlignVCenter); | ||
152 | // make sure that there's enough space for the bills | ||
153 | QString s1 = session_bill->text(); | ||
154 | QString s2 = total_bill->text(); | ||
155 | QString s3 = volinfo->text(); | ||
156 | |||
157 | session_bill->setText("888888.88 XXX"); | ||
158 | total_bill->setText("888888.88 XXX"); | ||
159 | volinfo->setText("8888.8 MB"); | ||
160 | session_bill->setFixedSize(session_bill->sizeHint()); | ||
161 | total_bill->setFixedSize(total_bill->sizeHint()); | ||
162 | volinfo->setFixedSize(volinfo->sizeHint()); | ||
163 | session_bill->setText(s1); | ||
164 | total_bill->setText(s2); | ||
165 | volinfo->setText(s3); | ||
166 | |||
167 | l1->addWidget(info1, 0, 0); | ||
168 | l1->addWidget(info2, 0, 1); | ||
169 | l1->addWidget(timelabel1, 1, 0); | ||
170 | l1->addWidget(timelabel2, 1, 1); | ||
171 | if(accountingEnabled) { | ||
172 | session_bill_l->show(); | ||
173 | session_bill->show(); | ||
174 | total_bill_l->show(); | ||
175 | total_bill->show(); | ||
176 | l1->addWidget(session_bill_l, 2, 0); | ||
177 | l1->addWidget(session_bill, 2, 1); | ||
178 | l1->addWidget(total_bill_l, 3, 0); | ||
179 | l1->addWidget(total_bill, 3, 1); | ||
180 | |||
181 | if(volumeAccountingEnabled) { | ||
182 | vollabel->show(); | ||
183 | volinfo->show(); | ||
184 | l1->addWidget(vollabel, 4, 0); | ||
185 | l1->addWidget(volinfo, 4, 1); | ||
186 | } else { | ||
187 | vollabel->hide(); | ||
188 | volinfo->hide(); | ||
189 | } | ||
190 | |||
191 | } else { | ||
192 | session_bill_l->hide(); | ||
193 | session_bill->hide(); | ||
194 | total_bill_l->hide(); | ||
195 | total_bill->hide(); | ||
196 | |||
197 | if(volumeAccountingEnabled) { | ||
198 | vollabel->show(); | ||
199 | volinfo->show(); | ||
200 | l1->addWidget(vollabel, 2, 0); | ||
201 | l1->addWidget(volinfo, 2, 1); | ||
202 | } else { | ||
203 | vollabel->hide(); | ||
204 | volinfo->hide(); | ||
205 | } | ||
206 | } | ||
207 | 119 | ||
208 | tl->addSpacing(10); | 120 | // // delete old layout |
209 | QVBoxLayout *l2 = new QVBoxLayout(5); | 121 | // if(tl1 != 0) |
210 | tl->addLayout(l2); | 122 | // delete tl1; |
211 | l2->addStretch(1); | ||
212 | // l2->addWidget(statsbutton); | ||
213 | l2->addWidget(cancelbutton); | ||
214 | 123 | ||
215 | l2->addStretch(1); | 124 | // // add layout now |
125 | // tl1 = new QVBoxLayout(this, 10, 10); | ||
126 | // tl1->addSpacing(5); | ||
127 | // QHBoxLayout *tl = new QHBoxLayout; | ||
128 | // tl1->addLayout(tl); | ||
129 | // tl->addSpacing(20); | ||
130 | // QGridLayout *l1; | ||
216 | 131 | ||
217 | tl1->addSpacing(5); | 132 | // int vol_lines = 0; |
133 | // // if(_pppdata->VolAcctEnabled()) | ||
134 | // // vol_lines = 1; | ||
218 | 135 | ||
219 | setFixedSize(sizeHint()); | 136 | // if(accountingEnabled) |
220 | /* | 137 | // l1 = new QGridLayout(4 + vol_lines, 2, 5); |
221 | do not overwrite position read from config | 138 | // else |
222 | setGeometry((QApplication::desktop()->width() - width()) / 2, | 139 | // l1 = new QGridLayout(2 + vol_lines, 2, 5); |
223 | (QApplication::desktop()->height() - height())/2, | 140 | // tl->addLayout(l1); |
224 | width(), | 141 | // l1->setColStretch(0, 0); |
225 | height()); | 142 | // l1->setColStretch(1, 1); |
226 | */ | 143 | |
227 | } | 144 | // info2->setAlignment(AlignRight|AlignVCenter); |
145 | // timelabel2->setAlignment(AlignRight|AlignVCenter); | ||
146 | // session_bill->setAlignment(AlignRight|AlignVCenter); | ||
147 | // total_bill->setAlignment(AlignRight|AlignVCenter); | ||
148 | // volinfo->setAlignment(AlignRight|AlignVCenter); | ||
149 | // // make sure that there's enough space for the bills | ||
150 | // QString s1 = session_bill->text(); | ||
151 | // QString s2 = total_bill->text(); | ||
152 | // QString s3 = volinfo->text(); | ||
153 | |||
154 | // session_bill->setText("888888.88 XXX"); | ||
155 | // total_bill->setText("888888.88 XXX"); | ||
156 | // volinfo->setText("8888.8 MB"); | ||
157 | // session_bill->setFixedSize(session_bill->sizeHint()); | ||
158 | // total_bill->setFixedSize(total_bill->sizeHint()); | ||
159 | // volinfo->setFixedSize(volinfo->sizeHint()); | ||
160 | // session_bill->setText(s1); | ||
161 | // total_bill->setText(s2); | ||
162 | // volinfo->setText(s3); | ||
163 | |||
164 | // l1->addWidget(info1, 0, 0); | ||
165 | // l1->addWidget(info2, 0, 1); | ||
166 | // l1->addWidget(timelabel1, 1, 0); | ||
167 | // l1->addWidget(timelabel2, 1, 1); | ||
168 | // if(accountingEnabled) { | ||
169 | // session_bill_l->show(); | ||
170 | // session_bill->show(); | ||
171 | // total_bill_l->show(); | ||
172 | // total_bill->show(); | ||
173 | // l1->addWidget(session_bill_l, 2, 0); | ||
174 | // l1->addWidget(session_bill, 2, 1); | ||
175 | // l1->addWidget(total_bill_l, 3, 0); | ||
176 | // l1->addWidget(total_bill, 3, 1); | ||
177 | |||
178 | // if(volumeAccountingEnabled) { | ||
179 | // vollabel->show(); | ||
180 | // volinfo->show(); | ||
181 | // l1->addWidget(vollabel, 4, 0); | ||
182 | // l1->addWidget(volinfo, 4, 1); | ||
183 | // } else { | ||
184 | // vollabel->hide(); | ||
185 | // volinfo->hide(); | ||
186 | // } | ||
187 | |||
188 | // } else { | ||
189 | // session_bill_l->hide(); | ||
190 | // session_bill->hide(); | ||
191 | // total_bill_l->hide(); | ||
192 | // total_bill->hide(); | ||
193 | |||
194 | // if(volumeAccountingEnabled) { | ||
195 | // vollabel->show(); | ||
196 | // volinfo->show(); | ||
197 | // l1->addWidget(vollabel, 2, 0); | ||
198 | // l1->addWidget(volinfo, 2, 1); | ||
199 | // } else { | ||
200 | // vollabel->hide(); | ||
201 | // volinfo->hide(); | ||
202 | // } | ||
203 | // } | ||
228 | 204 | ||
205 | // tl->addSpacing(10); | ||
206 | // QVBoxLayout *l2 = new QVBoxLayout(5); | ||
207 | // tl->addLayout(l2); | ||
208 | // l2->addStretch(1); | ||
209 | // // l2->addWidget(statsbutton); | ||
210 | // l2->addWidget(cancelbutton); | ||
229 | 211 | ||
230 | void ConWindow::dock() { | 212 | // l2->addStretch(1); |
231 | // DockWidget::dock_widget->show(); | 213 | |
232 | this->hide(); | 214 | // tl1->addSpacing(5); |
233 | } | 215 | |
216 | // setFixedSize(sizeHint()); | ||
217 | // /* | ||
218 | // do not overwrite position read from config | ||
219 | // setGeometry((QApplication::desktop()->width() - width()) / 2, | ||
220 | // (QApplication::desktop()->height() - height())/2, | ||
221 | // width(), | ||
222 | // height()); | ||
223 | // */ | ||
224 | // } | ||
225 | |||
226 | |||
227 | // void ConWindow::dock() { | ||
228 | // // DockWidget::dock_widget->show(); | ||
229 | // this->hide(); | ||
230 | // } | ||
234 | 231 | ||
235 | 232 | ||
236 | void ConWindow::startClock() { | 233 | void ConWindow::startClock() { |
@@ -239,9 +236,9 @@ void ConWindow::startClock() { | |||
239 | hours = 0; | 236 | hours = 0; |
240 | QString title ; | 237 | QString title ; |
241 | 238 | ||
242 | title = PPPData::data()->accname(); | 239 | title = _pppdata->accname(); |
243 | 240 | ||
244 | if(PPPData::data()->get_show_clock_on_caption()){ | 241 | if(_pppdata->get_show_clock_on_caption()){ |
245 | title += " 00:00" ; | 242 | title += " 00:00" ; |
246 | } | 243 | } |
247 | this->setCaption(title); | 244 | this->setCaption(title); |
@@ -265,7 +262,7 @@ void ConWindow::timeclick() { | |||
265 | // QString tooltip = i18n("Connection: %1\n" | 262 | // QString tooltip = i18n("Connection: %1\n" |
266 | // "Connected at: %2\n" | 263 | // "Connected at: %2\n" |
267 | // "Time connected: %3") | 264 | // "Time connected: %3") |
268 | // .arg(PPPData::data()->accname()).arg(info2->text()) | 265 | // .arg(_pppdata->accname()).arg(info2->text()) |
269 | // .arg(time_string2); | 266 | // .arg(time_string2); |
270 | 267 | ||
271 | // if(accountingEnabled) | 268 | // if(accountingEnabled) |
@@ -275,7 +272,7 @@ void ConWindow::timeclick() { | |||
275 | // if(volumeAccountingEnabled) { | 272 | // if(volumeAccountingEnabled) { |
276 | 273 | ||
277 | // volinfo->setEnabled(TRUE); | 274 | // volinfo->setEnabled(TRUE); |
278 | // int bytes = PPPData::data()->totalBytes(); | 275 | // int bytes = _pppdata->totalBytes(); |
279 | // volinfo->setText(prettyPrintVolume(bytes)); | 276 | // volinfo->setText(prettyPrintVolume(bytes)); |
280 | // } | 277 | // } |
281 | 278 | ||
@@ -305,14 +302,14 @@ void ConWindow::timeclick() { | |||
305 | // else | 302 | // else |
306 | // time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds); | 303 | // time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds); |
307 | 304 | ||
308 | // caption_string = PPPData::data()->accname(); | 305 | // caption_string = _pppdata->accname(); |
309 | // caption_string += " "; | 306 | // caption_string += " "; |
310 | // caption_string += time_string; | 307 | // caption_string += time_string; |
311 | 308 | ||
312 | 309 | ||
313 | // timelabel2->setText(time_string2); | 310 | // timelabel2->setText(time_string2); |
314 | 311 | ||
315 | // if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){ | 312 | // if(_pppdata->get_show_clock_on_caption() && (seconds == 1)){ |
316 | // // we update the Caption only once per minute not every second | 313 | // // we update the Caption only once per minute not every second |
317 | // // otherwise I get a flickering icon | 314 | // // otherwise I get a flickering icon |
318 | // this->setCaption(caption_string); | 315 | // this->setCaption(caption_string); |
@@ -328,8 +325,8 @@ void ConWindow::closeEvent( QCloseEvent *e ){ | |||
328 | // if we lost it we could only kill the program by hand to get on with life. | 325 | // if we lost it we could only kill the program by hand to get on with life. |
329 | e->ignore(); | 326 | e->ignore(); |
330 | 327 | ||
331 | if(PPPData::data()->get_dock_into_panel()) | 328 | // if(_pppdata->get_dock_into_panel()) |
332 | dock(); | 329 | // dock(); |
333 | } | 330 | } |
334 | 331 | ||
335 | 332 | ||