author | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
commit | 9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (unidiff) | |
tree | 549192e9e27e8972e2b48cf40e1599118df12da5 | |
parent | 055928e26613f4ab249bd82be86890ed278372f6 (diff) | |
download | kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.zip kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.gz kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendar.cpp | 42 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 26 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 6 | ||||
-rw-r--r-- | libkcal/incidence.h | 1 |
6 files changed, 50 insertions, 27 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index b7990d4..b1806ee 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -65,99 +65,118 @@ void Calendar::init() | |||
65 | // even that good of one at that. | 65 | // even that good of one at that. |
66 | // srandom(time(0)); | 66 | // srandom(time(0)); |
67 | 67 | ||
68 | // user information... | 68 | // user information... |
69 | setOwner(i18n("Unknown Name")); | 69 | setOwner(i18n("Unknown Name")); |
70 | setEmail(i18n("unknown@nowhere")); | 70 | setEmail(i18n("unknown@nowhere")); |
71 | 71 | ||
72 | #if 0 | 72 | #if 0 |
73 | tmpStr = KOPrefs::instance()->mTimeZone; | 73 | tmpStr = KOPrefs::instance()->mTimeZone; |
74 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; | 74 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; |
75 | int dstSetting = KOPrefs::instance()->mDaylightSavings; | 75 | int dstSetting = KOPrefs::instance()->mDaylightSavings; |
76 | extern long int timezone; | 76 | extern long int timezone; |
77 | struct tm *now; | 77 | struct tm *now; |
78 | time_t curtime; | 78 | time_t curtime; |
79 | curtime = time(0); | 79 | curtime = time(0); |
80 | now = localtime(&curtime); | 80 | now = localtime(&curtime); |
81 | int hourOff = - ((timezone / 60) / 60); | 81 | int hourOff = - ((timezone / 60) / 60); |
82 | if (now->tm_isdst) | 82 | if (now->tm_isdst) |
83 | hourOff += 1; | 83 | hourOff += 1; |
84 | QString tzStr; | 84 | QString tzStr; |
85 | tzStr.sprintf("%.2d%.2d", | 85 | tzStr.sprintf("%.2d%.2d", |
86 | hourOff, | 86 | hourOff, |
87 | abs((timezone / 60) % 60)); | 87 | abs((timezone / 60) % 60)); |
88 | 88 | ||
89 | // if no time zone was in the config file, write what we just discovered. | 89 | // if no time zone was in the config file, write what we just discovered. |
90 | if (tmpStr.isEmpty()) { | 90 | if (tmpStr.isEmpty()) { |
91 | // KOPrefs::instance()->mTimeZone = tzStr; | 91 | // KOPrefs::instance()->mTimeZone = tzStr; |
92 | } else { | 92 | } else { |
93 | tzStr = tmpStr; | 93 | tzStr = tmpStr; |
94 | } | 94 | } |
95 | 95 | ||
96 | // if daylight savings has changed since last load time, we need | 96 | // if daylight savings has changed since last load time, we need |
97 | // to rewrite these settings to the config file. | 97 | // to rewrite these settings to the config file. |
98 | if ((now->tm_isdst && !dstSetting) || | 98 | if ((now->tm_isdst && !dstSetting) || |
99 | (!now->tm_isdst && dstSetting)) { | 99 | (!now->tm_isdst && dstSetting)) { |
100 | KOPrefs::instance()->mTimeZone = tzStr; | 100 | KOPrefs::instance()->mTimeZone = tzStr; |
101 | KOPrefs::instance()->mDaylightSavings = now->tm_isdst; | 101 | KOPrefs::instance()->mDaylightSavings = now->tm_isdst; |
102 | } | 102 | } |
103 | 103 | ||
104 | setTimeZone(tzStr); | 104 | setTimeZone(tzStr); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | // KOPrefs::instance()->writeConfig(); | 107 | // KOPrefs::instance()->writeConfig(); |
108 | } | 108 | } |
109 | 109 | ||
110 | Calendar::~Calendar() | 110 | Calendar::~Calendar() |
111 | { | 111 | { |
112 | delete mDefaultFilter; | 112 | delete mDefaultFilter; |
113 | if ( mUndoIncidence ) | 113 | clearUndo( 0 ); |
114 | delete mUndoIncidence; | 114 | } |
115 | } | 115 | void Calendar::clearUndo( Incidence * newUndo ) |
116 | { | ||
117 | |||
118 | if ( mUndoIncidence ) { | ||
119 | if ( mUndoIncidence->typeID() == eventID ) | ||
120 | delete ((Event*) mUndoIncidence) ; | ||
121 | else if ( mUndoIncidence->typeID() == todoID ) | ||
122 | delete ( (Todo*) mUndoIncidence ); | ||
123 | else if ( mUndoIncidence->typeID() == journalID ) | ||
124 | delete ( (Journal*) mUndoIncidence ); | ||
125 | else | ||
126 | delete mUndoIncidence; | ||
127 | } | ||
128 | mUndoIncidence = newUndo; | ||
129 | if ( mUndoIncidence ) { | ||
130 | mUndoIncidence->clearRelations(); | ||
131 | } | ||
132 | |||
133 | } | ||
134 | |||
116 | void Calendar::setDontDeleteIncidencesOnClose () | 135 | void Calendar::setDontDeleteIncidencesOnClose () |
117 | { | 136 | { |
118 | mDeleteIncidencesOnClose = false; | 137 | mDeleteIncidencesOnClose = false; |
119 | } | 138 | } |
120 | void Calendar::setDefaultCalendar( int d ) | 139 | void Calendar::setDefaultCalendar( int d ) |
121 | { | 140 | { |
122 | mDefaultCalendar = d; | 141 | mDefaultCalendar = d; |
123 | } | 142 | } |
124 | int Calendar::defaultCalendar() | 143 | int Calendar::defaultCalendar() |
125 | { | 144 | { |
126 | return mDefaultCalendar; | 145 | return mDefaultCalendar; |
127 | } | 146 | } |
128 | const QString &Calendar::getOwner() const | 147 | const QString &Calendar::getOwner() const |
129 | { | 148 | { |
130 | return mOwner; | 149 | return mOwner; |
131 | } | 150 | } |
132 | 151 | ||
133 | bool Calendar::undoDeleteIncidence() | 152 | bool Calendar::undoDeleteIncidence() |
134 | { | 153 | { |
135 | if (!mUndoIncidence) | 154 | if (!mUndoIncidence) |
136 | return false; | 155 | return false; |
137 | addIncidence(mUndoIncidence); | 156 | addIncidence(mUndoIncidence); |
138 | mUndoIncidence = 0; | 157 | mUndoIncidence = 0; |
139 | return true; | 158 | return true; |
140 | } | 159 | } |
141 | void Calendar::setOwner(const QString &os) | 160 | void Calendar::setOwner(const QString &os) |
142 | { | 161 | { |
143 | int i; | 162 | int i; |
144 | mOwner = os; | 163 | mOwner = os; |
145 | i = mOwner.find(','); | 164 | i = mOwner.find(','); |
146 | if (i != -1) | 165 | if (i != -1) |
147 | mOwner = mOwner.left(i); | 166 | mOwner = mOwner.left(i); |
148 | 167 | ||
149 | setModified( true ); | 168 | setModified( true ); |
150 | } | 169 | } |
151 | 170 | ||
152 | void Calendar::setTimeZone(const QString & tz) | 171 | void Calendar::setTimeZone(const QString & tz) |
153 | { | 172 | { |
154 | bool neg = FALSE; | 173 | bool neg = FALSE; |
155 | int hours, minutes; | 174 | int hours, minutes; |
156 | QString tmpStr(tz); | 175 | QString tmpStr(tz); |
157 | 176 | ||
158 | if (tmpStr.left(1) == "-") | 177 | if (tmpStr.left(1) == "-") |
159 | neg = TRUE; | 178 | neg = TRUE; |
160 | if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+") | 179 | if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+") |
161 | tmpStr.remove(0, 1); | 180 | tmpStr.remove(0, 1); |
162 | hours = tmpStr.left(2).toInt(); | 181 | hours = tmpStr.left(2).toInt(); |
163 | if (tmpStr.length() > 2) | 182 | if (tmpStr.length() > 2) |
@@ -402,88 +421,103 @@ void Calendar::setupRelations( Incidence *incidence ) | |||
402 | { | 421 | { |
403 | QString uid = incidence->uid(); | 422 | QString uid = incidence->uid(); |
404 | //qDebug("Calendar::setupRelations "); | 423 | //qDebug("Calendar::setupRelations "); |
405 | // First, go over the list of orphans and see if this is their parent | 424 | // First, go over the list of orphans and see if this is their parent |
406 | while( Incidence* i = mOrphans[ uid ] ) { | 425 | while( Incidence* i = mOrphans[ uid ] ) { |
407 | mOrphans.remove( uid ); | 426 | mOrphans.remove( uid ); |
408 | i->setRelatedTo( incidence ); | 427 | i->setRelatedTo( incidence ); |
409 | incidence->addRelation( i ); | 428 | incidence->addRelation( i ); |
410 | mOrphanUids.remove( i->uid() ); | 429 | mOrphanUids.remove( i->uid() ); |
411 | } | 430 | } |
412 | 431 | ||
413 | // Now see about this incidences parent | 432 | // Now see about this incidences parent |
414 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { | 433 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { |
415 | // This incidence has a uid it is related to, but is not registered to it yet | 434 | // This incidence has a uid it is related to, but is not registered to it yet |
416 | // Try to find it | 435 | // Try to find it |
417 | Incidence* parent = this->incidence( incidence->relatedToUid() ); | 436 | Incidence* parent = this->incidence( incidence->relatedToUid() ); |
418 | if( parent ) { | 437 | if( parent ) { |
419 | // Found it | 438 | // Found it |
420 | incidence->setRelatedTo( parent ); | 439 | incidence->setRelatedTo( parent ); |
421 | parent->addRelation( incidence ); | 440 | parent->addRelation( incidence ); |
422 | } else { | 441 | } else { |
423 | // Not found, put this in the mOrphans list | 442 | // Not found, put this in the mOrphans list |
424 | mOrphans.insert( incidence->relatedToUid(), incidence ); | 443 | mOrphans.insert( incidence->relatedToUid(), incidence ); |
425 | mOrphanUids.insert( incidence->uid(), incidence ); | 444 | mOrphanUids.insert( incidence->uid(), incidence ); |
426 | } | 445 | } |
427 | } | 446 | } |
428 | } | 447 | } |
429 | 448 | ||
430 | // If a task with subtasks is deleted, move it's subtasks to the orphans list | 449 | // If a task with subtasks is deleted, move it's subtasks to the orphans list |
431 | void Calendar::removeRelations( Incidence *incidence ) | 450 | void Calendar::removeRelations( Incidence *incidence ) |
432 | { | 451 | { |
433 | // qDebug("Calendar::removeRelations "); | 452 | // qDebug("Calendar::removeRelations "); |
434 | QString uid = incidence->uid(); | 453 | QString uid = incidence->uid(); |
435 | 454 | ||
436 | QPtrList<Incidence> relations = incidence->relations(); | 455 | QPtrList<Incidence> relations = incidence->relations(); |
437 | for( Incidence* i = relations.first(); i; i = relations.next() ) | 456 | for( Incidence* i = relations.first(); i; i = relations.next() ) |
438 | if( !mOrphanUids.find( i->uid() ) ) { | 457 | if( !mOrphanUids.find( i->uid() ) ) { |
439 | mOrphans.insert( uid, i ); | 458 | mOrphans.insert( uid, i ); |
440 | mOrphanUids.insert( i->uid(), i ); | 459 | mOrphanUids.insert( i->uid(), i ); |
441 | i->setRelatedTo( 0 ); | 460 | i->setRelatedTo( 0 ); |
442 | i->setRelatedToUid( uid ); | 461 | i->setRelatedToUid( uid ); |
443 | } | 462 | } |
444 | 463 | ||
445 | // If this incidence is related to something else, tell that about it | 464 | // If this incidence is related to something else, tell that about it |
446 | if( incidence->relatedTo() ) | 465 | if( incidence->relatedTo() ) |
447 | incidence->relatedTo()->removeRelation( incidence ); | 466 | incidence->relatedTo()->removeRelation( incidence ); |
448 | 467 | ||
449 | // Remove this one from the orphans list | 468 | // Remove this one from the orphans list |
450 | if( mOrphanUids.remove( uid ) ) | 469 | if( mOrphanUids.remove( uid ) ) { |
470 | QString r2uid = incidence->relatedToUid(); | ||
471 | QPtrList<Incidence> tempList; | ||
472 | while( Incidence* i = mOrphans[ r2uid ] ) { | ||
473 | mOrphans.remove( r2uid ); | ||
474 | if ( i != incidence ) tempList.append( i ); | ||
475 | } | ||
476 | Incidence* inc = tempList.first(); | ||
477 | while ( inc ) { | ||
478 | mOrphans.insert( r2uid, inc ); | ||
479 | inc = tempList.next(); | ||
480 | } | ||
481 | } | ||
482 | // LR: and another big bad bug found | ||
483 | #if 0 | ||
451 | // This incidence is located in the orphans list - it should be removed | 484 | // This incidence is located in the orphans list - it should be removed |
452 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { | 485 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { |
453 | // Removing wasn't that easy | 486 | // Removing wasn't that easy |
454 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { | 487 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { |
455 | if( it.current()->uid() == uid ) { | 488 | if( it.current()->uid() == uid ) { |
456 | mOrphans.remove( it.currentKey() ); | 489 | mOrphans.remove( it.currentKey() ); |
457 | break; | 490 | break; |
458 | } | 491 | } |
459 | } | 492 | } |
460 | } | 493 | } |
494 | #endif | ||
461 | } | 495 | } |
462 | 496 | ||
463 | void Calendar::registerObserver( Observer *observer ) | 497 | void Calendar::registerObserver( Observer *observer ) |
464 | { | 498 | { |
465 | mObserver = observer; | 499 | mObserver = observer; |
466 | mNewObserver = true; | 500 | mNewObserver = true; |
467 | } | 501 | } |
468 | 502 | ||
469 | void Calendar::setModified( bool modified ) | 503 | void Calendar::setModified( bool modified ) |
470 | { | 504 | { |
471 | if ( mObserver ) mObserver->calendarModified( modified, this ); | 505 | if ( mObserver ) mObserver->calendarModified( modified, this ); |
472 | if ( modified != mModified || mNewObserver ) { | 506 | if ( modified != mModified || mNewObserver ) { |
473 | mNewObserver = false; | 507 | mNewObserver = false; |
474 | // if ( mObserver ) mObserver->calendarModified( modified, this ); | 508 | // if ( mObserver ) mObserver->calendarModified( modified, this ); |
475 | mModified = modified; | 509 | mModified = modified; |
476 | } | 510 | } |
477 | } | 511 | } |
478 | 512 | ||
479 | void Calendar::setLoadedProductId( const QString &id ) | 513 | void Calendar::setLoadedProductId( const QString &id ) |
480 | { | 514 | { |
481 | mLoadedProductId = id; | 515 | mLoadedProductId = id; |
482 | } | 516 | } |
483 | 517 | ||
484 | QString Calendar::loadedProductId() | 518 | QString Calendar::loadedProductId() |
485 | { | 519 | { |
486 | return mLoadedProductId; | 520 | return mLoadedProductId; |
487 | } | 521 | } |
488 | 522 | ||
489 | //#include "calendar.moc" | 523 | //#include "calendar.moc" |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 95477cd..3f6895d 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -35,96 +35,97 @@ | |||
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 Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0; |
81 | virtual void setSyncEventsReadOnly() = 0; | 81 | virtual void setSyncEventsReadOnly() = 0; |
82 | virtual void stopAllTodos() = 0; | 82 | virtual void stopAllTodos() = 0; |
83 | virtual void clearUndo( Incidence * newUndo ); | ||
83 | 84 | ||
84 | /** | 85 | /** |
85 | Sync changes in memory to persistant storage. | 86 | Sync changes in memory to persistant storage. |
86 | */ | 87 | */ |
87 | virtual void save() = 0; | 88 | virtual void save() = 0; |
88 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 89 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
89 | virtual void removeSyncInfo( QString syncProfile) = 0; | 90 | virtual void removeSyncInfo( QString syncProfile) = 0; |
90 | virtual bool isSaving() { return false; } | 91 | virtual bool isSaving() { return false; } |
91 | 92 | ||
92 | /** | 93 | /** |
93 | Return the owner of the calendar's full name. | 94 | Return the owner of the calendar's full name. |
94 | */ | 95 | */ |
95 | const QString &getOwner() const; | 96 | const QString &getOwner() const; |
96 | /** | 97 | /** |
97 | Set the owner of the calendar. Should be owner's full name. | 98 | Set the owner of the calendar. Should be owner's full name. |
98 | */ | 99 | */ |
99 | void setOwner( const QString &os ); | 100 | void setOwner( const QString &os ); |
100 | /** | 101 | /** |
101 | Return the email address of the calendar owner. | 102 | Return the email address of the calendar owner. |
102 | */ | 103 | */ |
103 | const QString &getEmail(); | 104 | const QString &getEmail(); |
104 | /** | 105 | /** |
105 | Set the email address of the calendar owner. | 106 | Set the email address of the calendar owner. |
106 | */ | 107 | */ |
107 | void setEmail( const QString & ); | 108 | void setEmail( const QString & ); |
108 | 109 | ||
109 | /** | 110 | /** |
110 | Set time zone from a timezone string (e.g. -2:00) | 111 | Set time zone from a timezone string (e.g. -2:00) |
111 | */ | 112 | */ |
112 | void setTimeZone( const QString &tz ); | 113 | void setTimeZone( const QString &tz ); |
113 | /** | 114 | /** |
114 | Set time zone from a minutes value (e.g. -60) | 115 | Set time zone from a minutes value (e.g. -60) |
115 | */ | 116 | */ |
116 | void setTimeZone( int tz ); | 117 | void setTimeZone( int tz ); |
117 | /** | 118 | /** |
118 | Return time zone as offest in minutes. | 119 | Return time zone as offest in minutes. |
119 | */ | 120 | */ |
120 | int getTimeZone() const; | 121 | int getTimeZone() const; |
121 | /** | 122 | /** |
122 | Compute an ISO 8601 format string from the time zone. | 123 | Compute an ISO 8601 format string from the time zone. |
123 | */ | 124 | */ |
124 | QString getTimeZoneStr() const; | 125 | QString getTimeZoneStr() const; |
125 | /** | 126 | /** |
126 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal | 127 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal |
127 | values). | 128 | values). |
128 | */ | 129 | */ |
129 | void setTimeZoneId( const QString & ); | 130 | void setTimeZoneId( const QString & ); |
130 | /** | 131 | /** |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e8c969f..1a1c6be 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -223,226 +223,211 @@ void CalendarLocal::addCalendar( Calendar* cal ) | |||
223 | Journal * ev = JournalList.first(); | 223 | Journal * ev = JournalList.first(); |
224 | while ( ev ) { | 224 | while ( ev ) { |
225 | ev->unRegisterObserver( cal ); | 225 | ev->unRegisterObserver( cal ); |
226 | ev->registerObserver( this ); | 226 | ev->registerObserver( this ); |
227 | mJournalList.append( ev ); | 227 | mJournalList.append( ev ); |
228 | ev = JournalList.next(); | 228 | ev = JournalList.next(); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | setModified( true ); | 231 | setModified( true ); |
232 | } | 232 | } |
233 | bool CalendarLocal::load( const QString &fileName ) | 233 | bool CalendarLocal::load( const QString &fileName ) |
234 | { | 234 | { |
235 | FileStorage storage( this, fileName ); | 235 | FileStorage storage( this, fileName ); |
236 | return storage.load(); | 236 | return storage.load(); |
237 | } | 237 | } |
238 | 238 | ||
239 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | 239 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) |
240 | { | 240 | { |
241 | FileStorage storage( this, fileName, format ); | 241 | FileStorage storage( this, fileName, format ); |
242 | return storage.save(); | 242 | return storage.save(); |
243 | } | 243 | } |
244 | 244 | ||
245 | void CalendarLocal::stopAllTodos() | 245 | void CalendarLocal::stopAllTodos() |
246 | { | 246 | { |
247 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 247 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
248 | it->setRunning( false ); | 248 | it->setRunning( false ); |
249 | 249 | ||
250 | } | 250 | } |
251 | void CalendarLocal::close() | 251 | void CalendarLocal::close() |
252 | { | 252 | { |
253 | 253 | ||
254 | Todo * i; | 254 | Todo * i; |
255 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); | 255 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); |
256 | 256 | ||
257 | mEventList.setAutoDelete( true ); | 257 | mEventList.setAutoDelete( true ); |
258 | mTodoList.setAutoDelete( true ); | 258 | mTodoList.setAutoDelete( true ); |
259 | mJournalList.setAutoDelete( true ); | 259 | mJournalList.setAutoDelete( true ); |
260 | 260 | ||
261 | mEventList.clear(); | 261 | mEventList.clear(); |
262 | mTodoList.clear(); | 262 | mTodoList.clear(); |
263 | mJournalList.clear(); | 263 | mJournalList.clear(); |
264 | 264 | ||
265 | mEventList.setAutoDelete( false ); | 265 | mEventList.setAutoDelete( false ); |
266 | mTodoList.setAutoDelete( false ); | 266 | mTodoList.setAutoDelete( false ); |
267 | mJournalList.setAutoDelete( false ); | 267 | mJournalList.setAutoDelete( false ); |
268 | 268 | ||
269 | setModified( false ); | 269 | setModified( false ); |
270 | } | 270 | } |
271 | void CalendarLocal::clearUndo() | 271 | |
272 | { | ||
273 | if ( mUndoIncidence ) { | ||
274 | if ( mUndoIncidence->typeID() == eventID ) | ||
275 | delete ((Event*) mUndoIncidence) ; | ||
276 | else if ( mUndoIncidence->typeID() == todoID ) | ||
277 | delete ( (Todo*) mUndoIncidence ); | ||
278 | else if ( mUndoIncidence->typeID() == journalID ) | ||
279 | delete ( (Journal*) mUndoIncidence ); | ||
280 | else | ||
281 | delete mUndoIncidence; | ||
282 | } | ||
283 | mUndoIncidence = 0; | ||
284 | } | ||
285 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) | 272 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) |
286 | { | 273 | { |
287 | QString cat; | 274 | QString cat; |
288 | bool isBirthday = true; | 275 | bool isBirthday = true; |
289 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { | 276 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { |
290 | isBirthday = false; | 277 | isBirthday = false; |
291 | cat = i18n( "Anniversary" ); | 278 | cat = i18n( "Anniversary" ); |
292 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { | 279 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { |
293 | isBirthday = true; | 280 | isBirthday = true; |
294 | cat = i18n( "Birthday" ); | 281 | cat = i18n( "Birthday" ); |
295 | } else { | 282 | } else { |
296 | qDebug("addAnniversaryNoDup called without fitting category! "); | 283 | qDebug("addAnniversaryNoDup called without fitting category! "); |
297 | return false; | 284 | return false; |
298 | } | 285 | } |
299 | Event * eve; | 286 | Event * eve; |
300 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 287 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
301 | if ( !(eve->categories().contains( cat ) )) | 288 | if ( !(eve->categories().contains( cat ) )) |
302 | continue; | 289 | continue; |
303 | // now we have an event with fitting category | 290 | // now we have an event with fitting category |
304 | if ( eve->dtStart().date() != event->dtStart().date() ) | 291 | if ( eve->dtStart().date() != event->dtStart().date() ) |
305 | continue; | 292 | continue; |
306 | // now we have an event with fitting category+date | 293 | // now we have an event with fitting category+date |
307 | if ( eve->summary() != event->summary() ) | 294 | if ( eve->summary() != event->summary() ) |
308 | continue; | 295 | continue; |
309 | // now we have an event with fitting category+date+summary | 296 | // now we have an event with fitting category+date+summary |
310 | return false; | 297 | return false; |
311 | } | 298 | } |
312 | return addEvent( event ); | 299 | return addEvent( event ); |
313 | 300 | ||
314 | } | 301 | } |
315 | bool CalendarLocal::addEventNoDup( Event *event ) | 302 | bool CalendarLocal::addEventNoDup( Event *event ) |
316 | { | 303 | { |
317 | Event * eve; | 304 | Event * eve; |
318 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 305 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
319 | if ( *eve == *event ) { | 306 | if ( *eve == *event ) { |
320 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); | 307 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); |
321 | return false; | 308 | return false; |
322 | } | 309 | } |
323 | } | 310 | } |
324 | return addEvent( event ); | 311 | return addEvent( event ); |
325 | } | 312 | } |
326 | 313 | ||
327 | bool CalendarLocal::addEvent( Event *event ) | 314 | bool CalendarLocal::addEvent( Event *event ) |
328 | { | 315 | { |
329 | insertEvent( event ); | 316 | insertEvent( event ); |
330 | 317 | ||
331 | event->registerObserver( this ); | 318 | event->registerObserver( this ); |
332 | 319 | ||
333 | setModified( true ); | 320 | setModified( true ); |
334 | if ( event->calID() == 0 ) | 321 | if ( event->calID() == 0 ) |
335 | event->setCalID( mDefaultCalendar ); | 322 | event->setCalID( mDefaultCalendar ); |
336 | event->setCalEnabled( true ); | 323 | event->setCalEnabled( true ); |
337 | 324 | ||
338 | return true; | 325 | return true; |
339 | } | 326 | } |
340 | 327 | ||
341 | void CalendarLocal::deleteEvent( Event *event ) | 328 | void CalendarLocal::deleteEvent( Event *event ) |
342 | { | 329 | { |
343 | clearUndo(); | 330 | clearUndo(event); |
344 | mUndoIncidence = event; | ||
345 | if ( mEventList.removeRef( event ) ) { | 331 | if ( mEventList.removeRef( event ) ) { |
346 | setModified( true ); | 332 | setModified( true ); |
347 | } | 333 | } |
348 | } | 334 | } |
349 | 335 | ||
350 | 336 | ||
351 | Event *CalendarLocal::event( const QString &uid ) | 337 | Event *CalendarLocal::event( const QString &uid ) |
352 | { | 338 | { |
353 | Event *event; | 339 | Event *event; |
354 | Event *retVal = 0; | 340 | Event *retVal = 0; |
355 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 341 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
356 | if ( event->calEnabled() && event->uid() == uid ) { | 342 | if ( event->calEnabled() && event->uid() == uid ) { |
357 | if ( retVal ) { | 343 | if ( retVal ) { |
358 | if ( retVal->calID() > event->calID() ) { | 344 | if ( retVal->calID() > event->calID() ) { |
359 | retVal = event; | 345 | retVal = event; |
360 | } | 346 | } |
361 | } else { | 347 | } else { |
362 | retVal = event; | 348 | retVal = event; |
363 | } | 349 | } |
364 | } | 350 | } |
365 | } | 351 | } |
366 | return retVal; | 352 | return retVal; |
367 | } | 353 | } |
368 | bool CalendarLocal::addTodoNoDup( Todo *todo ) | 354 | bool CalendarLocal::addTodoNoDup( Todo *todo ) |
369 | { | 355 | { |
370 | Todo * eve; | 356 | Todo * eve; |
371 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { | 357 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { |
372 | if ( *eve == *todo ) { | 358 | if ( *eve == *todo ) { |
373 | //qDebug("duplicate todo found! not inserted! "); | 359 | //qDebug("duplicate todo found! not inserted! "); |
374 | return false; | 360 | return false; |
375 | } | 361 | } |
376 | } | 362 | } |
377 | return addTodo( todo ); | 363 | return addTodo( todo ); |
378 | } | 364 | } |
379 | bool CalendarLocal::addTodo( Todo *todo ) | 365 | bool CalendarLocal::addTodo( Todo *todo ) |
380 | { | 366 | { |
381 | mTodoList.append( todo ); | 367 | mTodoList.append( todo ); |
382 | 368 | ||
383 | todo->registerObserver( this ); | 369 | todo->registerObserver( this ); |
384 | 370 | ||
385 | // Set up subtask relations | 371 | // Set up subtask relations |
386 | setupRelations( todo ); | 372 | setupRelations( todo ); |
387 | 373 | ||
388 | setModified( true ); | 374 | setModified( true ); |
389 | if ( todo->calID() == 0 ) | 375 | if ( todo->calID() == 0 ) |
390 | todo->setCalID( mDefaultCalendar ); | 376 | todo->setCalID( mDefaultCalendar ); |
391 | todo->setCalEnabled( true ); | 377 | todo->setCalEnabled( true ); |
392 | return true; | 378 | return true; |
393 | } | 379 | } |
394 | 380 | ||
395 | void CalendarLocal::deleteTodo( Todo *todo ) | 381 | void CalendarLocal::deleteTodo( Todo *todo ) |
396 | { | 382 | { |
397 | // Handle orphaned children | 383 | // Handle orphaned children |
398 | clearUndo(); | ||
399 | removeRelations( todo ); | 384 | removeRelations( todo ); |
400 | mUndoIncidence = todo; | 385 | clearUndo(todo); |
401 | 386 | ||
402 | if ( mTodoList.removeRef( todo ) ) { | 387 | if ( mTodoList.removeRef( todo ) ) { |
403 | setModified( true ); | 388 | setModified( true ); |
404 | } | 389 | } |
405 | } | 390 | } |
406 | 391 | ||
407 | QPtrList<Todo> CalendarLocal::rawTodos() | 392 | QPtrList<Todo> CalendarLocal::rawTodos() |
408 | { | 393 | { |
409 | QPtrList<Todo> el; | 394 | QPtrList<Todo> el; |
410 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 395 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
411 | if ( it->calEnabled() ) el.append( it ); | 396 | if ( it->calEnabled() ) el.append( it ); |
412 | return el; | 397 | return el; |
413 | } | 398 | } |
414 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 399 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
415 | { | 400 | { |
416 | Todo *todo; | 401 | Todo *todo; |
417 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 402 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
418 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 403 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
419 | } | 404 | } |
420 | 405 | ||
421 | return 0; | 406 | return 0; |
422 | } | 407 | } |
423 | void CalendarLocal::removeSyncInfo( QString syncProfile) | 408 | void CalendarLocal::removeSyncInfo( QString syncProfile) |
424 | { | 409 | { |
425 | QPtrList<Incidence> all = rawIncidences() ; | 410 | QPtrList<Incidence> all = rawIncidences() ; |
426 | Incidence *inc; | 411 | Incidence *inc; |
427 | for ( inc = all.first(); inc; inc = all.next() ) { | 412 | for ( inc = all.first(); inc; inc = all.next() ) { |
428 | inc->removeID( syncProfile ); | 413 | inc->removeID( syncProfile ); |
429 | } | 414 | } |
430 | if ( syncProfile.isEmpty() ) { | 415 | if ( syncProfile.isEmpty() ) { |
431 | QPtrList<Event> el; | 416 | QPtrList<Event> el; |
432 | Event *todo; | 417 | Event *todo; |
433 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 418 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
434 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 419 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
435 | el.append( todo ); | 420 | el.append( todo ); |
436 | } | 421 | } |
437 | for ( todo = el.first(); todo; todo = el.next() ) { | 422 | for ( todo = el.first(); todo; todo = el.next() ) { |
438 | deleteIncidence ( todo ); | 423 | deleteIncidence ( todo ); |
439 | } | 424 | } |
440 | } else { | 425 | } else { |
441 | Event *lse = event( "last-syncEvent-"+ syncProfile); | 426 | Event *lse = event( "last-syncEvent-"+ syncProfile); |
442 | if ( lse ) | 427 | if ( lse ) |
443 | deleteIncidence ( lse ); | 428 | deleteIncidence ( lse ); |
444 | } | 429 | } |
445 | } | 430 | } |
446 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 431 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
447 | { | 432 | { |
448 | QPtrList<Event> el; | 433 | QPtrList<Event> el; |
@@ -854,177 +839,176 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | |||
854 | if ( found ) eventList.append( event ); | 839 | if ( found ) eventList.append( event ); |
855 | } else { | 840 | } else { |
856 | QDate s = event->dtStart().date(); | 841 | QDate s = event->dtStart().date(); |
857 | QDate e = event->dtEnd().date(); | 842 | QDate e = event->dtEnd().date(); |
858 | 843 | ||
859 | if ( inclusive ) { | 844 | if ( inclusive ) { |
860 | if ( s >= start && e <= end ) { | 845 | if ( s >= start && e <= end ) { |
861 | eventList.append( event ); | 846 | eventList.append( event ); |
862 | } | 847 | } |
863 | } else { | 848 | } else { |
864 | if ( ( e >= start && s <= end ) ) { | 849 | if ( ( e >= start && s <= end ) ) { |
865 | eventList.append( event ); | 850 | eventList.append( event ); |
866 | } | 851 | } |
867 | } | 852 | } |
868 | } | 853 | } |
869 | } | 854 | } |
870 | 855 | ||
871 | return eventList; | 856 | return eventList; |
872 | } | 857 | } |
873 | 858 | ||
874 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) | 859 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) |
875 | { | 860 | { |
876 | return rawEventsForDate( qdt.date() ); | 861 | return rawEventsForDate( qdt.date() ); |
877 | } | 862 | } |
878 | 863 | ||
879 | QPtrList<Event> CalendarLocal::rawEvents() | 864 | QPtrList<Event> CalendarLocal::rawEvents() |
880 | { | 865 | { |
881 | QPtrList<Event> el; | 866 | QPtrList<Event> el; |
882 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 867 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
883 | if ( it->calEnabled() ) el.append( it ); | 868 | if ( it->calEnabled() ) el.append( it ); |
884 | return el; | 869 | return el; |
885 | } | 870 | } |
886 | 871 | ||
887 | bool CalendarLocal::addJournal(Journal *journal) | 872 | bool CalendarLocal::addJournal(Journal *journal) |
888 | { | 873 | { |
889 | mJournalList.append(journal); | 874 | mJournalList.append(journal); |
890 | 875 | ||
891 | journal->registerObserver( this ); | 876 | journal->registerObserver( this ); |
892 | 877 | ||
893 | setModified( true ); | 878 | setModified( true ); |
894 | if ( journal->calID() == 0 ) | 879 | if ( journal->calID() == 0 ) |
895 | journal->setCalID( mDefaultCalendar ); | 880 | journal->setCalID( mDefaultCalendar ); |
896 | journal->setCalEnabled( true ); | 881 | journal->setCalEnabled( true ); |
897 | return true; | 882 | return true; |
898 | } | 883 | } |
899 | 884 | ||
900 | void CalendarLocal::deleteJournal( Journal *journal ) | 885 | void CalendarLocal::deleteJournal( Journal *journal ) |
901 | { | 886 | { |
902 | clearUndo(); | 887 | clearUndo(journal); |
903 | mUndoIncidence = journal; | ||
904 | if ( mJournalList.removeRef(journal) ) { | 888 | if ( mJournalList.removeRef(journal) ) { |
905 | setModified( true ); | 889 | setModified( true ); |
906 | } | 890 | } |
907 | } | 891 | } |
908 | 892 | ||
909 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) | 893 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) |
910 | { | 894 | { |
911 | QPtrList<Journal> el; | 895 | QPtrList<Journal> el; |
912 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 896 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
913 | if ( it->calEnabled() && it->dtStart().date() == date) el.append( it ); | 897 | if ( it->calEnabled() && it->dtStart().date() == date) el.append( it ); |
914 | return el; | 898 | return el; |
915 | } | 899 | } |
916 | Journal *CalendarLocal::journal( const QDate &date ) | 900 | Journal *CalendarLocal::journal( const QDate &date ) |
917 | { | 901 | { |
918 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; | 902 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; |
919 | 903 | ||
920 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 904 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
921 | if ( it->calEnabled() && it->dtStart().date() == date ) | 905 | if ( it->calEnabled() && it->dtStart().date() == date ) |
922 | return it; | 906 | return it; |
923 | 907 | ||
924 | return 0; | 908 | return 0; |
925 | } | 909 | } |
926 | 910 | ||
927 | Journal *CalendarLocal::journal( const QString &uid ) | 911 | Journal *CalendarLocal::journal( const QString &uid ) |
928 | { | 912 | { |
929 | Journal * retVal = 0; | 913 | Journal * retVal = 0; |
930 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 914 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
931 | if ( it->calEnabled() && it->uid() == uid ) { | 915 | if ( it->calEnabled() && it->uid() == uid ) { |
932 | if ( retVal ) { | 916 | if ( retVal ) { |
933 | if ( retVal->calID() > it->calID() ) { | 917 | if ( retVal->calID() > it->calID() ) { |
934 | retVal = it; | 918 | retVal = it; |
935 | } | 919 | } |
936 | } else { | 920 | } else { |
937 | retVal = it; | 921 | retVal = it; |
938 | } | 922 | } |
939 | } | 923 | } |
940 | return retVal; | 924 | return retVal; |
941 | } | 925 | } |
942 | 926 | ||
943 | QPtrList<Journal> CalendarLocal::journals() | 927 | QPtrList<Journal> CalendarLocal::journals() |
944 | { | 928 | { |
945 | QPtrList<Journal> el; | 929 | QPtrList<Journal> el; |
946 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 930 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
947 | if ( it->calEnabled() ) el.append( it ); | 931 | if ( it->calEnabled() ) el.append( it ); |
948 | return el; | 932 | return el; |
949 | } | 933 | } |
950 | void CalendarLocal::setCalendarRemove( int id ) | 934 | void CalendarLocal::setCalendarRemove( int id ) |
951 | { | 935 | { |
952 | 936 | ||
953 | { | 937 | { |
954 | QPtrList<Event> EventList = mEventList; | 938 | QPtrList<Event> EventList = mEventList; |
955 | Event * ev = EventList.first(); | 939 | Event * ev = EventList.first(); |
956 | while ( ev ) { | 940 | while ( ev ) { |
957 | if ( ev->calID() == id ) | 941 | if ( ev->calID() == id ) |
958 | deleteEvent( ev ); | 942 | deleteEvent( ev ); |
959 | ev = EventList.next(); | 943 | ev = EventList.next(); |
960 | } | 944 | } |
961 | } | 945 | } |
962 | { | 946 | { |
963 | 947 | ||
964 | QPtrList<Todo> TodoList = mTodoList; | 948 | QPtrList<Todo> TodoList = mTodoList; |
965 | Todo * ev = TodoList.first(); | 949 | Todo * ev = TodoList.first(); |
966 | while ( ev ) { | 950 | while ( ev ) { |
967 | if ( ev->calID() == id ) | 951 | if ( ev->calID() == id ) |
968 | deleteTodo( ev ); | 952 | deleteTodo( ev ); |
969 | ev = TodoList.next(); | 953 | ev = TodoList.next(); |
970 | } | 954 | } |
971 | } | 955 | } |
972 | { | 956 | { |
973 | QPtrList<Journal> JournalList = mJournalList; | 957 | QPtrList<Journal> JournalList = mJournalList; |
974 | Journal * ev = JournalList.first(); | 958 | Journal * ev = JournalList.first(); |
975 | while ( ev ) { | 959 | while ( ev ) { |
976 | if ( ev->calID() == id ) | 960 | if ( ev->calID() == id ) |
977 | deleteJournal( ev ); | 961 | deleteJournal( ev ); |
978 | ev = JournalList.next(); | 962 | ev = JournalList.next(); |
979 | } | 963 | } |
980 | } | 964 | } |
981 | 965 | ||
982 | clearUndo(); | 966 | clearUndo(0); |
983 | 967 | ||
984 | } | 968 | } |
985 | 969 | ||
986 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) | 970 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) |
987 | { | 971 | { |
988 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 972 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
989 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 973 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
990 | 974 | ||
991 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 975 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
992 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 976 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
993 | 977 | ||
994 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 978 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
995 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 979 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
996 | 980 | ||
997 | } | 981 | } |
998 | 982 | ||
999 | void CalendarLocal::setReadOnly( int id, bool enable ) | 983 | void CalendarLocal::setReadOnly( int id, bool enable ) |
1000 | { | 984 | { |
1001 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 985 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
1002 | if ( it->calID() == id ) it->setReadOnly( enable ); | 986 | if ( it->calID() == id ) it->setReadOnly( enable ); |
1003 | 987 | ||
1004 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 988 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
1005 | if ( it->calID() == id ) it->setReadOnly( enable ); | 989 | if ( it->calID() == id ) it->setReadOnly( enable ); |
1006 | 990 | ||
1007 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 991 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
1008 | if ( it->calID() == id ) it->setReadOnly( enable ); | 992 | if ( it->calID() == id ) it->setReadOnly( enable ); |
1009 | 993 | ||
1010 | } | 994 | } |
1011 | 995 | ||
1012 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) | 996 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) |
1013 | { | 997 | { |
1014 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 998 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
1015 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 999 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
1016 | 1000 | ||
1017 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 1001 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
1018 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 1002 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
1019 | 1003 | ||
1020 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 1004 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
1021 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 1005 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
1022 | reInitAlarmSettings(); | 1006 | reInitAlarmSettings(); |
1023 | 1007 | ||
1024 | } | 1008 | } |
1025 | void CalendarLocal::setDefaultCalendarEnabledOnly() | 1009 | void CalendarLocal::setDefaultCalendarEnabledOnly() |
1026 | { | 1010 | { |
1027 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 1011 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
1028 | it->setCalEnabled( it->calID() == mDefaultCalendar ); | 1012 | it->setCalEnabled( it->calID() == mDefaultCalendar ); |
1029 | 1013 | ||
1030 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 1014 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index ae7e30c..a7a85c8 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -24,97 +24,96 @@ | |||
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, bool doNotCheckDuplicates ); | 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 | void clearUndo(); | ||
73 | 72 | ||
74 | void save() {} | 73 | void save() {} |
75 | 74 | ||
76 | /** | 75 | /** |
77 | Add Event to calendar. | 76 | Add Event to calendar. |
78 | */ | 77 | */ |
79 | void removeSyncInfo( QString syncProfile); | 78 | void removeSyncInfo( QString syncProfile); |
80 | bool addAnniversaryNoDup( Event *event ); | 79 | bool addAnniversaryNoDup( Event *event ); |
81 | bool addEventNoDup( Event *event ); | 80 | bool addEventNoDup( Event *event ); |
82 | bool addEvent( Event *event ); | 81 | bool addEvent( Event *event ); |
83 | /** | 82 | /** |
84 | Deletes an event from this calendar. | 83 | Deletes an event from this calendar. |
85 | */ | 84 | */ |
86 | void deleteEvent( Event *event ); | 85 | void deleteEvent( Event *event ); |
87 | 86 | ||
88 | /** | 87 | /** |
89 | Retrieves an event on the basis of the unique string ID. | 88 | Retrieves an event on the basis of the unique string ID. |
90 | */ | 89 | */ |
91 | Event *event( const QString &uid ); | 90 | Event *event( const QString &uid ); |
92 | /** | 91 | /** |
93 | Return unfiltered list of all events in calendar. | 92 | Return unfiltered list of all events in calendar. |
94 | */ | 93 | */ |
95 | QPtrList<Event> rawEvents(); | 94 | QPtrList<Event> rawEvents(); |
96 | QPtrList<Event> getExternLastSyncEvents(); | 95 | QPtrList<Event> getExternLastSyncEvents(); |
97 | /** | 96 | /** |
98 | Add a todo to the todolist. | 97 | Add a todo to the todolist. |
99 | */ | 98 | */ |
100 | bool addTodo( Todo *todo ); | 99 | bool addTodo( Todo *todo ); |
101 | bool addTodoNoDup( Todo *todo ); | 100 | bool addTodoNoDup( Todo *todo ); |
102 | /** | 101 | /** |
103 | Remove a todo from the todolist. | 102 | Remove a todo from the todolist. |
104 | */ | 103 | */ |
105 | void deleteTodo( Todo * ); | 104 | void deleteTodo( Todo * ); |
106 | /** | 105 | /** |
107 | Searches todolist for an event with this unique string identifier, | 106 | Searches todolist for an event with this unique string identifier, |
108 | returns a pointer or null. | 107 | returns a pointer or null. |
109 | */ | 108 | */ |
110 | Todo *todo( const QString &uid ); | 109 | Todo *todo( const QString &uid ); |
111 | /** | 110 | /** |
112 | Return list of all todos. | 111 | Return list of all todos. |
113 | */ | 112 | */ |
114 | QPtrList<Todo> rawTodos(); | 113 | QPtrList<Todo> rawTodos(); |
115 | /** | 114 | /** |
116 | Returns list of todos due on the specified date. | 115 | Returns list of todos due on the specified date. |
117 | */ | 116 | */ |
118 | QPtrList<Todo> todos( const QDate &date ); | 117 | QPtrList<Todo> todos( const QDate &date ); |
119 | /** | 118 | /** |
120 | Return list of all todos. | 119 | Return list of all todos. |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 52d94fb..549014e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -446,97 +446,101 @@ void Incidence::setCategories(const QStringList &categories, bool setForRelation | |||
446 | for (inc=Relations.first();inc;inc=Relations.next()) { | 446 | for (inc=Relations.first();inc;inc=Relations.next()) { |
447 | inc->setCategories( categories, true ); | 447 | inc->setCategories( categories, true ); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | // TODO: remove setCategories(QString) function | 452 | // TODO: remove setCategories(QString) function |
453 | void Incidence::setCategories(const QString &catStr) | 453 | void Incidence::setCategories(const QString &catStr) |
454 | { | 454 | { |
455 | if (mReadOnly) return; | 455 | if (mReadOnly) return; |
456 | mCategories.clear(); | 456 | mCategories.clear(); |
457 | 457 | ||
458 | if (catStr.isEmpty()) return; | 458 | if (catStr.isEmpty()) return; |
459 | 459 | ||
460 | mCategories = QStringList::split(",",catStr); | 460 | mCategories = QStringList::split(",",catStr); |
461 | 461 | ||
462 | QStringList::Iterator it; | 462 | QStringList::Iterator it; |
463 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 463 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
464 | *it = (*it).stripWhiteSpace(); | 464 | *it = (*it).stripWhiteSpace(); |
465 | } | 465 | } |
466 | checkCategories(); | 466 | checkCategories(); |
467 | updated(); | 467 | updated(); |
468 | } | 468 | } |
469 | // using this makes filtering 3 times faster | 469 | // using this makes filtering 3 times faster |
470 | QStringList* Incidence::categoriesP() | 470 | QStringList* Incidence::categoriesP() |
471 | { | 471 | { |
472 | return &mCategories; | 472 | return &mCategories; |
473 | } | 473 | } |
474 | 474 | ||
475 | QStringList Incidence::categories() const | 475 | QStringList Incidence::categories() const |
476 | { | 476 | { |
477 | return mCategories; | 477 | return mCategories; |
478 | } | 478 | } |
479 | 479 | ||
480 | QString Incidence::categoriesStr() | 480 | QString Incidence::categoriesStr() |
481 | { | 481 | { |
482 | return mCategories.join(","); | 482 | return mCategories.join(","); |
483 | } | 483 | } |
484 | QString Incidence::categoriesStrWithSpace() | 484 | QString Incidence::categoriesStrWithSpace() |
485 | { | 485 | { |
486 | return mCategories.join(", "); | 486 | return mCategories.join(", "); |
487 | } | 487 | } |
488 | 488 | ||
489 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 489 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
490 | { | 490 | { |
491 | if (mReadOnly) return; | 491 | if (mReadOnly) return; |
492 | mRelatedToUid = relatedToUid; | 492 | mRelatedToUid = relatedToUid; |
493 | } | 493 | } |
494 | 494 | void Incidence::clearRelations() | |
495 | { | ||
496 | mRelatedTo = 0; | ||
497 | mRelations.clear(); | ||
498 | } | ||
495 | QString Incidence::relatedToUid() const | 499 | QString Incidence::relatedToUid() const |
496 | { | 500 | { |
497 | return mRelatedToUid; | 501 | return mRelatedToUid; |
498 | } | 502 | } |
499 | 503 | ||
500 | void Incidence::setRelatedTo(Incidence *relatedTo) | 504 | void Incidence::setRelatedTo(Incidence *relatedTo) |
501 | { | 505 | { |
502 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 506 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
503 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 507 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
504 | if (mReadOnly || mRelatedTo == relatedTo) return; | 508 | if (mReadOnly || mRelatedTo == relatedTo) return; |
505 | if(mRelatedTo) { | 509 | if(mRelatedTo) { |
506 | // updated(); | 510 | // updated(); |
507 | mRelatedTo->removeRelation(this); | 511 | mRelatedTo->removeRelation(this); |
508 | } | 512 | } |
509 | mRelatedTo = relatedTo; | 513 | mRelatedTo = relatedTo; |
510 | if (mRelatedTo) { | 514 | if (mRelatedTo) { |
511 | mRelatedTo->addRelation(this); | 515 | mRelatedTo->addRelation(this); |
512 | mRelatedToUid = mRelatedTo->uid(); | 516 | mRelatedToUid = mRelatedTo->uid(); |
513 | } else { | 517 | } else { |
514 | mRelatedToUid = ""; | 518 | mRelatedToUid = ""; |
515 | } | 519 | } |
516 | } | 520 | } |
517 | 521 | ||
518 | Incidence *Incidence::relatedTo() const | 522 | Incidence *Incidence::relatedTo() const |
519 | { | 523 | { |
520 | return mRelatedTo; | 524 | return mRelatedTo; |
521 | } | 525 | } |
522 | 526 | ||
523 | QPtrList<Incidence> Incidence::relations() const | 527 | QPtrList<Incidence> Incidence::relations() const |
524 | { | 528 | { |
525 | return mRelations; | 529 | return mRelations; |
526 | } | 530 | } |
527 | 531 | ||
528 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | 532 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) |
529 | { | 533 | { |
530 | Incidence* inc; | 534 | Incidence* inc; |
531 | QPtrList<Incidence> Relations = relations(); | 535 | QPtrList<Incidence> Relations = relations(); |
532 | for (inc=Relations.first();inc;inc=Relations.next()) { | 536 | for (inc=Relations.first();inc;inc=Relations.next()) { |
533 | inc->addRelationsToList( rel ); | 537 | inc->addRelationsToList( rel ); |
534 | } | 538 | } |
535 | if ( rel->findRef( this ) == -1 ) | 539 | if ( rel->findRef( this ) == -1 ) |
536 | rel->append( this ); | 540 | rel->append( this ); |
537 | } | 541 | } |
538 | 542 | ||
539 | void Incidence::addRelation(Incidence *event) | 543 | void Incidence::addRelation(Incidence *event) |
540 | { | 544 | { |
541 | setLastModifiedSubInvalid(); | 545 | setLastModifiedSubInvalid(); |
542 | if( mRelations.findRef( event ) == -1 ) { | 546 | if( mRelations.findRef( event ) == -1 ) { |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 88df217..eef9e64 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -69,96 +69,97 @@ class Incidence : public IncidenceBase | |||
69 | virtual bool visit(Todo *) { return false; } | 69 | virtual bool visit(Todo *) { return false; } |
70 | /** | 70 | /** |
71 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions | 71 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions |
72 | on an Journal object. | 72 | on an Journal object. |
73 | */ | 73 | */ |
74 | virtual bool visit(Journal *) { return false; } | 74 | virtual bool visit(Journal *) { return false; } |
75 | 75 | ||
76 | protected: | 76 | protected: |
77 | /** Constructor is protected to prevent direct creation of visitor base class. */ | 77 | /** Constructor is protected to prevent direct creation of visitor base class. */ |
78 | Visitor() {} | 78 | Visitor() {} |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | This class implements a visitor for adding an Incidence to a resource | 82 | This class implements a visitor for adding an Incidence to a resource |
83 | supporting addEvent(), addTodo() and addJournal() calls. | 83 | supporting addEvent(), addTodo() and addJournal() calls. |
84 | */ | 84 | */ |
85 | template<class T> | 85 | template<class T> |
86 | class AddVisitor : public Visitor | 86 | class AddVisitor : public Visitor |
87 | { | 87 | { |
88 | public: | 88 | public: |
89 | AddVisitor( T *r ) : mResource( r ) {} | 89 | AddVisitor( T *r ) : mResource( r ) {} |
90 | bool visit( Event *e ) { return mResource->addEvent( e ); } | 90 | bool visit( Event *e ) { return mResource->addEvent( e ); } |
91 | bool visit( Todo *t ) { return mResource->addTodo( t ); } | 91 | bool visit( Todo *t ) { return mResource->addTodo( t ); } |
92 | bool visit( Journal *j ) { return mResource->addJournal( j ); } | 92 | bool visit( Journal *j ) { return mResource->addJournal( j ); } |
93 | 93 | ||
94 | private: | 94 | private: |
95 | T *mResource; | 95 | T *mResource; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /** enumeration for describing an event's secrecy. */ | 98 | /** enumeration for describing an event's secrecy. */ |
99 | enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; | 99 | enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; |
100 | typedef ListBase<Incidence> List; | 100 | typedef ListBase<Incidence> List; |
101 | Incidence(); | 101 | Incidence(); |
102 | Incidence(const Incidence &); | 102 | Incidence(const Incidence &); |
103 | ~Incidence(); | 103 | ~Incidence(); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Accept IncidenceVisitor. A class taking part in the visitor mechanism has to | 106 | Accept IncidenceVisitor. A class taking part in the visitor mechanism has to |
107 | provide this implementation: | 107 | provide this implementation: |
108 | <pre> | 108 | <pre> |
109 | bool accept(Visitor &v) { return v.visit(this); } | 109 | bool accept(Visitor &v) { return v.visit(this); } |
110 | </pre> | 110 | </pre> |
111 | */ | 111 | */ |
112 | virtual bool accept(Visitor &) { return false; } | 112 | virtual bool accept(Visitor &) { return false; } |
113 | 113 | ||
114 | virtual Incidence *clone() = 0; | 114 | virtual Incidence *clone() = 0; |
115 | virtual void cloneRelations( Incidence * ); | 115 | virtual void cloneRelations( Incidence * ); |
116 | void addRelationsToList(QPtrList<Incidence> *rel); | 116 | void addRelationsToList(QPtrList<Incidence> *rel); |
117 | void clearRelations(); | ||
117 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; | 118 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; |
118 | void setReadOnly( bool ); | 119 | void setReadOnly( bool ); |
119 | 120 | ||
120 | /** | 121 | /** |
121 | Recreate event. The event is made a new unique event, but already stored | 122 | Recreate event. The event is made a new unique event, but already stored |
122 | event information is preserved. Sets uniquie id, creation date, last | 123 | event information is preserved. Sets uniquie id, creation date, last |
123 | modification date and revision number. | 124 | modification date and revision number. |
124 | */ | 125 | */ |
125 | void recreate(); | 126 | void recreate(); |
126 | Incidence* recreateCloneException(QDate); | 127 | Incidence* recreateCloneException(QDate); |
127 | 128 | ||
128 | /** set creation date */ | 129 | /** set creation date */ |
129 | void setCreated(QDateTime); | 130 | void setCreated(QDateTime); |
130 | /** return time and date of creation. */ | 131 | /** return time and date of creation. */ |
131 | QDateTime created() const; | 132 | QDateTime created() const; |
132 | 133 | ||
133 | /** set the number of revisions this event has seen */ | 134 | /** set the number of revisions this event has seen */ |
134 | void setRevision(int rev); | 135 | void setRevision(int rev); |
135 | /** return the number of revisions this event has seen */ | 136 | /** return the number of revisions this event has seen */ |
136 | int revision() const; | 137 | int revision() const; |
137 | 138 | ||
138 | /** Set starting date/time. */ | 139 | /** Set starting date/time. */ |
139 | virtual void setDtStart(const QDateTime &dtStart); | 140 | virtual void setDtStart(const QDateTime &dtStart); |
140 | /** Return the incidence's ending date/time as a QDateTime. */ | 141 | /** Return the incidence's ending date/time as a QDateTime. */ |
141 | virtual QDateTime dtEnd() const { return QDateTime(); } | 142 | virtual QDateTime dtEnd() const { return QDateTime(); } |
142 | 143 | ||
143 | /** sets the event's lengthy description. */ | 144 | /** sets the event's lengthy description. */ |
144 | void setDescription(const QString &description); | 145 | void setDescription(const QString &description); |
145 | /** returns a reference to the event's description. */ | 146 | /** returns a reference to the event's description. */ |
146 | QString description() const; | 147 | QString description() const; |
147 | 148 | ||
148 | /** sets the event's short summary. */ | 149 | /** sets the event's short summary. */ |
149 | void setSummary(const QString &summary); | 150 | void setSummary(const QString &summary); |
150 | /** returns a reference to the event's summary. */ | 151 | /** returns a reference to the event's summary. */ |
151 | QString summary() const; | 152 | QString summary() const; |
152 | 153 | ||
153 | /** set event's applicable categories */ | 154 | /** set event's applicable categories */ |
154 | void setCategories(const QStringList &categories, bool setForRelations = false); | 155 | void setCategories(const QStringList &categories, bool setForRelations = false); |
155 | void addCategories(const QStringList &categories, bool addToRelations = false); | 156 | void addCategories(const QStringList &categories, bool addToRelations = false); |
156 | /** set event's categories based on a comma delimited string */ | 157 | /** set event's categories based on a comma delimited string */ |
157 | void setCategories(const QString &catStr); | 158 | void setCategories(const QString &catStr); |
158 | /** return categories in a list */ | 159 | /** return categories in a list */ |
159 | QStringList categories() const; | 160 | QStringList categories() const; |
160 | QStringList* categoriesP(); | 161 | QStringList* categoriesP(); |
161 | /** return categories as a comma separated string */ | 162 | /** return categories as a comma separated string */ |
162 | QString categoriesStr(); | 163 | QString categoriesStr(); |
163 | QString categoriesStrWithSpace(); | 164 | QString categoriesStrWithSpace(); |
164 | 165 | ||