-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 | |||
@@ -2972,86 +2972,74 @@ void CalendarView::appointment_edit() | |||
2972 | 2972 | ||
2973 | if (!anEvent) { | 2973 | if (!anEvent) { |
2974 | KNotifyClient::beep(); | 2974 | KNotifyClient::beep(); |
2975 | return; | 2975 | return; |
2976 | } | 2976 | } |
2977 | 2977 | ||
2978 | editEvent(anEvent); | 2978 | editEvent(anEvent); |
2979 | } | 2979 | } |
2980 | 2980 | ||
2981 | void CalendarView::appointment_delete() | 2981 | void CalendarView::appointment_delete() |
2982 | { | 2982 | { |
2983 | Event *anEvent = 0; | 2983 | Event *anEvent = 0; |
2984 | 2984 | ||
2985 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2985 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2986 | 2986 | ||
2987 | if (mViewManager->currentView()->isEventView()) { | 2987 | if (mViewManager->currentView()->isEventView()) { |
2988 | if ( incidence && incidence->type() == "Event" ) { | 2988 | if ( incidence && incidence->type() == "Event" ) { |
2989 | anEvent = static_cast<Event *>(incidence); | 2989 | anEvent = static_cast<Event *>(incidence); |
2990 | } | 2990 | } |
2991 | } | 2991 | } |
2992 | 2992 | ||
2993 | if (!anEvent) { | 2993 | if (!anEvent) { |
2994 | KNotifyClient::beep(); | 2994 | KNotifyClient::beep(); |
2995 | return; | 2995 | return; |
2996 | } | 2996 | } |
2997 | 2997 | ||
2998 | deleteEvent(anEvent); | 2998 | deleteEvent(anEvent); |
2999 | } | 2999 | } |
3000 | 3000 | ||
3001 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3001 | 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(); |
3014 | } | 3010 | } |
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 | ||
3028 | void CalendarView::deleteTodo(Todo *todo) | 3016 | void CalendarView::deleteTodo(Todo *todo) |
3029 | { | 3017 | { |
3030 | if (!todo) { | 3018 | if (!todo) { |
3031 | KNotifyClient::beep(); | 3019 | KNotifyClient::beep(); |
3032 | return; | 3020 | return; |
3033 | } | 3021 | } |
3034 | if (KOPrefs::instance()->mConfirm) { | 3022 | if (KOPrefs::instance()->mConfirm) { |
3035 | QString text = todo->summary().left(20); | 3023 | QString text = todo->summary().left(20); |
3036 | if (!todo->relations().isEmpty()) { | 3024 | if (!todo->relations().isEmpty()) { |
3037 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3025 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3038 | 3026 | ||
3039 | } | 3027 | } |
3040 | switch (msgItemDelete(text)) { | 3028 | switch (msgItemDelete(text)) { |
3041 | case KMessageBox::Continue: // OK | 3029 | case KMessageBox::Continue: // OK |
3042 | bool deleteT = false; | 3030 | bool deleteT = false; |
3043 | if (!todo->relations().isEmpty()) { | 3031 | if (!todo->relations().isEmpty()) { |
3044 | deleteT = removeCompletedSubTodos( todo ); | 3032 | deleteT = removeCompletedSubTodos( todo ); |
3045 | } | 3033 | } |
3046 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3034 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3047 | if ( !deleteT ) { | 3035 | if ( !deleteT ) { |
3048 | checkExternalId( todo ); | 3036 | checkExternalId( todo ); |
3049 | calendar()->deleteTodo(todo); | 3037 | calendar()->deleteTodo(todo); |
3050 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3038 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3051 | updateView(); | 3039 | updateView(); |
3052 | } | 3040 | } |
3053 | break; | 3041 | break; |
3054 | } // switch | 3042 | } // switch |
3055 | } else { | 3043 | } else { |
3056 | checkExternalId( todo ); | 3044 | checkExternalId( todo ); |
3057 | mCalendar->deleteTodo(todo); | 3045 | mCalendar->deleteTodo(todo); |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index dcfee5d..406cd48 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -9,65 +9,65 @@ | |||
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <time.h> | 23 | #include <time.h> |
24 | 24 | ||
25 | #include <kdebug.h> | 25 | #include <kdebug.h> |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
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; |
54 | mNewObserver = false; | 54 | mNewObserver = false; |
55 | mUndoIncidence = 0; | 55 | mUndoIncidence = 0; |
56 | mModified = false; | 56 | mModified = false; |
57 | 57 | ||
58 | // Setup default filter, which does nothing | 58 | // Setup default filter, which does nothing |
59 | mDefaultFilter = new CalFilter; | 59 | mDefaultFilter = new CalFilter; |
60 | mFilter = mDefaultFilter; | 60 | mFilter = mDefaultFilter; |
61 | mFilter->setEnabled(false); | 61 | mFilter->setEnabled(false); |
62 | 62 | ||
63 | // initialize random numbers. This is a hack, and not | 63 | // initialize random numbers. This is a hack, and not |
64 | // even that good of one at that. | 64 | // even that good of one at that. |
65 | // srandom(time(0)); | 65 | // srandom(time(0)); |
66 | 66 | ||
67 | // user information... | 67 | // user information... |
68 | setOwner(i18n("Unknown Name")); | 68 | setOwner(i18n("Unknown Name")); |
69 | setEmail(i18n("unknown@nowhere")); | 69 | setEmail(i18n("unknown@nowhere")); |
70 | 70 | ||
71 | #if 0 | 71 | #if 0 |
72 | tmpStr = KOPrefs::instance()->mTimeZone; | 72 | tmpStr = KOPrefs::instance()->mTimeZone; |
73 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; | 73 | // kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; |
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp index 8a3d069..359f65f 100644 --- a/libkcal/calformat.cpp +++ b/libkcal/calformat.cpp | |||
@@ -1,98 +1,94 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <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; |
54 | } | 54 | } |
55 | 55 | ||
56 | void CalFormat::clearException() | 56 | void CalFormat::clearException() |
57 | { | 57 | { |
58 | delete mException; | 58 | delete mException; |
59 | mException = 0; | 59 | mException = 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | void CalFormat::setException(ErrorFormat *exception) | 62 | void CalFormat::setException(ErrorFormat *exception) |
63 | { | 63 | { |
64 | delete mException; | 64 | delete mException; |
65 | mException = exception; | 65 | mException = exception; |
66 | } | 66 | } |
67 | 67 | ||
68 | ErrorFormat *CalFormat::exception() | 68 | 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 | |||
@@ -337,67 +337,67 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
337 | QStringList::Iterator it; | 337 | QStringList::Iterator it; |
338 | for(it = categories.begin(); it != categories.end(); ++it ) { | 338 | for(it = categories.begin(); it != categories.end(); ++it ) { |
339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); | 339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); |
340 | } | 340 | } |
341 | // TODO: Ensure correct concatenation of categories properties. | 341 | // TODO: Ensure correct concatenation of categories properties. |
342 | 342 | ||
343 | /* | 343 | /* |
344 | // categories | 344 | // categories |
345 | tmpStrList = incidence->getCategories(); | 345 | tmpStrList = incidence->getCategories(); |
346 | tmpStr = ""; | 346 | tmpStr = ""; |
347 | QString catStr; | 347 | QString catStr; |
348 | for ( QStringList::Iterator it = tmpStrList.begin(); | 348 | for ( QStringList::Iterator it = tmpStrList.begin(); |
349 | it != tmpStrList.end(); | 349 | it != tmpStrList.end(); |
350 | ++it ) { | 350 | ++it ) { |
351 | catStr = *it; | 351 | catStr = *it; |
352 | if (catStr[0] == ' ') | 352 | if (catStr[0] == ' ') |
353 | tmpStr += catStr.mid(1); | 353 | tmpStr += catStr.mid(1); |
354 | else | 354 | else |
355 | tmpStr += catStr; | 355 | tmpStr += catStr; |
356 | // this must be a ';' character as the vCalendar specification requires! | 356 | // this must be a ';' character as the vCalendar specification requires! |
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; |
384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | 384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { |
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | 385 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
386 | writeICalDate(*exIt))); | 386 | writeICalDate(*exIt))); |
387 | } | 387 | } |
388 | 388 | ||
389 | // attachments | 389 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 390 | QPtrList<Attachment> attachments = incidence->attachments(); |
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 392 | icalcomponent_add_property(parent,writeAttachment(at)); |
393 | 393 | ||
394 | // alarms | 394 | // alarms |
395 | QPtrList<Alarm> alarms = incidence->alarms(); | 395 | QPtrList<Alarm> alarms = incidence->alarms(); |
396 | Alarm* alarm; | 396 | Alarm* alarm; |
397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
398 | if (alarm->enabled()) { | 398 | if (alarm->enabled()) { |
399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; | 399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; |
400 | icalcomponent_add_component(parent,writeAlarm(alarm)); | 400 | icalcomponent_add_component(parent,writeAlarm(alarm)); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | if( incidence->hasRecurrenceID() ) { | 403 | if( incidence->hasRecurrenceID() ) { |
@@ -2007,69 +2007,73 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar) | |||
2007 | goto SKIP; | 2007 | goto SKIP; |
2008 | } | 2008 | } |
2009 | 2009 | ||
2010 | anEvent = VEventToEvent(curVO); | 2010 | anEvent = VEventToEvent(curVO); |
2011 | // we now use addEvent instead of insertEvent so that the | 2011 | // we now use addEvent instead of insertEvent so that the |
2012 | // signal/slot get connected. | 2012 | // signal/slot get connected. |
2013 | if (anEvent) | 2013 | if (anEvent) |
2014 | cal->addEvent(anEvent); | 2014 | cal->addEvent(anEvent); |
2015 | else { | 2015 | else { |
2016 | // some sort of error must have occurred while in translation. | 2016 | // some sort of error must have occurred while in translation. |
2017 | goto SKIP; | 2017 | goto SKIP; |
2018 | } | 2018 | } |
2019 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { | 2019 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { |
2020 | anEvent = VTodoToEvent(curVO); | 2020 | anEvent = VTodoToEvent(curVO); |
2021 | cal->addTodo(anEvent); | 2021 | cal->addTodo(anEvent); |
2022 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || | 2022 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || |
2023 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || | 2023 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || |
2024 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { | 2024 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { |
2025 | // do nothing, we know these properties and we want to skip them. | 2025 | // do nothing, we know these properties and we want to skip them. |
2026 | // we have either already processed them or are ignoring them. | 2026 | // we have either already processed them or are ignoring them. |
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 | ||
2056 | icalproperty *error; | 2060 | icalproperty *error; |
2057 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); | 2061 | error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); |
2058 | while(error) { | 2062 | while(error) { |
2059 | errorMessage += icalproperty_get_xlicerror(error); | 2063 | errorMessage += icalproperty_get_xlicerror(error); |
2060 | errorMessage += "\n"; | 2064 | errorMessage += "\n"; |
2061 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); | 2065 | error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); |
2062 | } | 2066 | } |
2063 | 2067 | ||
2064 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; | 2068 | // kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; |
2065 | 2069 | ||
2066 | return errorMessage; | 2070 | return errorMessage; |
2067 | } | 2071 | } |
2068 | 2072 | ||
2069 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) | 2073 | void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) |
2070 | { | 2074 | { |
2071 | int i; | 2075 | int i; |
2072 | 2076 | ||
2073 | 2077 | ||
2074 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { | 2078 | if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
2075 | int index = 0; | 2079 | int index = 0; |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index a312ba5..6bca12c 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -361,65 +361,70 @@ void Incidence::setCategories(const QString &catStr) | |||
361 | 361 | ||
362 | QStringList Incidence::categories() const | 362 | QStringList Incidence::categories() const |
363 | { | 363 | { |
364 | return mCategories; | 364 | return mCategories; |
365 | } | 365 | } |
366 | 366 | ||
367 | QString Incidence::categoriesStr() | 367 | QString Incidence::categoriesStr() |
368 | { | 368 | { |
369 | return mCategories.join(","); | 369 | return mCategories.join(","); |
370 | } | 370 | } |
371 | 371 | ||
372 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 372 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
373 | { | 373 | { |
374 | if (mReadOnly) return; | 374 | if (mReadOnly) return; |
375 | mRelatedToUid = relatedToUid; | 375 | mRelatedToUid = relatedToUid; |
376 | } | 376 | } |
377 | 377 | ||
378 | QString Incidence::relatedToUid() const | 378 | QString Incidence::relatedToUid() const |
379 | { | 379 | { |
380 | return mRelatedToUid; | 380 | return mRelatedToUid; |
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 | ||
406 | void Incidence::addRelation(Incidence *event) | 411 | void Incidence::addRelation(Incidence *event) |
407 | { | 412 | { |
408 | if( mRelations.findRef( event ) == -1 ) { | 413 | if( mRelations.findRef( event ) == -1 ) { |
409 | mRelations.append(event); | 414 | mRelations.append(event); |
410 | //updated(); | 415 | //updated(); |
411 | } | 416 | } |
412 | } | 417 | } |
413 | 418 | ||
414 | void Incidence::removeRelation(Incidence *event) | 419 | void Incidence::removeRelation(Incidence *event) |
415 | { | 420 | { |
416 | 421 | ||
417 | mRelations.removeRef(event); | 422 | mRelations.removeRef(event); |
418 | 423 | ||
419 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 424 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
420 | } | 425 | } |
421 | 426 | ||
422 | bool Incidence::recursOn(const QDate &qd) const | 427 | bool Incidence::recursOn(const QDate &qd) const |
423 | { | 428 | { |
424 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 429 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
425 | else return false; | 430 | else return false; |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 8794f7a..7906046 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -1,137 +1,135 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <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; |
39 | mPercentComplete = 0; | 41 | mPercentComplete = 0; |
40 | mRunning = false; | 42 | mRunning = false; |
41 | mRunSaveTimer = 0; | 43 | mRunSaveTimer = 0; |
42 | } | 44 | } |
43 | 45 | ||
44 | Todo::Todo(const Todo &t) : Incidence(t) | 46 | Todo::Todo(const Todo &t) : Incidence(t) |
45 | { | 47 | { |
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 ) { |
70 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min | 73 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min |
71 | mRunStart = QDateTime::currentDateTime(); | 74 | mRunStart = QDateTime::currentDateTime(); |
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; |
118 | Incidence *aTodo; | 116 | Incidence *aTodo; |
119 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 117 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
120 | if ( ((Todo*)aTodo)->hasRunningSub() ) | 118 | if ( ((Todo*)aTodo)->hasRunningSub() ) |
121 | return true; | 119 | return true; |
122 | } | 120 | } |
123 | return false; | 121 | return false; |
124 | } | 122 | } |
125 | Incidence *Todo::clone() | 123 | Incidence *Todo::clone() |
126 | { | 124 | { |
127 | return new Todo(*this); | 125 | return new Todo(*this); |
128 | } | 126 | } |
129 | 127 | ||
130 | bool Todo::contains ( Todo* from ) | 128 | bool Todo::contains ( Todo* from ) |
131 | { | 129 | { |
132 | 130 | ||
133 | if ( !from->summary().isEmpty() ) | 131 | if ( !from->summary().isEmpty() ) |
134 | if ( !summary().startsWith( from->summary() )) | 132 | if ( !summary().startsWith( from->summary() )) |
135 | return false; | 133 | return false; |
136 | if ( from->hasStartDate() ) { | 134 | if ( from->hasStartDate() ) { |
137 | if ( !hasStartDate() ) | 135 | if ( !hasStartDate() ) |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 62a31ae..8efc1ea 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -297,67 +297,67 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
297 | 297 | ||
298 | // description BL: | 298 | // description BL: |
299 | if (!anEvent->description().isEmpty()) { | 299 | if (!anEvent->description().isEmpty()) { |
300 | VObject *d = addPropValue(vtodo, VCDescriptionProp, | 300 | VObject *d = addPropValue(vtodo, VCDescriptionProp, |
301 | anEvent->description().local8Bit()); | 301 | anEvent->description().local8Bit()); |
302 | if (anEvent->description().find('\n') != -1) | 302 | if (anEvent->description().find('\n') != -1) |
303 | addProp(d, VCQuotedPrintableProp); | 303 | addProp(d, VCQuotedPrintableProp); |
304 | } | 304 | } |
305 | 305 | ||
306 | // summary | 306 | // summary |
307 | if (!anEvent->summary().isEmpty()) | 307 | if (!anEvent->summary().isEmpty()) |
308 | addPropValue(vtodo, VCSummaryProp, anEvent->summary().local8Bit()); | 308 | addPropValue(vtodo, VCSummaryProp, anEvent->summary().local8Bit()); |
309 | 309 | ||
310 | if (!anEvent->location().isEmpty()) | 310 | if (!anEvent->location().isEmpty()) |
311 | addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit()); | 311 | addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit()); |
312 | 312 | ||
313 | // completed | 313 | // completed |
314 | // status | 314 | // status |
315 | // backward compatibility, KOrganizer used to interpret only these two values | 315 | // backward compatibility, KOrganizer used to interpret only these two values |
316 | addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" : | 316 | addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" : |
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); |
344 | else | 344 | else |
345 | tmpStr += catStr; | 345 | tmpStr += catStr; |
346 | // this must be a ';' character as the vCalendar specification requires! | 346 | // this must be a ';' character as the vCalendar specification requires! |
347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
348 | // read in. | 348 | // read in. |
349 | tmpStr += ";"; | 349 | tmpStr += ";"; |
350 | } | 350 | } |
351 | if (!tmpStr.isEmpty()) { | 351 | if (!tmpStr.isEmpty()) { |
352 | tmpStr.truncate(tmpStr.length()-1); | 352 | tmpStr.truncate(tmpStr.length()-1); |
353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); | 353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); |
354 | } | 354 | } |
355 | 355 | ||
356 | // alarm stuff | 356 | // alarm stuff |
357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; | 357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; |
358 | QPtrList<Alarm> alarms = anEvent->alarms(); | 358 | QPtrList<Alarm> alarms = anEvent->alarms(); |
359 | Alarm* alarm; | 359 | Alarm* alarm; |
360 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 360 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
361 | if (alarm->enabled()) { | 361 | if (alarm->enabled()) { |
362 | VObject *a; | 362 | VObject *a; |
363 | tmpStr = qDateTimeToISO(alarm->time()); | 363 | tmpStr = qDateTimeToISO(alarm->time()); |
@@ -643,67 +643,67 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
643 | VObject *a ; | 643 | VObject *a ; |
644 | tmpStr = qDateTimeToISO(alarm->time()); | 644 | tmpStr = qDateTimeToISO(alarm->time()); |
645 | if (alarm->type() == Alarm::Audio) { | 645 | if (alarm->type() == Alarm::Audio) { |
646 | a = addProp(vevent, VCAAlarmProp); | 646 | a = addProp(vevent, VCAAlarmProp); |
647 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 647 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
648 | addPropValue(a, VCRepeatCountProp, "1"); | 648 | addPropValue(a, VCRepeatCountProp, "1"); |
649 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); | 649 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); |
650 | } | 650 | } |
651 | if (alarm->type() == Alarm::Procedure) { | 651 | if (alarm->type() == Alarm::Procedure) { |
652 | a = addProp(vevent, VCPAlarmProp); | 652 | a = addProp(vevent, VCPAlarmProp); |
653 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 653 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
654 | addPropValue(a, VCRepeatCountProp, "1"); | 654 | addPropValue(a, VCRepeatCountProp, "1"); |
655 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); | 655 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); |
656 | } else { | 656 | } else { |
657 | a = addProp(vevent, VCDAlarmProp); | 657 | a = addProp(vevent, VCDAlarmProp); |
658 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 658 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
659 | addPropValue(a, VCRepeatCountProp, "1"); | 659 | addPropValue(a, VCRepeatCountProp, "1"); |
660 | addPropValue(a, VCDisplayStringProp, "beep!"); | 660 | addPropValue(a, VCDisplayStringProp, "beep!"); |
661 | 661 | ||
662 | } | 662 | } |
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 | } |
690 | 690 | ||
691 | Todo *VCalFormat::VTodoToEvent(VObject *vtodo) | 691 | Todo *VCalFormat::VTodoToEvent(VObject *vtodo) |
692 | { | 692 | { |
693 | VObject *vo; | 693 | VObject *vo; |
694 | VObjectIterator voi; | 694 | VObjectIterator voi; |
695 | char *s; | 695 | char *s; |
696 | 696 | ||
697 | Todo *anEvent = new Todo; | 697 | Todo *anEvent = new Todo; |
698 | 698 | ||
699 | // creation date | 699 | // creation date |
700 | if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != 0) { | 700 | if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != 0) { |
701 | anEvent->setCreated(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); | 701 | anEvent->setCreated(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); |
702 | deleteStr(s); | 702 | deleteStr(s); |
703 | } | 703 | } |
704 | 704 | ||
705 | // unique id | 705 | // unique id |
706 | vo = isAPropertyOf(vtodo, VCUniqueStringProp); | 706 | vo = isAPropertyOf(vtodo, VCUniqueStringProp); |
707 | // while the UID property is preferred, it is not required. We'll use the | 707 | // while the UID property is preferred, it is not required. We'll use the |
708 | // default Event UID if none is given. | 708 | // default Event UID if none is given. |
709 | if (vo) { | 709 | if (vo) { |
@@ -1575,69 +1575,73 @@ void VCalFormat::populate(VObject *vcal) | |||
1575 | // we now use addEvent instead of insertEvent so that the | 1575 | // we now use addEvent instead of insertEvent so that the |
1576 | // signal/slot get connected. | 1576 | // signal/slot get connected. |
1577 | if (anEvent) { | 1577 | if (anEvent) { |
1578 | if ( !anEvent->dtStart().isValid() || !anEvent->dtEnd().isValid() ) { | 1578 | if ( !anEvent->dtStart().isValid() || !anEvent->dtEnd().isValid() ) { |
1579 | kdDebug() << "VCalFormat::populate(): Event has invalid dates." | 1579 | kdDebug() << "VCalFormat::populate(): Event has invalid dates." |
1580 | << endl; | 1580 | << endl; |
1581 | } else { | 1581 | } else { |
1582 | mCalendar->addEvent(anEvent); | 1582 | mCalendar->addEvent(anEvent); |
1583 | } | 1583 | } |
1584 | } else { | 1584 | } else { |
1585 | // some sort of error must have occurred while in translation. | 1585 | // some sort of error must have occurred while in translation. |
1586 | goto SKIP; | 1586 | goto SKIP; |
1587 | } | 1587 | } |
1588 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { | 1588 | } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { |
1589 | Todo *aTodo = VTodoToEvent(curVO); | 1589 | Todo *aTodo = VTodoToEvent(curVO); |
1590 | mCalendar->addTodo(aTodo); | 1590 | mCalendar->addTodo(aTodo); |
1591 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || | 1591 | } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || |
1592 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || | 1592 | (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || |
1593 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { | 1593 | (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { |
1594 | // do nothing, we know these properties and we want to skip them. | 1594 | // do nothing, we know these properties and we want to skip them. |
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 | { |
1624 | if (day == "MO ") return 0; | 1628 | if (day == "MO ") return 0; |
1625 | if (day == "TU ") return 1; | 1629 | if (day == "TU ") return 1; |
1626 | if (day == "WE ") return 2; | 1630 | if (day == "WE ") return 2; |
1627 | if (day == "TH ") return 3; | 1631 | if (day == "TH ") return 3; |
1628 | if (day == "FR ") return 4; | 1632 | if (day == "FR ") return 4; |
1629 | if (day == "SA ") return 5; | 1633 | if (day == "SA ") return 5; |
1630 | if (day == "SU ") return 6; | 1634 | if (day == "SU ") return 6; |
1631 | 1635 | ||
1632 | return -1; // something bad happened. :) | 1636 | return -1; // something bad happened. :) |
1633 | } | 1637 | } |
1634 | Attendee::Role VCalFormat::readRole(const char *s) const | 1638 | Attendee::Role VCalFormat::readRole(const char *s) const |
1635 | { | 1639 | { |
1636 | QString statStr = s; | 1640 | QString statStr = s; |
1637 | statStr = statStr.upper(); | 1641 | statStr = statStr.upper(); |
1638 | Attendee::Role role = Attendee::ReqParticipant; | 1642 | Attendee::Role role = Attendee::ReqParticipant; |
1639 | 1643 | ||
1640 | if ( statStr == "OWNER") | 1644 | if ( statStr == "OWNER") |
1641 | role = Attendee::Chair; | 1645 | role = Attendee::Chair; |
1642 | // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair }; | 1646 | // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair }; |
1643 | 1647 | ||
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index e54b0d9..b65ce66 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp | |||
@@ -13,64 +13,65 @@ QFont KGlobalSettings::generalFont() | |||
13 | } | 13 | } |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | else | 15 | else |
16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
17 | size = 18; | 17 | size = 18; |
18 | #endif | 18 | #endif |
19 | QFont f = QApplication::font(); | 19 | QFont f = QApplication::font(); |
20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); | 20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); |
21 | f.setPointSize( size ); | 21 | f.setPointSize( size ); |
22 | return f; | 22 | return f; |
23 | } | 23 | } |
24 | QFont KGlobalSettings::generalMaxFont() | 24 | QFont KGlobalSettings::generalMaxFont() |
25 | { | 25 | { |
26 | int size = 12; | 26 | int size = 12; |
27 | if (QApplication::desktop()->width() < 480 ) { | 27 | if (QApplication::desktop()->width() < 480 ) { |
28 | size = 10; | 28 | size = 10; |
29 | } | 29 | } |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | else | 31 | else |
32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
33 | size = 18; | 33 | size = 18; |
34 | #endif | 34 | #endif |
35 | QFont f = QApplication::font(); | 35 | QFont f = QApplication::font(); |
36 | if ( f.pointSize() > size ) | 36 | if ( f.pointSize() > size ) |
37 | f.setPointSize( size ); | 37 | f.setPointSize( size ); |
38 | return f; | 38 | return f; |
39 | } | 39 | } |
40 | 40 | ||
41 | QString KGlobalSettings::timeTrackerDir() | 41 | QString KGlobalSettings::timeTrackerDir() |
42 | { | 42 | { |
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; |
48 | } | 49 | } |
49 | 50 | ||
50 | QFont KGlobalSettings::toolBarFont() | 51 | QFont KGlobalSettings::toolBarFont() |
51 | { | 52 | { |
52 | return QApplication::font(); | 53 | return QApplication::font(); |
53 | } | 54 | } |
54 | 55 | ||
55 | QColor KGlobalSettings::toolBarHighlightColor() | 56 | QColor KGlobalSettings::toolBarHighlightColor() |
56 | { | 57 | { |
57 | return QColor( "black" ); | 58 | return QColor( "black" ); |
58 | } | 59 | } |
59 | 60 | ||
60 | QRect KGlobalSettings::desktopGeometry( QWidget * ) | 61 | QRect KGlobalSettings::desktopGeometry( QWidget * ) |
61 | { | 62 | { |
62 | return QApplication::desktop()->rect(); | 63 | return QApplication::desktop()->rect(); |
63 | } | 64 | } |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Returns whether KDE runs in single (default) or double click | 67 | * Returns whether KDE runs in single (default) or double click |
67 | * mode. | 68 | * mode. |
68 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html | 69 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html |
69 | * @return true if single click mode, or false if double click mode. | 70 | * @return true if single click mode, or false if double click mode. |
70 | **/ | 71 | **/ |
71 | bool KGlobalSettings::singleClick() | 72 | bool KGlobalSettings::singleClick() |
72 | { | 73 | { |
73 | KConfig *c = KGlobal::config(); | 74 | KConfig *c = KGlobal::config(); |
74 | KConfigGroupSaver cgs( c, "KDE" ); | 75 | KConfigGroupSaver cgs( c, "KDE" ); |
75 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); | 76 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); |
76 | } | 77 | } |