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
00161 void extractTime( int minutes );
00162 void taskTotalTimesChanged( long session, long total)
00163 { emit totalTimesChanged( session, total); };
00164 void adaptColumns();
00166 void deletingTask(Task* deletedTask);
00167
00172 void startTimerFor( Task* task, QDateTime startTime = QDateTime::currentDateTime() );
00173 void stopTimerFor( Task* task );
00174
00178 void clearActiveTasks();
00179
00183 void iCalFileChanged(QString file);
00184
00186 void clipTotals();
00187
00189 void clipSession();
00190
00192 void clipHistory();
00193
00194 signals:
00195 void totalTimesChanged( long session, long total );
00196 void updateButtons();
00197 void timersActive();
00198 void timersInactive();
00199 void tasksChanged( QPtrList<Task> activeTasks );
00200 void setStatusBar( QString );
00201
00202 private:
00203 IdleTimeDetector *_idleTimeDetector;
00204 QTimer *_minuteTimer;
00205 QTimer *_autoSaveTimer;
00206 QTimer *_manualSaveTimer;
00207 Preferences *_preferences;
00208 QPtrList<Task> activeTasks;
00209 int previousColumnWidths[4];
00210 DesktopTracker* _desktopTracker;
00211 bool _isloading;
00212
00213
00214 KarmStorage * _storage;
00215
00216 private:
00217 void contentsMousePressEvent ( QMouseEvent * e );
00218 void contentsMouseDoubleClickEvent ( QMouseEvent * e );
00219 void updateParents( Task* task, long totalDiff, long sesssionDiff);
00220 void deleteChildTasks( Task *item );
00221 void addTimeToActiveTasks( int minutes, bool save_data = true );
00223 void restoreItemState( QListViewItem *item );
00224
00225 protected slots:
00226 void autoSaveChanged( bool );
00227 void autoSavePeriodChanged( int period );
00228 void minuteUpdate();
00230 void itemStateChanged( QListViewItem *item );
00232 void iCalFileModified(ResourceCalendar *);
00233 };
00234
00235 #endif // KARM_TASK_VIEW
|