karm

timekard.h
1 /*
2  * This file only:
3  * Copyright (C) 2003 Mark Bucciarelli <mark@hubcapconsutling.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the
17  * Free Software Foundation, Inc.
18  * 51 Franklin Street, Fifth Floor
19  * Boston, MA 02110-1301 USA.
20  *
21  */
22 
23 #ifndef KARM_TIMEKARD_H
24 #define KARM_TIMEKARD_H
25 
26 #undef Color // X11 headers
27 #undef GrayScale // X11 headers
28 #include <kprinter.h>
29 //#include <qdate.h>
30 
31 #include "karmstorage.h"
32 
33 class TQString;
34 class TQDate;
35 
36 class TaskView;
37 
38 
46 class Week
47 {
48  public:
50  Week();
51  Week(TQDate from);
52  TQDate start() const;
53  TQDate end() const;
54  TQValueList<TQDate> days() const;
55 
66  static TQValueList<Week> weeksFromDateRange(const TQDate& from,
67  const TQDate& to);
68 
75  TQString name() const;
76 
77 
78  private:
79  TQDate _start;
80 };
81 
85 class TimeKard
86 {
87  public:
88  TimeKard() {};
89 
90  enum WhichTime { TotalTime, SessionTime };
91 
104  TQString totalsAsText(TaskView* taskview, bool justThisTask, WhichTime which);
105 
111  TQString historyAsText(TaskView* taskview, const TQDate& from,
112  const TQDate& to, bool justThisTask, bool perWeek, bool totalsOnly);
113 
114 private:
115  void printTask(Task *t, TQString &s, int level, WhichTime which);
116 
117  void printTaskHistory(const Task *t, const TQMap<TQString, long>& datamap,
118  TQMap<TQString, long>& daytotals,
119  const TQDate& from, const TQDate& to,
120  const int level, TQString& retval, bool totalsOnly);
121 
122  TQString sectionHistoryAsText(TaskView* taskview,
123  const TQDate& sectionFrom, const TQDate& sectionTo,
124  const TQDate& from, const TQDate& to,
125  const TQString& name,
126  bool justThisTask, bool totalsOnly);
127 
128  };
129 #endif // KARM_TIMEKARD_H
Container and interface for the tasks.
Definition: taskview.h:43
A class representing a task.
Definition: task.h:42
Routines to output timecard data.
Definition: timekard.h:86
TQString totalsAsText(TaskView *taskview, bool justThisTask, WhichTime which)
Generates ascii text of task totals, for current task on down.
Definition: timekard.cpp:48
TQString historyAsText(TaskView *taskview, const TQDate &from, const TQDate &to, bool justThisTask, bool perWeek, bool totalsOnly)
Generates ascii text of weekly task history, for current task on down.
Definition: timekard.cpp:308
Seven consecutive days.
Definition: timekard.h:47
TQString name() const
Return the name of the week.
Definition: timekard.cpp:354
Week()
Need an empty constructor to use in a TQValueList.
Definition: timekard.cpp:337
static TQValueList< Week > weeksFromDateRange(const TQDate &from, const TQDate &to)
Returns a list of weeks for the given date range.
Definition: timekard.cpp:359