8 #include <tqptrvector.h>
10 #include <tqdatetime.h>
13 #include "desktoplist.h"
41 class Task :
public TQObject,
public TQListViewItem
48 Task(
const TQString& taskame,
long minutes,
long sessionTime,
49 DesktopList desktops,
TaskView* parent = 0);
50 Task(
const TQString& taskame,
long minutes,
long sessionTime,
51 DesktopList desktops,
Task* parent = 0);
61 Task* nextSibling()
const {
return (
Task*)TQListViewItem::nextSibling(); }
62 Task* parent()
const {
return (
Task*)TQListViewItem::parent(); }
66 return static_cast<TaskView *
>( listView() );
70 TQString
uid()
const {
return _uid; }
90 int compare ( TQListViewItem * i,
int col,
bool ascending )
const;
112 (
long minutesSession,
long minutes,
KarmStorage* storage=0);
129 long time()
const {
return _time; };
130 long totalTime()
const {
return _totalTime; };
131 long sessionTime()
const {
return _sessionTime; };
132 long totalSessionTime()
const {
return _totalSessionTime; };
145 void setDesktopList ( DesktopList dl );
146 DesktopList getDesktops()
const {
return _desktops;}
148 TQString getDesktopStr()
const;
162 TQString
name()
const {
return _name; };
185 void setRunning(
bool on,
KarmStorage* storage, TQDateTime whenStarted=TQDateTime::currentDateTime(), TQDateTime whenStopped=TQDateTime::currentDateTime());
193 bool parseIncidence(KCal::Incidence*,
long& minutes,
194 long& sessionMinutes, TQString&
name, DesktopList& desktops,
195 int& percent_complete);
200 KCal::Todo*
asTodo(KCal::Todo* calendar)
const;
209 bool isRoot()
const {
return parent() == 0; }
241 void changeParentTotalTimes(
long minutesSession,
long minutes );
244 void totalTimesChanged(
long minutesSession,
long minutes);
260 int _percentcomplete;
262 long totalTimeInSeconds()
const {
return _totalTime * 60; }
265 void noNegativeTimes();
268 void init(
const TQString& taskame,
long minutes,
long sessionTime,
269 DesktopList desktops,
int percent_complete);
276 TQDateTime _lastStart;
280 long _totalSessionTime;
287 DesktopList _desktops;
290 static TQPtrVector<TQPixmap> *icons;
297 #endif // KARM_TASK_H
void changeTotalTimes(long minutesSession, long minutes)
adds minutes to total and session time
void setPercentComplete(const int percent, KarmStorage *storage)
Update percent complete for this task.
bool isComplete()
Return true if task is complete (percent complete equals 100).
void startNewSession()
sets session time to zero.
bool isRoot() const
tells you whether this task is the root of the task tree
bool isRunning() const
return the state of a task - if it's running or not
KCal::Todo * asTodo(KCal::Todo *calendar) const
Load the todo passed in with this tasks info.
Singleton to store/retrieve KArm data to/from persistent storage.
TQDateTime startTime() const
Return time the task was started.
void setUid(const TQString uid)
Set unique id for the task.
TQString comment() const
Retrieve the entire comment for the task.
TQString name() const
returns the name of this task.
Container and interface for the tasks.
void deletingTask(Task *thisTask)
signal that we're about to delete a task
A class representing a task.
Task * firstChild() const
return parent Task or null in case of TaskView.
void move(Task *destination)
cut Task out of parent Task or the TaskView and into the destination Task
void updateActiveIcon()
animate the active icon
void resetTimes()
Reset all times to 0.
void removeFromView()
Remove current task and all it's children from the view.
void addComment(TQString comment, KarmStorage *storage)
Add a comment to this task.
void setRunning(bool on, KarmStorage *storage, TQDateTime whenStarted=TQDateTime::currentDateTime(), TQDateTime whenStopped=TQDateTime::currentDateTime())
starts or stops a task
TQString uid() const
Return unique iCalendar Todo ID for this task.
void paste(Task *destination)
insert Task into the destination Task
void cut()
cut Task out of parent Task or the TaskView
int compare(TQListViewItem *i, int col, bool ascending) const
Sort times numerically, not alphabetically.
TQString fullName() const
Returns that task name, prefixed by parent tree up to root.
void setName(const TQString &name, KarmStorage *storage)
sets the name of the task
bool remove(TQPtrList< Task > &activeTasks, KarmStorage *storage)
remove Task with all it's children
TQDateTime lastStart()
delivers when the task was started last
void changeTimes(long minutesSession, long minutes, KarmStorage *storage=0)
Add minutes to time and session time, and write to storage.
void setPixmapProgress()
Sets an appropriate icon for this task based on its level of completion.
TaskView * taskView() const
Return task view for this task.
void changeTime(long minutes, KarmStorage *storage)
Change task time.
void update()
Update the display of the task (all columns) in the UI.