author | zautrix <zautrix> | 2005-10-10 00:54:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-10 00:54:59 (UTC) |
commit | 999e15691b8cd67db766a60906b96b68da8cfb30 (patch) (unidiff) | |
tree | 4b4873b893d1a1099ea4cf3edd175f4cd03163be | |
parent | dad8e8745591620c951cefd835ea7ea727db8925 (diff) | |
download | kdepimpi-999e15691b8cd67db766a60906b96b68da8cfb30.zip kdepimpi-999e15691b8cd67db766a60906b96b68da8cfb30.tar.gz kdepimpi-999e15691b8cd67db766a60906b96b68da8cfb30.tar.bz2 |
chaged set todo complete in viewer
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 0763825..2e936f3 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -1,308 +1,310 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 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 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libkcal/event.h> | 22 | #include <libkcal/event.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | 25 | ||
26 | #include "koeventviewer.h" | 26 | #include "koeventviewer.h" |
27 | #include <kmessagebox.h> | 27 | #include <kmessagebox.h> |
28 | #include "koprefs.h" | 28 | #include "koprefs.h" |
29 | #include <libkcal/todo.h> | 29 | #include <libkcal/todo.h> |
30 | #include "qapp.h" | 30 | #include "qapp.h" |
31 | 31 | ||
32 | #include "koeventviewerdialog.h" | 32 | #include "koeventviewerdialog.h" |
33 | extern int globalFlagBlockAgenda; | 33 | extern int globalFlagBlockAgenda; |
34 | 34 | ||
35 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | 35 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) |
36 | : KDialogBase(parent,name, | 36 | : KDialogBase(parent,name, |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | true , | 38 | true , |
39 | #else | 39 | #else |
40 | false, | 40 | false, |
41 | #endif | 41 | #endif |
42 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) | 42 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) |
43 | { | 43 | { |
44 | sendSignalViewerClosed = true; | 44 | sendSignalViewerClosed = true; |
45 | mEventViewer = new KOEventViewer(this); | 45 | mEventViewer = new KOEventViewer(this); |
46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
47 | setMainWidget(mEventViewer); | 47 | setMainWidget(mEventViewer); |
48 | setButtonText(Ok, i18n("Edit") ); | 48 | setButtonText(Ok, i18n("Edit") ); |
49 | 49 | ||
50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
51 | SLOT(editIncidence())); | 51 | SLOT(editIncidence())); |
52 | QObject::connect(this,SIGNAL(user1Clicked()), | 52 | QObject::connect(this,SIGNAL(user1Clicked()), |
53 | SLOT(showIncidence())); | 53 | SLOT(showIncidence())); |
54 | connect( mEventViewer, SIGNAL( showIncidence( QString ) ),SIGNAL( showIncidence( QString ) )); | 54 | connect( mEventViewer, SIGNAL( showIncidence( QString ) ),SIGNAL( showIncidence( QString ) )); |
55 | mIncidence = 0; | 55 | mIncidence = 0; |
56 | // TODO: Set a sensible size (based on the content?). | 56 | // TODO: Set a sensible size (based on the content?). |
57 | //showMaximized(); | 57 | //showMaximized(); |
58 | //qDebug("++++++++++++KOEventViewerDialog() "); | 58 | //qDebug("++++++++++++KOEventViewerDialog() "); |
59 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 59 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
60 | // setFixedSize( 240,284 ); | 60 | // setFixedSize( 240,284 ); |
61 | // move( 0, 15 ); | 61 | // move( 0, 15 ); |
62 | // } else { | 62 | // } else { |
63 | // setMinimumSize(300,200); | 63 | // setMinimumSize(300,200); |
64 | // resize(320,300); | 64 | // resize(320,300); |
65 | // } | 65 | // } |
66 | mSyncMode = false; | 66 | mSyncMode = false; |
67 | mSyncResult = 0; | 67 | mSyncResult = 0; |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | KOEventViewerDialog::~KOEventViewerDialog() | 71 | KOEventViewerDialog::~KOEventViewerDialog() |
72 | { | 72 | { |
73 | //qDebug("-------~KOEventViewerDialog() "); | 73 | //qDebug("-------~KOEventViewerDialog() "); |
74 | } | 74 | } |
75 | void KOEventViewerDialog::showMe() | 75 | void KOEventViewerDialog::showMe() |
76 | { | 76 | { |
77 | 77 | ||
78 | #ifdef DESKTOP_VERSION | 78 | #ifdef DESKTOP_VERSION |
79 | int x,y,w,h; | 79 | int x,y,w,h; |
80 | x = geometry().x(); | 80 | x = geometry().x(); |
81 | y = geometry().y(); | 81 | y = geometry().y(); |
82 | w = width(); | 82 | w = width(); |
83 | h = height(); | 83 | h = height(); |
84 | show(); | 84 | show(); |
85 | setGeometry(x,y,w,h); | 85 | setGeometry(x,y,w,h); |
86 | raise(); | 86 | raise(); |
87 | #else | 87 | #else |
88 | showMaximized(); | 88 | showMaximized(); |
89 | #endif | 89 | #endif |
90 | QTimer::singleShot( 1, this, SLOT ( setMyFocus() ) ); | 90 | QTimer::singleShot( 1, this, SLOT ( setMyFocus() ) ); |
91 | 91 | ||
92 | } | 92 | } |
93 | void KOEventViewerDialog::setMyFocus() | 93 | void KOEventViewerDialog::setMyFocus() |
94 | { | 94 | { |
95 | 95 | ||
96 | setActiveWindow(); | 96 | setActiveWindow(); |
97 | mEventViewer->setFocus(); | 97 | mEventViewer->setFocus(); |
98 | 98 | ||
99 | } | 99 | } |
100 | void KOEventViewerDialog::print() | 100 | void KOEventViewerDialog::print() |
101 | { | 101 | { |
102 | mEventViewer->printMe(); | 102 | mEventViewer->printMe(); |
103 | 103 | ||
104 | } | 104 | } |
105 | void KOEventViewerDialog::setSyncMode( bool b ) | 105 | void KOEventViewerDialog::setSyncMode( bool b ) |
106 | { | 106 | { |
107 | mSyncMode = b; | 107 | mSyncMode = b; |
108 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 108 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
109 | if ( mSyncMode ) { | 109 | if ( mSyncMode ) { |
110 | findButton( Close )->setText( i18n("Cancel Sync")); | 110 | findButton( Close )->setText( i18n("Cancel Sync")); |
111 | findButton( Ok )->setText( i18n("Remote")); | 111 | findButton( Ok )->setText( i18n("Remote")); |
112 | findButton( User1 )->setText( i18n("Local")); | 112 | findButton( User1 )->setText( i18n("Local")); |
113 | } else { | 113 | } else { |
114 | findButton( Close )->setText( i18n("Close")); | 114 | findButton( Close )->setText( i18n("Close")); |
115 | findButton( Ok )->setText( i18n("Edit")); | 115 | findButton( Ok )->setText( i18n("Edit")); |
116 | findButton( User1 )->setText( i18n("Agenda")); | 116 | findButton( User1 )->setText( i18n("Agenda")); |
117 | } | 117 | } |
118 | mEventViewer->setSyncMode( b ); | 118 | mEventViewer->setSyncMode( b ); |
119 | } | 119 | } |
120 | void KOEventViewerDialog::setColorMode( int m ) | 120 | void KOEventViewerDialog::setColorMode( int m ) |
121 | { | 121 | { |
122 | mEventViewer->setColorMode( m ); | 122 | mEventViewer->setColorMode( m ); |
123 | } | 123 | } |
124 | int KOEventViewerDialog::executeS( bool local ) | 124 | int KOEventViewerDialog::executeS( bool local ) |
125 | { | 125 | { |
126 | mSyncResult = 3; | 126 | mSyncResult = 3; |
127 | if ( local ) | 127 | if ( local ) |
128 | findButton( User1 )->setFocus(); | 128 | findButton( User1 )->setFocus(); |
129 | else | 129 | else |
130 | findButton( Ok )->setFocus(); | 130 | findButton( Ok )->setFocus(); |
131 | exec(); | 131 | exec(); |
132 | return mSyncResult; | 132 | return mSyncResult; |
133 | } | 133 | } |
134 | 134 | ||
135 | void KOEventViewerDialog::updateConfig() | 135 | void KOEventViewerDialog::updateConfig() |
136 | { | 136 | { |
137 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 137 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
138 | 138 | ||
139 | } | 139 | } |
140 | void KOEventViewerDialog::setEvent(Event *event) | 140 | void KOEventViewerDialog::setEvent(Event *event) |
141 | { | 141 | { |
142 | mEventViewer->setEvent(event); | 142 | mEventViewer->setEvent(event); |
143 | mIncidence = event; | 143 | mIncidence = event; |
144 | mEventViewer->setFocus(); | 144 | mEventViewer->setFocus(); |
145 | //findButton( Close )->setFocus(); | 145 | //findButton( Close )->setFocus(); |
146 | if ( !mSyncMode ) { | 146 | if ( !mSyncMode ) { |
147 | findButton( User1 )->setText( i18n("Agenda")); | 147 | findButton( User1 )->setText( i18n("Agenda")); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 150 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
151 | { | 151 | { |
152 | if ( in->typeID() == eventID ) | 152 | if ( in->typeID() == eventID ) |
153 | setEvent( (Event*) in ); | 153 | setEvent( (Event*) in ); |
154 | else if ( in->typeID() == todoID ) | 154 | else if ( in->typeID() == todoID ) |
155 | setTodo( (Todo*) in ); | 155 | setTodo( (Todo*) in ); |
156 | else if ( in->typeID() == journalID ) | 156 | else if ( in->typeID() == journalID ) |
157 | setJournal( (Journal*) in ); | 157 | setJournal( (Journal*) in ); |
158 | } | 158 | } |
159 | void KOEventViewerDialog::addIncidence(Incidence *in) | 159 | void KOEventViewerDialog::addIncidence(Incidence *in) |
160 | { | 160 | { |
161 | if ( in->typeID() == eventID ) | 161 | if ( in->typeID() == eventID ) |
162 | addEvent( (Event*) in ); | 162 | addEvent( (Event*) in ); |
163 | else if ( in->typeID() == todoID ) | 163 | else if ( in->typeID() == todoID ) |
164 | mEventViewer->setTodo( (Todo*) in, false ); | 164 | mEventViewer->setTodo( (Todo*) in, false ); |
165 | else if ( in->typeID() == journalID ) | 165 | else if ( in->typeID() == journalID ) |
166 | mEventViewer->setJournal( (Journal*) in, false ); | 166 | mEventViewer->setJournal( (Journal*) in, false ); |
167 | if ( mSyncMode ) { | 167 | if ( mSyncMode ) { |
168 | findButton( User1 )->setFocus(); | 168 | findButton( User1 )->setFocus(); |
169 | setCaption(i18n("Conflict! Please choose entry")); | 169 | setCaption(i18n("Conflict! Please choose entry")); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | void KOEventViewerDialog::addEvent(Event *event) | 173 | void KOEventViewerDialog::addEvent(Event *event) |
174 | { | 174 | { |
175 | mEventViewer->addEvent(event); | 175 | mEventViewer->addEvent(event); |
176 | mIncidence = event; | 176 | mIncidence = event; |
177 | mEventViewer->setFocus(); | 177 | mEventViewer->setFocus(); |
178 | //findButton( Close )->setFocus(); | 178 | //findButton( Close )->setFocus(); |
179 | if ( !mSyncMode ) { | 179 | if ( !mSyncMode ) { |
180 | findButton( User1 )->setText( i18n("Agenda")); | 180 | findButton( User1 )->setText( i18n("Agenda")); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | void KOEventViewerDialog::setTodo(Todo *event) | 184 | void KOEventViewerDialog::setTodo(Todo *event) |
185 | { | 185 | { |
186 | mEventViewer->setTodo(event); | 186 | mEventViewer->setTodo(event); |
187 | mIncidence = (Incidence*)event; | 187 | mIncidence = (Incidence*)event; |
188 | mEventViewer->setFocus(); | 188 | mEventViewer->setFocus(); |
189 | //findButton( Close )->setFocus(); | 189 | //findButton( Close )->setFocus(); |
190 | if ( !mSyncMode ) { | 190 | if ( !mSyncMode ) { |
191 | findButton( User1 )->setText( i18n("Set complete")); | 191 | findButton( User1 )->setText( i18n("Set complete")); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | void KOEventViewerDialog::setJournal(Journal *j) | 194 | void KOEventViewerDialog::setJournal(Journal *j) |
195 | { | 195 | { |
196 | mEventViewer->setJournal(j); | 196 | mEventViewer->setJournal(j); |
197 | mIncidence = (Incidence*)j; | 197 | mIncidence = (Incidence*)j; |
198 | mEventViewer->setFocus(); | 198 | mEventViewer->setFocus(); |
199 | //findButton( Close )->setFocus(); | 199 | //findButton( Close )->setFocus(); |
200 | if ( !mSyncMode ) { | 200 | if ( !mSyncMode ) { |
201 | findButton( User1 )->setText( i18n("Agenda")); | 201 | findButton( User1 )->setText( i18n("Agenda")); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | void KOEventViewerDialog::addText(QString text) | 205 | void KOEventViewerDialog::addText(QString text) |
206 | { | 206 | { |
207 | mEventViewer->addText(text); | 207 | mEventViewer->addText(text); |
208 | mEventViewer->setFocus(); | 208 | mEventViewer->setFocus(); |
209 | //findButton( Close )->setFocus(); | 209 | //findButton( Close )->setFocus(); |
210 | } | 210 | } |
211 | void KOEventViewerDialog::editIncidence() | 211 | void KOEventViewerDialog::editIncidence() |
212 | { | 212 | { |
213 | sendSignalViewerClosed = false; | 213 | sendSignalViewerClosed = false; |
214 | if ( mSyncMode ) { | 214 | if ( mSyncMode ) { |
215 | mSyncResult = 2; | 215 | mSyncResult = 2; |
216 | accept(); | 216 | accept(); |
217 | return; | 217 | return; |
218 | } | 218 | } |
219 | if ( mIncidence ){ | 219 | if ( mIncidence ){ |
220 | close(); | 220 | close(); |
221 | emit editIncidence( mIncidence ); | 221 | emit editIncidence( mIncidence ); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | void KOEventViewerDialog::showIncidence() | 224 | void KOEventViewerDialog::showIncidence() |
225 | { | 225 | { |
226 | sendSignalViewerClosed = false; | 226 | sendSignalViewerClosed = false; |
227 | if ( mSyncMode ) { | 227 | if ( mSyncMode ) { |
228 | mSyncResult = 1; | 228 | mSyncResult = 1; |
229 | accept(); | 229 | accept(); |
230 | return; | 230 | return; |
231 | } | 231 | } |
232 | 232 | ||
233 | if ( mIncidence ){ | 233 | if ( mIncidence ){ |
234 | QDate date; | 234 | QDate date; |
235 | if ( mIncidence->type() == "Todo" ) { | 235 | if ( mIncidence->type() == "Todo" ) { |
236 | /* | 236 | /* |
237 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 237 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
238 | date = ((Todo*)mIncidence)->dtDue().date(); | 238 | date = ((Todo*)mIncidence)->dtDue().date(); |
239 | else { | 239 | else { |
240 | globalFlagBlockAgenda = 2; | 240 | globalFlagBlockAgenda = 2; |
241 | emit showAgendaView( false ); | 241 | emit showAgendaView( false ); |
242 | return; | 242 | return; |
243 | } | 243 | } |
244 | */ | 244 | */ |
245 | ((Todo*)mIncidence)->setCompleted( true ); | 245 | ((Todo*)mIncidence)->setCompleted( true ); |
246 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | 246 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); |
247 | emit todoCompleted(((Todo*)mIncidence)); | 247 | emit todoCompleted(((Todo*)mIncidence)); |
248 | mEventViewer->setTodo((Todo*)mIncidence); | ||
249 | return; | ||
248 | } else { | 250 | } else { |
249 | date = mIncidence->dtStart().date(); | 251 | date = mIncidence->dtStart().date(); |
250 | globalFlagBlockAgenda = 1; | 252 | globalFlagBlockAgenda = 1; |
251 | emit showAgendaView( false ); | 253 | emit showAgendaView( false ); |
252 | globalFlagBlockAgenda = 2; | 254 | globalFlagBlockAgenda = 2; |
253 | emit jumpToTime( date ); | 255 | emit jumpToTime( date ); |
254 | } | 256 | } |
255 | close(); | 257 | close(); |
256 | } | 258 | } |
257 | } | 259 | } |
258 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 260 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
259 | { | 261 | { |
260 | switch ( e->key() ) { | 262 | switch ( e->key() ) { |
261 | 263 | ||
262 | case Qt::Key_A : | 264 | case Qt::Key_A : |
263 | case Qt::Key_L : | 265 | case Qt::Key_L : |
264 | showIncidence(); | 266 | showIncidence(); |
265 | break; | 267 | break; |
266 | case Qt::Key_E : | 268 | case Qt::Key_E : |
267 | case Qt::Key_R : | 269 | case Qt::Key_R : |
268 | editIncidence(); | 270 | editIncidence(); |
269 | break; | 271 | break; |
270 | case Qt::Key_C: | 272 | case Qt::Key_C: |
271 | case Qt::Key_Escape: | 273 | case Qt::Key_Escape: |
272 | sendSignalViewerClosed = true; | 274 | sendSignalViewerClosed = true; |
273 | close(); | 275 | close(); |
274 | break; | 276 | break; |
275 | case Qt::Key_I: | 277 | case Qt::Key_I: |
276 | #ifndef DESKTOP_VERSION | 278 | #ifndef DESKTOP_VERSION |
277 | sendSignalViewerClosed = true; | 279 | sendSignalViewerClosed = true; |
278 | close(); | 280 | close(); |
279 | #else | 281 | #else |
280 | sendSignalViewerClosed = true; | 282 | sendSignalViewerClosed = true; |
281 | slotViewerClosed(); | 283 | slotViewerClosed(); |
282 | //accept(); | 284 | //accept(); |
283 | #endif | 285 | #endif |
284 | break; | 286 | break; |
285 | default: | 287 | default: |
286 | KDialogBase::keyPressEvent ( e ); | 288 | KDialogBase::keyPressEvent ( e ); |
287 | break; | 289 | break; |
288 | } | 290 | } |
289 | 291 | ||
290 | } | 292 | } |
291 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) | 293 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) |
292 | { | 294 | { |
293 | KDialogBase::hideEvent ( e ); | 295 | KDialogBase::hideEvent ( e ); |
294 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); | 296 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); |
295 | } | 297 | } |
296 | 298 | ||
297 | void KOEventViewerDialog::slotViewerClosed() | 299 | void KOEventViewerDialog::slotViewerClosed() |
298 | { | 300 | { |
299 | if ( mSyncMode ) | 301 | if ( mSyncMode ) |
300 | return; | 302 | return; |
301 | 303 | ||
302 | if ( sendSignalViewerClosed ) { | 304 | if ( sendSignalViewerClosed ) { |
303 | //qDebug("KOEventViewerDialog::hideEvent "); | 305 | //qDebug("KOEventViewerDialog::hideEvent "); |
304 | emit signalViewerClosed(); | 306 | emit signalViewerClosed(); |
305 | } | 307 | } |
306 | sendSignalViewerClosed = true; | 308 | sendSignalViewerClosed = true; |
307 | } | 309 | } |
308 | 310 | ||