summaryrefslogtreecommitdiffabout
path: root/korganizer/koeditorgeneralevent.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koeditorgeneralevent.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditorgeneralevent.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 3b2a276..af97ee9 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -133,27 +133,26 @@ void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
// time widgets are checked if they contain a valid time
connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)),
this, SLOT(startTimeChanged(QTime)));
connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)),
this, SLOT(endTimeChanged(QTime)));
// date widgets are checked if they contain a valid date
connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
this, SLOT(startDateChanged(QDate)));
connect(mEndDateEdit, SIGNAL(dateChanged(QDate)),
this, SLOT(endDateChanged(QDate)));
- connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
- connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),mEndTimeEdit,SLOT(setTime(QTime)));
-
+ connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime)));
+ connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime)));
}
void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout)
{
QBoxLayout *classLayout = new QHBoxLayout(topLayout);
QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent);
classLayout->addWidget(freeTimeLabel);
mFreeTimeCombo = new QComboBox(false, parent);
mFreeTimeCombo->insertItem(i18n("Busy"));
mFreeTimeCombo->insertItem(i18n("Free"));
@@ -187,46 +186,53 @@ void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
mStartTimeEdit->blockSignals( false );
if ( !mTemplate )
mEndDateEdit->setDate(end.date());
mEndTimeEdit->setTime(end.time());
mCurrStartDateTime = start;
mCurrEndDateTime = end;
setDuration();
emitDateTimeStr();
}
+void KOEditorGeneralEvent::sTimeChanged(QTime ti)
+{
+ mStartTimeEdit->setTime( ti );
+ startTimeChanged ( ti);
+}
+void KOEditorGeneralEvent::eTimeChanged(QTime ti )
+{
+ mEndTimeEdit->setTime( ti );
+ endTimeChanged( ti );
+}
void KOEditorGeneralEvent::startTimeChanged(QTime newtime)
{
- kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl;
int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime);
- mCurrStartDateTime.setTime(newtime);
-
+ mCurrStartDateTime = QDateTime( mStartDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0) );
// adjust end time so that the event has the same duration as before.
+ if( secsep > 0 )
mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
mEndTimeEdit->setTime(mCurrEndDateTime.time());
mEndDateEdit->setDate(mCurrEndDateTime.date());
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
void KOEditorGeneralEvent::endTimeChanged(QTime newtime)
{
-// kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl;
- QDateTime newdt(mCurrEndDateTime.date(), newtime);
- mCurrEndDateTime = newdt;
+ mCurrEndDateTime = QDateTime ( mEndDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0));
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
void KOEditorGeneralEvent::startDateChanged(QDate newdate)
{
int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime);
mCurrStartDateTime.setDate(newdate);
// adjust end date so that the event has the same duration as before
mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));