author | zautrix <zautrix> | 2005-07-09 10:40:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 10:40:57 (UTC) |
commit | b51db424f4b1e558ab8c7c723859bb564c99d83b (patch) (unidiff) | |
tree | 2de26e6455c6b07b17cb169ef23e4170387a5fcc /libkcal | |
parent | f731dd9fc5b3f14c44d4de26eb5370a79c63887c (diff) | |
download | kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.zip kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.gz kdepimpi-b51db424f4b1e558ab8c7c723859bb564c99d83b.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 35 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 2 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 8 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 1 |
5 files changed, 37 insertions, 10 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 14a1a45..95477cd 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -32,96 +32,97 @@ | |||
32 | #include "event.h" | 32 | #include "event.h" |
33 | #include "todo.h" | 33 | #include "todo.h" |
34 | #include "journal.h" | 34 | #include "journal.h" |
35 | #include "calfilter.h" | 35 | #include "calfilter.h" |
36 | 36 | ||
37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ | 37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ |
38 | 38 | ||
39 | class KConfig; | 39 | class KConfig; |
40 | 40 | ||
41 | namespace KCal { | 41 | namespace KCal { |
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | This is the main "calendar" object class for KOrganizer. It holds | 45 | This is the main "calendar" object class for KOrganizer. It holds |
46 | information like all appointments/events, user information, etc. etc. | 46 | information like all appointments/events, user information, etc. etc. |
47 | one calendar is associated with each CalendarView (@see calendarview.h). | 47 | one calendar is associated with each CalendarView (@see calendarview.h). |
48 | This is an abstract base class defining the interface to a calendar. It is | 48 | This is an abstract base class defining the interface to a calendar. It is |
49 | implemented by subclasses like @see CalendarLocal, which use different | 49 | implemented by subclasses like @see CalendarLocal, which use different |
50 | methods to store and access the data. | 50 | methods to store and access the data. |
51 | 51 | ||
52 | Ownership of events etc. is handled by the following policy: As soon as an | 52 | Ownership of events etc. is handled by the following policy: As soon as an |
53 | event (or any other subclass of IncidenceBase) object is added to the | 53 | event (or any other subclass of IncidenceBase) object is added to the |
54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes | 54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes |
55 | care of deleting it. All Events returned by the query functions are returned | 55 | care of deleting it. All Events returned by the query functions are returned |
56 | as pointers, that means all changes to the returned events are immediately | 56 | as pointers, that means all changes to the returned events are immediately |
57 | visible in the Calendar. You shouldn't delete any Event object you get from | 57 | visible in the Calendar. You shouldn't delete any Event object you get from |
58 | Calendar. | 58 | Calendar. |
59 | */ | 59 | */ |
60 | class Calendar : public QObject, public CustomProperties, | 60 | class Calendar : public QObject, public CustomProperties, |
61 | public IncidenceBase::Observer | 61 | public IncidenceBase::Observer |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | Calendar(); | 65 | Calendar(); |
66 | Calendar(const QString &timeZoneId); | 66 | Calendar(const QString &timeZoneId); |
67 | virtual ~Calendar(); | 67 | virtual ~Calendar(); |
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 bool mergeCalendarFile( QString name ) = 0; | 79 | virtual bool mergeCalendarFile( QString name ) = 0; |
80 | virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0; | ||
80 | virtual void setSyncEventsReadOnly() = 0; | 81 | virtual void setSyncEventsReadOnly() = 0; |
81 | virtual void stopAllTodos() = 0; | 82 | virtual void stopAllTodos() = 0; |
82 | 83 | ||
83 | /** | 84 | /** |
84 | Sync changes in memory to persistant storage. | 85 | Sync changes in memory to persistant storage. |
85 | */ | 86 | */ |
86 | virtual void save() = 0; | 87 | virtual void save() = 0; |
87 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 88 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
88 | virtual void removeSyncInfo( QString syncProfile) = 0; | 89 | virtual void removeSyncInfo( QString syncProfile) = 0; |
89 | virtual bool isSaving() { return false; } | 90 | virtual bool isSaving() { return false; } |
90 | 91 | ||
91 | /** | 92 | /** |
92 | Return the owner of the calendar's full name. | 93 | Return the owner of the calendar's full name. |
93 | */ | 94 | */ |
94 | const QString &getOwner() const; | 95 | const QString &getOwner() const; |
95 | /** | 96 | /** |
96 | Set the owner of the calendar. Should be owner's full name. | 97 | Set the owner of the calendar. Should be owner's full name. |
97 | */ | 98 | */ |
98 | void setOwner( const QString &os ); | 99 | void setOwner( const QString &os ); |
99 | /** | 100 | /** |
100 | Return the email address of the calendar owner. | 101 | Return the email address of the calendar owner. |
101 | */ | 102 | */ |
102 | const QString &getEmail(); | 103 | const QString &getEmail(); |
103 | /** | 104 | /** |
104 | Set the email address of the calendar owner. | 105 | Set the email address of the calendar owner. |
105 | */ | 106 | */ |
106 | void setEmail( const QString & ); | 107 | void setEmail( const QString & ); |
107 | 108 | ||
108 | /** | 109 | /** |
109 | Set time zone from a timezone string (e.g. -2:00) | 110 | Set time zone from a timezone string (e.g. -2:00) |
110 | */ | 111 | */ |
111 | void setTimeZone( const QString &tz ); | 112 | void setTimeZone( const QString &tz ); |
112 | /** | 113 | /** |
113 | Set time zone from a minutes value (e.g. -60) | 114 | Set time zone from a minutes value (e.g. -60) |
114 | */ | 115 | */ |
115 | void setTimeZone( int tz ); | 116 | void setTimeZone( int tz ); |
116 | /** | 117 | /** |
117 | Return time zone as offest in minutes. | 118 | Return time zone as offest in minutes. |
118 | */ | 119 | */ |
119 | int getTimeZone() const; | 120 | int getTimeZone() const; |
120 | /** | 121 | /** |
121 | Compute an ISO 8601 format string from the time zone. | 122 | Compute an ISO 8601 format string from the time zone. |
122 | */ | 123 | */ |
123 | QString getTimeZoneStr() const; | 124 | QString getTimeZoneStr() const; |
124 | /** | 125 | /** |
125 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal | 126 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal |
126 | values). | 127 | values). |
127 | */ | 128 | */ |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 3e42ec0..e37a7ad 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -34,160 +34,179 @@ | |||
34 | #include "icalformat.h" | 34 | #include "icalformat.h" |
35 | #include "exceptions.h" | 35 | #include "exceptions.h" |
36 | #include "incidence.h" | 36 | #include "incidence.h" |
37 | #include "journal.h" | 37 | #include "journal.h" |
38 | #include "filestorage.h" | 38 | #include "filestorage.h" |
39 | #include "calfilter.h" | 39 | #include "calfilter.h" |
40 | 40 | ||
41 | #include "calendarlocal.h" | 41 | #include "calendarlocal.h" |
42 | 42 | ||
43 | // #ifndef DESKTOP_VERSION | 43 | // #ifndef DESKTOP_VERSION |
44 | // #include <qtopia/alarmserver.h> | 44 | // #include <qtopia/alarmserver.h> |
45 | // #endif | 45 | // #endif |
46 | using namespace KCal; | 46 | using namespace KCal; |
47 | 47 | ||
48 | CalendarLocal::CalendarLocal() | 48 | CalendarLocal::CalendarLocal() |
49 | : Calendar() | 49 | : Calendar() |
50 | { | 50 | { |
51 | init(); | 51 | init(); |
52 | } | 52 | } |
53 | 53 | ||
54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) | 54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) |
55 | : Calendar(timeZoneId) | 55 | : Calendar(timeZoneId) |
56 | { | 56 | { |
57 | init(); | 57 | init(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void CalendarLocal::init() | 60 | void CalendarLocal::init() |
61 | { | 61 | { |
62 | mNextAlarmIncidence = 0; | 62 | mNextAlarmIncidence = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | CalendarLocal::~CalendarLocal() | 66 | CalendarLocal::~CalendarLocal() |
67 | { | 67 | { |
68 | if ( mDeleteIncidencesOnClose ) | 68 | if ( mDeleteIncidencesOnClose ) |
69 | close(); | 69 | close(); |
70 | } | 70 | } |
71 | bool CalendarLocal::mergeCalendarFile( QString name ) | 71 | bool CalendarLocal::mergeCalendarFile( QString name ) |
72 | { | 72 | { |
73 | CalendarLocal calendar( timeZoneId() ); | 73 | CalendarLocal calendar( timeZoneId() ); |
74 | calendar.setDefaultCalendar( 1 ); | 74 | calendar.setDefaultCalendar( 1 ); |
75 | if ( calendar.load( name ) ) { | 75 | if ( calendar.load( name ) ) { |
76 | mergeCalendar( &calendar ); | 76 | mergeCalendar( &calendar ); |
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | 81 | ||
82 | Incidence* CalendarLocal::incidenceForUid( const QString& uid ) | 82 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) |
83 | { | 83 | { |
84 | Todo *todo;; | 84 | Todo *todo;; |
85 | Incidence *retVal = 0; | 85 | Incidence *retVal = 0; |
86 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 86 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
87 | if ( todo->uid() == uid ) { | 87 | if ( todo->uid() == uid ) { |
88 | if ( doNotCheckDuplicates ) return todo; | ||
88 | if ( retVal ) { | 89 | if ( retVal ) { |
89 | if ( retVal->calID() > todo->calID() ) { | 90 | if ( retVal->calID() > todo->calID() ) { |
90 | retVal = todo; | 91 | retVal = todo; |
91 | } | 92 | } |
92 | } else { | 93 | } else { |
93 | retVal = todo; | 94 | retVal = todo; |
94 | } | 95 | } |
95 | } | 96 | } |
96 | } | 97 | } |
97 | if ( retVal ) return retVal; | 98 | if ( retVal ) return retVal; |
98 | Event *event; | 99 | Event *event; |
99 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 100 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
100 | if ( event->uid() == uid ) { | 101 | if ( event->uid() == uid ) { |
102 | if ( doNotCheckDuplicates ) return event; | ||
101 | if ( retVal ) { | 103 | if ( retVal ) { |
102 | if ( retVal->calID() > event->calID() ) { | 104 | if ( retVal->calID() > event->calID() ) { |
103 | retVal = event; | 105 | retVal = event; |
104 | } | 106 | } |
105 | } else { | 107 | } else { |
106 | retVal = event; | 108 | retVal = event; |
107 | } | 109 | } |
108 | } | 110 | } |
109 | } | 111 | } |
110 | if ( retVal ) return retVal; | 112 | if ( retVal ) return retVal; |
111 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 113 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
112 | if ( it->uid() == uid ) { | 114 | if ( it->uid() == uid ) { |
115 | if ( doNotCheckDuplicates ) return it; | ||
113 | if ( retVal ) { | 116 | if ( retVal ) { |
114 | if ( retVal->calID() > it->calID() ) { | 117 | if ( retVal->calID() > it->calID() ) { |
115 | retVal = it; | 118 | retVal = it; |
116 | } | 119 | } |
117 | } else { | 120 | } else { |
118 | retVal = it; | 121 | retVal = it; |
119 | } | 122 | } |
120 | } | 123 | } |
121 | return retVal; | 124 | return retVal; |
122 | } | 125 | } |
123 | 126 | ||
124 | bool CalendarLocal::mergeCalendar( Calendar* remote ) | 127 | bool CalendarLocal::mergeCalendar( Calendar* remote ) |
125 | { | 128 | { |
129 | // 1 look for raw inc in local | ||
130 | // if inc not in remote, delete in local | ||
131 | // 2 look for raw inc in remote | ||
132 | // if inc in local, replace it | ||
133 | // if not in local, add it to default calendar | ||
134 | QPtrList<Incidence> localInc = rawIncidences(); | ||
135 | Incidence* inL = localInc.first(); | ||
136 | while ( inL ) { | ||
137 | if ( ! inL->isReadOnly () ) | ||
138 | if ( !remote->incidenceForUid( inL->uid(), true )) | ||
139 | deleteIncidence( inL ); | ||
140 | inL = localInc.next(); | ||
141 | } | ||
126 | QPtrList<Incidence> er = remote->rawIncidences(); | 142 | QPtrList<Incidence> er = remote->rawIncidences(); |
127 | Incidence* inR = er.first(); | 143 | Incidence* inR = er.first(); |
128 | Incidence* inL; | ||
129 | while ( inR ) { | 144 | while ( inR ) { |
130 | inL = incidenceForUid( inR->uid() ); | 145 | inL = incidenceForUid( inR->uid(),false ); |
131 | if ( inL ) { | 146 | if ( inL ) { |
132 | int calID = inL->calID(); | 147 | if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) { |
133 | deleteIncidence( inL ); | 148 | int calID = inL->calID(); |
134 | inL = inR->clone(); | 149 | deleteIncidence( inL ); |
135 | inL->setCalID( calID ); | 150 | inL = inR->clone(); |
136 | addIncidence( inL ); | 151 | inL->setCalID( calID ); |
152 | addIncidence( inL ); | ||
153 | } | ||
137 | } else { | 154 | } else { |
138 | inL = inR->clone(); | 155 | inL = inR->clone(); |
139 | inL->setCalID( 0 );// add to default cal | 156 | inL->setCalID( 0 );// add to default cal |
140 | addIncidence( inL ); | 157 | addIncidence( inL ); |
141 | } | 158 | } |
142 | inR = er.next(); | 159 | inR = er.next(); |
143 | } | 160 | } |
144 | return true; | 161 | return true; |
145 | } | 162 | } |
163 | |||
164 | |||
146 | bool CalendarLocal::addCalendarFile( QString name, int id ) | 165 | bool CalendarLocal::addCalendarFile( QString name, int id ) |
147 | { | 166 | { |
148 | CalendarLocal calendar( timeZoneId() ); | 167 | CalendarLocal calendar( timeZoneId() ); |
149 | calendar.setDefaultCalendar( id ); | 168 | calendar.setDefaultCalendar( id ); |
150 | if ( calendar.load( name ) ) { | 169 | if ( calendar.load( name ) ) { |
151 | addCalendar( &calendar ); | 170 | addCalendar( &calendar ); |
152 | return true; | 171 | return true; |
153 | } | 172 | } |
154 | return false; | 173 | return false; |
155 | } | 174 | } |
156 | void CalendarLocal::setSyncEventsReadOnly() | 175 | void CalendarLocal::setSyncEventsReadOnly() |
157 | { | 176 | { |
158 | Event * ev; | 177 | Event * ev; |
159 | ev = mEventList.first(); | 178 | ev = mEventList.first(); |
160 | while ( ev ) { | 179 | while ( ev ) { |
161 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 180 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
162 | ev->setReadOnly( true ); | 181 | ev->setReadOnly( true ); |
163 | ev = mEventList.next(); | 182 | ev = mEventList.next(); |
164 | } | 183 | } |
165 | } | 184 | } |
166 | void CalendarLocal::addCalendar( Calendar* cal ) | 185 | void CalendarLocal::addCalendar( Calendar* cal ) |
167 | { | 186 | { |
168 | cal->setDontDeleteIncidencesOnClose(); | 187 | cal->setDontDeleteIncidencesOnClose(); |
169 | { | 188 | { |
170 | QPtrList<Event> EventList = cal->rawEvents(); | 189 | QPtrList<Event> EventList = cal->rawEvents(); |
171 | Event * ev = EventList.first(); | 190 | Event * ev = EventList.first(); |
172 | while ( ev ) { | 191 | while ( ev ) { |
173 | ev->unRegisterObserver( cal ); | 192 | ev->unRegisterObserver( cal ); |
174 | ev->registerObserver( this ); | 193 | ev->registerObserver( this ); |
175 | mEventList.append( ev ); | 194 | mEventList.append( ev ); |
176 | ev = EventList.next(); | 195 | ev = EventList.next(); |
177 | } | 196 | } |
178 | } | 197 | } |
179 | { | 198 | { |
180 | 199 | ||
181 | QPtrList<Todo> TodoList = cal->rawTodos(); | 200 | QPtrList<Todo> TodoList = cal->rawTodos(); |
182 | Todo * ev = TodoList.first(); | 201 | Todo * ev = TodoList.first(); |
183 | while ( ev ) { | 202 | while ( ev ) { |
184 | QString rel = ev->relatedToUid(); | 203 | QString rel = ev->relatedToUid(); |
185 | if ( !rel.isEmpty() ){ | 204 | if ( !rel.isEmpty() ){ |
186 | ev->setRelatedTo ( 0 ); | 205 | ev->setRelatedTo ( 0 ); |
187 | ev->setRelatedToUid( rel ); | 206 | ev->setRelatedToUid( rel ); |
188 | } | 207 | } |
189 | ev = TodoList.next(); | 208 | ev = TodoList.next(); |
190 | } | 209 | } |
191 | //TodoList = cal->rawTodos(); | 210 | //TodoList = cal->rawTodos(); |
192 | ev = TodoList.first(); | 211 | ev = TodoList.first(); |
193 | while ( ev ) { | 212 | while ( ev ) { |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 23b0542..a7a85c8 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -2,97 +2,97 @@ | |||
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> | 5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | #ifndef KCAL_CALENDARLOCAL_H | 22 | #ifndef KCAL_CALENDARLOCAL_H |
23 | #define KCAL_CALENDARLOCAL_H | 23 | #define KCAL_CALENDARLOCAL_H |
24 | 24 | ||
25 | #include "calendar.h" | 25 | #include "calendar.h" |
26 | 26 | ||
27 | namespace KCal { | 27 | namespace KCal { |
28 | 28 | ||
29 | class CalFormat; | 29 | class CalFormat; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | This class provides a calendar stored as a local file. | 32 | This class provides a calendar stored as a local file. |
33 | */ | 33 | */ |
34 | class CalendarLocal : public Calendar | 34 | class CalendarLocal : public Calendar |
35 | { | 35 | { |
36 | public: | 36 | public: |
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 | bool mergeCalendarFile( QString name ); | 48 | bool mergeCalendarFile( QString name ); |
49 | bool mergeCalendar( Calendar* cal ); | 49 | bool mergeCalendar( Calendar* cal ); |
50 | Incidence* incidenceForUid( const QString& uid ); | 50 | Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ); |
51 | void setSyncEventsReadOnly(); | 51 | void setSyncEventsReadOnly(); |
52 | void stopAllTodos(); | 52 | void stopAllTodos(); |
53 | /** | 53 | /** |
54 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 54 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
55 | calendar. Any information already present is lost. | 55 | calendar. Any information already present is lost. |
56 | @return true, if successfull, false on error. | 56 | @return true, if successfull, false on error. |
57 | @param fileName the name of the calendar on disk. | 57 | @param fileName the name of the calendar on disk. |
58 | */ | 58 | */ |
59 | bool load( const QString &fileName ); | 59 | bool load( const QString &fileName ); |
60 | /** | 60 | /** |
61 | Writes out the calendar to disk in the specified \a format. | 61 | Writes out the calendar to disk in the specified \a format. |
62 | CalendarLocal takes ownership of the CalFormat object. | 62 | CalendarLocal takes ownership of the CalFormat object. |
63 | @return true, if successfull, false on error. | 63 | @return true, if successfull, false on error. |
64 | @param fileName the name of the file | 64 | @param fileName the name of the file |
65 | */ | 65 | */ |
66 | bool save( const QString &fileName, CalFormat *format = 0 ); | 66 | bool save( const QString &fileName, CalFormat *format = 0 ); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | Clears out the current calendar, freeing all used memory etc. etc. | 69 | Clears out the current calendar, freeing all used memory etc. etc. |
70 | */ | 70 | */ |
71 | void close(); | 71 | void close(); |
72 | 72 | ||
73 | void save() {} | 73 | void save() {} |
74 | 74 | ||
75 | /** | 75 | /** |
76 | Add Event to calendar. | 76 | Add Event to calendar. |
77 | */ | 77 | */ |
78 | void removeSyncInfo( QString syncProfile); | 78 | void removeSyncInfo( QString syncProfile); |
79 | bool addAnniversaryNoDup( Event *event ); | 79 | bool addAnniversaryNoDup( Event *event ); |
80 | bool addEventNoDup( Event *event ); | 80 | bool addEventNoDup( Event *event ); |
81 | bool addEvent( Event *event ); | 81 | bool addEvent( Event *event ); |
82 | /** | 82 | /** |
83 | Deletes an event from this calendar. | 83 | Deletes an event from this calendar. |
84 | */ | 84 | */ |
85 | void deleteEvent( Event *event ); | 85 | void deleteEvent( Event *event ); |
86 | 86 | ||
87 | /** | 87 | /** |
88 | Retrieves an event on the basis of the unique string ID. | 88 | Retrieves an event on the basis of the unique string ID. |
89 | */ | 89 | */ |
90 | Event *event( const QString &uid ); | 90 | Event *event( const QString &uid ); |
91 | /** | 91 | /** |
92 | Return unfiltered list of all events in calendar. | 92 | Return unfiltered list of all events in calendar. |
93 | */ | 93 | */ |
94 | QPtrList<Event> rawEvents(); | 94 | QPtrList<Event> rawEvents(); |
95 | QPtrList<Event> getExternLastSyncEvents(); | 95 | QPtrList<Event> getExternLastSyncEvents(); |
96 | /** | 96 | /** |
97 | Add a todo to the todolist. | 97 | Add a todo to the todolist. |
98 | */ | 98 | */ |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index dcead02..1a19f3e 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -1,239 +1,245 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | #include <kidmanager.h> | 24 | #include <kidmanager.h> |
25 | 25 | ||
26 | #include "calformat.h" | 26 | #include "calformat.h" |
27 | #include "syncdefines.h" | 27 | #include "syncdefines.h" |
28 | 28 | ||
29 | #include "incidencebase.h" | 29 | #include "incidencebase.h" |
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | IncidenceBase::IncidenceBase() : | 33 | IncidenceBase::IncidenceBase() : |
34 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), | 34 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), |
35 | mPilotId(0), mSyncStatus(SYNCMOD) | 35 | mPilotId(0), mSyncStatus(SYNCMOD) |
36 | { | 36 | { |
37 | blockLastModified = false; | ||
37 | setUid(CalFormat::createUniqueId()); | 38 | setUid(CalFormat::createUniqueId()); |
38 | mOrganizer = ""; | 39 | mOrganizer = ""; |
39 | mFloats = false; | 40 | mFloats = false; |
40 | mDuration = 0; | 41 | mDuration = 0; |
41 | mHasDuration = false; | 42 | mHasDuration = false; |
42 | mPilotId = 0; | 43 | mPilotId = 0; |
43 | mExternalId = ":"; | 44 | mExternalId = ":"; |
44 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 45 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
45 | mSyncStatus = 0; | 46 | mSyncStatus = 0; |
46 | mAttendees.setAutoDelete( true ); | 47 | mAttendees.setAutoDelete( true ); |
47 | mCalEnabled = true; | 48 | mCalEnabled = true; |
48 | mAlarmEnabled = true; | 49 | mAlarmEnabled = true; |
49 | mCalID = 0; | 50 | mCalID = 0; |
50 | } | 51 | } |
51 | 52 | ||
52 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : | 53 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : |
53 | CustomProperties( i ) | 54 | CustomProperties( i ) |
54 | { | 55 | { |
55 | 56 | ||
57 | blockLastModified = false; | ||
56 | mReadOnly = i.mReadOnly; | 58 | mReadOnly = i.mReadOnly; |
57 | mDtStart = i.mDtStart; | 59 | mDtStart = i.mDtStart; |
58 | mDuration = i.mDuration; | 60 | mDuration = i.mDuration; |
59 | mHasDuration = i.mHasDuration; | 61 | mHasDuration = i.mHasDuration; |
60 | mOrganizer = i.mOrganizer; | 62 | mOrganizer = i.mOrganizer; |
61 | mUid = i.mUid; | 63 | mUid = i.mUid; |
62 | mCalEnabled = i.mCalEnabled; | 64 | mCalEnabled = i.mCalEnabled; |
63 | mAlarmEnabled = i.mAlarmEnabled; | 65 | mAlarmEnabled = i.mAlarmEnabled; |
64 | mCalID = i.mCalID; | 66 | mCalID = i.mCalID; |
65 | QPtrList<Attendee> attendees = i.attendees(); | 67 | QPtrList<Attendee> attendees = i.attendees(); |
66 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { | 68 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { |
67 | mAttendees.append( new Attendee( *a ) ); | 69 | mAttendees.append( new Attendee( *a ) ); |
68 | } | 70 | } |
69 | mFloats = i.mFloats; | 71 | mFloats = i.mFloats; |
70 | mLastModified = i.mLastModified; | 72 | mLastModified = i.mLastModified; |
71 | mPilotId = i.mPilotId; | 73 | mPilotId = i.mPilotId; |
72 | mTempSyncStat = i.mTempSyncStat; | 74 | mTempSyncStat = i.mTempSyncStat; |
73 | mSyncStatus = i.mSyncStatus; | 75 | mSyncStatus = i.mSyncStatus; |
74 | mExternalId = i.mExternalId; | 76 | mExternalId = i.mExternalId; |
75 | // The copied object is a new one, so it isn't observed by the observer | 77 | // The copied object is a new one, so it isn't observed by the observer |
76 | // of the original object. | 78 | // of the original object. |
77 | mObservers.clear(); | 79 | mObservers.clear(); |
78 | 80 | ||
79 | mAttendees.setAutoDelete( true ); | 81 | mAttendees.setAutoDelete( true ); |
80 | } | 82 | } |
81 | 83 | ||
82 | IncidenceBase::~IncidenceBase() | 84 | IncidenceBase::~IncidenceBase() |
83 | { | 85 | { |
84 | } | 86 | } |
85 | 87 | ||
86 | 88 | ||
87 | bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) | 89 | bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) |
88 | { | 90 | { |
89 | // do not compare mSyncStatus and mExternalId | 91 | // do not compare mSyncStatus and mExternalId |
90 | if( i1.attendees().count() != i2.attendees().count() ) { | 92 | if( i1.attendees().count() != i2.attendees().count() ) { |
91 | return false; // no need to check further | 93 | return false; // no need to check further |
92 | } | 94 | } |
93 | if ( i1.attendees().count() > 0 ) { | 95 | if ( i1.attendees().count() > 0 ) { |
94 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; | 96 | Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; |
95 | while ( a1 ) { | 97 | while ( a1 ) { |
96 | if ( !( (*a1) == (*a2)) ) | 98 | if ( !( (*a1) == (*a2)) ) |
97 | { | 99 | { |
98 | //qDebug("Attendee not equal "); | 100 | //qDebug("Attendee not equal "); |
99 | return false; | 101 | return false; |
100 | } | 102 | } |
101 | a1 = i1.attendees().next(); | 103 | a1 = i1.attendees().next(); |
102 | a2 = i2.attendees().next(); | 104 | a2 = i2.attendees().next(); |
103 | } | 105 | } |
104 | } | 106 | } |
105 | //if ( i1.dtStart() != i2.dtStart() ) | 107 | //if ( i1.dtStart() != i2.dtStart() ) |
106 | // return false; | 108 | // return false; |
107 | #if 0 | 109 | #if 0 |
108 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); | 110 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); |
109 | qDebug("1 %d ",i1.duration() == i2.duration() ); | 111 | qDebug("1 %d ",i1.duration() == i2.duration() ); |
110 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); | 112 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); |
111 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); | 113 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); |
112 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); | 114 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); |
113 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); | 115 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); |
114 | 116 | ||
115 | #endif | 117 | #endif |
116 | if ( i1.hasDuration() == i2.hasDuration() ) { | 118 | if ( i1.hasDuration() == i2.hasDuration() ) { |
117 | if ( i1.hasDuration() ) { | 119 | if ( i1.hasDuration() ) { |
118 | if ( i1.duration() != i2.duration() ) | 120 | if ( i1.duration() != i2.duration() ) |
119 | return false; | 121 | return false; |
120 | } | 122 | } |
121 | } else { | 123 | } else { |
122 | return false; | 124 | return false; |
123 | } | 125 | } |
124 | 126 | ||
125 | return ( i1.organizer() == i2.organizer() && | 127 | return ( i1.organizer() == i2.organizer() && |
126 | // i1.uid() == i2.uid() && | 128 | // i1.uid() == i2.uid() && |
127 | // Don't compare lastModified, otherwise the operator is not | 129 | // Don't compare lastModified, otherwise the operator is not |
128 | // of much use. We are not comparing for identity, after all. | 130 | // of much use. We are not comparing for identity, after all. |
129 | i1.doesFloat() == i2.doesFloat() && | 131 | i1.doesFloat() == i2.doesFloat() && |
130 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); | 132 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); |
131 | // no need to compare mObserver | 133 | // no need to compare mObserver |
132 | } | 134 | } |
133 | 135 | ||
134 | 136 | ||
135 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) | 137 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) |
136 | { | 138 | { |
137 | QTime t = dt.time(); | 139 | QTime t = dt.time(); |
138 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 140 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
139 | return dt; | 141 | return dt; |
140 | } | 142 | } |
141 | 143 | ||
142 | bool IncidenceBase::isTagged() const | 144 | bool IncidenceBase::isTagged() const |
143 | { | 145 | { |
144 | return mIsTagged; | 146 | return mIsTagged; |
145 | } | 147 | } |
146 | void IncidenceBase::setTagged( bool b) | 148 | void IncidenceBase::setTagged( bool b) |
147 | { | 149 | { |
148 | mIsTagged = b; | 150 | mIsTagged = b; |
149 | } | 151 | } |
150 | void IncidenceBase::setCalID( int id ) | 152 | void IncidenceBase::setCalID( int id ) |
151 | { | 153 | { |
152 | if ( mCalID > 0 ) | 154 | if ( mCalID > 0 ) { |
155 | blockLastModified = true; | ||
153 | updated(); | 156 | updated(); |
157 | blockLastModified = false; | ||
158 | } | ||
154 | mCalID = id; | 159 | mCalID = id; |
155 | } | 160 | } |
156 | int IncidenceBase::calID() const | 161 | int IncidenceBase::calID() const |
157 | { | 162 | { |
158 | return mCalID; | 163 | return mCalID; |
159 | } | 164 | } |
160 | void IncidenceBase::setCalEnabled( bool b ) | 165 | void IncidenceBase::setCalEnabled( bool b ) |
161 | { | 166 | { |
162 | mCalEnabled = b; | 167 | mCalEnabled = b; |
163 | } | 168 | } |
164 | bool IncidenceBase::calEnabled() const | 169 | bool IncidenceBase::calEnabled() const |
165 | { | 170 | { |
166 | return mCalEnabled; | 171 | return mCalEnabled; |
167 | } | 172 | } |
168 | 173 | ||
169 | void IncidenceBase::setAlarmEnabled( bool b ) | 174 | void IncidenceBase::setAlarmEnabled( bool b ) |
170 | { | 175 | { |
171 | mAlarmEnabled = b; | 176 | mAlarmEnabled = b; |
172 | } | 177 | } |
173 | bool IncidenceBase::alarmEnabled() const | 178 | bool IncidenceBase::alarmEnabled() const |
174 | { | 179 | { |
175 | return mAlarmEnabled; | 180 | return mAlarmEnabled; |
176 | } | 181 | } |
177 | 182 | ||
178 | 183 | ||
179 | void IncidenceBase::setUid(const QString &uid) | 184 | void IncidenceBase::setUid(const QString &uid) |
180 | { | 185 | { |
181 | mUid = uid; | 186 | mUid = uid; |
182 | updated(); | 187 | updated(); |
183 | } | 188 | } |
184 | 189 | ||
185 | QString IncidenceBase::uid() const | 190 | QString IncidenceBase::uid() const |
186 | { | 191 | { |
187 | return mUid; | 192 | return mUid; |
188 | } | 193 | } |
189 | 194 | ||
190 | void IncidenceBase::setLastModified(const QDateTime &lm) | 195 | void IncidenceBase::setLastModified(const QDateTime &lm) |
191 | { | 196 | { |
197 | if ( blockLastModified ) return; | ||
192 | // DON'T! updated() because we call this from | 198 | // DON'T! updated() because we call this from |
193 | // Calendar::updateEvent(). | 199 | // Calendar::updateEvent(). |
194 | mLastModified = getEvenTime(lm); | 200 | mLastModified = getEvenTime(lm); |
195 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 201 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
196 | } | 202 | } |
197 | 203 | ||
198 | QDateTime IncidenceBase::lastModified() const | 204 | QDateTime IncidenceBase::lastModified() const |
199 | { | 205 | { |
200 | return mLastModified; | 206 | return mLastModified; |
201 | } | 207 | } |
202 | 208 | ||
203 | void IncidenceBase::setOrganizer(const QString &o) | 209 | void IncidenceBase::setOrganizer(const QString &o) |
204 | { | 210 | { |
205 | // we don't check for readonly here, because it is | 211 | // we don't check for readonly here, because it is |
206 | // possible that by setting the organizer we are changing | 212 | // possible that by setting the organizer we are changing |
207 | // the event's readonly status... | 213 | // the event's readonly status... |
208 | mOrganizer = o; | 214 | mOrganizer = o; |
209 | if (mOrganizer.left(7).upper() == "MAILTO:") | 215 | if (mOrganizer.left(7).upper() == "MAILTO:") |
210 | mOrganizer = mOrganizer.remove(0,7); | 216 | mOrganizer = mOrganizer.remove(0,7); |
211 | 217 | ||
212 | updated(); | 218 | updated(); |
213 | } | 219 | } |
214 | 220 | ||
215 | QString IncidenceBase::organizer() const | 221 | QString IncidenceBase::organizer() const |
216 | { | 222 | { |
217 | return mOrganizer; | 223 | return mOrganizer; |
218 | } | 224 | } |
219 | 225 | ||
220 | void IncidenceBase::setReadOnly( bool readOnly ) | 226 | void IncidenceBase::setReadOnly( bool readOnly ) |
221 | { | 227 | { |
222 | mReadOnly = readOnly; | 228 | mReadOnly = readOnly; |
223 | } | 229 | } |
224 | 230 | ||
225 | void IncidenceBase::setDtStart(const QDateTime &dtStart) | 231 | void IncidenceBase::setDtStart(const QDateTime &dtStart) |
226 | { | 232 | { |
227 | // if (mReadOnly) return; | 233 | // if (mReadOnly) return; |
228 | mDtStart = getEvenTime(dtStart); | 234 | mDtStart = getEvenTime(dtStart); |
229 | updated(); | 235 | updated(); |
230 | } | 236 | } |
231 | 237 | ||
232 | 238 | ||
233 | QDateTime IncidenceBase::dtStart() const | 239 | QDateTime IncidenceBase::dtStart() const |
234 | { | 240 | { |
235 | return mDtStart; | 241 | return mDtStart; |
236 | } | 242 | } |
237 | 243 | ||
238 | QString IncidenceBase::dtStartTimeStr() const | 244 | QString IncidenceBase::dtStartTimeStr() const |
239 | { | 245 | { |
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index bccf287..bed73db 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -105,81 +105,82 @@ class IncidenceBase : public CustomProperties | |||
105 | bool addAttendee(Attendee *a, bool doupdate=true ); | 105 | bool addAttendee(Attendee *a, bool doupdate=true ); |
106 | // void removeAttendee(Attendee *a); | 106 | // void removeAttendee(Attendee *a); |
107 | // void removeAttendee(const char *n); | 107 | // void removeAttendee(const char *n); |
108 | /** Remove all Attendees. */ | 108 | /** Remove all Attendees. */ |
109 | void clearAttendees(); | 109 | void clearAttendees(); |
110 | /** Return list of attendees. */ | 110 | /** Return list of attendees. */ |
111 | QPtrList<Attendee> attendees() const { return mAttendees; }; | 111 | QPtrList<Attendee> attendees() const { return mAttendees; }; |
112 | /** Return number of attendees. */ | 112 | /** Return number of attendees. */ |
113 | int attendeeCount() const { return mAttendees.count(); }; | 113 | int attendeeCount() const { return mAttendees.count(); }; |
114 | /** Return the Attendee with this email */ | 114 | /** Return the Attendee with this email */ |
115 | Attendee* attendeeByMail(const QString &); | 115 | Attendee* attendeeByMail(const QString &); |
116 | /** Return first Attendee with one of this emails */ | 116 | /** Return first Attendee with one of this emails */ |
117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); | 117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); |
118 | 118 | ||
119 | /** pilot syncronization states */ | 119 | /** pilot syncronization states */ |
120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; | 120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; |
121 | /** Set synchronisation satus. */ | 121 | /** Set synchronisation satus. */ |
122 | void setSyncStatus(int stat); | 122 | void setSyncStatus(int stat); |
123 | /** Return synchronisation status. */ | 123 | /** Return synchronisation status. */ |
124 | int syncStatus() const; | 124 | int syncStatus() const; |
125 | 125 | ||
126 | /** Set Pilot Id. */ | 126 | /** Set Pilot Id. */ |
127 | void setPilotId(int id); | 127 | void setPilotId(int id); |
128 | /** Return Pilot Id. */ | 128 | /** Return Pilot Id. */ |
129 | int pilotId() const; | 129 | int pilotId() const; |
130 | 130 | ||
131 | void setTempSyncStat(int id); | 131 | void setTempSyncStat(int id); |
132 | int tempSyncStat() const; | 132 | int tempSyncStat() const; |
133 | void setIDStr( const QString & ); | 133 | void setIDStr( const QString & ); |
134 | QString IDStr() const; | 134 | QString IDStr() const; |
135 | void setID( const QString &, const QString & ); | 135 | void setID( const QString &, const QString & ); |
136 | QString getID( const QString & ); | 136 | QString getID( const QString & ); |
137 | void setCsum( const QString &, const QString & ); | 137 | void setCsum( const QString &, const QString & ); |
138 | QString getCsum( const QString & ); | 138 | QString getCsum( const QString & ); |
139 | void removeID(const QString &); | 139 | void removeID(const QString &); |
140 | 140 | ||
141 | void registerObserver( Observer * ); | 141 | void registerObserver( Observer * ); |
142 | void unRegisterObserver( Observer * ); | 142 | void unRegisterObserver( Observer * ); |
143 | void updated(); | 143 | void updated(); |
144 | void setCalID( int id ); | 144 | void setCalID( int id ); |
145 | int calID() const; | 145 | int calID() const; |
146 | void setCalEnabled( bool ); | 146 | void setCalEnabled( bool ); |
147 | bool calEnabled() const; | 147 | bool calEnabled() const; |
148 | void setAlarmEnabled( bool ); | 148 | void setAlarmEnabled( bool ); |
149 | bool alarmEnabled() const; | 149 | bool alarmEnabled() const; |
150 | bool isTagged() const; | 150 | bool isTagged() const; |
151 | void setTagged( bool ); | 151 | void setTagged( bool ); |
152 | protected: | 152 | protected: |
153 | bool blockLastModified; | ||
153 | bool mIsTagged; | 154 | bool mIsTagged; |
154 | QDateTime mDtStart; | 155 | QDateTime mDtStart; |
155 | bool mReadOnly; | 156 | bool mReadOnly; |
156 | QDateTime getEvenTime( QDateTime ); | 157 | QDateTime getEvenTime( QDateTime ); |
157 | 158 | ||
158 | private: | 159 | private: |
159 | // base components | 160 | // base components |
160 | QString mOrganizer; | 161 | QString mOrganizer; |
161 | QString mUid; | 162 | QString mUid; |
162 | int mCalID; | 163 | int mCalID; |
163 | bool mCalEnabled; | 164 | bool mCalEnabled; |
164 | bool mAlarmEnabled; | 165 | bool mAlarmEnabled; |
165 | QDateTime mLastModified; | 166 | QDateTime mLastModified; |
166 | QPtrList<Attendee> mAttendees; | 167 | QPtrList<Attendee> mAttendees; |
167 | 168 | ||
168 | bool mFloats; | 169 | bool mFloats; |
169 | 170 | ||
170 | int mDuration; | 171 | int mDuration; |
171 | bool mHasDuration; | 172 | bool mHasDuration; |
172 | QString mExternalId; | 173 | QString mExternalId; |
173 | int mTempSyncStat; | 174 | int mTempSyncStat; |
174 | 175 | ||
175 | // PILOT SYNCHRONIZATION STUFF | 176 | // PILOT SYNCHRONIZATION STUFF |
176 | int mPilotId; // unique id for pilot sync | 177 | int mPilotId; // unique id for pilot sync |
177 | int mSyncStatus; // status (for sync) | 178 | int mSyncStatus; // status (for sync) |
178 | 179 | ||
179 | QPtrList<Observer> mObservers; | 180 | QPtrList<Observer> mObservers; |
180 | }; | 181 | }; |
181 | 182 | ||
182 | bool operator==( const IncidenceBase&, const IncidenceBase& ); | 183 | bool operator==( const IncidenceBase&, const IncidenceBase& ); |
183 | } | 184 | } |
184 | 185 | ||
185 | #endif | 186 | #endif |