summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp60
-rw-r--r--korganizer/calendarview.h8
-rw-r--r--korganizer/koviewmanager.cpp10
3 files changed, 50 insertions, 28 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 697093e..776cdd3 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -275,470 +275,495 @@ class KOBeamPrefs : public QDialog
275 QDialog( parent, name, true ) 275 QDialog( parent, name, true )
276 { 276 {
277 setCaption( i18n("Beam Options") ); 277 setCaption( i18n("Beam Options") );
278 QVBoxLayout* lay = new QVBoxLayout( this ); 278 QVBoxLayout* lay = new QVBoxLayout( this );
279 lay->setSpacing( 3 ); 279 lay->setSpacing( 3 );
280 lay->setMargin( 3 ); 280 lay->setMargin( 3 );
281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
282 lay->addWidget( format ); 282 lay->addWidget( format );
283 format->setExclusive ( true ) ; 283 format->setExclusive ( true ) ;
284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
285 lay->addWidget( time ); time->setExclusive ( true ) ; 285 lay->addWidget( time ); time->setExclusive ( true ) ;
286 vcal = new QRadioButton(" vCalendar ", format ); 286 vcal = new QRadioButton(" vCalendar ", format );
287 ical = new QRadioButton(" iCalendar ", format ); 287 ical = new QRadioButton(" iCalendar ", format );
288 vcal->setChecked( true ); 288 vcal->setChecked( true );
289 tz = new QRadioButton(i18n(" With timezone "), time ); 289 tz = new QRadioButton(i18n(" With timezone "), time );
290 local = new QRadioButton(i18n(" Local time "), time ); 290 local = new QRadioButton(i18n(" Local time "), time );
291 tz->setChecked( true ); 291 tz->setChecked( true );
292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
293 lay->addWidget( ok ); 293 lay->addWidget( ok );
294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
295 lay->addWidget( cancel ); 295 lay->addWidget( cancel );
296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
298 resize( 200, 200 ); 298 resize( 200, 200 );
299 } 299 }
300 300
301 bool beamVcal() { return vcal->isChecked(); } 301 bool beamVcal() { return vcal->isChecked(); }
302 bool beamLocal() { return local->isChecked(); } 302 bool beamLocal() { return local->isChecked(); }
303private: 303private:
304 QRadioButton* vcal, *ical, *local, *tz; 304 QRadioButton* vcal, *ical, *local, *tz;
305}; 305};
306class KOCatPrefs : public QDialog 306class KOCatPrefs : public QDialog
307{ 307{
308 public: 308 public:
309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
310 QDialog( parent, name, true ) 310 QDialog( parent, name, true )
311 { 311 {
312 setCaption( i18n("Manage new Categories") ); 312 setCaption( i18n("Manage new Categories") );
313 QVBoxLayout* lay = new QVBoxLayout( this ); 313 QVBoxLayout* lay = new QVBoxLayout( this );
314 lay->setSpacing( 3 ); 314 lay->setSpacing( 3 );
315 lay->setMargin( 3 ); 315 lay->setMargin( 3 );
316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
317 lay->addWidget( lab ); 317 lay->addWidget( lab );
318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
319 lay->addWidget( format ); 319 lay->addWidget( format );
320 format->setExclusive ( true ) ; 320 format->setExclusive ( true ) ;
321 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 321 addCatBut = new QRadioButton(i18n("Add to category list"), format );
322 new QRadioButton(i18n("Remove from Events/Todos"), format ); 322 new QRadioButton(i18n("Remove from Events/Todos"), format );
323 addCatBut->setChecked( true ); 323 addCatBut->setChecked( true );
324 QPushButton * ok = new QPushButton( i18n("OK"), this ); 324 QPushButton * ok = new QPushButton( i18n("OK"), this );
325 lay->addWidget( ok ); 325 lay->addWidget( ok );
326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
327 lay->addWidget( cancel ); 327 lay->addWidget( cancel );
328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
330 resize( 200, 200 ); 330 resize( 200, 200 );
331 } 331 }
332 332
333 bool addCat() { return addCatBut->isChecked(); } 333 bool addCat() { return addCatBut->isChecked(); }
334private: 334private:
335 QRadioButton* addCatBut; 335 QRadioButton* addCatBut;
336}; 336};
337 337
338 338
339 339
340CalendarView::CalendarView( CalendarResources *calendar, 340CalendarView::CalendarView( CalendarResources *calendar,
341 QWidget *parent, const char *name ) 341 QWidget *parent, const char *name )
342 : CalendarViewBase( parent, name ), 342 : CalendarViewBase( parent, name ),
343 mCalendar( calendar ), 343 mCalendar( calendar ),
344 mResourceManager( calendar->resourceManager() ) 344 mResourceManager( calendar->resourceManager() )
345{ 345{
346 346
347 mEventEditor = 0; 347 mEventEditor = 0;
348 mTodoEditor = 0; 348 mTodoEditor = 0;
349 349
350 init(); 350 init();
351} 351}
352 352
353CalendarView::CalendarView( Calendar *calendar, 353CalendarView::CalendarView( Calendar *calendar,
354 QWidget *parent, const char *name ) 354 QWidget *parent, const char *name )
355 : CalendarViewBase( parent, name ), 355 : CalendarViewBase( parent, name ),
356 mCalendar( calendar ), 356 mCalendar( calendar ),
357 mResourceManager( 0 ) 357 mResourceManager( 0 )
358{ 358{
359 359
360 mEventEditor = 0; 360 mEventEditor = 0;
361 mTodoEditor = 0; 361 mTodoEditor = 0;
362 init(); 362 init();
363} 363}
364 364
365void CalendarView::init() 365void CalendarView::init()
366{ 366{
367 mNextAlarmDateTime = QDateTime::currentDateTime(); 367 mNextAlarmDateTime = QDateTime::currentDateTime();
368 setFocusPolicy ( NoFocus ); 368 setFocusPolicy ( NoFocus );
369 mViewerCallerIsSearchDialog = false; 369 mViewerCallerIsSearchDialog = false;
370 mBlockShowDates = false; 370 mBlockShowDates = false;
371 beamDialog = new KOBeamPrefs(); 371
372 mDatePickerMode = 0; 372 mDatePickerMode = 0;
373 mCurrentSyncDevice = ""; 373 mCurrentSyncDevice = "";
374 writeLocale();
375 mViewManager = new KOViewManager( this ); 374 mViewManager = new KOViewManager( this );
376 mDialogManager = new KODialogManager( this ); 375 mDialogManager = new KODialogManager( this );
377 mEventViewerDialog = 0; 376 mEventViewerDialog = 0;
378 mModified = false; 377 mModified = false;
379 mReadOnly = false; 378 mReadOnly = false;
380 mSelectedIncidence = 0; 379 mSelectedIncidence = 0;
381 mCalPrinter = 0; 380 mCalPrinter = 0;
382 mFilters.setAutoDelete(true); 381 mFilters.setAutoDelete(true);
383 382
384 mCalendar->registerObserver( this ); 383 mCalendar->registerObserver( this );
385 // TODO: Make sure that view is updated, when calendar is changed. 384 // TODO: Make sure that view is updated, when calendar is changed.
386 385
387 mStorage = new FileStorage( mCalendar ); 386 mStorage = new FileStorage( mCalendar );
388 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 387 mNavigator = new DateNavigator( this, "datevav", mViewManager );
389 388
390 QBoxLayout *topLayout = (QBoxLayout*)layout(); 389 QBoxLayout *topLayout = (QBoxLayout*)layout();
391#ifndef KORG_NOSPLITTER 390#ifndef KORG_NOSPLITTER
392 // create the main layout frames. 391 // create the main layout frames.
393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 392 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
394 topLayout->addWidget(mPanner); 393 topLayout->addWidget(mPanner);
395 394
396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 395 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
397 "CalendarView::LeftFrame"); 396 "CalendarView::LeftFrame");
398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 397 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
399 398
400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 399 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
401 "CalendarView::DateNavigator" ); 400 "CalendarView::DateNavigator" );
402 401
403 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 402 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
404 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 403 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
405 mTodoList->setNavigator( mNavigator ); 404 mTodoList->setNavigator( mNavigator );
406 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 405 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
407 406
408#ifdef KORG_NORESOURCEVIEW 407#ifdef KORG_NORESOURCEVIEW
409 mResourceView = 0; 408 mResourceView = 0;
410#else 409#else
411 if ( mResourceManager ) { 410 if ( mResourceManager ) {
412 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 411 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
413 mResourceView->updateView(); 412 mResourceView->updateView();
414 connect( mResourceView, SIGNAL( resourcesChanged() ), 413 connect( mResourceView, SIGNAL( resourcesChanged() ),
415 SLOT( updateView() ) ); 414 SLOT( updateView() ) );
416 } else { 415 } else {
417 mResourceView = 0; 416 mResourceView = 0;
418 } 417 }
419#endif 418#endif
420 QWidget *rightBox = new QWidget( mPanner ); 419 QWidget *rightBox = new QWidget( mPanner );
421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 420 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
422 421
423 mRightFrame = new QWidgetStack( rightBox ); 422 mRightFrame = new QWidgetStack( rightBox );
424 rightLayout->addWidget( mRightFrame, 1 ); 423 rightLayout->addWidget( mRightFrame, 1 );
425 424
426 mLeftFrame = mLeftSplitter; 425 mLeftFrame = mLeftSplitter;
427#else 426#else
428 //QWidget *mainBox = new QWidget( this ); 427 //QWidget *mainBox = new QWidget( this );
429 //QWidget *leftFrame = new QWidget( mainBox ); 428 //QWidget *leftFrame = new QWidget( mainBox );
430 //QBoxLayout * mainBoxLayout; 429 //QBoxLayout * mainBoxLayout;
431 if ( KOPrefs::instance()->mVerticalScreen ) { 430 if ( KOPrefs::instance()->mVerticalScreen ) {
432 //mainBoxLayout = new QVBoxLayout(mainBox); 431 //mainBoxLayout = new QVBoxLayout(mainBox);
433 //leftFrameLayout = new QHBoxLayout(leftFrame ); 432 //leftFrameLayout = new QHBoxLayout(leftFrame );
434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
438 } else { 437 } else {
439 //mainBoxLayout = new QHBoxLayout(mainBox); 438 //mainBoxLayout = new QHBoxLayout(mainBox);
440 //leftFrameLayout = new QVBoxLayout(leftFrame ); 439 //leftFrameLayout = new QVBoxLayout(leftFrame );
441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
445 } 444 }
446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
447 //QBoxLayout * leftFrameLayout; 446 //QBoxLayout * leftFrameLayout;
447 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
448 topLayout->addWidget( mMainFrame ); 448 topLayout->addWidget( mMainFrame );
449 topLayout->addWidget( mDateScrollBar );
449 //mainBoxLayout->addWidget (mLeftFrame); 450 //mainBoxLayout->addWidget (mLeftFrame);
450 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 451 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
451 "CalendarView::DateNavigator" ); 452 "CalendarView::DateNavigator" );
452#if 0 453#if 0
453 // FIXME 454 // FIXME
454 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 455 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
455 "CalendarView::DateNavigator", QDate::currentDate()); 456 "CalendarView::DateNavigator", QDate::currentDate());
456#endif 457#endif
457 // mDateNavigator->blockSignals( true ); 458 // mDateNavigator->blockSignals( true );
458 //leftFrameLayout->addWidget( mDateNavigator ); 459 //leftFrameLayout->addWidget( mDateNavigator );
459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 460 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 461 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 462 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
462 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 463 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
463 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 464 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 465 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 466 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
466 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 467 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
467 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 468 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
468 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 469 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
469 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 470 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
470 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 471 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
472 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
471 mTodoList->setNavigator( mNavigator ); 473 mTodoList->setNavigator( mNavigator );
472#if 0 474#if 0
473 if ( QApplication::desktop()->width() < 480 ) { 475 if ( QApplication::desktop()->width() < 480 ) {
474 leftFrameLayout->addWidget(mFilterView); 476 leftFrameLayout->addWidget(mFilterView);
475 leftFrameLayout->addWidget(mTodoList, 2 ); 477 leftFrameLayout->addWidget(mTodoList, 2 );
476 478
477 } else { 479 } else {
478 leftFrameLayout->addWidget(mTodoList,2 ); 480 leftFrameLayout->addWidget(mTodoList,2 );
479 leftFrameLayout->addWidget(mFilterView ); 481 leftFrameLayout->addWidget(mFilterView );
480 } 482 }
481#endif 483#endif
482 mFilterView->hide(); 484 mFilterView->hide();
483 mCalEditView->hide(); 485 mCalEditView->hide();
484 QWidget *rightBox = new QWidget( mMainFrame ); 486 QWidget *rightBox = new QWidget( mMainFrame );
485 //mainBoxLayout->addWidget ( rightBox, 10 ); 487 //mainBoxLayout->addWidget ( rightBox, 10 );
486 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 488 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
487 mRightFrame = new QWidgetStack( rightBox ); 489 mRightFrame = new QWidgetStack( rightBox );
488 rightLayout->addWidget( mRightFrame, 10 ); 490 rightLayout->addWidget( mRightFrame, 10 );
489 491
490 //mLeftFrame = (QWidget *)leftFrame; 492 //mLeftFrame = (QWidget *)leftFrame;
491 if ( KOPrefs::instance()->mVerticalScreen ) { 493 if ( KOPrefs::instance()->mVerticalScreen ) {
492 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 494 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
493 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 495 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
494 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 496 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
495 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 497 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
496 } else { 498 } else {
497 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 499 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
498 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 500 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
499 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 501 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
500 } 502 }
501 if ( !KOPrefs::instance()->mShowDateNavigator) 503 if ( !KOPrefs::instance()->mShowDateNavigator)
502 mDateNavigator->hide(); 504 mDateNavigator->hide();
503 //qDebug("Calendarview Size %d %d ", width(), height()); 505 //qDebug("Calendarview Size %d %d ", width(), height());
504#endif 506#endif
505 507
506 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 508 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
507 SLOT( showDates( const KCal::DateList & ) ) ); 509 SLOT( showDates( const KCal::DateList & ) ) );
508 510
509 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 511 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
510 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 512 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
511 513
512 514
513 515
514 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 516 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
515 mViewManager, SLOT( showMonth( const QDate & ) ) ); 517 mViewManager, SLOT( showMonth( const QDate & ) ) );
516 518
517 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 519 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
518 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 520 mNavigator, SLOT( selectWeek( const QDate & ) ) );
519 521
520 connect( mDateNavigator, SIGNAL( goPrevYear() ), 522 connect( mDateNavigator, SIGNAL( goPrevYear() ),
521 mNavigator, SLOT( selectPreviousYear() ) ); 523 mNavigator, SLOT( selectPreviousYear() ) );
522 connect( mDateNavigator, SIGNAL( goNextYear() ), 524 connect( mDateNavigator, SIGNAL( goNextYear() ),
523 mNavigator, SLOT( selectNextYear() ) ); 525 mNavigator, SLOT( selectNextYear() ) );
524 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 526 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
525 mNavigator, SLOT( selectPreviousMonth() ) ); 527 mNavigator, SLOT( selectPreviousMonth() ) );
526 connect( mDateNavigator, SIGNAL( goNextMonth() ), 528 connect( mDateNavigator, SIGNAL( goNextMonth() ),
527 mNavigator, SLOT( selectNextMonth() ) ); 529 mNavigator, SLOT( selectNextMonth() ) );
528 530
529 connect( mDateNavigator, SIGNAL( goPrevious() ), 531 connect( mDateNavigator, SIGNAL( goPrevious() ),
530 mNavigator, SLOT( selectPrevious() ) ); 532 mNavigator, SLOT( selectPrevious() ) );
531 connect( mDateNavigator, SIGNAL( goNext() ), 533 connect( mDateNavigator, SIGNAL( goNext() ),
532 mNavigator, SLOT( selectNext() ) ); 534 mNavigator, SLOT( selectNext() ) );
533 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 535 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
534 mNavigator, SLOT( slotMonthSelect( int ) ) ); 536 mNavigator, SLOT( slotMonthSelect( int ) ) );
535 537
536 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 538 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
537 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 539 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
538#if 0 540#if 0
539 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 541 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
540 SLOT( incidenceAdded( Incidence *) ) ); 542 SLOT( incidenceAdded( Incidence *) ) );
541#endif 543#endif
542 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 544 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
543 545
544 connect( this, SIGNAL( configChanged() ), 546 connect( this, SIGNAL( configChanged() ),
545 mDateNavigator, SLOT( updateConfig() ) ); 547 mDateNavigator, SLOT( updateConfig() ) );
546 548
547 connect( mTodoList, SIGNAL( newTodoSignal() ), 549 connect( mTodoList, SIGNAL( newTodoSignal() ),
548 SLOT( newTodo() ) ); 550 SLOT( newTodo() ) );
549 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 551 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
550 SLOT( newSubTodo( Todo * ) ) ); 552 SLOT( newSubTodo( Todo * ) ) );
551 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 553 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
552 SLOT( editTodo( Todo * ) ) ); 554 SLOT( editTodo( Todo * ) ) );
553 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 555 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
554 SLOT( showTodo( Todo *) ) ); 556 SLOT( showTodo( Todo *) ) );
555 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 557 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
556 SLOT( deleteTodo( Todo *) ) ); 558 SLOT( deleteTodo( Todo *) ) );
557 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 559 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
558 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 560 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
559 SLOT( purgeCompleted() ) ); 561 SLOT( purgeCompleted() ) );
560 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 562 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
561 SIGNAL( todoModified( Todo *, int ) ) ); 563 SIGNAL( todoModified( Todo *, int ) ) );
562 564
563 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 565 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
564 this, SLOT ( cloneIncidence( Incidence * ) ) ); 566 this, SLOT ( cloneIncidence( Incidence * ) ) );
565 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 567 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
566 this, SLOT (cancelIncidence( Incidence * ) ) ); 568 this, SLOT (cancelIncidence( Incidence * ) ) );
567 569
568 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 570 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
569 this, SLOT ( moveIncidence( Incidence * ) ) ); 571 this, SLOT ( moveIncidence( Incidence * ) ) );
570 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 572 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
571 this, SLOT ( beamIncidence( Incidence * ) ) ); 573 this, SLOT ( beamIncidence( Incidence * ) ) );
572 574
573 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 575 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
574 this, SLOT ( todo_unsub( Todo * ) ) ); 576 this, SLOT ( todo_unsub( Todo * ) ) );
575 577
576 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 578 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
577 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 579 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
578 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 580 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
579 SLOT( updateTodo( Todo *, int ) ) ); 581 SLOT( updateTodo( Todo *, int ) ) );
580 connect( this, SIGNAL( todoModified( Todo *, int )), this, 582 connect( this, SIGNAL( todoModified( Todo *, int )), this,
581 SLOT( changeTodoDisplay( Todo *, int ) ) ); 583 SLOT( changeTodoDisplay( Todo *, int ) ) );
582 584
583 585
584 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 586 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
585 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 587 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
586 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 588 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
587 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 589 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
588 590
589 591
590 592
591 593
592 594
593 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 595 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
594 SLOT(checkClipboard())); 596 SLOT(checkClipboard()));
595 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 597 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
596 SLOT( processTodoListSelection( Incidence * ) ) ); 598 SLOT( processTodoListSelection( Incidence * ) ) );
597 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 599 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
598 600
599 // kdDebug() << "CalendarView::CalendarView() done" << endl; 601 // kdDebug() << "CalendarView::CalendarView() done" << endl;
600 602
601 mDateFrame = new QVBox(0,0,WType_Popup); 603 mDateFrame = new QVBox(0,0,WType_Popup);
602 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 604 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
603 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 605 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
604 mDateFrame->setLineWidth(3); 606 mDateFrame->setLineWidth(3);
605 mDateFrame->hide(); 607 mDateFrame->hide();
606 mDateFrame->setCaption( i18n( "Pick a date to display")); 608 mDateFrame->setCaption( i18n( "Pick a date to display"));
607 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 609 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
608 610
609 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 611 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
610 612
611 mEventEditor = mDialogManager->getEventEditor(); 613 mEventEditor = mDialogManager->getEventEditor();
612 mTodoEditor = mDialogManager->getTodoEditor(); 614 mTodoEditor = mDialogManager->getTodoEditor();
613 615
614 mFlagEditDescription = false; 616 mFlagEditDescription = false;
615 617
616 mSuspendTimer = new QTimer( this ); 618 mSuspendTimer = new QTimer( this );
617 mAlarmTimer = new QTimer( this ); 619 mAlarmTimer = new QTimer( this );
618 mRecheckAlarmTimer = new QTimer( this ); 620 mRecheckAlarmTimer = new QTimer( this );
619 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 621 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
620 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 622 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
621 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 623 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
622 mAlarmDialog = new AlarmDialog( this ); 624 mAlarmDialog = new AlarmDialog( this );
623 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 625 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
624 mAlarmDialog->setServerNotification( false ); 626 mAlarmDialog->setServerNotification( false );
625 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 627 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
626 628
627 629
628#ifndef DESKTOP_VERSION 630#ifndef DESKTOP_VERSION
629//US listen for arriving address resultsets 631//US listen for arriving address resultsets
630 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 632 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
631 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 633 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
632#endif 634#endif
633 mDateNavigator->setCalendar( mCalendar ); 635 mDateNavigator->setCalendar( mCalendar );
634} 636}
635 637
636 638
637CalendarView::~CalendarView() 639CalendarView::~CalendarView()
638{ 640{
639 // kdDebug() << "~CalendarView()" << endl; 641 // kdDebug() << "~CalendarView()" << endl;
640 //qDebug("CalendarView::~CalendarView() "); 642 //qDebug("CalendarView::~CalendarView() ");
641 delete mDialogManager; 643 delete mDialogManager;
642 delete mViewManager; 644 delete mViewManager;
643 delete mStorage; 645 delete mStorage;
644 delete mDateFrame ; 646 delete mDateFrame ;
645 delete beamDialog;
646 delete mEventViewerDialog; 647 delete mEventViewerDialog;
647 //kdDebug() << "~CalendarView() done" << endl; 648 //kdDebug() << "~CalendarView() done" << endl;
648} 649}
650void CalendarView::setScrollBarStep(int val )
651{
652 mDateScrollBar->setLineStep ( val );
653}
654void CalendarView::scrollBarValue(int val )
655{
656 static bool block = false;
657 if ( block ) return;
658 block = true;
659 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
660 //qDebug("VAL %d ",val );
661 int count = mNavigator->selectedDates().count();
662 int year = mNavigator->selectedDates().first().year();
663 int day = mNavigator->selectedDates().first().dayOfYear();
664 if ( val == day -1 ) {
665 block = false;
666 return;
667 }
668 QDate d ( year,1,1 );
669 mNavigator->selectDates( d.addDays( val ), count );
670 block = false;
671
672}
673
649void CalendarView::checkAlarms() 674void CalendarView::checkAlarms()
650{ 675{
651 KConfig *config = KOGlobals::config(); 676 KConfig *config = KOGlobals::config();
652 config->setGroup( "AppRun" ); 677 config->setGroup( "AppRun" );
653 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 678 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
654 int daysto = dt.daysTo( QDate::currentDate() ); 679 int daysto = dt.daysTo( QDate::currentDate() );
655 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 680 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
656 dt = dt.addDays( days ); 681 dt = dt.addDays( days );
657 int secto = dt.secsTo( QDateTime::currentDateTime() ); 682 int secto = dt.secsTo( QDateTime::currentDateTime() );
658 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 683 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
659 //qDebug("KO: Reading program stop %d ", secs); 684 //qDebug("KO: Reading program stop %d ", secs);
660 //secs -= ( 3600 * 24*3 ); // debug only 685 //secs -= ( 3600 * 24*3 ); // debug only
661 QDateTime latest = dt.addSecs ( secs ); 686 QDateTime latest = dt.addSecs ( secs );
662 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 687 qDebug("KO: Last termination on %s ", latest.toString().latin1());
663 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 688 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
664 QPtrList<Incidence> el = mCalendar->rawIncidences(); 689 QPtrList<Incidence> el = mCalendar->rawIncidences();
665 QPtrList<Incidence> al; 690 QPtrList<Incidence> al;
666 Incidence* inL = el.first(); 691 Incidence* inL = el.first();
667 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 692 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
668 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 693 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
669 while ( inL ) { 694 while ( inL ) {
670 bool ok = false; 695 bool ok = false;
671 int offset = 0; 696 int offset = 0;
672 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 697 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
673 if ( ok ) { 698 if ( ok ) {
674 //qDebug("OK %s",next.toString().latin1()); 699 //qDebug("OK %s",next.toString().latin1());
675 if ( next < cur ) { 700 if ( next < cur ) {
676 al.append( inL ); 701 al.append( inL );
677 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 702 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
678 } 703 }
679 } 704 }
680 inL = el.next(); 705 inL = el.next();
681 } 706 }
682 if ( al.count() ) { 707 if ( al.count() ) {
683 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 708 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
684 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 709 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
685 QVBoxLayout* lay = new QVBoxLayout( dia ); 710 QVBoxLayout* lay = new QVBoxLayout( dia );
686 lay->setSpacing( 0 ); 711 lay->setSpacing( 0 );
687 lay->setMargin( 0 ); 712 lay->setMargin( 0 );
688 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 713 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
689 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 714 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
690 lay->addWidget( matb ); 715 lay->addWidget( matb );
691 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 716 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
692 int wid = 210; 717 int wid = 210;
693 int x = QApplication::desktop()->width() - wid - 7; 718 int x = QApplication::desktop()->width() - wid - 7;
694 int y = QApplication::desktop()->height() - wid - 70; 719 int y = QApplication::desktop()->height() - wid - 70;
695 dia->setGeometry ( x,y,wid,wid); 720 dia->setGeometry ( x,y,wid,wid);
696 } else { 721 } else {
697 int si = 220; 722 int si = 220;
698 if ( QApplication::desktop()->width() > 470 ) 723 if ( QApplication::desktop()->width() > 470 )
699 si = 400; 724 si = 400;
700 dia->resize(si,si/2); 725 dia->resize(si,si/2);
701 } 726 }
702 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 727 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
703 dia->show(); 728 dia->show();
704 729
705 } 730 }
706} 731}
707void CalendarView::showDay( QDate d ) 732void CalendarView::showDay( QDate d )
708{ 733{
709 dateNavigator()->blockSignals( true ); 734 dateNavigator()->blockSignals( true );
710 dateNavigator()->selectDate( d ); 735 dateNavigator()->selectDate( d );
711 dateNavigator()->blockSignals( false ); 736 dateNavigator()->blockSignals( false );
712 mViewManager->showDayView(); 737 mViewManager->showDayView();
713 //dateNavigator()->selectDate( d ); 738 //dateNavigator()->selectDate( d );
714} 739}
715void CalendarView::timerAlarm() 740void CalendarView::timerAlarm()
716{ 741{
717 //qDebug("CalendarView::timerAlarm() "); 742 //qDebug("CalendarView::timerAlarm() ");
718 computeAlarm(mAlarmNotification ); 743 computeAlarm(mAlarmNotification );
719} 744}
720 745
721void CalendarView::suspendAlarm() 746void CalendarView::suspendAlarm()
722{ 747{
723 //qDebug(" CalendarView::suspendAlarm() "); 748 //qDebug(" CalendarView::suspendAlarm() ");
724 computeAlarm(mSuspendAlarmNotification ); 749 computeAlarm(mSuspendAlarmNotification );
725 750
726} 751}
727 752
728void CalendarView::startAlarm( QString mess , QString filename) 753void CalendarView::startAlarm( QString mess , QString filename)
729{ 754{
730 755
731 topLevelWidget()->showNormal(); 756 topLevelWidget()->showNormal();
732 topLevelWidget()->setActiveWindow(); 757 topLevelWidget()->setActiveWindow();
733 topLevelWidget()->raise(); 758 topLevelWidget()->raise();
734 759
735 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 760 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
736 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 761 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
737 762
738} 763}
739 764
740void CalendarView::checkNextTimerAlarm() 765void CalendarView::checkNextTimerAlarm()
741{ 766{
742 mCalendar->checkAlarmForIncidence( 0, true ); 767 mCalendar->checkAlarmForIncidence( 0, true );
743} 768}
744 769
@@ -2374,302 +2399,285 @@ void CalendarView::writeSettings()
2374#endif 2399#endif
2375 2400
2376 2401
2377 config->sync(); 2402 config->sync();
2378} 2403}
2379 2404
2380void CalendarView::readFilterSettings(KConfig *config) 2405void CalendarView::readFilterSettings(KConfig *config)
2381{ 2406{
2382 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2407 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2383 2408
2384 mFilters.clear(); 2409 mFilters.clear();
2385 2410
2386 config->setGroup("General"); 2411 config->setGroup("General");
2387 QStringList filterList = config->readListEntry("CalendarFilters"); 2412 QStringList filterList = config->readListEntry("CalendarFilters");
2388 2413
2389 QStringList::ConstIterator it = filterList.begin(); 2414 QStringList::ConstIterator it = filterList.begin();
2390 QStringList::ConstIterator end = filterList.end(); 2415 QStringList::ConstIterator end = filterList.end();
2391 while(it != end) { 2416 while(it != end) {
2392 // kdDebug() << " filter: " << (*it) << endl; 2417 // kdDebug() << " filter: " << (*it) << endl;
2393 2418
2394 CalFilter *filter; 2419 CalFilter *filter;
2395 filter = new CalFilter(*it); 2420 filter = new CalFilter(*it);
2396 config->setGroup("Filter_" + (*it).utf8()); 2421 config->setGroup("Filter_" + (*it).utf8());
2397 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2422 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2398 filter->setCriteria(config->readNumEntry("Criteria",0)); 2423 filter->setCriteria(config->readNumEntry("Criteria",0));
2399 filter->setCategoryList(config->readListEntry("CategoryList")); 2424 filter->setCategoryList(config->readListEntry("CategoryList"));
2400 mFilters.append(filter); 2425 mFilters.append(filter);
2401 2426
2402 ++it; 2427 ++it;
2403 } 2428 }
2404 2429
2405 if (mFilters.count() == 0) { 2430 if (mFilters.count() == 0) {
2406 CalFilter *filter = new CalFilter(i18n("Default")); 2431 CalFilter *filter = new CalFilter(i18n("Default"));
2407 mFilters.append(filter); 2432 mFilters.append(filter);
2408 } 2433 }
2409 mFilterView->updateFilters(); 2434 mFilterView->updateFilters();
2410 config->setGroup("FilterView"); 2435 config->setGroup("FilterView");
2411 2436
2412 mFilterView->blockSignals(true); 2437 mFilterView->blockSignals(true);
2413 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2438 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2414 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2439 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2415 mFilterView->blockSignals(false); 2440 mFilterView->blockSignals(false);
2416 // We do it manually to avoid it being done twice by the above calls 2441 // We do it manually to avoid it being done twice by the above calls
2417 updateFilter(); 2442 updateFilter();
2418} 2443}
2419 2444
2420void CalendarView::writeFilterSettings(KConfig *config) 2445void CalendarView::writeFilterSettings(KConfig *config)
2421{ 2446{
2422 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2447 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2423 2448
2424 QStringList filterList; 2449 QStringList filterList;
2425 2450
2426 CalFilter *filter = mFilters.first(); 2451 CalFilter *filter = mFilters.first();
2427 while(filter) { 2452 while(filter) {
2428 // kdDebug() << " fn: " << filter->name() << endl; 2453 // kdDebug() << " fn: " << filter->name() << endl;
2429 filterList << filter->name(); 2454 filterList << filter->name();
2430 config->setGroup("Filter_" + filter->name().utf8()); 2455 config->setGroup("Filter_" + filter->name().utf8());
2431 config->writeEntry("Criteria",filter->criteria()); 2456 config->writeEntry("Criteria",filter->criteria());
2432 config->writeEntry("CategoryList",filter->categoryList()); 2457 config->writeEntry("CategoryList",filter->categoryList());
2433 filter = mFilters.next(); 2458 filter = mFilters.next();
2434 } 2459 }
2435 config->setGroup("General"); 2460 config->setGroup("General");
2436 config->writeEntry("CalendarFilters",filterList); 2461 config->writeEntry("CalendarFilters",filterList);
2437 2462
2438 config->setGroup("FilterView"); 2463 config->setGroup("FilterView");
2439 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2464 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2440 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2465 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2441} 2466}
2442 2467
2443 2468
2444void CalendarView::goToday() 2469void CalendarView::goToday()
2445{ 2470{
2446 if ( mViewManager->currentView()->isMonthView() ) 2471 if ( mViewManager->currentView()->isMonthView() )
2447 mNavigator->selectTodayMonth(); 2472 mNavigator->selectTodayMonth();
2448 else 2473 else
2449 mNavigator->selectToday(); 2474 mNavigator->selectToday();
2450} 2475}
2451 2476
2452void CalendarView::goNext() 2477void CalendarView::goNext()
2453{ 2478{
2454 mNavigator->selectNext(); 2479 mNavigator->selectNext();
2455} 2480}
2456 2481
2457void CalendarView::goPrevious() 2482void CalendarView::goPrevious()
2458{ 2483{
2459 mNavigator->selectPrevious(); 2484 mNavigator->selectPrevious();
2460} 2485}
2461void CalendarView::goNextMonth() 2486void CalendarView::goNextMonth()
2462{ 2487{
2463 mNavigator->selectNextMonth(); 2488 mNavigator->selectNextMonth();
2464} 2489}
2465 2490
2466void CalendarView::goPreviousMonth() 2491void CalendarView::goPreviousMonth()
2467{ 2492{
2468 mNavigator->selectPreviousMonth(); 2493 mNavigator->selectPreviousMonth();
2469} 2494}
2470void CalendarView::writeLocale() 2495
2471{
2472 //KPimGlobalPrefs::instance()->setGlobalConfig();
2473#if 0
2474 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2475 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2476 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2477 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2478 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2479 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2480 dummy = KOPrefs::instance()->mUserDateFormatShort;
2481 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2482 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2483 KOPrefs::instance()->mDaylightsavingStart,
2484 KOPrefs::instance()->mDaylightsavingEnd );
2485 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2486#endif
2487}
2488void CalendarView::updateConfig() 2496void CalendarView::updateConfig()
2489{ 2497{
2490 writeLocale();
2491 if ( KOPrefs::instance()->mUseAppColors ) 2498 if ( KOPrefs::instance()->mUseAppColors )
2492 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2499 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2493 emit configChanged(); 2500 emit configChanged();
2494 mTodoList->updateConfig(); 2501 mTodoList->updateConfig();
2495 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2502 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2496 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2503 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2497 // To make the "fill window" configurations work 2504 // To make the "fill window" configurations work
2498 //mViewManager->raiseCurrentView(); 2505 //mViewManager->raiseCurrentView();
2499} 2506}
2500 2507
2501 2508
2502void CalendarView::eventChanged(Event *event) 2509void CalendarView::eventChanged(Event *event)
2503{ 2510{
2504 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2511 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2505 //updateUnmanagedViews(); 2512 //updateUnmanagedViews();
2506} 2513}
2507 2514
2508void CalendarView::eventAdded(Event *event) 2515void CalendarView::eventAdded(Event *event)
2509{ 2516{
2510 changeEventDisplay(event,KOGlobals::EVENTADDED); 2517 changeEventDisplay(event,KOGlobals::EVENTADDED);
2511} 2518}
2512 2519
2513void CalendarView::eventToBeDeleted(Event *) 2520void CalendarView::eventToBeDeleted(Event *)
2514{ 2521{
2515 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2522 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2516} 2523}
2517 2524
2518void CalendarView::eventDeleted() 2525void CalendarView::eventDeleted()
2519{ 2526{
2520 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2527 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2521} 2528}
2522void CalendarView::changeTodoDisplay(Todo *which, int action) 2529void CalendarView::changeTodoDisplay(Todo *which, int action)
2523{ 2530{
2524 changeIncidenceDisplay((Incidence *)which, action); 2531 changeIncidenceDisplay((Incidence *)which, action);
2525 mDateNavigator->updateView(); //LR 2532 mDateNavigator->updateView(); //LR
2526 //mDialogManager->updateSearchDialog(); 2533 //mDialogManager->updateSearchDialog();
2527 2534
2528 if (which) { 2535 if (which) {
2529 mViewManager->updateWNview(); 2536 mViewManager->updateWNview();
2530 //mTodoList->updateView(); 2537 //mTodoList->updateView();
2531 } 2538 }
2532 2539
2533} 2540}
2534 2541
2535void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2542void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2536{ 2543{
2537 updateUnmanagedViews(); 2544 updateUnmanagedViews();
2538 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2545 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2539 if ( action == KOGlobals::EVENTDELETED ) { //delete 2546 if ( action == KOGlobals::EVENTDELETED ) { //delete
2540 mCalendar->checkAlarmForIncidence( 0, true ); 2547 mCalendar->checkAlarmForIncidence( 0, true );
2541 if ( mEventViewerDialog ) 2548 if ( mEventViewerDialog )
2542 mEventViewerDialog->hide(); 2549 mEventViewerDialog->hide();
2543 } 2550 }
2544 else 2551 else
2545 mCalendar->checkAlarmForIncidence( which , false ); 2552 mCalendar->checkAlarmForIncidence( which , false );
2546} 2553}
2547 2554
2548// most of the changeEventDisplays() right now just call the view's 2555// most of the changeEventDisplays() right now just call the view's
2549// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2556// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2550void CalendarView::changeEventDisplay(Event *which, int action) 2557void CalendarView::changeEventDisplay(Event *which, int action)
2551{ 2558{
2552 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2559 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2553 changeIncidenceDisplay((Incidence *)which, action); 2560 changeIncidenceDisplay((Incidence *)which, action);
2554 mDateNavigator->updateView(); 2561 mDateNavigator->updateView();
2555 //mDialogManager->updateSearchDialog(); 2562 //mDialogManager->updateSearchDialog();
2556 2563
2557 if (which) { 2564 if (which) {
2558 // If there is an event view visible update the display 2565 // If there is an event view visible update the display
2559 mViewManager->currentView()->changeEventDisplay(which,action); 2566 mViewManager->currentView()->changeEventDisplay(which,action);
2560 // TODO: check, if update needed 2567 // TODO: check, if update needed
2561 // if (which->getTodoStatus()) { 2568 // if (which->getTodoStatus()) {
2562 mTodoList->updateView(); 2569 mTodoList->updateView();
2563 // } 2570 // }
2564 } else { 2571 } else {
2565 mViewManager->currentView()->updateView(); 2572 mViewManager->currentView()->updateView();
2566 } 2573 }
2567} 2574}
2568 2575
2569 2576
2570void CalendarView::updateTodoViews() 2577void CalendarView::updateTodoViews()
2571{ 2578{
2572 mTodoList->updateView(); 2579 mTodoList->updateView();
2573 mViewManager->currentView()->updateView(); 2580 mViewManager->currentView()->updateView();
2574 2581
2575} 2582}
2576 2583
2577 2584
2578void CalendarView::updateView(const QDate &start, const QDate &end) 2585void CalendarView::updateView(const QDate &start, const QDate &end)
2579{ 2586{
2587 mDateScrollBar->setValue( start.dayOfYear()-1);
2580 mTodoList->updateView(); 2588 mTodoList->updateView();
2581 mViewManager->updateView(start, end); 2589 mViewManager->updateView(start, end);
2582 //mDateNavigator->updateView(); 2590 //mDateNavigator->updateView();
2583} 2591}
2584 2592
2585void CalendarView::clearAllViews() 2593void CalendarView::clearAllViews()
2586{ 2594{
2587 mTodoList->clearList(); 2595 mTodoList->clearList();
2588 mViewManager->clearAllViews(); 2596 mViewManager->clearAllViews();
2589 SearchDialog * sd = mDialogManager->getSearchDialog(); 2597 SearchDialog * sd = mDialogManager->getSearchDialog();
2590 if ( sd ) { 2598 if ( sd ) {
2591 KOListView* kol = sd->listview(); 2599 KOListView* kol = sd->listview();
2592 if ( kol ) 2600 if ( kol )
2593 kol->clearList(); 2601 kol->clearList();
2594 } 2602 }
2595} 2603}
2596void CalendarView::updateView() 2604void CalendarView::updateView()
2597{ 2605{
2598 DateList tmpList = mNavigator->selectedDates(); 2606 DateList tmpList = mNavigator->selectedDates();
2599 2607
2600 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2608 if ( KOPrefs::instance()->mHideNonStartedTodos )
2601 mTodoList->updateView(); 2609 mTodoList->updateView();
2602 // We assume that the navigator only selects consecutive days. 2610 // We assume that the navigator only selects consecutive days.
2603 updateView( tmpList.first(), tmpList.last() ); 2611 updateView( tmpList.first(), tmpList.last() );
2604} 2612}
2605 2613
2606void CalendarView::updateUnmanagedViews() 2614void CalendarView::updateUnmanagedViews()
2607{ 2615{
2608 mDateNavigator->updateDayMatrix(); 2616 mDateNavigator->updateDayMatrix();
2609} 2617}
2610 2618
2611int CalendarView::msgItemDelete(const QString name) 2619int CalendarView::msgItemDelete(const QString name)
2612{ 2620{
2613 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2621 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2614 i18n("This item will be\npermanently deleted."), 2622 i18n("This item will be\npermanently deleted."),
2615 i18n("KO/Pi Confirmation"),i18n("Delete")); 2623 i18n("KO/Pi Confirmation"),i18n("Delete"));
2616} 2624}
2617 2625
2618 2626
2619void CalendarView::edit_cut() 2627void CalendarView::edit_cut()
2620{ 2628{
2621 Event *anEvent=0; 2629 Event *anEvent=0;
2622 2630
2623 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2631 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2624 2632
2625 if (mViewManager->currentView()->isEventView()) { 2633 if (mViewManager->currentView()->isEventView()) {
2626 if ( incidence && incidence->typeID() == eventID ) { 2634 if ( incidence && incidence->typeID() == eventID ) {
2627 anEvent = static_cast<Event *>(incidence); 2635 anEvent = static_cast<Event *>(incidence);
2628 } 2636 }
2629 } 2637 }
2630 2638
2631 if (!anEvent) { 2639 if (!anEvent) {
2632 KNotifyClient::beep(); 2640 KNotifyClient::beep();
2633 return; 2641 return;
2634 } 2642 }
2635 DndFactory factory( mCalendar ); 2643 DndFactory factory( mCalendar );
2636 factory.cutIncidence(anEvent); 2644 factory.cutIncidence(anEvent);
2637 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2645 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2638} 2646}
2639 2647
2640void CalendarView::edit_copy() 2648void CalendarView::edit_copy()
2641{ 2649{
2642 Event *anEvent=0; 2650 Event *anEvent=0;
2643 2651
2644 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2652 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2645 2653
2646 if (mViewManager->currentView()->isEventView()) { 2654 if (mViewManager->currentView()->isEventView()) {
2647 if ( incidence && incidence->typeID() == eventID ) { 2655 if ( incidence && incidence->typeID() == eventID ) {
2648 anEvent = static_cast<Event *>(incidence); 2656 anEvent = static_cast<Event *>(incidence);
2649 } 2657 }
2650 } 2658 }
2651 2659
2652 if (!anEvent) { 2660 if (!anEvent) {
2653 KNotifyClient::beep(); 2661 KNotifyClient::beep();
2654 return; 2662 return;
2655 } 2663 }
2656 DndFactory factory( mCalendar ); 2664 DndFactory factory( mCalendar );
2657 factory.copyIncidence(anEvent); 2665 factory.copyIncidence(anEvent);
2658} 2666}
2659 2667
2660void CalendarView::edit_paste() 2668void CalendarView::edit_paste()
2661{ 2669{
2662 QDate date = mNavigator->selectedDates().first(); 2670 QDate date = mNavigator->selectedDates().first();
2663 2671
2664 DndFactory factory( mCalendar ); 2672 DndFactory factory( mCalendar );
2665 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2673 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2666 2674
2667 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2675 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2668} 2676}
2669void CalendarView::edit_global_options() 2677void CalendarView::edit_global_options()
2670{ 2678{
2671 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2679 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2672 emit save(); 2680 emit save();
2673 emit saveStopTimer(); 2681 emit saveStopTimer();
2674 mDialogManager->showGlobalOptionsDialog(); 2682 mDialogManager->showGlobalOptionsDialog();
2675 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2683 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
@@ -2751,229 +2759,231 @@ void CalendarView::slotSelectPickerDate( QDate d)
2751} 2759}
2752 2760
2753void CalendarView::removeCategories() 2761void CalendarView::removeCategories()
2754{ 2762{
2755 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2763 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2756 QStringList catList = KOPrefs::instance()->mCustomCategories; 2764 QStringList catList = KOPrefs::instance()->mCustomCategories;
2757 QStringList catIncList; 2765 QStringList catIncList;
2758 QStringList newCatList; 2766 QStringList newCatList;
2759 Incidence* inc = incList.first(); 2767 Incidence* inc = incList.first();
2760 int i; 2768 int i;
2761 int count = 0; 2769 int count = 0;
2762 while ( inc ) { 2770 while ( inc ) {
2763 newCatList.clear(); 2771 newCatList.clear();
2764 catIncList = inc->categories() ; 2772 catIncList = inc->categories() ;
2765 for( i = 0; i< catIncList.count(); ++i ) { 2773 for( i = 0; i< catIncList.count(); ++i ) {
2766 if ( catList.contains (catIncList[i])) 2774 if ( catList.contains (catIncList[i]))
2767 newCatList.append( catIncList[i] ); 2775 newCatList.append( catIncList[i] );
2768 } 2776 }
2769 newCatList.sort(); 2777 newCatList.sort();
2770 inc->setCategories( newCatList.join(",") ); 2778 inc->setCategories( newCatList.join(",") );
2771 inc = incList.next(); 2779 inc = incList.next();
2772 } 2780 }
2773} 2781}
2774 2782
2775int CalendarView::addCategories() 2783int CalendarView::addCategories()
2776{ 2784{
2777 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2785 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2778 QStringList catList = KOPrefs::instance()->mCustomCategories; 2786 QStringList catList = KOPrefs::instance()->mCustomCategories;
2779 QStringList catIncList; 2787 QStringList catIncList;
2780 Incidence* inc = incList.first(); 2788 Incidence* inc = incList.first();
2781 int i; 2789 int i;
2782 int count = 0; 2790 int count = 0;
2783 while ( inc ) { 2791 while ( inc ) {
2784 catIncList = inc->categories() ; 2792 catIncList = inc->categories() ;
2785 for( i = 0; i< catIncList.count(); ++i ) { 2793 for( i = 0; i< catIncList.count(); ++i ) {
2786 if ( !catList.contains (catIncList[i])) { 2794 if ( !catList.contains (catIncList[i])) {
2787 catList.append( catIncList[i] ); 2795 catList.append( catIncList[i] );
2788 //qDebug("add cat %s ", catIncList[i].latin1()); 2796 //qDebug("add cat %s ", catIncList[i].latin1());
2789 ++count; 2797 ++count;
2790 } 2798 }
2791 } 2799 }
2792 inc = incList.next(); 2800 inc = incList.next();
2793 } 2801 }
2794 catList.sort(); 2802 catList.sort();
2795 KOPrefs::instance()->mCustomCategories = catList; 2803 KOPrefs::instance()->mCustomCategories = catList;
2796 return count; 2804 return count;
2797} 2805}
2798 2806
2799void CalendarView::manageCategories() 2807void CalendarView::manageCategories()
2800{ 2808{
2801 KOCatPrefs* cp = new KOCatPrefs(); 2809 KOCatPrefs* cp = new KOCatPrefs();
2802 cp->show(); 2810 cp->show();
2803 int w =cp->sizeHint().width() ; 2811 int w =cp->sizeHint().width() ;
2804 int h = cp->sizeHint().height() ; 2812 int h = cp->sizeHint().height() ;
2805 int dw = QApplication::desktop()->width(); 2813 int dw = QApplication::desktop()->width();
2806 int dh = QApplication::desktop()->height(); 2814 int dh = QApplication::desktop()->height();
2807 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2815 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2808 if ( !cp->exec() ) { 2816 if ( !cp->exec() ) {
2809 delete cp; 2817 delete cp;
2810 return; 2818 return;
2811 } 2819 }
2812 int count = 0; 2820 int count = 0;
2813 if ( cp->addCat() ) { 2821 if ( cp->addCat() ) {
2814 count = addCategories(); 2822 count = addCategories();
2815 if ( count ) { 2823 if ( count ) {
2816 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2824 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2817 writeSettings(); 2825 writeSettings();
2818 } else 2826 } else
2819 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2827 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2820 } else { 2828 } else {
2821 removeCategories(); 2829 removeCategories();
2822 updateView(); 2830 updateView();
2823 } 2831 }
2824 delete cp; 2832 delete cp;
2825} 2833}
2826 2834
2827void CalendarView::beamIncidence(Incidence * Inc) 2835void CalendarView::beamIncidence(Incidence * Inc)
2828{ 2836{
2829 QPtrList<Incidence> delSel ; 2837 QPtrList<Incidence> delSel ;
2830 delSel.append(Inc); 2838 delSel.append(Inc);
2831 beamIncidenceList( delSel ); 2839 beamIncidenceList( delSel );
2832} 2840}
2833void CalendarView::beamCalendar() 2841void CalendarView::beamCalendar()
2834{ 2842{
2835 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2843 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2836 //qDebug("beamCalendar() "); 2844 //qDebug("beamCalendar() ");
2837 beamIncidenceList( delSel ); 2845 beamIncidenceList( delSel );
2838} 2846}
2839void CalendarView::beamFilteredCalendar() 2847void CalendarView::beamFilteredCalendar()
2840{ 2848{
2841 QPtrList<Incidence> delSel = mCalendar->incidences(); 2849 QPtrList<Incidence> delSel = mCalendar->incidences();
2842 //qDebug("beamFilteredCalendar() "); 2850 //qDebug("beamFilteredCalendar() ");
2843 beamIncidenceList( delSel ); 2851 beamIncidenceList( delSel );
2844} 2852}
2845void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2853void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2846{ 2854{
2847 if ( beamDialog->exec () == QDialog::Rejected ) 2855
2856 KOBeamPrefs beamDialog;
2857 if ( beamDialog.exec () == QDialog::Rejected )
2848 return; 2858 return;
2849#ifdef DESKTOP_VERSION 2859#ifdef DESKTOP_VERSION
2850 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2860 QString fn = locateLocal( "tmp", "kopibeamfile" );
2851#else 2861#else
2852 QString fn = "/tmp/kopibeamfile"; 2862 QString fn = "/tmp/kopibeamfile";
2853#endif 2863#endif
2854 QString mes; 2864 QString mes;
2855 bool createbup = true; 2865 bool createbup = true;
2856 if ( createbup ) { 2866 if ( createbup ) {
2857 QString description = "\n"; 2867 QString description = "\n";
2858 CalendarLocal* cal = new CalendarLocal(); 2868 CalendarLocal* cal = new CalendarLocal();
2859 if ( beamDialog->beamLocal() ) 2869 if ( beamDialog.beamLocal() )
2860 cal->setLocalTime(); 2870 cal->setLocalTime();
2861 else 2871 else
2862 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2872 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2863 Incidence *incidence = delSel.first(); 2873 Incidence *incidence = delSel.first();
2864 bool addText = false; 2874 bool addText = false;
2865 if ( delSel.count() < 10 ) 2875 if ( delSel.count() < 10 )
2866 addText = true; 2876 addText = true;
2867 else { 2877 else {
2868 description.sprintf(i18n(" %d items?"),delSel.count() ); 2878 description.sprintf(i18n(" %d items?"),delSel.count() );
2869 } 2879 }
2870 while ( incidence ) { 2880 while ( incidence ) {
2871 Incidence *in = incidence->clone(); 2881 Incidence *in = incidence->clone();
2872 if ( ! in->summary().isEmpty() ) { 2882 if ( ! in->summary().isEmpty() ) {
2873 in->setDescription(""); 2883 in->setDescription("");
2874 } else { 2884 } else {
2875 in->setSummary( in->description().left(20)); 2885 in->setSummary( in->description().left(20));
2876 in->setDescription(""); 2886 in->setDescription("");
2877 } 2887 }
2878 if ( addText ) 2888 if ( addText )
2879 description += in->summary() + "\n"; 2889 description += in->summary() + "\n";
2880 cal->addIncidence( in ); 2890 cal->addIncidence( in );
2881 incidence = delSel.next(); 2891 incidence = delSel.next();
2882 } 2892 }
2883 if ( beamDialog->beamVcal() ) { 2893 if ( beamDialog.beamVcal() ) {
2884 fn += ".vcs"; 2894 fn += ".vcs";
2885 FileStorage storage( cal, fn, new VCalFormat ); 2895 FileStorage storage( cal, fn, new VCalFormat );
2886 storage.save(); 2896 storage.save();
2887 } else { 2897 } else {
2888 fn += ".ics"; 2898 fn += ".ics";
2889 FileStorage storage( cal, fn, new ICalFormat( ) ); 2899 FileStorage storage( cal, fn, new ICalFormat( ) );
2890 storage.save(); 2900 storage.save();
2891 } 2901 }
2892 delete cal; 2902 delete cal;
2893 mes = i18n("KO/Pi: Ready for beaming"); 2903 mes = i18n("KO/Pi: Ready for beaming");
2894 topLevelWidget()->setCaption(mes); 2904 topLevelWidget()->setCaption(mes);
2895 KApplication::convert2latin1( fn ); 2905 KApplication::convert2latin1( fn );
2896#ifndef DESKTOP_VERSION 2906#ifndef DESKTOP_VERSION
2897 Ir *ir = new Ir( this ); 2907 Ir *ir = new Ir( this );
2898 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2908 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2899 ir->send( fn, description, "text/x-vCalendar" ); 2909 ir->send( fn, description, "text/x-vCalendar" );
2900#endif 2910#endif
2901 } 2911 }
2902} 2912}
2903void CalendarView::beamDone( Ir *ir ) 2913void CalendarView::beamDone( Ir *ir )
2904{ 2914{
2905#ifndef DESKTOP_VERSION 2915#ifndef DESKTOP_VERSION
2906 delete ir; 2916 delete ir;
2907#endif 2917#endif
2908 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2918 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2909 topLevelWidget()->raise(); 2919 topLevelWidget()->raise();
2910} 2920}
2911 2921
2912void CalendarView::moveIncidence(Incidence * inc ) 2922void CalendarView::moveIncidence(Incidence * inc )
2913{ 2923{
2914 if ( !inc ) return; 2924 if ( !inc ) return;
2915 showDatePickerPopup(); 2925 showDatePickerPopup();
2916 mDatePickerMode = 2; 2926 mDatePickerMode = 2;
2917 mMoveIncidence = inc ; 2927 mMoveIncidence = inc ;
2918 QDate da; 2928 QDate da;
2919 if ( mMoveIncidence->typeID() == todoID ) { 2929 if ( mMoveIncidence->typeID() == todoID ) {
2920 Todo * to = (Todo *) mMoveIncidence; 2930 Todo * to = (Todo *) mMoveIncidence;
2921 if ( to->hasDueDate() ) 2931 if ( to->hasDueDate() )
2922 da = to->dtDue().date(); 2932 da = to->dtDue().date();
2923 else 2933 else
2924 da = QDate::currentDate(); 2934 da = QDate::currentDate();
2925 } else { 2935 } else {
2926 da = mMoveIncidence->dtStart().date(); 2936 da = mMoveIncidence->dtStart().date();
2927 } 2937 }
2928 //PENDING set date for recurring incidence to date of recurrence 2938 //PENDING set date for recurring incidence to date of recurrence
2929 //mMoveIncidenceOldDate; 2939 //mMoveIncidenceOldDate;
2930 mDatePicker->setDate( da ); 2940 mDatePicker->setDate( da );
2931} 2941}
2932void CalendarView::showDatePickerPopup() 2942void CalendarView::showDatePickerPopup()
2933{ 2943{
2934 if ( mDateFrame->isVisible() ) 2944 if ( mDateFrame->isVisible() )
2935 mDateFrame->hide(); 2945 mDateFrame->hide();
2936 else { 2946 else {
2937 int offX = 0, offY = 0; 2947 int offX = 0, offY = 0;
2938#ifdef DESKTOP_VERSION 2948#ifdef DESKTOP_VERSION
2939 int w =mDatePicker->sizeHint().width() ; 2949 int w =mDatePicker->sizeHint().width() ;
2940 int h = mDatePicker->sizeHint().height() ; 2950 int h = mDatePicker->sizeHint().height() ;
2941 int dw = topLevelWidget()->width(); 2951 int dw = topLevelWidget()->width();
2942 int dh = topLevelWidget()->height(); 2952 int dh = topLevelWidget()->height();
2943 offX = topLevelWidget()->x(); 2953 offX = topLevelWidget()->x();
2944 offY = topLevelWidget()->y(); 2954 offY = topLevelWidget()->y();
2945#else 2955#else
2946 int w =mDatePicker->sizeHint().width() ; 2956 int w =mDatePicker->sizeHint().width() ;
2947 int h = mDatePicker->sizeHint().height() ; 2957 int h = mDatePicker->sizeHint().height() ;
2948 int dw = QApplication::desktop()->width(); 2958 int dw = QApplication::desktop()->width();
2949 int dh = QApplication::desktop()->height(); 2959 int dh = QApplication::desktop()->height();
2950#endif 2960#endif
2951 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 2961 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2952 mDateFrame->show(); 2962 mDateFrame->show();
2953 } 2963 }
2954} 2964}
2955void CalendarView::showDatePicker( ) 2965void CalendarView::showDatePicker( )
2956{ 2966{
2957 showDatePickerPopup(); 2967 showDatePickerPopup();
2958 mDatePickerMode = 1; 2968 mDatePickerMode = 1;
2959 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2969 mDatePicker->setDate( mNavigator->selectedDates().first() );
2960} 2970}
2961 2971
2962void CalendarView::showEventEditor() 2972void CalendarView::showEventEditor()
2963{ 2973{
2964#ifdef DESKTOP_VERSION 2974#ifdef DESKTOP_VERSION
2965 int x,y,w,h; 2975 int x,y,w,h;
2966 x = mEventEditor->geometry().x(); 2976 x = mEventEditor->geometry().x();
2967 y = mEventEditor->geometry().y(); 2977 y = mEventEditor->geometry().y();
2968 w = mEventEditor->width(); 2978 w = mEventEditor->width();
2969 h = mEventEditor->height(); 2979 h = mEventEditor->height();
2970 mEventEditor->show(); 2980 mEventEditor->show();
2971 mEventEditor->setGeometry(x,y,w,h); 2981 mEventEditor->setGeometry(x,y,w,h);
2972#else 2982#else
2973 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2983 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2974 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2984 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2975 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2985 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2976 qApp->processEvents(); 2986 qApp->processEvents();
2977 delete mEventEditor; 2987 delete mEventEditor;
2978 mEventEditor = mDialogManager->getEventEditor(); 2988 mEventEditor = mDialogManager->getEventEditor();
2979 topLevelWidget()->setCaption( i18n("") ); 2989 topLevelWidget()->setCaption( i18n("") );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index be18e8f..c89bbf7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,128 +1,129 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#include <qscrollbar.h>
33#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 35#include <qtopia/ir.h>
35#else 36#else
36#define Ir char 37#define Ir char
37#endif 38#endif
38#include <libkcal/calendar.h> 39#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 40#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
42#include <KDGanttMinimizeSplitter.h> 43#include <KDGanttMinimizeSplitter.h>
43 44
44#include <korganizer/calendarviewbase.h> 45#include <korganizer/calendarviewbase.h>
45 46
46#include <ksyncmanager.h> 47#include <ksyncmanager.h>
47//#include <koprefs.h> 48//#include <koprefs.h>
48 49
49class QWidgetStack; 50class QWidgetStack;
50class QSplitter; 51class QSplitter;
51class KopiCalendarFile; 52class KopiCalendarFile;
52class CalPrinter; 53class CalPrinter;
53class KOFilterView; 54class KOFilterView;
54class KOCalEditView; 55class KOCalEditView;
55class KOViewManager; 56class KOViewManager;
56class KODialogManager; 57class KODialogManager;
57class KOTodoView; 58class KOTodoView;
58class KDateNavigator; 59class KDateNavigator;
59class DateNavigatorContainer; 60class DateNavigatorContainer;
60class DateNavigator; 61class DateNavigator;
61class KOIncidenceEditor; 62class KOIncidenceEditor;
62class KDatePicker; 63class KDatePicker;
63class ResourceView; 64class ResourceView;
64class KOEventEditor; 65class KOEventEditor;
65class KOTodoEditor ; 66class KOTodoEditor ;
66class KOEventViewerDialog; 67class KOEventViewerDialog;
67class KOBeamPrefs; 68class KOBeamPrefs;
68class KSyncProfile; 69class KSyncProfile;
69class AlarmDialog; 70class AlarmDialog;
70class KCal::Attendee; 71class KCal::Attendee;
71 72
72namespace KCal { class FileStorage; } 73namespace KCal { class FileStorage; }
73 74
74using namespace KCal; 75using namespace KCal;
75 76
76/** 77/**
77 This is the main calendar widget. It provides the different vies on t he 78 This is the main calendar widget. It provides the different vies on t he
78 calendar data as well as the date navigator. It also handles synchronisation 79 calendar data as well as the date navigator. It also handles synchronisation
79 of the different views and controls the different dialogs like preferences, 80 of the different views and controls the different dialogs like preferences,
80 event editor, search dialog etc. 81 event editor, search dialog etc.
81 82
82 @short main calendar view widget 83 @short main calendar view widget
83 @author Cornelius Schumacher 84 @author Cornelius Schumacher
84*/ 85*/
85 86
86#include <qtextbrowser.h> 87#include <qtextbrowser.h>
87#include <qtextcodec.h> 88#include <qtextcodec.h>
88 89
89class MissedAlarmTextBrowser : public QTextBrowser { 90class MissedAlarmTextBrowser : public QTextBrowser {
90 Q_OBJECT 91 Q_OBJECT
91 public: 92 public:
92 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); 93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
93 ~MissedAlarmTextBrowser(); 94 ~MissedAlarmTextBrowser();
94 void setSource(const QString & n); 95 void setSource(const QString & n);
95 96
96 private: 97 private:
97 Incidence * getNextInc(QDateTime start ); 98 Incidence * getNextInc(QDateTime start );
98 QPtrList<Incidence> mAlarms; 99 QPtrList<Incidence> mAlarms;
99 signals: 100 signals:
100 void showIncidence( QString uid); 101 void showIncidence( QString uid);
101}; 102};
102 103
103 104
104class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
105{ 106{
106 Q_OBJECT 107 Q_OBJECT
107 public: 108 public:
108 /** 109 /**
109 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
110 111
111 @param calendar calendar document 112 @param calendar calendar document
112 @param parent parent window 113 @param parent parent window
113 @param name Qt internal widget object name 114 @param name Qt internal widget object name
114 */ 115 */
115 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
116 const char *name = 0 ); 117 const char *name = 0 );
117 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
118 const char *name = 0 ); 119 const char *name = 0 );
119 virtual ~CalendarView(); 120 virtual ~CalendarView();
120 121
121 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
122 123
123 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
124 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
125 126
126 QDate startDate(); 127 QDate startDate();
127 QDate endDate(); 128 QDate endDate();
128 129
@@ -399,254 +400,255 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
399 400
400 /** Take ownership of all events in calendar. */ 401 /** Take ownership of all events in calendar. */
401 void takeOverCalendar(); 402 void takeOverCalendar();
402 403
403 /** query whether or not the calendar is "dirty". */ 404 /** query whether or not the calendar is "dirty". */
404 bool isModified(); 405 bool isModified();
405 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 406 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
406 void setModified(bool modified=true); 407 void setModified(bool modified=true);
407 408
408 /** query if the calendar is read-only. */ 409 /** query if the calendar is read-only. */
409 bool isReadOnly(); 410 bool isReadOnly();
410 /** set state of calendar to read-only */ 411 /** set state of calendar to read-only */
411 void setReadOnly(bool readOnly=true); 412 void setReadOnly(bool readOnly=true);
412 413
413 void eventUpdated(Incidence *); 414 void eventUpdated(Incidence *);
414 415
415 /* iTIP scheduling actions */ 416 /* iTIP scheduling actions */
416 void schedule_publish(Incidence *incidence = 0); 417 void schedule_publish(Incidence *incidence = 0);
417 void schedule_request(Incidence *incidence = 0); 418 void schedule_request(Incidence *incidence = 0);
418 void schedule_refresh(Incidence *incidence = 0); 419 void schedule_refresh(Incidence *incidence = 0);
419 void schedule_cancel(Incidence *incidence = 0); 420 void schedule_cancel(Incidence *incidence = 0);
420 void schedule_add(Incidence *incidence = 0); 421 void schedule_add(Incidence *incidence = 0);
421 void schedule_reply(Incidence *incidence = 0); 422 void schedule_reply(Incidence *incidence = 0);
422 void schedule_counter(Incidence *incidence = 0); 423 void schedule_counter(Incidence *incidence = 0);
423 void schedule_declinecounter(Incidence *incidence = 0); 424 void schedule_declinecounter(Incidence *incidence = 0);
424 void schedule_publish_freebusy(int daysToPublish = 30); 425 void schedule_publish_freebusy(int daysToPublish = 30);
425 426
426 void openAddressbook(); 427 void openAddressbook();
427 428
428 void editFilters(); 429 void editFilters();
429 void toggleFilerEnabled(); 430 void toggleFilerEnabled();
430 QPtrList<CalFilter> filters(); 431 QPtrList<CalFilter> filters();
431 void toggleFilter(); 432 void toggleFilter();
432 void showFilter(bool visible); 433 void showFilter(bool visible);
433 void updateFilter(); 434 void updateFilter();
434 void filterEdited(); 435 void filterEdited();
435 void selectFilter( int ); 436 void selectFilter( int );
436 KOFilterView *filterView(); 437 KOFilterView *filterView();
437 438
438 void showIntro(); 439 void showIntro();
439 440
440 /** Move the curdatepient view date to today */ 441 /** Move the curdatepient view date to today */
441 void goToday(); 442 void goToday();
442 443
443 /** Move to the next date(s) in the current view */ 444 /** Move to the next date(s) in the current view */
444 void goNext(); 445 void goNext();
445 446
446 /** Move to the previous date(s) in the current view */ 447 /** Move to the previous date(s) in the current view */
447 void goPrevious(); 448 void goPrevious();
448 /** Move to the next date(s) in the current view */ 449 /** Move to the next date(s) in the current view */
449 void goNextMonth(); 450 void goNextMonth();
450 451
451 /** Move to the previous date(s) in the current view */ 452 /** Move to the previous date(s) in the current view */
452 void goPreviousMonth(); 453 void goPreviousMonth();
453 454
454 void toggleExpand(); 455 void toggleExpand();
455 void toggleDateNavigatorWidget(); 456 void toggleDateNavigatorWidget();
456 void toggleAllDaySize(); 457 void toggleAllDaySize();
457 void dialogClosing(Incidence *); 458 void dialogClosing(Incidence *);
458 459
459 /** Look for new messages in the inbox */ 460 /** Look for new messages in the inbox */
460 void lookForIncomingMessages(); 461 void lookForIncomingMessages();
461 /** Look for new messages in the outbox */ 462 /** Look for new messages in the outbox */
462 void lookForOutgoingMessages(); 463 void lookForOutgoingMessages();
463 464
464 void processMainViewSelection( Incidence * ); 465 void processMainViewSelection( Incidence * );
465 void processTodoListSelection( Incidence * ); 466 void processTodoListSelection( Incidence * );
466 467
467 void processIncidenceSelection( Incidence * ); 468 void processIncidenceSelection( Incidence * );
468 469
469 void purgeCompleted(); 470 void purgeCompleted();
470 bool removeCompletedSubTodos( Todo* ); 471 bool removeCompletedSubTodos( Todo* );
471 void slotCalendarChanged(); 472 void slotCalendarChanged();
472 bool importBday(); 473 bool importBday();
473 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
474 bool importQtopia( const QString &categoriesFile, 475 bool importQtopia( const QString &categoriesFile,
475 const QString &datebookFile, 476 const QString &datebookFile,
476 const QString &tasklistFile ); 477 const QString &tasklistFile );
477 void syncExternal( int mode ); 478 void syncExternal( int mode );
478 void slotSelectPickerDate( QDate ) ; 479 void slotSelectPickerDate( QDate ) ;
479 void showDatePicker() ; 480 void showDatePicker() ;
480 void showDatePickerPopup() ; 481 void showDatePickerPopup() ;
481 void moveIncidence(Incidence *) ; 482 void moveIncidence(Incidence *) ;
482 void beamIncidence(Incidence *) ; 483 void beamIncidence(Incidence *) ;
483 void beamCalendar() ; 484 void beamCalendar() ;
484 void beamFilteredCalendar() ; 485 void beamFilteredCalendar() ;
485 void beamIncidenceList(QPtrList<Incidence>) ; 486 void beamIncidenceList(QPtrList<Incidence>) ;
486 void manageCategories(); 487 void manageCategories();
487 int addCategories(); 488 int addCategories();
488 void removeCategories(); 489 void removeCategories();
489 void setSyncDevice( QString ); 490 void setSyncDevice( QString );
490 void setSyncName( QString ); 491 void setSyncName( QString );
491 void showDay( QDate ); 492 void showDay( QDate );
492 void undo_delete(); 493 void undo_delete();
493 protected slots: 494 protected slots:
494 void resetFocus(); 495 void resetFocus();
496 void scrollBarValue(int);
495 void slotViewerClosed(); 497 void slotViewerClosed();
496 void timerAlarm(); 498 void timerAlarm();
497 void suspendAlarm(); 499 void suspendAlarm();
498 void beamDone( Ir *ir ); 500 void beamDone( Ir *ir );
499 /** Select a view or adapt the current view to display the specified dates. */ 501 /** Select a view or adapt the current view to display the specified dates. */
500 void showDates( const KCal::DateList & ); 502 void showDates( const KCal::DateList & );
501 void selectWeekNum ( int ); 503 void selectWeekNum ( int );
502 504
503 public: 505 public:
504 // show a standard warning 506 // show a standard warning
505 // returns KMsgBox::yesNoCancel() 507 // returns KMsgBox::yesNoCancel()
506 int msgCalModified(); 508 int msgCalModified();
507 virtual bool sync(KSyncManager* manager, QString filename, int mode); 509 virtual bool sync(KSyncManager* manager, QString filename, int mode);
508 510
509 virtual bool syncExternal(KSyncManager* manager, QString resource); 511 virtual bool syncExternal(KSyncManager* manager, QString resource);
510 virtual void removeSyncInfo( QString syncProfile); 512 virtual void removeSyncInfo( QString syncProfile);
511 void setSyncManager(KSyncManager* manager); 513 void setSyncManager(KSyncManager* manager);
512 void setLoadedFileVersion(QDateTime); 514 void setLoadedFileVersion(QDateTime);
513 bool checkFileVersion(QString fn); 515 bool checkFileVersion(QString fn);
514 bool checkAllFileVersions(); 516 bool checkAllFileVersions();
515 bool checkFileChanged(QString fn); 517 bool checkFileChanged(QString fn);
516 Event* getLastSyncEvent(); 518 Event* getLastSyncEvent();
517 /** Adapt navigation units correpsonding to step size of navigation of the 519 /** Adapt navigation units correpsonding to step size of navigation of the
518 * current view. 520 * current view.
519 */ 521 */
520 void adaptNavigationUnits(); 522 void adaptNavigationUnits();
521 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 523 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
522 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 524 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
523 //Attendee* getYourAttendee(Event *event); 525 //Attendee* getYourAttendee(Event *event);
524 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 526 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
527 void setScrollBarStep(int val );
528
525 protected: 529 protected:
526 void schedule(Scheduler::Method, Incidence *incidence = 0); 530 void schedule(Scheduler::Method, Incidence *incidence = 0);
527 531
528 // returns KMsgBox::OKCandel() 532 // returns KMsgBox::OKCandel()
529 int msgItemDelete(const QString name); 533 int msgItemDelete(const QString name);
530 void showEventEditor(); 534 void showEventEditor();
531 void showTodoEditor(); 535 void showTodoEditor();
532 void writeLocale();
533 Todo *selectedTodo(); 536 Todo *selectedTodo();
534
535 private: 537 private:
538 QScrollBar * mDateScrollBar;
536 QDateTime mNextAlarmDateTime; 539 QDateTime mNextAlarmDateTime;
537 bool mViewerCallerIsSearchDialog; 540 bool mViewerCallerIsSearchDialog;
538 bool mBlockShowDates; 541 bool mBlockShowDates;
539 KSyncManager* mSyncManager; 542 KSyncManager* mSyncManager;
540 AlarmDialog * mAlarmDialog; 543 AlarmDialog * mAlarmDialog;
541 QString mAlarmNotification; 544 QString mAlarmNotification;
542 QString mSuspendAlarmNotification; 545 QString mSuspendAlarmNotification;
543 QTimer* mSuspendTimer; 546 QTimer* mSuspendTimer;
544 QTimer* mAlarmTimer; 547 QTimer* mAlarmTimer;
545 QTimer* mRecheckAlarmTimer; 548 QTimer* mRecheckAlarmTimer;
546 void computeAlarm( QString ); 549 void computeAlarm( QString );
547 void startAlarm( QString, QString ); 550 void startAlarm( QString, QString );
548 void setSyncEventsReadOnly(); 551 void setSyncEventsReadOnly();
549 552
550 QDateTime loadedFileVersion; 553 QDateTime loadedFileVersion;
551 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 554 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
552 void checkExternalId( Incidence * inc ); 555 void checkExternalId( Incidence * inc );
553 int mGlobalSyncMode; 556 int mGlobalSyncMode;
554 QString mCurrentSyncDevice; 557 QString mCurrentSyncDevice;
555 QString mCurrentSyncName; 558 QString mCurrentSyncName;
556 KOBeamPrefs* beamDialog;
557 void init(); 559 void init();
558 int mDatePickerMode; 560 int mDatePickerMode;
559 bool mFlagEditDescription; 561 bool mFlagEditDescription;
560 QDateTime mLastCalendarSync; 562 QDateTime mLastCalendarSync;
561 void createPrinter(); 563 void createPrinter();
562 564
563 void calendarModified( bool, Calendar * ); 565 void calendarModified( bool, Calendar * );
564 566
565 CalPrinter *mCalPrinter; 567 CalPrinter *mCalPrinter;
566 568
567 QSplitter *mPanner; 569 QSplitter *mPanner;
568 QSplitter *mLeftSplitter; 570 QSplitter *mLeftSplitter;
569 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 571 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
570 QWidgetStack *mRightFrame; 572 QWidgetStack *mRightFrame;
571 573
572 KDatePicker* mDatePicker; 574 KDatePicker* mDatePicker;
573 QVBox* mDateFrame; 575 QVBox* mDateFrame;
574 576
575 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 577 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
576 578
577 KOFilterView *mFilterView; 579 KOFilterView *mFilterView;
578 KOCalEditView *mCalEditView; 580 KOCalEditView *mCalEditView;
579 581
580 ResourceView *mResourceView; 582 ResourceView *mResourceView;
581 583
582 // calendar object for this viewing instance 584 // calendar object for this viewing instance
583 Calendar *mCalendar; 585 Calendar *mCalendar;
584 586
585 CalendarResourceManager *mResourceManager; 587 CalendarResourceManager *mResourceManager;
586 588
587 FileStorage *mStorage; 589 FileStorage *mStorage;
588 590
589 DateNavigator *mNavigator; 591 DateNavigator *mNavigator;
590 592
591 KOViewManager *mViewManager; 593 KOViewManager *mViewManager;
592 KODialogManager *mDialogManager; 594 KODialogManager *mDialogManager;
593 595
594 // Calendar filters 596 // Calendar filters
595 QPtrList<CalFilter> mFilters; 597 QPtrList<CalFilter> mFilters;
596 598
597 // various housekeeping variables. 599 // various housekeeping variables.
598 bool mModified; // flag indicating if calendar is modified 600 bool mModified; // flag indicating if calendar is modified
599 bool mReadOnly; // flag indicating if calendar is read-only 601 bool mReadOnly; // flag indicating if calendar is read-only
600 QDate mSaveSingleDate; 602 QDate mSaveSingleDate;
601 603
602 Incidence *mSelectedIncidence; 604 Incidence *mSelectedIncidence;
603 Incidence *mMoveIncidence; 605 Incidence *mMoveIncidence;
604 QDate mMoveIncidenceOldDate; 606 QDate mMoveIncidenceOldDate;
605 KOTodoView *mTodoList; 607 KOTodoView *mTodoList;
606 KOEventEditor * mEventEditor; 608 KOEventEditor * mEventEditor;
607 KOTodoEditor * mTodoEditor; 609 KOTodoEditor * mTodoEditor;
608 KOEventViewerDialog * mEventViewerDialog; 610 KOEventViewerDialog * mEventViewerDialog;
609 void keyPressEvent ( QKeyEvent *e) ; 611 void keyPressEvent ( QKeyEvent *e) ;
610 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 612 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
611}; 613};
612 614
613 615
614class CalendarViewVisitor : public Incidence::Visitor 616class CalendarViewVisitor : public Incidence::Visitor
615{ 617{
616 public: 618 public:
617 CalendarViewVisitor() : mView( 0 ) {} 619 CalendarViewVisitor() : mView( 0 ) {}
618 620
619 bool act( Incidence *incidence, CalendarView *view ) 621 bool act( Incidence *incidence, CalendarView *view )
620 { 622 {
621 mView = view; 623 mView = view;
622 return incidence->accept( *this ); 624 return incidence->accept( *this );
623 } 625 }
624 626
625 protected: 627 protected:
626 CalendarView *mView; 628 CalendarView *mView;
627}; 629};
628 630
629class ShowIncidenceVisitor : public CalendarViewVisitor 631class ShowIncidenceVisitor : public CalendarViewVisitor
630{ 632{
631 protected: 633 protected:
632 bool visit( Event *event ) { mView->showEvent( event ); return true; } 634 bool visit( Event *event ) { mView->showEvent( event ); return true; }
633 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 635 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
634 bool visit( Journal * j ) { mView->showJournal( j );return true; } 636 bool visit( Journal * j ) { mView->showJournal( j );return true; }
635}; 637};
636 638
637class EditIncidenceVisitor : public CalendarViewVisitor 639class EditIncidenceVisitor : public CalendarViewVisitor
638{ 640{
639 protected: 641 protected:
640 bool visit( Event *event ) { mView->editEvent( event ); return true; } 642 bool visit( Event *event ) { mView->editEvent( event ); return true; }
641 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 643 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
642 bool visit( Journal *j ) { mView->editJournal( j); return true; } 644 bool visit( Journal *j ) { mView->editJournal( j); return true; }
643}; 645};
644 646
645class DeleteIncidenceVisitor : public CalendarViewVisitor 647class DeleteIncidenceVisitor : public CalendarViewVisitor
646{ 648{
647 protected: 649 protected:
648 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 650 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
649 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 651 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
650 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 652 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
651}; 653};
652 654
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 7b307f7..bd191d8 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -375,482 +375,492 @@ void KOViewManager::clearAllViews()
375 if ( mMonthView ) mMonthView->clearList(); 375 if ( mMonthView ) mMonthView->clearList();
376 if ( mWhatsNextView ) mWhatsNextView->clearList(); 376 if ( mWhatsNextView ) mWhatsNextView->clearList();
377 if ( mJournalView ) mJournalView->clearList(); 377 if ( mJournalView ) mJournalView->clearList();
378 378
379} 379}
380void KOViewManager::updateView() 380void KOViewManager::updateView()
381{ 381{
382 // qDebug("KOViewManager::updateView() "); 382 // qDebug("KOViewManager::updateView() ");
383 // if we are updating mTodoView, we get endless recursion 383 // if we are updating mTodoView, we get endless recursion
384 if ( mTodoView == mCurrentView ) 384 if ( mTodoView == mCurrentView )
385 return; 385 return;
386 if ( mCurrentView ) mCurrentView->updateView(); 386 if ( mCurrentView ) mCurrentView->updateView();
387 387
388} 388}
389 389
390void KOViewManager::updateView(const QDate &start, const QDate &end) 390void KOViewManager::updateView(const QDate &start, const QDate &end)
391{ 391{
392 // kdDebug() << "KOViewManager::updateView()" << endl; 392 // kdDebug() << "KOViewManager::updateView()" << endl;
393 393
394 if (mCurrentView) mCurrentView->showDates(start, end); 394 if (mCurrentView) mCurrentView->showDates(start, end);
395 395
396 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 396 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
397} 397}
398 398
399 399
400void KOViewManager::updateWNview() 400void KOViewManager::updateWNview()
401{ 401{
402 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 402 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
403 mWhatsNextView->updateView(); 403 mWhatsNextView->updateView();
404 if ( mCurrentView == mMonthView && mMonthView ) 404 if ( mCurrentView == mMonthView && mMonthView )
405 mMonthView->updateView(); 405 mMonthView->updateView();
406 406
407} 407}
408void KOViewManager::showWhatsNextView() 408void KOViewManager::showWhatsNextView()
409{ 409{
410 if (!mWhatsNextView) { 410 if (!mWhatsNextView) {
411 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 411 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
412 "KOViewManager::WhatsNextView"); 412 "KOViewManager::WhatsNextView");
413 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 413 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
414 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 414 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
415 addView(mWhatsNextView); 415 addView(mWhatsNextView);
416 connect(this, SIGNAL( printWNV() ), 416 connect(this, SIGNAL( printWNV() ),
417 mWhatsNextView, SLOT( printMe() ) ); 417 mWhatsNextView, SLOT( printMe() ) );
418 } 418 }
419 globalFlagBlockAgenda = 1; 419 globalFlagBlockAgenda = 1;
420 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; 420 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
421 showView(mWhatsNextView, true ); 421 showView(mWhatsNextView, true );
422 //mWhatsNextView->updateView(); 422 //mWhatsNextView->updateView();
423 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; 423 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
424} 424}
425 425
426void KOViewManager::slotprintWNV() 426void KOViewManager::slotprintWNV()
427{ 427{
428 if (!mWhatsNextView) 428 if (!mWhatsNextView)
429 showWhatsNextView(); 429 showWhatsNextView();
430 emit printWNV(); 430 emit printWNV();
431 431
432} 432}
433void KOViewManager::showListView() 433void KOViewManager::showListView()
434{ 434{
435 if (!mListView) { 435 if (!mListView) {
436 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 436 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
437 addView(mListView); 437 addView(mListView);
438 438
439 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 439 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
440 mMainView, SLOT(showIncidence(Incidence *))); 440 mMainView, SLOT(showIncidence(Incidence *)));
441 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 441 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
442 mMainView, SLOT(editIncidence(Incidence *))); 442 mMainView, SLOT(editIncidence(Incidence *)));
443 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 443 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
444 mMainView, SLOT(deleteIncidence(Incidence *))); 444 mMainView, SLOT(deleteIncidence(Incidence *)));
445 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 445 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
446 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 446 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
447 connect( mListView, SIGNAL( signalNewEvent() ), 447 connect( mListView, SIGNAL( signalNewEvent() ),
448 mMainView, SLOT( newEvent() ) ); 448 mMainView, SLOT( newEvent() ) );
449 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 449 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
450 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 450 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
451 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 451 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
452 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 452 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
453 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 453 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
454 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 454 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
455 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 455 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
456 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 456 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
457 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 457 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
458 } 458 }
459 // bool temp = mFlagShowNextxDays; 459 // bool temp = mFlagShowNextxDays;
460 //globalFlagBlockPainting = true; 460 //globalFlagBlockPainting = true;
461 globalFlagBlockAgenda = 1; 461 globalFlagBlockAgenda = 1;
462 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 462 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
463 mMainView->setBlockShowDates( true ); 463 mMainView->setBlockShowDates( true );
464 mMainView->dateNavigator()->selectMonth(); 464 mMainView->dateNavigator()->selectMonth();
465 mMainView->setBlockShowDates( false ); 465 mMainView->setBlockShowDates( false );
466 } 466 }
467 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 467 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
468 showView(mListView, KOPrefs::instance()->mFullViewTodo); 468 showView(mListView, KOPrefs::instance()->mFullViewTodo);
469 //mFlagShowNextxDays = temp; 469 //mFlagShowNextxDays = temp;
470 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 470 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
471 mMainView->setScrollBarStep( 7 );
471} 472}
472 473
473void KOViewManager::showAgendaView( bool fullScreen ) 474void KOViewManager::showAgendaView( bool fullScreen )
474{ 475{
475 476
476 mMainView->dialogManager()->hideSearchDialog(); 477 mMainView->dialogManager()->hideSearchDialog();
477 // qDebug("KOViewManager::showAgendaView "); 478 // qDebug("KOViewManager::showAgendaView ");
478 bool full; 479 bool full;
479 full = fullScreen; 480 full = fullScreen;
480 if (!mAgendaView) { 481 if (!mAgendaView) {
481 full = false; 482 full = false;
482 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 483 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
483 addView(mAgendaView); 484 addView(mAgendaView);
484#ifndef DESKTOP_VERSION 485#ifndef DESKTOP_VERSION
485 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 486 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
486#endif 487#endif
487 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 488 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
488 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 489 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
489 490
490 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 491 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
491 492
492 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 493 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
493 494
494 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 495 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
495 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 496 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
496 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 497 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
497 mMainView, SLOT(newEvent(QDateTime))); 498 mMainView, SLOT(newEvent(QDateTime)));
498 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 499 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
499 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 500 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
500 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 501 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
501 mMainView, SLOT(newEvent(QDate))); 502 mMainView, SLOT(newEvent(QDate)));
502 503
503 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 504 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
504 mMainView, SLOT(editIncidence(Incidence *))); 505 mMainView, SLOT(editIncidence(Incidence *)));
505 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 506 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
506 mMainView, SLOT(showIncidence(Incidence *))); 507 mMainView, SLOT(showIncidence(Incidence *)));
507 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 508 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
508 mMainView, SLOT(deleteIncidence(Incidence *))); 509 mMainView, SLOT(deleteIncidence(Incidence *)));
509 510
510 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 511 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
511 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 512 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
512 513
513 connect(mAgendaView, SIGNAL( toggleExpand() ), 514 connect(mAgendaView, SIGNAL( toggleExpand() ),
514 mMainView, SLOT( toggleExpand() ) ); 515 mMainView, SLOT( toggleExpand() ) );
515 516
516 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 517 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
517 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 518 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
518 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 519 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
519 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 520 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
520 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 521 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
521 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 522 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
522 SLOT( updateTodo( Todo *, int ) ) ); 523 SLOT( updateTodo( Todo *, int ) ) );
523 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 524 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
524 mMainView, SIGNAL( todoModified( Todo *, int ))); 525 mMainView, SIGNAL( todoModified( Todo *, int )));
525 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 526 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
526 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 527 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
527 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 528 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
528 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 529 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
529 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 530 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
530 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 531 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
531 mAgendaView->readSettings(); 532 mAgendaView->readSettings();
532 mAgendaView->updateConfig(); 533 mAgendaView->updateConfig();
533 } 534 }
534 535
535 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 536 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
536 showView( mAgendaView, full); 537 showView( mAgendaView, full);
537 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 538 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
539 mMainView->setScrollBarStep( 1 );
538} 540}
539 541
540void KOViewManager::showDayView() 542void KOViewManager::showDayView()
541{ 543{
542 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 544 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
543 mFlagShowNextxDays = false; 545 mFlagShowNextxDays = false;
544 globalFlagBlockLabel = 1; 546 globalFlagBlockLabel = 1;
545 globalFlagBlockAgenda = 1; 547 globalFlagBlockAgenda = 1;
546 if ( mCurrentAgendaView != 1 ) 548 if ( mCurrentAgendaView != 1 )
547 mCurrentAgendaView = -1; 549 mCurrentAgendaView = -1;
548 showAgendaView(); 550 showAgendaView();
549 qApp->processEvents(); 551 qApp->processEvents();
550 globalFlagBlockAgenda = 2; 552 globalFlagBlockAgenda = 2;
551 globalFlagBlockLabel = 0; 553 globalFlagBlockLabel = 0;
552 mMainView->dateNavigator()->selectDates( 1 ); 554 mMainView->dateNavigator()->selectDates( 1 );
553 mCurrentAgendaView = 1 ; 555 mCurrentAgendaView = 1 ;
556 mMainView->setScrollBarStep( 1 );
554 557
555} 558}
556 559
557void KOViewManager::showWorkWeekView() 560void KOViewManager::showWorkWeekView()
558{ 561{
559 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
560 mFlagShowNextxDays = false; 563 mFlagShowNextxDays = false;
561 globalFlagBlockAgenda = 1; 564 globalFlagBlockAgenda = 1;
562 globalFlagBlockLabel = 1; 565 globalFlagBlockLabel = 1;
563 if ( mCurrentAgendaView != 5 ) 566 if ( mCurrentAgendaView != 5 )
564 mCurrentAgendaView = -1; 567 mCurrentAgendaView = -1;
565 showAgendaView(); 568 showAgendaView();
566 qApp->processEvents(); 569 qApp->processEvents();
567 globalFlagBlockAgenda = 2; 570 globalFlagBlockAgenda = 2;
568 globalFlagBlockLabel = 0; 571 globalFlagBlockLabel = 0;
569 mMainView->dateNavigator()->selectWorkWeek(); 572 mMainView->dateNavigator()->selectWorkWeek();
570 mCurrentAgendaView = 5 ; 573 mCurrentAgendaView = 5 ;
574 mMainView->setScrollBarStep( 1 );
571 575
572} 576}
573 577
574void KOViewManager::showWeekView() 578void KOViewManager::showWeekView()
575{ 579{
576 580
577 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 581 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
578 mFlagShowNextxDays = false; 582 mFlagShowNextxDays = false;
579 globalFlagBlockAgenda = 1; 583 globalFlagBlockAgenda = 1;
580 globalFlagBlockLabel = 1; 584 globalFlagBlockLabel = 1;
581 if ( mCurrentAgendaView != 7 ) 585 if ( mCurrentAgendaView != 7 )
582 mCurrentAgendaView = -1; 586 mCurrentAgendaView = -1;
583 showAgendaView(); 587 showAgendaView();
584 qApp->processEvents(); 588 qApp->processEvents();
585 globalFlagBlockAgenda = 2; 589 globalFlagBlockAgenda = 2;
586 globalFlagBlockLabel = 0; 590 globalFlagBlockLabel = 0;
587 mMainView->dateNavigator()->selectWeek(); 591 mMainView->dateNavigator()->selectWeek();
588 mCurrentAgendaView = 7 ; 592 mCurrentAgendaView = 7 ;
593 mMainView->setScrollBarStep( 1 );
589} 594}
590 595
591void KOViewManager::showNextXView() 596void KOViewManager::showNextXView()
592{ 597{
593 598
594 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 599 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
595 globalFlagBlockAgenda = 1; 600 globalFlagBlockAgenda = 1;
596 if ( mCurrentAgendaView != 3 ) 601 if ( mCurrentAgendaView != 3 )
597 mCurrentAgendaView = -1; 602 mCurrentAgendaView = -1;
598 showAgendaView(KOPrefs::instance()->mFullViewMonth); 603 showAgendaView(KOPrefs::instance()->mFullViewMonth);
599 globalFlagBlockAgenda = 2; 604 globalFlagBlockAgenda = 2;
600 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 605 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
601 KOPrefs::instance()->mNextXDays ); 606 KOPrefs::instance()->mNextXDays );
602 mFlagShowNextxDays = true; 607 mFlagShowNextxDays = true;
603 mCurrentAgendaView = 3 ; 608 mCurrentAgendaView = 3 ;
604 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 609 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
610 mMainView->setScrollBarStep( KOPrefs::instance()->mNextXDays );
605} 611}
606bool KOViewManager::showsNextDays() 612bool KOViewManager::showsNextDays()
607{ 613{
608 return mFlagShowNextxDays; 614 return mFlagShowNextxDays;
609} 615}
610void KOViewManager::createMonthView() 616void KOViewManager::createMonthView()
611{ 617{
612if (!mMonthView) { 618if (!mMonthView) {
613 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 619 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
614 620
615 addView(mMonthView); 621 addView(mMonthView);
616 // mMonthView->show(); 622 // mMonthView->show();
617 // SIGNALS/SLOTS FOR MONTH VIEW 623 // SIGNALS/SLOTS FOR MONTH VIEW
618 624
619 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate ))); 625 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
620 626
621 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)), 627 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)),
622 mMainView, SLOT(newTodoDateTime(QDateTime, bool))); 628 mMainView, SLOT(newTodoDateTime(QDateTime, bool)));
623 629
624 630
625 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 631 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
626 mMainView, SLOT(newEvent(QDateTime))); 632 mMainView, SLOT(newEvent(QDateTime)));
627 633
628 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 634 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
629 mMainView, SLOT(showIncidence(Incidence *))); 635 mMainView, SLOT(showIncidence(Incidence *)));
630 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 636 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
631 mMainView, SLOT(editIncidence(Incidence *))); 637 mMainView, SLOT(editIncidence(Incidence *)));
632 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 638 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
633 mMainView, SLOT(deleteIncidence(Incidence *))); 639 mMainView, SLOT(deleteIncidence(Incidence *)));
634 640
635 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 641 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
636 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 642 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
637 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 643 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
638 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 644 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
639 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 645 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
640 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 646 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
641 647
642 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 648 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
643 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 649 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
644 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 650 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
645 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 651 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
646 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 652 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
647 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 653 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
648 connect( mMonthView, SIGNAL( selectMonth() ), 654 connect( mMonthView, SIGNAL( selectMonth() ),
649 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 655 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
650 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 656 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
651 mMainView, SLOT ( showDay( QDate ) ) ); 657 mMainView, SLOT ( showDay( QDate ) ) );
652 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 658 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
653 connect( mMonthView, SIGNAL(nextMonth() ), 659 connect( mMonthView, SIGNAL(nextMonth() ),
654 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 660 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
655 connect( mMonthView, SIGNAL(prevMonth() ), 661 connect( mMonthView, SIGNAL(prevMonth() ),
656 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 662 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
657 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 663 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
658 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 664 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
659 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 665 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
660 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 666 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
661 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 667 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
662 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 668 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
663 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 669 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
664 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 670 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
665 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 671 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
666 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 672 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
667 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 673 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
668 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 674 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
669 675
670 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 676 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
671 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 677 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
672 678
673 679
674 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 680 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
675 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 681 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
676 682
677 } 683 }
678} 684}
679void KOViewManager::showMonthViewWeek() 685void KOViewManager::showMonthViewWeek()
680{ 686{
681 createMonthView(); 687 createMonthView();
682 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 688 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
683 globalFlagBlockAgenda = 1; 689 globalFlagBlockAgenda = 1;
684 bool full = true; 690 bool full = true;
685 if ( mCurrentView == mMonthView) 691 if ( mCurrentView == mMonthView)
686 full = mMainView->leftFrame()->isVisible(); 692 full = mMainView->leftFrame()->isVisible();
687 if ( !KOPrefs::instance()->mMonthViewWeek ) { 693 if ( !KOPrefs::instance()->mMonthViewWeek ) {
688 mMonthView->switchView(); 694 mMonthView->switchView();
689 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 695 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
690 full = false; 696 full = false;
691 else 697 else
692 full = true; 698 full = true;
693 } 699 }
694 mMainView->dateNavigator()->selectWeek(); 700 mMainView->dateNavigator()->selectWeek();
695 showView(mMonthView, full ); 701 showView(mMonthView, full );
696 mMonthView->setKeyBFocus(); 702 mMonthView->setKeyBFocus();
697 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 703 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
704 mMainView->setScrollBarStep( 7 );
698} 705}
699 706
700void KOViewManager::showMonth( const QDate & date ) 707void KOViewManager::showMonth( const QDate & date )
701{ 708{
702 mMainView->dateNavigator()->blockSignals( true ); 709 mMainView->dateNavigator()->blockSignals( true );
703 mMainView->dateNavigator()->selectDate( date ); 710 mMainView->dateNavigator()->selectDate( date );
704 mMainView->dateNavigator()->blockSignals( false ); 711 mMainView->dateNavigator()->blockSignals( false );
705 showMonthView(); 712 showMonthView();
706} 713}
707void KOViewManager::showMonthView() 714void KOViewManager::showMonthView()
708 { 715 {
709 716
710 createMonthView(); 717 createMonthView();
711 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 718 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
712 globalFlagBlockAgenda = 1; 719 globalFlagBlockAgenda = 1;
713 //mFlagShowNextxDays = false; 720 //mFlagShowNextxDays = false;
714 bool full = true; 721 bool full = true;
715 if ( mCurrentView == mMonthView) 722 if ( mCurrentView == mMonthView)
716 full = mMainView->leftFrame()->isVisible(); 723 full = mMainView->leftFrame()->isVisible();
717 // if(mMonthView == mCurrentView) return; 724 // if(mMonthView == mCurrentView) return;
718 if ( KOPrefs::instance()->mMonthViewWeek ) { 725 if ( KOPrefs::instance()->mMonthViewWeek ) {
719 mMonthView->switchView(); 726 mMonthView->switchView();
720 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 727 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
721 full = false; 728 full = false;
722 else 729 else
723 full = true; 730 full = true;
724 } 731 }
725 mMainView->dateNavigator()->selectMonth(); 732 mMainView->dateNavigator()->selectMonth();
726 733
727 showView(mMonthView, full ); 734 showView(mMonthView, full );
728 mMonthView->setKeyBFocus(); 735 mMonthView->setKeyBFocus();
729 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 736 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
737 mMainView->setScrollBarStep( 7 );
730 738
731} 739}
732 740
733void KOViewManager::showTodoView() 741void KOViewManager::showTodoView()
734{ 742{
735 //mFlagShowNextxDays = false; 743 //mFlagShowNextxDays = false;
736 if ( !mTodoView ) { 744 if ( !mTodoView ) {
737 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 745 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
738 "KOViewManager::TodoView" ); 746 "KOViewManager::TodoView" );
739 747
740 addView( mTodoView ); 748 addView( mTodoView );
741 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 749 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
742 750
743 // SIGNALS/SLOTS FOR TODO VIEW 751 // SIGNALS/SLOTS FOR TODO VIEW
744 connect( mTodoView, SIGNAL( newTodoSignal() ), 752 connect( mTodoView, SIGNAL( newTodoSignal() ),
745 mMainView, SLOT( newTodo() ) ); 753 mMainView, SLOT( newTodo() ) );
746 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 754 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
747 mMainView, SLOT( newSubTodo( Todo *) ) ); 755 mMainView, SLOT( newSubTodo( Todo *) ) );
748 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 756 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
749 mMainView, SLOT( showTodo( Todo * ) ) ); 757 mMainView, SLOT( showTodo( Todo * ) ) );
750 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 758 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
751 mMainView, SLOT( editTodo( Todo * ) ) ); 759 mMainView, SLOT( editTodo( Todo * ) ) );
752 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 760 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
753 mMainView, SLOT( deleteTodo( Todo * ) ) ); 761 mMainView, SLOT( deleteTodo( Todo * ) ) );
754 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 762 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
755 mMainView, SLOT( purgeCompleted() ) ); 763 mMainView, SLOT( purgeCompleted() ) );
756 764
757 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 765 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
758 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 766 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
759 767
760 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 768 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
761 SLOT( updateConfig() ) ); 769 SLOT( updateConfig() ) );
762 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 770 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
763 SLOT( updateTodo( Todo *, int ) ) ); 771 SLOT( updateTodo( Todo *, int ) ) );
764 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 772 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
765 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 773 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
766 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 774 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
767 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 775 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
768 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 776 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
769 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 777 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
770 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 778 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
771 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 779 mMainView, SLOT ( todo_unsub( Todo * ) ) );
772 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 780 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
773 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 781 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
774 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 782 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
775 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 783 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
776 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 784 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
777 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 785 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
778 KConfig *config = KOGlobals::config(); 786 KConfig *config = KOGlobals::config();
779 mTodoView->restoreLayout(config,"Todo View"); 787 mTodoView->restoreLayout(config,"Todo View");
780 mTodoView->setNavigator( mMainView->dateNavigator() ); 788 mTodoView->setNavigator( mMainView->dateNavigator() );
781 } 789 }
782 790
783 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 791 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
784 globalFlagBlockAgenda = 1; 792 globalFlagBlockAgenda = 1;
785 showView( mTodoView, true ); 793 showView( mTodoView, true );
786 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 794 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
795 mMainView->setScrollBarStep( 7 );
787 796
788} 797}
789 798
790void KOViewManager::showJournalView() 799void KOViewManager::showJournalView()
791{ 800{
792 //mFlagShowNextxDays = false; 801 //mFlagShowNextxDays = false;
793 if (!mJournalView) { 802 if (!mJournalView) {
794 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 803 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
795 "KOViewManager::JournalView"); 804 "KOViewManager::JournalView");
796 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 805 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
797 SLOT( updateConfig() ) ); 806 SLOT( updateConfig() ) );
798 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 807 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
799 addView(mJournalView); 808 addView(mJournalView);
800 } 809 }
801 810
802 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 811 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
803 showView(mJournalView); 812 showView(mJournalView);
804 mMainView->dateNavigator()->selectDates( 1 ); 813 mMainView->dateNavigator()->selectDates( 1 );
805 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 814 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
815 mMainView->setScrollBarStep( 1 );
806} 816}
807 817
808void KOViewManager::showTimeSpanView() 818void KOViewManager::showTimeSpanView()
809{ 819{
810 //mFlagShowNextxDays = false; 820 //mFlagShowNextxDays = false;
811 if (!mTimeSpanView) { 821 if (!mTimeSpanView) {
812 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 822 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
813 "KOViewManager::TimeSpanView"); 823 "KOViewManager::TimeSpanView");
814 addView(mTimeSpanView); 824 addView(mTimeSpanView);
815 825
816 mTimeSpanView->readSettings(); 826 mTimeSpanView->readSettings();
817 } 827 }
818 828
819 showView(mTimeSpanView); 829 showView(mTimeSpanView);
820} 830}
821 831
822Incidence *KOViewManager::currentSelection() 832Incidence *KOViewManager::currentSelection()
823{ 833{
824 if (!mCurrentView) return 0; 834 if (!mCurrentView) return 0;
825 if ( mCurrentView == mListView ) { 835 if ( mCurrentView == mListView ) {
826 if ( mListView->currentItem() ) 836 if ( mListView->currentItem() )
827 return mListView->currentItem(); 837 return mListView->currentItem();
828 } 838 }
829 return mCurrentView->selectedIncidences().first(); 839 return mCurrentView->selectedIncidences().first();
830} 840}
831 841
832QDate KOViewManager::currentSelectionDate() 842QDate KOViewManager::currentSelectionDate()
833{ 843{
834 QDate qd; 844 QDate qd;
835 if (mCurrentView) { 845 if (mCurrentView) {
836 DateList qvl = mCurrentView->selectedDates(); 846 DateList qvl = mCurrentView->selectedDates();
837 if (!qvl.isEmpty()) qd = qvl.first(); 847 if (!qvl.isEmpty()) qd = qvl.first();
838 } 848 }
839 return qd; 849 return qd;
840} 850}
841 851
842void KOViewManager::addView(KOrg::BaseView *view) 852void KOViewManager::addView(KOrg::BaseView *view)
843{ 853{
844#if QT_VERSION >= 0x030000 854#if QT_VERSION >= 0x030000
845 mMainView->viewStack()->addWidget( view ); 855 mMainView->viewStack()->addWidget( view );
846#else 856#else
847 mMainView->viewStack()->addWidget( view, 1 ); 857 mMainView->viewStack()->addWidget( view, 1 );
848#endif 858#endif
849} 859}
850 860
851void KOViewManager::setDocumentId( const QString &id ) 861void KOViewManager::setDocumentId( const QString &id )
852{ 862{
853 if (mTodoView) { 863 if (mTodoView) {
854 mTodoView->setDocumentId( id ); 864 mTodoView->setDocumentId( id );
855 } 865 }
856} 866}