summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-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
6 files changed, 51 insertions, 44 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index dcfee5d..406cd48 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -40,3 +40,3 @@ Calendar::Calendar()
init();
- setTimeZoneId( i18n (" 00:00 Europe/London(UTC)") );
+ setTimeZoneId( " 00:00 Europe/London(UTC)" );
}
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp
index 8a3d069..359f65f 100644
--- a/libkcal/calformat.cpp
+++ b/libkcal/calformat.cpp
@@ -28,4 +28,4 @@ using namespace KCal;
-QString CalFormat::mApplication = QString::fromLatin1("libkcal");
-QString CalFormat::mProductId = QString::fromLatin1("-//K Desktop Environment//NONSGML libkcal 3.1//EN");
+QString CalFormat::mApplication = QString::fromLatin1("libkcal-pi");
+QString CalFormat::mProductId = QString::fromLatin1("-//KDE-Pim//Platform-independent 2.1.0");
@@ -38,5 +38,5 @@ struct CalVersion {
static CalVersion prodIds[] = {
- { 220, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 2.2//EN") },
- { 300, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.0//EN") },
- { 310, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.1//EN") },
+ { 220, QString::fromLatin1("-//KDE-Pim//Pi 2.2//EN") },
+ { 300, QString::fromLatin1("-//KDE-Pim//Pi 3.0//EN") },
+ { 310, QString::fromLatin1("-//KDE-Pim//Pi 3.1//EN") },
{ 0 , QString() }
@@ -80,10 +80,6 @@ QString CalFormat::createUniqueId()
{
- int hashTime = QTime::currentTime().hour() +
- QTime::currentTime().minute() + QTime::currentTime().second() +
- QTime::currentTime().msec();
- QString uidStr = QString("%1-%2.%3")
- .arg(mApplication)
+ return QString("%1-%2-%3")
+ .arg("kopi")
.arg(KApplication::random())
- .arg(hashTime);
- return uidStr;
+ .arg(QTime::currentTime().msec()+1);
}
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index eae41aa..fe7413f 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -368,5 +368,5 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
// related event
- if (incidence->relatedTo()) {
+ if (!incidence->relatedToUid().isEmpty()) {
icalcomponent_add_property(parent,icalproperty_new_relatedto(
- incidence->relatedTo()->uid().utf8()));
+ incidence->relatedToUid().utf8()));
}
@@ -2038,3 +2038,5 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) {
- ev->setRelatedTo(cal->event(ev->relatedToUid()));
+ Incidence * inc = cal->event(ev->relatedToUid());
+ if ( inc )
+ ev->setRelatedTo( inc );
}
@@ -2042,3 +2044,5 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) {
- todo->setRelatedTo(cal->todo(todo->relatedToUid()));
+ Incidence * inc = cal->todo(todo->relatedToUid());
+ if ( inc )
+ todo->setRelatedTo( inc );
}
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index a312ba5..6bca12c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -392,3 +392,8 @@ void Incidence::setRelatedTo(Incidence *relatedTo)
mRelatedTo = relatedTo;
- if (mRelatedTo) mRelatedTo->addRelation(this);
+ if (mRelatedTo) {
+ mRelatedTo->addRelation(this);
+ mRelatedToUid = mRelatedTo->uid();
+ } else {
+ mRelatedToUid = "";
+ }
}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 8794f7a..7906046 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -26,2 +26,4 @@
+#include "calendarlocal.h"
+#include "icalformat.h"
#include "todo.h"
@@ -57,2 +59,3 @@ Todo::~Todo()
setRunning( false );
+ qDebug("Todo::~Todo() ");
}
@@ -83,23 +86,18 @@ void Todo::saveRunningInfoToFile()
qDebug("%s ", dir.latin1());
- QString file = "%1-%2-%3-%4-%5-%6-%7.tt";
-
- 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 );
+ QString file = "%1%2%3-%4%5%6-%7%8%9-";
+ int runtime = mRunStart.secsTo( QDateTime::currentDateTime() );
+ runtime = (runtime / 60) +1;
+ int h = runtime / 60;
+ int m = runtime % 60;
+ int d = h / 24;
+ h = h % 24;
+ 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 );
file.replace ( QRegExp (" "), "0" );
- file = dir +"/" +file;
- qDebug("%s ", file.latin1());
- QStringList dataList;
-
- //Summary
- //Category
- //CategoryColor
- //StartRuntime
- //Runtime
- //Due
- //Start
- //Prio
- //Erledigt
- //Uid
- //Parents uids
-
-
+ file = dir +"/" +file + uid()+".ics";
+ qDebug("File %s ",file.latin1() );
+ CalendarLocal cal;
+ cal.setTimeZoneId( " 00:00 Europe/London(UTC)" );
+ cal.addIncidence( clone() );
+ ICalFormat format;
+ format.save( &cal, file );
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 62a31ae..8efc1ea 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -328,5 +328,5 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
// related event
- if (anEvent->relatedTo()) {
+ if (anEvent->relatedToUid()) {
addPropValue(vtodo, VCRelatedToProp,
- anEvent->relatedTo()->uid().local8Bit());
+ anEvent->relatedToUid().local8Bit());
}
@@ -674,5 +674,5 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
// related event
- if (anEvent->relatedTo()) {
+ if (anEvent->relatedToUid()) {
addPropValue(vevent, VCRelatedToProp,
- anEvent->relatedTo()->uid().local8Bit());
+ anEvent->relatedToUid().local8Bit());
}
@@ -1606,3 +1606,5 @@ void VCalFormat::populate(VObject *vcal)
for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) {
- ev->setRelatedTo(mCalendar->event(ev->relatedToUid()));
+ Incidence * inc = mCalendar->event(ev->relatedToUid());
+ if ( inc )
+ ev->setRelatedTo( inc );
}
@@ -1610,3 +1612,5 @@ void VCalFormat::populate(VObject *vcal)
for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) {
- todo->setRelatedTo(mCalendar->todo(todo->relatedToUid()));
+ Incidence * inc = mCalendar->todo(todo->relatedToUid());
+ if ( inc )
+ todo->setRelatedTo( inc );
}