summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
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
@@ -84,8 +84,9 @@ class KOEditorGeneral : public QObject
void slotSetFocusOn();
signals:
void openCategoryDialog();
void allAccepted();
+ void dateTimesChanged(QDateTime,QDateTime);
protected:
int mNextFocus;
//QLineEdit *mSummaryEdit;
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index af97ee9..3dd7f5c 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -236,9 +236,9 @@ void KOEditorGeneralEvent::startDateChanged(QDate newdate)
// adjust end date so that the event has the same duration as before
mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
mEndDateEdit->setDate(mCurrEndDateTime.date());
-
+ qDebug("KOEditorGeneralEvent::startDateChanged ");
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
void KOEditorGeneralEvent::endDateChanged(QDate newdate)
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 9649806..d798905 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -86,9 +86,8 @@ class KOEditorGeneralEvent : public KOEditorGeneral
void sTimeChanged(QTime);
void eTimeChanged(QTime);
signals:
- void dateTimesChanged(QDateTime start,QDateTime end);
void allDayChanged(bool);
void dateTimeStrChanged(const QString &);
private:
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index e86b4d0..0a734ee 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -126,9 +126,10 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
-
+ connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
+ this, SLOT(startDateChanged(QDate)));
// some more layouting
//layoutTimeBox->setColStretch(3,1);
}
@@ -394,9 +395,13 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable )
mStartTimeEdit->setEnabled( false );
}
emit datesChecked();
}
-
+void KOEditorGeneralTodo::startDateChanged(QDate newdate)
+{
+ if ( mDueCheck->isChecked() )
+ emit dateTimesChanged(newdate,mDueDateEdit->date());
+}
void KOEditorGeneralTodo::enableTimeEdits(bool enable)
{
if(mStartCheck->isChecked()) {
mStartTimeEdit->setEnabled( enable );
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index b198539..2e56a7a 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -74,8 +74,9 @@ class KOEditorGeneralTodo : public KOEditorGeneral
void openCategoryDialog();
void datesChecked();
protected slots:
+ void startDateChanged(QDate newdate);
void completedChanged(int);
void enableDueEdit( bool enable );
void enableStartEdit( bool enable );
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index dea8981..de4e4f7 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -834,14 +834,34 @@ void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end )
mRecurrenceRange->setDateTimes( start, end );
mExceptions->setDefaults( end );
}
+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 );
-void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
+ 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 )
{
// qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() );
- setDateTimes( from, to );
+ //setDateTimes( from, to );
bool enabled = false;
mEnabledCheck->setChecked( enabled );
setEnabled( enabled );
@@ -852,20 +872,12 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
mRecurrenceChooser->setType( RecurrenceChooser::Weekly );
showCurrentRule( mRecurrenceChooser->type() );
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 );
}
void KOEditorRecurrence::readEvent(Incidence *event)
{
@@ -875,9 +887,9 @@ void KOEditorRecurrence::readEvent(Incidence *event)
dtEnd = ((Event*)event)->dtEnd();
else
dtEnd = ((Todo*)event)->dtDue();
- setDefaults( event->dtStart(), dtEnd, true );
+ setDefaults( event->dtStart(), dtEnd );
QBitArray rDays( 7 );
QPtrList<Recurrence::rMonthPos> rmp;
QPtrList<int> rmd;
int day = 0;
@@ -896,9 +908,9 @@ void KOEditorRecurrence::readEvent(Incidence *event)
int recurrenceType = RecurrenceChooser::Weekly;
switch ( recurs ) {
case Recurrence::rNone:
- setDefaults( event->dtStart(), dtEnd, true );
+ setDefaults( event->dtStart(), dtEnd );
break;
case Recurrence::rDaily:
recurrenceType = RecurrenceChooser::Daily;
mDaily->setFrequency( f );
@@ -968,9 +980,9 @@ void KOEditorRecurrence::readEvent(Incidence *event)
mYearly->setByDay( event->dtStart().date().dayOfYear() );
mYearly->setFrequency( f );
break;
default:
- setDefaults( event->dtStart(), dtEnd, true );
+ setDefaults( event->dtStart(), dtEnd );
break;
}
mRecurrenceChooser->setType( recurrenceType );
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index a15afcb..f398f62 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -270,10 +270,8 @@ class KOEditorRecurrence : public QWidget
virtual ~KOEditorRecurrence();
enum { Daily, Weekly, Monthly, Yearly };
- /** Set widgets to default values */
- void setDefaults( QDateTime from, QDateTime to, bool allday );
/** Read event object and setup widgets accordingly */
void readEvent( Incidence * );
/** Write event settings to event object */
void writeEvent( Incidence * );
@@ -281,8 +279,10 @@ class KOEditorRecurrence : public QWidget
/** Check if the input is valid. */
bool validateInput();
public slots:
+ void setDefaultsDates( QDateTime from, QDateTime to );
+ void setDefaults( QDateTime from, QDateTime to );
void setEnabled( bool );
void setDateTimes( QDateTime start, QDateTime end );
void setDateTimeStr( const QString & );
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 02d4a78..75dae34 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -71,9 +71,9 @@ void KOEventEditor::init()
setupRecurrence();
// Propagate date time settings to recurrence tab
connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
- mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime)));
+ mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
mRecurrence,SLOT(setDateTimeStr(const QString &)));
// Category dialog
@@ -279,9 +279,9 @@ void KOEventEditor::deleteEvent()
void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
{
mGeneral->setDefaults(from,to,allDay);
mDetails->setDefaults();
- mRecurrence->setDefaults(from,to,allDay);
+ mRecurrence->setDefaults(from,to);
showPage( 0 );
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
@@ -74,8 +74,10 @@ void KOTodoEditor::init()
setupAttendeesTab();
setupRecurrence();
connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
+ connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
+ mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
}
void KOTodoEditor::setupRecurrence()
{
QFrame *topFrame = addPage( i18n("Recurrence") );
@@ -304,9 +306,9 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
} else
mGeneral->setFocusOn( 2 );
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
- mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
}
void KOTodoEditor::checkRecurrence()
{
if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
@@ -325,13 +327,13 @@ void KOTodoEditor::checkRecurrence()
from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
}
if ( to < from )
to = from;
- mRecurrence->setDefaults(from,to,!time);
+ mRecurrence->setDefaults(from,to);
}
} else {
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
- mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
}
}
void KOTodoEditor::readTodo(Todo *todo)
{