summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/statistics/statisticsdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/plugins/statistics/statisticsdialog.cpp')
-rw-r--r--kopete/plugins/statistics/statisticsdialog.cpp164
1 files changed, 82 insertions, 82 deletions
diff --git a/kopete/plugins/statistics/statisticsdialog.cpp b/kopete/plugins/statistics/statisticsdialog.cpp
index 485eb7ad..461dd696 100644
--- a/kopete/plugins/statistics/statisticsdialog.cpp
+++ b/kopete/plugins/statistics/statisticsdialog.cpp
@@ -14,14 +14,14 @@
*/
-#include <qtabwidget.h>
-#include <qwidget.h>
-#include <qhbox.h>
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qtextedit.h>
-#include <qcombobox.h>
-#include <qstring.h>
+#include <tqtabwidget.h>
+#include <tqwidget.h>
+#include <tqhbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqtextedit.h>
+#include <tqcombobox.h>
+#include <tqstring.h>
#include "kdialogbase.h"
#include "klocale.h"
@@ -40,7 +40,7 @@
#include "statisticsplugin.h"
#include "statisticsdb.h"
-StatisticsDialog::StatisticsDialog(StatisticsContact *contact, StatisticsDB *db, QWidget* parent,
+StatisticsDialog::StatisticsDialog(StatisticsContact *contact, StatisticsDB *db, TQWidget* parent,
const char* name) : KDialogBase(parent, name, false,
i18n("Statistics for %1").arg(contact->metaContact()->displayName()), Close, Close), m_db(db), m_contact(contact)
{
@@ -51,20 +51,20 @@ StatisticsDialog::StatisticsDialog(StatisticsContact *contact, StatisticsDB *db,
setMinimumHeight(400);
adjustSize();
- QHBox *hbox = new QHBox(this);
+ TQHBox *hbox = new TQHBox(this);
generalHTMLPart = new KHTMLPart(hbox);
generalHTMLPart->setOnlyLocalReferences(true);
- connect ( generalHTMLPart->browserExtension(), SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ),
- this, SLOT( slotOpenURLRequest( const KURL &, const KParts::URLArgs & ) ) );
+ connect ( generalHTMLPart->browserExtension(), TQT_SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ),
+ this, TQT_SLOT( slotOpenURLRequest( const KURL &, const KParts::URLArgs & ) ) );
mainWidget->tabWidget->insertTab(hbox, i18n("General"), 0);
mainWidget->tabWidget->setCurrentPage(0);
- mainWidget->timePicker->setTime(QTime::currentTime());
- mainWidget->datePicker->setDate(QDate::currentDate());
- connect(mainWidget->askButton, SIGNAL(clicked()), this, SLOT(slotAskButtonClicked()));
+ mainWidget->timePicker->setTime(TQTime::currentTime());
+ mainWidget->datePicker->setDate(TQDate::currentDate());
+ connect(mainWidget->askButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotAskButtonClicked()));
setFocus();
setEscapeButton(Close);
@@ -89,14 +89,14 @@ void StatisticsDialog::slotOpenURLRequest(const KURL& url, const KParts::URLArgs
}
}
-/*void StatisticsDialog::parseTemplate(QString Template)
+/*void StatisticsDialog::parseTemplate(TQString Template)
{
- QString fileString = ::locate("appdata", "kopete_statistics.template.html");
- QString templateString;
- QFile file(file);
+ TQString fileString = ::locate("appdata", "kopete_statistics.template.html");
+ TQString templateString;
+ TQFile file(file);
if (file.open(IO_ReadOnly))
{
- QTextStream stream(&file);
+ TQTextStream stream(&file);
templateString = stream.read();
file.close();
}
@@ -106,14 +106,14 @@ void StatisticsDialog::slotOpenURLRequest(const KURL& url, const KParts::URLArgs
void StatisticsDialog::generatePageForMonth(const int monthOfYear)
{
- QStringList values = m_db->query(QString("SELECT status, datetimebegin, datetimeend "
+ TQStringList values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend "
"FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin;").arg(m_contact->statisticsContactId()));
- QStringList values2;
+ TQStringList values2;
for (uint i=0; i<values.count(); i+=3)
{
- QDateTime dateTimeBegin;
+ TQDateTime dateTimeBegin;
dateTimeBegin.setTime_t(values[i+1].toInt());
/// @todo Same as for Day, check if second datetime is on the same month
if (dateTimeBegin.date().month() == monthOfYear)
@@ -123,21 +123,21 @@ void StatisticsDialog::generatePageForMonth(const int monthOfYear)
values2.push_back(values[i+2]);
}
}
- generatePageFromQStringList(values2, QDate::longMonthName(monthOfYear));
+ generatePageFromQStringList(values2, TQDate::longMonthName(monthOfYear));
}
void StatisticsDialog::generatePageForDay(const int dayOfWeek)
{
- QStringList values = m_db->query(QString("SELECT status, datetimebegin, datetimeend "
+ TQStringList values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend "
"FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin;").arg(m_contact->statisticsContactId()));
- QStringList values2;
+ TQStringList values2;
for (uint i=0; i<values.count(); i+=3)
{
- QDateTime dateTimeBegin;
+ TQDateTime dateTimeBegin;
dateTimeBegin.setTime_t(values[i+1].toInt());
- QDateTime dateTimeEnd;
+ TQDateTime dateTimeEnd;
dateTimeEnd.setTime_t(values[i+2].toInt());
if (dateTimeBegin.date().dayOfWeek() == dayOfWeek)
{
@@ -149,9 +149,9 @@ void StatisticsDialog::generatePageForDay(const int dayOfWeek)
// datetime from value[i+1]
- dateTimeBegin = QDateTime(dateTimeBegin.date(), QTime(0, 0, 0));
- dateTimeBegin.addSecs(dateTimeBegin.time().secsTo(QTime(23, 59, 59)));
- values2.push_back(QString::number(dateTimeBegin.toTime_t()));
+ dateTimeBegin = TQDateTime(dateTimeBegin.date(), TQTime(0, 0, 0));
+ dateTimeBegin.addSecs(dateTimeBegin.time().secsTo(TQTime(23, 59, 59)));
+ values2.push_back(TQString::number(dateTimeBegin.toTime_t()));
}
else
{
@@ -161,15 +161,15 @@ void StatisticsDialog::generatePageForDay(const int dayOfWeek)
}
}
}
- generatePageFromQStringList(values2, QDate::longDayName(dayOfWeek));
+ generatePageFromQStringList(values2, TQDate::longDayName(dayOfWeek));
}
/// @todo chart problem at midnight.
-void StatisticsDialog::generatePageFromQStringList(QStringList values, const QString & subTitle)
+void StatisticsDialog::generatePageFromQStringList(TQStringList values, const TQString & subTitle)
{
generalHTMLPart->begin();
- generalHTMLPart->write(QString("<html><head><style>.bar { margin:0px;} "
+ generalHTMLPart->write(TQString("<html><head><style>.bar { margin:0px;} "
"body"
"{"
"font-size:11px"
@@ -223,7 +223,7 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt
// mainWidget->listView->addColumn(i18n("Start Date"));
// mainWidget->listView->addColumn(i18n("End Date"));
- QString todayString;
+ TQString todayString;
todayString.append(i18n("<div class=\"statgroup\" title=\"Contact status history for today\"><h2>Today</h2><table width=\"100%\"><tr><td>Status</td><td>From</td><td>To</td></tr>"));
bool today;
@@ -259,13 +259,13 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt
// it is the STARTDATE from the database
- QDateTime dateTime1;
+ TQDateTime dateTime1;
dateTime1.setTime_t(values[i+1].toInt());
// it is the ENDDATE from the database
- QDateTime dateTime2;
+ TQDateTime dateTime2;
dateTime2.setTime_t(values[i+2].toInt());
- if (dateTime1.date() == QDate::currentDate() || dateTime2.date() == QDate::currentDate())
+ if (dateTime1.date() == TQDate::currentDate() || dateTime2.date() == TQDate::currentDate())
today = true;
else today = false;
@@ -330,10 +330,10 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt
- QString color;
+ TQString color;
if (today)
{
- QString status;
+ TQString status;
if (Kopete::OnlineStatus::statusStringToType(values[i]) == Kopete::OnlineStatus::Online)
{
color="blue";
@@ -351,12 +351,12 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt
}
else color="white";
- todayString.append(QString("<tr style=\"color:%1\"><td>%2</td><td>%3</td><td>%4</td></tr>").arg(color, status, dateTime1.time().toString(), dateTime2.time().toString()));
+ todayString.append(TQString("<tr style=\"color:%1\"><td>%2</td><td>%3</td><td>%4</td></tr>").arg(color, status, dateTime1.time().toString(), dateTime2.time().toString()));
}
// We add a listview item to the log list
- // QDateTime listViewDT1, listViewDT2;
+ // TQDateTime listViewDT1, listViewDT2;
// listViewDT1.setTime_t(values[i+1].toInt());
// listViewDT2.setTime_t(values[i+2].toInt());
// new KListViewItem(mainWidget->listView, values[i], values[i+1], values[i+2], listViewDT1.toString(), listViewDT2.toString());
@@ -391,83 +391,83 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt
"Total online time :</b> %2 hour(s)<br>").arg(m_contact->metaContact()->displayName()).arg(stringFromSeconds(totalOnlineTime)));
generalHTMLPart->write(i18n("<b title=\"The total time I have seen %1 away\">Total busy time :</b> %2 hour(s)<br>").arg(m_contact->metaContact()->displayName()).arg(stringFromSeconds(totalAwayTime)));
generalHTMLPart->write(i18n("<b title=\"The total time I have seen %1 offline\">Total offline time :</b> %2 hour(s)").arg(m_contact->metaContact()->displayName()).arg(stringFromSeconds(totalOfflineTime)));
- generalHTMLPart->write(QString("</div>"));
+ generalHTMLPart->write(TQString("</div>"));
if (subTitle == i18n("General information"))
/*
* General stats that should not be shown on "day" or "month" pages
*/
{
- generalHTMLPart->write(QString("<div class=\"statgroup\">"));
+ generalHTMLPart->write(TQString("<div class=\"statgroup\">"));
generalHTMLPart->write(i18n("<b>Average message length :</b> %1 characters<br>").arg(m_contact->messageLength()));
generalHTMLPart->write(i18n("<b>Time between two messages : </b> %1 second(s)").arg(m_contact->timeBetweenTwoMessages()));
- generalHTMLPart->write(QString("</div>"));
+ generalHTMLPart->write(TQString("</div>"));
- generalHTMLPart->write(QString("<div class=\"statgroup\">"));
+ generalHTMLPart->write(TQString("<div class=\"statgroup\">"));
generalHTMLPart->write(i18n("<b title=\"The last time you talked with %1\">Last talk :</b> %2<br>").arg(m_contact->metaContact()->displayName()).arg(KGlobal::locale()->formatDateTime(m_contact->lastTalk())));
generalHTMLPart->write(i18n("<b title=\"The last time I have seen %1 online or away\">Last time contact was present :</b> %2").arg(m_contact->metaContact()->displayName()).arg(KGlobal::locale()->formatDateTime(m_contact->lastPresent())));
- generalHTMLPart->write(QString("</div>"));
+ generalHTMLPart->write(TQString("</div>"));
- //generalHTMLPart->write(QString("<div class=\"statgroup\">"));
+ //generalHTMLPart->write(TQString("<div class=\"statgroup\">"));
//generalHTMLPart->write(i18n("<b title=\"%1 uses to set his status online at these hours (EXPERIMENTAL)\">Main online events :</b><br>").arg(m_contact->metaContact()->displayName()));
- //QValueList<QTime> mainEvents = m_contact->mainEvents(Kopete::OnlineStatus::Online);
+ //TQValueList<TQTime> mainEvents = m_contact->mainEvents(Kopete::OnlineStatus::Online);
//for (uint i=0; i<mainEvents.count(); i++)
- //generalHTMLPart->write(QString("%1<br>").arg(mainEvents[i].toString()));
- //generalHTMLPart->write(QString("</div>"));
+ //generalHTMLPart->write(TQString("%1<br>").arg(mainEvents[i].toString()));
+ //generalHTMLPart->write(TQString("</div>"));
generalHTMLPart->write("<div title=\"" +i18n("Current status") + "\" class=\"statgroup\">");
generalHTMLPart->write(i18n("Is <b>%1</b> since <b>%2</b>").arg(
Kopete::OnlineStatus(m_contact->oldStatus()).description(),
KGlobal::locale()->formatDateTime(m_contact->oldStatusDateTime())));
- generalHTMLPart->write(QString("</div>"));
+ generalHTMLPart->write(TQString("</div>"));
}
/*
* Chart which show the hours where plugin has seen this contact online
*/
- generalHTMLPart->write(QString("<div class=\"statgroup\">"));
- generalHTMLPart->write(QString("<table width=\"100%\"><tr><td colspan=\"3\">") + i18n("When have I seen this contact ?") + QString("</td></tr>"));
- generalHTMLPart->write(QString("<tr><td height=\"200\" valign=\"bottom\" colspan=\"3\" class=\"chart\">"));
+ generalHTMLPart->write(TQString("<div class=\"statgroup\">"));
+ generalHTMLPart->write(TQString("<table width=\"100%\"><tr><td colspan=\"3\">") + i18n("When have I seen this contact ?") + TQString("</td></tr>"));
+ generalHTMLPart->write(TQString("<tr><td height=\"200\" valign=\"bottom\" colspan=\"3\" class=\"chart\">"));
- QString chartString;
- QString colorPath = ::locate("appdata", "pics/statistics/black.png");
+ TQString chartString;
+ TQString colorPath = ::locate("appdata", "pics/statistics/black.png");
for (uint i=0; i<24; i++)
{
int hrWidth = qRound((double)hours[i]/(double)hours[iMaxHours]*100.);
- chartString += QString("<img class=\"margin:0px;\" height=\"")
- +(totalTime ? QString::number(hrWidth) : QString::number(0))
- +QString("\" src=\"file://")
+ chartString += TQString("<img class=\"margin:0px;\" height=\"")
+ +(totalTime ? TQString::number(hrWidth) : TQString::number(0))
+ +TQString("\" src=\"file://")
+colorPath
+"\" width=\"4%\" title=\""
+i18n("Between %1:00 and %2:00, I was able to see %3 status %4% of the hour.").arg(i).arg((i+1)%24).arg(m_contact->metaContact()->displayName()).arg(hrWidth)
- +QString("\">");
+ +TQString("\">");
}
generalHTMLPart->write(chartString);
- generalHTMLPart->write(QString("</td></tr>"));
+ generalHTMLPart->write(TQString("</td></tr>"));
- generalHTMLPart->write(QString( "<tr>"
- "<td>")+i18n("Online time")+QString("</td><td>")+i18n("Away time")+QString("</td><td>")+i18n("Offline time")+QString("</td>"
+ generalHTMLPart->write(TQString( "<tr>"
+ "<td>")+i18n("Online time")+TQString("</td><td>")+i18n("Away time")+TQString("</td><td>")+i18n("Offline time")+TQString("</td>"
"</tr>"
"<td valign=\"bottom\" width=\"33%\" class=\"chart\">"));
generalHTMLPart->write(generateHTMLChart(hoursOnline, hoursAway, hoursOffline, i18n("online"), "blue"));
- generalHTMLPart->write(QString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">"));
+ generalHTMLPart->write(TQString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">"));
generalHTMLPart->write(generateHTMLChart(hoursAway, hoursOnline, hoursOffline, i18n("away"), "navy"));
- generalHTMLPart->write(QString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">"));
+ generalHTMLPart->write(TQString("</td><td valign=\"bottom\" width=\"33%\" class=\"chart\">"));
generalHTMLPart->write(generateHTMLChart(hoursOffline, hoursAway, hoursOnline, i18n("offline"), "gray"));
- generalHTMLPart->write(QString("</td></tr></table></div>"));
+ generalHTMLPart->write(TQString("</td></tr></table></div>"));
if (subTitle == i18n("General information"))
/* On main page, show the different status of the contact today
*/
{
- generalHTMLPart->write(QString(todayString));
+ generalHTMLPart->write(TQString(todayString));
}
- generalHTMLPart->write(QString("</body></html>"));
+ generalHTMLPart->write(TQString("</body></html>"));
generalHTMLPart->end();
@@ -475,18 +475,18 @@ void StatisticsDialog::generatePageFromQStringList(QStringList values, const QSt
void StatisticsDialog::generatePageGeneral()
{
- QStringList values;
- values = m_db->query(QString("SELECT status, datetimebegin, datetimeend "
+ TQStringList values;
+ values = m_db->query(TQString("SELECT status, datetimebegin, datetimeend "
"FROM contactstatus WHERE metacontactid LIKE '%1' ORDER BY datetimebegin;")
.arg(m_contact->statisticsContactId()));
generatePageFromQStringList(values, i18n("General information"));
}
-QString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2, const int *hours3, const QString & caption, const QString & color)
+TQString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2, const int *hours3, const TQString & caption, const TQString & color)
{
- QString chartString;
+ TQString chartString;
- QString colorPath = ::locate("appdata", "pics/statistics/"+color+".png");
+ TQString colorPath = ::locate("appdata", "pics/statistics/"+color+".png");
for (uint i=0; i<24; i++)
@@ -494,9 +494,9 @@ QString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2,
int totalTime = hours[i] + hours2[i] + hours3[i];
int hrWidth = qRound((double)hours[i]/(double)totalTime*100.);
- chartString += QString("<img class=\"margin:0px;\" height=\"")
- +(totalTime ? QString::number(hrWidth) : QString::number(0))
- +QString("\" src=\"file://")
+ chartString += TQString("<img class=\"margin:0px;\" height=\"")
+ +(totalTime ? TQString::number(hrWidth) : TQString::number(0))
+ +TQString("\" src=\"file://")
+colorPath
+"\" width=\"4%\" title=\""+
i18n("Between %1:00 and %2:00, I have seen %3 %4% %5.").
@@ -510,23 +510,23 @@ QString StatisticsDialog::generateHTMLChart(const int *hours, const int *hours2,
return chartString;
}
-QString StatisticsDialog::stringFromSeconds(const int seconds)
+TQString StatisticsDialog::stringFromSeconds(const int seconds)
{
int h, m, s;
h = seconds/3600;
m = (seconds % 3600)/60;
s = (seconds % 3600) % 60;
- return QString::number(h)+":"+QString::number(m)+":"+QString::number(s);
+ return TQString::number(h)+":"+TQString::number(m)+":"+TQString::number(s);
}
void StatisticsDialog::slotAskButtonClicked()
{
if (mainWidget->questionComboBox->currentItem()==0)
{
- QString text = i18n("1 is date, 2 is contact name, 3 is online status", "%1, %2 was %3")
- .arg(KGlobal::locale()->formatDateTime(QDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time())))
+ TQString text = i18n("1 is date, 2 is contact name, 3 is online status", "%1, %2 was %3")
+ .arg(KGlobal::locale()->formatDateTime(TQDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time())))
.arg(m_contact->metaContact()->displayName())
- .arg(m_contact->statusAt(QDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time())));
+ .arg(m_contact->statusAt(TQDateTime(mainWidget->datePicker->date(), mainWidget->timePicker->time())));
mainWidget->answerEdit->setText(text);
}
else if (mainWidget->questionComboBox->currentItem()==1)