karm
taskview.h00001 #ifndef KARM_TASK_VIEW_H
00002 #define KARM_TASK_VIEW_H
00003
00004 #include <qdict.h>
00005 #include <qptrlist.h>
00006 #include <qptrstack.h>
00007
00008 #include <klistview.h>
00009
00010 #include "desktoplist.h"
00011 #include "resourcecalendar.h"
00012 #include "karmstorage.h"
00013 #include "reportcriteria.h"
00014 #include <qtimer.h>
00015
00016
00017
00018
00019 class QListBox;
00020 class QString;
00021 class QTextStream;
00022 class QTimer;
00023
00024 class KMenuBar;
00025 class KToolBar;
00026
00027 class DesktopTracker;
00028 class EditTaskDialog;
00029 class IdleTimeDetector;
00030 class Preferences;
00031 class Task;
00032 class KarmStorage;
00033 class HistoryEvent;
00034
00035 using namespace KCal;
00036
00041 class TaskView : public KListView
00042 {
00043 Q_OBJECT
00044
00045 public:
00046 TaskView( QWidget *parent = 0, const char *name = 0, const QString &icsfile = "" );
00047 virtual ~TaskView();
00048
00050 Task* first_child() const;
00051
00053 Task* current_item() const;
00054
00056 Task* item_at_index(int i);
00057
00059 void load( QString filename="" );
00060
00062 void closeStorage();
00063
00065 void startNewSession();
00066
00068 void resetTimeForAllTasks();
00069
00071 long count();
00072
00074 QValueList<HistoryEvent> getHistory(const QDate& from, const QDate& to) const;
00075
00077 void scheduleSave();
00078
00080 Preferences *preferences();
00081
00083 QString addTask( const QString& taskame, long total, long session, const DesktopList& desktops,
00084 Task* parent = 0 );
00085
00086 public slots:
00088 QString save();
00089
00091 void startCurrentTimer();
00092
00094 void stopCurrentTimer();
00095
00097 void stopAllTimers();
00098
00100 void newTask();
00101
00103 void newTask( QString caption, Task* parent );
00104
00106 void refresh();
00107
00109 void loadFromFlatFile();
00110
00112 QString importPlanner( QString fileName="" );
00113
00115 QString report( const ReportCriteria &rc );
00116
00118 void exportcsvFile();
00119
00121 QString exportcsvHistory();
00122
00124 void newSubTask();
00125
00126 void editTask();
00127
00137 KarmStorage* storage();
00138
00147 void deleteTask(bool markingascomplete=false);
00148
00151 void reinstateTask(int completion);
00152
00153 void markTaskAsComplete();
00154 void markTaskAsIncomplete();
00155
00157 void extractTime( int minutes );
00158 void taskTotalTimesChanged( long session, long total)
00159 { emit totalTimesChanged( session, total); };
00160 void adaptColumns();
00162 void deletingTask(Task* deletedTask);
00163
00168 void startTimerFor( Task* task, QDateTime startTime = QDateTime::currentDateTime() );
00169 void stopTimerFor( Task* task );
00170
00174 void clearActiveTasks();
00175
00177 void iCalFileChanged(QString file);
00178
00180 void clipTotals();
00181
00183 void clipHistory();
00184
00185 signals:
00186 void totalTimesChanged( long session, long total );
00187 void updateButtons();
00188 void timersActive();
00189 void timersInactive();
00190 void tasksChanged( QPtrList<Task> activeTasks );
00191
00192 private:
00193 IdleTimeDetector *_idleTimeDetector;
00194 QTimer *_minuteTimer;
00195 QTimer *_autoSaveTimer;
00196 QTimer *_manualSaveTimer;
00197 Preferences *_preferences;
00198 QPtrList<Task> activeTasks;
00199 int previousColumnWidths[4];
00200 DesktopTracker* _desktopTracker;
00201 bool _isloading;
00202
00203
00204 KarmStorage * _storage;
00205
00206 private:
00207 void contentsMousePressEvent ( QMouseEvent * e );
00208 void contentsMouseDoubleClickEvent ( QMouseEvent * e );
00209 void updateParents( Task* task, long totalDiff, long sesssionDiff);
00210 void deleteChildTasks( Task *item );
00211 void addTimeToActiveTasks( int minutes, bool save_data = true );
00213 void restoreItemState( QListViewItem *item );
00214
00215 protected slots:
00216 void autoSaveChanged( bool );
00217 void autoSavePeriodChanged( int period );
00218 void minuteUpdate();
00220 void itemStateChanged( QListViewItem *item );
00221 void iCalFileModified(ResourceCalendar *);
00222 };
00223
00224 #endif // KARM_TASK_VIEW
|