summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-15 07:31:29 (UTC)
committer zautrix <zautrix>2005-04-15 07:31:29 (UTC)
commit6a16de9a18235d2ddd771c97a4bb4512b43d181a (patch) (unidiff)
tree3fec37074addd6afc6eebb191d57a1d5ef5127ab
parent7e87a287a0860882af27e26288bc9cc553dd3a0b (diff)
downloadkdepimpi-6a16de9a18235d2ddd771c97a4bb4512b43d181a.zip
kdepimpi-6a16de9a18235d2ddd771c97a4bb4512b43d181a.tar.gz
kdepimpi-6a16de9a18235d2ddd771c97a4bb4512b43d181a.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/todo.cpp36
-rw-r--r--libkcal/todo.h1
2 files changed, 34 insertions, 3 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 90e7eb9..b89abce 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -25,2 +25,3 @@
25#include <qregexp.h> 25#include <qregexp.h>
26#include <qfileinfo.h>
26 27
@@ -32,3 +33,3 @@ using namespace KCal;
32 33
33Todo::Todo(): Incidence() 34Todo::Todo(): QObject(), Incidence()
34{ 35{
@@ -45,3 +46,3 @@ Todo::Todo(): Incidence()
45 46
46Todo::Todo(const Todo &t) : Incidence(t) 47Todo::Todo(const Todo &t) : QObject(),Incidence(t)
47{ 48{
@@ -83,4 +84,6 @@ void Todo::saveRunningInfoToFile()
83 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 84 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
84 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) 85 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) {
86 qDebug("Running time < 30 seconds. Skipped. ");
85 return; 87 return;
88 }
86 QString dir = KGlobalSettings::timeTrackerDir(); 89 QString dir = KGlobalSettings::timeTrackerDir();
@@ -105,4 +108,31 @@ void Todo::saveRunningInfoToFile()
105 format.save( &cal, file ); 108 format.save( &cal, file );
109 saveParents();
106 110
107} 111}
112void Todo::saveParents()
113{
114 if (!relatedTo() )
115 return;
116 Incidence * inc = relatedTo();
117 if ( inc->type() != "Todo" )
118 return;
119 Todo* to = (Todo*)inc;
120 bool saveTodo = false;
121 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
122 QFileInfo fi ( file );
123 if ( fi.exists() ) {
124 if ( fi.lastModified () < to->lastModified ())
125 saveTodo = true;
126 } else {
127 saveTodo = true;
128 }
129 if ( saveTodo ) {
130 CalendarLocal cal;
131 cal.setTimeZoneId( " 00:00 Europe/London(UTC)" );
132 Todo * par = (Todo *) to->clone();
133 cal.addIncidence( par );
134 ICalFormat format;
135 format.save( &cal, file );
136 }
137}
108 138
diff --git a/libkcal/todo.h b/libkcal/todo.h
index fe43357..ec1ffda 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -126,2 +126,3 @@ namespace KCal {
126 void saveRunningInfoToFile(); 126 void saveRunningInfoToFile();
127 void saveParents();
127 private: 128 private: