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
@@ -3000,30 +3000,18 @@ void CalendarView::appointment_delete()
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{
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index dcfee5d..406cd48 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -37,9 +37,9 @@ using namespace KCal;
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{
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp
index 8a3d069..359f65f 100644
--- a/libkcal/calformat.cpp
+++ b/libkcal/calformat.cpp
@@ -25,21 +25,21 @@
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
@@ -77,16 +77,12 @@ void CalFormat::setApplication(const QString& application, const QString& produc
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{
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index eae41aa..fe7413f 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -365,11 +365,11 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
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();
@@ -2035,13 +2035,17 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
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}
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index a312ba5..6bca12c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -389,9 +389,14 @@ void Incidence::setRelatedTo(Incidence *relatedTo)
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{
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 8794f7a..7906046 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -23,8 +23,10 @@
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
@@ -54,8 +56,9 @@ Todo::Todo(const Todo &t) : Incidence(t)
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{
@@ -80,30 +83,25 @@ void Todo::saveRunningInfoToFile()
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{
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 62a31ae..8efc1ea 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -325,11 +325,11 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
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();
@@ -671,11 +671,11 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
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
@@ -1603,13 +1603,17 @@ void VCalFormat::populate(VObject *vcal)
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)
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index e54b0d9..b65ce66 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -41,9 +41,10 @@ QFont KGlobalSettings::generalMaxFont()
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