korganizer

koeditorgeneralevent.cpp

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #include <qtooltip.h>
00026 #include <qlayout.h>
00027 #include <qvbox.h>
00028 #include <qbuttongroup.h>
00029 #include <qvgroupbox.h>
00030 #include <qwidgetstack.h>
00031 #include <qspinbox.h>
00032 #include <qdatetime.h>
00033 #include <qlabel.h>
00034 #include <qcheckbox.h>
00035 #include <qcombobox.h>
00036 #include <qpushbutton.h>
00037 #include <qwhatsthis.h>
00038 
00039 #include <kdebug.h>
00040 #include <kglobal.h>
00041 #include <klocale.h>
00042 #include <kmessagebox.h>
00043 #include <kfiledialog.h>
00044 #include <kstandarddirs.h>
00045 #include <ktextedit.h>
00046 
00047 #include <libkcal/event.h>
00048 #include <libkcal/incidenceformatter.h>
00049 
00050 #include "ktimeedit.h"
00051 #include <libkdepim/kdateedit.h>
00052 
00053 #include "koprefs.h"
00054 #include "koglobals.h"
00055 
00056 #include "koeditorgeneralevent.h"
00057 #include "koeditorgeneralevent.moc"
00058 
00059 KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent,
00060                                            const char* name) :
00061   KOEditorGeneral( parent, name)
00062 {
00063   connect( this, SIGNAL( dateTimesChanged( const QDateTime &, const QDateTime & )),
00064            SLOT( setDuration() ) );
00065   connect( this, SIGNAL( dateTimesChanged( const QDateTime &, const QDateTime & )),
00066            SLOT( emitDateTimeStr() ));
00067 }
00068 
00069 KOEditorGeneralEvent::~KOEditorGeneralEvent()
00070 {
00071 }
00072 
00073 void KOEditorGeneralEvent::finishSetup()
00074 {
00075   QWidget::setTabOrder( mSummaryEdit, mLocationEdit );
00076   QWidget::setTabOrder( mLocationEdit, mStartDateEdit );
00077   QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit );
00078   QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit );
00079   QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit );
00080   QWidget::setTabOrder( mEndTimeEdit, mAlldayEventCheckbox );
00081   QWidget::setTabOrder( mAlldayEventCheckbox, mRecEditButton );
00082   QWidget::setTabOrder( mRecEditButton, mAlarmButton );
00083   QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit );
00084   QWidget::setTabOrder( mAlarmTimeEdit, mAlarmIncrCombo );
00085   QWidget::setTabOrder( mAlarmIncrCombo, mAlarmAdvancedButton );
00086   QWidget::setTabOrder( mAlarmAdvancedButton, mFreeTimeCombo );
00087   QWidget::setTabOrder( mFreeTimeCombo, mDescriptionEdit );
00088   QWidget::setTabOrder( mDescriptionEdit, mCategoriesButton );
00089   QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo );
00090 
00091   mSummaryEdit->setFocus();
00092 }
00093 
00094 void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
00095 {
00096   QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
00097 
00098   QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
00099                                           i18n("Date && Time"),parent);
00100   QWhatsThis::add( timeGroupBox,
00101        i18n("Sets options related to the date and time of the "
00102             "event or to-do.") );
00103   timeLayout->addWidget(timeGroupBox);
00104 
00105   QFrame *timeBoxFrame = new QFrame(timeGroupBox);
00106 
00107   QGridLayout *layoutTimeBox = new QGridLayout( timeBoxFrame );
00108   layoutTimeBox->setSpacing(topLayout->spacing());
00109   layoutTimeBox->setColStretch( 3, 1 );
00110 
00111   mStartDateLabel = new QLabel(i18n("&Start:"),timeBoxFrame);
00112   layoutTimeBox->addWidget(mStartDateLabel,0,0);
00113 
00114   mStartDateEdit = new KDateEdit(timeBoxFrame);
00115   layoutTimeBox->addWidget(mStartDateEdit,0,1);
00116   mStartDateLabel->setBuddy( mStartDateEdit );
00117 
00118   mStartTimeEdit = new KTimeEdit(timeBoxFrame);
00119   layoutTimeBox->addWidget(mStartTimeEdit,0,2);
00120 
00121   mEndDateLabel = new QLabel(i18n("&End:"),timeBoxFrame);
00122   layoutTimeBox->addWidget(mEndDateLabel,1,0);
00123 
00124   mEndDateEdit = new KDateEdit(timeBoxFrame);
00125   layoutTimeBox->addWidget(mEndDateEdit,1,1);
00126   mEndDateLabel->setBuddy( mEndDateEdit );
00127 
00128   mEndTimeEdit = new KTimeEdit(timeBoxFrame);
00129   layoutTimeBox->addWidget(mEndTimeEdit,1,2);
00130 
00131   mAlldayEventCheckbox = new QCheckBox(i18n("All-&day"),timeBoxFrame);
00132   layoutTimeBox->addWidget( mAlldayEventCheckbox, 0, 3 );
00133   connect(mAlldayEventCheckbox, SIGNAL(toggled(bool)),SLOT(associateTime(bool)));
00134 
00135   mDurationLabel = new QLabel( timeBoxFrame );
00136   layoutTimeBox->addWidget( mDurationLabel, 1, 3 );
00137 
00138   // time widgets are checked if they contain a valid time
00139   connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)),
00140           this, SLOT(startTimeChanged(QTime)));
00141   connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)),
00142           this, SLOT(endTimeChanged(QTime)));
00143 
00144   // date widgets are checked if they contain a valid date
00145   connect(mStartDateEdit, SIGNAL(dateChanged(const QDate&)),
00146           this, SLOT(startDateChanged(const QDate&)));
00147   connect(mEndDateEdit, SIGNAL(dateChanged(const QDate&)),
00148           this, SLOT(endDateChanged(const QDate&)));
00149 
00150   QLabel *label = new QLabel( i18n( "Recurrence:" ), timeBoxFrame );
00151   layoutTimeBox->addWidget( label, 2, 0 );
00152   QBoxLayout *recLayout = new QHBoxLayout();
00153   layoutTimeBox->addMultiCellLayout( recLayout, 2, 2, 1, 4 );
00154   mRecEditButton = new QPushButton( timeBoxFrame );
00155   mRecEditButton->setIconSet( KOGlobals::self()->smallIconSet( "recur", 16 ) );
00156   recLayout->addWidget( mRecEditButton );
00157   connect( mRecEditButton, SIGNAL(clicked()), SIGNAL(editRecurrence()) );
00158   mRecEditLabel = new QLabel( QString(), timeBoxFrame );
00159   recLayout->addWidget( mRecEditLabel );
00160   recLayout->addStretch( 1 );
00161 
00162   label = new QLabel( i18n("Reminder:"), timeBoxFrame );
00163   layoutTimeBox->addWidget( label, 3, 0 );
00164   QBoxLayout *alarmLineLayout = new QHBoxLayout();
00165   layoutTimeBox->addMultiCellLayout( alarmLineLayout, 3, 3, 1, 4 );
00166   initAlarm( timeBoxFrame, alarmLineLayout );
00167   alarmLineLayout->addStretch( 1 );
00168 
00169   QBoxLayout *secLayout = new QHBoxLayout();
00170   layoutTimeBox->addLayout( secLayout, 0, 4 );
00171   initSecrecy( timeBoxFrame, secLayout );
00172 
00173   QBoxLayout *classLayout = new QHBoxLayout();
00174   layoutTimeBox->addLayout( classLayout, 1, 4 );
00175   initClass( timeBoxFrame, classLayout );
00176 }
00177 
00178 void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout)
00179 {
00180   QBoxLayout *classLayout = new QHBoxLayout(topLayout);
00181 
00182   QLabel *freeTimeLabel = new QLabel(i18n("S&how time as:"),parent);
00183   QString whatsThis = i18n("Sets how this time will appear on your Free/Busy "
00184                            "information.");
00185   QWhatsThis::add( freeTimeLabel, whatsThis );
00186   classLayout->addWidget(freeTimeLabel);
00187 
00188   mFreeTimeCombo = new QComboBox(false, parent);
00189   QWhatsThis::add( mFreeTimeCombo, whatsThis );
00190   mFreeTimeCombo->insertItem(i18n("Busy"));
00191   mFreeTimeCombo->insertItem(i18n("Free"));
00192   classLayout->addWidget(mFreeTimeCombo);
00193   freeTimeLabel->setBuddy( mFreeTimeCombo );
00194 }
00195 
00196 void KOEditorGeneralEvent::initInvitationBar(QWidget * parent, QBoxLayout * layout)
00197 {
00198   QBoxLayout *topLayout = new QHBoxLayout( layout );
00199   mInvitationBar = new QFrame( parent );
00200   mInvitationBar->setFrameStyle( QFrame::NoFrame );
00201   topLayout->addWidget( mInvitationBar );
00202 
00203   QBoxLayout *barLayout = new QHBoxLayout( mInvitationBar );
00204   barLayout->setSpacing( layout->spacing() );
00205   QLabel *label = new QLabel( i18n("You have not yet definitely responded to this invitation." ), mInvitationBar );
00206   label->setPalette( QToolTip::palette() );
00207   label->setFrameStyle( QFrame::Plain | QFrame::Box );
00208   label->setLineWidth( 1 );
00209   barLayout->addWidget( label );
00210   QPushButton *button = new QPushButton( i18n("Accept"), mInvitationBar );
00211   button->setPalette( QToolTip::palette() );
00212   QToolTip::add( button,
00213                  i18n( "Set your attendance status to Accept" ) );
00214   QWhatsThis::add( button,
00215                    i18n( "Click this button if you want to set your attendance status "
00216                          "for the invitation to Accept." ) );
00217   connect( button, SIGNAL(clicked()), SIGNAL(acceptInvitation()) );
00218   connect( button, SIGNAL(clicked()), mInvitationBar, SLOT(hide()) );
00219   barLayout->addWidget( button );
00220   button = new QPushButton( i18n("Decline"), mInvitationBar );
00221   button->setPalette( QToolTip::palette() );
00222   QToolTip::add( button,
00223                  i18n( "Set your attendance status to Decline" ) );
00224   QWhatsThis::add( button,
00225                    i18n( "Click this button if you want to set your attendance status "
00226                          "for the invitation to Decline." ) );
00227   connect( button, SIGNAL(clicked()), SIGNAL(declineInvitation()) );
00228   connect( button, SIGNAL(clicked()), mInvitationBar, SLOT(hide()) );
00229   barLayout->addWidget( button );
00230   barLayout->addItem( new QSpacerItem( 50, 1, QSizePolicy::Expanding ) );
00231 
00232   mInvitationBar->hide();
00233 }
00234 
00235 void KOEditorGeneralEvent::timeStuffDisable(bool disable)
00236 {
00237   mStartTimeEdit->setEnabled( !disable );
00238   mEndTimeEdit->setEnabled( !disable );
00239 
00240   setDuration();
00241   emitDateTimeStr();
00242 }
00243 
00244 void KOEditorGeneralEvent::associateTime(bool time)
00245 {
00246   timeStuffDisable(time);
00247   allDayChanged(time);
00248 }
00249 
00250 void KOEditorGeneralEvent::setDateTimes( const QDateTime &start, const QDateTime &end )
00251 {
00252 //  kdDebug(5850) << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl;
00253 
00254   mStartDateEdit->setDate(start.date());
00255   // KTimeEdit seems to emit some signals when setTime() is called.
00256   mStartTimeEdit->blockSignals( true );
00257   mStartTimeEdit->setTime(start.time());
00258   mStartTimeEdit->blockSignals( false );
00259   mEndDateEdit->setDate(end.date());
00260   mEndTimeEdit->setTime(end.time());
00261 
00262   mCurrStartDateTime = start;
00263   mCurrEndDateTime = end;
00264 
00265   setDuration();
00266   emitDateTimeStr();
00267 }
00268 
00269 void KOEditorGeneralEvent::startTimeChanged( QTime newtime )
00270 {
00271   kdDebug(5850) << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl;
00272 
00273   int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime);
00274 
00275   mCurrStartDateTime.setTime(newtime);
00276 
00277   // adjust end time so that the event has the same duration as before.
00278   mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
00279   mEndTimeEdit->setTime(mCurrEndDateTime.time());
00280   mEndDateEdit->setDate(mCurrEndDateTime.date());
00281 
00282   emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
00283 }
00284 
00285 void KOEditorGeneralEvent::endTimeChanged( QTime newtime )
00286 {
00287 //  kdDebug(5850) << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl;
00288 
00289   QDateTime newdt(mCurrEndDateTime.date(), newtime);
00290   mCurrEndDateTime = newdt;
00291 
00292   emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
00293 }
00294 
00295 void KOEditorGeneralEvent::startDateChanged( const QDate &newdate )
00296 {
00297   if ( !newdate.isValid() )
00298     return;
00299 
00300   int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime);
00301 
00302   mCurrStartDateTime.setDate(newdate);
00303 
00304   // adjust end date so that the event has the same duration as before
00305   mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
00306   mEndDateEdit->setDate(mCurrEndDateTime.date());
00307 
00308   emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
00309 }
00310 
00311 void KOEditorGeneralEvent::endDateChanged( const QDate &newdate )
00312 {
00313   if ( !newdate.isValid() )
00314     return;
00315 
00316   QDateTime newdt(newdate, mCurrEndDateTime.time());
00317   mCurrEndDateTime = newdt;
00318 
00319   emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
00320 }
00321 
00322 void KOEditorGeneralEvent::setDefaults( const QDateTime &from,
00323                                         const QDateTime &to, bool allDay)
00324 {
00325   KOEditorGeneral::setDefaults(allDay);
00326 
00327   mAlldayEventCheckbox->setChecked(allDay);
00328   timeStuffDisable(allDay);
00329 
00330   setDateTimes(from,to);
00331 }
00332 
00333 void KOEditorGeneralEvent::readEvent( Event *event, Calendar *calendar, const QDate &date, bool tmpl )
00334 {
00335   QString tmpStr;
00336 
00337   mAlldayEventCheckbox->setChecked(event->doesFloat());
00338   timeStuffDisable(event->doesFloat());
00339 
00340   if ( !tmpl ) {
00341     QDateTime startDT = event->dtStart();
00342     QDateTime endDT = event->dtEnd();
00343     if ( event->doesRecur() && date.isValid() ) {
00344       // Consider the active date when editing recurring Events.
00345       QDateTime kdt( date, QTime( 0, 0, 0 ) );
00346       const int eventLength = startDT.daysTo( endDT );
00347       kdt = kdt.addSecs( -1 );
00348       startDT.setDate( event->recurrence()->getNextDateTime( kdt ).date() );
00349       if ( event->hasEndDate() ) {
00350         endDT.setDate( startDT.addDays( eventLength ).date() );
00351       } else {
00352         if ( event->hasDuration() ) {
00353           endDT = startDT.addSecs( event->duration() );
00354         } else {
00355           endDT = startDT;
00356         }
00357       }
00358     }
00359     // the rest is for the events only
00360     if ( event->doesFloat() ) {
00361       endDT.setTime(QTime(23,59,59));
00362     }
00363     setDateTimes( startDT, endDT );
00364   }
00365 
00366   switch( event->transparency() ) {
00367   case Event::Transparent:
00368     mFreeTimeCombo->setCurrentItem(1);
00369     break;
00370   case Event::Opaque:
00371     mFreeTimeCombo->setCurrentItem(0);
00372     break;
00373   }
00374 
00375   updateRecurrenceSummary( event );
00376 
00377   Attendee *me = event->attendeeByMails( KOPrefs::instance()->allEmails() );
00378   if ( !KOPrefs::instance()->thatIsMe( event->organizer().email() ) &&
00379        event->attendeeCount() > 1 &&
00380        me &&
00381        ( me->status() == Attendee::NeedsAction ||
00382          me->status() == Attendee::Tentative ||
00383          me->status() == Attendee::InProcess ) ) {
00384     mInvitationBar->show();
00385   } else {
00386     mInvitationBar->hide();
00387   }
00388 
00389   readIncidence(event, calendar);
00390 }
00391 
00392 void KOEditorGeneralEvent::writeEvent(Event *event)
00393 {
00394 //  kdDebug(5850) << "KOEditorGeneralEvent::writeEvent()" << endl;
00395 
00396   writeIncidence(event);
00397 
00398   QDate tmpDate;
00399   QTime tmpTime;
00400   QDateTime tmpDT;
00401 
00402   // temp. until something better happens.
00403   QString tmpStr;
00404 
00405   if (mAlldayEventCheckbox->isChecked()) {
00406     event->setFloats(true);
00407     // need to change this.
00408     tmpDate = mStartDateEdit->date();
00409     tmpTime.setHMS(0,0,0);
00410     tmpDT.setDate(tmpDate);
00411     tmpDT.setTime(tmpTime);
00412     event->setDtStart(tmpDT);
00413 
00414     tmpDate = mEndDateEdit->date();
00415     tmpTime.setHMS(0,0,0);
00416     tmpDT.setDate(tmpDate);
00417     tmpDT.setTime(tmpTime);
00418     event->setDtEnd(tmpDT);
00419   } else {
00420     event->setFloats(false);
00421 
00422     // set date/time end
00423     tmpDate = mEndDateEdit->date();
00424     tmpTime = mEndTimeEdit->getTime();
00425     tmpDT.setDate(tmpDate);
00426     tmpDT.setTime(tmpTime);
00427     event->setDtEnd(tmpDT);
00428 
00429     // set date/time start
00430     tmpDate = mStartDateEdit->date();
00431     tmpTime = mStartTimeEdit->getTime();
00432     tmpDT.setDate(tmpDate);
00433     tmpDT.setTime(tmpTime);
00434     event->setDtStart(tmpDT);
00435   } // check for float
00436 
00437   event->setTransparency(mFreeTimeCombo->currentItem() > 0
00438                          ? KCal::Event::Transparent
00439                          : KCal::Event::Opaque);
00440 
00441 //  kdDebug(5850) << "KOEditorGeneralEvent::writeEvent() done" << endl;
00442 }
00443 
00444 void KOEditorGeneralEvent::setDuration()
00445 {
00446   QString tmpStr, catStr;
00447   int hourdiff, minutediff;
00448   // end<date is an accepted temporary state while typing, but don't show
00449   // any duration if this happens
00450   if(mCurrEndDateTime >= mCurrStartDateTime) {
00451 
00452     if (mAlldayEventCheckbox->isChecked()) {
00453       int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1;
00454       tmpStr = i18n("Duration: ");
00455       tmpStr.append(i18n("1 Day","%n Days",daydiff));
00456     } else {
00457       hourdiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) * 24;
00458       hourdiff += mCurrEndDateTime.time().hour() -
00459                   mCurrStartDateTime.time().hour();
00460       minutediff = mCurrEndDateTime.time().minute() -
00461                    mCurrStartDateTime.time().minute();
00462       // If minutediff is negative, "borrow" 60 minutes from hourdiff
00463       if (minutediff < 0 && hourdiff > 0) {
00464         hourdiff -= 1;
00465         minutediff += 60;
00466       }
00467       if (hourdiff || minutediff){
00468         tmpStr = i18n("Duration: ");
00469         if (hourdiff){
00470           catStr = i18n("1 hour","%n hours",hourdiff);
00471           tmpStr.append(catStr);
00472         }
00473         if (hourdiff && minutediff){
00474           tmpStr += i18n(", ");
00475         }
00476         if (minutediff){
00477           catStr = i18n("1 minute","%n minutes",minutediff);
00478           tmpStr += catStr;
00479         }
00480       } else tmpStr = "";
00481     }
00482   }
00483   mDurationLabel->setText(tmpStr);
00484   QWhatsThis::add( mDurationLabel,
00485        i18n("Shows the duration of the event or to-do with the "
00486       "current start and end dates and times.") );
00487 }
00488 
00489 void KOEditorGeneralEvent::emitDateTimeStr()
00490 {
00491   KLocale *l = KGlobal::locale();
00492 
00493   QString from,to;
00494   if (mAlldayEventCheckbox->isChecked()) {
00495     from = l->formatDate(mCurrStartDateTime.date());
00496     to = l->formatDate(mCurrEndDateTime.date());
00497   } else {
00498     from = l->formatDateTime(mCurrStartDateTime);
00499     to = l->formatDateTime(mCurrEndDateTime);
00500   }
00501 
00502   QString str = i18n("From: %1   To: %2   %3").arg(from).arg(to)
00503                 .arg(mDurationLabel->text());
00504 
00505   emit dateTimeStrChanged(str);
00506 }
00507 
00508 bool KOEditorGeneralEvent::validateInput()
00509 {
00510 //  kdDebug(5850) << "KOEditorGeneralEvent::validateInput()" << endl;
00511 
00512   if (!mAlldayEventCheckbox->isChecked()) {
00513     if (!mStartTimeEdit->inputIsValid()) {
00514       KMessageBox::sorry( 0,
00515           i18n("Please specify a valid start time, for example '%1'.")
00516           .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) );
00517       return false;
00518     }
00519 
00520     if (!mEndTimeEdit->inputIsValid()) {
00521       KMessageBox::sorry( 0,
00522           i18n("Please specify a valid end time, for example '%1'.")
00523           .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) );
00524       return false;
00525     }
00526   }
00527 
00528   if (!mStartDateEdit->date().isValid()) {
00529     KMessageBox::sorry( 0,
00530         i18n("Please specify a valid start date, for example '%1'.")
00531         .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) );
00532     return false;
00533   }
00534 
00535   if (!mEndDateEdit->date().isValid()) {
00536     KMessageBox::sorry( 0,
00537         i18n("Please specify a valid end date, for example '%1'.")
00538         .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) );
00539     return false;
00540   }
00541 
00542   QDateTime startDt,endDt;
00543   startDt.setDate(mStartDateEdit->date());
00544   endDt.setDate(mEndDateEdit->date());
00545   if (!mAlldayEventCheckbox->isChecked()) {
00546     startDt.setTime(mStartTimeEdit->getTime());
00547     endDt.setTime(mEndTimeEdit->getTime());
00548   }
00549 
00550   if ( startDt > endDt ) {
00551     KMessageBox::sorry(
00552       0,
00553       i18n( "The event ends before it starts.\n"
00554             "Please correct dates and times." ) );
00555     return false;
00556   }
00557 
00558   return KOEditorGeneral::validateInput();
00559 }
00560 
00561 void KOEditorGeneralEvent::updateRecurrenceSummary( Event *event )
00562 {
00563   if ( event->doesRecur() ) {
00564     mRecEditLabel->setText( IncidenceFormatter::recurrenceString( event ) );
00565   } else {
00566     mRecEditLabel->setText( QString() );
00567   }
00568 }
KDE Home | KDE Accessibility Home | Description of Access Keys