summaryrefslogtreecommitdiffstats
path: root/karm/timekard.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /karm/timekard.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karm/timekard.cpp')
-rw-r--r--karm/timekard.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/karm/timekard.cpp b/karm/timekard.cpp
index b7ff21f0e..984baf741 100644
--- a/karm/timekard.cpp
+++ b/karm/timekard.cpp
@@ -22,10 +22,10 @@
// #include <iostream>
-#include <qdatetime.h>
-#include <qpaintdevicemetrics.h>
-#include <qpainter.h>
-#include <qmap.h>
+#include <tqdatetime.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqpainter.h>
+#include <tqmap.h>
#include <kglobal.h>
#include <kdebug.h>
@@ -43,15 +43,15 @@ const int timeWidth = 6;
const int totalTimeWidth = 7;
const int reportWidth = taskWidth + timeWidth;
-const QString cr = QString::fromLatin1("\n");
+const TQString cr = TQString::fromLatin1("\n");
-QString TimeKard::totalsAsText(TaskView* taskview, bool justThisTask, WhichTime which)
+TQString TimeKard::totalsAsText(TaskView* taskview, bool justThisTask, WhichTime which)
// Print the total Times as text. If justThisTask, use activeTask, else, all tasks
{
kdDebug(5970) << "Entering TimeKard::totalsAsText" << endl;
- QString retval;
- QString line;
- QString buf;
+ TQString retval;
+ TQString line;
+ TQString buf;
long sum;
line.fill('-', reportWidth);
@@ -59,9 +59,9 @@ QString TimeKard::totalsAsText(TaskView* taskview, bool justThisTask, WhichTime
// header
retval += i18n("Task Totals") + cr;
- retval += KGlobal::locale()->formatDateTime(QDateTime::currentDateTime());
+ retval += KGlobal::locale()->formatDateTime(TQDateTime::currentDateTime());
retval += cr + cr;
- retval += QString(QString::fromLatin1("%1 %2"))
+ retval += TQString(TQString::fromLatin1("%1 %2"))
.arg(i18n("Time"), timeWidth)
.arg(i18n("Task"));
retval += cr;
@@ -92,8 +92,8 @@ QString TimeKard::totalsAsText(TaskView* taskview, bool justThisTask, WhichTime
// total
buf.fill('-', reportWidth);
- retval += QString(QString::fromLatin1("%1")).arg(buf, timeWidth) + cr;
- retval += QString(QString::fromLatin1("%1 %2"))
+ retval += TQString(TQString::fromLatin1("%1")).arg(buf, timeWidth) + cr;
+ retval += TQString(TQString::fromLatin1("%1 %2"))
.arg(formatTime(sum),timeWidth)
.arg(i18n("Total"));
}
@@ -104,12 +104,12 @@ QString TimeKard::totalsAsText(TaskView* taskview, bool justThisTask, WhichTime
}
// Print out "<indent for level> <task total> <task>", for task and subtasks. Used by totalsAsText.
-void TimeKard::printTask(Task *task, QString &s, int level, WhichTime which)
+void TimeKard::printTask(Task *task, TQString &s, int level, WhichTime which)
{
- QString buf;
+ TQString buf;
s += buf.fill(' ', level);
- s += QString(QString::fromLatin1("%1 %2"))
+ s += TQString(TQString::fromLatin1("%1 %2"))
.arg(formatTime(which == TotalTime?task->totalTime():task->totalSessionTime()), timeWidth)
.arg(task->name());
s += cr;
@@ -125,17 +125,17 @@ void TimeKard::printTask(Task *task, QString &s, int level, WhichTime which)
}
void TimeKard::printTaskHistory(const Task *task,
- const QMap<QString,long>& taskdaytotals,
- QMap<QString,long>& daytotals,
- const QDate& from,
- const QDate& to,
- const int level, QString& s, bool totalsOnly)
+ const TQMap<TQString,long>& taskdaytotals,
+ TQMap<TQString,long>& daytotals,
+ const TQDate& from,
+ const TQDate& to,
+ const int level, TQString& s, bool totalsOnly)
{
long sectionsum = 0;
- for ( QDate day = from; day <= to; day = day.addDays(1) )
+ for ( TQDate day = from; day <= to; day = day.addDays(1) )
{
- QString daykey = day.toString(QString::fromLatin1("yyyyMMdd"));
- QString daytaskkey = QString::fromLatin1("%1_%2")
+ TQString daykey = day.toString(TQString::fromLatin1("yyyyMMdd"));
+ TQString daytaskkey = TQString::fromLatin1("%1_%2")
.arg(daykey)
.arg(task->uid());
@@ -143,7 +143,7 @@ void TimeKard::printTaskHistory(const Task *task,
{
if ( !totalsOnly )
{
- s += QString::fromLatin1("%1")
+ s += TQString::fromLatin1("%1")
.arg(formatTime(taskdaytotals[daytaskkey]/60), timeWidth);
}
sectionsum += taskdaytotals[daytaskkey]; // in seconds
@@ -155,19 +155,19 @@ void TimeKard::printTaskHistory(const Task *task,
}
else if ( !totalsOnly )
{
- QString buf;
+ TQString buf;
buf.fill(' ', timeWidth);
s += buf;
}
}
// Total for task this section (e.g. week)
- s += QString::fromLatin1("%1").arg(formatTime(sectionsum/60), totalTimeWidth);
+ s += TQString::fromLatin1("%1").arg(formatTime(sectionsum/60), totalTimeWidth);
// Task name
- QString buf;
+ TQString buf;
s += buf.fill(' ', level + 1);
- s += QString::fromLatin1("%1").arg(task->name());
+ s += TQString::fromLatin1("%1").arg(task->name());
s += cr;
for (Task* subTask = task->firstChild();
@@ -179,21 +179,21 @@ void TimeKard::printTaskHistory(const Task *task,
}
}
-QString TimeKard::sectionHistoryAsText(
+TQString TimeKard::sectionHistoryAsText(
TaskView* taskview,
- const QDate& sectionFrom, const QDate& sectionTo,
- const QDate& from, const QDate& to,
- const QString& name,
+ const TQDate& sectionFrom, const TQDate& sectionTo,
+ const TQDate& from, const TQDate& to,
+ const TQString& name,
bool justThisTask, bool totalsOnly)
{
const int sectionReportWidth = taskWidth + ( totalsOnly ? 0 : sectionFrom.daysTo(sectionTo) * timeWidth ) + totalTimeWidth;
assert( sectionReportWidth > 0 );
- QString line;
+ TQString line;
line.fill('-', sectionReportWidth);
line += cr;
- QValueList<HistoryEvent> events;
+ TQValueList<HistoryEvent> events;
if ( sectionFrom < from && sectionTo > to)
{
events = taskview->getHistory(from, to);
@@ -211,18 +211,18 @@ QString TimeKard::sectionHistoryAsText(
events = taskview->getHistory(sectionFrom, sectionTo);
}
- QMap<QString, long> taskdaytotals;
- QMap<QString, long> daytotals;
+ TQMap<TQString, long> taskdaytotals;
+ TQMap<TQString, long> daytotals;
// Build lookup dictionary used to output data in table cells. keys are
// in this format: YYYYMMDD_NNNNNN, where Y = year, M = month, d = day and
// NNNNN = the VTODO uid. The value is the total seconds logged against
// that task on that day. Note the UID is the todo id, not the event id,
// so times are accumulated for each task.
- for (QValueList<HistoryEvent>::iterator event = events.begin(); event != events.end(); ++event)
+ for (TQValueList<HistoryEvent>::iterator event = events.begin(); event != events.end(); ++event)
{
- QString daykey = (*event).start().date().toString(QString::fromLatin1("yyyyMMdd"));
- QString daytaskkey = QString::fromLatin1("%1_%2")
+ TQString daykey = (*event).start().date().toString(TQString::fromLatin1("yyyyMMdd"));
+ TQString daytaskkey = TQString::fromLatin1("%1_%2")
.arg(daykey)
.arg((*event).todoUid());
@@ -233,10 +233,10 @@ QString TimeKard::sectionHistoryAsText(
taskdaytotals.insert(daytaskkey, (*event).duration());
}
- QString retval;
+ TQString retval;
// section name (e.g. week name)
retval += cr + cr;
- QString buf;
+ TQString buf;
if ( name.length() < (unsigned int)sectionReportWidth )
buf.fill(' ', int((sectionReportWidth - name.length()) / 2));
retval += buf + name + cr;
@@ -244,9 +244,9 @@ QString TimeKard::sectionHistoryAsText(
if ( !totalsOnly )
{
// day headings
- for (QDate day = sectionFrom; day <= sectionTo; day = day.addDays(1))
+ for (TQDate day = sectionFrom; day <= sectionTo; day = day.addDays(1))
{
- retval += QString::fromLatin1("%1").arg(day.day(), timeWidth);
+ retval += TQString::fromLatin1("%1").arg(day.day(), timeWidth);
}
retval += cr;
retval += line;
@@ -278,15 +278,15 @@ QString TimeKard::sectionHistoryAsText(
// per-day totals at the bottom of the section
long sum = 0;
- for (QDate day = sectionFrom; day <= sectionTo; day = day.addDays(1))
+ for (TQDate day = sectionFrom; day <= sectionTo; day = day.addDays(1))
{
- QString daykey = day.toString(QString::fromLatin1("yyyyMMdd"));
+ TQString daykey = day.toString(TQString::fromLatin1("yyyyMMdd"));
if (daytotals.contains(daykey))
{
if ( !totalsOnly )
{
- retval += QString::fromLatin1("%1")
+ retval += TQString::fromLatin1("%1")
.arg(formatTime(daytotals[daykey]/60), timeWidth);
}
sum += daytotals[daykey]; // in seconds
@@ -298,18 +298,18 @@ QString TimeKard::sectionHistoryAsText(
}
}
- retval += QString::fromLatin1("%1 %2")
+ retval += TQString::fromLatin1("%1 %2")
.arg(formatTime(sum/60), totalTimeWidth)
.arg(i18n("Total"));
}
return retval;
}
-QString TimeKard::historyAsText(TaskView* taskview, const QDate& from,
- const QDate& to, bool justThisTask, bool perWeek, bool totalsOnly)
+TQString TimeKard::historyAsText(TaskView* taskview, const TQDate& from,
+ const TQDate& to, bool justThisTask, bool perWeek, bool totalsOnly)
{
// header
- QString retval;
+ TQString retval;
retval += totalsOnly ? i18n("Task Totals") : i18n("Task History");
retval += cr;
retval += i18n("From %1 to %2")
@@ -317,13 +317,13 @@ QString TimeKard::historyAsText(TaskView* taskview, const QDate& from,
.arg(KGlobal::locale()->formatDate(to));
retval += cr;
retval += i18n("Printed on: %1")
- .arg(KGlobal::locale()->formatDateTime(QDateTime::currentDateTime()));
+ .arg(KGlobal::locale()->formatDateTime(TQDateTime::currentDateTime()));
if ( perWeek )
{
// output one time card table for each week in the date range
- QValueList<Week> weeks = Week::weeksFromDateRange(from, to);
- for (QValueList<Week>::iterator week = weeks.begin(); week != weeks.end(); ++week)
+ TQValueList<Week> weeks = Week::weeksFromDateRange(from, to);
+ for (TQValueList<Week>::iterator week = weeks.begin(); week != weeks.end(); ++week)
{
retval += sectionHistoryAsText( taskview, (*week).start(), (*week).end(), from, to, (*week).name(), justThisTask, totalsOnly );
}
@@ -336,37 +336,37 @@ QString TimeKard::historyAsText(TaskView* taskview, const QDate& from,
Week::Week() {}
-Week::Week(QDate from)
+Week::Week(TQDate from)
{
_start = from;
}
-QDate Week::start() const
+TQDate Week::start() const
{
return _start;
}
-QDate Week::end() const
+TQDate Week::end() const
{
return _start.addDays(6);
}
-QString Week::name() const
+TQString Week::name() const
{
return i18n("Week of %1").arg(KGlobal::locale()->formatDate(start()));
}
-QValueList<Week> Week::weeksFromDateRange(const QDate& from, const QDate& to)
+TQValueList<Week> Week::weeksFromDateRange(const TQDate& from, const TQDate& to)
{
- QDate start;
- QValueList<Week> weeks;
+ TQDate start;
+ TQValueList<Week> weeks;
- // The QDate weekNumber() method always puts monday as the first day of the
+ // The TQDate weekNumber() method always puts monday as the first day of the
// week.
//
// Not that it matters here, but week 1 always includes the first Thursday
// of the year. For example, January 1, 2000 was a Saturday, so
- // QDate(2000,1,1).weekNumber() returns 52.
+ // TQDate(2000,1,1).weekNumber() returns 52.
// Since report always shows a full week, we generate a full week of dates,
// even if from and to are the same date. The week starts on the day
@@ -374,7 +374,7 @@ QValueList<Week> Week::weeksFromDateRange(const QDate& from, const QDate& to)
start = from.addDays(
-((7 - KGlobal::locale()->weekStartDay() + from.dayOfWeek()) % 7));
- for (QDate d = start; d <= to; d = d.addDays(7))
+ for (TQDate d = start; d <= to; d = d.addDays(7))
weeks.append(Week(d));
return weeks;