summaryrefslogtreecommitdiffabout
path: root/korganizer/koeventeditor.cpp
Unidiff
Diffstat (limited to 'korganizer/koeventeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventeditor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 02d4a78..75dae34 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -27,97 +27,97 @@
27#include <qhbox.h> 27#include <qhbox.h>
28#include <qdir.h> 28#include <qdir.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qapplication.h> 31#include <qapplication.h>
32 32
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39#include <libkcal/calendarresources.h> 39#include <libkcal/calendarresources.h>
40#include <libkcal/resourcecalendar.h> 40#include <libkcal/resourcecalendar.h>
41#include <kresources/resourceselectdialog.h> 41#include <kresources/resourceselectdialog.h>
42 42
43#include <libkdepim/categoryselectdialog.h> 43#include <libkdepim/categoryselectdialog.h>
44#include <libkcal/calendarlocal.h> 44#include <libkcal/calendarlocal.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koeventeditor.h" 49#include "koeventeditor.h"
50extern int globalFlagBlockAgenda; 50extern int globalFlagBlockAgenda;
51 51
52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : 52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) :
53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) 53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent )
54{ 54{
55 mEvent = 0; 55 mEvent = 0;
56 init(); 56 init();
57 if ( QApplication::desktop()->height() <= 240 ) 57 if ( QApplication::desktop()->height() <= 240 )
58 hideButtons(); 58 hideButtons();
59} 59}
60 60
61KOEventEditor::~KOEventEditor() 61KOEventEditor::~KOEventEditor()
62{ 62{
63 //emit dialogClose( mEvent ); 63 //emit dialogClose( mEvent );
64} 64}
65 65
66void KOEventEditor::init() 66void KOEventEditor::init()
67{ 67{
68 68
69 setupGeneral(); 69 setupGeneral();
70 setupAttendeesTab(); 70 setupAttendeesTab();
71 setupRecurrence(); 71 setupRecurrence();
72 72
73 // Propagate date time settings to recurrence tab 73 // Propagate date time settings to recurrence tab
74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
75 mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); 75 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), 76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
77 mRecurrence,SLOT(setDateTimeStr(const QString &))); 77 mRecurrence,SLOT(setDateTimeStr(const QString &)));
78 78
79 // Category dialog 79 // Category dialog
80 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 80 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
81 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), 81 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)),
82 // mGeneral,SLOT(setCategories(const QString &))); 82 // mGeneral,SLOT(setCategories(const QString &)));
83 83
84 84
85} 85}
86 86
87void KOEventEditor::reload() 87void KOEventEditor::reload()
88{ 88{
89 if ( mEvent ) readEvent( mEvent ); 89 if ( mEvent ) readEvent( mEvent );
90} 90}
91 91
92void KOEventEditor::setSecrecy( int sec ) 92void KOEventEditor::setSecrecy( int sec )
93{ 93{
94 mGeneral->setSecrecy( sec ); 94 mGeneral->setSecrecy( sec );
95} 95}
96void KOEventEditor::setCategories( QString s ) 96void KOEventEditor::setCategories( QString s )
97{ 97{
98 mGeneral->setCategories(s); 98 mGeneral->setCategories(s);
99 99
100} 100}
101void KOEventEditor::setupGeneral() 101void KOEventEditor::setupGeneral()
102{ 102{
103 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); 103 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
104 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 104 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
105 105
106 if( KOPrefs::instance()->mCompactDialogs ) { 106 if( KOPrefs::instance()->mCompactDialogs ) {
107 QFrame *topFrame = addPage(i18n("General")); 107 QFrame *topFrame = addPage(i18n("General"));
108 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 108 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
109 topLayout->setSpacing(spacingHint()-1); 109 topLayout->setSpacing(spacingHint()-1);
110 topLayout->setMargin(marginHint()-1); 110 topLayout->setMargin(marginHint()-1);
111 mGeneral->initHeader(topFrame,topLayout); 111 mGeneral->initHeader(topFrame,topLayout);
112 mGeneral->initTime(topFrame,topLayout); 112 mGeneral->initTime(topFrame,topLayout);
113// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 113// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
114 mGeneral->initAlarm(topFrame,topLayout); 114 mGeneral->initAlarm(topFrame,topLayout);
115 mGeneral->enableAlarm( false ); 115 mGeneral->enableAlarm( false );
116 116
117 QBoxLayout *buttonLayout; 117 QBoxLayout *buttonLayout;
118 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) 118 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 )
119 buttonLayout = new QVBoxLayout( topLayout ); 119 buttonLayout = new QVBoxLayout( topLayout );
120 else 120 else
121 buttonLayout = new QHBoxLayout( topLayout ); 121 buttonLayout = new QHBoxLayout( topLayout );
122 QHBox* buttonWidget = new QHBox (topFrame); 122 QHBox* buttonWidget = new QHBox (topFrame);
123 QIconSet icon; 123 QIconSet icon;
@@ -235,97 +235,97 @@ bool KOEventEditor::processInput( bool emitTime )
235 emit jumpToTime( event->dtStart().date() ); 235 emit jumpToTime( event->dtStart().date() );
236 globalFlagBlockAgenda = 2; 236 globalFlagBlockAgenda = 2;
237 237
238 } 238 }
239 if (mEvent) { 239 if (mEvent) {
240 event->setRevision(event->revision()+1); 240 event->setRevision(event->revision()+1);
241 emit eventChanged(event); 241 emit eventChanged(event);
242 } else { 242 } else {
243 mCalendar->addEvent(event); 243 mCalendar->addEvent(event);
244 mEvent = event; 244 mEvent = event;
245 emit eventAdded(event); 245 emit eventAdded(event);
246 } 246 }
247 247
248 return true; 248 return true;
249} 249}
250 250
251void KOEventEditor::deleteEvent() 251void KOEventEditor::deleteEvent()
252{ 252{
253 kdDebug() << "Delete event" << endl; 253 kdDebug() << "Delete event" << endl;
254 254
255 if (mEvent) { 255 if (mEvent) {
256 if (KOPrefs::instance()->mConfirm) { 256 if (KOPrefs::instance()->mConfirm) {
257 switch (msgItemDelete()) { 257 switch (msgItemDelete()) {
258 case KMessageBox::Continue: // OK 258 case KMessageBox::Continue: // OK
259 emit eventToBeDeleted(mEvent); 259 emit eventToBeDeleted(mEvent);
260 emit dialogClose(mEvent); 260 emit dialogClose(mEvent);
261 mCalendar->deleteEvent(mEvent); 261 mCalendar->deleteEvent(mEvent);
262 emit eventDeleted(); 262 emit eventDeleted();
263 reject(); 263 reject();
264 break; 264 break;
265 } 265 }
266 } 266 }
267 else { 267 else {
268 emit eventToBeDeleted(mEvent); 268 emit eventToBeDeleted(mEvent);
269 emit dialogClose(mEvent); 269 emit dialogClose(mEvent);
270 mCalendar->deleteEvent(mEvent); 270 mCalendar->deleteEvent(mEvent);
271 emit eventDeleted(); 271 emit eventDeleted();
272 reject(); 272 reject();
273 } 273 }
274 } else { 274 } else {
275 reject(); 275 reject();
276 } 276 }
277} 277}
278 278
279void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) 279void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
280{ 280{
281 mGeneral->setDefaults(from,to,allDay); 281 mGeneral->setDefaults(from,to,allDay);
282 mDetails->setDefaults(); 282 mDetails->setDefaults();
283 mRecurrence->setDefaults(from,to,allDay); 283 mRecurrence->setDefaults(from,to);
284 showPage( 0 ); 284 showPage( 0 );
285 mGeneral->setFocusOn( 2 ); 285 mGeneral->setFocusOn( 2 );
286} 286}
287 287
288void KOEventEditor::readEvent( Event *event, bool tmpl ) 288void KOEventEditor::readEvent( Event *event, bool tmpl )
289{ 289{
290 mGeneral->readEvent( event, tmpl ); 290 mGeneral->readEvent( event, tmpl );
291 mDetails->readEvent( event ); 291 mDetails->readEvent( event );
292 mRecurrence->readEvent( event ); 292 mRecurrence->readEvent( event );
293 293
294 // categories 294 // categories
295 //mCategoryDialog->setSelected( event->categories() ); 295 //mCategoryDialog->setSelected( event->categories() );
296} 296}
297 297
298void KOEventEditor::writeEvent(Event *event) 298void KOEventEditor::writeEvent(Event *event)
299{ 299{
300 mGeneral->writeEvent( event ); 300 mGeneral->writeEvent( event );
301 mDetails->writeEvent( event ); 301 mDetails->writeEvent( event );
302 302
303 if ( event->organizer() == KOPrefs::instance()->email() ) { 303 if ( event->organizer() == KOPrefs::instance()->email() ) {
304 Event *ev = new Event( *event ); 304 Event *ev = new Event( *event );
305 ev->registerObserver(0); 305 ev->registerObserver(0);
306 mDetails->cancelAttendeeEvent( ev ); 306 mDetails->cancelAttendeeEvent( ev );
307 if ( ev->attendeeCount() > 0 ) { 307 if ( ev->attendeeCount() > 0 ) {
308 emit deleteAttendee( ev ); 308 emit deleteAttendee( ev );
309 } 309 }
310 delete(ev); 310 delete(ev);
311 } 311 }
312 312
313 mRecurrence->writeEvent(event); 313 mRecurrence->writeEvent(event);
314} 314}
315 315
316bool KOEventEditor::validateInput() 316bool KOEventEditor::validateInput()
317{ 317{
318 if (!mGeneral->validateInput()) return false; 318 if (!mGeneral->validateInput()) return false;
319 if (!mDetails->validateInput()) return false; 319 if (!mDetails->validateInput()) return false;
320 if (!mRecurrence->validateInput()) return false; 320 if (!mRecurrence->validateInput()) return false;
321 return true; 321 return true;
322} 322}
323 323
324int KOEventEditor::msgItemDelete() 324int KOEventEditor::msgItemDelete()
325{ 325{
326 return KMessageBox::warningContinueCancel(this, 326 return KMessageBox::warningContinueCancel(this,
327 i18n("This item will be permanently deleted."), 327 i18n("This item will be permanently deleted."),
328 i18n("KOrganizer Confirmation"),i18n("Delete")); 328 i18n("KOrganizer Confirmation"),i18n("Delete"));
329} 329}
330 330
331void KOEventEditor::slotLoadTemplate() 331void KOEventEditor::slotLoadTemplate()