karm Library API Documentation

Task Class Reference

A class representing a task. More...

#include <task.h>

List of all members.

Signals

void totalTimesChanged (long minutesSession, long minutes)
void deletingTask (Task *thisTask)

Public Member Functions

TaskfirstChild () const
TasknextSibling () const
Taskparent () const
TaskViewtaskView () const
QString uid () const
void setUid (const QString uid)
void cut ()
void move (Task *destination)
void paste (Task *destination)
void update ()
bool parseIncidence (KCal::Incidence *, long &minutes, long &sessionMinutes, QString &name, DesktopList &desktops, int &percent_complete)
KCal::Todo * asTodo (KCal::Todo *calendar) const
void addComment (QString comment, KarmStorage *storage)
QString comment () const
bool isRoot () const
bool remove (QPtrList< Task > &activeTasks, KarmStorage *storage)
void setPercentComplete (const int percent, KarmStorage *storage)
bool isComplete ()
void removeFromView ()
 Task (const QString &taskame, long minutes, long sessionTime, DesktopList desktops, TaskView *parent=0)
 Task (const QString &taskame, long minutes, long sessionTime, DesktopList desktops, Task *parent=0)
 Task (KCal::Todo *incident, TaskView *parent)
void changeTime (long minutes, bool do_logging, KarmStorage *storage)
void changeTimes (long minutesSession, long minutes, bool do_logging, KarmStorage *storage=0)
void changeTotalTimes (long minutesSession, long minutes)
void resetTimes ()
long time () const
long totalTime () const
long sessionTime () const
long totalSessionTime () const
QDateTime startTime () const
void startNewSession ()
void setDesktopList (DesktopList dl)
DesktopList getDesktops () const
QString getDesktopStr () const
void setName (const QString &name, KarmStorage *storage)
QString name () const
QString fullName () const
void setRunning (bool on, KarmStorage *storage)
bool isRunning () const

Protected Slots

void updateActiveIcon ()

Protected Member Functions

void changeParentTotalTimes (long minutesSession, long minutes)


Detailed Description

A class representing a task.

A "Task" object stores information about a task such as it's name, total and session times.

It can log when the task is started, stoped or deleted.

If a task is associated with some desktop's activity it can remember that too.

It can also contain subtasks - these are managed using the QListViewItem class.

Definition at line 37 of file task.h.


Constructor & Destructor Documentation

Task::Task const QString &  taskame,
long  minutes,
long  sessionTime,
DesktopList  desktops,
TaskView parent = 0
 

constructors

Definition at line 24 of file task.cpp.


Member Function Documentation

Task* Task::firstChild  )  const [inline]
 

return parent Task or null in case of TaskView.

same as QListViewItem::parent()

Definition at line 55 of file task.h.

Referenced by remove(), removeFromView(), and setPercentComplete().

TaskView* Task::taskView  )  const [inline]
 

Return task view for this task.

Definition at line 60 of file task.h.

QString Task::uid  )  const [inline]
 

Return unique iCalendar Todo ID for this task.

Definition at line 65 of file task.h.

Referenced by KarmStorage::addComment(), KarmStorage::addTask(), KarmStorage::loadFromFlatFile(), TaskView::newTask(), and KarmStorage::removeTask().

void Task::setUid const QString  uid  ) 
 

Set unique id for the task.

The uid is the key used to update the storage.

Parameters:
uid The new unique id.

Definition at line 119 of file task.cpp.

Referenced by KarmStorage::loadFromFlatFile(), and TaskView::newTask().

void Task::cut  ) 
 

cut Task out of parent Task or the TaskView

Definition at line 379 of file task.cpp.

Referenced by move().

void Task::move Task destination  ) 
 

cut Task out of parent Task or the TaskView and into the destination Task

Definition at line 389 of file task.cpp.

References cut(), and paste().

void Task::paste Task destination  ) 
 

insert Task into the destination Task

Definition at line 395 of file task.cpp.

Referenced by move().

void Task::changeTime long  minutes,
bool  do_logging,
KarmStorage storage
[inline]
 

Change task time.

Adds minutes to both total time and session time.

Parameters:
minutes minutes to add to - may be negative
do_logging distinguish between time changes due to setting up task when reading from disk and changes due to a user actually changing the tasks time.
storage handles writing changes to disk

Definition at line 95 of file task.h.

References changeTimes().

void Task::changeTimes long  minutesSession,
long  minutes,
bool  do_logging,
KarmStorage storage = 0
 

Adds minutes to time and session time, and writes to storage.

If do_logging is true, then storage should be loaded with a valid storage object.

Parameters:
minutesSession minutes to add to task session time
minutes minutes to add to task time
do_logging distinguish between time changes due to setting up task when reading from disk and changes due to a user actually changing the tasks time.
storage where and how to write the change to disk

Definition at line 190 of file task.cpp.

References KarmStorage::changeTime(), and changeTotalTimes().

Referenced by changeTime(), KarmStorage::loadFromFlatFile(), and startNewSession().

void Task::changeTotalTimes long  minutesSession,
long  minutes
 

adds minutes to total and session time

Parameters:
minutesSession minutes to add to task total session time
minutes minutes to add to task total time

Definition at line 210 of file task.cpp.

References update().

Referenced by changeTimes().

void Task::resetTimes  ) 
 

Reset all times to 0.

Definition at line 223 of file task.cpp.

References update().

Referenced by TaskView::resetTimeForAllTasks().

long Task::time  )  const [inline]
 

returns the times accumulated by the task

Returns:
total time in minutes

Definition at line 129 of file task.h.

QDateTime Task::startTime  )  const [inline]
 

Return time the task was started.

Definition at line 137 of file task.h.

Referenced by KarmStorage::stopTimer().

void Task::startNewSession  )  [inline]
 

sets session time to zero.

Definition at line 140 of file task.h.

References changeTimes().

Referenced by TaskView::startNewSession().

void Task::setDesktopList DesktopList  dl  ) 
 

desktop related functions

Definition at line 185 of file task.cpp.

void Task::setName const QString &  name,
KarmStorage storage
 

sets the name of the task

Parameters:
name a pointer to the name. A deep copy will be made.

Definition at line 128 of file task.cpp.

References KarmStorage::setName(), and update().

QString Task::name  )  const [inline]
 

returns the name of this task.

Returns:
a pointer to the name.

Definition at line 161 of file task.h.

Referenced by asTodo(), TaskView::deleteTask(), fullName(), and KarmStorage::loadFromFlatFile().

QString Task::fullName  )  const
 

Returns that task name, prefixed by parent tree up to root.

Task names are seperated by a forward slash: /

Definition at line 281 of file task.cpp.

References isRoot(), and name().

void Task::update  ) 
 

Update the display of the task (all columns) in the UI.

Definition at line 401 of file task.cpp.

Referenced by changeTotalTimes(), resetTimes(), and setName().

void Task::setRunning bool  on,
KarmStorage storage
 

starts or stops a task

Parameters:
on true or false for starting or stopping a task

Definition at line 99 of file task.cpp.

References KarmStorage::startTimer(), KarmStorage::stopTimer(), and updateActiveIcon().

Referenced by remove(), and setPercentComplete().

bool Task::isRunning  )  const
 

return the state of a task - if it's running or not

Returns:
true or false depending on whether the task is running

Definition at line 123 of file task.cpp.

Referenced by remove(), and setPercentComplete().

KCal::Todo * Task::asTodo KCal::Todo *  calendar  )  const
 

Load the todo passed in with this tasks info.

Definition at line 289 of file task.cpp.

References name().

Referenced by KarmStorage::addTask().

void Task::addComment QString  comment,
KarmStorage storage
 

Add a comment to this task.

Definition at line 410 of file task.cpp.

References KarmStorage::addComment().

QString Task::comment  )  const
 

Retrieve the entire comment for the task.

Definition at line 416 of file task.cpp.

Referenced by KarmStorage::addComment().

bool Task::isRoot  )  const [inline]
 

tells you whether this task is the root of the task tree

Definition at line 202 of file task.h.

Referenced by TaskView::clipTotals(), and fullName().

bool Task::remove QPtrList< Task > &  activeTasks,
KarmStorage storage
 

remove Task with all it's children

Parameters:
activeTasks - list of aktive tasks
true if task removed sucessfully, false otherwise

Definition at line 245 of file task.cpp.

References firstChild(), isRunning(), nextSibling(), KarmStorage::removeTask(), and setRunning().

Referenced by TaskView::deleteTask().

void Task::setPercentComplete const int  percent,
KarmStorage storage
 

Update percent complete for this task.

Tasks that are complete (i.e., percent = 100) do not show up in taskview. If percent NULL, set to zero. If greater than 100, set to 100. If less than zero, set to zero.

Definition at line 140 of file task.cpp.

References firstChild(), isRunning(), nextSibling(), and setRunning().

Referenced by TaskView::deleteTask().

bool Task::isComplete  ) 
 

Return true if task is complete (percent complete equals 100).

Definition at line 176 of file task.cpp.

void Task::removeFromView  ) 
 

Remove current task and all it's children from the view.

Definition at line 178 of file task.cpp.

References firstChild(), and nextSibling().

Referenced by TaskView::deleteTask().

void Task::deletingTask Task thisTask  )  [signal]
 

signal that we're about to delete a task

void Task::updateActiveIcon  )  [protected, slot]
 

animate the active icon

Definition at line 267 of file task.cpp.

Referenced by setRunning().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for karm Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Apr 26 23:23:27 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003