karm

taskview.h
1#ifndef KARM_TASK_VIEW_H
2#define KARM_TASK_VIEW_H
3
4#include <tqdict.h>
5#include <tqptrlist.h>
6#include <tqptrstack.h>
7
8#include <tdelistview.h>
9
10#include "desktoplist.h"
11#include "resourcecalendar.h"
12#include "karmstorage.h"
13#include "mainwindow.h"
14#include "reportcriteria.h"
15#include <tqtimer.h>
16//#include "desktoptracker.h"
17
18//#include "karmutility.h"
19
20class TQListBox;
21class TQString;
22class TQTextStream;
23class TQTimer;
24
25class KMenuBar;
26class TDEToolBar;
27
28class DesktopTracker;
29class EditTaskDialog;
31class Preferences;
32class Task;
33class KarmStorage;
34class HistoryEvent;
35
36using namespace KCal;
37
42class TaskView : public TDEListView
43{
44 TQ_OBJECT
45
46
47 public:
48 TaskView( TQWidget *parent = 0, const char *name = 0, const TQString &icsfile = "" );
49 virtual ~TaskView();
50
52 Task* first_child() const;
53
55 Task* current_item() const;
56
58 Task* item_at_index(int i);
59
61 void load( TQString filename="" );
62
64 void closeStorage();
65
67 void startNewSession();
68
71
73 long count();
74
76 TQValueList<HistoryEvent> getHistory(const TQDate& from, const TQDate& to) const;
77
79 void scheduleSave();
80
83
85 TQString addTask( const TQString& taskame, long total, long session, const DesktopList& desktops,
86 Task* parent = 0 );
87
88 public slots:
90 TQString save();
91
93 void startCurrentTimer();
94
96 void stopCurrentTimer();
97
99 void stopAllTimers();
100
102 void stopAllTimersAt(TQDateTime qdt);
103
105 void newTask();
106
108 void newTask( TQString caption, Task* parent );
109
111 void refresh();
112
114 void loadFromFlatFile();
115
117 TQString importPlanner( TQString fileName="" );
118
120 TQString report( const ReportCriteria &rc );
121
123 void exportcsvFile();
124
126 TQString exportcsvHistory();
127
129 void newSubTask();
130
131 void editTask();
132
143
152 void deleteTask(bool markingascomplete=false);
153
156 void reinstateTask(int completion);
157// void addCommentToTask();
158 void markTaskAsComplete();
159 void markTaskAsIncomplete();
160
165 void extractTime( int minutes );
166 void taskTotalTimesChanged( long session, long total)
167 { emit totalTimesChanged( session, total); };
168 void adaptColumns();
170 void deletingTask(Task* deletedTask);
171
176 void startTimerFor( Task* task, TQDateTime startTime = TQDateTime::currentDateTime() );
177 void stopTimerFor( Task* task );
178
182 void clearActiveTasks();
183
187 void iCalFileChanged(TQString file);
188
190 void clipTotals();
191
193 void clipSession();
194
196 void clipHistory();
197
198 signals:
199 void totalTimesChanged( long session, long total );
200 void updateButtons();
201 void timersActive();
202 void timersInactive();
203 void tasksChanged( TQPtrList<Task> activeTasks );
204 void setStatusBar( TQString );
205
206 private: // member variables
207 IdleTimeDetector *_idleTimeDetector;
208 TQTimer *_minuteTimer;
209 TQTimer *_autoSaveTimer;
210 TQTimer *_manualSaveTimer;
211 Preferences *_preferences;
212 TQPtrList<Task> activeTasks;
213 int previousColumnWidths[4];
214 DesktopTracker* _desktopTracker;
215 bool _isloading;
216
217 //KCal::CalendarLocal _calendar;
218 KarmStorage * _storage;
219
220 private:
221 void contentsMousePressEvent ( TQMouseEvent * e );
222 void contentsMouseDoubleClickEvent ( TQMouseEvent * e );
223 void updateParents( Task* task, long totalDiff, long sesssionDiff);
224 void deleteChildTasks( Task *item );
225 void addTimeToActiveTasks( int minutes, bool save_data = true );
227 void restoreItemState( TQListViewItem *item );
228
229 protected slots:
230 void autoSaveChanged( bool );
231 void autoSavePeriodChanged( int period );
232 void minuteUpdate();
234 void itemStateChanged( TQListViewItem *item );
236 void iCalFileModified(ResourceCalendar *);
237};
238
239#endif // KARM_TASK_VIEW
A utility to associate tasks with desktops As soon as a desktop is activated/left - an signal is emit...
Dialog to add a new task or edit an existing task.
One start/stop event that has been logged.
Definition: karmstorage.h:356
Keep track of how long the computer has been idle.
Singleton to store/retrieve KArm data to/from persistent storage.
Definition: karmstorage.h:68
Provide an interface to the configuration options for the program.
Definition: preferences.h:17
Stores entries from export dialog.
Container and interface for the tasks.
Definition: taskview.h:43
Preferences * preferences()
Return preferences user selected on settings dialog.
Definition: taskview.cpp:363
KarmStorage * storage()
Returns a pointer to storage object.
Definition: taskview.cpp:114
void clipTotals()
Copy totals for current and all sub tasks to clipboard.
Definition: taskview.cpp:812
void iCalFileChanged(TQString file)
User might have picked a new iCalendar file on preferences screen.
Definition: taskview.cpp:769
Task * first_child() const
Return the first item in the view, cast to a Task pointer.
Definition: taskview.cpp:172
void loadFromFlatFile()
Used to import a legacy file format.
Definition: taskview.cpp:275
long count()
Return the total number if items in the view.
Definition: taskview.cpp:379
TQString exportcsvHistory()
Export comma-separated values format for task history.
Definition: taskview.cpp:341
void iCalFileModified(ResourceCalendar *)
React on another process having modified the iCal file we rely on.
Definition: taskview.cpp:239
void stopCurrentTimer()
Stop the timer for the current item in the view.
Definition: taskview.cpp:477
void resetTimeForAllTasks()
Reset session and total time to zero for all tasks.
Definition: taskview.cpp:453
void deletingTask(Task *deletedTask)
receiving signal that a task is being deleted
Definition: taskview.cpp:759
TQString importPlanner(TQString fileName="")
used to import tasks from imendio planner
Definition: taskview.cpp:308
void refresh()
Used to refresh (e.g.
Definition: taskview.cpp:248
void startCurrentTimer()
Start the timer on the current item (task) in view.
Definition: taskview.cpp:374
void closeStorage()
Close the storage and release lock.
Definition: taskview.cpp:237
TQString addTask(const TQString &taskame, long total, long session, const DesktopList &desktops, Task *parent=0)
Add a task to view and storage.
Definition: taskview.cpp:529
void extractTime(int minutes)
Subtracts time from all active tasks, and does not log event.
Definition: taskview.cpp:704
TQString report(const ReportCriteria &rc)
call export function for csv totals or history
Definition: taskview.cpp:322
void clipSession()
Copy session times for current and all sub tasks to clipboard.
Definition: taskview.cpp:836
Task * current_item() const
Return the current item in the view, cast to a Task pointer.
Definition: taskview.cpp:177
TQString save()
Save to persistent storage.
Definition: taskview.cpp:365
void exportcsvFile()
Export comma separated values format for task time totals.
Definition: taskview.cpp:327
Task * item_at_index(int i)
Return the i'th item (zero-based), cast to a Task pointer.
Definition: taskview.cpp:182
void clearActiveTasks()
clears all active tasks.
Definition: taskview.cpp:408
void newTask()
Calls newTask dialog with caption "New Task".
Definition: taskview.cpp:493
void load(TQString filename="")
Load the view from storage.
Definition: taskview.cpp:187
void clipHistory()
Copy history for current and all sub tasks to clipboard.
Definition: taskview.cpp:860
void deleteTask(bool markingascomplete=false)
Delete task (and children) from view.
Definition: taskview.cpp:640
void startTimerFor(Task *task, TQDateTime startTime=TQDateTime::currentDateTime())
starts timer for task.
Definition: taskview.cpp:386
void newSubTask()
Calls newTask dialog with caption "New Sub Task".
Definition: taskview.cpp:555
void scheduleSave()
Schedule that we should save very soon.
Definition: taskview.cpp:356
void itemStateChanged(TQListViewItem *item)
item state stores if a task is expanded so you can see the subtasks
Definition: taskview.cpp:227
void reinstateTask(int completion)
Reinstates the current task as incomplete.
Definition: taskview.cpp:622
void stopAllTimers()
Stop all running timers.
Definition: taskview.cpp:413
void stopAllTimersAt(TQDateTime qdt)
Stop all running timers as if it was qdt.
Definition: taskview.cpp:426
TQValueList< HistoryEvent > getHistory(const TQDate &from, const TQDate &to) const
Return list of start/stop events for given date range.
Definition: taskview.cpp:782
void startNewSession()
Reset session time to zero for all tasks.
Definition: taskview.cpp:444
A class representing a task.
Definition: task.h:42