summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/conwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/ppp/conwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/conwindow.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp
index 9136ca0..7641bbe 100644
--- a/noncore/settings/networksettings/ppp/conwindow.cpp
+++ b/noncore/settings/networksettings/ppp/conwindow.cpp
@@ -1,146 +1,141 @@
/*
* kPPP: A pppd front end for the KDE project
*
* $Id$
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <qtooltip.h>
#include <qdialog.h>
#include "conwindow.h"
-//#include "docking.h"
#include "pppdata.h"
-// #include "pppstats.h"
-// #include <klocale.h>
-#define i18n QObject::tr
-// #include <kglobal.h>
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),
_pppdata(pd)
{
- info1 = new QLabel(i18n("Connected at:"), this);
+ info1 = new QLabel(QObject::tr("Connected at:"), this);
info2 = new QLabel("", this);
- timelabel1 = new QLabel(i18n("Time connected:"), this);
+ timelabel1 = new QLabel(QObject::tr("Time connected:"), this);
timelabel2 = new QLabel("000:00:00", this);
- vollabel = new QLabel(i18n("Volume:"), this);
+ vollabel = new QLabel(QObject::tr("Volume:"), this);
volinfo = new QLabel("", this);
// now the stuff for accounting
- session_bill_l = new QLabel(i18n("Session Bill:"), this);
+ session_bill_l = new QLabel(QObject::tr("Session Bill:"), this);
session_bill = new QLabel("", this);
- total_bill_l = new QLabel(i18n("Total Bill:"), this);
+ total_bill_l = new QLabel(QObject::tr("Total Bill:"), this);
total_bill = new QLabel("", this);
this->setCaption("kppp");
cancelbutton = new QPushButton(this);
- cancelbutton->setText(i18n("Disconnect"));
+ cancelbutton->setText(QObject::tr("Disconnect"));
connect(cancelbutton, SIGNAL(clicked()), mainwidget, SLOT(disconnect()));
// statsbutton = new QPushButton(this);
-// statsbutton->setText(i18n("Details"));
+// statsbutton->setText(QObject::tr("Details"));
// statsbutton->setFocus();
// connect(statsbutton, SIGNAL(clicked()), mainwidget, SLOT(showStats()));
clocktimer = new QTimer(this);
connect(clocktimer, SIGNAL(timeout()), SLOT(timeclick()));
// read window position from config file
// int p_x, p_y;
// PPPData::data()->winPosConWin(p_x, p_y);
// setGeometry(p_x, p_y, 320, 110);
}
ConWindow::~ConWindow() {
stopClock();
}
// save window position when window was closed
bool ConWindow::event(QEvent *e) {
if (e->type() == QEvent::Hide)
{
// PPPData::data()->setWinPosConWin(x(), y());
return true;
}
else
return QWidget::event(e);
}
QString ConWindow::prettyPrintVolume(unsigned int n) {
int idx = 0;
- const QString quant[] = {i18n("Byte"), i18n("KB"),
- i18n("MB"), i18n("GB"), QString::null};
+ const QString quant[] = {QObject::tr("Byte"), QObject::tr("KB"),
+ QObject::tr("MB"), QObject::tr("GB"), QString::null};
float n1 = n;
while(n >= 1024 && quant[idx] != QString::null) {
idx++;
n /= 1024;
}
int i = idx;
while(i--)
n1 = n1 / 1024.0;
QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 ); //KGlobal::locale()->formatNumber( n1, idx==0 ? 0 : 1 );
s += " " + quant[idx];
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->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);
@@ -214,104 +209,104 @@ QString ConWindow::prettyPrintVolume(unsigned int n) {
// 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() {
minutes = 0;
seconds = 0;
hours = 0;
QString title ;
title = _pppdata->accname();
if(_pppdata->get_show_clock_on_caption()){
title += " 00:00" ;
}
this->setCaption(title);
timelabel2->setText("00:00:00");
clocktimer->start(1000);
}
void ConWindow::setConnectionSpeed(const QString &speed) {
info2->setText(speed);
}
void ConWindow::stopClock() {
clocktimer->stop();
}
void ConWindow::timeclick() {
-// QString tooltip = i18n("Connection: %1\n"
+// QString tooltip = QObject::tr("Connection: %1\n"
// "Connected at: %2\n"
// "Time connected: %3")
// .arg(_pppdata->accname()).arg(info2->text())
// .arg(time_string2);
// if(accountingEnabled)
-// tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2")
+// tooltip += QObject::tr("\nSession Bill: %1\nTotal Bill: %2")
// .arg(session_bill->text()).arg(total_bill->text());
// // volume accounting
// if(volumeAccountingEnabled) {
// volinfo->setEnabled(TRUE);
// int bytes = _pppdata->totalBytes();
// volinfo->setText(prettyPrintVolume(bytes));
// }
// seconds++;
// if(seconds >= 60 ) {
// minutes ++;
// seconds = 0;
// }
// if (minutes >= 60){
// minutes = 0;
// hours ++;
// }
// if( hours >= 24){
// days ++;
// hours = 0;
// }
// time_string.sprintf("%02d:%02d",hours,minutes);
// time_string2 = "";
// if (days)
// time_string2.sprintf("%d d %02d:%02d:%02d",
// days,hours,minutes,seconds);
// else
// time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
// caption_string = _pppdata->accname();
// caption_string += " ";
// caption_string += time_string;
// timelabel2->setText(time_string2);
// 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);
// }