-rw-r--r-- | libkcal/calendar.cpp | 2 | ||||
-rw-r--r-- | libkcal/calformat.cpp | 20 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 12 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 7 | ||||
-rw-r--r-- | libkcal/todo.cpp | 38 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 16 |
6 files changed, 51 insertions, 44 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index dcfee5d..406cd48 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -29,25 +29,25 @@ | |||
29 | #include "exceptions.h" | 29 | #include "exceptions.h" |
30 | #include "calfilter.h" | 30 | #include "calfilter.h" |
31 | 31 | ||
32 | #include "calendar.h" | 32 | #include "calendar.h" |
33 | #include "syncdefines.h" | 33 | #include "syncdefines.h" |
34 | 34 | ||
35 | using namespace KCal; | 35 | using namespace KCal; |
36 | 36 | ||
37 | Calendar::Calendar() | 37 | Calendar::Calendar() |
38 | { | 38 | { |
39 | 39 | ||
40 | init(); | 40 | init(); |
41 | setTimeZoneId( i18n (" 00:00 Europe/London(UTC)") ); | 41 | setTimeZoneId( " 00:00 Europe/London(UTC)" ); |
42 | } | 42 | } |
43 | 43 | ||
44 | Calendar::Calendar( const QString &timeZoneId ) | 44 | Calendar::Calendar( const QString &timeZoneId ) |
45 | { | 45 | { |
46 | 46 | ||
47 | init(); | 47 | init(); |
48 | setTimeZoneId(timeZoneId); | 48 | setTimeZoneId(timeZoneId); |
49 | } | 49 | } |
50 | 50 | ||
51 | void Calendar::init() | 51 | void Calendar::init() |
52 | { | 52 | { |
53 | mObserver = 0; | 53 | mObserver = 0; |
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp index 8a3d069..359f65f 100644 --- a/libkcal/calformat.cpp +++ b/libkcal/calformat.cpp | |||
@@ -17,37 +17,37 @@ | |||
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 <klocale.h> | 21 | #include <klocale.h> |
22 | #include <kdebug.h> | 22 | #include <kdebug.h> |
23 | #include <kapplication.h> | 23 | #include <kapplication.h> |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | 26 | ||
27 | using namespace KCal; | 27 | using namespace KCal; |
28 | 28 | ||
29 | QString CalFormat::mApplication = QString::fromLatin1("libkcal"); | 29 | QString CalFormat::mApplication = QString::fromLatin1("libkcal-pi"); |
30 | QString CalFormat::mProductId = QString::fromLatin1("-//K Desktop Environment//NONSGML libkcal 3.1//EN"); | 30 | QString CalFormat::mProductId = QString::fromLatin1("-//KDE-Pim//Platform-independent 2.1.0"); |
31 | 31 | ||
32 | // An array containing the PRODID strings indexed against the calendar file format version used. | 32 | // An array containing the PRODID strings indexed against the calendar file format version used. |
33 | // Every time the calendar file format is changed, add an entry/entries to this list. | 33 | // Every time the calendar file format is changed, add an entry/entries to this list. |
34 | struct CalVersion { | 34 | struct CalVersion { |
35 | int version; | 35 | int version; |
36 | QString prodId; | 36 | QString prodId; |
37 | }; | 37 | }; |
38 | static CalVersion prodIds[] = { | 38 | static CalVersion prodIds[] = { |
39 | { 220, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 2.2//EN") }, | 39 | { 220, QString::fromLatin1("-//KDE-Pim//Pi 2.2//EN") }, |
40 | { 300, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.0//EN") }, | 40 | { 300, QString::fromLatin1("-//KDE-Pim//Pi 3.0//EN") }, |
41 | { 310, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.1//EN") }, | 41 | { 310, QString::fromLatin1("-//KDE-Pim//Pi 3.1//EN") }, |
42 | { 0 , QString() } | 42 | { 0 , QString() } |
43 | }; | 43 | }; |
44 | 44 | ||
45 | 45 | ||
46 | CalFormat::CalFormat() | 46 | CalFormat::CalFormat() |
47 | { | 47 | { |
48 | mException = 0; | 48 | mException = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | CalFormat::~CalFormat() | 51 | CalFormat::~CalFormat() |
52 | { | 52 | { |
53 | delete mException; | 53 | delete mException; |
@@ -69,30 +69,26 @@ ErrorFormat *CalFormat::exception() | |||
69 | { | 69 | { |
70 | return mException; | 70 | return mException; |
71 | } | 71 | } |
72 | 72 | ||
73 | void CalFormat::setApplication(const QString& application, const QString& productID) | 73 | void CalFormat::setApplication(const QString& application, const QString& productID) |
74 | { | 74 | { |
75 | mApplication = application; | 75 | mApplication = application; |
76 | mProductId = productID; | 76 | mProductId = productID; |
77 | } | 77 | } |
78 | 78 | ||
79 | QString CalFormat::createUniqueId() | 79 | QString CalFormat::createUniqueId() |
80 | { | 80 | { |
81 | int hashTime = QTime::currentTime().hour() + | 81 | return QString("%1-%2-%3") |
82 | QTime::currentTime().minute() + QTime::currentTime().second() + | 82 | .arg("kopi") |
83 | QTime::currentTime().msec(); | ||
84 | QString uidStr = QString("%1-%2.%3") | ||
85 | .arg(mApplication) | ||
86 | .arg(KApplication::random()) | 83 | .arg(KApplication::random()) |
87 | .arg(hashTime); | 84 | .arg(QTime::currentTime().msec()+1); |
88 | return uidStr; | ||
89 | } | 85 | } |
90 | 86 | ||
91 | int CalFormat::calendarVersion(const char* prodId) | 87 | int CalFormat::calendarVersion(const char* prodId) |
92 | { | 88 | { |
93 | for (const CalVersion* cv = prodIds; cv->version; ++cv) { | 89 | for (const CalVersion* cv = prodIds; cv->version; ++cv) { |
94 | if (!strcmp(prodId, cv->prodId.local8Bit())) | 90 | if (!strcmp(prodId, cv->prodId.local8Bit())) |
95 | return cv->version; | 91 | return cv->version; |
96 | } | 92 | } |
97 | return 0; | 93 | return 0; |
98 | } | 94 | } |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index eae41aa..fe7413f 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -357,27 +357,27 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
358 | // read in. | 358 | // read in. |
359 | tmpStr += ";"; | 359 | tmpStr += ";"; |
360 | } | 360 | } |
361 | if (!tmpStr.isEmpty()) { | 361 | if (!tmpStr.isEmpty()) { |
362 | tmpStr.truncate(tmpStr.length()-1); | 362 | tmpStr.truncate(tmpStr.length()-1); |
363 | icalcomponent_add_property(parent,icalproperty_new_categories( | 363 | icalcomponent_add_property(parent,icalproperty_new_categories( |
364 | writeText(incidence->getCategories().join(";")))); | 364 | writeText(incidence->getCategories().join(";")))); |
365 | } | 365 | } |
366 | */ | 366 | */ |
367 | 367 | ||
368 | // related event | 368 | // related event |
369 | if (incidence->relatedTo()) { | 369 | if (!incidence->relatedToUid().isEmpty()) { |
370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( | 370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( |
371 | incidence->relatedTo()->uid().utf8())); | 371 | incidence->relatedToUid().utf8())); |
372 | } | 372 | } |
373 | 373 | ||
374 | // recurrence rule stuff | 374 | // recurrence rule stuff |
375 | Recurrence *recur = incidence->recurrence(); | 375 | Recurrence *recur = incidence->recurrence(); |
376 | if (recur->doesRecur()) { | 376 | if (recur->doesRecur()) { |
377 | 377 | ||
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | 378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); |
379 | } | 379 | } |
380 | 380 | ||
381 | // recurrence excpetion dates | 381 | // recurrence excpetion dates |
382 | DateList dateList = incidence->exDates(); | 382 | DateList dateList = incidence->exDates(); |
383 | DateList::ConstIterator exIt; | 383 | DateList::ConstIterator exIt; |
@@ -2027,29 +2027,33 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) | |||
2027 | ; | 2027 | ; |
2028 | } else { | 2028 | } else { |
2029 | ; | 2029 | ; |
2030 | } | 2030 | } |
2031 | SKIP: | 2031 | SKIP: |
2032 | ; | 2032 | ; |
2033 | } // while | 2033 | } // while |
2034 | #endif | 2034 | #endif |
2035 | 2035 | ||
2036 | // Post-Process list of events with relations, put Event objects in relation | 2036 | // Post-Process list of events with relations, put Event objects in relation |
2037 | Event *ev; | 2037 | Event *ev; |
2038 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { | 2038 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { |
2039 | ev->setRelatedTo(cal->event(ev->relatedToUid())); | 2039 | Incidence * inc = cal->event(ev->relatedToUid()); |
2040 | if ( inc ) | ||
2041 | ev->setRelatedTo( inc ); | ||
2040 | } | 2042 | } |
2041 | Todo *todo; | 2043 | Todo *todo; |
2042 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { | 2044 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { |
2043 | todo->setRelatedTo(cal->todo(todo->relatedToUid())); | 2045 | Incidence * inc = cal->todo(todo->relatedToUid()); |
2046 | if ( inc ) | ||
2047 | todo->setRelatedTo( inc ); | ||
2044 | } | 2048 | } |
2045 | 2049 | ||
2046 | return true; | 2050 | return true; |
2047 | } | 2051 | } |
2048 | 2052 | ||
2049 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) | 2053 | QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) |
2050 | { | 2054 | { |
2051 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " | 2055 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " |
2052 | // << icalcomponent_as_ical_string(c) << endl; | 2056 | // << icalcomponent_as_ical_string(c) << endl; |
2053 | 2057 | ||
2054 | QString errorMessage; | 2058 | QString errorMessage; |
2055 | 2059 | ||
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index a312ba5..6bca12c 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -381,25 +381,30 @@ QString Incidence::relatedToUid() const | |||
381 | } | 381 | } |
382 | 382 | ||
383 | void Incidence::setRelatedTo(Incidence *relatedTo) | 383 | void Incidence::setRelatedTo(Incidence *relatedTo) |
384 | { | 384 | { |
385 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 385 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
386 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 386 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
387 | if (mReadOnly || mRelatedTo == relatedTo) return; | 387 | if (mReadOnly || mRelatedTo == relatedTo) return; |
388 | if(mRelatedTo) { | 388 | if(mRelatedTo) { |
389 | // updated(); | 389 | // updated(); |
390 | mRelatedTo->removeRelation(this); | 390 | mRelatedTo->removeRelation(this); |
391 | } | 391 | } |
392 | mRelatedTo = relatedTo; | 392 | mRelatedTo = relatedTo; |
393 | if (mRelatedTo) mRelatedTo->addRelation(this); | 393 | if (mRelatedTo) { |
394 | mRelatedTo->addRelation(this); | ||
395 | mRelatedToUid = mRelatedTo->uid(); | ||
396 | } else { | ||
397 | mRelatedToUid = ""; | ||
398 | } | ||
394 | } | 399 | } |
395 | 400 | ||
396 | Incidence *Incidence::relatedTo() const | 401 | Incidence *Incidence::relatedTo() const |
397 | { | 402 | { |
398 | return mRelatedTo; | 403 | return mRelatedTo; |
399 | } | 404 | } |
400 | 405 | ||
401 | QPtrList<Incidence> Incidence::relations() const | 406 | QPtrList<Incidence> Incidence::relations() const |
402 | { | 407 | { |
403 | return mRelations; | 408 | return mRelations; |
404 | } | 409 | } |
405 | 410 | ||
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 8794f7a..7906046 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -15,24 +15,26 @@ | |||
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 <kglobalsettings.h> | 22 | #include <kglobalsettings.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | 26 | ||
27 | #include "calendarlocal.h" | ||
28 | #include "icalformat.h" | ||
27 | #include "todo.h" | 29 | #include "todo.h" |
28 | 30 | ||
29 | using namespace KCal; | 31 | using namespace KCal; |
30 | 32 | ||
31 | Todo::Todo(): Incidence() | 33 | Todo::Todo(): Incidence() |
32 | { | 34 | { |
33 | // mStatus = TENTATIVE; | 35 | // mStatus = TENTATIVE; |
34 | 36 | ||
35 | mHasDueDate = false; | 37 | mHasDueDate = false; |
36 | setHasStartDate( false ); | 38 | setHasStartDate( false ); |
37 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 39 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
38 | mHasCompletedDate = false; | 40 | mHasCompletedDate = false; |
@@ -46,24 +48,25 @@ Todo::Todo(const Todo &t) : Incidence(t) | |||
46 | mDtDue = t.mDtDue; | 48 | mDtDue = t.mDtDue; |
47 | mHasDueDate = t.mHasDueDate; | 49 | mHasDueDate = t.mHasDueDate; |
48 | mCompleted = t.mCompleted; | 50 | mCompleted = t.mCompleted; |
49 | mHasCompletedDate = t.mHasCompletedDate; | 51 | mHasCompletedDate = t.mHasCompletedDate; |
50 | mPercentComplete = t.mPercentComplete; | 52 | mPercentComplete = t.mPercentComplete; |
51 | mRunning = false; | 53 | mRunning = false; |
52 | mRunSaveTimer = 0; | 54 | mRunSaveTimer = 0; |
53 | } | 55 | } |
54 | 56 | ||
55 | Todo::~Todo() | 57 | Todo::~Todo() |
56 | { | 58 | { |
57 | setRunning( false ); | 59 | setRunning( false ); |
60 | qDebug("Todo::~Todo() "); | ||
58 | } | 61 | } |
59 | 62 | ||
60 | void Todo::setRunning( bool run ) | 63 | void Todo::setRunning( bool run ) |
61 | { | 64 | { |
62 | if ( run == mRunning ) | 65 | if ( run == mRunning ) |
63 | return; | 66 | return; |
64 | if ( !mRunSaveTimer ) { | 67 | if ( !mRunSaveTimer ) { |
65 | mRunSaveTimer = new QTimer ( this ); | 68 | mRunSaveTimer = new QTimer ( this ); |
66 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); | 69 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); |
67 | } | 70 | } |
68 | mRunning = run; | 71 | mRunning = run; |
69 | if ( mRunning ) { | 72 | if ( mRunning ) { |
@@ -72,46 +75,41 @@ void Todo::setRunning( bool run ) | |||
72 | } else { | 75 | } else { |
73 | mRunSaveTimer->stop(); | 76 | mRunSaveTimer->stop(); |
74 | saveRunningInfoToFile(); | 77 | saveRunningInfoToFile(); |
75 | } | 78 | } |
76 | } | 79 | } |
77 | 80 | ||
78 | void Todo::saveRunningInfoToFile() | 81 | void Todo::saveRunningInfoToFile() |
79 | { | 82 | { |
80 | qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 83 | qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
81 | 84 | ||
82 | QString dir = KGlobalSettings::timeTrackerDir(); | 85 | QString dir = KGlobalSettings::timeTrackerDir(); |
83 | qDebug("%s ", dir.latin1()); | 86 | qDebug("%s ", dir.latin1()); |
84 | QString file = "%1-%2-%3-%4-%5-%6-%7.tt"; | 87 | QString file = "%1%2%3-%4%5%6-%7%8%9-"; |
85 | 88 | int runtime = mRunStart.secsTo( QDateTime::currentDateTime() ); | |
86 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ).arg( mRunStart.time().msec(), 3 ); | 89 | runtime = (runtime / 60) +1; |
90 | int h = runtime / 60; | ||
91 | int m = runtime % 60; | ||
92 | int d = h / 24; | ||
93 | h = h % 24; | ||
94 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ).arg( d,3 ).arg( h,2 ).arg( m,2 ); | ||
87 | file.replace ( QRegExp (" "), "0" ); | 95 | file.replace ( QRegExp (" "), "0" ); |
88 | file = dir +"/" +file; | 96 | file = dir +"/" +file + uid()+".ics"; |
89 | qDebug("%s ", file.latin1()); | 97 | qDebug("File %s ",file.latin1() ); |
90 | QStringList dataList; | 98 | CalendarLocal cal; |
91 | 99 | cal.setTimeZoneId( " 00:00 Europe/London(UTC)" ); | |
92 | //Summary | 100 | cal.addIncidence( clone() ); |
93 | //Category | 101 | ICalFormat format; |
94 | //CategoryColor | 102 | format.save( &cal, file ); |
95 | //StartRuntime | ||
96 | //Runtime | ||
97 | //Due | ||
98 | //Start | ||
99 | //Prio | ||
100 | //Erledigt | ||
101 | //Uid | ||
102 | //Parents uids | ||
103 | 103 | ||
104 | |||
105 | |||
106 | } | 104 | } |
107 | 105 | ||
108 | int Todo::runTime() | 106 | int Todo::runTime() |
109 | { | 107 | { |
110 | if ( !mRunning ) | 108 | if ( !mRunning ) |
111 | return 0; | 109 | return 0; |
112 | return mRunStart.secsTo( QDateTime::currentDateTime() ); | 110 | return mRunStart.secsTo( QDateTime::currentDateTime() ); |
113 | } | 111 | } |
114 | bool Todo::hasRunningSub() | 112 | bool Todo::hasRunningSub() |
115 | { | 113 | { |
116 | if ( mRunning ) | 114 | if ( mRunning ) |
117 | return true; | 115 | return true; |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 62a31ae..8efc1ea 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -317,27 +317,27 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
317 | "NEEDS_ACTION"); | 317 | "NEEDS_ACTION"); |
318 | // completion date | 318 | // completion date |
319 | if (anEvent->hasCompletedDate()) { | 319 | if (anEvent->hasCompletedDate()) { |
320 | tmpStr = qDateTimeToISO(anEvent->completed()); | 320 | tmpStr = qDateTimeToISO(anEvent->completed()); |
321 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); | 321 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); |
322 | } | 322 | } |
323 | 323 | ||
324 | // priority | 324 | // priority |
325 | tmpStr.sprintf("%i",anEvent->priority()); | 325 | tmpStr.sprintf("%i",anEvent->priority()); |
326 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); | 326 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); |
327 | 327 | ||
328 | // related event | 328 | // related event |
329 | if (anEvent->relatedTo()) { | 329 | if (anEvent->relatedToUid()) { |
330 | addPropValue(vtodo, VCRelatedToProp, | 330 | addPropValue(vtodo, VCRelatedToProp, |
331 | anEvent->relatedTo()->uid().local8Bit()); | 331 | anEvent->relatedToUid().local8Bit()); |
332 | } | 332 | } |
333 | 333 | ||
334 | // categories | 334 | // categories |
335 | QStringList tmpStrList = anEvent->categories(); | 335 | QStringList tmpStrList = anEvent->categories(); |
336 | tmpStr = ""; | 336 | tmpStr = ""; |
337 | QString catStr; | 337 | QString catStr; |
338 | for ( QStringList::Iterator it = tmpStrList.begin(); | 338 | for ( QStringList::Iterator it = tmpStrList.begin(); |
339 | it != tmpStrList.end(); | 339 | it != tmpStrList.end(); |
340 | ++it ) { | 340 | ++it ) { |
341 | catStr = *it; | 341 | catStr = *it; |
342 | if (catStr[0] == ' ') | 342 | if (catStr[0] == ' ') |
343 | tmpStr += catStr.mid(1); | 343 | tmpStr += catStr.mid(1); |
@@ -663,27 +663,27 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
663 | } | 663 | } |
664 | } | 664 | } |
665 | 665 | ||
666 | // priority | 666 | // priority |
667 | tmpStr.sprintf("%i",anEvent->priority()); | 667 | tmpStr.sprintf("%i",anEvent->priority()); |
668 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); | 668 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); |
669 | 669 | ||
670 | // transparency | 670 | // transparency |
671 | tmpStr.sprintf("%i",anEvent->transparency()); | 671 | tmpStr.sprintf("%i",anEvent->transparency()); |
672 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); | 672 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); |
673 | 673 | ||
674 | // related event | 674 | // related event |
675 | if (anEvent->relatedTo()) { | 675 | if (anEvent->relatedToUid()) { |
676 | addPropValue(vevent, VCRelatedToProp, | 676 | addPropValue(vevent, VCRelatedToProp, |
677 | anEvent->relatedTo()->uid().local8Bit()); | 677 | anEvent->relatedToUid().local8Bit()); |
678 | } | 678 | } |
679 | 679 | ||
680 | if (anEvent->pilotId()) { | 680 | if (anEvent->pilotId()) { |
681 | // pilot sync stuff | 681 | // pilot sync stuff |
682 | tmpStr.sprintf("%i",anEvent->pilotId()); | 682 | tmpStr.sprintf("%i",anEvent->pilotId()); |
683 | addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit()); | 683 | addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit()); |
684 | tmpStr.sprintf("%i",anEvent->syncStatus()); | 684 | tmpStr.sprintf("%i",anEvent->syncStatus()); |
685 | addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit()); | 685 | addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit()); |
686 | } | 686 | } |
687 | 687 | ||
688 | return vevent; | 688 | return vevent; |
689 | } | 689 | } |
@@ -1595,29 +1595,33 @@ void VCalFormat::populate(VObject *vcal) | |||
1595 | // we have either already processed them or are ignoring them. | 1595 | // we have either already processed them or are ignoring them. |
1596 | ; | 1596 | ; |
1597 | } else { | 1597 | } else { |
1598 | kdDebug(5800) << "Ignoring unknown vObject \"" << vObjectName(curVO) << "\"" << endl; | 1598 | kdDebug(5800) << "Ignoring unknown vObject \"" << vObjectName(curVO) << "\"" << endl; |
1599 | } | 1599 | } |
1600 | SKIP: | 1600 | SKIP: |
1601 | ; | 1601 | ; |
1602 | } // while | 1602 | } // while |
1603 | 1603 | ||
1604 | // Post-Process list of events with relations, put Event objects in relation | 1604 | // Post-Process list of events with relations, put Event objects in relation |
1605 | Event *ev; | 1605 | Event *ev; |
1606 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { | 1606 | for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { |
1607 | ev->setRelatedTo(mCalendar->event(ev->relatedToUid())); | 1607 | Incidence * inc = mCalendar->event(ev->relatedToUid()); |
1608 | if ( inc ) | ||
1609 | ev->setRelatedTo( inc ); | ||
1608 | } | 1610 | } |
1609 | Todo *todo; | 1611 | Todo *todo; |
1610 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { | 1612 | for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { |
1611 | todo->setRelatedTo(mCalendar->todo(todo->relatedToUid())); | 1613 | Incidence * inc = mCalendar->todo(todo->relatedToUid()); |
1614 | if ( inc ) | ||
1615 | todo->setRelatedTo( inc ); | ||
1612 | } | 1616 | } |
1613 | } | 1617 | } |
1614 | 1618 | ||
1615 | const char *VCalFormat::dayFromNum(int day) | 1619 | const char *VCalFormat::dayFromNum(int day) |
1616 | { | 1620 | { |
1617 | const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " }; | 1621 | const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " }; |
1618 | 1622 | ||
1619 | return days[day]; | 1623 | return days[day]; |
1620 | } | 1624 | } |
1621 | 1625 | ||
1622 | int VCalFormat::numFromDay(const QString &day) | 1626 | int VCalFormat::numFromDay(const QString &day) |
1623 | { | 1627 | { |