-rw-r--r-- | korganizer/koeditorgeneral.h | 1 | ||||
-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneralevent.h | 1 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 9 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.h | 1 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 42 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.h | 4 | ||||
-rw-r--r-- | korganizer/koeventeditor.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 8 |
9 files changed, 46 insertions, 26 deletions
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index 2069e9c..a8f6443 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h @@ -87,2 +87,3 @@ class KOEditorGeneral : public QObject void allAccepted(); + void dateTimesChanged(QDateTime,QDateTime); diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index af97ee9..3dd7f5c 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp @@ -239,3 +239,3 @@ void KOEditorGeneralEvent::startDateChanged(QDate newdate) mEndDateEdit->setDate(mCurrEndDateTime.date()); - + qDebug("KOEditorGeneralEvent::startDateChanged "); emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h index 9649806..d798905 100644 --- a/korganizer/koeditorgeneralevent.h +++ b/korganizer/koeditorgeneralevent.h @@ -89,3 +89,2 @@ class KOEditorGeneralEvent : public KOEditorGeneral signals: - void dateTimesChanged(QDateTime start,QDateTime end); void allDayChanged(bool); diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index e86b4d0..0a734ee 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp @@ -129,3 +129,4 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); - + connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), + this, SLOT(startDateChanged(QDate))); // some more layouting @@ -397,3 +398,7 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable ) } - +void KOEditorGeneralTodo::startDateChanged(QDate newdate) +{ + if ( mDueCheck->isChecked() ) + emit dateTimesChanged(newdate,mDueDateEdit->date()); +} void KOEditorGeneralTodo::enableTimeEdits(bool enable) diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h index b198539..2e56a7a 100644 --- a/korganizer/koeditorgeneraltodo.h +++ b/korganizer/koeditorgeneraltodo.h @@ -77,2 +77,3 @@ class KOEditorGeneralTodo : public KOEditorGeneral protected slots: + void startDateChanged(QDate newdate); void completedChanged(int); diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index dea8981..de4e4f7 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp @@ -837,4 +837,24 @@ void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) } - -void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) +void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to ) +{ + setDateTimes( from, to ); + QBitArray days( 7 ); + days.fill( 0 ); + days.setBit( from.date().dayOfWeek()- 1); + mWeekly->setDays( days ); + bool byPos = mMonthly->byPos(); + if ( byPos ) + mMonthly->setByDay( from.date().day()-1 ); + mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); + if ( ! byPos) + mMonthly->setByDay( from.date().day()-1 ); + + bool byDay = mYearly->byDay(); + if ( ! byDay ) + mYearly->setByDay( from.date().dayOfYear() ); + mYearly->setByMonth( from.date().month(), from.date().day() ); + if ( byDay ) + mYearly->setByDay( from.date().dayOfYear() ); +} +void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to ) { @@ -842,3 +862,3 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); - setDateTimes( from, to ); + //setDateTimes( from, to ); @@ -855,14 +875,6 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) mDaily->setFrequency( 1 ); - mWeekly->setFrequency( 1 ); - QBitArray days( 7 ); - days.fill( 0 ); - days.setBit( from.date().dayOfWeek()- 1); - mWeekly->setDays( days ); mMonthly->setFrequency( 1 ); - mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); - mMonthly->setByDay( from.date().day()-1 ); mYearly->setFrequency( 1 ); - mYearly->setByDay( from.date().dayOfYear() ); - mYearly->setByMonth( from.date().month(), from.date().day() ); + setDefaultsDates( from, to ); } @@ -878,3 +890,3 @@ void KOEditorRecurrence::readEvent(Incidence *event) - setDefaults( event->dtStart(), dtEnd, true ); + setDefaults( event->dtStart(), dtEnd ); QBitArray rDays( 7 ); @@ -899,3 +911,3 @@ void KOEditorRecurrence::readEvent(Incidence *event) case Recurrence::rNone: - setDefaults( event->dtStart(), dtEnd, true ); + setDefaults( event->dtStart(), dtEnd ); break; @@ -971,3 +983,3 @@ void KOEditorRecurrence::readEvent(Incidence *event) default: - setDefaults( event->dtStart(), dtEnd, true ); + setDefaults( event->dtStart(), dtEnd ); break; diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h index a15afcb..f398f62 100644 --- a/korganizer/koeditorrecurrence.h +++ b/korganizer/koeditorrecurrence.h @@ -273,4 +273,2 @@ class KOEditorRecurrence : public QWidget - /** Set widgets to default values */ - void setDefaults( QDateTime from, QDateTime to, bool allday ); /** Read event object and setup widgets accordingly */ @@ -284,2 +282,4 @@ class KOEditorRecurrence : public QWidget public slots: + void setDefaultsDates( QDateTime from, QDateTime to ); + void setDefaults( QDateTime from, QDateTime to ); void setEnabled( bool ); diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index 02d4a78..75dae34 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp @@ -74,3 +74,3 @@ void KOEventEditor::init() connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), - mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); + mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), @@ -282,3 +282,3 @@ void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) mDetails->setDefaults(); - mRecurrence->setDefaults(from,to,allDay); + mRecurrence->setDefaults(from,to); showPage( 0 ); diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 9073bca..8b90ae5 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp @@ -77,2 +77,4 @@ void KOTodoEditor::init() mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); + connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), + mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); } @@ -307,3 +309,3 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); - mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); + mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); } @@ -328,3 +330,3 @@ void KOTodoEditor::checkRecurrence() to = from; - mRecurrence->setDefaults(from,to,!time); + mRecurrence->setDefaults(from,to); } @@ -332,3 +334,3 @@ void KOTodoEditor::checkRecurrence() tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); - mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); + mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); } |