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 
20 class TQListBox;
21 class TQString;
22 class TQTextStream;
23 class TQTimer;
24 
25 class KMenuBar;
26 class TDEToolBar;
27 
28 class DesktopTracker;
29 class EditTaskDialog;
30 class IdleTimeDetector;
31 class Preferences;
32 class Task;
33 class KarmStorage;
34 class HistoryEvent;
35 
36 using namespace KCal;
37 
42 class 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 
70  void resetTimeForAllTasks();
71 
73  long count();
74 
76  TQValueList<HistoryEvent> getHistory(const TQDate& from, const TQDate& to) const;
77 
79  void scheduleSave();
80 
82  Preferences *preferences();
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 
142  KarmStorage* storage();
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
A class representing a task.
Definition: task.h:42