• 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
taskview.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003 by Scott Monachello <smonach@cox.net>
3  * 2007 the ktimetracker developers
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 KTIMETRACKER_TASK_VIEW
24 #define KTIMETRACKER_TASK_VIEW
25 
26 
27 #include <QList>
28 #include <QTreeWidget>
29 
30 #include "desktoplist.h"
31 #include "timetrackerstorage.h"
32 #include "reportcriteria.h"
33 
34 class QMouseEvent;
35 class QString;
36 class QTableWidget;
37 class QTimer;
38 
39 class DesktopTracker;
40 class IdleTimeDetector;
41 class Preferences;
42 class Task;
43 class timetrackerstorage;
44 class HistoryEvent;
45 
50 class TaskView : public QTreeWidget
51 {
52  Q_OBJECT
53 
54  public:
55  explicit TaskView( QWidget *parent = 0 );
56  virtual ~TaskView();
57 
58  //BEGIN view specified
60  Task* currentItem() const;
61 
63  Task* itemAt( int i );
64  //END
65 
66  //BEGIN model specified
68  void load( const QString &filename );
69 
71  void closeStorage();
72 
74  void startNewSession();
75 
77  bool allEventsHaveEndTiMe();
78 
80  void resetTimeForAllTasks();
81 
83  void resetDisplayTimeForAllTasks();
84 
86  long count();
87 
89  QList<HistoryEvent> getHistory(const QDate& from, const QDate& to) const;
90 
92  void scheduleSave();
93 
95  QStringList tasks();
96 
98  Task* task( const QString& uid );
99 
101  QString addTask( const QString& taskame, const QString& taskdescription = QString(), long total = 0, long session = 0, const DesktopList& desktops = QVector<int>(0,0),
102  Task* parent = 0 );
103 
105  QList< Task* > activeTasks() const;
106  //END
107 
108  //BEGIN behavior
110  bool isFocusTrackingActive() const;
111  //END
112 
113  public Q_SLOTS:
115  void save();
116 
118  void startCurrentTimer();
119 
121  void stopCurrentTimer();
122 
127  void stopAllTimers( const QDateTime &when = QDateTime::currentDateTime() );
128 
131  void toggleFocusTracking();
132 
134  void newTask();
135 
139  void newTask( const QString &caption, Task* parent );
140 
142  void refresh();
143 
145  void importPlanner( const QString &fileName = "" );
146 
148  QString report( const ReportCriteria &rc );
149 
151  void exportcsvFile();
152 
154  QString exportcsvHistory();
155 
157  void newSubTask();
158 
160  void editTask();
161 
171  timetrackerstorage* storage();
172 
179  void deleteTaskBatch( Task* task=0 );
180 
187  void deleteTask( Task* task=0 );
188 
191  void setPerCentComplete(int completion);
192  void markTaskAsComplete();
193  void markTaskAsIncomplete();
194 
196  void subtractTime(int minutes);
197  void taskTotalTimesChanged(long session, long total)
198  { emit totalTimesChanged( session, total); }
200  void deletingTask(Task* deletedTask);
201 
206  void startTimerFor( Task* task,
207  const QDateTime &startTime = QDateTime::currentDateTime() );
208  void stopTimerFor( Task* task );
209 
213  void clearActiveTasks();
214 
216  QString clipTotals( const ReportCriteria &rc );
217 
219  QString setClipBoardText(const QString& s);
220 
222  void reconfigure();
223 
225  QString reFreshTimes();
226 
227  Q_SIGNALS:
228  void totalTimesChanged( long session, long total );
229  void reSetTimes();
230  void updateButtons();
231  void timersActive();
232  void timersInactive();
233  void tasksChanged( QList<Task*> activeTasks );
234  void setStatusBarText(QString);
235  void contextMenuRequested( const QPoint & );
236 
237  private: // member variables
238  IdleTimeDetector* _idleTimeDetector;
239  QTimer *_minuteTimer;
240  QTimer *_autoSaveTimer;
241  QTimer *_manualSaveTimer;
242  Preferences *_preferences;
243  DesktopTracker* _desktopTracker;
244  bool _isloading;
245  QTableWidget* historywidget;
246 
247  //@cond PRIVATE
248  class Private;
249  Private *const d;
250  //@endcond
251 
252  private:
253  void updateParents( Task* task, long totalDiff, long sesssionDiff);
254  void deleteChildTasks( Task *item );
255  void addTimeToActiveTasks( int minutes, bool save_data = true );
257  void restoreItemState();
258 
259  protected:
260  void mouseMoveEvent( QMouseEvent* );
261  void mousePressEvent( QMouseEvent* );
262 
263  protected Q_SLOTS:
264  void minuteUpdate();
265  void dropEvent ( QDropEvent * event );
267  void itemStateChanged( QTreeWidgetItem *item );
268 
271  void iCalFileModified();
272  void slotItemDoubleClicked( QTreeWidgetItem *item, int );
273 
275  void newFocusWindowDetected( const QString & );
276 
277  void slotColumnToggled( int );
278  void slotCustomContextMenuRequested( const QPoint & );
279  void slotSetPercentage( QAction * );
280  void slotSetPriority( QAction * );
281 };
282 
283 #endif // KTIMETRACKER_TASK_VIEW
TaskView::dropEvent
void dropEvent(QDropEvent *event)
Definition: taskview.cpp:687
TaskView::slotSetPriority
void slotSetPriority(QAction *)
Definition: taskview.cpp:1173
TaskView::taskTotalTimesChanged
void taskTotalTimesChanged(long session, long total)
Definition: taskview.h:197
TaskView::toggleFocusTracking
void toggleFocusTracking()
Toggles the automatic tracking of focused windows.
Definition: taskview.cpp:766
QTreeWidget
TaskView::editTask
void editTask()
Calls editTask dialog for the current task.
Definition: taskview.cpp:939
TaskView::importPlanner
void importPlanner(const QString &fileName="")
used to import tasks from imendio planner
Definition: taskview.cpp:602
TaskView::reSetTimes
void reSetTimes()
TaskView::newFocusWindowDetected
void newFocusWindowDetected(const QString &)
React on the focus having changed to Window QString.
Definition: taskview.cpp:275
TaskView::itemAt
Task * itemAt(int i)
Return the i'th item (zero-based), cast to a Task pointer.
Definition: taskview.cpp:405
QWidget
TaskView::count
long count()
Return the total number of items in the view.
Definition: taskview.cpp:653
TaskView::startTimerFor
void startTimerFor(Task *task, const QDateTime &startTime=QDateTime::currentDateTime())
starts timer for task.
Definition: taskview.cpp:721
TaskView::setClipBoardText
QString setClipBoardText(const QString &s)
Set the text of the application's clipboard.
Definition: taskview.cpp:1090
TaskView::reFreshTimes
QString reFreshTimes()
Refresh the times of the tasks, e.g.
Definition: taskview.cpp:548
IdleTimeDetector
Keep track of how long the computer has been idle.
Definition: idletimedetector.h:47
TaskView::updateButtons
void updateButtons()
TaskView::scheduleSave
void scheduleSave()
Schedule that we should save very soon.
Definition: taskview.cpp:693
TaskView::TaskView
TaskView(QWidget *parent=0)
Definition: taskview.cpp:163
TaskView::clipTotals
QString clipTotals(const ReportCriteria &rc)
Copy totals for current and all sub tasks to clipboard.
Definition: taskview.cpp:1079
TaskView::task
Task * task(const QString &uid)
return the task with the given UID
Definition: taskview.cpp:677
TaskView::stopCurrentTimer
void stopCurrentTimer()
Stop the timer for the current item in the view.
Definition: taskview.cpp:845
TaskView::subtractTime
void subtractTime(int minutes)
Subtracts time from all active tasks, and does not log event.
Definition: taskview.cpp:1058
TaskView::iCalFileModified
void iCalFileModified()
React on another process having modified the iCal file we rely on.
Definition: taskview.cpp:513
desktoplist.h
TaskView::timersActive
void timersActive()
TaskView::~TaskView
virtual ~TaskView()
Definition: taskview.cpp:392
TaskView::markTaskAsIncomplete
void markTaskAsIncomplete()
Definition: taskview.cpp:1074
reportcriteria.h
TaskView::slotCustomContextMenuRequested
void slotCustomContextMenuRequested(const QPoint &)
Definition: taskview.cpp:1143
TaskView::markTaskAsComplete
void markTaskAsComplete()
Definition: taskview.cpp:1045
TaskView::activeTasks
QList< Task * > activeTasks() const
Returns a list of the current active tasks.
Definition: taskview.cpp:1186
TaskView::clearActiveTasks
void clearActiveTasks()
clears all active tasks.
Definition: taskview.cpp:740
TaskView::slotColumnToggled
void slotColumnToggled(int)
Definition: taskview.cpp:1117
TaskView::tasksChanged
void tasksChanged(QList< Task * > activeTasks)
TaskView::newTask
void newTask()
Calls newTask dialog with caption "New Task".
Definition: taskview.cpp:865
TaskView::startNewSession
void startNewSession()
Reset session time to zero for all tasks.
Definition: taskview.cpp:783
TaskView::setStatusBarText
void setStatusBarText(QString)
TaskView::slotItemDoubleClicked
void slotItemDoubleClicked(QTreeWidgetItem *item, int)
Definition: taskview.cpp:1097
TaskView::refresh
void refresh()
Used to refresh (e.g.
Definition: taskview.cpp:526
TaskView::startCurrentTimer
void startCurrentTimer()
Start the timer on the current item (task) in view.
Definition: taskview.cpp:716
TaskView::minuteUpdate
void minuteUpdate()
Definition: taskview.cpp:854
TaskView::allEventsHaveEndTiMe
bool allEventsHaveEndTiMe()
Deliver if all events from the storage have and end time.
Definition: taskview.cpp:508
TaskView::mousePressEvent
void mousePressEvent(QMouseEvent *)
Definition: taskview.cpp:351
TaskView::setPerCentComplete
void setPerCentComplete(int completion)
Sets % completed for the current task.
Definition: taskview.cpp:981
TaskView::exportcsvFile
void exportcsvFile()
Export comma separated values format for task time totals.
Definition: taskview.cpp:622
TaskView::closeStorage
void closeStorage()
Close the storage and release lock.
Definition: taskview.cpp:503
ReportCriteria
Stores entries from export dialog.
Definition: reportcriteria.h:41
TaskView::timersInactive
void timersInactive()
TaskView::storage
timetrackerstorage * storage()
Returns a pointer to storage object.
Definition: taskview.cpp:387
TaskView::deleteTask
void deleteTask(Task *task=0)
Deletes the given or the current task (and children) from the view.
Definition: taskview.cpp:1018
TaskView::stopTimerFor
void stopTimerFor(Task *task)
Definition: taskview.cpp:828
TaskView::slotSetPercentage
void slotSetPercentage(QAction *)
Definition: taskview.cpp:1164
TaskView::isFocusTrackingActive
bool isFocusTrackingActive() const
Returns whether the focus tracking is currently active.
Definition: taskview.cpp:1181
QTreeWidgetItem
TaskView::tasks
QStringList tasks()
return all task names, e.g.
Definition: taskview.cpp:665
TaskView::deleteTaskBatch
void deleteTaskBatch(Task *task=0)
Deletes the given or the current task (and children) from the view.
Definition: taskview.cpp:1000
TaskView::resetDisplayTimeForAllTasks
void resetDisplayTimeForAllTasks()
Reset session and total time for all tasks - do not touch the storage.
Definition: taskview.cpp:814
TaskView::getHistory
QList< HistoryEvent > getHistory(const QDate &from, const QDate &to) const
Return list of start/stop events for given date range.
DesktopList
QVector< int > DesktopList
Definition: desktoplist.h:28
TaskView::totalTimesChanged
void totalTimesChanged(long session, long total)
TaskView::reconfigure
void reconfigure()
Reconfigures taskView depending on current configuration.
Definition: taskview.cpp:1191
TaskView::load
void load(const QString &filename)
Load the view from storage.
Definition: taskview.cpp:422
TaskView::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *)
Definition: taskview.cpp:316
HistoryEvent
One start/stop event that has been logged.
Definition: timetrackerstorage.h:344
TaskView::report
QString report(const ReportCriteria &rc)
call export function for csv totals or history
Definition: taskview.cpp:617
DesktopTracker
A utility to associate tasks with desktops As soon as a desktop is activated/left - an signal is emit...
Definition: desktoptracker.h:42
TaskView::save
void save()
Save to persistent storage.
Definition: taskview.cpp:698
TaskView::stopAllTimers
void stopAllTimers(const QDateTime &when=QDateTime::currentDateTime())
Stop all running timers.
Definition: taskview.cpp:745
TaskView::newSubTask
void newSubTask()
Calls newTask dialog with caption "New Sub Task".
Definition: taskview.cpp:929
Preferences
Provide an interface to the configuration options for the program.
Definition: preferences.h:31
TaskView::deletingTask
void deletingTask(Task *deletedTask)
receiving signal that a task is being deleted
Definition: taskview.cpp:1063
TaskView::contextMenuRequested
void contextMenuRequested(const QPoint &)
TaskView::itemStateChanged
void itemStateChanged(QTreeWidgetItem *item)
item state stores if a task is expanded so you can see the subtasks
Definition: taskview.cpp:494
TaskView
Container and interface for the tasks.
Definition: taskview.h:50
Task
A class representing a task.
Definition: task.h:54
TaskView::exportcsvHistory
QString exportcsvHistory()
Export comma-separated values format for task history.
Definition: taskview.cpp:637
timetrackerstorage.h
TaskView::currentItem
Task * currentItem() const
Return the current item in the view, cast to a Task pointer.
Definition: taskview.cpp:399
timetrackerstorage
Class to store/retrieve KTimeTracker data to/from persistent storage.
Definition: timetrackerstorage.h:57
TaskView::resetTimeForAllTasks
void resetTimeForAllTasks()
Reset session and total time to zero for all tasks.
Definition: taskview.cpp:799
TaskView::addTask
QString addTask(const QString &taskame, const QString &taskdescription=QString(), long total=0, long session=0, const DesktopList &desktops=QVector< int >(0, 0), Task *parent=0)
Add a task to view and storage.
Definition: taskview.cpp:902
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