-rw-r--r-- | korganizer/koeventeditor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index 9ede543..3e87197 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp | |||
@@ -1,59 +1,60 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qhbox.h> | 27 | #include <qhbox.h> |
28 | #include <qtimer.h> | ||
28 | #include <qdir.h> | 29 | #include <qdir.h> |
29 | #include <qlayout.h> | 30 | #include <qlayout.h> |
30 | #include <qwidgetstack.h> | 31 | #include <qwidgetstack.h> |
31 | #include <qapplication.h> | 32 | #include <qapplication.h> |
32 | 33 | ||
33 | #include <kiconloader.h> | 34 | #include <kiconloader.h> |
34 | #include <kstandarddirs.h> | 35 | #include <kstandarddirs.h> |
35 | #include <kdebug.h> | 36 | #include <kdebug.h> |
36 | #include <klocale.h> | 37 | #include <klocale.h> |
37 | #include <kfiledialog.h> | 38 | #include <kfiledialog.h> |
38 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
39 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
40 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
41 | #include <kresources/resourceselectdialog.h> | 42 | #include <kresources/resourceselectdialog.h> |
42 | 43 | ||
43 | #include <libkdepim/categoryselectdialog.h> | 44 | #include <libkdepim/categoryselectdialog.h> |
44 | #include <libkcal/calendarlocal.h> | 45 | #include <libkcal/calendarlocal.h> |
45 | #include <libkcal/icalformat.h> | 46 | #include <libkcal/icalformat.h> |
46 | 47 | ||
47 | #include "koprefs.h" | 48 | #include "koprefs.h" |
48 | 49 | ||
49 | #include "koeventeditor.h" | 50 | #include "koeventeditor.h" |
50 | extern int globalFlagBlockAgenda; | 51 | extern int globalFlagBlockAgenda; |
51 | 52 | ||
52 | KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : | 53 | KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : |
53 | KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) | 54 | KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) |
54 | { | 55 | { |
55 | mEvent = 0; | 56 | mEvent = 0; |
56 | init(); | 57 | init(); |
57 | if ( QApplication::desktop()->height() <= 240 ) | 58 | if ( QApplication::desktop()->height() <= 240 ) |
58 | hideButtons(); | 59 | hideButtons(); |
59 | } | 60 | } |
@@ -220,64 +221,67 @@ void KOEventEditor::loadDefaults() | |||
220 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); | 221 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); |
221 | 222 | ||
222 | setDefaults(from,to,false); | 223 | setDefaults(from,to,false); |
223 | } | 224 | } |
224 | 225 | ||
225 | bool KOEventEditor::processInput( bool emitTime ) | 226 | bool KOEventEditor::processInput( bool emitTime ) |
226 | { | 227 | { |
227 | if (!validateInput()) return false; | 228 | if (!validateInput()) return false; |
228 | 229 | ||
229 | Event *event = 0; | 230 | Event *event = 0; |
230 | 231 | ||
231 | if (mEvent) event = mEvent; | 232 | if (mEvent) event = mEvent; |
232 | else { | 233 | else { |
233 | event = new Event; | 234 | event = new Event; |
234 | event->setOrganizer(KOPrefs::instance()->email()); | 235 | event->setOrganizer(KOPrefs::instance()->email()); |
235 | } | 236 | } |
236 | 237 | ||
237 | writeEvent(event); | 238 | writeEvent(event); |
238 | if ( emitTime ) { | 239 | if ( emitTime ) { |
239 | globalFlagBlockAgenda = 1; | 240 | globalFlagBlockAgenda = 1; |
240 | emit showAgendaView( false ); | 241 | emit showAgendaView( false ); |
241 | emit jumpToTime( event->dtStart().date() ); | 242 | emit jumpToTime( event->dtStart().date() ); |
242 | globalFlagBlockAgenda = 2; | 243 | globalFlagBlockAgenda = 2; |
243 | 244 | ||
244 | } | 245 | } |
245 | if (mEvent) { | 246 | if (mEvent) { |
246 | event->setRevision(event->revision()+1); | 247 | event->setRevision(event->revision()+1); |
247 | emit eventChanged(event); | 248 | emit eventChanged(event); |
248 | } else { | 249 | } else { |
249 | mCalendar->addEvent(event); | 250 | mCalendar->addEvent(event); |
250 | mEvent = event; | 251 | mEvent = event; |
251 | emit eventAdded(event); | 252 | emit eventAdded(event); |
253 | if ( event->isAlarmEnabled () && !event->alarmEnabled () ) { | ||
254 | QTimer::singleShot( 0, this, SLOT ( alarmWarning() ) ); | ||
255 | } | ||
252 | } | 256 | } |
253 | 257 | ||
254 | return true; | 258 | return true; |
255 | } | 259 | } |
256 | 260 | ||
257 | void KOEventEditor::deleteEvent() | 261 | void KOEventEditor::deleteEvent() |
258 | { | 262 | { |
259 | kdDebug() << "Delete event" << endl; | 263 | kdDebug() << "Delete event" << endl; |
260 | 264 | ||
261 | if (mEvent) { | 265 | if (mEvent) { |
262 | if (KOPrefs::instance()->mConfirm) { | 266 | if (KOPrefs::instance()->mConfirm) { |
263 | switch (msgItemDelete()) { | 267 | switch (msgItemDelete()) { |
264 | case KMessageBox::Continue: // OK | 268 | case KMessageBox::Continue: // OK |
265 | emit eventToBeDeleted(mEvent); | 269 | emit eventToBeDeleted(mEvent); |
266 | emit dialogClose(mEvent); | 270 | emit dialogClose(mEvent); |
267 | mCalendar->deleteEvent(mEvent); | 271 | mCalendar->deleteEvent(mEvent); |
268 | emit eventDeleted(); | 272 | emit eventDeleted(); |
269 | reject(); | 273 | reject(); |
270 | break; | 274 | break; |
271 | } | 275 | } |
272 | } | 276 | } |
273 | else { | 277 | else { |
274 | emit eventToBeDeleted(mEvent); | 278 | emit eventToBeDeleted(mEvent); |
275 | emit dialogClose(mEvent); | 279 | emit dialogClose(mEvent); |
276 | mCalendar->deleteEvent(mEvent); | 280 | mCalendar->deleteEvent(mEvent); |
277 | emit eventDeleted(); | 281 | emit eventDeleted(); |
278 | reject(); | 282 | reject(); |
279 | } | 283 | } |
280 | } else { | 284 | } else { |
281 | reject(); | 285 | reject(); |
282 | } | 286 | } |
283 | } | 287 | } |