summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -2996,38 +2996,26 @@ void CalendarView::appointment_delete()
}
deleteEvent(anEvent);
}
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)
{
if (!todo) {
KNotifyClient::beep();
return;
}
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index dcfee5d..406cd48 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -33,17 +33,17 @@
#include "syncdefines.h"
using namespace KCal;
Calendar::Calendar()
{
init();
- setTimeZoneId( i18n (" 00:00 Europe/London(UTC)") );
+ setTimeZoneId( " 00:00 Europe/London(UTC)" );
}
Calendar::Calendar( const QString &timeZoneId )
{
init();
setTimeZoneId(timeZoneId);
}
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp
index 8a3d069..359f65f 100644
--- a/libkcal/calformat.cpp
+++ b/libkcal/calformat.cpp
@@ -21,29 +21,29 @@
#include <klocale.h>
#include <kdebug.h>
#include <kapplication.h>
#include "calformat.h"
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.
struct CalVersion {
int version;
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() }
};
CalFormat::CalFormat()
{
mException = 0;
}
@@ -73,24 +73,20 @@ ErrorFormat *CalFormat::exception()
void CalFormat::setApplication(const QString& application, const QString& productID)
{
mApplication = application;
mProductId = productID;
}
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)
{
for (const CalVersion* cv = prodIds; cv->version; ++cv) {
if (!strcmp(prodId, cv->prodId.local8Bit()))
return cv->version;
}
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index eae41aa..fe7413f 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -361,19 +361,19 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
if (!tmpStr.isEmpty()) {
tmpStr.truncate(tmpStr.length()-1);
icalcomponent_add_property(parent,icalproperty_new_categories(
writeText(incidence->getCategories().join(";"))));
}
*/
// 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
Recurrence *recur = incidence->recurrence();
if (recur->doesRecur()) {
icalcomponent_add_property(parent,writeRecurrenceRule(recur));
}
@@ -2031,21 +2031,25 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
SKIP:
;
} // while
#endif
// 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;
}
QString ICalFormatImpl::extractErrorProperty(icalcomponent *c)
{
// kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: "
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index a312ba5..6bca12c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -385,17 +385,22 @@ void Incidence::setRelatedTo(Incidence *relatedTo)
//qDebug("Incidence::setRelatedTo %d ", relatedTo);
//qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
if (mReadOnly || mRelatedTo == relatedTo) return;
if(mRelatedTo) {
// updated();
mRelatedTo->removeRelation(this);
}
mRelatedTo = relatedTo;
- if (mRelatedTo) mRelatedTo->addRelation(this);
+ if (mRelatedTo) {
+ mRelatedTo->addRelation(this);
+ mRelatedToUid = mRelatedTo->uid();
+ } else {
+ mRelatedToUid = "";
+ }
}
Incidence *Incidence::relatedTo() const
{
return mRelatedTo;
}
QPtrList<Incidence> Incidence::relations() const
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 8794f7a..7906046 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -19,16 +19,18 @@
*/
#include <kglobal.h>
#include <kglobalsettings.h>
#include <klocale.h>
#include <kdebug.h>
#include <qregexp.h>
+#include "calendarlocal.h"
+#include "icalformat.h"
#include "todo.h"
using namespace KCal;
Todo::Todo(): Incidence()
{
// mStatus = TENTATIVE;
@@ -50,16 +52,17 @@ Todo::Todo(const Todo &t) : Incidence(t)
mPercentComplete = t.mPercentComplete;
mRunning = false;
mRunSaveTimer = 0;
}
Todo::~Todo()
{
setRunning( false );
+ qDebug("Todo::~Todo() ");
}
void Todo::setRunning( bool run )
{
if ( run == mRunning )
return;
if ( !mRunSaveTimer ) {
mRunSaveTimer = new QTimer ( this );
@@ -76,38 +79,33 @@ void Todo::setRunning( bool run )
}
void Todo::saveRunningInfoToFile()
{
qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
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()
{
if ( !mRunning )
return 0;
return mRunStart.secsTo( QDateTime::currentDateTime() );
}
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 62a31ae..8efc1ea 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -321,19 +321,19 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit());
}
// priority
tmpStr.sprintf("%i",anEvent->priority());
addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit());
// related event
- if (anEvent->relatedTo()) {
+ if (anEvent->relatedToUid()) {
addPropValue(vtodo, VCRelatedToProp,
- anEvent->relatedTo()->uid().local8Bit());
+ anEvent->relatedToUid().local8Bit());
}
// categories
QStringList tmpStrList = anEvent->categories();
tmpStr = "";
QString catStr;
for ( QStringList::Iterator it = tmpStrList.begin();
it != tmpStrList.end();
@@ -667,19 +667,19 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
tmpStr.sprintf("%i",anEvent->priority());
addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit());
// transparency
tmpStr.sprintf("%i",anEvent->transparency());
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()) {
// pilot sync stuff
tmpStr.sprintf("%i",anEvent->pilotId());
addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit());
tmpStr.sprintf("%i",anEvent->syncStatus());
addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit());
@@ -1599,21 +1599,25 @@ void VCalFormat::populate(VObject *vcal)
}
SKIP:
;
} // while
// 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 );
}
}
const char *VCalFormat::dayFromNum(int day)
{
const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " };
return days[day];
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index e54b0d9..b65ce66 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -37,17 +37,18 @@ QFont KGlobalSettings::generalMaxFont()
f.setPointSize( size );
return f;
}
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;
}
QFont KGlobalSettings::toolBarFont()
{
return QApplication::font();
}