summaryrefslogtreecommitdiffabout
path: root/korganizer
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 /korganizer
parent00ec9899a4727a4c9100d320935dde7da4803801 (diff)
downloadkdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.zip
kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.gz
kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.bz2
todo recurchanges
Diffstat (limited to 'korganizer') (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
6 files changed, 68 insertions, 10 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 6370b54..a9d1ed3 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -370,4 +370,5 @@ void KOEditorGeneralTodo::enableDueEdit(bool enable)
mDueTimeEdit->setEnabled( false );
}
+ emit datesChecked();
}
@@ -389,4 +390,5 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable )
mStartTimeEdit->setEnabled( false );
}
+ emit datesChecked();
}
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index 98f43dd..b198539 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -73,4 +73,5 @@ class KOEditorGeneralTodo : public KOEditorGeneral
signals:
void openCategoryDialog();
+ void datesChecked();
protected slots:
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 4209e10..bedc75a 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -43,4 +43,5 @@
#include <libkcal/event.h>
+#include <libkcal/todo.h>
#include <libkdepim/kdateedit.h>
@@ -906,7 +907,14 @@ 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 );
QPtrList<Recurrence::rMonthPos> rmp;
@@ -915,5 +923,5 @@ void KOEditorRecurrence::readEvent(Event *event)
int count = 0;
int month = 0;
- setDateTimes( event->dtStart(), event->dtEnd() );
+ setDateTimes( event->dtStart(), dtEnd );
Recurrence *r = event->recurrence();
@@ -929,5 +937,5 @@ void KOEditorRecurrence::readEvent(Event *event)
switch ( recurs ) {
case Recurrence::rNone:
- setDefaults( event->dtStart(), event->dtEnd(), true );
+ setDefaults( event->dtStart(), dtEnd, true );
break;
case Recurrence::rDaily:
@@ -1001,5 +1009,5 @@ void KOEditorRecurrence::readEvent(Event *event)
break;
default:
- setDefaults( event->dtStart(), event->dtEnd(), true );
+ setDefaults( event->dtStart(), dtEnd, true );
break;
}
@@ -1025,5 +1033,5 @@ void KOEditorRecurrence::readEvent(Event *event)
}
-void KOEditorRecurrence::writeEvent( Event *event )
+void KOEditorRecurrence::writeEvent( Incidence *event )
{
Recurrence *r = event->recurrence();
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index 2b59085..a15afcb 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -275,7 +275,7 @@ class KOEditorRecurrence : public QWidget
void setDefaults( QDateTime from, QDateTime to, bool allday );
/** 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 * );
/** Check if the input is valid. */
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 70dfbd1..069dda8 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -31,4 +31,5 @@
#include <qdatetime.h>
#include <qapplication.h>
+#include <qtabwidget.h>
#include <kiconloader.h>
@@ -44,4 +45,5 @@
#include <libkcal/icalformat.h>
#include <kresources/resourceselectdialog.h>
+#include <libkdepim/kdateedit.h>
#include "koprefs.h"
@@ -69,5 +71,16 @@ void KOTodoEditor::init()
setupGeneral();
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 )
{
@@ -195,4 +208,5 @@ void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
mGeneral->setFocusOn( 2 );
}
+ checkRecurrence();
}
@@ -288,6 +302,31 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
} else
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)
{
@@ -309,5 +348,9 @@ void KOTodoEditor::writeTodo(Todo *event)
if (mRelatedTodo) {
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
@@ -30,4 +30,5 @@
#include "koeditordetails.h"
#include "koincidenceeditor.h"
+#include "koeditorrecurrence.h"
class QDateTime;
@@ -83,4 +84,5 @@ class KOTodoEditor : public KOIncidenceEditor
void loadDefaults();
void deleteTodo();
+ void checkRecurrence();
void slotLoadTemplate();
@@ -91,4 +93,5 @@ class KOTodoEditor : public KOIncidenceEditor
void setupGeneral();
int msgItemDelete();
+ void setupRecurrence();
private:
@@ -98,4 +101,5 @@ class KOTodoEditor : public KOIncidenceEditor
KOEditorGeneralTodo *mGeneral;
+ KOEditorRecurrence *mRecurrence;
};