diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-01 00:37:02 +0000 |
commit | cc29364f06178f8f6b457384f2ec37a042bd9d43 (patch) | |
tree | 7c77a3184c698bbf9d98cef09fb1ba8124daceba /korganizer/koeditorgeneralevent.cpp | |
parent | 4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff) | |
download | tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip |
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed
* Added journal read support to the CalDAV resource
* Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korganizer/koeditorgeneralevent.cpp')
-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 76 |
1 files changed, 50 insertions, 26 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index 24e8b4ca2..0411c2f8e 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp @@ -39,7 +39,6 @@ #include <kdebug.h> #include <kglobal.h> #include <klocale.h> -#include <kiconloader.h> #include <kmessagebox.h> #include <kfiledialog.h> #include <kstandarddirs.h> @@ -52,6 +51,7 @@ #include <libkdepim/kdateedit.h> #include "koprefs.h" +#include "koglobals.h" #include "koeditorgeneralevent.h" #include "koeditorgeneralevent.moc" @@ -78,18 +78,15 @@ void KOEditorGeneralEvent::finishSetup() TQWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); TQWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); TQWidget::setTabOrder( mEndTimeEdit, mAlldayEventCheckbox ); - TQWidget::setTabOrder( mAlldayEventCheckbox, mAlarmButton ); + TQWidget::setTabOrder( mAlldayEventCheckbox, mRecEditButton ); + TQWidget::setTabOrder( mRecEditButton, mAlarmButton ); TQWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); TQWidget::setTabOrder( mAlarmTimeEdit, mAlarmIncrCombo ); -// TQWidget::setTabOrder( mAlarmIncrCombo, mAlarmSoundButton ); - TQWidget::setTabOrder( mAlarmIncrCombo, mAlarmEditButton ); -// TQWidget::setTabOrder( mAlarmSoundButton, mAlarmProgramButton ); -// TQWidget::setTabOrder( mAlarmProgramButton, mFreeTimeCombo ); - TQWidget::setTabOrder( mAlarmEditButton, mFreeTimeCombo ); + TQWidget::setTabOrder( mAlarmIncrCombo, mAlarmAdvancedButton ); + TQWidget::setTabOrder( mAlarmAdvancedButton, mFreeTimeCombo ); TQWidget::setTabOrder( mFreeTimeCombo, mDescriptionEdit ); TQWidget::setTabOrder( mDescriptionEdit, mCategoriesButton ); TQWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); -// TQWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); mSummaryEdit->setFocus(); } @@ -121,7 +118,6 @@ void KOEditorGeneralEvent::initTime(TQWidget *parent,TQBoxLayout *topLayout) mStartTimeEdit = new KTimeEdit(timeBoxFrame); layoutTimeBox->addWidget(mStartTimeEdit,0,2); - mEndDateLabel = new TQLabel(i18n("&End:"),timeBoxFrame); layoutTimeBox->addWidget(mEndDateLabel,1,0); @@ -151,16 +147,19 @@ void KOEditorGeneralEvent::initTime(TQWidget *parent,TQBoxLayout *topLayout) connect(mEndDateEdit, TQT_SIGNAL(dateChanged(const TQDate&)), this, TQT_SLOT(endDateChanged(const TQDate&))); + TQLabel *label = new TQLabel( i18n( "Recurrence:" ), timeBoxFrame ); + layoutTimeBox->addWidget( label, 2, 0 ); TQBoxLayout *recLayout = new TQHBoxLayout(); layoutTimeBox->addMultiCellLayout( recLayout, 2, 2, 1, 4 ); - mRecurrenceSummary = new TQLabel( TQString(), timeBoxFrame ); - recLayout->addWidget( mRecurrenceSummary ); - TQPushButton *recEditButton = new TQPushButton( i18n("Edit..."), timeBoxFrame ); - recLayout->addWidget( recEditButton ); - connect( recEditButton, TQT_SIGNAL(clicked()), TQT_SIGNAL(editRecurrence()) ); + mRecEditButton = new TQPushButton( timeBoxFrame ); + mRecEditButton->setIconSet( KOGlobals::self()->smallIconSet( "recur", 16 ) ); + recLayout->addWidget( mRecEditButton ); + connect( mRecEditButton, TQT_SIGNAL(clicked()), TQT_SIGNAL(editRecurrence()) ); + mRecEditLabel = new TQLabel( TQString(), timeBoxFrame ); + recLayout->addWidget( mRecEditLabel ); recLayout->addStretch( 1 ); - TQLabel *label = new TQLabel( i18n("Reminder:"), timeBoxFrame ); + label = new TQLabel( i18n("Reminder:"), timeBoxFrame ); layoutTimeBox->addWidget( label, 3, 0 ); TQBoxLayout *alarmLineLayout = new TQHBoxLayout(); layoutTimeBox->addMultiCellLayout( alarmLineLayout, 3, 3, 1, 4 ); @@ -230,7 +229,6 @@ void KOEditorGeneralEvent::timeStuffDisable(bool disable) void KOEditorGeneralEvent::associateTime(bool time) { timeStuffDisable(time); - //if(alarmButton->isChecked()) alarmStuffDisable(noTime); allDayChanged(time); } @@ -317,7 +315,7 @@ void KOEditorGeneralEvent::setDefaults( const TQDateTime &from, setDateTimes(from,to); } -void KOEditorGeneralEvent::readEvent( Event *event, Calendar *calendar, bool tmpl ) +void KOEditorGeneralEvent::readEvent( Event *event, Calendar *calendar, const TQDate &date, bool tmpl ) { TQString tmpStr; @@ -325,8 +323,26 @@ void KOEditorGeneralEvent::readEvent( Event *event, Calendar *calendar, bool tmp timeStuffDisable(event->doesFloat()); if ( !tmpl ) { + TQDateTime startDT = event->dtStart(); + TQDateTime endDT = event->dtEnd(); + if ( event->doesRecur() && date.isValid() ) { + // Consider the active date when editing recurring Events. + TQDateTime kdt( date, TQTime( 0, 0, 0 ) ); + const int eventLength = startDT.daysTo( endDT ); + kdt = kdt.addSecs( -1 ); + startDT.setDate( event->recurrence()->getNextDateTime( kdt ).date() ); + if ( event->hasEndDate() ) { + endDT.setDate( startDT.addDays( eventLength ).date() ); + } else { + if ( event->hasDuration() ) { + endDT = startDT.addSecs( event->duration() ); + } else { + endDT = startDT; + } + } + } // the rest is for the events only - setDateTimes(event->dtStart(),event->dtEnd()); + setDateTimes( startDT, endDT ); } switch( event->transparency() ) { @@ -338,11 +354,13 @@ void KOEditorGeneralEvent::readEvent( Event *event, Calendar *calendar, bool tmp break; } - mRecurrenceSummary->setText( IncidenceFormatter::recurrenceString( event ) ); + updateRecurrenceSummary( event ); Attendee *me = event->attendeeByMails( KOPrefs::instance()->allEmails() ); - if ( me && (me->status() == Attendee::NeedsAction || me->status() == Attendee::Tentative || - me->status() == Attendee::InProcess) ) { + if ( event->attendeeCount() > 1 && + me && ( me->status() == Attendee::NeedsAction || + me->status() == Attendee::Tentative || + me->status() == Attendee::InProcess ) ) { mInvitationBar->show(); } else { mInvitationBar->hide(); @@ -509,16 +527,22 @@ bool KOEditorGeneralEvent::validateInput() endDt.setTime(mEndTimeEdit->getTime()); } - if (startDt > endDt) { - KMessageBox::sorry(0,i18n("The event ends before it starts.\n" - "Please correct dates and times.")); + if ( startDt > endDt ) { + KMessageBox::sorry( + 0, + i18n( "The event ends before it starts.\n" + "Please correct dates and times." ) ); return false; } return KOEditorGeneral::validateInput(); } -void KOEditorGeneralEvent::updateRecurrenceSummary(const TQString & summary) +void KOEditorGeneralEvent::updateRecurrenceSummary( Event *event ) { - mRecurrenceSummary->setText( summary ); + if ( event->doesRecur() ) { + mRecEditLabel->setText( IncidenceFormatter::recurrenceString( event ) ); + } else { + mRecEditLabel->setText( TQString() ); + } } |