summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-13 11:55:52 (UTC)
committer zautrix <zautrix>2005-02-13 11:55:52 (UTC)
commit0a33f91e166747406ca2ccb5819881feeecfdb40 (patch) (side-by-side diff)
treee9130a16aaa6365e106d6733c3e1adeca01f72ac
parent00ec9899a4727a4c9100d320935dde7da4803801 (diff)
downloadkdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.zip
kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.gz
kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.bz2
todo recurchanges
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneraltodo.cpp2
-rw-r--r--korganizer/koeditorgeneraltodo.h1
-rw-r--r--korganizer/koeditorrecurrence.cpp20
-rw-r--r--korganizer/koeditorrecurrence.h4
-rw-r--r--korganizer/kotodoeditor.cpp47
-rw-r--r--korganizer/kotodoeditor.h4
-rw-r--r--libkcal/icalformatimpl.cpp10
-rw-r--r--libkcal/incidence.cpp35
-rw-r--r--libkcal/incidence.h9
-rw-r--r--microkde/kdialogbase.h2
10 files changed, 121 insertions, 13 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 6370b54..a9d1ed3 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -371,2 +371,3 @@ void KOEditorGeneralTodo::enableDueEdit(bool enable)
}
+ emit datesChecked();
}
@@ -390,2 +391,3 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable )
}
+ emit datesChecked();
}
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index 98f43dd..b198539 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -74,2 +74,3 @@ class KOEditorGeneralTodo : public KOEditorGeneral
void openCategoryDialog();
+ void datesChecked();
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 4209e10..bedc75a 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -44,2 +44,3 @@
#include <libkcal/event.h>
+#include <libkcal/todo.h>
@@ -907,5 +908,12 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
-void KOEditorRecurrence::readEvent(Event *event)
+void KOEditorRecurrence::readEvent(Incidence *event)
{
- setDefaults( event->dtStart(), event->dtEnd(), true );
+
+ QDateTime dtEnd;
+ if ( event->type() == "Event" )
+ dtEnd = ((Event*)event)->dtEnd();
+ else
+ dtEnd = ((Todo*)event)->dtDue();
+
+ setDefaults( event->dtStart(), dtEnd, true );
QBitArray rDays( 7 );
@@ -916,3 +924,3 @@ void KOEditorRecurrence::readEvent(Event *event)
int month = 0;
- setDateTimes( event->dtStart(), event->dtEnd() );
+ setDateTimes( event->dtStart(), dtEnd );
@@ -930,3 +938,3 @@ void KOEditorRecurrence::readEvent(Event *event)
case Recurrence::rNone:
- setDefaults( event->dtStart(), event->dtEnd(), true );
+ setDefaults( event->dtStart(), dtEnd, true );
break;
@@ -1002,3 +1010,3 @@ void KOEditorRecurrence::readEvent(Event *event)
default:
- setDefaults( event->dtStart(), event->dtEnd(), true );
+ setDefaults( event->dtStart(), dtEnd, true );
break;
@@ -1026,3 +1034,3 @@ void KOEditorRecurrence::readEvent(Event *event)
-void KOEditorRecurrence::writeEvent( Event *event )
+void KOEditorRecurrence::writeEvent( Incidence *event )
{
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index 2b59085..a15afcb 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -276,5 +276,5 @@ class KOEditorRecurrence : public QWidget
/** Read event object and setup widgets accordingly */
- void readEvent( Event * );
+ void readEvent( Incidence * );
/** Write event settings to event object */
- void writeEvent( Event * );
+ void writeEvent( Incidence * );
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 70dfbd1..069dda8 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -32,2 +32,3 @@
#include <qapplication.h>
+#include <qtabwidget.h>
@@ -45,2 +46,3 @@
#include <kresources/resourceselectdialog.h>
+#include <libkdepim/kdateedit.h>
@@ -70,3 +72,14 @@ void KOTodoEditor::init()
setupAttendeesTab();
+ setupRecurrence();
+ connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
}
+void KOTodoEditor::setupRecurrence()
+{
+ QFrame *topFrame = addPage( i18n("Recurrence") );
+ QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+
+ mRecurrence = new KOEditorRecurrence( topFrame );
+ topLayout->addWidget( mRecurrence );
+}
+
void KOTodoEditor::setCategories( QString s )
@@ -196,2 +209,3 @@ void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
}
+ checkRecurrence();
}
@@ -289,4 +303,29 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
mGeneral->setFocusOn( 2 );
+ tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+}
+void KOTodoEditor::checkRecurrence()
+{
+ if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
+ tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
+
+ if ( mTodo )
+ mRecurrence->readEvent( mTodo );
+ else {
+ bool time = mGeneral->mTimeButton->isChecked();
+ QDateTime from,to;
+ if ( time ) {
+ to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
+ from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
+ } else {
+ to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
+ from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
+ }
+ mRecurrence->setDefaults(from,to,!time);
+ }
+ } else {
+ tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+ }
}
-
void KOTodoEditor::readTodo(Todo *todo)
@@ -310,3 +349,7 @@ void KOTodoEditor::writeTodo(Todo *event)
event->setRelatedTo(mRelatedTodo);
- }
+ }
+ if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
+ mRecurrence->writeEvent(event);
+ } else
+ event->recurrence()->unsetRecurs();
}
diff --git a/korganizer/kotodoeditor.h b/korganizer/kotodoeditor.h
index 2657bd8..1b5e3b4 100644
--- a/korganizer/kotodoeditor.h
+++ b/korganizer/kotodoeditor.h
@@ -31,2 +31,3 @@
#include "koincidenceeditor.h"
+#include "koeditorrecurrence.h"
@@ -84,2 +85,3 @@ class KOTodoEditor : public KOIncidenceEditor
void deleteTodo();
+ void checkRecurrence();
@@ -92,2 +94,3 @@ class KOTodoEditor : public KOIncidenceEditor
int msgItemDelete();
+ void setupRecurrence();
@@ -99,2 +102,3 @@ class KOTodoEditor : public KOIncidenceEditor
KOEditorGeneralTodo *mGeneral;
+ KOEditorRecurrence *mRecurrence;
};
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index bd13132..bb9cb29 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -402,3 +402,6 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
}
-
+ if( incidence->hasRecurrenceID() ) {
+ icalcomponent_add_property(parent,
+ icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
+ }
// duration
@@ -1206,2 +1209,7 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
+ case ICAL_RECURRENCEID_PROPERTY:
+ icaltime = icalproperty_get_recurrenceid(p);
+ incidence->setRecurrenceID( readICalDateTime(icaltime) );
+ qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() );
+ break;
#if 0
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index f9e1e9e..dbc159c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -41,2 +41,3 @@ Incidence::Incidence() :
mAttachments.setAutoDelete(true);
+ mHasRecurrenceID = false;
}
@@ -73,3 +74,4 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
mAlarms.setAutoDelete(true);
-
+ mHasRecurrenceID = i.mHasRecurrenceID;
+ mRecurrenceID = i.mRecurrenceID;
mRecurrence = new Recurrence( *(i.mRecurrence), this );
@@ -89,2 +91,22 @@ Incidence::~Incidence()
}
+bool Incidence::hasRecurrenceID() const
+{
+ return mHasRecurrenceID;
+}
+
+void Incidence::setHasRecurrenceID( bool b )
+{
+ mHasRecurrenceID = b;
+}
+
+void Incidence::setRecurrenceID(QDateTime d)
+{
+ mRecurrenceID = d;
+ mHasRecurrenceID = true;
+ updated();
+}
+QDateTime Incidence::recurrenceID () const
+{
+ return mRecurrenceID;
+}
@@ -145,2 +167,12 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
+ if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
+ if ( i1.hasRecurrenceID() ) {
+ if ( i1.recurrenceID() != i2.recurrenceID() )
+ return false;
+ }
+
+ } else {
+ return false;
+ }
+
if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
@@ -172,2 +204,3 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
i1.priority() == i2.priority() &&
+ i1.cancelled() == i2.cancelled() &&
stringCompare( i1.location(), i2.location() );
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index de2a381..38d2aaa 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -265,2 +265,9 @@ class Incidence : public IncidenceBase
void setCancelled( bool b );
+
+ bool hasRecurrenceID() const;
+ void setHasRecurrenceID( bool b );
+
+ void setRecurrenceID(QDateTime);
+ QDateTime recurrenceID () const;
+
@@ -274,2 +281,4 @@ protected:
// base components of jounal, event and todo
+ QDateTime mRecurrenceID;
+ bool mHasRecurrenceID;
QDateTime mCreated;
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h
index 7b44bfb..a2fc2dc 100644
--- a/microkde/kdialogbase.h
+++ b/microkde/kdialogbase.h
@@ -119,5 +119,5 @@ class KDialogBase : public KDialog
QPushButton *findButton( ButtonCode );
+ QTabWidget *tabWidget();
private:
- QTabWidget *tabWidget();
void init( const QString &caption, int buttonMask,