-rw-r--r-- | korganizer/koeventview.cpp | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/korganizer/koeventview.cpp b/korganizer/koeventview.cpp new file mode 100644 index 0000000..4553b0b --- a/dev/null +++ b/korganizer/koeventview.cpp | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #include <qpopupmenu.h> | ||
25 | #include <qcursor.h> | ||
26 | |||
27 | #include <klocale.h> | ||
28 | #include <kdebug.h> | ||
29 | #include <kiconloader.h> | ||
30 | #include <kmessagebox.h> | ||
31 | |||
32 | #include <libkcal/calendar.h> | ||
33 | #include "koprefs.h" | ||
34 | #include "koeventview.h" | ||
35 | using namespace KOrg; | ||
36 | #include "koeventview.moc" | ||
37 | |||
38 | //--------------------------------------------------------------------------- | ||
39 | |||
40 | KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name) | ||
41 | : KOrg::BaseView(cal,parent,name) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | //--------------------------------------------------------------------------- | ||
46 | |||
47 | KOEventView::~KOEventView() | ||
48 | { | ||
49 | } | ||
50 | |||
51 | //--------------------------------------------------------------------------- | ||
52 | |||
53 | KOEventPopupMenu *KOEventView::eventPopup() | ||
54 | { | ||
55 | KOEventPopupMenu *eventPopup = new KOEventPopupMenu; | ||
56 | |||
57 | connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)), | ||
58 | SIGNAL(editIncidenceSignal(Incidence *))); | ||
59 | connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)), | ||
60 | SIGNAL(showIncidenceSignal(Incidence *))); | ||
61 | connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)), | ||
62 | SIGNAL(deleteIncidenceSignal(Incidence *))); | ||
63 | connect(eventPopup,SIGNAL(cancelIncidenceSignal(Incidence *)), | ||
64 | SIGNAL(cancelIncidenceSignal(Incidence *))); | ||
65 | connect(eventPopup,SIGNAL(cloneIncidenceSignal(Incidence *)), | ||
66 | SIGNAL(cloneIncidenceSignal(Incidence *))); | ||
67 | connect(eventPopup,SIGNAL(beamIncidenceSignal(Incidence *)), | ||
68 | SIGNAL(beamIncidenceSignal(Incidence *))); | ||
69 | connect(eventPopup,SIGNAL(moveIncidenceSignal(Incidence *)), | ||
70 | SIGNAL(moveIncidenceSignal(Incidence *))); | ||
71 | |||
72 | return eventPopup; | ||
73 | } | ||
74 | |||
75 | //--------------------------------------------------------------------------- | ||
76 | |||
77 | void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event) | ||
78 | { | ||
79 | mCurrentIncidence = event; | ||
80 | if (event) popup->popup(QCursor::pos()); | ||
81 | else kdDebug() << "KOEventView::showEventPopup(): No event selected" << endl; | ||
82 | } | ||
83 | |||
84 | //--------------------------------------------------------------------------- | ||
85 | |||
86 | void KOEventView::popupShow() | ||
87 | { | ||
88 | emit showIncidenceSignal(mCurrentIncidence); | ||
89 | } | ||
90 | |||
91 | //--------------------------------------------------------------------------- | ||
92 | |||
93 | void KOEventView::popupEdit() | ||
94 | { | ||
95 | emit editIncidenceSignal(mCurrentIncidence); | ||
96 | } | ||
97 | |||
98 | //--------------------------------------------------------------------------- | ||
99 | |||
100 | void KOEventView::popupDelete() | ||
101 | { | ||
102 | emit deleteIncidenceSignal(mCurrentIncidence); | ||
103 | } | ||
104 | void KOEventView::popupClone() | ||
105 | { | ||
106 | emit cloneIncidenceSignal(mCurrentIncidence); | ||
107 | } | ||
108 | void KOEventView::popupCancel() | ||
109 | { | ||
110 | emit cancelIncidenceSignal(mCurrentIncidence); | ||
111 | } | ||
112 | |||
113 | //--------------------------------------------------------------------------- | ||
114 | |||
115 | void KOEventView::defaultAction( Incidence *incidence ) | ||
116 | { | ||
117 | |||
118 | if ( !incidence ) return; | ||
119 | |||
120 | if ( incidence->isReadOnly() ) | ||
121 | emit showIncidenceSignal(incidence); | ||
122 | else { | ||
123 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | ||
124 | emit editIncidenceSignal(incidence); | ||
125 | else | ||
126 | emit showIncidenceSignal(incidence); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | //--------------------------------------------------------------------------- | ||
131 | |||
132 | #include "baseview.moc" | ||
133 | |||