author | zautrix <zautrix> | 2005-02-13 11:55:52 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-13 11:55:52 (UTC) |
commit | 0a33f91e166747406ca2ccb5819881feeecfdb40 (patch) (unidiff) | |
tree | e9130a16aaa6365e106d6733c3e1adeca01f72ac | |
parent | 00ec9899a4727a4c9100d320935dde7da4803801 (diff) | |
download | kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.zip kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.gz kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.bz2 |
todo recurchanges
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.h | 1 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 20 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.h | 4 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 47 | ||||
-rw-r--r-- | korganizer/kotodoeditor.h | 4 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 10 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 35 | ||||
-rw-r--r-- | libkcal/incidence.h | 9 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 2 |
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) | |||
371 | } | 371 | } |
372 | emit datesChecked(); | ||
372 | } | 373 | } |
@@ -390,2 +391,3 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable ) | |||
390 | } | 391 | } |
392 | emit datesChecked(); | ||
391 | } | 393 | } |
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 | |||
74 | void openCategoryDialog(); | 74 | void openCategoryDialog(); |
75 | void datesChecked(); | ||
75 | 76 | ||
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 @@ | |||
44 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
45 | #include <libkcal/todo.h> | ||
45 | 46 | ||
@@ -907,5 +908,12 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) | |||
907 | 908 | ||
908 | void KOEditorRecurrence::readEvent(Event *event) | 909 | void KOEditorRecurrence::readEvent(Incidence *event) |
909 | { | 910 | { |
910 | setDefaults( event->dtStart(), event->dtEnd(), true ); | 911 | |
912 | QDateTime dtEnd; | ||
913 | if ( event->type() == "Event" ) | ||
914 | dtEnd = ((Event*)event)->dtEnd(); | ||
915 | else | ||
916 | dtEnd = ((Todo*)event)->dtDue(); | ||
917 | |||
918 | setDefaults( event->dtStart(), dtEnd, true ); | ||
911 | QBitArray rDays( 7 ); | 919 | QBitArray rDays( 7 ); |
@@ -916,3 +924,3 @@ void KOEditorRecurrence::readEvent(Event *event) | |||
916 | int month = 0; | 924 | int month = 0; |
917 | setDateTimes( event->dtStart(), event->dtEnd() ); | 925 | setDateTimes( event->dtStart(), dtEnd ); |
918 | 926 | ||
@@ -930,3 +938,3 @@ void KOEditorRecurrence::readEvent(Event *event) | |||
930 | case Recurrence::rNone: | 938 | case Recurrence::rNone: |
931 | setDefaults( event->dtStart(), event->dtEnd(), true ); | 939 | setDefaults( event->dtStart(), dtEnd, true ); |
932 | break; | 940 | break; |
@@ -1002,3 +1010,3 @@ void KOEditorRecurrence::readEvent(Event *event) | |||
1002 | default: | 1010 | default: |
1003 | setDefaults( event->dtStart(), event->dtEnd(), true ); | 1011 | setDefaults( event->dtStart(), dtEnd, true ); |
1004 | break; | 1012 | break; |
@@ -1026,3 +1034,3 @@ void KOEditorRecurrence::readEvent(Event *event) | |||
1026 | 1034 | ||
1027 | void KOEditorRecurrence::writeEvent( Event *event ) | 1035 | void KOEditorRecurrence::writeEvent( Incidence *event ) |
1028 | { | 1036 | { |
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 | |||
276 | /** Read event object and setup widgets accordingly */ | 276 | /** Read event object and setup widgets accordingly */ |
277 | void readEvent( Event * ); | 277 | void readEvent( Incidence * ); |
278 | /** Write event settings to event object */ | 278 | /** Write event settings to event object */ |
279 | void writeEvent( Event * ); | 279 | void writeEvent( Incidence * ); |
280 | 280 | ||
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 @@ | |||
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qtabwidget.h> | ||
33 | 34 | ||
@@ -45,2 +46,3 @@ | |||
45 | #include <kresources/resourceselectdialog.h> | 46 | #include <kresources/resourceselectdialog.h> |
47 | #include <libkdepim/kdateedit.h> | ||
46 | 48 | ||
@@ -70,3 +72,14 @@ void KOTodoEditor::init() | |||
70 | setupAttendeesTab(); | 72 | setupAttendeesTab(); |
73 | setupRecurrence(); | ||
74 | connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); | ||
71 | } | 75 | } |
76 | void KOTodoEditor::setupRecurrence() | ||
77 | { | ||
78 | QFrame *topFrame = addPage( i18n("Recurrence") ); | ||
79 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | ||
80 | |||
81 | mRecurrence = new KOEditorRecurrence( topFrame ); | ||
82 | topLayout->addWidget( mRecurrence ); | ||
83 | } | ||
84 | |||
72 | void KOTodoEditor::setCategories( QString s ) | 85 | void KOTodoEditor::setCategories( QString s ) |
@@ -196,2 +209,3 @@ void KOTodoEditor::editTodo(Todo *todo, bool editDescription) | |||
196 | } | 209 | } |
210 | checkRecurrence(); | ||
197 | } | 211 | } |
@@ -289,4 +303,29 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) | |||
289 | mGeneral->setFocusOn( 2 ); | 303 | mGeneral->setFocusOn( 2 ); |
304 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); | ||
305 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); | ||
306 | } | ||
307 | void KOTodoEditor::checkRecurrence() | ||
308 | { | ||
309 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | ||
310 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); | ||
311 | |||
312 | if ( mTodo ) | ||
313 | mRecurrence->readEvent( mTodo ); | ||
314 | else { | ||
315 | bool time = mGeneral->mTimeButton->isChecked(); | ||
316 | QDateTime from,to; | ||
317 | if ( time ) { | ||
318 | to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; | ||
319 | from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; | ||
320 | } else { | ||
321 | to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; | ||
322 | from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; | ||
323 | } | ||
324 | mRecurrence->setDefaults(from,to,!time); | ||
325 | } | ||
326 | } else { | ||
327 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); | ||
328 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); | ||
329 | } | ||
290 | } | 330 | } |
291 | |||
292 | void KOTodoEditor::readTodo(Todo *todo) | 331 | void KOTodoEditor::readTodo(Todo *todo) |
@@ -310,3 +349,7 @@ void KOTodoEditor::writeTodo(Todo *event) | |||
310 | event->setRelatedTo(mRelatedTodo); | 349 | event->setRelatedTo(mRelatedTodo); |
311 | } | 350 | } |
351 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | ||
352 | mRecurrence->writeEvent(event); | ||
353 | } else | ||
354 | event->recurrence()->unsetRecurs(); | ||
312 | } | 355 | } |
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 @@ | |||
31 | #include "koincidenceeditor.h" | 31 | #include "koincidenceeditor.h" |
32 | #include "koeditorrecurrence.h" | ||
32 | 33 | ||
@@ -84,2 +85,3 @@ class KOTodoEditor : public KOIncidenceEditor | |||
84 | void deleteTodo(); | 85 | void deleteTodo(); |
86 | void checkRecurrence(); | ||
85 | 87 | ||
@@ -92,2 +94,3 @@ class KOTodoEditor : public KOIncidenceEditor | |||
92 | int msgItemDelete(); | 94 | int msgItemDelete(); |
95 | void setupRecurrence(); | ||
93 | 96 | ||
@@ -99,2 +102,3 @@ class KOTodoEditor : public KOIncidenceEditor | |||
99 | KOEditorGeneralTodo *mGeneral; | 102 | KOEditorGeneralTodo *mGeneral; |
103 | KOEditorRecurrence *mRecurrence; | ||
100 | }; | 104 | }; |
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) | |||
402 | } | 402 | } |
403 | 403 | if( incidence->hasRecurrenceID() ) { | |
404 | icalcomponent_add_property(parent, | ||
405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); | ||
406 | } | ||
404 | // duration | 407 | // duration |
@@ -1206,2 +1209,7 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
1206 | 1209 | ||
1210 | case ICAL_RECURRENCEID_PROPERTY: | ||
1211 | icaltime = icalproperty_get_recurrenceid(p); | ||
1212 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); | ||
1213 | qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); | ||
1214 | break; | ||
1207 | #if 0 | 1215 | #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() : | |||
41 | mAttachments.setAutoDelete(true); | 41 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | ||
42 | } | 43 | } |
@@ -73,3 +74,4 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | |||
73 | mAlarms.setAutoDelete(true); | 74 | mAlarms.setAutoDelete(true); |
74 | 75 | mHasRecurrenceID = i.mHasRecurrenceID; | |
76 | mRecurrenceID = i.mRecurrenceID; | ||
75 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 77 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); |
@@ -89,2 +91,22 @@ Incidence::~Incidence() | |||
89 | } | 91 | } |
92 | bool Incidence::hasRecurrenceID() const | ||
93 | { | ||
94 | return mHasRecurrenceID; | ||
95 | } | ||
96 | |||
97 | void Incidence::setHasRecurrenceID( bool b ) | ||
98 | { | ||
99 | mHasRecurrenceID = b; | ||
100 | } | ||
101 | |||
102 | void Incidence::setRecurrenceID(QDateTime d) | ||
103 | { | ||
104 | mRecurrenceID = d; | ||
105 | mHasRecurrenceID = true; | ||
106 | updated(); | ||
107 | } | ||
108 | QDateTime Incidence::recurrenceID () const | ||
109 | { | ||
110 | return mRecurrenceID; | ||
111 | } | ||
90 | 112 | ||
@@ -145,2 +167,12 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
145 | 167 | ||
168 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { | ||
169 | if ( i1.hasRecurrenceID() ) { | ||
170 | if ( i1.recurrenceID() != i2.recurrenceID() ) | ||
171 | return false; | ||
172 | } | ||
173 | |||
174 | } else { | ||
175 | return false; | ||
176 | } | ||
177 | |||
146 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) | 178 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) |
@@ -172,2 +204,3 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
172 | i1.priority() == i2.priority() && | 204 | i1.priority() == i2.priority() && |
205 | i1.cancelled() == i2.cancelled() && | ||
173 | stringCompare( i1.location(), i2.location() ); | 206 | 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 | |||
265 | void setCancelled( bool b ); | 265 | void setCancelled( bool b ); |
266 | |||
267 | bool hasRecurrenceID() const; | ||
268 | void setHasRecurrenceID( bool b ); | ||
269 | |||
270 | void setRecurrenceID(QDateTime); | ||
271 | QDateTime recurrenceID () const; | ||
272 | |||
266 | 273 | ||
@@ -274,2 +281,4 @@ protected: | |||
274 | // base components of jounal, event and todo | 281 | // base components of jounal, event and todo |
282 | QDateTime mRecurrenceID; | ||
283 | bool mHasRecurrenceID; | ||
275 | QDateTime mCreated; | 284 | 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 | |||
119 | QPushButton *findButton( ButtonCode ); | 119 | QPushButton *findButton( ButtonCode ); |
120 | QTabWidget *tabWidget(); | ||
120 | 121 | ||
121 | private: | 122 | private: |
122 | QTabWidget *tabWidget(); | ||
123 | void init( const QString &caption, int buttonMask, | 123 | void init( const QString &caption, int buttonMask, |