summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-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.cpp40
-rw-r--r--korganizer/koeditorrecurrence.h4
-rw-r--r--korganizer/koeventeditor.cpp4
-rw-r--r--korganizer/kotodoeditor.cpp8
9 files changed, 45 insertions, 25 deletions
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index 2069e9c..a8f6443 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -86,4 +86,5 @@ class KOEditorGeneral : public QObject
86 void openCategoryDialog(); 86 void openCategoryDialog();
87 void allAccepted(); 87 void allAccepted();
88 void dateTimesChanged(QDateTime,QDateTime);
88 89
89 protected: 90 protected:
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index af97ee9..3dd7f5c 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -238,5 +238,5 @@ void KOEditorGeneralEvent::startDateChanged(QDate newdate)
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}
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 9649806..d798905 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -88,5 +88,4 @@ class KOEditorGeneralEvent : public KOEditorGeneral
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 &);
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index e86b4d0..0a734ee 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -128,5 +128,6 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
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);
@@ -396,5 +397,9 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable )
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{
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index b198539..2e56a7a 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -76,4 +76,5 @@ class KOEditorGeneralTodo : public KOEditorGeneral
76 76
77 protected slots: 77 protected slots:
78 void startDateChanged(QDate newdate);
78 void completedChanged(int); 79 void completedChanged(int);
79 80
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index dea8981..de4e4f7 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -836,10 +836,30 @@ void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end )
836 836
837} 837}
838void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to )
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 );
838 851
839void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) 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;
@@ -854,16 +874,8 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
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
@@ -877,5 +889,5 @@ void KOEditorRecurrence::readEvent(Incidence *event)
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;
@@ -898,5 +910,5 @@ void KOEditorRecurrence::readEvent(Incidence *event)
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:
@@ -970,5 +982,5 @@ void KOEditorRecurrence::readEvent(Incidence *event)
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 }
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index a15afcb..f398f62 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -272,6 +272,4 @@ class KOEditorRecurrence : public QWidget
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 * );
@@ -283,4 +281,6 @@ class KOEditorRecurrence : public QWidget
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 );
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 02d4a78..75dae34 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -73,5 +73,5 @@ void KOEventEditor::init()
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 &)));
@@ -281,5 +281,5 @@ void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
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 );
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 9073bca..8b90ae5 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -76,4 +76,6 @@ void KOTodoEditor::init()
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()
@@ -306,5 +308,5 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
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()
@@ -327,9 +329,9 @@ void KOTodoEditor::checkRecurrence()
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}