summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-10 08:53:14 (UTC)
committer zautrix <zautrix>2005-04-10 08:53:14 (UTC)
commit79b12b680f6a0653bcff84c8ef83b23803246b7d (patch) (unidiff)
tree05e4c6d7ac0446eacb7dff6ca466f656b3152793
parent54f5fe5e6f4909109edf915513c02f7af3e7bb2d (diff)
downloadkdepimpi-79b12b680f6a0653bcff84c8ef83b23803246b7d.zip
kdepimpi-79b12b680f6a0653bcff84c8ef83b23803246b7d.tar.gz
kdepimpi-79b12b680f6a0653bcff84c8ef83b23803246b7d.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp18
-rw-r--r--libkcal/calendar.cpp2
-rw-r--r--libkcal/calformat.cpp20
-rw-r--r--libkcal/icalformatimpl.cpp12
-rw-r--r--libkcal/incidence.cpp7
-rw-r--r--libkcal/todo.cpp38
-rw-r--r--libkcal/vcalformat.cpp16
-rw-r--r--microkde/kglobalsettings.cpp3
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
@@ -2998,34 +2998,22 @@ void CalendarView::appointment_delete()
2998 deleteEvent(anEvent); 2998 deleteEvent(anEvent);
2999} 2999}
3000 3000
3001void CalendarView::todo_resub( Todo * parent, Todo * sub ) 3001void 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}
3015void CalendarView::todo_unsub(Todo *anTodo ) 3011void 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
3028void CalendarView::deleteTodo(Todo *todo) 3016void CalendarView::deleteTodo(Todo *todo)
3029{ 3017{
3030 if (!todo) { 3018 if (!todo) {
3031 KNotifyClient::beep(); 3019 KNotifyClient::beep();
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index dcfee5d..406cd48 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -35,13 +35,13 @@
35using namespace KCal; 35using namespace KCal;
36 36
37Calendar::Calendar() 37Calendar::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
44Calendar::Calendar( const QString &timeZoneId ) 44Calendar::Calendar( const QString &timeZoneId )
45{ 45{
46 46
47 init(); 47 init();
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp
index 8a3d069..359f65f 100644
--- a/libkcal/calformat.cpp
+++ b/libkcal/calformat.cpp
@@ -23,25 +23,25 @@
23#include <kapplication.h> 23#include <kapplication.h>
24 24
25#include "calformat.h" 25#include "calformat.h"
26 26
27using namespace KCal; 27using namespace KCal;
28 28
29QString CalFormat::mApplication = QString::fromLatin1("libkcal"); 29QString CalFormat::mApplication = QString::fromLatin1("libkcal-pi");
30QString CalFormat::mProductId = QString::fromLatin1("-//K Desktop Environment//NONSGML libkcal 3.1//EN"); 30QString 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.
34struct CalVersion { 34struct CalVersion {
35 int version; 35 int version;
36 QString prodId; 36 QString prodId;
37}; 37};
38static CalVersion prodIds[] = { 38static 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
46CalFormat::CalFormat() 46CalFormat::CalFormat()
47{ 47{
@@ -75,20 +75,16 @@ void CalFormat::setApplication(const QString& application, const QString& produc
75 mApplication = application; 75 mApplication = application;
76 mProductId = productID; 76 mProductId = productID;
77} 77}
78 78
79QString CalFormat::createUniqueId() 79QString 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
91int CalFormat::calendarVersion(const char* prodId) 87int 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()))
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index eae41aa..fe7413f 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -363,15 +363,15 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
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
@@ -2033,17 +2033,21 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
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
2049QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) 2053QString ICalFormatImpl::extractErrorProperty(icalcomponent *c)
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index a312ba5..6bca12c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -387,13 +387,18 @@ void Incidence::setRelatedTo(Incidence *relatedTo)
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
396Incidence *Incidence::relatedTo() const 401Incidence *Incidence::relatedTo() const
397{ 402{
398 return mRelatedTo; 403 return mRelatedTo;
399} 404}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 8794f7a..7906046 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -21,12 +21,14 @@
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
29using namespace KCal; 31using namespace KCal;
30 32
31Todo::Todo(): Incidence() 33Todo::Todo(): Incidence()
32{ 34{
@@ -52,12 +54,13 @@ Todo::Todo(const Todo &t) : Incidence(t)
52 mRunSaveTimer = 0; 54 mRunSaveTimer = 0;
53} 55}
54 56
55Todo::~Todo() 57Todo::~Todo()
56{ 58{
57 setRunning( false ); 59 setRunning( false );
60 qDebug("Todo::~Todo() ");
58} 61}
59 62
60void Todo::setRunning( bool run ) 63void Todo::setRunning( bool run )
61{ 64{
62 if ( run == mRunning ) 65 if ( run == mRunning )
63 return; 66 return;
@@ -78,34 +81,29 @@ void Todo::setRunning( bool run )
78void Todo::saveRunningInfoToFile() 81void 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
108int Todo::runTime() 106int Todo::runTime()
109{ 107{
110 if ( !mRunning ) 108 if ( !mRunning )
111 return 0; 109 return 0;
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 62a31ae..8efc1ea 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -323,15 +323,15 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
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;
@@ -669,15 +669,15 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
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());
@@ -1601,17 +1601,21 @@ void VCalFormat::populate(VObject *vcal)
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
1615const char *VCalFormat::dayFromNum(int day) 1619const 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 " };
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index e54b0d9..b65ce66 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -39,13 +39,14 @@ QFont KGlobalSettings::generalMaxFont()
39} 39}
40 40
41QString KGlobalSettings::timeTrackerDir() 41QString 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
50QFont KGlobalSettings::toolBarFont() 51QFont KGlobalSettings::toolBarFont()
51{ 52{