-rw-r--r-- | korganizer/calendarview.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e4a11f5..1f8ad5b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -230,384 +230,386 @@ CalendarView::CalendarView( Calendar *calendar, | |||
230 | mEventEditor = 0; | 230 | mEventEditor = 0; |
231 | mTodoEditor = 0; | 231 | mTodoEditor = 0; |
232 | init();} | 232 | init();} |
233 | 233 | ||
234 | void CalendarView::init() | 234 | void CalendarView::init() |
235 | { | 235 | { |
236 | beamDialog = new KOBeamPrefs(); | 236 | beamDialog = new KOBeamPrefs(); |
237 | mDatePickerMode = 0; | 237 | mDatePickerMode = 0; |
238 | mCurrentSyncDevice = ""; | 238 | mCurrentSyncDevice = ""; |
239 | writeLocale(); | 239 | writeLocale(); |
240 | mViewManager = new KOViewManager( this ); | 240 | mViewManager = new KOViewManager( this ); |
241 | mDialogManager = new KODialogManager( this ); | 241 | mDialogManager = new KODialogManager( this ); |
242 | mEventViewerDialog = 0; | 242 | mEventViewerDialog = 0; |
243 | mModified = false; | 243 | mModified = false; |
244 | mReadOnly = false; | 244 | mReadOnly = false; |
245 | mSelectedIncidence = 0; | 245 | mSelectedIncidence = 0; |
246 | mCalPrinter = 0; | 246 | mCalPrinter = 0; |
247 | mFilters.setAutoDelete(true); | 247 | mFilters.setAutoDelete(true); |
248 | 248 | ||
249 | mCalendar->registerObserver( this ); | 249 | mCalendar->registerObserver( this ); |
250 | // TODO: Make sure that view is updated, when calendar is changed. | 250 | // TODO: Make sure that view is updated, when calendar is changed. |
251 | 251 | ||
252 | mStorage = new FileStorage( mCalendar ); | 252 | mStorage = new FileStorage( mCalendar ); |
253 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 253 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
254 | 254 | ||
255 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 255 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
256 | #ifndef KORG_NOSPLITTER | 256 | #ifndef KORG_NOSPLITTER |
257 | // create the main layout frames. | 257 | // create the main layout frames. |
258 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 258 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
259 | topLayout->addWidget(mPanner); | 259 | topLayout->addWidget(mPanner); |
260 | 260 | ||
261 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 261 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
262 | "CalendarView::LeftFrame"); | 262 | "CalendarView::LeftFrame"); |
263 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 263 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
264 | 264 | ||
265 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 265 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
266 | "CalendarView::DateNavigator", QDate::currentDate() ); | 266 | "CalendarView::DateNavigator", QDate::currentDate() ); |
267 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 267 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
268 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 268 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
269 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 269 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
270 | 270 | ||
271 | #ifdef KORG_NORESOURCEVIEW | 271 | #ifdef KORG_NORESOURCEVIEW |
272 | mResourceView = 0; | 272 | mResourceView = 0; |
273 | #else | 273 | #else |
274 | if ( mResourceManager ) { | 274 | if ( mResourceManager ) { |
275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
276 | mResourceView->updateView(); | 276 | mResourceView->updateView(); |
277 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 277 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
278 | SLOT( updateView() ) ); | 278 | SLOT( updateView() ) ); |
279 | } else { | 279 | } else { |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | } | 281 | } |
282 | #endif | 282 | #endif |
283 | QWidget *rightBox = new QWidget( mPanner ); | 283 | QWidget *rightBox = new QWidget( mPanner ); |
284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
285 | 285 | ||
286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
287 | rightLayout->addWidget( mNavigatorBar ); | 287 | rightLayout->addWidget( mNavigatorBar ); |
288 | 288 | ||
289 | mRightFrame = new QWidgetStack( rightBox ); | 289 | mRightFrame = new QWidgetStack( rightBox ); |
290 | rightLayout->addWidget( mRightFrame, 1 ); | 290 | rightLayout->addWidget( mRightFrame, 1 ); |
291 | 291 | ||
292 | mLeftFrame = mLeftSplitter; | 292 | mLeftFrame = mLeftSplitter; |
293 | #else | 293 | #else |
294 | QWidget *mainBox = new QWidget( this ); | 294 | QWidget *mainBox = new QWidget( this ); |
295 | QWidget *leftFrame = new QWidget( mainBox ); | 295 | QWidget *leftFrame = new QWidget( mainBox ); |
296 | 296 | ||
297 | QBoxLayout * mainBoxLayout; | 297 | QBoxLayout * mainBoxLayout; |
298 | QBoxLayout * leftFrameLayout; | 298 | QBoxLayout * leftFrameLayout; |
299 | if ( KOPrefs::instance()->mVerticalScreen ) { | 299 | if ( KOPrefs::instance()->mVerticalScreen ) { |
300 | mainBoxLayout = new QVBoxLayout(mainBox); | 300 | mainBoxLayout = new QVBoxLayout(mainBox); |
301 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 301 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
302 | } else { | 302 | } else { |
303 | mainBoxLayout = new QHBoxLayout(mainBox); | 303 | mainBoxLayout = new QHBoxLayout(mainBox); |
304 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 304 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
305 | } | 305 | } |
306 | topLayout->addWidget( mainBox ); | 306 | topLayout->addWidget( mainBox ); |
307 | mainBoxLayout->addWidget (leftFrame); | 307 | mainBoxLayout->addWidget (leftFrame); |
308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
309 | "CalendarView::DateNavigator", QDate::currentDate()); | 309 | "CalendarView::DateNavigator", QDate::currentDate()); |
310 | // mDateNavigator->blockSignals( true ); | 310 | // mDateNavigator->blockSignals( true ); |
311 | leftFrameLayout->addWidget( mDateNavigator ); | 311 | leftFrameLayout->addWidget( mDateNavigator ); |
312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
314 | 314 | ||
315 | if ( QApplication::desktop()->width() < 480 ) { | 315 | if ( QApplication::desktop()->width() < 480 ) { |
316 | leftFrameLayout->addWidget(mFilterView); | 316 | leftFrameLayout->addWidget(mFilterView); |
317 | leftFrameLayout->addWidget(mTodoList, 2 ); | 317 | leftFrameLayout->addWidget(mTodoList, 2 ); |
318 | 318 | ||
319 | } else { | 319 | } else { |
320 | leftFrameLayout->addWidget(mTodoList,2 ); | 320 | leftFrameLayout->addWidget(mTodoList,2 ); |
321 | leftFrameLayout->addWidget(mFilterView ); | 321 | leftFrameLayout->addWidget(mFilterView ); |
322 | } | 322 | } |
323 | mFilterView->hide(); | 323 | mFilterView->hide(); |
324 | QWidget *rightBox = new QWidget( mainBox ); | 324 | QWidget *rightBox = new QWidget( mainBox ); |
325 | mainBoxLayout->addWidget ( rightBox, 10 ); | 325 | mainBoxLayout->addWidget ( rightBox, 10 ); |
326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
328 | mRightFrame = new QWidgetStack( rightBox ); | 328 | mRightFrame = new QWidgetStack( rightBox ); |
329 | rightLayout->addWidget( mNavigatorBar ); | 329 | rightLayout->addWidget( mNavigatorBar ); |
330 | rightLayout->addWidget( mRightFrame, 10 ); | 330 | rightLayout->addWidget( mRightFrame, 10 ); |
331 | 331 | ||
332 | mLeftFrame = leftFrame; | 332 | mLeftFrame = leftFrame; |
333 | if ( KOPrefs::instance()->mVerticalScreen ) { | 333 | if ( KOPrefs::instance()->mVerticalScreen ) { |
334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
336 | } else { | 336 | } else { |
337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
339 | } | 339 | } |
340 | 340 | ||
341 | //qDebug("Calendarview Size %d %d ", width(), height()); | 341 | //qDebug("Calendarview Size %d %d ", width(), height()); |
342 | #endif | 342 | #endif |
343 | 343 | ||
344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
345 | SLOT( showDates( const KCal::DateList & ) ) ); | 345 | SLOT( showDates( const KCal::DateList & ) ) ); |
346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
348 | 348 | ||
349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
350 | mNavigator, SLOT( selectPreviousYear() ) ); | 350 | mNavigator, SLOT( selectPreviousYear() ) ); |
351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
352 | mNavigator, SLOT( selectNextYear() ) ); | 352 | mNavigator, SLOT( selectNextYear() ) ); |
353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
354 | mNavigator, SLOT( selectPreviousMonth() ) ); | 354 | mNavigator, SLOT( selectPreviousMonth() ) ); |
355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
356 | mNavigator, SLOT( selectNextMonth() ) ); | 356 | mNavigator, SLOT( selectNextMonth() ) ); |
357 | 357 | ||
358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
360 | 360 | ||
361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
363 | 363 | ||
364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
365 | mNavigator, SLOT( selectPreviousYear() ) ); | 365 | mNavigator, SLOT( selectPreviousYear() ) ); |
366 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 366 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
367 | mNavigator, SLOT( selectNextYear() ) ); | 367 | mNavigator, SLOT( selectNextYear() ) ); |
368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
369 | mNavigator, SLOT( selectPreviousMonth() ) ); | 369 | mNavigator, SLOT( selectPreviousMonth() ) ); |
370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
371 | mNavigator, SLOT( selectNextMonth() ) ); | 371 | mNavigator, SLOT( selectNextMonth() ) ); |
372 | 372 | ||
373 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 373 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
374 | mNavigator, SLOT( selectPrevious() ) ); | 374 | mNavigator, SLOT( selectPrevious() ) ); |
375 | connect( mDateNavigator, SIGNAL( goNext() ), | 375 | connect( mDateNavigator, SIGNAL( goNext() ), |
376 | mNavigator, SLOT( selectNext() ) ); | 376 | mNavigator, SLOT( selectNext() ) ); |
377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
381 | 381 | ||
382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
384 | 384 | ||
385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
386 | SLOT( eventAdded( Event *) ) ); | 386 | SLOT( eventAdded( Event *) ) ); |
387 | 387 | ||
388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
389 | 389 | ||
390 | connect( this, SIGNAL( configChanged() ), | 390 | connect( this, SIGNAL( configChanged() ), |
391 | mDateNavigator, SLOT( updateConfig() ) ); | 391 | mDateNavigator, SLOT( updateConfig() ) ); |
392 | 392 | ||
393 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 393 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
394 | SLOT( newTodo() ) ); | 394 | SLOT( newTodo() ) ); |
395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
396 | SLOT( newSubTodo( Todo * ) ) ); | 396 | SLOT( newSubTodo( Todo * ) ) ); |
397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
398 | SLOT( editTodo( Todo * ) ) ); | 398 | SLOT( editTodo( Todo * ) ) ); |
399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
400 | SLOT( showTodo( Todo *) ) ); | 400 | SLOT( showTodo( Todo *) ) ); |
401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
402 | SLOT( deleteTodo( Todo *) ) ); | 402 | SLOT( deleteTodo( Todo *) ) ); |
403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
405 | SLOT( purgeCompleted() ) ); | 405 | SLOT( purgeCompleted() ) ); |
406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
407 | SIGNAL( todoModified( Todo *, int ) ) ); | 407 | SIGNAL( todoModified( Todo *, int ) ) ); |
408 | 408 | ||
409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
412 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 412 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
413 | 413 | ||
414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
415 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 415 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
417 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 417 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
418 | 418 | ||
419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
420 | this, SLOT ( todo_unsub( Todo * ) ) ); | 420 | this, SLOT ( todo_unsub( Todo * ) ) ); |
421 | 421 | ||
422 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | ||
423 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | ||
422 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 424 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
423 | SLOT( updateTodo( Todo *, int ) ) ); | 425 | SLOT( updateTodo( Todo *, int ) ) ); |
424 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 426 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
425 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 427 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
426 | 428 | ||
427 | 429 | ||
428 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 430 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
429 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 431 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
430 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 432 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
431 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 433 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
432 | 434 | ||
433 | 435 | ||
434 | 436 | ||
435 | 437 | ||
436 | 438 | ||
437 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 439 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
438 | SLOT(checkClipboard())); | 440 | SLOT(checkClipboard())); |
439 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 441 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
440 | SLOT( processTodoListSelection( Incidence * ) ) ); | 442 | SLOT( processTodoListSelection( Incidence * ) ) ); |
441 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 443 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
442 | 444 | ||
443 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 445 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
444 | 446 | ||
445 | mDateFrame = new QVBox(0,0,WType_Popup); | 447 | mDateFrame = new QVBox(0,0,WType_Popup); |
446 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 448 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
447 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 449 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
448 | mDateFrame->setLineWidth(3); | 450 | mDateFrame->setLineWidth(3); |
449 | mDateFrame->hide(); | 451 | mDateFrame->hide(); |
450 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 452 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
451 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 453 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
452 | 454 | ||
453 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 455 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
454 | 456 | ||
455 | mEventEditor = mDialogManager->getEventEditor(); | 457 | mEventEditor = mDialogManager->getEventEditor(); |
456 | mTodoEditor = mDialogManager->getTodoEditor(); | 458 | mTodoEditor = mDialogManager->getTodoEditor(); |
457 | 459 | ||
458 | mFlagEditDescription = false; | 460 | mFlagEditDescription = false; |
459 | 461 | ||
460 | mSuspendTimer = new QTimer( this ); | 462 | mSuspendTimer = new QTimer( this ); |
461 | mAlarmTimer = new QTimer( this ); | 463 | mAlarmTimer = new QTimer( this ); |
462 | mRecheckAlarmTimer = new QTimer( this ); | 464 | mRecheckAlarmTimer = new QTimer( this ); |
463 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 465 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
464 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 466 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
465 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 467 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
466 | mAlarmDialog = new AlarmDialog( this ); | 468 | mAlarmDialog = new AlarmDialog( this ); |
467 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 469 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
468 | mAlarmDialog->setServerNotification( false ); | 470 | mAlarmDialog->setServerNotification( false ); |
469 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 471 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
470 | 472 | ||
471 | 473 | ||
472 | #ifndef DESKTOP_VERSION | 474 | #ifndef DESKTOP_VERSION |
473 | //US listen for arriving address resultsets | 475 | //US listen for arriving address resultsets |
474 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 476 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
475 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 477 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
476 | #endif | 478 | #endif |
477 | 479 | ||
478 | } | 480 | } |
479 | 481 | ||
480 | 482 | ||
481 | CalendarView::~CalendarView() | 483 | CalendarView::~CalendarView() |
482 | { | 484 | { |
483 | // kdDebug() << "~CalendarView()" << endl; | 485 | // kdDebug() << "~CalendarView()" << endl; |
484 | //qDebug("CalendarView::~CalendarView() "); | 486 | //qDebug("CalendarView::~CalendarView() "); |
485 | delete mDialogManager; | 487 | delete mDialogManager; |
486 | delete mViewManager; | 488 | delete mViewManager; |
487 | delete mStorage; | 489 | delete mStorage; |
488 | delete mDateFrame ; | 490 | delete mDateFrame ; |
489 | delete beamDialog; | 491 | delete beamDialog; |
490 | //kdDebug() << "~CalendarView() done" << endl; | 492 | //kdDebug() << "~CalendarView() done" << endl; |
491 | } | 493 | } |
492 | void CalendarView::timerAlarm() | 494 | void CalendarView::timerAlarm() |
493 | { | 495 | { |
494 | //qDebug("CalendarView::timerAlarm() "); | 496 | //qDebug("CalendarView::timerAlarm() "); |
495 | computeAlarm(mAlarmNotification ); | 497 | computeAlarm(mAlarmNotification ); |
496 | } | 498 | } |
497 | 499 | ||
498 | void CalendarView::suspendAlarm() | 500 | void CalendarView::suspendAlarm() |
499 | { | 501 | { |
500 | //qDebug(" CalendarView::suspendAlarm() "); | 502 | //qDebug(" CalendarView::suspendAlarm() "); |
501 | computeAlarm(mSuspendAlarmNotification ); | 503 | computeAlarm(mSuspendAlarmNotification ); |
502 | 504 | ||
503 | } | 505 | } |
504 | 506 | ||
505 | void CalendarView::startAlarm( QString mess , QString filename) | 507 | void CalendarView::startAlarm( QString mess , QString filename) |
506 | { | 508 | { |
507 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 509 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
508 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 510 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
509 | 511 | ||
510 | } | 512 | } |
511 | 513 | ||
512 | void CalendarView::checkNextTimerAlarm() | 514 | void CalendarView::checkNextTimerAlarm() |
513 | { | 515 | { |
514 | mCalendar->checkAlarmForIncidence( 0, true ); | 516 | mCalendar->checkAlarmForIncidence( 0, true ); |
515 | } | 517 | } |
516 | 518 | ||
517 | void CalendarView::computeAlarm( QString msg ) | 519 | void CalendarView::computeAlarm( QString msg ) |
518 | { | 520 | { |
519 | 521 | ||
520 | QString mess = msg; | 522 | QString mess = msg; |
521 | QString mAlarmMessage = mess.mid( 9 ); | 523 | QString mAlarmMessage = mess.mid( 9 ); |
522 | QString filename = MainWindow::resourcePath(); | 524 | QString filename = MainWindow::resourcePath(); |
523 | filename += "koalarm.wav"; | 525 | filename += "koalarm.wav"; |
524 | QString tempfilename; | 526 | QString tempfilename; |
525 | if ( mess.left( 13 ) == "suspend_alarm") { | 527 | if ( mess.left( 13 ) == "suspend_alarm") { |
526 | bool error = false; | 528 | bool error = false; |
527 | int len = mess.mid( 13 ).find("+++"); | 529 | int len = mess.mid( 13 ).find("+++"); |
528 | if ( len < 2 ) | 530 | if ( len < 2 ) |
529 | error = true; | 531 | error = true; |
530 | else { | 532 | else { |
531 | tempfilename = mess.mid( 13, len ); | 533 | tempfilename = mess.mid( 13, len ); |
532 | if ( !QFile::exists( tempfilename ) ) | 534 | if ( !QFile::exists( tempfilename ) ) |
533 | error = true; | 535 | error = true; |
534 | } | 536 | } |
535 | if ( ! error ) { | 537 | if ( ! error ) { |
536 | filename = tempfilename; | 538 | filename = tempfilename; |
537 | } | 539 | } |
538 | mAlarmMessage = mess.mid( 13+len+3 ); | 540 | mAlarmMessage = mess.mid( 13+len+3 ); |
539 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 541 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
540 | startAlarm( mAlarmMessage, filename); | 542 | startAlarm( mAlarmMessage, filename); |
541 | return; | 543 | return; |
542 | } | 544 | } |
543 | if ( mess.left( 11 ) == "timer_alarm") { | 545 | if ( mess.left( 11 ) == "timer_alarm") { |
544 | //mTimerTime = 0; | 546 | //mTimerTime = 0; |
545 | startAlarm( mess.mid( 11 ), filename ); | 547 | startAlarm( mess.mid( 11 ), filename ); |
546 | return; | 548 | return; |
547 | } | 549 | } |
548 | if ( mess.left( 10 ) == "proc_alarm") { | 550 | if ( mess.left( 10 ) == "proc_alarm") { |
549 | bool error = false; | 551 | bool error = false; |
550 | int len = mess.mid( 10 ).find("+++"); | 552 | int len = mess.mid( 10 ).find("+++"); |
551 | if ( len < 2 ) | 553 | if ( len < 2 ) |
552 | error = true; | 554 | error = true; |
553 | else { | 555 | else { |
554 | tempfilename = mess.mid( 10, len ); | 556 | tempfilename = mess.mid( 10, len ); |
555 | if ( !QFile::exists( tempfilename ) ) | 557 | if ( !QFile::exists( tempfilename ) ) |
556 | error = true; | 558 | error = true; |
557 | } | 559 | } |
558 | if ( error ) { | 560 | if ( error ) { |
559 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 561 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
560 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 562 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
561 | } else { | 563 | } else { |
562 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 564 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
563 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 565 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
564 | #ifndef _WIN32_ | 566 | #ifndef _WIN32_ |
565 | if ( vfork () == 0 ) { | 567 | if ( vfork () == 0 ) { |
566 | execl ( tempfilename.latin1(), 0 ); | 568 | execl ( tempfilename.latin1(), 0 ); |
567 | return; | 569 | return; |
568 | } | 570 | } |
569 | #else | 571 | #else |
570 | QProcess* p = new QProcess(); | 572 | QProcess* p = new QProcess(); |
571 | p->addArgument( tempfilename.latin1() ); | 573 | p->addArgument( tempfilename.latin1() ); |
572 | p->start(); | 574 | p->start(); |
573 | return; | 575 | return; |
574 | #endif | 576 | #endif |
575 | 577 | ||
576 | return; | 578 | return; |
577 | } | 579 | } |
578 | 580 | ||
579 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 581 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
580 | } | 582 | } |
581 | if ( mess.left( 11 ) == "audio_alarm") { | 583 | if ( mess.left( 11 ) == "audio_alarm") { |
582 | bool error = false; | 584 | bool error = false; |
583 | int len = mess.mid( 11 ).find("+++"); | 585 | int len = mess.mid( 11 ).find("+++"); |
584 | if ( len < 2 ) | 586 | if ( len < 2 ) |
585 | error = true; | 587 | error = true; |
586 | else { | 588 | else { |
587 | tempfilename = mess.mid( 11, len ); | 589 | tempfilename = mess.mid( 11, len ); |
588 | if ( !QFile::exists( tempfilename ) ) | 590 | if ( !QFile::exists( tempfilename ) ) |
589 | error = true; | 591 | error = true; |
590 | } | 592 | } |
591 | if ( ! error ) { | 593 | if ( ! error ) { |
592 | filename = tempfilename; | 594 | filename = tempfilename; |
593 | } | 595 | } |
594 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 596 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
595 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 597 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
596 | } | 598 | } |
597 | if ( mess.left( 9 ) == "cal_alarm") { | 599 | if ( mess.left( 9 ) == "cal_alarm") { |
598 | mAlarmMessage = mess.mid( 9 ) ; | 600 | mAlarmMessage = mess.mid( 9 ) ; |
599 | } | 601 | } |
600 | 602 | ||
601 | startAlarm( mAlarmMessage, filename ); | 603 | startAlarm( mAlarmMessage, filename ); |
602 | 604 | ||
603 | 605 | ||
604 | } | 606 | } |
605 | 607 | ||
606 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 608 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
607 | { | 609 | { |
608 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 610 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
609 | 611 | ||
610 | mSuspendAlarmNotification = noti; | 612 | mSuspendAlarmNotification = noti; |
611 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 613 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
612 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 614 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
613 | mSuspendTimer->start( ms , true ); | 615 | mSuspendTimer->start( ms , true ); |
@@ -2557,384 +2559,398 @@ void CalendarView::todoAdded(Todo * t) | |||
2557 | } | 2559 | } |
2558 | void CalendarView::todoChanged(Todo * t) | 2560 | void CalendarView::todoChanged(Todo * t) |
2559 | { | 2561 | { |
2560 | emit todoModified( t, 4 ); | 2562 | emit todoModified( t, 4 ); |
2561 | // updateTodoViews(); | 2563 | // updateTodoViews(); |
2562 | } | 2564 | } |
2563 | void CalendarView::todoToBeDeleted(Todo *) | 2565 | void CalendarView::todoToBeDeleted(Todo *) |
2564 | { | 2566 | { |
2565 | //qDebug("todoToBeDeleted(Todo *) "); | 2567 | //qDebug("todoToBeDeleted(Todo *) "); |
2566 | updateTodoViews(); | 2568 | updateTodoViews(); |
2567 | } | 2569 | } |
2568 | void CalendarView::todoDeleted() | 2570 | void CalendarView::todoDeleted() |
2569 | { | 2571 | { |
2570 | //qDebug(" todoDeleted()"); | 2572 | //qDebug(" todoDeleted()"); |
2571 | updateTodoViews(); | 2573 | updateTodoViews(); |
2572 | } | 2574 | } |
2573 | 2575 | ||
2574 | 2576 | ||
2575 | 2577 | ||
2576 | void CalendarView::newTodo() | 2578 | void CalendarView::newTodo() |
2577 | { | 2579 | { |
2578 | 2580 | ||
2579 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); | 2581 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); |
2580 | if ( mFilterView->filtersEnabled() ) { | 2582 | if ( mFilterView->filtersEnabled() ) { |
2581 | CalFilter *filter = mFilterView->selectedFilter(); | 2583 | CalFilter *filter = mFilterView->selectedFilter(); |
2582 | if (filter && filter->showCategories()) { | 2584 | if (filter && filter->showCategories()) { |
2583 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2585 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2584 | } | 2586 | } |
2585 | if ( filter ) | 2587 | if ( filter ) |
2586 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2588 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2587 | } | 2589 | } |
2588 | showTodoEditor(); | 2590 | showTodoEditor(); |
2589 | } | 2591 | } |
2590 | 2592 | ||
2591 | void CalendarView::newSubTodo() | 2593 | void CalendarView::newSubTodo() |
2592 | { | 2594 | { |
2593 | Todo *todo = selectedTodo(); | 2595 | Todo *todo = selectedTodo(); |
2594 | if ( todo ) newSubTodo( todo ); | 2596 | if ( todo ) newSubTodo( todo ); |
2595 | } | 2597 | } |
2596 | 2598 | ||
2597 | void CalendarView::newSubTodo(Todo *parentEvent) | 2599 | void CalendarView::newSubTodo(Todo *parentEvent) |
2598 | { | 2600 | { |
2599 | 2601 | ||
2600 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | 2602 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); |
2601 | showTodoEditor(); | 2603 | showTodoEditor(); |
2602 | } | 2604 | } |
2603 | 2605 | ||
2604 | void CalendarView::newFloatingEvent() | 2606 | void CalendarView::newFloatingEvent() |
2605 | { | 2607 | { |
2606 | DateList tmpList = mNavigator->selectedDates(); | 2608 | DateList tmpList = mNavigator->selectedDates(); |
2607 | QDate date = tmpList.first(); | 2609 | QDate date = tmpList.first(); |
2608 | 2610 | ||
2609 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2611 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2610 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2612 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2611 | } | 2613 | } |
2612 | 2614 | ||
2613 | 2615 | ||
2614 | void CalendarView::editEvent( Event *event ) | 2616 | void CalendarView::editEvent( Event *event ) |
2615 | { | 2617 | { |
2616 | 2618 | ||
2617 | if ( !event ) return; | 2619 | if ( !event ) return; |
2618 | if ( event->isReadOnly() ) { | 2620 | if ( event->isReadOnly() ) { |
2619 | showEvent( event ); | 2621 | showEvent( event ); |
2620 | return; | 2622 | return; |
2621 | } | 2623 | } |
2622 | mEventEditor->editEvent( event , mFlagEditDescription); | 2624 | mEventEditor->editEvent( event , mFlagEditDescription); |
2623 | showEventEditor(); | 2625 | showEventEditor(); |
2624 | } | 2626 | } |
2625 | void CalendarView::editJournal( Journal *jour ) | 2627 | void CalendarView::editJournal( Journal *jour ) |
2626 | { | 2628 | { |
2627 | if ( !jour ) return; | 2629 | if ( !jour ) return; |
2628 | mDialogManager->hideSearchDialog(); | 2630 | mDialogManager->hideSearchDialog(); |
2629 | mViewManager->showJournalView(); | 2631 | mViewManager->showJournalView(); |
2630 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2632 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2631 | } | 2633 | } |
2632 | void CalendarView::editTodo( Todo *todo ) | 2634 | void CalendarView::editTodo( Todo *todo ) |
2633 | { | 2635 | { |
2634 | if ( !todo ) return; | 2636 | if ( !todo ) return; |
2635 | 2637 | ||
2636 | if ( todo->isReadOnly() ) { | 2638 | if ( todo->isReadOnly() ) { |
2637 | showTodo( todo ); | 2639 | showTodo( todo ); |
2638 | return; | 2640 | return; |
2639 | } | 2641 | } |
2640 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2642 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2641 | showTodoEditor(); | 2643 | showTodoEditor(); |
2642 | 2644 | ||
2643 | } | 2645 | } |
2644 | 2646 | ||
2645 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2647 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2646 | { | 2648 | { |
2647 | if ( !mEventViewerDialog ) { | 2649 | if ( !mEventViewerDialog ) { |
2648 | mEventViewerDialog = new KOEventViewerDialog(this); | 2650 | mEventViewerDialog = new KOEventViewerDialog(this); |
2649 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2651 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2650 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2652 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2651 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2653 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2652 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2654 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2653 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2655 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2654 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2656 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2655 | mEventViewerDialog->resize( 640, 480 ); | 2657 | mEventViewerDialog->resize( 640, 480 ); |
2656 | 2658 | ||
2657 | } | 2659 | } |
2658 | return mEventViewerDialog; | 2660 | return mEventViewerDialog; |
2659 | } | 2661 | } |
2660 | void CalendarView::showEvent(Event *event) | 2662 | void CalendarView::showEvent(Event *event) |
2661 | { | 2663 | { |
2662 | getEventViewerDialog()->setEvent(event); | 2664 | getEventViewerDialog()->setEvent(event); |
2663 | getEventViewerDialog()->showMe(); | 2665 | getEventViewerDialog()->showMe(); |
2664 | } | 2666 | } |
2665 | 2667 | ||
2666 | void CalendarView::showTodo(Todo *event) | 2668 | void CalendarView::showTodo(Todo *event) |
2667 | { | 2669 | { |
2668 | getEventViewerDialog()->setTodo(event); | 2670 | getEventViewerDialog()->setTodo(event); |
2669 | getEventViewerDialog()->showMe(); | 2671 | getEventViewerDialog()->showMe(); |
2670 | } | 2672 | } |
2671 | void CalendarView::showJournal( Journal *jour ) | 2673 | void CalendarView::showJournal( Journal *jour ) |
2672 | { | 2674 | { |
2673 | getEventViewerDialog()->setJournal(jour); | 2675 | getEventViewerDialog()->setJournal(jour); |
2674 | getEventViewerDialog()->showMe(); | 2676 | getEventViewerDialog()->showMe(); |
2675 | 2677 | ||
2676 | } | 2678 | } |
2677 | // void CalendarView::todoModified (Todo *event, int changed) | 2679 | // void CalendarView::todoModified (Todo *event, int changed) |
2678 | // { | 2680 | // { |
2679 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2681 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2680 | // // kdDebug() << "Todo modified and open" << endl; | 2682 | // // kdDebug() << "Todo modified and open" << endl; |
2681 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2683 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2682 | // // temp->modified (changed); | 2684 | // // temp->modified (changed); |
2683 | 2685 | ||
2684 | // // } | 2686 | // // } |
2685 | 2687 | ||
2686 | // mViewManager->updateView(); | 2688 | // mViewManager->updateView(); |
2687 | // } | 2689 | // } |
2688 | 2690 | ||
2689 | void CalendarView::appointment_show() | 2691 | void CalendarView::appointment_show() |
2690 | { | 2692 | { |
2691 | Event *anEvent = 0; | 2693 | Event *anEvent = 0; |
2692 | 2694 | ||
2693 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2695 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2694 | 2696 | ||
2695 | if (mViewManager->currentView()->isEventView()) { | 2697 | if (mViewManager->currentView()->isEventView()) { |
2696 | if ( incidence && incidence->type() == "Event" ) { | 2698 | if ( incidence && incidence->type() == "Event" ) { |
2697 | anEvent = static_cast<Event *>(incidence); | 2699 | anEvent = static_cast<Event *>(incidence); |
2698 | } | 2700 | } |
2699 | } | 2701 | } |
2700 | 2702 | ||
2701 | if (!anEvent) { | 2703 | if (!anEvent) { |
2702 | KNotifyClient::beep(); | 2704 | KNotifyClient::beep(); |
2703 | return; | 2705 | return; |
2704 | } | 2706 | } |
2705 | 2707 | ||
2706 | showEvent(anEvent); | 2708 | showEvent(anEvent); |
2707 | } | 2709 | } |
2708 | 2710 | ||
2709 | void CalendarView::appointment_edit() | 2711 | void CalendarView::appointment_edit() |
2710 | { | 2712 | { |
2711 | Event *anEvent = 0; | 2713 | Event *anEvent = 0; |
2712 | 2714 | ||
2713 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2715 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2714 | 2716 | ||
2715 | if (mViewManager->currentView()->isEventView()) { | 2717 | if (mViewManager->currentView()->isEventView()) { |
2716 | if ( incidence && incidence->type() == "Event" ) { | 2718 | if ( incidence && incidence->type() == "Event" ) { |
2717 | anEvent = static_cast<Event *>(incidence); | 2719 | anEvent = static_cast<Event *>(incidence); |
2718 | } | 2720 | } |
2719 | } | 2721 | } |
2720 | 2722 | ||
2721 | if (!anEvent) { | 2723 | if (!anEvent) { |
2722 | KNotifyClient::beep(); | 2724 | KNotifyClient::beep(); |
2723 | return; | 2725 | return; |
2724 | } | 2726 | } |
2725 | 2727 | ||
2726 | editEvent(anEvent); | 2728 | editEvent(anEvent); |
2727 | } | 2729 | } |
2728 | 2730 | ||
2729 | void CalendarView::appointment_delete() | 2731 | void CalendarView::appointment_delete() |
2730 | { | 2732 | { |
2731 | Event *anEvent = 0; | 2733 | Event *anEvent = 0; |
2732 | 2734 | ||
2733 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2735 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2734 | 2736 | ||
2735 | if (mViewManager->currentView()->isEventView()) { | 2737 | if (mViewManager->currentView()->isEventView()) { |
2736 | if ( incidence && incidence->type() == "Event" ) { | 2738 | if ( incidence && incidence->type() == "Event" ) { |
2737 | anEvent = static_cast<Event *>(incidence); | 2739 | anEvent = static_cast<Event *>(incidence); |
2738 | } | 2740 | } |
2739 | } | 2741 | } |
2740 | 2742 | ||
2741 | if (!anEvent) { | 2743 | if (!anEvent) { |
2742 | KNotifyClient::beep(); | 2744 | KNotifyClient::beep(); |
2743 | return; | 2745 | return; |
2744 | } | 2746 | } |
2745 | 2747 | ||
2746 | deleteEvent(anEvent); | 2748 | deleteEvent(anEvent); |
2747 | } | 2749 | } |
2748 | 2750 | ||
2751 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | ||
2752 | { | ||
2753 | if (!sub) return; | ||
2754 | if (!parent) return; | ||
2755 | if ( sub->relatedTo() ) | ||
2756 | sub->relatedTo()->removeRelation(sub); | ||
2757 | sub->setRelatedTo(parent); | ||
2758 | sub->setRelatedToUid(parent->uid()); | ||
2759 | parent->addRelation(sub); | ||
2760 | sub->updated(); | ||
2761 | parent->updated(); | ||
2762 | setModified(true); | ||
2763 | updateView(); | ||
2764 | } | ||
2749 | void CalendarView::todo_unsub(Todo *anTodo ) | 2765 | void CalendarView::todo_unsub(Todo *anTodo ) |
2750 | { | 2766 | { |
2751 | // Todo *anTodo = selectedTodo(); | 2767 | // Todo *anTodo = selectedTodo(); |
2752 | if (!anTodo) return; | 2768 | if (!anTodo) return; |
2753 | if (!anTodo->relatedTo()) return; | 2769 | if (!anTodo->relatedTo()) return; |
2754 | anTodo->relatedTo()->removeRelation(anTodo); | 2770 | anTodo->relatedTo()->removeRelation(anTodo); |
2755 | anTodo->setRelatedTo(0); | 2771 | anTodo->setRelatedTo(0); |
2756 | anTodo->updated(); | 2772 | anTodo->updated(); |
2757 | anTodo->setRelatedToUid(""); | 2773 | anTodo->setRelatedToUid(""); |
2758 | setModified(true); | 2774 | setModified(true); |
2759 | updateView(); | 2775 | updateView(); |
2760 | } | 2776 | } |
2761 | 2777 | ||
2762 | void CalendarView::deleteTodo(Todo *todo) | 2778 | void CalendarView::deleteTodo(Todo *todo) |
2763 | { | 2779 | { |
2764 | if (!todo) { | 2780 | if (!todo) { |
2765 | KNotifyClient::beep(); | 2781 | KNotifyClient::beep(); |
2766 | return; | 2782 | return; |
2767 | } | 2783 | } |
2768 | if (KOPrefs::instance()->mConfirm) { | 2784 | if (KOPrefs::instance()->mConfirm) { |
2769 | switch (msgItemDelete()) { | 2785 | switch (msgItemDelete()) { |
2770 | case KMessageBox::Continue: // OK | 2786 | case KMessageBox::Continue: // OK |
2771 | if (!todo->relations().isEmpty()) { | 2787 | if (!todo->relations().isEmpty()) { |
2772 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2788 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2773 | i18n("Delete To-Do")); | 2789 | i18n("Delete To-Do")); |
2774 | } else { | 2790 | } else { |
2775 | checkExternalId( todo ); | 2791 | checkExternalId( todo ); |
2776 | calendar()->deleteTodo(todo); | 2792 | calendar()->deleteTodo(todo); |
2777 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2793 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2778 | updateView(); | 2794 | updateView(); |
2779 | } | 2795 | } |
2780 | break; | 2796 | break; |
2781 | } // switch | 2797 | } // switch |
2782 | } else { | 2798 | } else { |
2783 | if (!todo->relations().isEmpty()) { | 2799 | if (!todo->relations().isEmpty()) { |
2784 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2800 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2785 | i18n("Delete To-Do")); | 2801 | i18n("Delete To-Do")); |
2786 | } else { | 2802 | } else { |
2787 | checkExternalId( todo ); | 2803 | checkExternalId( todo ); |
2788 | mCalendar->deleteTodo(todo); | 2804 | mCalendar->deleteTodo(todo); |
2789 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2805 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2790 | updateView(); | 2806 | updateView(); |
2791 | } | 2807 | } |
2792 | } | 2808 | } |
2793 | emit updateSearchDialog(); | 2809 | emit updateSearchDialog(); |
2794 | } | 2810 | } |
2795 | void CalendarView::deleteJournal(Journal *jour) | 2811 | void CalendarView::deleteJournal(Journal *jour) |
2796 | { | 2812 | { |
2797 | if (!jour) { | 2813 | if (!jour) { |
2798 | KNotifyClient::beep(); | 2814 | KNotifyClient::beep(); |
2799 | return; | 2815 | return; |
2800 | } | 2816 | } |
2801 | if (KOPrefs::instance()->mConfirm) { | 2817 | if (KOPrefs::instance()->mConfirm) { |
2802 | switch (msgItemDelete()) { | 2818 | switch (msgItemDelete()) { |
2803 | case KMessageBox::Continue: // OK | 2819 | case KMessageBox::Continue: // OK |
2804 | calendar()->deleteJournal(jour); | 2820 | calendar()->deleteJournal(jour); |
2805 | updateView(); | 2821 | updateView(); |
2806 | break; | 2822 | break; |
2807 | } // switch | 2823 | } // switch |
2808 | } else { | 2824 | } else { |
2809 | calendar()->deleteJournal(jour);; | 2825 | calendar()->deleteJournal(jour);; |
2810 | updateView(); | 2826 | updateView(); |
2811 | } | 2827 | } |
2812 | emit updateSearchDialog(); | 2828 | emit updateSearchDialog(); |
2813 | } | 2829 | } |
2814 | 2830 | ||
2815 | void CalendarView::deleteEvent(Event *anEvent) | 2831 | void CalendarView::deleteEvent(Event *anEvent) |
2816 | { | 2832 | { |
2817 | if (!anEvent) { | 2833 | if (!anEvent) { |
2818 | KNotifyClient::beep(); | 2834 | KNotifyClient::beep(); |
2819 | return; | 2835 | return; |
2820 | } | 2836 | } |
2821 | 2837 | ||
2822 | if (anEvent->recurrence()->doesRecur()) { | 2838 | if (anEvent->recurrence()->doesRecur()) { |
2823 | QDate itemDate = mViewManager->currentSelectionDate(); | 2839 | QDate itemDate = mViewManager->currentSelectionDate(); |
2824 | int km; | 2840 | int km; |
2825 | if (!itemDate.isValid()) { | 2841 | if (!itemDate.isValid()) { |
2826 | //kdDebug() << "Date Not Valid" << endl; | 2842 | //kdDebug() << "Date Not Valid" << endl; |
2827 | if (KOPrefs::instance()->mConfirm) { | 2843 | if (KOPrefs::instance()->mConfirm) { |
2828 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2844 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2829 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 2845 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
2830 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 2846 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
2831 | if ( km == KMessageBox::Continue ) | 2847 | if ( km == KMessageBox::Continue ) |
2832 | km = KMessageBox::No; // No = all below | 2848 | km = KMessageBox::No; // No = all below |
2833 | } else | 2849 | } else |
2834 | km = KMessageBox::No; | 2850 | km = KMessageBox::No; |
2835 | } else { | 2851 | } else { |
2836 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + | 2852 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + |
2837 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 2853 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
2838 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 2854 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
2839 | i18n("KO/Pi Confirmation"),i18n("Current"), | 2855 | i18n("KO/Pi Confirmation"),i18n("Current"), |
2840 | i18n("All")); | 2856 | i18n("All")); |
2841 | } | 2857 | } |
2842 | switch(km) { | 2858 | switch(km) { |
2843 | 2859 | ||
2844 | case KMessageBox::No: // Continue // all | 2860 | case KMessageBox::No: // Continue // all |
2845 | //qDebug("KMessageBox::No "); | 2861 | //qDebug("KMessageBox::No "); |
2846 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2862 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2847 | schedule(Scheduler::Cancel,anEvent); | 2863 | schedule(Scheduler::Cancel,anEvent); |
2848 | 2864 | ||
2849 | checkExternalId( anEvent); | 2865 | checkExternalId( anEvent); |
2850 | mCalendar->deleteEvent(anEvent); | 2866 | mCalendar->deleteEvent(anEvent); |
2851 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 2867 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
2852 | break; | 2868 | break; |
2853 | 2869 | ||
2854 | // Disabled because it does not work | 2870 | // Disabled because it does not work |
2855 | //#if 0 | 2871 | //#if 0 |
2856 | case KMessageBox::Yes: // just this one | 2872 | case KMessageBox::Yes: // just this one |
2857 | //QDate qd = mNavigator->selectedDates().first(); | 2873 | //QDate qd = mNavigator->selectedDates().first(); |
2858 | //if (!qd.isValid()) { | 2874 | //if (!qd.isValid()) { |
2859 | // kdDebug() << "no date selected, or invalid date" << endl; | 2875 | // kdDebug() << "no date selected, or invalid date" << endl; |
2860 | // KNotifyClient::beep(); | 2876 | // KNotifyClient::beep(); |
2861 | // return; | 2877 | // return; |
2862 | //} | 2878 | //} |
2863 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 2879 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
2864 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 2880 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
2865 | anEvent->addExDate(itemDate); | 2881 | anEvent->addExDate(itemDate); |
2866 | int duration = anEvent->recurrence()->duration(); | 2882 | int duration = anEvent->recurrence()->duration(); |
2867 | if ( duration > 0 ) { | 2883 | if ( duration > 0 ) { |
2868 | anEvent->recurrence()->setDuration( duration - 1 ); | 2884 | anEvent->recurrence()->setDuration( duration - 1 ); |
2869 | } | 2885 | } |
2870 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 2886 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
2871 | } | 2887 | } |
2872 | break; | 2888 | break; |
2873 | //#endif | 2889 | //#endif |
2874 | } // switch | 2890 | } // switch |
2875 | } else { | 2891 | } else { |
2876 | if (KOPrefs::instance()->mConfirm) { | 2892 | if (KOPrefs::instance()->mConfirm) { |
2877 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2893 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2878 | i18n("\nAre you sure you want\nto delete this event?"), | 2894 | i18n("\nAre you sure you want\nto delete this event?"), |
2879 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 2895 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
2880 | case KMessageBox::Continue: // OK | 2896 | case KMessageBox::Continue: // OK |
2881 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2897 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2882 | schedule(Scheduler::Cancel,anEvent); | 2898 | schedule(Scheduler::Cancel,anEvent); |
2883 | checkExternalId( anEvent); | 2899 | checkExternalId( anEvent); |
2884 | mCalendar->deleteEvent(anEvent); | 2900 | mCalendar->deleteEvent(anEvent); |
2885 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2901 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2886 | break; | 2902 | break; |
2887 | } // switch | 2903 | } // switch |
2888 | } else { | 2904 | } else { |
2889 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2905 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2890 | schedule(Scheduler::Cancel,anEvent); | 2906 | schedule(Scheduler::Cancel,anEvent); |
2891 | checkExternalId( anEvent); | 2907 | checkExternalId( anEvent); |
2892 | mCalendar->deleteEvent(anEvent); | 2908 | mCalendar->deleteEvent(anEvent); |
2893 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2909 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2894 | } | 2910 | } |
2895 | } // if-else | 2911 | } // if-else |
2896 | emit updateSearchDialog(); | 2912 | emit updateSearchDialog(); |
2897 | } | 2913 | } |
2898 | 2914 | ||
2899 | bool CalendarView::deleteEvent(const QString &uid) | 2915 | bool CalendarView::deleteEvent(const QString &uid) |
2900 | { | 2916 | { |
2901 | Event *ev = mCalendar->event(uid); | 2917 | Event *ev = mCalendar->event(uid); |
2902 | if (ev) { | 2918 | if (ev) { |
2903 | deleteEvent(ev); | 2919 | deleteEvent(ev); |
2904 | return true; | 2920 | return true; |
2905 | } else { | 2921 | } else { |
2906 | return false; | 2922 | return false; |
2907 | } | 2923 | } |
2908 | } | 2924 | } |
2909 | 2925 | ||
2910 | /*****************************************************************************/ | 2926 | /*****************************************************************************/ |
2911 | 2927 | ||
2912 | void CalendarView::action_mail() | 2928 | void CalendarView::action_mail() |
2913 | { | 2929 | { |
2914 | #ifndef KORG_NOMAIL | 2930 | #ifndef KORG_NOMAIL |
2915 | KOMailClient mailClient; | 2931 | KOMailClient mailClient; |
2916 | 2932 | ||
2917 | Incidence *incidence = currentSelection(); | 2933 | Incidence *incidence = currentSelection(); |
2918 | 2934 | ||
2919 | if (!incidence) { | 2935 | if (!incidence) { |
2920 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 2936 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2921 | return; | 2937 | return; |
2922 | } | 2938 | } |
2923 | if(incidence->attendeeCount() == 0 ) { | 2939 | if(incidence->attendeeCount() == 0 ) { |
2924 | KMessageBox::sorry(this, | 2940 | KMessageBox::sorry(this, |
2925 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 2941 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2926 | return; | 2942 | return; |
2927 | } | 2943 | } |
2928 | 2944 | ||
2929 | CalendarLocal cal_tmp; | 2945 | CalendarLocal cal_tmp; |
2930 | Event *event = 0; | 2946 | Event *event = 0; |
2931 | Event *ev = 0; | 2947 | Event *ev = 0; |
2932 | if ( incidence && incidence->type() == "Event" ) { | 2948 | if ( incidence && incidence->type() == "Event" ) { |
2933 | event = static_cast<Event *>(incidence); | 2949 | event = static_cast<Event *>(incidence); |
2934 | ev = new Event(*event); | 2950 | ev = new Event(*event); |
2935 | cal_tmp.addEvent(ev); | 2951 | cal_tmp.addEvent(ev); |
2936 | } | 2952 | } |
2937 | ICalFormat mForm(); | 2953 | ICalFormat mForm(); |
2938 | QString attachment = mForm.toString( &cal_tmp ); | 2954 | QString attachment = mForm.toString( &cal_tmp ); |
2939 | if (ev) delete(ev); | 2955 | if (ev) delete(ev); |
2940 | 2956 | ||