From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kppp/logview/export.cpp | 92 +++++++++++----------- kppp/logview/export.h | 102 ++++++++++++------------ kppp/logview/log.cpp | 22 +++--- kppp/logview/log.h | 10 +-- kppp/logview/loginfo.cpp | 18 ++--- kppp/logview/loginfo.h | 18 ++--- kppp/logview/main.cpp | 20 ++--- kppp/logview/main.h | 6 +- kppp/logview/monthly.cpp | 198 +++++++++++++++++++++++------------------------ kppp/logview/monthly.h | 34 ++++---- 10 files changed, 260 insertions(+), 260 deletions(-) (limited to 'kppp/logview') diff --git a/kppp/logview/export.cpp b/kppp/logview/export.cpp index 7f810a6a..14c614c4 100644 --- a/kppp/logview/export.cpp +++ b/kppp/logview/export.cpp @@ -22,17 +22,17 @@ #include "export.h" -#include -#include +#include +#include class Export; /***** ExportFormats *****/ static struct { int id; - QString name; - QString desc; - QString ext; + TQString name; + TQString desc; + TQString ext; } ExportFormats [] = { @@ -47,7 +47,7 @@ ExportFormats [] = { /***** ExportWizard *****/ -ExportWizard::ExportWizard(QWidget *parent, const QString &_date) +ExportWizard::ExportWizard(TQWidget *parent, const TQString &_date) : KWizard(parent, "", true) { date = _date; @@ -56,13 +56,13 @@ ExportWizard::ExportWizard(QWidget *parent, const QString &_date) setCaption(i18n("Export Wizard for kPPP Logs")); /* format-page */ - formatPage = new QWidget(); - QHBoxLayout *formatLayout = new QHBoxLayout(formatPage); + formatPage = new TQWidget(); + TQHBoxLayout *formatLayout = new TQHBoxLayout(formatPage); - typeList = new QListBox(formatPage); - connect(typeList, SIGNAL(highlighted(int)), SLOT (typeHighlighted(int))); + typeList = new TQListBox(formatPage); + connect(typeList, TQT_SIGNAL(highlighted(int)), TQT_SLOT (typeHighlighted(int))); typeList->setMinimumSize(50, 200); - QToolTip::add(typeList, i18n("List with possible output formats")); + TQToolTip::add(typeList, i18n("List with possible output formats")); int i=0; while (ExportFormats[i].id) { // add each format to the list typeList->insertItem(i18n(ExportFormats[i].name.utf8())); @@ -72,7 +72,7 @@ ExportWizard::ExportWizard(QWidget *parent, const QString &_date) formatLayout->addWidget(typeList); formatLayout->addSpacing(10); - typeInfo = new QLabel(formatPage); + typeInfo = new TQLabel(formatPage); typeInfo->setAlignment(Qt::AlignTop | Qt::WordBreak); typeInfo->setText(i18n("Please choose the output format on the left side.")); typeInfo->setMinimumSize(350, 200); @@ -82,25 +82,25 @@ ExportWizard::ExportWizard(QWidget *parent, const QString &_date) /* filename-page */ - filenamePage = new QWidget(); - QVBoxLayout *filenameLayout = new QVBoxLayout( filenamePage ); + filenamePage = new TQWidget(); + TQVBoxLayout *filenameLayout = new TQVBoxLayout( filenamePage ); - QLabel *fnLbl = new QLabel(filenamePage); + TQLabel *fnLbl = new TQLabel(filenamePage); fnLbl->setText(i18n("Filename:")); filenameLayout->addWidget(fnLbl); - fnLine = new QLineEdit(filenamePage); + fnLine = new TQLineEdit(filenamePage); fnLine->setText(i18n("[No file selected]")); fnLine->setReadOnly(true); filenameLayout->addWidget(fnLine); filenameLayout->addStretch(1); - fnGet = new QPushButton(filenamePage); + fnGet = new TQPushButton(filenamePage); fnGet->setText(i18n("&Select File...")); fnGet->setMaximumWidth(200); - QToolTip::add(fnGet, i18n("Select the filename of the exported output file")); + TQToolTip::add(fnGet, i18n("Select the filename of the exported output file")); filenameLayout->addWidget(fnGet); - connect(fnGet, SIGNAL(clicked()), SLOT(getFilename())); + connect(fnGet, TQT_SIGNAL(clicked()), TQT_SLOT(getFilename())); filenameLayout->addStretch(2); addPage(filenamePage, i18n("Selection of Filename")); @@ -131,7 +131,7 @@ void ExportWizard::getFilename() { if ( i == -1 ) return; // prepare filter: e.g.: HTML (*.html *.HTML) - QString filter = "*." + ExportFormats[i].ext + " *." + ExportFormats[i].ext.upper() + "|" + + TQString filter = "*." + ExportFormats[i].ext + " *." + ExportFormats[i].ext.upper() + "|" + i18n(ExportFormats[i].name.utf8()) + " (*." + ExportFormats[i].ext + " *." + ExportFormats[i].ext.upper() + ")"; @@ -144,7 +144,7 @@ void ExportWizard::getFilename() { void ExportWizard::reject() { hide(); - filename = QString::null; + filename = TQString::null; } void ExportWizard::accept() { @@ -154,7 +154,7 @@ void ExportWizard::accept() { /***** Export *****/ -Export::Export(const QString &_filename) +Export::Export(const TQString &_filename) : filename(_filename), buffer("") { @@ -179,24 +179,24 @@ bool Export::closeFile() { /***** CSVExport *****/ -CSVExport::CSVExport(const QString &filename, const QString &_separator) +CSVExport::CSVExport(const TQString &filename, const TQString &_separator) : Export(filename), separator(_separator) { } -void CSVExport::addHeadline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h) { +void CSVExport::addHeadline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h) { // no especially style addDataline(a, b, c, d, e, f, g, h); } -void CSVExport::addDataline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h) { +void CSVExport::addDataline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h) { buffer+=a + separator + b + separator + c + separator + @@ -217,14 +217,14 @@ void CSVExport::setFinishCode() { /***** HTMLExport *****/ -HTMLExport::HTMLExport(const QString &filename, const QString &date) +HTMLExport::HTMLExport(const TQString &filename, const TQString &date) : Export(filename) { - QString title = i18n("Connection log for %1").arg(date); + TQString title = i18n("Connection log for %1").arg(date); buffer = "\n"; buffer.append("\n\n "+title+"\n"); - buffer.append(QString::fromLatin1(" ")); + buffer.append(TQString::fromLatin1(" ")); buffer.append("\n\n\n

"+title+"

\n\n"); buffer.append("\n"); @@ -234,13 +234,13 @@ HTMLExport::HTMLExport(const QString &filename, const QString &date) tdEndCode = ""; } -void HTMLExport::addHeadline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h) { +void HTMLExport::addHeadline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h) { // simply bold font - QString bak1 = tdStartCode; tdStartCode.append(""); - QString bak2 = tdEndCode; tdEndCode.prepend(""); + TQString bak1 = tdStartCode; tdStartCode.append(""); + TQString bak2 = tdEndCode; tdEndCode.prepend(""); addDataline(a, b, c, d, e, f, g, h); @@ -249,10 +249,10 @@ void HTMLExport::addHeadline(const QString &a, const QString &b, tdEndCode = bak2; } -void HTMLExport::addDataline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h) { +void HTMLExport::addDataline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h) { buffer+= trStartCode + tdStartCode + a + tdEndCode + tdStartCode + b + tdEndCode + diff --git a/kppp/logview/export.h b/kppp/logview/export.h index f192e7d5..3c601e96 100644 --- a/kppp/logview/export.h +++ b/kppp/logview/export.h @@ -23,13 +23,13 @@ #ifndef KPPPEXPORT_H #define KPPPEXPORT_H -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -41,11 +41,11 @@ class Export; class ExportWizard : public KWizard { Q_OBJECT public: - ExportWizard(QWidget *parent, const QString &_date); + ExportWizard(TQWidget *parent, const TQString &_date); Export *createExportFilter(); int filterID; - QString filename; + TQString filename; public slots: void typeHighlighted(int); @@ -55,15 +55,15 @@ public slots: void reject(); private: - QWidget *formatPage; - QListBox *typeList; - QLabel *typeInfo; + TQWidget *formatPage; + TQListBox *typeList; + TQLabel *typeInfo; - QWidget *filenamePage; - QLineEdit *fnLine; - QPushButton *fnGet; + TQWidget *filenamePage; + TQLineEdit *fnLine; + TQPushButton *fnGet; - QString date; + TQString date; }; @@ -71,68 +71,68 @@ private: class Export { public: Export(); - Export(const QString &filename); + Export(const TQString &filename); virtual ~Export(); bool openFile(); bool closeFile(); - virtual void addHeadline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h) = 0; - virtual void addDataline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h) = 0; + virtual void addHeadline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h) = 0; + virtual void addDataline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h) = 0; virtual void addEmptyLine() = 0; virtual void setFinishCode() = 0; protected: - QFile file; - QString filename; - QString buffer; + TQFile file; + TQString filename; + TQString buffer; }; /***** CSVExport *****/ class CSVExport : public Export { public: - CSVExport(const QString &filename, const QString &separator); - virtual void addHeadline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h); - virtual void addDataline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h); + CSVExport(const TQString &filename, const TQString &separator); + virtual void addHeadline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h); + virtual void addDataline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h); virtual void addEmptyLine(); virtual void setFinishCode(); private: - QString separator; + TQString separator; }; /***** HTMLExport *****/ class HTMLExport : public Export { public: - HTMLExport(const QString &filename, const QString &date); - virtual void addHeadline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h); - virtual void addDataline(const QString &a, const QString &b, - const QString &c, const QString &d, - const QString &e, const QString &f, - const QString &g, const QString &h); + HTMLExport(const TQString &filename, const TQString &date); + virtual void addHeadline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h); + virtual void addDataline(const TQString &a, const TQString &b, + const TQString &c, const TQString &d, + const TQString &e, const TQString &f, + const TQString &g, const TQString &h); virtual void addEmptyLine(); virtual void setFinishCode(); private: - QString trStartCode; - QString trEndCode; - QString tdStartCode; - QString tdEndCode; + TQString trStartCode; + TQString trEndCode; + TQString tdStartCode; + TQString tdEndCode; }; #endif diff --git a/kppp/logview/log.cpp b/kppp/logview/log.cpp index b0251d53..93be0098 100644 --- a/kppp/logview/log.cpp +++ b/kppp/logview/log.cpp @@ -23,37 +23,37 @@ #include #include -#include -#include +#include +#include #include #include #include #include -QPtrList logList; -QProgressDialog *dlg; +TQPtrList logList; +TQProgressDialog *dlg; int loadLogs() { int logsize = 0; - QString logdirname = locateLocal("data", "kppp/Log/"); - QDir logdir(logdirname, "*.log"); + TQString logdirname = locateLocal("data", "kppp/Log/"); + TQDir logdir(logdirname, "*.log"); kdDebug(5002) << "logdirname: " << logdirname << endl; // get log file size const QFileInfoList *list = logdir.entryInfoList(); QFileInfoListIterator it( *list ); - QFileInfo *fi; + TQFileInfo *fi; while ((fi = it.current()) != 0) { logsize += fi->size(); ++it; } - dlg = new QProgressDialog(i18n("Loading log files"), - QString::null, + dlg = new TQProgressDialog(i18n("Loading log files"), + TQString::null, logsize); dlg->setProgress(0); @@ -71,11 +71,11 @@ int loadLogs() { return retval; } -int loadLog(QString fname) { +int loadLog(TQString fname) { FILE *f; int warning=0; - f = fopen(QFile::encodeName(fname), "r"); + f = fopen(TQFile::encodeName(fname), "r"); if(f == NULL) return 1; diff --git a/kppp/logview/log.h b/kppp/logview/log.h index 2297bd63..d8fa15cd 100644 --- a/kppp/logview/log.h +++ b/kppp/logview/log.h @@ -22,19 +22,19 @@ #define __LOG__H__ #include "loginfo.h" -#include +#include -typedef QPtrList QLogInfoBase; -typedef QPtrListIterator QLogInfoIterator; +typedef TQPtrList QLogInfoBase; +typedef TQPtrListIterator QLogInfoIterator; class QLogList : public QLogInfoBase { public: virtual int compareItems(Item, Item); }; -extern QPtrList logList; +extern TQPtrList logList; int loadLogs(); -int loadLog(QString); +int loadLog(TQString); #endif diff --git a/kppp/logview/loginfo.cpp b/kppp/logview/loginfo.cpp index 9544f389..321ce7c5 100644 --- a/kppp/logview/loginfo.cpp +++ b/kppp/logview/loginfo.cpp @@ -33,27 +33,27 @@ char *mystrsep (char **stringp, const char *delim); -LogInfo::LogInfo(QCString data) { +LogInfo::LogInfo(TQCString data) { parse(data); } -QDateTime LogInfo::from() const { - QDateTime tm; +TQDateTime LogInfo::from() const { + TQDateTime tm; tm.setTime_t(_from); return tm; } -QDateTime LogInfo::until() const { - QDateTime tm; +TQDateTime LogInfo::until() const { + TQDateTime tm; tm.setTime_t(_until); return tm; } -QString LogInfo::connectionName() const { +TQString LogInfo::connectionName() const { return _conname; } -QString LogInfo::currency() const { +TQString LogInfo::currency() const { return _currency; } @@ -84,7 +84,7 @@ int LogInfo::error() const { return errorfield; } -void LogInfo::parse(QCString s) { +void LogInfo::parse(TQCString s) { errorfield = 0; char *c = (char *)malloc(s.length() + 1), *csep; strcpy(c, s); @@ -101,7 +101,7 @@ void LogInfo::parse(QCString s) { char *p = mystrsep(&csep, ":"); int i = 0; while(i < 8 && p != 0) { - QString token = QString::fromLocal8Bit(p); + TQString token = TQString::fromLocal8Bit(p); switch(i) { case 0: diff --git a/kppp/logview/loginfo.h b/kppp/logview/loginfo.h index 6e1fa7fc..de4b79fc 100644 --- a/kppp/logview/loginfo.h +++ b/kppp/logview/loginfo.h @@ -22,22 +22,22 @@ #define __LOGINFO__H__ #define MYDEBUG -#include -#include +#include +#include #include class LogInfo { public: - LogInfo(QCString data); + LogInfo(TQCString data); int error() const; - QDateTime from() const; + TQDateTime from() const; time_t from_t() const { return _from; } - QDateTime until() const; + TQDateTime until() const; int duration() const; - QString connectionName() const; - QString currency() const; + TQString connectionName() const; + TQString currency() const; double sessionCosts() const; double totalCosts() const; double bytesIn() const; @@ -49,12 +49,12 @@ public: #endif private: - void parse(QCString ); + void parse(TQCString ); int errorfield; time_t _from, _until; - QString _conname, _currency; + TQString _conname, _currency; double _session_cost, _total_cost; double _bytes_in, _bytes_out; }; diff --git a/kppp/logview/main.cpp b/kppp/logview/main.cpp index ae877158..a533da38 100644 --- a/kppp/logview/main.cpp +++ b/kppp/logview/main.cpp @@ -55,11 +55,11 @@ TopWidget::TopWidget() : KMainWindow(0, "") { setCaption(i18n("KPPP Log Viewer")); - w = new QWidget(this); + w = new TQWidget(this); - QBoxLayout *l = new QVBoxLayout(w, 5); + TQBoxLayout *l = new TQVBoxLayout(w, 5); - td = new QTabWidget(w, ""); + td = new TQTabWidget(w, ""); mw = new MonthlyWidget(td); td->addTab(mw, i18n("Monthly Log")); l->addWidget(td); @@ -68,22 +68,22 @@ TopWidget::TopWidget() : KMainWindow(0, "") { if(!kpppmode) { // create menu mb = new KMenuBar(this); - QPopupMenu *fm = new QPopupMenu; + TQPopupMenu *fm = new QPopupMenu; fm->insertItem(SmallIcon("exit"),KStdGuiItem::quit().text(), F_EXIT); mb->insertItem(i18n("&File"), fm); mb->setAccel(CTRL + Key_Q, F_EXIT); - connect(mb, SIGNAL(activated(int)), - this, SLOT(menuCallback(int))); + connect(mb, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(menuCallback(int))); } else { mb = 0; - QPushButton *but = new KPushButton(KStdGuiItem::close(),w); - QHBoxLayout *lh = new QHBoxLayout(l); + TQPushButton *but = new KPushButton(KStdGuiItem::close(),w); + TQHBoxLayout *lh = new TQHBoxLayout(l); lh->addStretch(10); lh->addWidget(but); - connect(but, SIGNAL(clicked()), - kapp, SLOT(quit())); + connect(but, TQT_SIGNAL(clicked()), + kapp, TQT_SLOT(quit())); } setMinimumSize(mw->sizeHint().width() + 15, diff --git a/kppp/logview/main.h b/kppp/logview/main.h index bb833a0f..db7ca8da 100644 --- a/kppp/logview/main.h +++ b/kppp/logview/main.h @@ -22,7 +22,7 @@ #define __MAIN__H__ #include -#include +#include #include #include "monthly.h" @@ -38,8 +38,8 @@ private slots: private: MonthlyWidget *mw; KMenuBar *mb; - QWidget *w; - QTabWidget *td; + TQWidget *w; + TQTabWidget *td; }; #endif diff --git a/kppp/logview/monthly.cpp b/kppp/logview/monthly.cpp index b9aac7d3..904f2800 100644 --- a/kppp/logview/monthly.cpp +++ b/kppp/logview/monthly.cpp @@ -18,10 +18,10 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -32,9 +32,9 @@ #include "monthly.h" #include "export.h" -#include +#include -static void formatBytes(double bytes, QString &result) { +static void formatBytes(double bytes, TQString &result) { if(bytes < 1024) result.setNum(bytes); else if(bytes < 1024*1024) @@ -43,11 +43,11 @@ static void formatBytes(double bytes, QString &result) { result = i18n("%1 MB").arg(KGlobal::locale()->formatNumber((float)bytes / 1024.0 / 1024.0, 1)); } -static void formatBytesMonth(double bytes, QString &result) { +static void formatBytesMonth(double bytes, TQString &result) { int day, days; - day = QDate::currentDate().day(); - days = QDate::currentDate().daysInMonth(); + day = TQDate::currentDate().day(); + days = TQDate::currentDate().daysInMonth(); bytes = (bytes / day) * days; @@ -59,8 +59,8 @@ static void formatBytesMonth(double bytes, QString &result) { result = i18n("%1 MB").arg(KGlobal::locale()->formatNumber((float)bytes / 1024.0 / 1024.0, 1)); } -static void formatDuration(int seconds, QString &result) { - QString sec; +static void formatDuration(int seconds, TQString &result) { + TQString sec; sec.sprintf("%02d", seconds%60); if(seconds < 60) result = i18n("%1s").arg(sec); @@ -73,15 +73,15 @@ static void formatDuration(int seconds, QString &result) { .arg(sec); } -static void formatDurationMonth(int seconds, QString &result) { +static void formatDurationMonth(int seconds, TQString &result) { int day, days; - day = QDate::currentDate().day(); - days = QDate::currentDate().daysInMonth(); + day = TQDate::currentDate().day(); + days = TQDate::currentDate().daysInMonth(); seconds = (seconds / day) * days; - QString sec; + TQString sec; sec.sprintf("%02d", seconds%60); if(seconds < 60) result = i18n("%1s").arg(sec); @@ -97,37 +97,37 @@ static void formatDurationMonth(int seconds, QString &result) { static void costsMonth(double costs, double &result) { int day, days; - day = QDate::currentDate().day(); - days = QDate::currentDate().daysInMonth(); + day = TQDate::currentDate().day(); + days = TQDate::currentDate().daysInMonth(); result = (costs / day) * days; } -class LogListItem : public QListViewItem { +class LogListItem : public TQListViewItem { public: LogListItem(LogInfo *l, - QListView * parent, - QString s1, QString s2, - QString s3, QString s4, - QString s5, QString s6, - QString s7, QString s8) - : QListViewItem(parent, s1, s2, s3, s4, s5, s6, s7, s8), + TQListView * parent, + TQString s1, TQString s2, + TQString s3, TQString s4, + TQString s5, TQString s6, + TQString s7, TQString s8) + : TQListViewItem(parent, s1, s2, s3, s4, s5, s6, s7, s8), li(l) { } - virtual void paintCell( QPainter *p, const QColorGroup & cg, + virtual void paintCell( TQPainter *p, const TQColorGroup & cg, int column, int width, int alignment ); - virtual QString key(int, bool) const; + virtual TQString key(int, bool) const; LogInfo *li; }; -void LogListItem::paintCell( QPainter *p, const QColorGroup & cg, +void LogListItem::paintCell( TQPainter *p, const TQColorGroup & cg, int column, int width, int alignment ) { - QListViewItem::paintCell(p, cg, column, width, alignment); + TQListViewItem::paintCell(p, cg, column, width, alignment); // double line above sum //if(!li) { @@ -136,12 +136,12 @@ void LogListItem::paintCell( QPainter *p, const QColorGroup & cg, //} } -QString LogListItem::key(int c, bool ascending) const +TQString LogListItem::key(int c, bool ascending) const { if (!li) // we want the sum to be always at the bottom return ascending ? "z" : " "; - QString k; + TQString k; switch (c) { case 0: k = li->connectionName(); @@ -167,8 +167,8 @@ QString LogListItem::key(int c, bool ascending) const return k; } -MonthlyWidget::MonthlyWidget(QWidget *parent) : - QWidget(parent) +MonthlyWidget::MonthlyWidget(TQWidget *parent) : + TQWidget(parent) { tl = 0; @@ -194,9 +194,9 @@ MonthlyWidget::MonthlyWidget(QWidget *parent) : lv->setSorting(1); lv->setMinimumWidth(180); lv->setMinimumHeight(280); - lv->setSelectionMode(QListView::Extended); + lv->setSelectionMode(TQListView::Extended); selectionItem = 0L; - connect(lv, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged())); + connect(lv, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelectionChanged())); lv2 = new KListView(this); lv2->addColumn(i18n("Connection")); @@ -212,21 +212,21 @@ MonthlyWidget::MonthlyWidget(QWidget *parent) : lv2->setSorting(-1); lv2->setItemMargin(2); lv2->setMaximumHeight(100); - lv2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); - lv2->setSelectionMode(QListView::NoSelection); + lv2->setSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Minimum); + lv2->setSelectionMode(TQListView::NoSelection); - title = new QLabel("X", this); - QFont f = title->font(); + title = new TQLabel("X", this); + TQFont f = title->font(); f.setPointSize(f.pointSize() + 2); f.setBold(TRUE); title->setFont(f); title->setFixedHeight(title->sizeHint().height()*2); - cboConnections = new QComboBox(false, this); // add a combo box to select connections + cboConnections = new TQComboBox(false, this); // add a combo box to select connections cboConnections->setMaximumWidth(200); // a resonable size cboConnections->insertItem(i18n("All Connections")); // default to all connections - connect(cboConnections, SIGNAL(activated(int)), - this, SLOT(slotConnections(int))); + connect(cboConnections, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotConnections(int))); bbox = new KButtonBox(this, Qt::Vertical); prev = bbox->addButton(i18n("&Prev Month")); @@ -236,14 +236,14 @@ MonthlyWidget::MonthlyWidget(QWidget *parent) : bbox->addStretch(1); exportBttn = bbox->addButton(i18n("&Export...")); - connect(prev, SIGNAL(released()), - this, SLOT(prevMonth())); - connect(next, SIGNAL(released()), - this, SLOT(nextMonth())); - connect(today, SIGNAL(released()), - this, SLOT(currentMonth())); - connect(exportBttn, SIGNAL(clicked()), - this, SLOT(exportWizard())); + connect(prev, TQT_SIGNAL(released()), + this, TQT_SLOT(prevMonth())); + connect(next, TQT_SIGNAL(released()), + this, TQT_SLOT(nextMonth())); + connect(today, TQT_SIGNAL(released()), + this, TQT_SLOT(currentMonth())); + connect(exportBttn, TQT_SIGNAL(clicked()), + this, TQT_SLOT(exportWizard())); bbox->addStretch(8); bbox->layout(); @@ -256,12 +256,12 @@ void MonthlyWidget::layoutWidget() { if(tl) delete tl; - tl = new QGridLayout(this, 1, 1, 11, 16, "MainLayout"); + tl = new TQGridLayout(this, 1, 1, 11, 16, "MainLayout"); tl->addWidget(title, 0, 0); tl->addWidget(cboConnections, 0, 1); - QLabel *l = new QLabel(this); + TQLabel *l = new TQLabel(this); l->setText(i18n("Statistics:")); - QFont f2 = l->font(); + TQFont f2 = l->font(); f2.setPointSize(f2.pointSize() + 1); f2.setBold(TRUE); l->setFont(f2); @@ -275,13 +275,13 @@ void MonthlyWidget::layoutWidget() { tl->activate(); } -int bestlen(QWidget *w, const char *s) { +int bestlen(TQWidget *w, const char *s) { return w->fontMetrics().boundingRect(s).width() + 8; } void MonthlyWidget::plotMonth() { // name of the current connection - QString con; + TQString con; // for collecting monthly statistics int count = 0; @@ -293,12 +293,12 @@ void MonthlyWidget::plotMonth() { lv2->clear(); const KCalendarSystem * calendar = KGlobal::locale()->calendar(); - QDate startDate = periodeFirst(); + TQDate startDate = periodeFirst(); for(int i = 0; i < (int)logList.count(); i++) { LogInfo *li = logList.at(i); - QDate logDate = li->from().date(); + TQDate logDate = li->from().date(); if ( periodeFirst() <= logDate && periodeLast() >= logDate ) { // get connection name for this line con = li->connectionName(); @@ -330,7 +330,7 @@ void MonthlyWidget::plotMonth() { duration += li->from().secsTo(li->until()); - QString _bin, _bout, b; + TQString _bin, _bout, b; if(li->bytesIn() >= 0) formatBytes(li->bytesIn(), _bin); else @@ -346,14 +346,14 @@ void MonthlyWidget::plotMonth() { else b = i18n("n/a"); - QString day; + TQString day; day.sprintf("%2d", li->from().date().day()); - QString s_duration; + TQString s_duration; formatDuration(li->from().secsTo(li->until()), s_duration); - QString s_lifrom, s_liuntil, s_costs; + TQString s_lifrom, s_liuntil, s_costs; s_lifrom = KGlobal::locale()->formatTime(li->from().time(), false); s_liuntil = KGlobal::locale()->formatTime(li->until().time(), false); s_costs = KGlobal::locale()->formatMoney(li->sessionCosts()); @@ -363,7 +363,7 @@ void MonthlyWidget::plotMonth() { } if(count) { - QString _bin, _bout, _b; + TQString _bin, _bout, _b; if(bin < 0) _bin = i18n("n/a"); @@ -380,25 +380,25 @@ void MonthlyWidget::plotMonth() { else formatBytes(bout + bin, _b); - QString s_duration; + TQString s_duration; formatDuration(duration, s_duration); - QString s_costs(KGlobal::locale()->formatMoney(costs, QString::null, 2)); + TQString s_costs(KGlobal::locale()->formatMoney(costs, TQString::null, 2)); selectionItem = new LogListItem(0, lv2, i18n("Selection (%n connection)", "Selection (%n connections)", 0), - QString::null, QString::null, QString::null, - QString::null, QString::null, QString::null, QString::null); + TQString::null, TQString::null, TQString::null, + TQString::null, TQString::null, TQString::null, TQString::null); (void) new LogListItem(0, lv2, i18n("%n connection", "%n connections", count), - s_duration, s_costs, _bin, _bout, QString::null, QString::null, QString::null); + s_duration, s_costs, _bin, _bout, TQString::null, TQString::null, TQString::null); const KCalendarSystem * calendar = KGlobal::locale()->calendar(); - if(calendar->month(periodeFirst()) == calendar->month(QDate::currentDate())) { + if(calendar->month(periodeFirst()) == calendar->month(TQDate::currentDate())) { - QString m_bin, m_bout; + TQString m_bin, m_bout; if(bin < 0) _bin = i18n("n/a"); @@ -410,19 +410,19 @@ void MonthlyWidget::plotMonth() { else formatBytesMonth(bout, m_bout); - QString m_duration; + TQString m_duration; formatDurationMonth(duration, m_duration); costsMonth(costs, costs); - QString m_costs(KGlobal::locale()->formatMoney(costs, QString::null, 2)); + TQString m_costs(KGlobal::locale()->formatMoney(costs, TQString::null, 2)); - (void) new QListViewItem(lv2, selectionItem, + (void) new TQListViewItem(lv2, selectionItem, i18n("Monthly estimates"), m_duration, m_costs, m_bin, m_bout, - QString::null, QString::null, QString::null); + TQString::null, TQString::null, TQString::null); } } - QString t; + TQString t; if(lv->childCount() > 0) { exportBttn->setEnabled(true); // export possibility t = i18n("Connection log for %1 %2") @@ -456,7 +456,7 @@ void MonthlyWidget::prevMonth() { void MonthlyWidget::currentMonth() { const KCalendarSystem * calendar = KGlobal::locale()->calendar(); - QDate dt = QDate::currentDate(); + TQDate dt = TQDate::currentDate(); calendar->setYMD(m_periodeFirst, calendar->year(dt), calendar->month(dt), 1); plotMonth(); @@ -464,7 +464,7 @@ void MonthlyWidget::currentMonth() { void MonthlyWidget::exportWizard() { const KCalendarSystem * calendar = KGlobal::locale()->calendar(); - QString date = QString::fromLatin1("%1-%2") // e.g.: June-2001 + TQString date = TQString::fromLatin1("%1-%2") // e.g.: June-2001 .arg(calendar->monthName(periodeFirst())) .arg(calendar->year(periodeFirst())); @@ -473,7 +473,7 @@ void MonthlyWidget::exportWizard() { if (wizard->filename.isEmpty()) { // wizard aborted... return; } - if (QFile::exists(wizard->filename)) { // overwrite? + if (TQFile::exists(wizard->filename)) { // overwrite? if (KMessageBox::Continue!=KMessageBox::warningContinueCancel(0, i18n("A document with this name already exists."), i18n("Overwrite file?"), i18n("&Overwrite") /*, true*/)) { // no return; } @@ -496,7 +496,7 @@ void MonthlyWidget::exportWizard() { i18n("Duration"), i18n("Costs"), i18n("Bytes In"), i18n("Bytes Out") ); // name of the current connection - QString con; + TQString con; // for collecting monthly statistics int count = 0; @@ -507,7 +507,7 @@ void MonthlyWidget::exportWizard() { for(int i = 0; i < (int)logList.count(); i++) { LogInfo *li = logList.at(i); - QDate logDate = li->from().date(); + TQDate logDate = li->from().date(); if (periodeFirst() <= logDate && periodeLast() >= logDate ) { // get connection name for this line con = li->connectionName(); @@ -540,7 +540,7 @@ void MonthlyWidget::exportWizard() { duration += li->from().secsTo(li->until()); - QString _bin, _bout, b; + TQString _bin, _bout, b; if(li->bytesIn() >= 0) formatBytes(li->bytesIn(), _bin); else @@ -556,15 +556,15 @@ void MonthlyWidget::exportWizard() { else b = i18n("n/a"); - QString day; + TQString day; day.sprintf("%2d", li->from().date().day()); - QString con = li->connectionName(); + TQString con = li->connectionName(); - QString s_duration; + TQString s_duration; formatDuration(li->from().secsTo(li->until()), s_duration); - QString s_lifrom, s_liuntil, s_costs; + TQString s_lifrom, s_liuntil, s_costs; s_lifrom = KGlobal::locale()->formatTime(li->from().time(), false); s_liuntil = KGlobal::locale()->formatTime(li->until().time(), false); s_costs = KGlobal::locale()->formatMoney(li->sessionCosts()); @@ -576,9 +576,9 @@ void MonthlyWidget::exportWizard() { } } - if(calendar->month(periodeFirst()) == calendar->month(QDate::currentDate())) { + if(calendar->month(periodeFirst()) == calendar->month(TQDate::currentDate())) { - QString m_bin, m_bout; + TQString m_bin, m_bout; if(bin < 0) m_bin = i18n("n/a"); else @@ -589,21 +589,21 @@ void MonthlyWidget::exportWizard() { else formatBytesMonth(bout, m_bout); - QString m_duration; + TQString m_duration; formatDurationMonth(duration, m_duration); costsMonth(costs, costs); - QString m_costs(KGlobal::locale()->formatMoney(costs, QString::null, 2)); + TQString m_costs(KGlobal::locale()->formatMoney(costs, TQString::null, 2)); - QString datetime = KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(), true); + TQString datetime = KGlobal::locale()->formatDateTime( TQDateTime::currentDateTime(), true); exportIFace->addEmptyLine(); exportIFace->addDataline(i18n("Monthly estimates (%1)").arg(datetime), - QString::null, QString::null, QString::null, m_duration, m_costs, m_bin, m_bout); + TQString::null, TQString::null, TQString::null, m_duration, m_costs, m_bin, m_bout); } if(count) { - QString _bin, _bout, _b; + TQString _bin, _bout, _b; if(bin < 0) _bin = i18n("n/a"); @@ -620,15 +620,15 @@ void MonthlyWidget::exportWizard() { else formatBytes(bout + bin, _b); - QString s_duration; + TQString s_duration; formatDuration(duration, s_duration); - QString s_costs(KGlobal::locale()->formatMoney(costs, QString::null, 2)); + TQString s_costs(KGlobal::locale()->formatMoney(costs, TQString::null, 2)); // call export methods exportIFace->addEmptyLine(); - exportIFace->addDataline(i18n("%n connection", "%n connections", count), QString::null, QString::null, QString::null, s_duration, + exportIFace->addDataline(i18n("%n connection", "%n connections", count), TQString::null, TQString::null, TQString::null, s_duration, s_costs, _bin, _bout); exportIFace->setFinishCode(); @@ -643,12 +643,12 @@ void MonthlyWidget::exportWizard() { delete exportIFace; } -QDate MonthlyWidget::periodeFirst() const +TQDate MonthlyWidget::periodeFirst() const { return m_periodeFirst; } -QDate MonthlyWidget::periodeLast() const +TQDate MonthlyWidget::periodeLast() const { const KCalendarSystem * calendar = KGlobal::locale()->calendar(); @@ -666,7 +666,7 @@ void MonthlyWidget::slotSelectionChanged() int duration = 0; LogListItem *item; LogInfo *li; - QListViewItemIterator it(lv); + TQListViewItemIterator it(lv); while ( it.current() ) { item = dynamic_cast(it.current()); @@ -695,7 +695,7 @@ void MonthlyWidget::slotSelectionChanged() } if(count) { - QString _bin, _bout, _b; + TQString _bin, _bout, _b; if(bin < 0) _bin = i18n("n/a"); @@ -712,11 +712,11 @@ void MonthlyWidget::slotSelectionChanged() else formatBytes(bout + bin, _b); - QString s_duration; + TQString s_duration; formatDuration(duration, s_duration); - QString s_costs(KGlobal::locale()->formatMoney(costs, QString::null, 2)); + TQString s_costs(KGlobal::locale()->formatMoney(costs, TQString::null, 2)); selectionItem->setText(0, i18n("Selection (%n connection)", "Selection (%n connections)", count)); selectionItem->setText(1, s_duration); selectionItem->setText(2, s_costs); diff --git a/kppp/logview/monthly.h b/kppp/logview/monthly.h index a77f7bfe..bfe5407e 100644 --- a/kppp/logview/monthly.h +++ b/kppp/logview/monthly.h @@ -23,12 +23,12 @@ #define __MONTHLY__H__ #include "log.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include @@ -36,10 +36,10 @@ class KListView; class QComboBox; class LogListItem; -class MonthlyWidget : public QWidget { +class MonthlyWidget : public TQWidget { Q_OBJECT public: - MonthlyWidget(QWidget *parent = 0); + MonthlyWidget(TQWidget *parent = 0); private slots: void prevMonth(); @@ -56,25 +56,25 @@ private: /** * Returns the first day in the period */ - QDate periodeFirst() const; + TQDate periodeFirst() const; /** * Returns the last day in the period */ - QDate periodeLast() const; + TQDate periodeLast() const; - QDate m_periodeFirst; // First day in month + TQDate m_periodeFirst; // First day in month //int _month, _year; - QComboBox *cboConnections; + TQComboBox *cboConnections; KButtonBox *bbox; KListView *lv; KListView *lv2; LogListItem* selectionItem; - QLabel *title; - QPushButton *next, *prev, *today, *exportBttn; - QValueList lstConnections; - QGridLayout *tl; - QDateTime *dt; + TQLabel *title; + TQPushButton *next, *prev, *today, *exportBttn; + TQValueList lstConnections; + TQGridLayout *tl; + TQDateTime *dt; }; #endif -- cgit v1.2.1