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 "mainwindow.h"
00014 #include "reportcriteria.h"
00015 #include <qtimer.h>
00016
00017
00018
00019
00020 class QListBox;
00021 class QString;
00022 class QTextStream;
00023 class QTimer;
00024
00025 class KMenuBar;
00026 class KToolBar;
00027
00028 class DesktopTracker;
00029 class EditTaskDialog;
00030 class IdleTimeDetector;
00031 class Preferences;
00032 class Task;
00033 class KarmStorage;
00034 class HistoryEvent;
00035
00036 using namespace KCal;
00037
00042 class TaskView : public KListView
00043 {
00044 Q_OBJECT
00045
00046 public:
00047 TaskView( QWidget *parent = 0, const char *name = 0, const QString &icsfile = "" );
00048 virtual ~TaskView();
00049
00051 Task* first_child() const;
00052
00054 Task* current_item() const;
00055
00057 Task* item_at_index(int i);
00058
00060 void load( QString filename="" );
00061
00063 void closeStorage();
00064
00066 void startNewSession();
00067
00069 void resetTimeForAllTasks();
00070
00072 long count();
00073
00075 QValueList<HistoryEvent> getHistory(const QDate& from, const QDate& to) const;
00076
00078 void scheduleSave();
00079
00081 Preferences *preferences();
00082
00084 QString addTask( const QString& taskame, long total, long session, const DesktopList& desktops,
00085 Task* parent = 0 );
00086
00087 public slots:
00089 QString save();
00090
00092 void startCurrentTimer();
00093
00095 void stopCurrentTimer();
00096
00098 void stopAllTimers();
00099
00101 void stopAllTimersAt(QDateTime qdt);
00102
00104 void newTask();
00105
00107 void newTask( QString caption, Task* parent );
00108
00110 void refresh();
00111
00113 void loadFromFlatFile();
00114
00116 QString importPlanner( QString fileName="" );
00117
00119 QString report( const ReportCriteria &rc );
00120
00122 void exportcsvFile();
00123
00125 QString exportcsvHistory();
00126
00128 void newSubTask();
00129
00130 void editTask();
00131
00141 KarmStorage* storage();
00142
00151 void deleteTask(bool markingascomplete=false);
00152
00155 void reinstateTask(int completion);
00156
00157 void markTaskAsComplete();
00158 void markTaskAsIncomplete();
00159
00164 void extractTime( int minutes );
00165 void taskTotalTimesChanged( long session, long total)
00166 { emit totalTimesChanged( session, total); };
00167 void adaptColumns();
00169 void deletingTask(Task* deletedTask);
00170
00175 void startTimerFor( Task* task, QDateTime startTime = QDateTime::currentDateTime() );
00176 void stopTimerFor( Task* task );
00177
00181 void clearActiveTasks();
00182
00186 void iCalFileChanged(QString file);
00187
00189 void clipTotals();
00190
00192 void clipSession();
00193
00195 void clipHistory();
00196
00197 signals:
00198 void totalTimesChanged( long session, long total );
00199 void updateButtons();
00200 void timersActive();
00201 void timersInactive();
00202 void tasksChanged( QPtrList<Task> activeTasks );
00203 void setStatusBar( QString );
00204
00205 private:
00206 IdleTimeDetector *_idleTimeDetector;
00207 QTimer *_minuteTimer;
00208 QTimer *_autoSaveTimer;
00209 QTimer *_manualSaveTimer;
00210 Preferences *_preferences;
00211 QPtrList<Task> activeTasks;
00212 int previousColumnWidths[4];
00213 DesktopTracker* _desktopTracker;
00214 bool _isloading;
00215
00216
00217 KarmStorage * _storage;
00218
00219 private:
00220 void contentsMousePressEvent ( QMouseEvent * e );
00221 void contentsMouseDoubleClickEvent ( QMouseEvent * e );
00222 void updateParents( Task* task, long totalDiff, long sesssionDiff);
00223 void deleteChildTasks( Task *item );
00224 void addTimeToActiveTasks( int minutes, bool save_data = true );
00226 void restoreItemState( QListViewItem *item );
00227
00228 protected slots:
00229 void autoSaveChanged( bool );
00230 void autoSavePeriodChanged( int period );
00231 void minuteUpdate();
00233 void itemStateChanged( QListViewItem *item );
00235 void iCalFileModified(ResourceCalendar *);
00236 };
00237
00238 #endif // KARM_TASK_VIEW
|