summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/todo.cpp4
4 files changed, 10 insertions, 2 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 3b7b183..2efa355 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -68,24 +68,25 @@ public:
68 Incidence * undoIncidence() { return mUndoIncidence; }; 68 Incidence * undoIncidence() { return mUndoIncidence; };
69 bool undoDeleteIncidence(); 69 bool undoDeleteIncidence();
70 void deleteIncidence(Incidence *in); 70 void deleteIncidence(Incidence *in);
71 void resetTempSyncStat(); 71 void resetTempSyncStat();
72 void resetPilotStat(int id); 72 void resetPilotStat(int id);
73 /** 73 /**
74 Clears out the current calendar, freeing all used memory etc. 74 Clears out the current calendar, freeing all used memory etc.
75 */ 75 */
76 virtual void close() = 0; 76 virtual void close() = 0;
77 virtual void addCalendar( Calendar* ) = 0; 77 virtual void addCalendar( Calendar* ) = 0;
78 virtual bool addCalendarFile( QString name, int id ) = 0; 78 virtual bool addCalendarFile( QString name, int id ) = 0;
79 virtual void setSyncEventsReadOnly() = 0; 79 virtual void setSyncEventsReadOnly() = 0;
80 virtual void stopAllTodos() = 0;
80 81
81 /** 82 /**
82 Sync changes in memory to persistant storage. 83 Sync changes in memory to persistant storage.
83 */ 84 */
84 virtual void save() = 0; 85 virtual void save() = 0;
85 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 86 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
86 virtual void removeSyncInfo( QString syncProfile) = 0; 87 virtual void removeSyncInfo( QString syncProfile) = 0;
87 virtual bool isSaving() { return false; } 88 virtual bool isSaving() { return false; }
88 89
89 /** 90 /**
90 Return the owner of the calendar's full name. 91 Return the owner of the calendar's full name.
91 */ 92 */
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 8c4dde1..18f1af8 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -138,24 +138,30 @@ void CalendarLocal::addCalendar( Calendar* cal )
138bool CalendarLocal::load( const QString &fileName ) 138bool CalendarLocal::load( const QString &fileName )
139{ 139{
140 FileStorage storage( this, fileName ); 140 FileStorage storage( this, fileName );
141 return storage.load(); 141 return storage.load();
142} 142}
143 143
144bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 144bool CalendarLocal::save( const QString &fileName, CalFormat *format )
145{ 145{
146 FileStorage storage( this, fileName, format ); 146 FileStorage storage( this, fileName, format );
147 return storage.save(); 147 return storage.save();
148} 148}
149 149
150void CalendarLocal::stopAllTodos()
151{
152 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
153 it->setRunning( false );
154
155}
150void CalendarLocal::close() 156void CalendarLocal::close()
151{ 157{
152 158
153 Todo * i; 159 Todo * i;
154 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 160 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
155 161
156 mEventList.setAutoDelete( true ); 162 mEventList.setAutoDelete( true );
157 mTodoList.setAutoDelete( true ); 163 mTodoList.setAutoDelete( true );
158 mJournalList.setAutoDelete( false ); 164 mJournalList.setAutoDelete( false );
159 165
160 mEventList.clear(); 166 mEventList.clear();
161 mTodoList.clear(); 167 mTodoList.clear();
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 0286b48..d32597f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -37,24 +37,25 @@ class CalendarLocal : public Calendar
37 /** 37 /**
38 Constructs a new calendar, with variables initialized to sane values. 38 Constructs a new calendar, with variables initialized to sane values.
39 */ 39 */
40 CalendarLocal(); 40 CalendarLocal();
41 /** 41 /**
42 Constructs a new calendar, with variables initialized to sane values. 42 Constructs a new calendar, with variables initialized to sane values.
43 */ 43 */
44 CalendarLocal( const QString &timeZoneId ); 44 CalendarLocal( const QString &timeZoneId );
45 ~CalendarLocal(); 45 ~CalendarLocal();
46 void addCalendar( Calendar* ); 46 void addCalendar( Calendar* );
47 bool addCalendarFile( QString name, int id ); 47 bool addCalendarFile( QString name, int id );
48 void setSyncEventsReadOnly(); 48 void setSyncEventsReadOnly();
49 void stopAllTodos();
49 /** 50 /**
50 Loads a calendar on disk in vCalendar or iCalendar format into the current 51 Loads a calendar on disk in vCalendar or iCalendar format into the current
51 calendar. Any information already present is lost. 52 calendar. Any information already present is lost.
52 @return true, if successfull, false on error. 53 @return true, if successfull, false on error.
53 @param fileName the name of the calendar on disk. 54 @param fileName the name of the calendar on disk.
54 */ 55 */
55 bool load( const QString &fileName ); 56 bool load( const QString &fileName );
56 /** 57 /**
57 Writes out the calendar to disk in the specified \a format. 58 Writes out the calendar to disk in the specified \a format.
58 CalendarLocal takes ownership of the CalFormat object. 59 CalendarLocal takes ownership of the CalFormat object.
59 @return true, if successfull, false on error. 60 @return true, if successfull, false on error.
60 @param fileName the name of the file 61 @param fileName the name of the file
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 9a8b6e4..5260051 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -102,26 +102,26 @@ void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end )
102 mRunStart = start; 102 mRunStart = start;
103 mRunEnd = end; 103 mRunEnd = end;
104 saveRunningInfoToFile( comment ); 104 saveRunningInfoToFile( comment );
105} 105}
106void Todo::saveRunningInfoToFile() 106void Todo::saveRunningInfoToFile()
107{ 107{
108 mRunEnd = QDateTime::currentDateTime(); 108 mRunEnd = QDateTime::currentDateTime();
109 saveRunningInfoToFile( QString::null ); 109 saveRunningInfoToFile( QString::null );
110} 110}
111void Todo::saveRunningInfoToFile( QString comment ) 111void Todo::saveRunningInfoToFile( QString comment )
112{ 112{
113 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 113 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
114 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 10 ) { 114 if ( mRunStart.secsTo ( mRunEnd) < 15 ) {
115 qDebug("Running time < 30 seconds. Skipped. "); 115 qDebug("Running time < 15 seconds. Skipped. ");
116 return; 116 return;
117 } 117 }
118 QString dir = KGlobalSettings::timeTrackerDir(); 118 QString dir = KGlobalSettings::timeTrackerDir();
119 //qDebug("%s ", dir.latin1()); 119 //qDebug("%s ", dir.latin1());
120 QString file = "%1%2%3-%4%5%6-"; 120 QString file = "%1%2%3-%4%5%6-";
121 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); 121 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 );
122 file.replace ( QRegExp (" "), "0" ); 122 file.replace ( QRegExp (" "), "0" );
123 file += uid(); 123 file += uid();
124 //qDebug("File %s ",file.latin1() ); 124 //qDebug("File %s ",file.latin1() );
125 CalendarLocal cal; 125 CalendarLocal cal;
126 cal.setLocalTime(); 126 cal.setLocalTime();
127 Todo * to = (Todo*) clone(); 127 Todo * to = (Todo*) clone();