summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-25 16:06:31 (UTC)
committer zautrix <zautrix>2005-06-25 16:06:31 (UTC)
commit3867528ada39bb50a18802c499fbc3f6fae26e8c (patch) (unidiff)
tree6b619b3bc6dea00e52648b4a394a61ab4ee8a072
parent49d8fe456ce284a512227a7ca9d4d49688a39cd2 (diff)
downloadkdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.zip
kdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.tar.gz
kdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.tar.bz2
fixxxxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt3
-rw-r--r--korganizer/koeditorgeneral.h1
-rw-r--r--korganizer/koeditorgeneralevent.cpp2
-rw-r--r--korganizer/koeditorgeneralevent.h1
-rw-r--r--korganizer/koeditorgeneraltodo.cpp9
-rw-r--r--korganizer/koeditorgeneraltodo.h1
-rw-r--r--korganizer/koeditorrecurrence.cpp42
-rw-r--r--korganizer/koeditorrecurrence.h4
-rw-r--r--korganizer/koeventeditor.cpp4
-rw-r--r--korganizer/kotodoeditor.cpp8
10 files changed, 49 insertions, 26 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index fdaf740..4b965c1 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,32 +1,35 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.1.9 ************ 3********** VERSION 2.1.9 ************
4 4
5KO/Pi: 5KO/Pi:
6Fixed some problems of the new search options in the search dialog. 6Fixed some problems of the new search options in the search dialog.
7Fixed some problems in the new resource config options. 7Fixed some problems in the new resource config options.
8Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. 8Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page.
9Fixed a problem cearting new events in the agenda view if at the day/time is already an agenda item shown:
10Now you can click on the bottom/top of an allday agenda item and on the left/right of an agenda item to get the "new todo/new event" popup.
11
9 12
10PwM/Pi: 13PwM/Pi:
11Added "sec" to the timeout config settings to make it clear the timeout values are seconds. 14Added "sec" to the timeout config settings to make it clear the timeout values are seconds.
12 15
13********** VERSION 2.1.8 ************ 16********** VERSION 2.1.8 ************
14 17
15KO/Pi: 18KO/Pi:
16Added info about the completion state of a todo in the ListView/Searchdialog. 19Added info about the completion state of a todo in the ListView/Searchdialog.
17If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. 20If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well.
18Fixed some updating problems when changing the filter. 21Fixed some updating problems when changing the filter.
19 22
20KA/Pi: 23KA/Pi:
21In the addressee selection dialog now the formatted name is shown, if not empty. 24In the addressee selection dialog now the formatted name is shown, if not empty.
22Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. 25Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category.
23Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. 26Now in the addressee selection dialog a selected contact is remove with a single click from the selected list.
24 27
25Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. 28Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored.
26Fixed the sorting for size in the file selector on the Z. 29Fixed the sorting for size in the file selector on the Z.
27 30
28Changed the color selection dialog on the Zaurus to a more user friendly version. 31Changed the color selection dialog on the Zaurus to a more user friendly version.
29 32
30********** VERSION 2.1.7 ************ 33********** VERSION 2.1.7 ************
31 34
32KO/Pi: 35KO/Pi:
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index 2069e9c..a8f6443 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -64,48 +64,49 @@ class KOEditorGeneral : public QObject
64 /** Read event object and setup widgets accordingly */ 64 /** Read event object and setup widgets accordingly */
65 void readIncidence(Incidence *); 65 void readIncidence(Incidence *);
66 /** Write event settings to event object */ 66 /** Write event settings to event object */
67 void writeIncidence(Incidence *); 67 void writeIncidence(Incidence *);
68 68
69 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
70 bool validateInput() { return true; } 70 bool validateInput() { return true; }
71 71
72 void enableAlarm( bool enable ); 72 void enableAlarm( bool enable );
73 void setSecrecy( int num ); 73 void setSecrecy( int num );
74 public slots: 74 public slots:
75 void setCategories(const QString &); 75 void setCategories(const QString &);
76 void editCategories(); 76 void editCategories();
77 77
78 protected slots: 78 protected slots:
79 void enableAlarmEdit( bool enable ); 79 void enableAlarmEdit( bool enable );
80 void disableAlarmEdit( bool disable ); 80 void disableAlarmEdit( bool disable );
81 void alarmDisable( bool disable ); 81 void alarmDisable( bool disable );
82 void pickAlarmSound(); 82 void pickAlarmSound();
83 void pickAlarmProgram(); 83 void pickAlarmProgram();
84 void slotSetFocusOn(); 84 void slotSetFocusOn();
85 signals: 85 signals:
86 void openCategoryDialog(); 86 void openCategoryDialog();
87 void allAccepted(); 87 void allAccepted();
88 void dateTimesChanged(QDateTime,QDateTime);
88 89
89 protected: 90 protected:
90 int mNextFocus; 91 int mNextFocus;
91 //QLineEdit *mSummaryEdit; 92 //QLineEdit *mSummaryEdit;
92 //QLineEdit *mLocationEdit; 93 //QLineEdit *mLocationEdit;
93 KOLocationBox *mSummaryEdit; 94 KOLocationBox *mSummaryEdit;
94 KOLocationBox *mLocationEdit; 95 KOLocationBox *mLocationEdit;
95 QLabel *mAlarmBell; 96 QLabel *mAlarmBell;
96 QCheckBox *mAlarmButton; 97 QCheckBox *mAlarmButton;
97 QSpinBox *mAlarmTimeEdit; 98 QSpinBox *mAlarmTimeEdit;
98 QPushButton *mAlarmSoundButton; 99 QPushButton *mAlarmSoundButton;
99 QPushButton *mAlarmProgramButton; 100 QPushButton *mAlarmProgramButton;
100 QComboBox *mAlarmIncrCombo; 101 QComboBox *mAlarmIncrCombo;
101 KTextEdit *mDescriptionEdit; 102 KTextEdit *mDescriptionEdit;
102 QLabel *mOwnerLabel; 103 QLabel *mOwnerLabel;
103 QComboBox *mSecrecyCombo; 104 QComboBox *mSecrecyCombo;
104 QCheckBox *mCancelBox; 105 QCheckBox *mCancelBox;
105 QPushButton *mCategoriesButton; 106 QPushButton *mCategoriesButton;
106 QLabel *mCategoriesLabel; 107 QLabel *mCategoriesLabel;
107 108
108 private: 109 private:
109 QString getFittingPath( const QString ) ; 110 QString getFittingPath( const QString ) ;
110 QString mAlarmSound; 111 QString mAlarmSound;
111 QString mAlarmProgram; 112 QString mAlarmProgram;
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index af97ee9..3dd7f5c 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -216,49 +216,49 @@ void KOEditorGeneralEvent::startTimeChanged(QTime newtime)
216 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); 216 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
217 mEndTimeEdit->setTime(mCurrEndDateTime.time()); 217 mEndTimeEdit->setTime(mCurrEndDateTime.time());
218 mEndDateEdit->setDate(mCurrEndDateTime.date()); 218 mEndDateEdit->setDate(mCurrEndDateTime.date());
219 219
220 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 220 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
221} 221}
222 222
223void KOEditorGeneralEvent::endTimeChanged(QTime newtime) 223void KOEditorGeneralEvent::endTimeChanged(QTime newtime)
224{ 224{
225 225
226 mCurrEndDateTime = QDateTime ( mEndDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0)); 226 mCurrEndDateTime = QDateTime ( mEndDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0));
227 227
228 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 228 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
229} 229}
230 230
231void KOEditorGeneralEvent::startDateChanged(QDate newdate) 231void KOEditorGeneralEvent::startDateChanged(QDate newdate)
232{ 232{
233 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); 233 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime);
234 234
235 mCurrStartDateTime.setDate(newdate); 235 mCurrStartDateTime.setDate(newdate);
236 236
237 // adjust end date so that the event has the same duration as before 237 // adjust end date so that the event has the same duration as before
238 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); 238 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
239 mEndDateEdit->setDate(mCurrEndDateTime.date()); 239 mEndDateEdit->setDate(mCurrEndDateTime.date());
240 240 qDebug("KOEditorGeneralEvent::startDateChanged ");
241 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 241 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
242} 242}
243 243
244void KOEditorGeneralEvent::endDateChanged(QDate newdate) 244void KOEditorGeneralEvent::endDateChanged(QDate newdate)
245{ 245{
246 QDateTime newdt(newdate, mCurrEndDateTime.time()); 246 QDateTime newdt(newdate, mCurrEndDateTime.time());
247 247
248 if(newdt < mCurrStartDateTime) { 248 if(newdt < mCurrStartDateTime) {
249 // oops, we can't let that happen. 249 // oops, we can't let that happen.
250 newdt = mCurrStartDateTime; 250 newdt = mCurrStartDateTime;
251 mEndDateEdit->setDate(newdt.date()); 251 mEndDateEdit->setDate(newdt.date());
252 mEndTimeEdit->setTime(newdt.time()); 252 mEndTimeEdit->setTime(newdt.time());
253 } 253 }
254 mCurrEndDateTime = newdt; 254 mCurrEndDateTime = newdt;
255 255
256 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 256 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
257} 257}
258 258
259void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay) 259void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay)
260{ 260{
261 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 261 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
262 mLocationEdit->load(KOLocationBox::LOCATION); 262 mLocationEdit->load(KOLocationBox::LOCATION);
263 KOEditorGeneral::setDefaults(allDay); 263 KOEditorGeneral::setDefaults(allDay);
264 264
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 9649806..d798905 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -66,46 +66,45 @@ class KOEditorGeneralEvent : public KOEditorGeneral
66 /** Write event settings to event object */ 66 /** Write event settings to event object */
67 void writeEvent(Event *); 67 void writeEvent(Event *);
68 68
69 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
70 bool validateInput(); 70 bool validateInput();
71 71
72 public slots: 72 public slots:
73 void setDateTimes(QDateTime start, QDateTime end); 73 void setDateTimes(QDateTime start, QDateTime end);
74 void setDuration(); 74 void setDuration();
75 75
76 protected slots: 76 protected slots:
77 void timeStuffDisable(bool disable); 77 void timeStuffDisable(bool disable);
78 void dontAssociateTime(bool noTime); 78 void dontAssociateTime(bool noTime);
79 79
80 void startTimeChanged(QTime); 80 void startTimeChanged(QTime);
81 void startDateChanged(QDate); 81 void startDateChanged(QDate);
82 void endTimeChanged(QTime); 82 void endTimeChanged(QTime);
83 void endDateChanged(QDate); 83 void endDateChanged(QDate);
84 84
85 void emitDateTimeStr(); 85 void emitDateTimeStr();
86 void sTimeChanged(QTime); 86 void sTimeChanged(QTime);
87 void eTimeChanged(QTime); 87 void eTimeChanged(QTime);
88 88
89 signals: 89 signals:
90 void dateTimesChanged(QDateTime start,QDateTime end);
91 void allDayChanged(bool); 90 void allDayChanged(bool);
92 void dateTimeStrChanged(const QString &); 91 void dateTimeStrChanged(const QString &);
93 92
94 private: 93 private:
95 bool mTemplate; 94 bool mTemplate;
96 QLabel *mStartDateLabel; 95 QLabel *mStartDateLabel;
97 QLabel *mEndDateLabel; 96 QLabel *mEndDateLabel;
98 KDateEdit *mStartDateEdit; 97 KDateEdit *mStartDateEdit;
99 KDateEdit *mEndDateEdit; 98 KDateEdit *mEndDateEdit;
100 KOTimeEdit *mStartTimeEdit; 99 KOTimeEdit *mStartTimeEdit;
101 KOTimeEdit *mEndTimeEdit; 100 KOTimeEdit *mEndTimeEdit;
102 QLabel *mDurationLabel; 101 QLabel *mDurationLabel;
103 QCheckBox *mNoTimeButton; 102 QCheckBox *mNoTimeButton;
104 QComboBox *mFreeTimeCombo; 103 QComboBox *mFreeTimeCombo;
105 104
106 // current start and end date and time 105 // current start and end date and time
107 QDateTime mCurrStartDateTime; 106 QDateTime mCurrStartDateTime;
108 QDateTime mCurrEndDateTime; 107 QDateTime mCurrEndDateTime;
109}; 108};
110 109
111#endif 110#endif
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index e86b4d0..0a734ee 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -106,49 +106,50 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
106 mDueDateEdit = new KDateEdit(timeBoxFrame); 106 mDueDateEdit = new KDateEdit(timeBoxFrame);
107 layoutTimeBox->addWidget(mDueDateEdit,1,1); 107 layoutTimeBox->addWidget(mDueDateEdit,1,1);
108 108
109 mDueTimeEdit = new KOTimeEdit(timeBoxFrame); 109 mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
110 layoutTimeBox->addWidget(mDueTimeEdit,1,2); 110 layoutTimeBox->addWidget(mDueTimeEdit,1,2);
111 111
112 112
113 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); 113 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
114 layoutTimeBox->addWidget(mStartCheck,0,0); 114 layoutTimeBox->addWidget(mStartCheck,0,0);
115 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); 115 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
116 116
117 mStartDateEdit = new KDateEdit(timeBoxFrame); 117 mStartDateEdit = new KDateEdit(timeBoxFrame);
118 layoutTimeBox->addWidget(mStartDateEdit,0,1); 118 layoutTimeBox->addWidget(mStartDateEdit,0,1);
119 119
120 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 120 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
121 layoutTimeBox->addWidget(mStartTimeEdit,0,2); 121 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
122 122
123 123
124 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); 124 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
125 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); 125 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
126 126
127 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); 127 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
128 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); 128 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
129 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); 129 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
130 130 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
131 this, SLOT(startDateChanged(QDate)));
131 // some more layouting 132 // some more layouting
132 //layoutTimeBox->setColStretch(3,1); 133 //layoutTimeBox->setColStretch(3,1);
133} 134}
134 135
135 136
136void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) 137void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
137{ 138{
138 mCompletedCombo = new QComboBox(parent); 139 mCompletedCombo = new QComboBox(parent);
139 // xgettext:no-c-format 140 // xgettext:no-c-format
140 mCompletedCombo->insertItem(i18n(" 0 %")); 141 mCompletedCombo->insertItem(i18n(" 0 %"));
141 // xgettext:no-c-format 142 // xgettext:no-c-format
142 mCompletedCombo->insertItem(i18n(" 20 %")); 143 mCompletedCombo->insertItem(i18n(" 20 %"));
143 // xgettext:no-c-format 144 // xgettext:no-c-format
144 mCompletedCombo->insertItem(i18n(" 40 %")); 145 mCompletedCombo->insertItem(i18n(" 40 %"));
145 // xgettext:no-c-format 146 // xgettext:no-c-format
146 mCompletedCombo->insertItem(i18n(" 60 %")); 147 mCompletedCombo->insertItem(i18n(" 60 %"));
147 // xgettext:no-c-format 148 // xgettext:no-c-format
148 mCompletedCombo->insertItem(i18n(" 80 %")); 149 mCompletedCombo->insertItem(i18n(" 80 %"));
149 // xgettext:no-c-format 150 // xgettext:no-c-format
150 mCompletedCombo->insertItem(i18n("100 %")); 151 mCompletedCombo->insertItem(i18n("100 %"));
151 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); 152 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int)));
152 topLayout->addWidget(mCompletedCombo); 153 topLayout->addWidget(mCompletedCombo);
153 154
154 mCompletedLabel = new QLabel(i18n("completed"),parent); 155 mCompletedLabel = new QLabel(i18n("completed"),parent);
@@ -374,49 +375,53 @@ void KOEditorGeneralTodo::enableDueEdit(bool enable)
374 mDueTimeEdit->setEnabled( false ); 375 mDueTimeEdit->setEnabled( false );
375 } 376 }
376 emit datesChecked(); 377 emit datesChecked();
377} 378}
378 379
379void KOEditorGeneralTodo::enableStartEdit( bool enable ) 380void KOEditorGeneralTodo::enableStartEdit( bool enable )
380{ 381{
381 mStartDateEdit->setEnabled( enable ); 382 mStartDateEdit->setEnabled( enable );
382 383
383 if(mDueCheck->isChecked() || mStartCheck->isChecked()) { 384 if(mDueCheck->isChecked() || mStartCheck->isChecked()) {
384 mTimeButton->setEnabled(true); 385 mTimeButton->setEnabled(true);
385 } 386 }
386 else { 387 else {
387 mTimeButton->setEnabled(false); 388 mTimeButton->setEnabled(false);
388 mTimeButton->setChecked(false); 389 mTimeButton->setChecked(false);
389 } 390 }
390 391
391 if (enable) { 392 if (enable) {
392 mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); 393 mStartTimeEdit->setEnabled( mTimeButton->isChecked() );
393 } else { 394 } else {
394 mStartTimeEdit->setEnabled( false ); 395 mStartTimeEdit->setEnabled( false );
395 } 396 }
396 emit datesChecked(); 397 emit datesChecked();
397} 398}
398 399void KOEditorGeneralTodo::startDateChanged(QDate newdate)
400{
401 if ( mDueCheck->isChecked() )
402 emit dateTimesChanged(newdate,mDueDateEdit->date());
403}
399void KOEditorGeneralTodo::enableTimeEdits(bool enable) 404void KOEditorGeneralTodo::enableTimeEdits(bool enable)
400{ 405{
401 if(mStartCheck->isChecked()) { 406 if(mStartCheck->isChecked()) {
402 mStartTimeEdit->setEnabled( enable ); 407 mStartTimeEdit->setEnabled( enable );
403 } 408 }
404 if(mDueCheck->isChecked()) { 409 if(mDueCheck->isChecked()) {
405 mDueTimeEdit->setEnabled( enable ); 410 mDueTimeEdit->setEnabled( enable );
406 } 411 }
407} 412}
408 413
409void KOEditorGeneralTodo::showAlarm() 414void KOEditorGeneralTodo::showAlarm()
410{ 415{
411 if ( mDueCheck->isChecked() ) { 416 if ( mDueCheck->isChecked() ) {
412 alarmDisable(false); 417 alarmDisable(false);
413 } 418 }
414 else { 419 else {
415 alarmDisable(true); 420 alarmDisable(true);
416 } 421 }
417} 422}
418 423
419bool KOEditorGeneralTodo::validateInput() 424bool KOEditorGeneralTodo::validateInput()
420{ 425{
421 if (mDueCheck->isChecked()) { 426 if (mDueCheck->isChecked()) {
422 if (!mDueDateEdit->inputIsValid()) { 427 if (!mDueDateEdit->inputIsValid()) {
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index b198539..2e56a7a 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -54,48 +54,49 @@ class KOEditorGeneralTodo : public KOEditorGeneral
54 void initStatus(QWidget *, QBoxLayout *); 54 void initStatus(QWidget *, QBoxLayout *);
55 void initCompletion(QWidget *, QBoxLayout *); 55 void initCompletion(QWidget *, QBoxLayout *);
56 void initPriority(QWidget *, QBoxLayout *); 56 void initPriority(QWidget *, QBoxLayout *);
57 57
58 void finishSetup(); 58 void finishSetup();
59 59
60 /** Set widgets to default values */ 60 /** Set widgets to default values */
61 void setDefaults(QDateTime due,bool allDay); 61 void setDefaults(QDateTime due,bool allDay);
62 /** Read todo object and setup widgets accordingly */ 62 /** Read todo object and setup widgets accordingly */
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 void datesChecked();
76 76
77 protected slots: 77 protected slots:
78 void startDateChanged(QDate newdate);
78 void completedChanged(int); 79 void completedChanged(int);
79 80
80 void enableDueEdit( bool enable ); 81 void enableDueEdit( bool enable );
81 void enableStartEdit( bool enable ); 82 void enableStartEdit( bool enable );
82 void enableTimeEdits( bool enable ); 83 void enableTimeEdits( bool enable );
83 void showAlarm(); 84 void showAlarm();
84 85
85 protected: 86 protected:
86 void setCompletedDate(); 87 void setCompletedDate();
87 88
88 private: 89 private:
89 friend class KOTodoEditor; 90 friend class KOTodoEditor;
90 KDateEdit *mStartDateEdit; 91 KDateEdit *mStartDateEdit;
91 KOTimeEdit *mStartTimeEdit; 92 KOTimeEdit *mStartTimeEdit;
92 KDateEdit *mCompleteDateEdit; 93 KDateEdit *mCompleteDateEdit;
93 KOTimeEdit *mCompleteTimeEdit; 94 KOTimeEdit *mCompleteTimeEdit;
94 QCheckBox *mTimeButton; 95 QCheckBox *mTimeButton;
95 QCheckBox *mDueCheck; 96 QCheckBox *mDueCheck;
96 KDateEdit *mDueDateEdit; 97 KDateEdit *mDueDateEdit;
97 KOTimeEdit *mDueTimeEdit; 98 KOTimeEdit *mDueTimeEdit;
98 QComboBox *mCompletedCombo; 99 QComboBox *mCompletedCombo;
99 QLabel *mCompletedLabel; 100 QLabel *mCompletedLabel;
100 QLabel *mPriorityLabel; 101 QLabel *mPriorityLabel;
101 QComboBox *mPriorityCombo; 102 QComboBox *mPriorityCombo;
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index dea8981..de4e4f7 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -814,111 +814,123 @@ void KOEditorRecurrence::showCurrentRule( int current )
814 case Daily: 814 case Daily:
815 mRuleStack->raiseWidget( mDaily ); 815 mRuleStack->raiseWidget( mDaily );
816 break; 816 break;
817 case Weekly: 817 case Weekly:
818 mRuleStack->raiseWidget( mWeekly ); 818 mRuleStack->raiseWidget( mWeekly );
819 break; 819 break;
820 case Monthly: 820 case Monthly:
821 mRuleStack->raiseWidget( mMonthly ); 821 mRuleStack->raiseWidget( mMonthly );
822 break; 822 break;
823 default: 823 default:
824 case Yearly: 824 case Yearly:
825 mRuleStack->raiseWidget( mYearly ); 825 mRuleStack->raiseWidget( mYearly );
826 break; 826 break;
827 } 827 }
828} 828}
829 829
830void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) 830void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end )
831{ 831{
832// kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; 832// kdDebug() << "KOEditorRecurrence::setDateTimes" << endl;
833 833
834 mRecurrenceRange->setDateTimes( start, end ); 834 mRecurrenceRange->setDateTimes( start, end );
835 mExceptions->setDefaults( end ); 835 mExceptions->setDefaults( end );
836 836
837} 837}
838 838void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to )
839void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) 839{
840 setDateTimes( from, to );
841 QBitArray days( 7 );
842 days.fill( 0 );
843 days.setBit( from.date().dayOfWeek()- 1);
844 mWeekly->setDays( days );
845 bool byPos = mMonthly->byPos();
846 if ( byPos )
847 mMonthly->setByDay( from.date().day()-1 );
848 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
849 if ( ! byPos)
850 mMonthly->setByDay( from.date().day()-1 );
851
852 bool byDay = mYearly->byDay();
853 if ( ! byDay )
854 mYearly->setByDay( from.date().dayOfYear() );
855 mYearly->setByMonth( from.date().month(), from.date().day() );
856 if ( byDay )
857 mYearly->setByDay( from.date().dayOfYear() );
858}
859void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to )
840{ 860{
841 861
842 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); 862 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() );
843 setDateTimes( from, to ); 863 //setDateTimes( from, to );
844 864
845 bool enabled = false; 865 bool enabled = false;
846 mEnabledCheck->setChecked( enabled ); 866 mEnabledCheck->setChecked( enabled );
847 setEnabled( enabled ); 867 setEnabled( enabled );
848 868
849 mExceptions->setDefaults( to ); 869 mExceptions->setDefaults( to );
850 mRecurrenceRange->setDefaults( to ); 870 mRecurrenceRange->setDefaults( to );
851 871
852 mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); 872 mRecurrenceChooser->setType( RecurrenceChooser::Weekly );
853 showCurrentRule( mRecurrenceChooser->type() ); 873 showCurrentRule( mRecurrenceChooser->type() );
854 874
855 mDaily->setFrequency( 1 ); 875 mDaily->setFrequency( 1 );
856
857 mWeekly->setFrequency( 1 ); 876 mWeekly->setFrequency( 1 );
858 QBitArray days( 7 );
859 days.fill( 0 );
860 days.setBit( from.date().dayOfWeek()- 1);
861 mWeekly->setDays( days );
862 mMonthly->setFrequency( 1 ); 877 mMonthly->setFrequency( 1 );
863 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
864 mMonthly->setByDay( from.date().day()-1 );
865 mYearly->setFrequency( 1 ); 878 mYearly->setFrequency( 1 );
866 mYearly->setByDay( from.date().dayOfYear() ); 879 setDefaultsDates( from, to );
867 mYearly->setByMonth( from.date().month(), from.date().day() );
868} 880}
869 881
870void KOEditorRecurrence::readEvent(Incidence *event) 882void KOEditorRecurrence::readEvent(Incidence *event)
871{ 883{
872 884
873 QDateTime dtEnd; 885 QDateTime dtEnd;
874 if ( event->typeID() == eventID ) 886 if ( event->typeID() == eventID )
875 dtEnd = ((Event*)event)->dtEnd(); 887 dtEnd = ((Event*)event)->dtEnd();
876 else 888 else
877 dtEnd = ((Todo*)event)->dtDue(); 889 dtEnd = ((Todo*)event)->dtDue();
878 890
879 setDefaults( event->dtStart(), dtEnd, true ); 891 setDefaults( event->dtStart(), dtEnd );
880 QBitArray rDays( 7 ); 892 QBitArray rDays( 7 );
881 QPtrList<Recurrence::rMonthPos> rmp; 893 QPtrList<Recurrence::rMonthPos> rmp;
882 QPtrList<int> rmd; 894 QPtrList<int> rmd;
883 int day = 0; 895 int day = 0;
884 int count = 0; 896 int count = 0;
885 int month = 0; 897 int month = 0;
886 setDateTimes( event->dtStart(), dtEnd ); 898 setDateTimes( event->dtStart(), dtEnd );
887 899
888 Recurrence *r = event->recurrence(); 900 Recurrence *r = event->recurrence();
889 int f = r->frequency(); 901 int f = r->frequency();
890 902
891 int recurs = r->doesRecur(); 903 int recurs = r->doesRecur();
892 904
893 mEnabledCheck->setChecked( recurs ); 905 mEnabledCheck->setChecked( recurs );
894 setEnabled( recurs ); 906 setEnabled( recurs );
895 907
896 int recurrenceType = RecurrenceChooser::Weekly; 908 int recurrenceType = RecurrenceChooser::Weekly;
897 909
898 switch ( recurs ) { 910 switch ( recurs ) {
899 case Recurrence::rNone: 911 case Recurrence::rNone:
900 setDefaults( event->dtStart(), dtEnd, true ); 912 setDefaults( event->dtStart(), dtEnd );
901 break; 913 break;
902 case Recurrence::rDaily: 914 case Recurrence::rDaily:
903 recurrenceType = RecurrenceChooser::Daily; 915 recurrenceType = RecurrenceChooser::Daily;
904 mDaily->setFrequency( f ); 916 mDaily->setFrequency( f );
905 break; 917 break;
906 case Recurrence::rWeekly: 918 case Recurrence::rWeekly:
907 recurrenceType = RecurrenceChooser::Weekly; 919 recurrenceType = RecurrenceChooser::Weekly;
908 mWeekly->setFrequency( f ); 920 mWeekly->setFrequency( f );
909 mWeekly->setDays( r->days() ); 921 mWeekly->setDays( r->days() );
910 break; 922 break;
911 case Recurrence::rMonthlyPos: 923 case Recurrence::rMonthlyPos:
912 // we only handle one possibility in the list right now, 924 // we only handle one possibility in the list right now,
913 // so I have hardcoded calls with first(). If we make the GUI 925 // so I have hardcoded calls with first(). If we make the GUI
914 // more extended, this can be changed. 926 // more extended, this can be changed.
915 recurrenceType = RecurrenceChooser::Monthly; 927 recurrenceType = RecurrenceChooser::Monthly;
916 928
917 rmp = r->monthPositions(); 929 rmp = r->monthPositions();
918 if ( rmp.first()->negative ) 930 if ( rmp.first()->negative )
919 count = 5 - rmp.first()->rPos - 1; 931 count = 5 - rmp.first()->rPos - 1;
920 else 932 else
921 count = rmp.first()->rPos - 1; 933 count = rmp.first()->rPos - 1;
922 day = 0; 934 day = 0;
923 while ( !rmp.first()->rDays.testBit( day ) ) ++day; 935 while ( !rmp.first()->rDays.testBit( day ) ) ++day;
924 mMonthly->setByPos( count, day ); 936 mMonthly->setByPos( count, day );
@@ -948,49 +960,49 @@ void KOEditorRecurrence::readEvent(Incidence *event)
948 month = event->dtStart().date().month() ; 960 month = event->dtStart().date().month() ;
949 mYearly->setByMonth( month, day ); 961 mYearly->setByMonth( month, day );
950#if 0 962#if 0
951 //qDebug("2day = %d ",day ); 963 //qDebug("2day = %d ",day );
952 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); 964 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
953 int month; 965 int month;
954 if ( !monthlist.isEmpty() ) { 966 if ( !monthlist.isEmpty() ) {
955 month = monthlist.first()->rPos ; 967 month = monthlist.first()->rPos ;
956 } else { 968 } else {
957 month = event->dtStart().date().month() ; 969 month = event->dtStart().date().month() ;
958 } 970 }
959 mYearly->setByMonth( day, month ); 971 mYearly->setByMonth( day, month );
960#endif 972#endif
961 mYearly->setFrequency( f ); 973 mYearly->setFrequency( f );
962 } 974 }
963 975
964 break; 976 break;
965 case Recurrence::rYearlyDay: 977 case Recurrence::rYearlyDay:
966 //qDebug("Recurrence::rYearlyDay: "); 978 //qDebug("Recurrence::rYearlyDay: ");
967 recurrenceType = RecurrenceChooser::Yearly; 979 recurrenceType = RecurrenceChooser::Yearly;
968 mYearly->setByDay( event->dtStart().date().dayOfYear() ); 980 mYearly->setByDay( event->dtStart().date().dayOfYear() );
969 mYearly->setFrequency( f ); 981 mYearly->setFrequency( f );
970 break; 982 break;
971 default: 983 default:
972 setDefaults( event->dtStart(), dtEnd, true ); 984 setDefaults( event->dtStart(), dtEnd );
973 break; 985 break;
974 } 986 }
975 987
976 mRecurrenceChooser->setType( recurrenceType ); 988 mRecurrenceChooser->setType( recurrenceType );
977 showCurrentRule( recurrenceType ); 989 showCurrentRule( recurrenceType );
978 990
979 mRecurrenceRange->setDateTimes( event->dtStart() ); 991 mRecurrenceRange->setDateTimes( event->dtStart() );
980 992
981 if ( r->doesRecur() ) { 993 if ( r->doesRecur() ) {
982 mRecurrenceRange->setDuration( r->duration() ); 994 mRecurrenceRange->setDuration( r->duration() );
983 if ( r->duration() == 0 ) 995 if ( r->duration() == 0 )
984 { 996 {
985 if ( r->endDate() < event->dtStart().date() ) 997 if ( r->endDate() < event->dtStart().date() )
986 mRecurrenceRange->setEndDate( event->dtStart().date() ); 998 mRecurrenceRange->setEndDate( event->dtStart().date() );
987 else 999 else
988 mRecurrenceRange->setEndDate( r->endDate() ); 1000 mRecurrenceRange->setEndDate( r->endDate() );
989 } else 1001 } else
990 mRecurrenceRange->setEndDate( event->dtStart().date() ); 1002 mRecurrenceRange->setEndDate( event->dtStart().date() );
991 } 1003 }
992 1004
993 mExceptions->setDates( event->exDates() ); 1005 mExceptions->setDates( event->exDates() );
994} 1006}
995 1007
996void KOEditorRecurrence::writeEvent( Incidence *event ) 1008void KOEditorRecurrence::writeEvent( Incidence *event )
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index a15afcb..f398f62 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -250,59 +250,59 @@ class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase
250 void setDefaults( const QDateTime &from ); 250 void setDefaults( const QDateTime &from );
251 251
252 void setDuration( int ); 252 void setDuration( int );
253 int duration(); 253 int duration();
254 254
255 void setEndDate( const QDate & ); 255 void setEndDate( const QDate & );
256 QDate endDate(); 256 QDate endDate();
257 257
258 void setDateTimes( const QDateTime &start, 258 void setDateTimes( const QDateTime &start,
259 const QDateTime &end = QDateTime() ); 259 const QDateTime &end = QDateTime() );
260 260
261 private: 261 private:
262 RecurrenceRangeWidget *mRecurrenceRangeWidget; 262 RecurrenceRangeWidget *mRecurrenceRangeWidget;
263}; 263};
264 264
265class KOEditorRecurrence : public QWidget 265class 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 */
275 void setDefaults( QDateTime from, QDateTime to, bool allday );
276 /** Read event object and setup widgets accordingly */ 274 /** Read event object and setup widgets accordingly */
277 void readEvent( Incidence * ); 275 void readEvent( Incidence * );
278 /** Write event settings to event object */ 276 /** Write event settings to event object */
279 void writeEvent( Incidence * ); 277 void writeEvent( Incidence * );
280 278
281 /** Check if the input is valid. */ 279 /** Check if the input is valid. */
282 bool validateInput(); 280 bool validateInput();
283 281
284 public slots: 282 public slots:
283 void setDefaultsDates( QDateTime from, QDateTime to );
284 void setDefaults( QDateTime from, QDateTime to );
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
292 protected slots: 292 protected slots:
293 void showCurrentRule( int ); 293 void showCurrentRule( int );
294 void showExceptionsDialog(); 294 void showExceptionsDialog();
295 void showRecurrenceRangeDialog(); 295 void showRecurrenceRangeDialog();
296 296
297 private: 297 private:
298 QCheckBox *mEnabledCheck; 298 QCheckBox *mEnabledCheck;
299 299
300 QGroupBox *mTimeGroupBox; 300 QGroupBox *mTimeGroupBox;
301 QLabel *mDateTimeLabel; 301 QLabel *mDateTimeLabel;
302 302
303 QGroupBox *mRuleBox; 303 QGroupBox *mRuleBox;
304 QWidgetStack *mRuleStack; 304 QWidgetStack *mRuleStack;
305 RecurrenceChooser *mRecurrenceChooser; 305 RecurrenceChooser *mRecurrenceChooser;
306 306
307 RecurDaily *mDaily; 307 RecurDaily *mDaily;
308 RecurWeekly *mWeekly; 308 RecurWeekly *mWeekly;
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 02d4a78..75dae34 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -51,49 +51,49 @@ extern int globalFlagBlockAgenda;
51 51
52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : 52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) :
53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) 53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent )
54{ 54{
55 mEvent = 0; 55 mEvent = 0;
56 init(); 56 init();
57 if ( QApplication::desktop()->height() <= 240 ) 57 if ( QApplication::desktop()->height() <= 240 )
58 hideButtons(); 58 hideButtons();
59} 59}
60 60
61KOEventEditor::~KOEventEditor() 61KOEventEditor::~KOEventEditor()
62{ 62{
63 //emit dialogClose( mEvent ); 63 //emit dialogClose( mEvent );
64} 64}
65 65
66void KOEventEditor::init() 66void KOEventEditor::init()
67{ 67{
68 68
69 setupGeneral(); 69 setupGeneral();
70 setupAttendeesTab(); 70 setupAttendeesTab();
71 setupRecurrence(); 71 setupRecurrence();
72 72
73 // Propagate date time settings to recurrence tab 73 // Propagate date time settings to recurrence tab
74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
75 mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); 75 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), 76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
77 mRecurrence,SLOT(setDateTimeStr(const QString &))); 77 mRecurrence,SLOT(setDateTimeStr(const QString &)));
78 78
79 // Category dialog 79 // Category dialog
80 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 80 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
81 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), 81 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)),
82 // mGeneral,SLOT(setCategories(const QString &))); 82 // mGeneral,SLOT(setCategories(const QString &)));
83 83
84 84
85} 85}
86 86
87void KOEventEditor::reload() 87void KOEventEditor::reload()
88{ 88{
89 if ( mEvent ) readEvent( mEvent ); 89 if ( mEvent ) readEvent( mEvent );
90} 90}
91 91
92void KOEventEditor::setSecrecy( int sec ) 92void KOEventEditor::setSecrecy( int sec )
93{ 93{
94 mGeneral->setSecrecy( sec ); 94 mGeneral->setSecrecy( sec );
95} 95}
96void KOEventEditor::setCategories( QString s ) 96void KOEventEditor::setCategories( QString s )
97{ 97{
98 mGeneral->setCategories(s); 98 mGeneral->setCategories(s);
99 99
@@ -259,49 +259,49 @@ void KOEventEditor::deleteEvent()
259 emit eventToBeDeleted(mEvent); 259 emit eventToBeDeleted(mEvent);
260 emit dialogClose(mEvent); 260 emit dialogClose(mEvent);
261 mCalendar->deleteEvent(mEvent); 261 mCalendar->deleteEvent(mEvent);
262 emit eventDeleted(); 262 emit eventDeleted();
263 reject(); 263 reject();
264 break; 264 break;
265 } 265 }
266 } 266 }
267 else { 267 else {
268 emit eventToBeDeleted(mEvent); 268 emit eventToBeDeleted(mEvent);
269 emit dialogClose(mEvent); 269 emit dialogClose(mEvent);
270 mCalendar->deleteEvent(mEvent); 270 mCalendar->deleteEvent(mEvent);
271 emit eventDeleted(); 271 emit eventDeleted();
272 reject(); 272 reject();
273 } 273 }
274 } else { 274 } else {
275 reject(); 275 reject();
276 } 276 }
277} 277}
278 278
279void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) 279void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
280{ 280{
281 mGeneral->setDefaults(from,to,allDay); 281 mGeneral->setDefaults(from,to,allDay);
282 mDetails->setDefaults(); 282 mDetails->setDefaults();
283 mRecurrence->setDefaults(from,to,allDay); 283 mRecurrence->setDefaults(from,to);
284 showPage( 0 ); 284 showPage( 0 );
285 mGeneral->setFocusOn( 2 ); 285 mGeneral->setFocusOn( 2 );
286} 286}
287 287
288void KOEventEditor::readEvent( Event *event, bool tmpl ) 288void KOEventEditor::readEvent( Event *event, bool tmpl )
289{ 289{
290 mGeneral->readEvent( event, tmpl ); 290 mGeneral->readEvent( event, tmpl );
291 mDetails->readEvent( event ); 291 mDetails->readEvent( event );
292 mRecurrence->readEvent( event ); 292 mRecurrence->readEvent( event );
293 293
294 // categories 294 // categories
295 //mCategoryDialog->setSelected( event->categories() ); 295 //mCategoryDialog->setSelected( event->categories() );
296} 296}
297 297
298void KOEventEditor::writeEvent(Event *event) 298void KOEventEditor::writeEvent(Event *event)
299{ 299{
300 mGeneral->writeEvent( event ); 300 mGeneral->writeEvent( event );
301 mDetails->writeEvent( event ); 301 mDetails->writeEvent( event );
302 302
303 if ( event->organizer() == KOPrefs::instance()->email() ) { 303 if ( event->organizer() == KOPrefs::instance()->email() ) {
304 Event *ev = new Event( *event ); 304 Event *ev = new Event( *event );
305 ev->registerObserver(0); 305 ev->registerObserver(0);
306 mDetails->cancelAttendeeEvent( ev ); 306 mDetails->cancelAttendeeEvent( ev );
307 if ( ev->attendeeCount() > 0 ) { 307 if ( ev->attendeeCount() > 0 ) {
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 9073bca..8b90ae5 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -54,48 +54,50 @@ extern int globalFlagBlockAgenda;
54 54
55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
57{ 57{
58 mTodo = 0; 58 mTodo = 0;
59 mRelatedTodo = 0; 59 mRelatedTodo = 0;
60 findButton(User1)->hide(); 60 findButton(User1)->hide();
61 init(); 61 init();
62 if ( QApplication::desktop()->height() <= 240 ) 62 if ( QApplication::desktop()->height() <= 240 )
63 hideButtons(); 63 hideButtons();
64} 64}
65 65
66KOTodoEditor::~KOTodoEditor() 66KOTodoEditor::~KOTodoEditor()
67{ 67{
68 emit dialogClose( mTodo ); 68 emit dialogClose( mTodo );
69} 69}
70 70
71void KOTodoEditor::init() 71void KOTodoEditor::init()
72{ 72{
73 setupGeneral(); 73 setupGeneral();
74 setupAttendeesTab(); 74 setupAttendeesTab();
75 setupRecurrence(); 75 setupRecurrence();
76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); 77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
78 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
79 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
78} 80}
79void KOTodoEditor::setupRecurrence() 81void KOTodoEditor::setupRecurrence()
80{ 82{
81 QFrame *topFrame = addPage( i18n("Recurrence") ); 83 QFrame *topFrame = addPage( i18n("Recurrence") );
82 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 84 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
83 85
84 mRecurrence = new KOEditorRecurrence( topFrame ); 86 mRecurrence = new KOEditorRecurrence( topFrame );
85 topLayout->addWidget( mRecurrence ); 87 topLayout->addWidget( mRecurrence );
86} 88}
87 89
88void KOTodoEditor::setCategories( QString s ) 90void KOTodoEditor::setCategories( QString s )
89{ 91{
90 mGeneral->setCategories(s); 92 mGeneral->setCategories(s);
91} 93}
92void KOTodoEditor::setSecrecy( int sec ) 94void KOTodoEditor::setSecrecy( int sec )
93{ 95{
94 mGeneral->setSecrecy( sec ); 96 mGeneral->setSecrecy( sec );
95} 97}
96void KOTodoEditor::reload() 98void KOTodoEditor::reload()
97{ 99{
98 if ( mTodo ) readTodo( mTodo ); 100 if ( mTodo ) readTodo( mTodo );
99} 101}
100 102
101void KOTodoEditor::setupGeneral() 103void KOTodoEditor::setupGeneral()
@@ -284,74 +286,74 @@ void KOTodoEditor::deleteTodo()
284 } 286 }
285} 287}
286 288
287void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) 289void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
288{ 290{
289 mRelatedTodo = relatedEvent; 291 mRelatedTodo = relatedEvent;
290 292
291 mGeneral->setDefaults(due,allDay); 293 mGeneral->setDefaults(due,allDay);
292 mDetails->setDefaults(); 294 mDetails->setDefaults();
293 showPage( 0 ); 295 showPage( 0 );
294 if ( mRelatedTodo ) { 296 if ( mRelatedTodo ) {
295 mGeneral->setCategories (mRelatedTodo->categoriesStr ()); 297 mGeneral->setCategories (mRelatedTodo->categoriesStr ());
296 mGeneral->setSecrecy (mRelatedTodo->secrecy ()); 298 mGeneral->setSecrecy (mRelatedTodo->secrecy ());
297 if ( mRelatedTodo->priority() < 3 ) 299 if ( mRelatedTodo->priority() < 3 )
298 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); 300 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
299 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); 301 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
300 int len = mRelatedTodo->summary().length(); 302 int len = mRelatedTodo->summary().length();
301 mGeneral->mSummaryEdit->lineEdit()->setFocus(); 303 mGeneral->mSummaryEdit->lineEdit()->setFocus();
302 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); 304 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
303 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); 305 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
304 306
305 } else 307 } else
306 mGeneral->setFocusOn( 2 ); 308 mGeneral->setFocusOn( 2 );
307 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 309 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
308 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 310 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
309} 311}
310void KOTodoEditor::checkRecurrence() 312void KOTodoEditor::checkRecurrence()
311{ 313{
312 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 314 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
313 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); 315 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
314 316
315 if ( mTodo ) 317 if ( mTodo )
316 mRecurrence->readEvent( mTodo ); 318 mRecurrence->readEvent( mTodo );
317 else { 319 else {
318 bool time = mGeneral->mTimeButton->isChecked(); 320 bool time = mGeneral->mTimeButton->isChecked();
319 QDateTime from,to; 321 QDateTime from,to;
320 if ( time ) { 322 if ( time ) {
321 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; 323 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
322 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; 324 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
323 } else { 325 } else {
324 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; 326 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
325 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; 327 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
326 } 328 }
327 if ( to < from ) 329 if ( to < from )
328 to = from; 330 to = from;
329 mRecurrence->setDefaults(from,to,!time); 331 mRecurrence->setDefaults(from,to);
330 } 332 }
331 } else { 333 } else {
332 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 334 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
333 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 335 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
334 } 336 }
335} 337}
336void KOTodoEditor::readTodo(Todo *todo) 338void KOTodoEditor::readTodo(Todo *todo)
337{ 339{
338 mGeneral->readTodo(todo); 340 mGeneral->readTodo(todo);
339 mDetails->readEvent(todo); 341 mDetails->readEvent(todo);
340 mRelatedTodo = 0;//todo->relatedTo(); 342 mRelatedTodo = 0;//todo->relatedTo();
341 // categories 343 // categories
342 // mCategoryDialog->setSelected(todo->categories()); 344 // mCategoryDialog->setSelected(todo->categories());
343 345
344 // We should handle read-only events here. 346 // We should handle read-only events here.
345} 347}
346 348
347void KOTodoEditor::writeTodo(Todo *event) 349void KOTodoEditor::writeTodo(Todo *event)
348{ 350{
349 bool maybeComputeRecurrenceTime = false; 351 bool maybeComputeRecurrenceTime = false;
350 if( event->hasRecurrenceID() && event->percentComplete() < 100) 352 if( event->hasRecurrenceID() && event->percentComplete() < 100)
351 maybeComputeRecurrenceTime = true; 353 maybeComputeRecurrenceTime = true;
352 event->setHasRecurrenceID( false ); 354 event->setHasRecurrenceID( false );
353 mGeneral->writeTodo(event); 355 mGeneral->writeTodo(event);
354 mDetails->writeEvent(event); 356 mDetails->writeEvent(event);
355 357
356 // set related event, i.e. parent to-do in this case. 358 // set related event, i.e. parent to-do in this case.
357 if (mRelatedTodo) { 359 if (mRelatedTodo) {