summaryrefslogtreecommitdiffstats
path: root/korganizer/koeventeditor.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /korganizer/koeventeditor.cpp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-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/koeventeditor.cpp')
-rw-r--r--korganizer/koeventeditor.cpp95
1 files changed, 53 insertions, 42 deletions
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 5cc7041ee..8a8340fc0 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -41,7 +41,6 @@
#include "koprefs.h"
#include "koeditorgeneralevent.h"
-#include "koeditoralarms.h"
#include "koeditorrecurrence.h"
#include "koeditordetails.h"
#include "koeditorfreebusy.h"
@@ -66,7 +65,6 @@ KOEventEditor::~KOEventEditor()
void KOEventEditor::init()
{
setupGeneral();
-// setupAlarmsTab();
setupRecurrence();
setupFreeBusy();
setupDesignerTabs( "event" );
@@ -111,7 +109,9 @@ void KOEventEditor::reload()
{
kdDebug(5850) << "KOEventEditor::reload()" << endl;
- if ( mEvent ) readEvent( mEvent, mCalendar );
+ if ( mEvent ) {
+ readEvent( mEvent, mCalendar, TQDate() );
+ }
}
void KOEventEditor::setupGeneral()
@@ -129,9 +129,6 @@ void KOEventEditor::setupGeneral()
mGeneral->initHeader( topFrame, topLayout );
mGeneral->initTime(topFrame,topLayout);
-// TQBoxLayout *alarmLineLayout = new TQHBoxLayout(topLayout);
- mGeneral->initAlarm(topFrame,topLayout);
- mGeneral->enableAlarm( false );
topLayout->addStretch( 1 );
@@ -166,27 +163,15 @@ void KOEventEditor::setupGeneral()
mGeneral->finishSetup();
}
-void KOEventEditor::modified (int /*modification*/)
+void KOEventEditor::modified()
{
- // Play dump, just reload the event. This dialog has become so complicated
+ // Play dumb, just reload the event. This dialog has become so complicated
// that there is no point in trying to be smart here...
reload();
}
void KOEventEditor::setupRecurrence()
{
-#if 0
- TQFrame *topFrame = addPage( i18n("Rec&urrence") );
-
- TQWhatsThis::add( topFrame,
- i18n("The Recurrence tab allows you to set options on "
- "how often this event recurs.") );
-
- TQBoxLayout *topLayout = new TQVBoxLayout( topFrame );
-
- mRecurrence = new KOEditorRecurrence( topFrame );
- topLayout->addWidget( mRecurrence );
-#endif
mRecurrenceDialog = new KOEditorRecurrenceDialog( this );
mRecurrenceDialog->hide();
mRecurrence = mRecurrenceDialog->editor();
@@ -205,7 +190,9 @@ void KOEventEditor::setupFreeBusy()
topLayout->addWidget( mFreeBusy );
}
-void KOEventEditor::editIncidence( Incidence *incidence, Calendar *calendar )
+void KOEventEditor::editIncidence( Incidence *incidence,
+ const TQDate &date,
+ Calendar *calendar )
{
Event*event = dynamic_cast<Event*>(incidence);
if ( event ) {
@@ -213,7 +200,9 @@ void KOEventEditor::editIncidence( Incidence *incidence, Calendar *calendar )
mEvent = event;
mCalendar = calendar;
- readEvent( mEvent, mCalendar );
+
+ const TQDate &dt = mRecurIncidence && date.isValid() ? date : incidence->dtStart().date();
+ readEvent( mEvent, mCalendar, dt );
}
setCaption( i18n("Edit Event") );
@@ -263,9 +252,12 @@ void KOEventEditor::loadDefaults()
bool KOEventEditor::processInput()
{
- kdDebug(5850) << "KOEventEditor::processInput()" << endl;
+ kdDebug(5850) << "KOEventEditor::processInput(); event is " << mEvent << endl;
- if ( !validateInput() || !mChanger ) return false;
+ if ( !validateInput() || !mChanger ) {
+ kdDebug(5850) << " mChanger is " << mChanger << endl;
+ return false;
+ }
TQGuardedPtr<KOEditorFreeBusy> freeBusy( mFreeBusy );
@@ -280,11 +272,12 @@ bool KOEventEditor::processInput()
if( *event == *mEvent ) {
// Don't do anything
- kdDebug(5850) << "Event not changed\n";
- if ( mIsCounter )
+ kdDebug(5850) << "Event not changed" << endl;
+ if ( mIsCounter ) {
KMessageBox::information( this, i18n("You didn't change the event, thus no counter proposal has been sent to the organizer."), i18n("No changes") );
+ }
} else {
- kdDebug(5850) << "Event changed\n";
+ kdDebug(5850) << "Event changed" << endl;
//IncidenceChanger::assignIncidence( mEvent, event );
writeEvent( mEvent );
if ( mIsCounter ) {
@@ -293,9 +286,17 @@ bool KOEventEditor::processInput()
Event *event = mEvent->clone();
event->clearAttendees();
event->setSummary( i18n("My counter proposal for: %1").arg( mEvent->summary() ) );
- mChanger->addIncidence( event );
+ mChanger->addIncidence( event, mResource, mSubResource, this );
} else {
- mChanger->changeIncidence( oldEvent, mEvent );
+ if ( mRecurIncidence && mRecurIncidenceAfterDissoc ) {
+ mChanger->addIncidence( mEvent, mResource, mSubResource, this );
+
+ mChanger->changeIncidence( mRecurIncidence, mRecurIncidenceAfterDissoc,
+ KOGlobals::RECURRENCE_MODIFIED_ALL_FUTURE, this );
+
+ } else {
+ mChanger->changeIncidence( oldEvent, mEvent, KOGlobals::NOTHING_MODIFIED, this );
+ }
}
}
delete event;
@@ -307,14 +308,16 @@ bool KOEventEditor::processInput()
KOPrefs::instance()->email() ) );
writeEvent( mEvent );
// NOTE: triggered by addIncidence, the kolab resource might open a non-modal dialog (parent is not available in the resource) to select a resource folder. Thus the user can close this dialog before addIncidence() returns.
- if ( !mChanger->addIncidence( mEvent, this ) ) {
+ if ( !mChanger->addIncidence( mEvent, mResource, mSubResource, this ) ) {
delete mEvent;
mEvent = 0;
return false;
}
}
// if "this" was deleted, freeBusy is 0 (being a guardedptr)
- if ( freeBusy ) freeBusy->cancelReload();
+ if ( freeBusy ) {
+ freeBusy->cancelReload();
+ }
return true;
}
@@ -324,6 +327,11 @@ void KOEventEditor::processCancel()
kdDebug(5850) << "KOEventEditor::processCancel()" << endl;
if ( mFreeBusy ) mFreeBusy->cancelReload();
+
+ if ( mRecurIncidence && mRecurIncidenceAfterDissoc ) {
+ *mRecurIncidenceAfterDissoc = *mRecurIncidence;
+ }
+
}
void KOEventEditor::deleteEvent()
@@ -336,11 +344,11 @@ void KOEventEditor::deleteEvent()
reject();
}
-void KOEventEditor::readEvent( Event *event, Calendar *calendar, bool tmpl )
+void KOEventEditor::readEvent( Event *event, Calendar *calendar, const TQDate &date, bool tmpl )
{
- mGeneral->readEvent( event, calendar, tmpl );
+ mGeneral->readEvent( event, calendar, date, tmpl );
mRecurrence->readIncidence( event );
-// mAlarms->readIncidence( event );
+
if ( mFreeBusy ) {
mFreeBusy->readEvent( event );
mFreeBusy->triggerReload();
@@ -368,11 +376,14 @@ void KOEventEditor::writeEvent( Event *event )
bool KOEventEditor::validateInput()
{
- if ( !mGeneral->validateInput() ) return false;
- if ( !mDetails->validateInput() ) return false;
- if ( !mRecurrence->validateInput() ) return false;
-
- return true;
+ if ( !mGeneral->validateInput() ||
+ !mDetails->validateInput() ||
+ !mRecurrence->validateInput() ) {
+ kdDebug(5850) << "ValidateInput returns false" << endl;
+ return false;
+ } else {
+ return true;
+ }
}
int KOEventEditor::msgItemDelete()
@@ -390,7 +401,7 @@ void KOEventEditor::loadTemplate( /*const*/ CalendarLocal& cal )
i18n("Template does not contain a valid event.") );
} else {
kdDebug(5850) << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl;
- readEvent( events.first(), 0, true );
+ readEvent( events.first(), 0, TQDate(), true );
}
}
@@ -414,9 +425,9 @@ TQObject *KOEventEditor::typeAheadReceiver() const
void KOEventEditor::updateRecurrenceSummary()
{
- Event *ev = new Event();
+ Event *ev = new Event();
writeEvent( ev );
- mGeneral->updateRecurrenceSummary( IncidenceFormatter::recurrenceString( ev ) );
+ mGeneral->updateRecurrenceSummary( ev );
delete ev;
}