-rw-r--r-- | korganizer/calendarview.cpp | 18 | ||||
-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 | ||||
-rw-r--r-- | microkde/kglobalsettings.cpp | 3 |
8 files changed, 56 insertions, 60 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8512a07..c530037 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3002,12 +3002,8 @@ void CalendarView::todo_resub( Todo * parent, Todo * sub ) | |||
3002 | { | 3002 | { |
3003 | if (!sub) return; | 3003 | if (!sub) return; |
3004 | if (!parent) return; | 3004 | if ( sub->relatedTo() == parent ) |
3005 | if ( sub->relatedTo() ) | 3005 | return; |
3006 | sub->relatedTo()->removeRelation(sub); | ||
3007 | sub->setRelatedTo(parent); | 3006 | sub->setRelatedTo(parent); |
3008 | sub->setRelatedToUid(parent->uid()); | ||
3009 | parent->addRelation(sub); | ||
3010 | sub->updated(); | 3007 | sub->updated(); |
3011 | parent->updated(); | ||
3012 | setModified(true); | 3008 | setModified(true); |
3013 | updateView(); | 3009 | updateView(); |
@@ -3015,13 +3011,5 @@ void CalendarView::todo_resub( Todo * parent, Todo * sub ) | |||
3015 | void CalendarView::todo_unsub(Todo *anTodo ) | 3011 | void CalendarView::todo_unsub(Todo *anTodo ) |
3016 | { | 3012 | { |
3017 | // Todo *anTodo = selectedTodo(); | 3013 | todo_resub( 0, anTodo ); |
3018 | if (!anTodo) return; | ||
3019 | if (!anTodo->relatedTo()) return; | ||
3020 | anTodo->relatedTo()->removeRelation(anTodo); | ||
3021 | anTodo->setRelatedTo(0); | ||
3022 | anTodo->updated(); | ||
3023 | anTodo->setRelatedToUid(""); | ||
3024 | setModified(true); | ||
3025 | updateView(); | ||
3026 | } | 3014 | } |
3027 | 3015 | ||
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index dcfee5d..406cd48 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -39,5 +39,5 @@ Calendar::Calendar() | |||
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 | ||
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp index 8a3d069..359f65f 100644 --- a/libkcal/calformat.cpp +++ b/libkcal/calformat.cpp | |||
@@ -27,6 +27,6 @@ | |||
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. |
@@ -37,7 +37,7 @@ struct CalVersion { | |||
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 | }; |
@@ -79,12 +79,8 @@ void CalFormat::setApplication(const QString& application, const QString& produc | |||
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 | ||
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index eae41aa..fe7413f 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -367,7 +367,7 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
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 | ||
@@ -2037,9 +2037,13 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) | |||
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 | ||
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index a312ba5..6bca12c 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -391,5 +391,10 @@ void Incidence::setRelatedTo(Incidence *relatedTo) | |||
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 | ||
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 8794f7a..7906046 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -25,4 +25,6 @@ | |||
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 | ||
@@ -56,4 +58,5 @@ Todo::~Todo() | |||
56 | { | 58 | { |
57 | setRunning( false ); | 59 | setRunning( false ); |
60 | qDebug("Todo::~Todo() "); | ||
58 | } | 61 | } |
59 | 62 | ||
@@ -82,26 +85,21 @@ void Todo::saveRunningInfoToFile() | |||
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 | ||
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 62a31ae..8efc1ea 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -327,7 +327,7 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
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 | ||
@@ -673,7 +673,7 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
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 | ||
@@ -1605,9 +1605,13 @@ void VCalFormat::populate(VObject *vcal) | |||
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 | } |
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index e54b0d9..b65ce66 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp | |||
@@ -43,5 +43,6 @@ QString KGlobalSettings::timeTrackerDir() | |||
43 | static QString dir; | 43 | static QString dir; |
44 | if ( dir.isEmpty() ) { | 44 | if ( dir.isEmpty() ) { |
45 | dir = locateLocal( "data", "timetracker" ); | 45 | dir = locateLocal( "data", "timetrackerdir/d.ttl" ); |
46 | dir = dir.left ( dir.length() - 5); | ||
46 | } | 47 | } |
47 | return dir; | 48 | return dir; |