• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

ktimetracker

  • sources
  • kde-4.12
  • kdepim
  • ktimetracker
task.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1997 by Stephan Kulow <coolo@kde.org>
3  *
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.
8  *
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.
13  *
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.
19  *
20  */
21 
22 #ifndef KTIMETRACKER_TASK_H
23 #define KTIMETRACKER_TASK_H
24 
25 #include "desktoplist.h" // Required b/c DesktopList is a typedef not a class.
26 #include "taskview.h" // Required b/c of static cast below.
27 
28 #include <KCalCore/Todo>
29 
30 #include <QDateTime>
31 #include <QPixmap>
32 #include <QVector>
33 
34 class QObject;
35 class QPixmap;
36 class QString;
37 
38 class timetrackerstorage;
39 
40 
54 class Task : public QObject, public QTreeWidgetItem
55 {
56 Q_OBJECT
57 
58 public:
59  Task( const QString& taskname, const QString& taskdescription, long minutes, long sessionTime,
60  DesktopList desktops, TaskView* parent = 0, bool konsolemode=false );
61  Task( const QString& taskname, const QString& taskdescription, long minutes, long sessionTime,
62  DesktopList desktops, Task* parent = 0);
63  Task( const KCalCore::Todo::Ptr &incident, TaskView* parent, bool konsolemode=false );
64 
65  /* destructor */
66  ~Task();
67 
71  Task* parent() const { return (Task*)QTreeWidgetItem::parent(); }
72 
74  TaskView* taskView() const
75  { return static_cast<TaskView *>( treeWidget() ); }
76 
78  QString uid() const;
79 
80  int depth();
81 
82  void delete_recursive();
83 
91  void setUid( const QString &uid );
92 
94  void cut();
95 
98  void move(Task* destination);
99 
101  void paste(Task* destination);
102 
104 
112  void changeTime( long minutes, timetrackerstorage* storage );
113 
122  void changeTimes
123  ( long minutesSession, long minutes, timetrackerstorage* storage=0 );
124 
130  void changeTotalTimes( long minutesSession, long minutes );
131 
138  QString addTime( long minutes );
139 
146  QString addTotalTime( long minutes );
147 
154  QString addSessionTime( long minutes );
155 
162  QString addTotalSessionTime( long minutes );
163 
169  QString setTime( long minutes );
170 
174  void setTotalTime( long minutes ) { mTotalTime=minutes; };
175 
179  void setTotalSessionTime( long minutes ) { mTotalSessionTime=minutes; };
180 
182  QString recalculatetotaltime();
183 
185  QString recalculatetotalsessiontime();
186 
196  QString setSessionTime( long minutes );
197 
201  void resetTimes();
202 
204  long time() const { return mTime; };
206  long totalTime() const { return mTotalTime; };
207  long sessionTime() const { return mSessionTime; };
208  long totalSessionTime() const { return mTotalSessionTime; };
209  KDateTime sessionStartTiMe() const;
210 
214  QDateTime startTime() const;
215 
217  void startNewSession();
219 
221 
222  void setDesktopList ( DesktopList dl );
223  DesktopList desktops() const;
224 
225  QString getDesktopStr() const;
227 
229 
234  void setName( const QString& name, timetrackerstorage* storage );
235 
238  void setDescription( const QString& description);
239 
243  QString name() const;
244 
248  QString description() const;
249 
255  QString fullName() const;
257 
259  void update();
260 
262 
271  void setRunning( bool on, timetrackerstorage* storage,
272  const QDateTime &when = QDateTime::currentDateTime() );
273 
277  void resumeRunning();
278 
282  bool isRunning() const;
284 
290  bool parseIncidence( const KCalCore::Incidence::Ptr &, long& minutes,
291  long& sessionMinutes, QString& sessionStartTiMe, QString& name, QString& description, DesktopList& desktops,
292  int& percent_complete, int& priority );
293 
297  KCalCore::Todo::Ptr asTodo(const KCalCore::Todo::Ptr &calendar) const;
298 
303  void setDescription( QString desc, timetrackerstorage* storage );
304 
309  void addComment( const QString &comment, timetrackerstorage* storage );
310 
312  QString comment() const;
313 
315  bool isRoot() const { return parent() == 0; }
316 
320  bool remove( timetrackerstorage* storage );
321 
329  void setPercentComplete(const int percent, timetrackerstorage *storage);
330 
331  int percentComplete() const;
332 
338  void setPriority( int priority );
339 
340  int priority() const;
341 
344  void setPixmapProgress();
345 
347  bool isComplete();
348 
349  protected:
350  void changeParentTotalTimes( long minutesSession, long minutes );
351 
352  Q_SIGNALS:
353  void totalTimesChanged( long minutesSession, long minutes);
355  void deletingTask(Task* thisTask);
356 
357  protected Q_SLOTS:
359  void updateActiveIcon();
360 
361  private:
362 
364  void noNegativeTimes();
365 
367  void init( const QString& taskname, const QString& taskdescription, long minutes, long sessionTime, QString sessionStartTiMe,
368  DesktopList desktops, int percent_complete, int priority, bool konsolemode=false );
369 
370  static QVector<QPixmap*> *icons;
371 
373  QString mUid;
374 
376  QString mComment;
377 
378  int mPercentComplete;
379 
381  QString mName;
382 
384  QString mDescription;
385 
387  QDateTime mLastStart;
388 
390  long mTotalTime;
391  long mTotalSessionTime;
392 
394  long mTime;
395  long mSessionTime;
396 
398  KDateTime mSessionStartTiMe;
399 
400  DesktopList mDesktops;
401  QTimer *mTimer;
402  int mCurrentPic;
403 
405  bool mRemoving;
406 
408  int mPriority;
409 };
410 
411 #endif // KTIMETRACKER_TASK_H
Task::setPercentComplete
void setPercentComplete(const int percent, timetrackerstorage *storage)
Update percent complete for this task.
Definition: task.cpp:238
Task::Task
Task(const QString &taskname, const QString &taskdescription, long minutes, long sessionTime, DesktopList desktops, TaskView *parent=0, bool konsolemode=false)
Definition: task.cpp:42
Task::taskView
TaskView * taskView() const
Return task view for this task.
Definition: task.h:74
Task::totalSessionTime
long totalSessionTime() const
Definition: task.h:208
Task::parseIncidence
bool parseIncidence(const KCalCore::Incidence::Ptr &, long &minutes, long &sessionMinutes, QString &sessionStartTiMe, QString &name, QString &description, DesktopList &desktops, int &percent_complete, int &priority)
Parses an incidence.
Definition: task.cpp:513
Task::name
QString name() const
returns the name of this task.
Definition: task.cpp:680
Task::startNewSession
void startNewSession()
sets session time to zero.
Definition: task.cpp:653
Task::sessionStartTiMe
KDateTime sessionStartTiMe() const
Definition: task.cpp:695
Task::updateActiveIcon
void updateActiveIcon()
animate the active icon
Definition: task.cpp:466
Task::isRoot
bool isRoot() const
tells you whether this task is the root of the task tree
Definition: task.h:315
Task::setRunning
void setRunning(bool on, timetrackerstorage *storage, const QDateTime &when=QDateTime::currentDateTime())
starts or stops a task
Definition: task.cpp:159
Task::update
void update()
Update the display of the task (all columns) in the UI.
Definition: task.cpp:632
Task::changeParentTotalTimes
void changeParentTotalTimes(long minutesSession, long minutes)
Definition: task.cpp:436
QObject
Task::setTotalTime
void setTotalTime(long minutes)
Sets the total time, does not change the parent's total time.
Definition: task.h:174
Task::changeTotalTimes
void changeTotalTimes(long minutesSession, long minutes)
adds minutes to total and session time by adding an event
Definition: task.cpp:412
Task::isComplete
bool isComplete()
Return true if task is complete (percent complete equals 100).
Definition: task.cpp:304
Task::setSessionTime
QString setSessionTime(long minutes)
Sets the session time.
Definition: task.cpp:383
desktoplist.h
Task::totalTimesChanged
void totalTimesChanged(long minutesSession, long minutes)
Task::setName
void setName(const QString &name, timetrackerstorage *storage)
sets the name of the task
Definition: task.cpp:213
taskview.h
Task::resetTimes
void resetTimes()
Reset all times to 0 and adjust parent task's totalTiMes.
Definition: task.cpp:424
Task::setTime
QString setTime(long minutes)
Sets the time (not session time).
Definition: task.cpp:351
Task::comment
QString comment() const
Retrieve the entire comment for the task.
Definition: task.cpp:665
Task::changeTimes
void changeTimes(long minutesSession, long minutes, timetrackerstorage *storage=0)
Add minutes to time and session time by adding an event, and write to storage.
Definition: task.cpp:393
Task::setTotalSessionTime
void setTotalSessionTime(long minutes)
Sets the total session time, does not change the parent's total session time.
Definition: task.h:179
Task::depth
int depth()
Definition: task.cpp:73
Task::delete_recursive
void delete_recursive()
Definition: task.cpp:149
Task::addTotalSessionTime
QString addTotalSessionTime(long minutes)
Adds minutes to the task's and its supertasks' total session time.
Definition: task.cpp:341
Task::uid
QString uid() const
Return unique iCalendar Todo ID for this task.
Definition: task.cpp:660
Task::resumeRunning
void resumeRunning()
Resume the running state of a task.
Definition: task.cpp:189
Task::isRunning
bool isRunning() const
return the state of a task - if it's running or not
Definition: task.cpp:208
Task::sessionTime
long sessionTime() const
Definition: task.h:207
Task::addTime
QString addTime(long minutes)
Adds minutes to the time of the task and the total time of its supertasks.
Definition: task.cpp:311
Task::addSessionTime
QString addSessionTime(long minutes)
Adds minutes to the task's session time and its supertasks' total session time.
Definition: task.cpp:331
QTreeWidgetItem
Task::getDesktopStr
QString getDesktopStr() const
Definition: task.cpp:586
Task::description
QString description() const
returns the description of this task.
Definition: task.cpp:685
Task::setDesktopList
void setDesktopList(DesktopList dl)
Definition: task.cpp:306
Task::addComment
void addComment(const QString &comment, timetrackerstorage *storage)
Add a comment to this task.
Definition: task.cpp:647
Task::changeTime
void changeTime(long minutes, timetrackerstorage *storage)
Change task time.
Definition: task.cpp:407
DesktopList
QVector< int > DesktopList
Definition: desktoplist.h:28
Task::percentComplete
int percentComplete() const
Definition: task.cpp:670
Task::setUid
void setUid(const QString &uid)
Set unique id for the task.
Definition: task.cpp:203
Task::addTotalTime
QString addTotalTime(long minutes)
Adds minutes to the total time of the task and its supertasks.
Definition: task.cpp:321
Task::cut
void cut()
cut Task out of parent Task or the TaskView
Definition: task.cpp:602
Task::priority
int priority() const
Definition: task.cpp:675
Task::parent
Task * parent() const
return parent Task or null in case of TaskView.
Definition: task.h:71
Task::desktops
DesktopList desktops() const
Definition: task.cpp:700
Task::~Task
~Task()
Definition: task.cpp:143
Task::recalculatetotalsessiontime
QString recalculatetotalsessiontime()
A recursive function to calculate the total session time of a task.
Definition: task.cpp:372
Task::paste
void paste(Task *destination)
insert Task into the destination Task
Definition: task.cpp:614
Task::move
void move(Task *destination)
cut Task out of parent Task or the TaskView and into the destination Task
Definition: task.cpp:623
Task::setPriority
void setPriority(int priority)
Update priority for this task.
Definition: task.cpp:269
Task::fullName
QString fullName() const
Returns that task name, prefixed by parent tree up to root.
Definition: task.cpp:472
Task::setPixmapProgress
void setPixmapProgress()
Sets an appropriate icon for this task based on its level of completion.
Definition: task.cpp:284
TaskView
Container and interface for the tasks.
Definition: taskview.h:50
Task
A class representing a task.
Definition: task.h:54
Task::asTodo
KCalCore::Todo::Ptr asTodo(const KCalCore::Todo::Ptr &calendar) const
Load the todo passed in with this tasks info.
Definition: task.cpp:480
Task::recalculatetotaltime
QString recalculatetotaltime()
A recursive function to calculate the total time of a task.
Definition: task.cpp:361
Task::startTime
QDateTime startTime() const
Return time the task was started.
Definition: task.cpp:690
Task::deletingTask
void deletingTask(Task *thisTask)
signal that we're about to delete a task
Task::time
long time() const
Definition: task.h:204
timetrackerstorage
Class to store/retrieve KTimeTracker data to/from persistent storage.
Definition: timetrackerstorage.h:57
Task::totalTime
long totalTime() const
Definition: task.h:206
Task::setDescription
void setDescription(const QString &description)
sets the description of the task
Definition: task.cpp:226
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktimetracker

Skip menu "ktimetracker"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal