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 resetTimeCurrentTask();
106 
108  void newTask();
109 
111  void newTask( TQString caption, Task* parent );
112 
114  void refresh();
115 
117  void loadFromFlatFile();
118 
120  TQString importPlanner( TQString fileName="" );
121 
123  TQString report( const ReportCriteria &rc );
124 
126  void exportcsvFile();
127 
129  TQString exportcsvHistory();
130 
132  void newSubTask();
133 
134  void editTask();
135 
145  KarmStorage* storage();
146 
155  void deleteTask(bool markingascomplete=false);
156 
159  void reinstateTask(int completion);
160 // void addCommentToTask();
161  void markTaskAsComplete();
162  void markTaskAsIncomplete();
163 
168  void extractTime( int minutes );
169  void taskTotalTimesChanged( long session, long total)
170  { emit totalTimesChanged( session, total); };
171  void adaptColumns();
173  void deletingTask(Task* deletedTask);
174 
179  void startTimerFor( Task* task, TQDateTime startTime = TQDateTime::currentDateTime() );
180  void stopTimerFor( Task* task );
181 
185  void clearActiveTasks();
186 
190  void iCalFileChanged(TQString file);
191 
193  void clipTotals();
194 
196  void clipSession();
197 
199  void clipHistory();
200 
201  signals:
202  void totalTimesChanged( long session, long total );
203  void updateButtons();
204  void timersActive();
205  void timersInactive();
206  void tasksChanged( TQPtrList<Task> activeTasks );
207  void setStatusBar( TQString );
208 
209  private: // member variables
210  IdleTimeDetector *_idleTimeDetector;
211  TQTimer *_minuteTimer;
212  TQTimer *_autoSaveTimer;
213  TQTimer *_manualSaveTimer;
214  Preferences *_preferences;
215  TQPtrList<Task> activeTasks;
216  int previousColumnWidths[4];
217  DesktopTracker* _desktopTracker;
218  bool _isloading;
219 
220  //KCal::CalendarLocal _calendar;
221  KarmStorage * _storage;
222 
223  private:
224  void contentsMousePressEvent ( TQMouseEvent * e );
225  void contentsMouseDoubleClickEvent ( TQMouseEvent * e );
226  void updateParents( Task* task, long totalDiff, long sesssionDiff);
227  void deleteChildTasks( Task *item );
228  void addTimeToActiveTasks( int minutes, bool save_data = true );
230  void restoreItemState( TQListViewItem *item );
231 
232  protected slots:
233  void autoSaveChanged( bool );
234  void autoSavePeriodChanged( int period );
235  void minuteUpdate();
237  void itemStateChanged( TQListViewItem *item );
239  void iCalFileModified(ResourceCalendar *);
240 };
241 
242 #endif // KARM_TASK_VIEW
Keep track of how long the computer has been idle.
Singleton to store/retrieve KArm data to/from persistent storage.
Definition: karmstorage.h:67
Stores entries from export dialog.
Dialog to add a new task or edit an existing task.
One start/stop event that has been logged.
Definition: karmstorage.h:355
A utility to associate tasks with desktops As soon as a desktop is activated/left - an signal is emit...
Provide an interface to the configuration options for the program.
Definition: preferences.h:16
Container and interface for the tasks.
Definition: taskview.h:42
A class representing a task.
Definition: task.h:41