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 | |||
@@ -360,43 +360,45 @@ void KOEditorGeneralTodo::enableDueEdit(bool enable) | |||
360 | mTimeButton->setEnabled(true); | 360 | mTimeButton->setEnabled(true); |
361 | } | 361 | } |
362 | else { | 362 | else { |
363 | mTimeButton->setEnabled(false); | 363 | mTimeButton->setEnabled(false); |
364 | mTimeButton->setChecked(false); | 364 | mTimeButton->setChecked(false); |
365 | } | 365 | } |
366 | 366 | ||
367 | if (enable) { | 367 | if (enable) { |
368 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 368 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
369 | } else { | 369 | } else { |
370 | mDueTimeEdit->setEnabled( false ); | 370 | mDueTimeEdit->setEnabled( false ); |
371 | } | 371 | } |
372 | emit datesChecked(); | ||
372 | } | 373 | } |
373 | 374 | ||
374 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 375 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
375 | { | 376 | { |
376 | mStartDateEdit->setEnabled( enable ); | 377 | mStartDateEdit->setEnabled( enable ); |
377 | 378 | ||
378 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 379 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
379 | mTimeButton->setEnabled(true); | 380 | mTimeButton->setEnabled(true); |
380 | } | 381 | } |
381 | else { | 382 | else { |
382 | mTimeButton->setEnabled(false); | 383 | mTimeButton->setEnabled(false); |
383 | mTimeButton->setChecked(false); | 384 | mTimeButton->setChecked(false); |
384 | } | 385 | } |
385 | 386 | ||
386 | if (enable) { | 387 | if (enable) { |
387 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 388 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
388 | } else { | 389 | } else { |
389 | mStartTimeEdit->setEnabled( false ); | 390 | mStartTimeEdit->setEnabled( false ); |
390 | } | 391 | } |
392 | emit datesChecked(); | ||
391 | } | 393 | } |
392 | 394 | ||
393 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 395 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
394 | { | 396 | { |
395 | if(mStartCheck->isChecked()) { | 397 | if(mStartCheck->isChecked()) { |
396 | mStartTimeEdit->setEnabled( enable ); | 398 | mStartTimeEdit->setEnabled( enable ); |
397 | } | 399 | } |
398 | if(mDueCheck->isChecked()) { | 400 | if(mDueCheck->isChecked()) { |
399 | mDueTimeEdit->setEnabled( enable ); | 401 | mDueTimeEdit->setEnabled( enable ); |
400 | } | 402 | } |
401 | } | 403 | } |
402 | 404 | ||
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h index 98f43dd..b198539 100644 --- a/korganizer/koeditorgeneraltodo.h +++ b/korganizer/koeditorgeneraltodo.h | |||
@@ -63,24 +63,25 @@ class KOEditorGeneralTodo : public KOEditorGeneral | |||
63 | void readTodo(Todo *); | 63 | void readTodo(Todo *); |
64 | /** Write todo settings to event object */ | 64 | /** Write todo settings to event object */ |
65 | void writeTodo(Todo *); | 65 | void writeTodo(Todo *); |
66 | 66 | ||
67 | /** Check if the input is valid. */ | 67 | /** Check if the input is valid. */ |
68 | bool validateInput(); | 68 | bool validateInput(); |
69 | 69 | ||
70 | /** The todo has been modified externally */ | 70 | /** The todo has been modified externally */ |
71 | void modified (Todo*, int); | 71 | void modified (Todo*, int); |
72 | 72 | ||
73 | signals: | 73 | signals: |
74 | void openCategoryDialog(); | 74 | void openCategoryDialog(); |
75 | void datesChecked(); | ||
75 | 76 | ||
76 | protected slots: | 77 | protected slots: |
77 | void completedChanged(int); | 78 | void completedChanged(int); |
78 | 79 | ||
79 | void enableDueEdit( bool enable ); | 80 | void enableDueEdit( bool enable ); |
80 | void enableStartEdit( bool enable ); | 81 | void enableStartEdit( bool enable ); |
81 | void enableTimeEdits( bool enable ); | 82 | void enableTimeEdits( bool enable ); |
82 | void showAlarm(); | 83 | void showAlarm(); |
83 | 84 | ||
84 | protected: | 85 | protected: |
85 | void setCompletedDate(); | 86 | void setCompletedDate(); |
86 | 87 | ||
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index 4209e10..bedc75a 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -33,24 +33,25 @@ | |||
33 | #include <qspinbox.h> | 33 | #include <qspinbox.h> |
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | 36 | ||
37 | #include <kdialog.h> | 37 | #include <kdialog.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <knumvalidator.h> | 42 | #include <knumvalidator.h> |
43 | 43 | ||
44 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
45 | #include <libkcal/todo.h> | ||
45 | 46 | ||
46 | #include <libkdepim/kdateedit.h> | 47 | #include <libkdepim/kdateedit.h> |
47 | 48 | ||
48 | #include "koprefs.h" | 49 | #include "koprefs.h" |
49 | 50 | ||
50 | #include "koeditorrecurrence.h" | 51 | #include "koeditorrecurrence.h" |
51 | 52 | ||
52 | /////////////////////////// RecurBase /////////////////////////////// | 53 | /////////////////////////// RecurBase /////////////////////////////// |
53 | 54 | ||
54 | RecurBase::RecurBase( QWidget *parent, const char *name ) : | 55 | RecurBase::RecurBase( QWidget *parent, const char *name ) : |
55 | QWidget( parent, name ) | 56 | QWidget( parent, name ) |
56 | { | 57 | { |
@@ -896,48 +897,55 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) | |||
896 | QBitArray days( 7 ); | 897 | QBitArray days( 7 ); |
897 | days.fill( 0 ); | 898 | days.fill( 0 ); |
898 | days.setBit( from.date().dayOfWeek()- 1); | 899 | days.setBit( from.date().dayOfWeek()- 1); |
899 | mWeekly->setDays( days ); | 900 | mWeekly->setDays( days ); |
900 | mMonthly->setFrequency( 1 ); | 901 | mMonthly->setFrequency( 1 ); |
901 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); | 902 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); |
902 | mMonthly->setByDay( from.date().day()-1 ); | 903 | mMonthly->setByDay( from.date().day()-1 ); |
903 | mYearly->setFrequency( 1 ); | 904 | mYearly->setFrequency( 1 ); |
904 | mYearly->setByDay( from.date().dayOfYear() ); | 905 | mYearly->setByDay( from.date().dayOfYear() ); |
905 | mYearly->setByMonth( from.date().month(), from.date().day() ); | 906 | mYearly->setByMonth( from.date().month(), from.date().day() ); |
906 | } | 907 | } |
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 ); |
912 | QPtrList<Recurrence::rMonthPos> rmp; | 920 | QPtrList<Recurrence::rMonthPos> rmp; |
913 | QPtrList<int> rmd; | 921 | QPtrList<int> rmd; |
914 | int day = 0; | 922 | int day = 0; |
915 | int count = 0; | 923 | int count = 0; |
916 | int month = 0; | 924 | int month = 0; |
917 | setDateTimes( event->dtStart(), event->dtEnd() ); | 925 | setDateTimes( event->dtStart(), dtEnd ); |
918 | 926 | ||
919 | Recurrence *r = event->recurrence(); | 927 | Recurrence *r = event->recurrence(); |
920 | int f = r->frequency(); | 928 | int f = r->frequency(); |
921 | 929 | ||
922 | int recurs = r->doesRecur(); | 930 | int recurs = r->doesRecur(); |
923 | 931 | ||
924 | mEnabledCheck->setChecked( recurs ); | 932 | mEnabledCheck->setChecked( recurs ); |
925 | setEnabled( recurs ); | 933 | setEnabled( recurs ); |
926 | 934 | ||
927 | int recurrenceType = RecurrenceChooser::Weekly; | 935 | int recurrenceType = RecurrenceChooser::Weekly; |
928 | 936 | ||
929 | switch ( recurs ) { | 937 | switch ( recurs ) { |
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; |
933 | case Recurrence::rDaily: | 941 | case Recurrence::rDaily: |
934 | recurrenceType = RecurrenceChooser::Daily; | 942 | recurrenceType = RecurrenceChooser::Daily; |
935 | mDaily->setFrequency( f ); | 943 | mDaily->setFrequency( f ); |
936 | break; | 944 | break; |
937 | case Recurrence::rWeekly: | 945 | case Recurrence::rWeekly: |
938 | recurrenceType = RecurrenceChooser::Weekly; | 946 | recurrenceType = RecurrenceChooser::Weekly; |
939 | mWeekly->setFrequency( f ); | 947 | mWeekly->setFrequency( f ); |
940 | mWeekly->setDays( r->days() ); | 948 | mWeekly->setDays( r->days() ); |
941 | break; | 949 | break; |
942 | case Recurrence::rMonthlyPos: | 950 | case Recurrence::rMonthlyPos: |
943 | // we only handle one possibility in the list right now, | 951 | // we only handle one possibility in the list right now, |
@@ -991,49 +999,49 @@ void KOEditorRecurrence::readEvent(Event *event) | |||
991 | #endif | 999 | #endif |
992 | mYearly->setFrequency( f ); | 1000 | mYearly->setFrequency( f ); |
993 | } | 1001 | } |
994 | 1002 | ||
995 | break; | 1003 | break; |
996 | case Recurrence::rYearlyDay: | 1004 | case Recurrence::rYearlyDay: |
997 | qDebug("Recurrence::rYearlyDay: "); | 1005 | qDebug("Recurrence::rYearlyDay: "); |
998 | recurrenceType = RecurrenceChooser::Yearly; | 1006 | recurrenceType = RecurrenceChooser::Yearly; |
999 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); | 1007 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); |
1000 | mYearly->setFrequency( f ); | 1008 | mYearly->setFrequency( f ); |
1001 | break; | 1009 | break; |
1002 | default: | 1010 | default: |
1003 | setDefaults( event->dtStart(), event->dtEnd(), true ); | 1011 | setDefaults( event->dtStart(), dtEnd, true ); |
1004 | break; | 1012 | break; |
1005 | } | 1013 | } |
1006 | 1014 | ||
1007 | mRecurrenceChooser->setType( recurrenceType ); | 1015 | mRecurrenceChooser->setType( recurrenceType ); |
1008 | showCurrentRule( recurrenceType ); | 1016 | showCurrentRule( recurrenceType ); |
1009 | 1017 | ||
1010 | mRecurrenceRange->setDateTimes( event->dtStart() ); | 1018 | mRecurrenceRange->setDateTimes( event->dtStart() ); |
1011 | 1019 | ||
1012 | if ( r->doesRecur() ) { | 1020 | if ( r->doesRecur() ) { |
1013 | mRecurrenceRange->setDuration( r->duration() ); | 1021 | mRecurrenceRange->setDuration( r->duration() ); |
1014 | if ( r->duration() == 0 ) | 1022 | if ( r->duration() == 0 ) |
1015 | { | 1023 | { |
1016 | if ( r->endDate() < event->dtStart().date() ) | 1024 | if ( r->endDate() < event->dtStart().date() ) |
1017 | mRecurrenceRange->setEndDate( event->dtStart().date() ); | 1025 | mRecurrenceRange->setEndDate( event->dtStart().date() ); |
1018 | else | 1026 | else |
1019 | mRecurrenceRange->setEndDate( r->endDate() ); | 1027 | mRecurrenceRange->setEndDate( r->endDate() ); |
1020 | } else | 1028 | } else |
1021 | mRecurrenceRange->setEndDate( event->dtStart().date() ); | 1029 | mRecurrenceRange->setEndDate( event->dtStart().date() ); |
1022 | } | 1030 | } |
1023 | 1031 | ||
1024 | mExceptions->setDates( event->exDates() ); | 1032 | mExceptions->setDates( event->exDates() ); |
1025 | } | 1033 | } |
1026 | 1034 | ||
1027 | void KOEditorRecurrence::writeEvent( Event *event ) | 1035 | void KOEditorRecurrence::writeEvent( Incidence *event ) |
1028 | { | 1036 | { |
1029 | Recurrence *r = event->recurrence(); | 1037 | Recurrence *r = event->recurrence(); |
1030 | 1038 | ||
1031 | // clear out any old settings; | 1039 | // clear out any old settings; |
1032 | r->unsetRecurs(); | 1040 | r->unsetRecurs(); |
1033 | 1041 | ||
1034 | if ( mEnabledCheck->isChecked() ) { | 1042 | if ( mEnabledCheck->isChecked() ) { |
1035 | int duration = mRecurrenceRange->duration(); | 1043 | int duration = mRecurrenceRange->duration(); |
1036 | QDate endDate; | 1044 | QDate endDate; |
1037 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); | 1045 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); |
1038 | 1046 | ||
1039 | int recurrenceType = mRecurrenceChooser->type(); | 1047 | int recurrenceType = mRecurrenceChooser->type(); |
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h index 2b59085..a15afcb 100644 --- a/korganizer/koeditorrecurrence.h +++ b/korganizer/koeditorrecurrence.h | |||
@@ -265,27 +265,27 @@ class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase | |||
265 | class KOEditorRecurrence : public QWidget | 265 | class KOEditorRecurrence : public QWidget |
266 | { | 266 | { |
267 | Q_OBJECT | 267 | Q_OBJECT |
268 | public: | 268 | public: |
269 | KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); | 269 | KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); |
270 | virtual ~KOEditorRecurrence(); | 270 | virtual ~KOEditorRecurrence(); |
271 | 271 | ||
272 | enum { Daily, Weekly, Monthly, Yearly }; | 272 | enum { Daily, Weekly, Monthly, Yearly }; |
273 | 273 | ||
274 | /** Set widgets to default values */ | 274 | /** Set widgets to default values */ |
275 | void setDefaults( QDateTime from, QDateTime to, bool allday ); | 275 | void setDefaults( QDateTime from, QDateTime to, bool allday ); |
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 | ||
281 | /** Check if the input is valid. */ | 281 | /** Check if the input is valid. */ |
282 | bool validateInput(); | 282 | bool validateInput(); |
283 | 283 | ||
284 | public slots: | 284 | public slots: |
285 | void setEnabled( bool ); | 285 | void setEnabled( bool ); |
286 | void setDateTimes( QDateTime start, QDateTime end ); | 286 | void setDateTimes( QDateTime start, QDateTime end ); |
287 | void setDateTimeStr( const QString & ); | 287 | void setDateTimeStr( const QString & ); |
288 | 288 | ||
289 | signals: | 289 | signals: |
290 | void dateTimesChanged( QDateTime start, QDateTime end ); | 290 | void dateTimesChanged( QDateTime start, QDateTime end ); |
291 | 291 | ||
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 70dfbd1..069dda8 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp | |||
@@ -21,37 +21,39 @@ | |||
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qhbox.h> | 29 | #include <qhbox.h> |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qtabwidget.h> | ||
33 | 34 | ||
34 | #include <kiconloader.h> | 35 | #include <kiconloader.h> |
35 | #include <klocale.h> | 36 | #include <klocale.h> |
36 | #include <kfiledialog.h> | 37 | #include <kfiledialog.h> |
37 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
38 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
39 | 40 | ||
40 | #include <libkdepim/categoryselectdialog.h> | 41 | #include <libkdepim/categoryselectdialog.h> |
41 | #include <libkcal/calendarlocal.h> | 42 | #include <libkcal/calendarlocal.h> |
42 | #include <libkcal/calendarresources.h> | 43 | #include <libkcal/calendarresources.h> |
43 | #include <libkcal/resourcecalendar.h> | 44 | #include <libkcal/resourcecalendar.h> |
44 | #include <libkcal/icalformat.h> | 45 | #include <libkcal/icalformat.h> |
45 | #include <kresources/resourceselectdialog.h> | 46 | #include <kresources/resourceselectdialog.h> |
47 | #include <libkdepim/kdateedit.h> | ||
46 | 48 | ||
47 | #include "koprefs.h" | 49 | #include "koprefs.h" |
48 | #include "kolocationbox.h" | 50 | #include "kolocationbox.h" |
49 | 51 | ||
50 | #include "kotodoeditor.h" | 52 | #include "kotodoeditor.h" |
51 | extern int globalFlagBlockAgenda; | 53 | extern int globalFlagBlockAgenda; |
52 | 54 | ||
53 | KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : | 55 | KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : |
54 | KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) | 56 | KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) |
55 | { | 57 | { |
56 | mTodo = 0; | 58 | mTodo = 0; |
57 | mRelatedTodo = 0; | 59 | mRelatedTodo = 0; |
@@ -59,25 +61,36 @@ KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : | |||
59 | init(); | 61 | init(); |
60 | } | 62 | } |
61 | 63 | ||
62 | KOTodoEditor::~KOTodoEditor() | 64 | KOTodoEditor::~KOTodoEditor() |
63 | { | 65 | { |
64 | emit dialogClose( mTodo ); | 66 | emit dialogClose( mTodo ); |
65 | } | 67 | } |
66 | 68 | ||
67 | void KOTodoEditor::init() | 69 | void KOTodoEditor::init() |
68 | { | 70 | { |
69 | setupGeneral(); | 71 | setupGeneral(); |
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 ) |
73 | { | 86 | { |
74 | mGeneral->setCategories(s); | 87 | mGeneral->setCategories(s); |
75 | } | 88 | } |
76 | void KOTodoEditor::setSecrecy( int sec ) | 89 | void KOTodoEditor::setSecrecy( int sec ) |
77 | { | 90 | { |
78 | mGeneral->setSecrecy( sec ); | 91 | mGeneral->setSecrecy( sec ); |
79 | } | 92 | } |
80 | void KOTodoEditor::reload() | 93 | void KOTodoEditor::reload() |
81 | { | 94 | { |
82 | if ( mTodo ) readTodo( mTodo ); | 95 | if ( mTodo ) readTodo( mTodo ); |
83 | } | 96 | } |
@@ -185,24 +198,25 @@ void KOTodoEditor::editTodo(Todo *todo, bool editDescription) | |||
185 | { | 198 | { |
186 | //init(); | 199 | //init(); |
187 | 200 | ||
188 | mTodo = todo; | 201 | mTodo = todo; |
189 | readTodo(mTodo); | 202 | readTodo(mTodo); |
190 | if ( editDescription ) { | 203 | if ( editDescription ) { |
191 | showPage( 1 ); | 204 | showPage( 1 ); |
192 | mGeneral->setFocusOn( 1 ); | 205 | mGeneral->setFocusOn( 1 ); |
193 | } else { | 206 | } else { |
194 | showPage( 0 ); | 207 | showPage( 0 ); |
195 | mGeneral->setFocusOn( 2 ); | 208 | mGeneral->setFocusOn( 2 ); |
196 | } | 209 | } |
210 | checkRecurrence(); | ||
197 | } | 211 | } |
198 | 212 | ||
199 | void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) | 213 | void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) |
200 | { | 214 | { |
201 | //init(); | 215 | //init(); |
202 | 216 | ||
203 | mTodo = 0; | 217 | mTodo = 0; |
204 | setDefaults(due,relatedTodo,allDay); | 218 | setDefaults(due,relatedTodo,allDay); |
205 | } | 219 | } |
206 | 220 | ||
207 | void KOTodoEditor::loadDefaults() | 221 | void KOTodoEditor::loadDefaults() |
208 | { | 222 | { |
@@ -278,46 +292,75 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) | |||
278 | mGeneral->setCategories (mRelatedTodo->categoriesStr ()); | 292 | mGeneral->setCategories (mRelatedTodo->categoriesStr ()); |
279 | mGeneral->setSecrecy (mRelatedTodo->secrecy ()); | 293 | mGeneral->setSecrecy (mRelatedTodo->secrecy ()); |
280 | if ( mRelatedTodo->priority() < 3 ) | 294 | if ( mRelatedTodo->priority() < 3 ) |
281 | mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); | 295 | mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); |
282 | mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); | 296 | mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); |
283 | int len = mRelatedTodo->summary().length(); | 297 | int len = mRelatedTodo->summary().length(); |
284 | mGeneral->mSummaryEdit->lineEdit()->setFocus(); | 298 | mGeneral->mSummaryEdit->lineEdit()->setFocus(); |
285 | mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); | 299 | mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); |
286 | mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); | 300 | mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); |
287 | 301 | ||
288 | } else | 302 | } else |
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) |
293 | { | 332 | { |
294 | mGeneral->readTodo(todo); | 333 | mGeneral->readTodo(todo); |
295 | mDetails->readEvent(todo); | 334 | mDetails->readEvent(todo); |
296 | mRelatedTodo = 0;//todo->relatedTo(); | 335 | mRelatedTodo = 0;//todo->relatedTo(); |
297 | // categories | 336 | // categories |
298 | // mCategoryDialog->setSelected(todo->categories()); | 337 | // mCategoryDialog->setSelected(todo->categories()); |
299 | 338 | ||
300 | // We should handle read-only events here. | 339 | // We should handle read-only events here. |
301 | } | 340 | } |
302 | 341 | ||
303 | void KOTodoEditor::writeTodo(Todo *event) | 342 | void KOTodoEditor::writeTodo(Todo *event) |
304 | { | 343 | { |
305 | mGeneral->writeTodo(event); | 344 | mGeneral->writeTodo(event); |
306 | mDetails->writeEvent(event); | 345 | mDetails->writeEvent(event); |
307 | 346 | ||
308 | // set related event, i.e. parent to-do in this case. | 347 | // set related event, i.e. parent to-do in this case. |
309 | if (mRelatedTodo) { | 348 | if (mRelatedTodo) { |
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 | } |
313 | 356 | ||
314 | bool KOTodoEditor::validateInput() | 357 | bool KOTodoEditor::validateInput() |
315 | { | 358 | { |
316 | if (!mGeneral->validateInput()) return false; | 359 | if (!mGeneral->validateInput()) return false; |
317 | if (!mDetails->validateInput()) return false; | 360 | if (!mDetails->validateInput()) return false; |
318 | return true; | 361 | return true; |
319 | } | 362 | } |
320 | 363 | ||
321 | int KOTodoEditor::msgItemDelete() | 364 | int KOTodoEditor::msgItemDelete() |
322 | { | 365 | { |
323 | return KMessageBox::warningContinueCancel(this, | 366 | return KMessageBox::warningContinueCancel(this, |
diff --git a/korganizer/kotodoeditor.h b/korganizer/kotodoeditor.h index 2657bd8..1b5e3b4 100644 --- a/korganizer/kotodoeditor.h +++ b/korganizer/kotodoeditor.h | |||
@@ -20,24 +20,25 @@ | |||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef _KOTODOEDITOR_H | 24 | #ifndef _KOTODOEDITOR_H |
25 | #define _KOTODOEDITOR_H | 25 | #define _KOTODOEDITOR_H |
26 | 26 | ||
27 | #include <libkcal/calendar.h> | 27 | #include <libkcal/calendar.h> |
28 | 28 | ||
29 | #include "koeditorgeneraltodo.h" | 29 | #include "koeditorgeneraltodo.h" |
30 | #include "koeditordetails.h" | 30 | #include "koeditordetails.h" |
31 | #include "koincidenceeditor.h" | 31 | #include "koincidenceeditor.h" |
32 | #include "koeditorrecurrence.h" | ||
32 | 33 | ||
33 | class QDateTime; | 34 | class QDateTime; |
34 | 35 | ||
35 | /** | 36 | /** |
36 | This class provides a dialog for editing a Todo. | 37 | This class provides a dialog for editing a Todo. |
37 | */ | 38 | */ |
38 | class KOTodoEditor : public KOIncidenceEditor | 39 | class KOTodoEditor : public KOIncidenceEditor |
39 | { | 40 | { |
40 | Q_OBJECT | 41 | Q_OBJECT |
41 | public: | 42 | public: |
42 | /** | 43 | /** |
43 | Constructs a new todo editor. | 44 | Constructs a new todo editor. |
@@ -73,30 +74,33 @@ class KOTodoEditor : public KOIncidenceEditor | |||
73 | /** This todo has been modified externally */ | 74 | /** This todo has been modified externally */ |
74 | void modified (int); | 75 | void modified (int); |
75 | void setCategories( QString s ); | 76 | void setCategories( QString s ); |
76 | signals: | 77 | signals: |
77 | void todoChanged(Todo *); | 78 | void todoChanged(Todo *); |
78 | void todoAdded(Todo *); | 79 | void todoAdded(Todo *); |
79 | void todoToBeDeleted(Todo *); | 80 | void todoToBeDeleted(Todo *); |
80 | void todoDeleted(); | 81 | void todoDeleted(); |
81 | 82 | ||
82 | protected slots: | 83 | protected slots: |
83 | void loadDefaults(); | 84 | void loadDefaults(); |
84 | void deleteTodo(); | 85 | void deleteTodo(); |
86 | void checkRecurrence(); | ||
85 | 87 | ||
86 | void slotLoadTemplate(); | 88 | void slotLoadTemplate(); |
87 | void slotSaveTemplate(); | 89 | void slotSaveTemplate(); |
88 | void saveTemplate( const QString & ); | 90 | void saveTemplate( const QString & ); |
89 | 91 | ||
90 | protected: | 92 | protected: |
91 | void setupGeneral(); | 93 | void setupGeneral(); |
92 | int msgItemDelete(); | 94 | int msgItemDelete(); |
95 | void setupRecurrence(); | ||
93 | 96 | ||
94 | private: | 97 | private: |
95 | Todo *mTodo; | 98 | Todo *mTodo; |
96 | 99 | ||
97 | Incidence *mRelatedTodo; | 100 | Incidence *mRelatedTodo; |
98 | 101 | ||
99 | KOEditorGeneralTodo *mGeneral; | 102 | KOEditorGeneralTodo *mGeneral; |
103 | KOEditorRecurrence *mRecurrence; | ||
100 | }; | 104 | }; |
101 | 105 | ||
102 | #endif | 106 | #endif |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index bd13132..bb9cb29 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -391,25 +391,28 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 392 | icalcomponent_add_property(parent,writeAttachment(at)); |
393 | 393 | ||
394 | // alarms | 394 | // alarms |
395 | QPtrList<Alarm> alarms = incidence->alarms(); | 395 | QPtrList<Alarm> alarms = incidence->alarms(); |
396 | Alarm* alarm; | 396 | Alarm* alarm; |
397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
398 | if (alarm->enabled()) { | 398 | if (alarm->enabled()) { |
399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; | 399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; |
400 | icalcomponent_add_component(parent,writeAlarm(alarm)); | 400 | icalcomponent_add_component(parent,writeAlarm(alarm)); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | 403 | if( incidence->hasRecurrenceID() ) { | |
404 | icalcomponent_add_property(parent, | ||
405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); | ||
406 | } | ||
404 | // duration | 407 | // duration |
405 | 408 | ||
406 | // turned off as it always is set to PTS0 (and must not occur together with DTEND | 409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND |
407 | 410 | ||
408 | // if (incidence->hasDuration()) { | 411 | // if (incidence->hasDuration()) { |
409 | // icaldurationtype duration; | 412 | // icaldurationtype duration; |
410 | // duration = writeICalDuration(incidence->duration()); | 413 | // duration = writeICalDuration(incidence->duration()); |
411 | // icalcomponent_add_property(parent,icalproperty_new_duration(duration)); | 414 | // icalcomponent_add_property(parent,icalproperty_new_duration(duration)); |
412 | // } | 415 | // } |
413 | } | 416 | } |
414 | 417 | ||
415 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
@@ -1195,24 +1198,29 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
1195 | case ICAL_STATUS_PROPERTY: // summary | 1198 | case ICAL_STATUS_PROPERTY: // summary |
1196 | { | 1199 | { |
1197 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) | 1200 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) |
1198 | incidence->setCancelled( true ); | 1201 | incidence->setCancelled( true ); |
1199 | } | 1202 | } |
1200 | break; | 1203 | break; |
1201 | 1204 | ||
1202 | case ICAL_LOCATION_PROPERTY: // location | 1205 | case ICAL_LOCATION_PROPERTY: // location |
1203 | text = icalproperty_get_location(p); | 1206 | text = icalproperty_get_location(p); |
1204 | incidence->setLocation(QString::fromUtf8(text)); | 1207 | incidence->setLocation(QString::fromUtf8(text)); |
1205 | break; | 1208 | break; |
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 |
1208 | // status | 1216 | // status |
1209 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { | 1217 | if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { |
1210 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); | 1218 | incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); |
1211 | deleteStr(s); | 1219 | deleteStr(s); |
1212 | } | 1220 | } |
1213 | else | 1221 | else |
1214 | incidence->setStatus("NEEDS ACTION"); | 1222 | incidence->setStatus("NEEDS ACTION"); |
1215 | #endif | 1223 | #endif |
1216 | 1224 | ||
1217 | case ICAL_PRIORITY_PROPERTY: // priority | 1225 | case ICAL_PRIORITY_PROPERTY: // priority |
1218 | intvalue = icalproperty_get_priority(p); | 1226 | intvalue = icalproperty_get_priority(p); |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index f9e1e9e..dbc159c 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -30,24 +30,25 @@ | |||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | Incidence::Incidence() : | 32 | Incidence::Incidence() : |
33 | IncidenceBase(), | 33 | IncidenceBase(), |
34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) | 34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) |
35 | { | 35 | { |
36 | mRecurrence = new Recurrence(this); | 36 | mRecurrence = new Recurrence(this); |
37 | mCancelled = false; | 37 | mCancelled = false; |
38 | recreate(); | 38 | recreate(); |
39 | mHasStartDate = true; | 39 | mHasStartDate = true; |
40 | mAlarms.setAutoDelete(true); | 40 | mAlarms.setAutoDelete(true); |
41 | mAttachments.setAutoDelete(true); | 41 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | ||
42 | } | 43 | } |
43 | 44 | ||
44 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | 45 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) |
45 | { | 46 | { |
46 | // TODO: reenable attributes currently commented out. | 47 | // TODO: reenable attributes currently commented out. |
47 | mRevision = i.mRevision; | 48 | mRevision = i.mRevision; |
48 | mCreated = i.mCreated; | 49 | mCreated = i.mCreated; |
49 | mDescription = i.mDescription; | 50 | mDescription = i.mDescription; |
50 | mSummary = i.mSummary; | 51 | mSummary = i.mSummary; |
51 | mCategories = i.mCategories; | 52 | mCategories = i.mCategories; |
52 | // Incidence *mRelatedTo; Incidence *mRelatedTo; | 53 | // Incidence *mRelatedTo; Incidence *mRelatedTo; |
53 | mRelatedTo = 0; | 54 | mRelatedTo = 0; |
@@ -62,40 +63,61 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | |||
62 | mCancelled = i.mCancelled; | 63 | mCancelled = i.mCancelled; |
63 | mHasStartDate = i.mHasStartDate; | 64 | mHasStartDate = i.mHasStartDate; |
64 | QPtrListIterator<Alarm> it( i.mAlarms ); | 65 | QPtrListIterator<Alarm> it( i.mAlarms ); |
65 | const Alarm *a; | 66 | const Alarm *a; |
66 | while( (a = it.current()) ) { | 67 | while( (a = it.current()) ) { |
67 | Alarm *b = new Alarm( *a ); | 68 | Alarm *b = new Alarm( *a ); |
68 | b->setParent( this ); | 69 | b->setParent( this ); |
69 | mAlarms.append( b ); | 70 | mAlarms.append( b ); |
70 | 71 | ||
71 | ++it; | 72 | ++it; |
72 | } | 73 | } |
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 ); |
76 | } | 78 | } |
77 | 79 | ||
78 | Incidence::~Incidence() | 80 | Incidence::~Incidence() |
79 | { | 81 | { |
80 | 82 | ||
81 | Incidence *ev; | 83 | Incidence *ev; |
82 | QPtrList<Incidence> Relations = relations(); | 84 | QPtrList<Incidence> Relations = relations(); |
83 | for (ev=Relations.first();ev;ev=Relations.next()) { | 85 | for (ev=Relations.first();ev;ev=Relations.next()) { |
84 | if (ev->relatedTo() == this) ev->setRelatedTo(0); | 86 | if (ev->relatedTo() == this) ev->setRelatedTo(0); |
85 | } | 87 | } |
86 | if (relatedTo()) relatedTo()->removeRelation(this); | 88 | if (relatedTo()) relatedTo()->removeRelation(this); |
87 | delete mRecurrence; | 89 | delete mRecurrence; |
88 | 90 | ||
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 | ||
91 | bool Incidence::cancelled() const | 113 | bool Incidence::cancelled() const |
92 | { | 114 | { |
93 | return mCancelled; | 115 | return mCancelled; |
94 | } | 116 | } |
95 | void Incidence::setCancelled( bool b ) | 117 | void Incidence::setCancelled( bool b ) |
96 | { | 118 | { |
97 | mCancelled = b; | 119 | mCancelled = b; |
98 | updated(); | 120 | updated(); |
99 | } | 121 | } |
100 | bool Incidence::hasStartDate() const | 122 | bool Incidence::hasStartDate() const |
101 | { | 123 | { |
@@ -134,24 +156,34 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
134 | QPtrListIterator<Alarm> a1( i1.alarms() ); | 156 | QPtrListIterator<Alarm> a1( i1.alarms() ); |
135 | QPtrListIterator<Alarm> a2( i2.alarms() ); | 157 | QPtrListIterator<Alarm> a2( i2.alarms() ); |
136 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { | 158 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { |
137 | if( *a1.current() == *a2.current() ) { | 159 | if( *a1.current() == *a2.current() ) { |
138 | continue; | 160 | continue; |
139 | } | 161 | } |
140 | else { | 162 | else { |
141 | return false; | 163 | return false; |
142 | } | 164 | } |
143 | } | 165 | } |
144 | #endif | 166 | #endif |
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 ) ) |
147 | return false; | 179 | return false; |
148 | if ( i1.hasStartDate() == i2.hasStartDate() ) { | 180 | if ( i1.hasStartDate() == i2.hasStartDate() ) { |
149 | if ( i1.hasStartDate() ) { | 181 | if ( i1.hasStartDate() ) { |
150 | if ( i1.dtStart() != i2.dtStart() ) | 182 | if ( i1.dtStart() != i2.dtStart() ) |
151 | return false; | 183 | return false; |
152 | } | 184 | } |
153 | } else { | 185 | } else { |
154 | return false; | 186 | return false; |
155 | } | 187 | } |
156 | if (!( *i1.recurrence() == *i2.recurrence()) ) { | 188 | if (!( *i1.recurrence() == *i2.recurrence()) ) { |
157 | qDebug("recurrence is NOT equal "); | 189 | qDebug("recurrence is NOT equal "); |
@@ -161,24 +193,25 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
161 | // i1.created() == i2.created() && | 193 | // i1.created() == i2.created() && |
162 | stringCompare( i1.description(), i2.description() ) && | 194 | stringCompare( i1.description(), i2.description() ) && |
163 | stringCompare( i1.summary(), i2.summary() ) && | 195 | stringCompare( i1.summary(), i2.summary() ) && |
164 | i1.categories() == i2.categories() && | 196 | i1.categories() == i2.categories() && |
165 | // no need to compare mRelatedTo | 197 | // no need to compare mRelatedTo |
166 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 198 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
167 | // i1.relations() == i2.relations() && | 199 | // i1.relations() == i2.relations() && |
168 | i1.exDates() == i2.exDates() && | 200 | i1.exDates() == i2.exDates() && |
169 | i1.attachments() == i2.attachments() && | 201 | i1.attachments() == i2.attachments() && |
170 | i1.resources() == i2.resources() && | 202 | i1.resources() == i2.resources() && |
171 | i1.secrecy() == i2.secrecy() && | 203 | i1.secrecy() == i2.secrecy() && |
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() ); |
174 | } | 207 | } |
175 | 208 | ||
176 | Incidence* Incidence::recreateCloneException( QDate d ) | 209 | Incidence* Incidence::recreateCloneException( QDate d ) |
177 | { | 210 | { |
178 | Incidence* newInc = clone(); | 211 | Incidence* newInc = clone(); |
179 | newInc->recreate(); | 212 | newInc->recreate(); |
180 | if ( doesRecur() ) { | 213 | if ( doesRecur() ) { |
181 | addExDate( d ); | 214 | addExDate( d ); |
182 | newInc->recurrence()->unsetRecurs(); | 215 | newInc->recurrence()->unsetRecurs(); |
183 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 216 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
184 | QTime tim = dtStart().time(); | 217 | QTime tim = dtStart().time(); |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index de2a381..38d2aaa 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -254,33 +254,42 @@ class Incidence : public IncidenceBase | |||
254 | 254 | ||
255 | /** set the event's/todo's location. Do _not_ use it with journal */ | 255 | /** set the event's/todo's location. Do _not_ use it with journal */ |
256 | void setLocation(const QString &location); | 256 | void setLocation(const QString &location); |
257 | /** return the event's/todo's location. Do _not_ use it with journal */ | 257 | /** return the event's/todo's location. Do _not_ use it with journal */ |
258 | QString location() const; | 258 | QString location() const; |
259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ | 259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ |
260 | bool hasStartDate() const; | 260 | bool hasStartDate() const; |
261 | /** sets the event's hasStartDate value. */ | 261 | /** sets the event's hasStartDate value. */ |
262 | void setHasStartDate(bool f); | 262 | void setHasStartDate(bool f); |
263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
264 | bool cancelled() const; | 264 | bool cancelled() const; |
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 | ||
267 | protected: | 274 | protected: |
268 | QPtrList<Alarm> mAlarms; | 275 | QPtrList<Alarm> mAlarms; |
269 | QPtrList<Incidence> mRelations; | 276 | QPtrList<Incidence> mRelations; |
270 | private: | 277 | private: |
271 | int mRevision; | 278 | int mRevision; |
272 | bool mCancelled; | 279 | bool mCancelled; |
273 | 280 | ||
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; |
276 | QString mDescription; | 285 | QString mDescription; |
277 | QString mSummary; | 286 | QString mSummary; |
278 | QStringList mCategories; | 287 | QStringList mCategories; |
279 | Incidence *mRelatedTo; | 288 | Incidence *mRelatedTo; |
280 | QString mRelatedToUid; | 289 | QString mRelatedToUid; |
281 | DateList mExDates; | 290 | DateList mExDates; |
282 | QPtrList<Attachment> mAttachments; | 291 | QPtrList<Attachment> mAttachments; |
283 | QStringList mResources; | 292 | QStringList mResources; |
284 | bool mHasStartDate; // if todo has associated start date | 293 | bool mHasStartDate; // if todo has associated start date |
285 | 294 | ||
286 | int mSecrecy; | 295 | int mSecrecy; |
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 7b44bfb..a2fc2dc 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h | |||
@@ -108,27 +108,27 @@ class KDialogBase : public KDialog | |||
108 | void defaultClicked(); | 108 | void defaultClicked(); |
109 | 109 | ||
110 | protected slots: | 110 | protected slots: |
111 | virtual void slotOk(); | 111 | virtual void slotOk(); |
112 | virtual void slotApply(); | 112 | virtual void slotApply(); |
113 | virtual void slotCancel(); | 113 | virtual void slotCancel(); |
114 | virtual void slotClose(); | 114 | virtual void slotClose(); |
115 | virtual void slotUser1(); | 115 | virtual void slotUser1(); |
116 | virtual void slotUser2(); | 116 | virtual void slotUser2(); |
117 | 117 | ||
118 | protected: | 118 | protected: |
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, |
124 | const QString &user1=QString::null, const QString &user2=QString::null ); | 124 | const QString &user1=QString::null, const QString &user2=QString::null ); |
125 | void initLayout(); | 125 | void initLayout(); |
126 | 126 | ||
127 | QWidget *mMainWidget; | 127 | QWidget *mMainWidget; |
128 | QTabWidget *mTabWidget; | 128 | QTabWidget *mTabWidget; |
129 | QFrame *mPlainPage; | 129 | QFrame *mPlainPage; |
130 | QBoxLayout *mTopLayout; | 130 | QBoxLayout *mTopLayout; |
131 | 131 | ||
132 | QPushButton *mUser1Button; | 132 | QPushButton *mUser1Button; |
133 | QPushButton *mUser2Button; | 133 | QPushButton *mUser2Button; |
134 | QPushButton *mCloseButton; | 134 | QPushButton *mCloseButton; |