• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

ktimetracker

  • sources
  • kde-4.12
  • kdepim
  • ktimetracker
timetrackerstorage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003 by Mark Bucciarelli <mark@hubcapconsutling.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the
16  * Free Software Foundation, Inc.
17  * 51 Franklin Street, Fifth Floor
18  * Boston, MA 02110-1301 USA.
19  *
20  */
21 
22 #ifndef KTIMETRACKER_STORAGE_H
23 #define KTIMETRACKER_STORAGE_H
24 
25 #include <QList>
26 #include <QStack>
27 #include <QVector>
28 
29 #include "reportcriteria.h"
30 #include "desktoplist.h"
31 #include "kttcalendar.h"
32 
33 #include <KCalCore/Todo>
34 #include <KCalCore/Event>
35 
36 class QDateTime;
37 class Task;
38 class TaskView;
39 class HistoryEvent;
40 
57 class timetrackerstorage : public QObject
58 {
59  Q_OBJECT
60 
61  public:
62  timetrackerstorage();
63  ~timetrackerstorage();
64 
65  QString setTaskParent( Task* task, Task* parent);
66 
89  QString load( TaskView* taskview, const QString &fileName );
90 
94  QString icalfile();
95 
101  QString buildTaskView( const KTimeTracker::KTTCalendar::Ptr &calendar, TaskView *view );
102 
108  QString buildTaskView(TaskView *view);
109 
111  void closeStorage();
112 
114  KCalCore::Event::List rawevents();
115 
117  KCalCore::Todo::List rawtodos();
118 
119  QString removeEvent(QString uid);
120 
121  KTimeTracker::KTTCalendar::Ptr calendar() const;
122 
131  bool allEventsHaveEndTiMe(Task* task);
132 
140  bool allEventsHaveEndTiMe();
141 
142  QString deleteAllEvents();
143 
154  QString save(TaskView* taskview);
155 
159  QString report( TaskView *taskview, const ReportCriteria &rc );
160 
186  void changeTime(const Task* task, const long deltaSeconds);
187 
199  void setName(const Task* task, const QString& oldname) { Q_UNUSED(task); Q_UNUSED(oldname); }
200 
201 
210  void startTimer(const Task* task, const KDateTime &when=KDateTime::currentLocalDateTime());
211 
217  void startTimer( QString taskID );
218 
229  void stopTimer( const Task* task, const QDateTime &when = QDateTime::currentDateTime() );
230 
240  void addComment(const Task* task, const QString& comment);
241 
242 
251  bool removeTask(Task* task);
252 
261  bool removeTask(QString taskid);
262 
275  QString addTask(const Task* task, const Task* parent=0);
276 
282  bool isEmpty();
283 
285  QStringList taskidsfromname(QString taskname);
286 
293  Task* task( const QString& uid, TaskView* view );
294 
296  QStringList taskNames() const;
297 
298  private:
299  //@cond PRIVATE
300  class Private;
301  Private *const d;
302  //@endcond
303  KTimeTracker::KTTCalendar::Ptr _calendar;
304  QString _icalfile;
305 
306  void adjustFromLegacyFileFormat(Task* task);
307  bool parseLine(QString line, long *time, QString *name, int *level,
308  DesktopList* desktopList);
309  QString writeTaskAsTodo( Task* task, QStack<KCalCore::Todo::Ptr>& parents );
310  QString saveCalendar();
311 
312  KCalCore::Event::Ptr baseEvent(const Task*);
313  KCalCore::Event::Ptr baseEvent(const KCalCore::Todo::Ptr &);
314  bool isRemoteFile( const QString &file ) const;
315 
323  QString exportcsvFile( TaskView *taskview, const ReportCriteria &rc );
324 
328  QString exportcsvHistory
329  (
330  TaskView* taskview,
331  const QDate& from,
332  const QDate& to,
333  const ReportCriteria &rc
334  );
335 };
336 
344 class HistoryEvent
345 {
346  public:
348  HistoryEvent() {}
349  HistoryEvent( const QString &uid, const QString &name, long duration,
350  const KDateTime &start, const KDateTime &stop,
351  const QString &todoUid );
352  QString uid() { return _uid; }
353  QString name() { return _name; }
355  long duration() { return _duration; }
356  KDateTime start() { return _start; }
357  KDateTime stop() { return _stop; }
358  QString todoUid() { return _todoUid; }
359 
360  private:
361  QString _uid;
362  QString _todoUid;
363  QString _name;
364  long _duration;
365  KDateTime _start;
366  KDateTime _stop;
367 
368 };
369 
370 #endif // KTIMETRACKER_STORAGE_H
timetrackerstorage::closeStorage
void closeStorage()
Close calendar and clear view.
Definition: timetrackerstorage.cpp:309
timetrackerstorage::startTimer
void startTimer(const Task *task, const KDateTime &when=KDateTime::currentLocalDateTime())
Log the event that a timer has started for a task.
Definition: timetrackerstorage.cpp:897
timetrackerstorage::report
QString report(TaskView *taskview, const ReportCriteria &rc)
Output a report based on contents of ReportCriteria.
Definition: timetrackerstorage.cpp:575
HistoryEvent::name
QString name()
Definition: timetrackerstorage.h:353
timetrackerstorage::timetrackerstorage
timetrackerstorage()
Definition: timetrackerstorage.cpp:90
KTimeTracker::KTTCalendar::Ptr
QSharedPointer< KTimeTracker::KTTCalendar > Ptr
Definition: kttcalendar.h:32
timetrackerstorage::setName
void setName(const Task *task, const QString &oldname)
Log a change to a task name.
Definition: timetrackerstorage.h:199
timetrackerstorage::deleteAllEvents
QString deleteAllEvents()
Definition: timetrackerstorage.cpp:358
timetrackerstorage::isEmpty
bool isEmpty()
Check if the iCalendar file currently loaded has any Todos in it.
Definition: timetrackerstorage.cpp:432
timetrackerstorage::addComment
void addComment(const Task *task, const QString &comment)
Log a new comment for this task.
Definition: timetrackerstorage.cpp:558
timetrackerstorage::rawtodos
KCalCore::Todo::List rawtodos()
list of all todos
Definition: timetrackerstorage.cpp:326
HistoryEvent::HistoryEvent
HistoryEvent()
Needed to be used in a value list.
Definition: timetrackerstorage.h:348
timetrackerstorage::taskidsfromname
QStringList taskidsfromname(QString taskname)
Return a list of all task ids for taskname.
Definition: timetrackerstorage.cpp:470
QObject
desktoplist.h
reportcriteria.h
timetrackerstorage::removeTask
bool removeTask(Task *task)
Remove this task from iCalendar file.
Definition: timetrackerstorage.cpp:510
HistoryEvent::uid
QString uid()
Definition: timetrackerstorage.h:352
ReportCriteria
Stores entries from export dialog.
Definition: reportcriteria.h:41
timetrackerstorage::rawevents
KCalCore::Event::List rawevents()
list of all events
Definition: timetrackerstorage.cpp:320
HistoryEvent::start
KDateTime start()
Definition: timetrackerstorage.h:356
timetrackerstorage::allEventsHaveEndTiMe
bool allEventsHaveEndTiMe()
Deliver if all events of the actual calendar have an endtime.
Definition: timetrackerstorage.cpp:346
timetrackerstorage::changeTime
void changeTime(const Task *task, const long deltaSeconds)
Log the change in a task's time.
Definition: timetrackerstorage.cpp:955
timetrackerstorage::~timetrackerstorage
~timetrackerstorage()
Definition: timetrackerstorage.cpp:94
DesktopList
QVector< int > DesktopList
Definition: desktoplist.h:28
timetrackerstorage::setTaskParent
QString setTaskParent(Task *task, Task *parent)
Definition: timetrackerstorage.cpp:394
name
const char * name
Definition: toolicons.h:159
HistoryEvent::stop
KDateTime stop()
Definition: timetrackerstorage.h:357
timetrackerstorage::stopTimer
void stopTimer(const Task *task, const QDateTime &when=QDateTime::currentDateTime())
Log the event that the timer has stopped for this task.
Definition: timetrackerstorage.cpp:929
timetrackerstorage::calendar
KTimeTracker::KTTCalendar::Ptr calendar() const
Definition: timetrackerstorage.cpp:1073
timetrackerstorage::task
Task * task(const QString &uid, TaskView *view)
Find the task with the given uid.
Definition: timetrackerstorage.cpp:208
timetrackerstorage::removeEvent
QString removeEvent(QString uid)
Definition: timetrackerstorage.cpp:494
HistoryEvent::todoUid
QString todoUid()
Definition: timetrackerstorage.h:358
HistoryEvent
One start/stop event that has been logged.
Definition: timetrackerstorage.h:344
timetrackerstorage::save
QString save(TaskView *taskview)
Save all tasks and their totals to an iCalendar file.
Definition: timetrackerstorage.cpp:367
HistoryEvent::duration
long duration()
In seconds.
Definition: timetrackerstorage.h:355
timetrackerstorage::addTask
QString addTask(const Task *task, const Task *parent=0)
Add this task from iCalendar file.
Definition: timetrackerstorage.cpp:442
kttcalendar.h
TaskView
Container and interface for the tasks.
Definition: taskview.h:50
timetrackerstorage::icalfile
QString icalfile()
Return the name of the iCal file.
Definition: timetrackerstorage.cpp:226
Task
A class representing a task.
Definition: task.h:54
timetrackerstorage::buildTaskView
QString buildTaskView(const KTimeTracker::KTTCalendar::Ptr &calendar, TaskView *view)
Build up the taskview.
Definition: timetrackerstorage.cpp:232
timetrackerstorage::taskNames
QStringList taskNames() const
Return a list of all task names.
Definition: timetrackerstorage.cpp:484
timetrackerstorage::load
QString load(TaskView *taskview, const QString &fileName)
Load the list view with tasks read from iCalendar file.
Definition: timetrackerstorage.cpp:99
timetrackerstorage
Class to store/retrieve KTimeTracker data to/from persistent storage.
Definition: timetrackerstorage.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktimetracker

Skip menu "ktimetracker"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal