-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 | |||
@@ -151,158 +151,160 @@ 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 | ||