2 * Copyright (C) 2003 by Mark Bucciarelli <mark@hubcapconsutling.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the
16 * Free Software Foundation, Inc.
17 * 51 Franklin Street, Fifth Floor
18 * Boston, MA 02110-1301 USA.
22 #ifndef KTIMETRACKER_TIMEKARD_H
23 #define KTIMETRACKER_TIMEKARD_H
25 #undef Color // X11 headers
26 #undef GrayScale // X11 headers
30 #include "reportcriteria.h"
39 * Seven consecutive days.
41 * The timecard report prints out one table for each week of data. The first
42 * day of the week should be read from the KControlPanel. Currently, it is
43 * hardcoded to Sunday.
48 /** Need an empty constructor to use in a QValueList. */
50 explicit Week( const QDate
&from
);
53 QList
<QDate
> days() const;
56 * Returns a list of weeks for the given date range.
58 * The first day of the week is picked up from the settings in the
61 * The list is inclusive; for example, if you pass in a date range of two
62 * days, one being a Sunday and the other being a Monday, you will get two
63 * weeks back in the list.
65 static QList
<Week
> weeksFromDateRange(const QDate
& from
,
69 * Return the name of the week.
71 * Uses whatever the user has set up for the long date format in
72 * KControlPanel, prefixed by "Week of".
82 * Routines to output timecard data.
93 * Generates ascii text of task totals, for current task on down.
95 * Formatted for pasting into clipboard.
97 * @param taskview The view whose tasks need to be formatted.
99 * @param rc Criteria which filters the task information.
101 QString
totalsAsText(TaskView
* taskview
, ReportCriteria rc
);
104 * Generates ascii text of weekly task history, for current task on down.
106 * Formatted for pasting into clipboard.
108 QString
historyAsText(TaskView
* taskview
, const QDate
& from
,
109 const QDate
& to
, bool justThisTask
, bool perWeek
, bool totalsOnly
);
112 void printTask(Task
*t
, QString
&s
, int level
, const ReportCriteria
&rc
);
114 void printTaskHistory(const Task
*t
, const QMap
<QString
, long>& datamap
,
115 QMap
<QString
, long>& daytotals
,
116 const QDate
& from
, const QDate
& to
,
117 const int level
, QString
& retval
, bool totalsOnly
);
119 QString
sectionHistoryAsText(TaskView
* taskview
,
120 const QDate
& sectionFrom
, const QDate
& sectionTo
,
121 const QDate
& from
, const QDate
& to
,
123 bool justThisTask
, bool totalsOnly
);
126 #endif // KTIMETRACKER_TIMEKARD_H