summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/conwindow.cpp
authortille <tille>2003-05-30 15:06:17 (UTC)
committer tille <tille>2003-05-30 15:06:17 (UTC)
commit8699d02f6c152afed9490e7e7a4315044261e6e8 (patch) (side-by-side diff)
treed2ee2ba401c7a9db0e33beaf0617a1456fe01d50 /noncore/settings/networksettings/ppp/conwindow.cpp
parentd8cec07fe5e54a68afe4feca574f9f4d2433e0c1 (diff)
downloadopie-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.cpp245
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 @@
#define i18n QObject::tr
// #include <kglobal.h>
-extern PPPData gpppdata;
-ConWindow::ConWindow(QWidget *parent, const char *name, QDialog *mainwidget )
-// PPPStats *st)
+ConWindow::ConWindow(PPPData *pd, QWidget *parent, const char *name,
+ QDialog *mainwidget )
: QWidget(parent, name, 0),
minutes(0),
seconds(0),
hours(0),
days(0),
tl1(0),
-// stats(st),
- accountingEnabled(false),
- volumeAccountingEnabled(false)
+ _pppdata(pd)
{
info1 = new QLabel(i18n("Connected at:"), this);
info2 = new QLabel("", this);
@@ -115,122 +112,122 @@ QString ConWindow::prettyPrintVolume(unsigned int n) {
return s;
}
-void ConWindow::accounting(bool on) {
- // cache accounting settings
- accountingEnabled = on;
- volumeAccountingEnabled = PPPData::data()->VolAcctEnabled();
-
- // delete old layout
- if(tl1 != 0)
- delete tl1;
-
- // add layout now
- tl1 = new QVBoxLayout(this, 10, 10);
- tl1->addSpacing(5);
- QHBoxLayout *tl = new QHBoxLayout;
- tl1->addLayout(tl);
- tl->addSpacing(20);
- QGridLayout *l1;
-
- int vol_lines = 0;
- if(PPPData::data()->VolAcctEnabled())
- vol_lines = 1;
-
- if(accountingEnabled)
- l1 = new QGridLayout(4 + vol_lines, 2, 5);
- else
- l1 = new QGridLayout(2 + vol_lines, 2, 5);
- tl->addLayout(l1);
- l1->setColStretch(0, 0);
- l1->setColStretch(1, 1);
-
- info2->setAlignment(AlignRight|AlignVCenter);
- timelabel2->setAlignment(AlignRight|AlignVCenter);
- session_bill->setAlignment(AlignRight|AlignVCenter);
- total_bill->setAlignment(AlignRight|AlignVCenter);
- volinfo->setAlignment(AlignRight|AlignVCenter);
- // make sure that there's enough space for the bills
- QString s1 = session_bill->text();
- QString s2 = total_bill->text();
- QString s3 = volinfo->text();
-
- session_bill->setText("888888.88 XXX");
- total_bill->setText("888888.88 XXX");
- volinfo->setText("8888.8 MB");
- session_bill->setFixedSize(session_bill->sizeHint());
- total_bill->setFixedSize(total_bill->sizeHint());
- volinfo->setFixedSize(volinfo->sizeHint());
- session_bill->setText(s1);
- total_bill->setText(s2);
- volinfo->setText(s3);
-
- l1->addWidget(info1, 0, 0);
- l1->addWidget(info2, 0, 1);
- l1->addWidget(timelabel1, 1, 0);
- l1->addWidget(timelabel2, 1, 1);
- if(accountingEnabled) {
- session_bill_l->show();
- session_bill->show();
- total_bill_l->show();
- total_bill->show();
- l1->addWidget(session_bill_l, 2, 0);
- l1->addWidget(session_bill, 2, 1);
- l1->addWidget(total_bill_l, 3, 0);
- l1->addWidget(total_bill, 3, 1);
-
- if(volumeAccountingEnabled) {
- vollabel->show();
- volinfo->show();
- l1->addWidget(vollabel, 4, 0);
- l1->addWidget(volinfo, 4, 1);
- } else {
- vollabel->hide();
- volinfo->hide();
- }
-
- } else {
- session_bill_l->hide();
- session_bill->hide();
- total_bill_l->hide();
- total_bill->hide();
-
- if(volumeAccountingEnabled) {
- vollabel->show();
- volinfo->show();
- l1->addWidget(vollabel, 2, 0);
- l1->addWidget(volinfo, 2, 1);
- } else {
- vollabel->hide();
- volinfo->hide();
- }
- }
+// void ConWindow::accounting(bool on) {
+// // cache accounting settings
+// accountingEnabled = on;
+// // volumeAccountingEnabled = PPPData::data()->VolAcctEnabled();
- tl->addSpacing(10);
- QVBoxLayout *l2 = new QVBoxLayout(5);
- tl->addLayout(l2);
- l2->addStretch(1);
-// l2->addWidget(statsbutton);
- l2->addWidget(cancelbutton);
+// // delete old layout
+// if(tl1 != 0)
+// delete tl1;
- l2->addStretch(1);
+// // add layout now
+// tl1 = new QVBoxLayout(this, 10, 10);
+// tl1->addSpacing(5);
+// QHBoxLayout *tl = new QHBoxLayout;
+// tl1->addLayout(tl);
+// tl->addSpacing(20);
+// QGridLayout *l1;
- tl1->addSpacing(5);
+// int vol_lines = 0;
+// // if(_pppdata->VolAcctEnabled())
+// // vol_lines = 1;
- setFixedSize(sizeHint());
-/*
- do not overwrite position read from config
- setGeometry((QApplication::desktop()->width() - width()) / 2,
- (QApplication::desktop()->height() - height())/2,
- width(),
- height());
-*/
-}
+// if(accountingEnabled)
+// l1 = new QGridLayout(4 + vol_lines, 2, 5);
+// else
+// l1 = new QGridLayout(2 + vol_lines, 2, 5);
+// tl->addLayout(l1);
+// l1->setColStretch(0, 0);
+// l1->setColStretch(1, 1);
+
+// info2->setAlignment(AlignRight|AlignVCenter);
+// timelabel2->setAlignment(AlignRight|AlignVCenter);
+// session_bill->setAlignment(AlignRight|AlignVCenter);
+// total_bill->setAlignment(AlignRight|AlignVCenter);
+// volinfo->setAlignment(AlignRight|AlignVCenter);
+// // make sure that there's enough space for the bills
+// QString s1 = session_bill->text();
+// QString s2 = total_bill->text();
+// QString s3 = volinfo->text();
+
+// session_bill->setText("888888.88 XXX");
+// total_bill->setText("888888.88 XXX");
+// volinfo->setText("8888.8 MB");
+// session_bill->setFixedSize(session_bill->sizeHint());
+// total_bill->setFixedSize(total_bill->sizeHint());
+// volinfo->setFixedSize(volinfo->sizeHint());
+// session_bill->setText(s1);
+// total_bill->setText(s2);
+// volinfo->setText(s3);
+
+// l1->addWidget(info1, 0, 0);
+// l1->addWidget(info2, 0, 1);
+// l1->addWidget(timelabel1, 1, 0);
+// l1->addWidget(timelabel2, 1, 1);
+// if(accountingEnabled) {
+// session_bill_l->show();
+// session_bill->show();
+// total_bill_l->show();
+// total_bill->show();
+// l1->addWidget(session_bill_l, 2, 0);
+// l1->addWidget(session_bill, 2, 1);
+// l1->addWidget(total_bill_l, 3, 0);
+// l1->addWidget(total_bill, 3, 1);
+
+// if(volumeAccountingEnabled) {
+// vollabel->show();
+// volinfo->show();
+// l1->addWidget(vollabel, 4, 0);
+// l1->addWidget(volinfo, 4, 1);
+// } else {
+// vollabel->hide();
+// volinfo->hide();
+// }
+
+// } else {
+// session_bill_l->hide();
+// session_bill->hide();
+// total_bill_l->hide();
+// total_bill->hide();
+
+// if(volumeAccountingEnabled) {
+// vollabel->show();
+// volinfo->show();
+// l1->addWidget(vollabel, 2, 0);
+// l1->addWidget(volinfo, 2, 1);
+// } else {
+// vollabel->hide();
+// volinfo->hide();
+// }
+// }
+// tl->addSpacing(10);
+// QVBoxLayout *l2 = new QVBoxLayout(5);
+// tl->addLayout(l2);
+// l2->addStretch(1);
+// // l2->addWidget(statsbutton);
+// l2->addWidget(cancelbutton);
-void ConWindow::dock() {
-// DockWidget::dock_widget->show();
- this->hide();
-}
+// l2->addStretch(1);
+
+// tl1->addSpacing(5);
+
+// setFixedSize(sizeHint());
+// /*
+// do not overwrite position read from config
+// setGeometry((QApplication::desktop()->width() - width()) / 2,
+// (QApplication::desktop()->height() - height())/2,
+// width(),
+// height());
+// */
+// }
+
+
+// void ConWindow::dock() {
+// // DockWidget::dock_widget->show();
+// this->hide();
+// }
void ConWindow::startClock() {
@@ -239,9 +236,9 @@ void ConWindow::startClock() {
hours = 0;
QString title ;
- title = PPPData::data()->accname();
+ title = _pppdata->accname();
- if(PPPData::data()->get_show_clock_on_caption()){
+ if(_pppdata->get_show_clock_on_caption()){
title += " 00:00" ;
}
this->setCaption(title);
@@ -265,7 +262,7 @@ void ConWindow::timeclick() {
// QString tooltip = i18n("Connection: %1\n"
// "Connected at: %2\n"
// "Time connected: %3")
-// .arg(PPPData::data()->accname()).arg(info2->text())
+// .arg(_pppdata->accname()).arg(info2->text())
// .arg(time_string2);
// if(accountingEnabled)
@@ -275,7 +272,7 @@ void ConWindow::timeclick() {
// if(volumeAccountingEnabled) {
// volinfo->setEnabled(TRUE);
-// int bytes = PPPData::data()->totalBytes();
+// int bytes = _pppdata->totalBytes();
// volinfo->setText(prettyPrintVolume(bytes));
// }
@@ -305,14 +302,14 @@ void ConWindow::timeclick() {
// else
// time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
-// caption_string = PPPData::data()->accname();
+// caption_string = _pppdata->accname();
// caption_string += " ";
// caption_string += time_string;
// timelabel2->setText(time_string2);
-// if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){
+// if(_pppdata->get_show_clock_on_caption() && (seconds == 1)){
// // we update the Caption only once per minute not every second
// // otherwise I get a flickering icon
// this->setCaption(caption_string);
@@ -328,8 +325,8 @@ void ConWindow::closeEvent( QCloseEvent *e ){
// if we lost it we could only kill the program by hand to get on with life.
e->ignore();
- if(PPPData::data()->get_dock_into_panel())
- dock();
+// if(_pppdata->get_dock_into_panel())
+// dock();
}