summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-14 20:32:31 (UTC)
committer zautrix <zautrix>2005-04-14 20:32:31 (UTC)
commit7e87a287a0860882af27e26288bc9cc553dd3a0b (patch) (side-by-side diff)
treea55374f708a8c27da182bcd8d975ad3f20f39057 /korganizer
parent2a449f785f955649df9de639d38dcb250fe1376d (diff)
downloadkdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.zip
kdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.tar.gz
kdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.tar.bz2
fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneralevent.cpp26
-rw-r--r--korganizer/koeditorgeneralevent.h2
-rw-r--r--korganizer/koeventviewerdialog.cpp7
3 files changed, 19 insertions, 16 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 3b2a276..af97ee9 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -129,35 +129,34 @@ void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
//}
flagsBox->setStretchFactor(mDurationLabel, 10 );
mDurationLabel->setAlignment( AlignRight | AlignVCenter);
layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 );
// 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"));
classLayout->addWidget(mFreeTimeCombo);
}
void KOEditorGeneralEvent::timeStuffDisable(bool disable)
@@ -183,54 +182,61 @@ void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
mStartDateEdit->setDate(start.date());
// KTimeEdit seems to emit some signals when setTime() is called.
mStartTimeEdit->blockSignals( true );
mStartTimeEdit->setTime(start.time());
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.
- mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
+ 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));
mEndDateEdit->setDate(mCurrEndDateTime.date());
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 0174788..9649806 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -70,32 +70,34 @@ class KOEditorGeneralEvent : public KOEditorGeneral
bool validateInput();
public slots:
void setDateTimes(QDateTime start, QDateTime end);
void setDuration();
protected slots:
void timeStuffDisable(bool disable);
void dontAssociateTime(bool noTime);
void startTimeChanged(QTime);
void startDateChanged(QDate);
void endTimeChanged(QTime);
void endDateChanged(QDate);
void emitDateTimeStr();
+ void sTimeChanged(QTime);
+ void eTimeChanged(QTime);
signals:
void dateTimesChanged(QDateTime start,QDateTime end);
void allDayChanged(bool);
void dateTimeStrChanged(const QString &);
private:
bool mTemplate;
QLabel *mStartDateLabel;
QLabel *mEndDateLabel;
KDateEdit *mStartDateEdit;
KDateEdit *mEndDateEdit;
KOTimeEdit *mStartTimeEdit;
KOTimeEdit *mEndTimeEdit;
QLabel *mDurationLabel;
QCheckBox *mNoTimeButton;
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index baa11b5..e5ff8af 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -203,36 +203,33 @@ void KOEventViewerDialog::setJournal(Journal *j)
void KOEventViewerDialog::addText(QString text)
{
mEventViewer->addText(text);
mEventViewer->setFocus();
//findButton( Close )->setFocus();
}
void KOEventViewerDialog::editIncidence()
{
sendSignalViewerClosed = false;
if ( mSyncMode ) {
mSyncResult = 2;
accept();
return;
}
if ( mIncidence ){
-#ifndef DESKTOP_VERSION
- //hide();
close();
-#endif
emit editIncidence( mIncidence );
}
}
void KOEventViewerDialog::showIncidence()
{
sendSignalViewerClosed = false;
if ( mSyncMode ) {
mSyncResult = 1;
accept();
return;
}
if ( mIncidence ){
QDate date;
if ( mIncidence->type() == "Todo" ) {
/*
@@ -241,35 +238,33 @@ void KOEventViewerDialog::showIncidence()
else {
globalFlagBlockAgenda = 2;
emit showAgendaView( false );
return;
}
*/
((Todo*)mIncidence)->setCompleted( true );
((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() );
emit todoCompleted(((Todo*)mIncidence));
} else {
date = mIncidence->dtStart().date();
globalFlagBlockAgenda = 1;
emit showAgendaView( false );
globalFlagBlockAgenda = 2;
emit jumpToTime( date );
}
-#ifndef DESKTOP_VERSION
- reject();
-#endif
+ close();
}
}
void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
{
switch ( e->key() ) {
case Qt::Key_A :
case Qt::Key_L :
showIncidence();
break;
case Qt::Key_E :
case Qt::Key_R :
editIncidence();
break;
case Qt::Key_C:
case Qt::Key_Escape: