karmstorage.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef KARM_STORAGE_H
00024
#define KARM_STORAGE_H
00025
00026
#include <qdict.h>
00027
#include <qptrstack.h>
00028
00029
#include "journal.h"
00030
#include "reportcriteria.h"
00031
00032
#include "desktoplist.h"
00033
00034
#include <calendarresources.h>
00035
00036
class QDateTime;
00037
class Preferences;
00038
class Task;
00039
class TaskView;
00040
class HistoryEvent;
00041
class KCal::Todo;
00042
00065 class KarmStorage
00066 {
00067
public:
00068
00069
00070
00071
00072
00073
00074
static KarmStorage *instance();
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
QString load(
TaskView* taskview,
const Preferences* preferences);
00100
00101
00102
void closeStorage(
TaskView* view);
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
void save(
TaskView* taskview);
00114
00128
QString loadFromFlatFile(
TaskView* taskview,
const QString& filename);
00129
00138
QString loadFromFlatFileCumulative(
TaskView* taskview,
00139
const QString& filename);
00140
00144
QString report(
TaskView *taskview,
const ReportCriteria &rc );
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
void changeTime(
const Task* task,
const long deltaSeconds);
00172
00184 void setName(
const Task* ,
const QString& ) {}
00185
00186
00195 void startTimer(
const Task* ) {}
00196
00206
void stopTimer(
const Task* task);
00207
00217
void addComment(
const Task* task,
const QString& comment);
00218
00219
00228
bool removeTask(
Task* task);
00229
00242
QString addTask(
const Task* task,
const Task* parent);
00243
00249
bool isEmpty();
00250
00261
bool isNewStorage(
const Preferences* preferences)
const;
00262
00264
QValueList<HistoryEvent> getHistory(
const QDate& from,
const QDate& to);
00265
00269 bool isReadOnly()
const {
return !_lock; }
00270
00271
private:
00272
static KarmStorage *_instance;
00273 KCal::CalendarResources *_calendar;
00274
QString _icalfile;
00275 KCal::CalendarResources::Ticket *_lock;
00276
00277
KarmStorage();
00278
void adjustFromLegacyFileFormat(
Task* task);
00279
bool parseLine(
QString line,
long *time,
QString *name,
int *level,
00280
DesktopList* desktopList);
00281
void writeTaskAsTodo
00282 (
Task* task,
const int level,
QPtrStack< KCal::Todo >& parents);
00283
00284 KCal::Event* baseEvent(
const Task*);
00285
00293
QString exportcsvFile(
TaskView *taskview,
const ReportCriteria &rc );
00294
00298
QString exportActivityReport (
00299
TaskView* taskview,
00300
const QDate& from,
00301
const QDate& to,
00302
const ReportCriteria &rc
00303 );
00304
00305
void printTaskHistory (
00306
const Task *task,
00307
const QMap<QString,long>& taskdaytotals,
00308
QMap<QString,long>& daytotals,
00309
const QDate& from,
00310
const QDate& to,
00311
const int level,
QString& s,
00312
const ReportCriteria &rc
00313 );
00314 };
00315
00323 class HistoryEvent
00324 {
00325
public:
00327 HistoryEvent() {}
00328
HistoryEvent(
QString uid,
QString name,
long duration,
00329
QDateTime start,
QDateTime stop,
QString todoUid);
00330
QString uid() {
return _uid; }
00331
QString name() {
return _name; }
00333 long duration() {
return _duration; }
00334
QDateTime start() {
return _start; }
00335
QDateTime stop() {
return _stop; }
00336
QString todoUid() {
return _todoUid; }
00337
00338
private:
00339
QString _uid;
00340
QString _todoUid;
00341
QString _name;
00342
long _duration;
00343
QDateTime _start;
00344
QDateTime _stop;
00345 };
00346
00347
#endif // KARM_STORAGE_H
This file is part of the documentation for karm Library Version 3.3.0.