summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-10 08:53:14 (UTC)
committer zautrix <zautrix>2005-04-10 08:53:14 (UTC)
commit79b12b680f6a0653bcff84c8ef83b23803246b7d (patch) (side-by-side diff)
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
@@ -3001,28 +3001,16 @@ void CalendarView::appointment_delete()
void CalendarView::todo_resub( Todo * parent, Todo * sub )
{
if (!sub) return;
- if (!parent) return;
- if ( sub->relatedTo() )
- sub->relatedTo()->removeRelation(sub);
+ if ( sub->relatedTo() == parent )
+ return;
sub->setRelatedTo(parent);
- sub->setRelatedToUid(parent->uid());
- parent->addRelation(sub);
sub->updated();
- parent->updated();
setModified(true);
updateView();
}
void CalendarView::todo_unsub(Todo *anTodo )
{
- // Todo *anTodo = selectedTodo();
- if (!anTodo) return;
- if (!anTodo->relatedTo()) return;
- anTodo->relatedTo()->removeRelation(anTodo);
- anTodo->setRelatedTo(0);
- anTodo->updated();
- anTodo->setRelatedToUid("");
- setModified(true);
- updateView();
+ todo_resub( 0, anTodo );
}
void CalendarView::deleteTodo(Todo *todo)
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index dcfee5d..406cd48 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -38,7 +38,7 @@ Calendar::Calendar()
{
init();
- setTimeZoneId( i18n (" 00:00 Europe/London(UTC)") );
+ setTimeZoneId( " 00:00 Europe/London(UTC)" );
}
Calendar::Calendar( const QString &timeZoneId )
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp
index 8a3d069..359f65f 100644
--- a/libkcal/calformat.cpp
+++ b/libkcal/calformat.cpp
@@ -26,8 +26,8 @@
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");
// An array containing the PRODID strings indexed against the calendar file format version used.
// Every time the calendar file format is changed, add an entry/entries to this list.
@@ -36,9 +36,9 @@ struct CalVersion {
QString prodId;
};
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() }
};
@@ -78,14 +78,10 @@ void CalFormat::setApplication(const QString& application, const QString& produc
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);
}
int CalFormat::calendarVersion(const char* prodId)
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index eae41aa..fe7413f 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -366,9 +366,9 @@ 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()));
}
// recurrence rule stuff
@@ -2036,11 +2036,15 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
// Post-Process list of events with relations, put Event objects in relation
Event *ev;
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 );
}
Todo *todo;
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 );
}
return true;
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index a312ba5..6bca12c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -390,7 +390,12 @@ void Incidence::setRelatedTo(Incidence *relatedTo)
mRelatedTo->removeRelation(this);
}
mRelatedTo = relatedTo;
- if (mRelatedTo) mRelatedTo->addRelation(this);
+ if (mRelatedTo) {
+ mRelatedTo->addRelation(this);
+ mRelatedToUid = mRelatedTo->uid();
+ } else {
+ mRelatedToUid = "";
+ }
}
Incidence *Incidence::relatedTo() const
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 8794f7a..7906046 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -24,6 +24,8 @@
#include <kdebug.h>
#include <qregexp.h>
+#include "calendarlocal.h"
+#include "icalformat.h"
#include "todo.h"
using namespace KCal;
@@ -55,6 +57,7 @@ Todo::Todo(const Todo &t) : Incidence(t)
Todo::~Todo()
{
setRunning( false );
+ qDebug("Todo::~Todo() ");
}
void Todo::setRunning( bool run )
@@ -81,28 +84,23 @@ void Todo::saveRunningInfoToFile()
QString dir = KGlobalSettings::timeTrackerDir();
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 );
-
-
}
int Todo::runTime()
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 62a31ae..8efc1ea 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -326,9 +326,9 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit());
// related event
- if (anEvent->relatedTo()) {
+ if (anEvent->relatedToUid()) {
addPropValue(vtodo, VCRelatedToProp,
- anEvent->relatedTo()->uid().local8Bit());
+ anEvent->relatedToUid().local8Bit());
}
// categories
@@ -672,9 +672,9 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
addPropValue(vevent, VCTranspProp, tmpStr.local8Bit());
// related event
- if (anEvent->relatedTo()) {
+ if (anEvent->relatedToUid()) {
addPropValue(vevent, VCRelatedToProp,
- anEvent->relatedTo()->uid().local8Bit());
+ anEvent->relatedToUid().local8Bit());
}
if (anEvent->pilotId()) {
@@ -1604,11 +1604,15 @@ void VCalFormat::populate(VObject *vcal)
// Post-Process list of events with relations, put Event objects in relation
Event *ev;
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 );
}
Todo *todo;
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 );
}
}
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index e54b0d9..b65ce66 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -42,7 +42,8 @@ QString KGlobalSettings::timeTrackerDir()
{
static QString dir;
if ( dir.isEmpty() ) {
- dir = locateLocal( "data", "timetracker" );
+ dir = locateLocal( "data", "timetrackerdir/d.ttl" );
+ dir = dir.left ( dir.length() - 5);
}
return dir;
}