summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp21
-rw-r--r--korganizer/mainwindow.cpp12
2 files changed, 21 insertions, 12 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3ab4bb4..a76f2ed 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -245,257 +245,257 @@ Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
245 retInc = inc; 245 retInc = inc;
246 } 246 }
247 inc = mAlarms.next(); 247 inc = mAlarms.next();
248 } 248 }
249 mAlarms.remove( retInc ); 249 mAlarms.remove( retInc );
250 return retInc; 250 return retInc;
251 251
252} 252}
253void MissedAlarmTextBrowser::setSource(const QString & n) 253void MissedAlarmTextBrowser::setSource(const QString & n)
254{ 254{
255 if (n.startsWith("event:")) { 255 if (n.startsWith("event:")) {
256#ifdef DESKTOP_VERSION 256#ifdef DESKTOP_VERSION
257 emit showIncidence(n.mid(8)); 257 emit showIncidence(n.mid(8));
258#else 258#else
259 emit showIncidence(n.mid(6)); 259 emit showIncidence(n.mid(6));
260#endif 260#endif
261 return; 261 return;
262 } else if (n.startsWith("todo:")) { 262 } else if (n.startsWith("todo:")) {
263#ifdef DESKTOP_VERSION 263#ifdef DESKTOP_VERSION
264 emit showIncidence(n.mid(7)); 264 emit showIncidence(n.mid(7));
265#else 265#else
266 emit showIncidence(n.mid(5)); 266 emit showIncidence(n.mid(5));
267#endif 267#endif
268 return; 268 return;
269 } 269 }
270} 270}
271 271
272 272
273class KOBeamPrefs : public QDialog 273class KOBeamPrefs : public QDialog
274{ 274{
275 public: 275 public:
276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
277 QDialog( parent, name, true ) 277 QDialog( parent, name, true )
278 { 278 {
279 setCaption( i18n("Beam Options") ); 279 setCaption( i18n("Beam Options") );
280 QVBoxLayout* lay = new QVBoxLayout( this ); 280 QVBoxLayout* lay = new QVBoxLayout( this );
281 lay->setSpacing( 3 ); 281 lay->setSpacing( 3 );
282 lay->setMargin( 3 ); 282 lay->setMargin( 3 );
283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
284 lay->addWidget( format ); 284 lay->addWidget( format );
285 format->setExclusive ( true ) ; 285 format->setExclusive ( true ) ;
286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
287 lay->addWidget( time ); time->setExclusive ( true ) ; 287 lay->addWidget( time ); time->setExclusive ( true ) ;
288 vcal = new QRadioButton(" vCalendar ", format ); 288 vcal = new QRadioButton(" vCalendar ", format );
289 ical = new QRadioButton(" iCalendar ", format ); 289 ical = new QRadioButton(" iCalendar ", format );
290 vcal->setChecked( true ); 290 vcal->setChecked( true );
291 tz = new QRadioButton(i18n(" With timezone "), time ); 291 tz = new QRadioButton(i18n(" With timezone "), time );
292 local = new QRadioButton(i18n(" Local time "), time ); 292 local = new QRadioButton(i18n(" Local time "), time );
293 tz->setChecked( true ); 293 tz->setChecked( true );
294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
295 lay->addWidget( ok ); 295 lay->addWidget( ok );
296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
297 lay->addWidget( cancel ); 297 lay->addWidget( cancel );
298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
300 resize( 200, 200 ); 300 resize( 200, 200 );
301 } 301 }
302 302
303 bool beamVcal() { return vcal->isChecked(); } 303 bool beamVcal() { return vcal->isChecked(); }
304 bool beamLocal() { return local->isChecked(); } 304 bool beamLocal() { return local->isChecked(); }
305private: 305private:
306 QRadioButton* vcal, *ical, *local, *tz; 306 QRadioButton* vcal, *ical, *local, *tz;
307}; 307};
308class KOCatPrefs : public QDialog 308class KOCatPrefs : public QDialog
309{ 309{
310 public: 310 public:
311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
312 QDialog( parent, name, true ) 312 QDialog( parent, name, true )
313 { 313 {
314 setCaption( i18n("Manage new Categories") ); 314 setCaption( i18n("Manage new Categories") );
315 QVBoxLayout* lay = new QVBoxLayout( this ); 315 QVBoxLayout* lay = new QVBoxLayout( this );
316 lay->setSpacing( 3 ); 316 lay->setSpacing( 3 );
317 lay->setMargin( 3 ); 317 lay->setMargin( 3 );
318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); 318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
319 lay->addWidget( lab ); 319 lay->addWidget( lab );
320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
321 lay->addWidget( format ); 321 lay->addWidget( format );
322 format->setExclusive ( true ) ; 322 format->setExclusive ( true ) ;
323 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 323 addCatBut = new QRadioButton(i18n("Add to category list"), format );
324 new QRadioButton(i18n("Remove from Events/Todos"), format ); 324 new QRadioButton(i18n("Remove from Events/Todos"), format );
325 addCatBut->setChecked( true ); 325 addCatBut->setChecked( true );
326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); 326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
327 lay->addWidget( ok ); 327 lay->addWidget( ok );
328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
329 lay->addWidget( cancel ); 329 lay->addWidget( cancel );
330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
332 resize( 200, 200 ); 332 resize( 200, 200 );
333 } 333 }
334 334
335 bool addCat() { return addCatBut->isChecked(); } 335 bool addCat() { return addCatBut->isChecked(); }
336private: 336private:
337 QRadioButton* addCatBut; 337 QRadioButton* addCatBut;
338}; 338};
339 339
340 340
341 341
342CalendarView::CalendarView( CalendarResources *calendar, 342CalendarView::CalendarView( CalendarResources *calendar,
343 QWidget *parent, const char *name ) 343 QWidget *parent, const char *name )
344 : CalendarViewBase( parent, name ), 344 : CalendarViewBase( parent, name ),
345 mCalendar( calendar ), 345 mCalendar( calendar ),
346 mResourceManager( calendar->resourceManager() ) 346 mResourceManager( calendar->resourceManager() )
347{ 347{
348 348
349 mEventEditor = 0; 349 mEventEditor = 0;
350 mTodoEditor = 0; 350 mTodoEditor = 0;
351 351
352 init(); 352 init();
353} 353}
354 354
355CalendarView::CalendarView( Calendar *calendar, 355CalendarView::CalendarView( Calendar *calendar,
356 QWidget *parent, const char *name ) 356 QWidget *parent, const char *name )
357 : CalendarViewBase( parent, name ), 357 : CalendarViewBase( parent, name ),
358 mCalendar( calendar ), 358 mCalendar( calendar ),
359 mResourceManager( 0 ) 359 mResourceManager( 0 )
360{ 360{
361 361
362 mEventEditor = 0; 362 mEventEditor = 0;
363 mTodoEditor = 0; 363 mTodoEditor = 0;
364 init(); 364 init();
365} 365}
366 366
367void CalendarView::init() 367void CalendarView::init()
368{ 368{
369 mNextAlarmDateTime = QDateTime::currentDateTime(); 369 mNextAlarmDateTime = QDateTime::currentDateTime();
370 setFocusPolicy (NoFocus ); 370 setFocusPolicy (NoFocus );
371 mViewerCallerIsSearchDialog = false; 371 mViewerCallerIsSearchDialog = false;
372 mBlockShowDates = false; 372 mBlockShowDates = false;
373 373 mConflictingEvent = 0;
374 mDatePickerMode = 0; 374 mDatePickerMode = 0;
375 mCurrentSyncDevice = ""; 375 mCurrentSyncDevice = "";
376 mViewManager = new KOViewManager( this ); 376 mViewManager = new KOViewManager( this );
377 mDialogManager = new KODialogManager( this ); 377 mDialogManager = new KODialogManager( this );
378 mEventViewerDialog = 0; 378 mEventViewerDialog = 0;
379 mModified = false; 379 mModified = false;
380 mReadOnly = false; 380 mReadOnly = false;
381 mSelectedIncidence = 0; 381 mSelectedIncidence = 0;
382 mCalPrinter = 0; 382 mCalPrinter = 0;
383 mFilters.setAutoDelete(true); 383 mFilters.setAutoDelete(true);
384 384
385 mCalendar->registerObserver( this ); 385 mCalendar->registerObserver( this );
386 // TODO: Make sure that view is updated, when calendar is changed. 386 // TODO: Make sure that view is updated, when calendar is changed.
387 387
388 mStorage = new FileStorage( mCalendar ); 388 mStorage = new FileStorage( mCalendar );
389 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 389 mNavigator = new DateNavigator( this, "datevav", mViewManager );
390 390
391 QBoxLayout *topLayout = (QBoxLayout*)layout(); 391 QBoxLayout *topLayout = (QBoxLayout*)layout();
392#ifndef KORG_NOSPLITTER 392#ifndef KORG_NOSPLITTER
393 // create the main layout frames. 393 // create the main layout frames.
394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
395 topLayout->addWidget(mPanner); 395 topLayout->addWidget(mPanner);
396 396
397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
398 "CalendarView::LeftFrame"); 398 "CalendarView::LeftFrame");
399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
400 400
401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
402 "CalendarView::DateNavigator" ); 402 "CalendarView::DateNavigator" );
403 403
404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
406 mTodoList->setNavigator( mNavigator ); 406 mTodoList->setNavigator( mNavigator );
407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
408 408
409#ifdef KORG_NORESOURCEVIEW 409#ifdef KORG_NORESOURCEVIEW
410 mResourceView = 0; 410 mResourceView = 0;
411#else 411#else
412 if ( mResourceManager ) { 412 if ( mResourceManager ) {
413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
414 mResourceView->updateView(); 414 mResourceView->updateView();
415 connect( mResourceView, SIGNAL( resourcesChanged() ), 415 connect( mResourceView, SIGNAL( resourcesChanged() ),
416 SLOT( updateView() ) ); 416 SLOT( updateView() ) );
417 } else { 417 } else {
418 mResourceView = 0; 418 mResourceView = 0;
419 } 419 }
420#endif 420#endif
421 QWidget *rightBox = new QWidget( mPanner ); 421 QWidget *rightBox = new QWidget( mPanner );
422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
423 423
424 mRightFrame = new QWidgetStack( rightBox ); 424 mRightFrame = new QWidgetStack( rightBox );
425 rightLayout->addWidget( mRightFrame, 1 ); 425 rightLayout->addWidget( mRightFrame, 1 );
426 426
427 mLeftFrame = mLeftSplitter; 427 mLeftFrame = mLeftSplitter;
428#else 428#else
429 //QWidget *mainBox = new QWidget( this ); 429 //QWidget *mainBox = new QWidget( this );
430 //QWidget *leftFrame = new QWidget( mainBox ); 430 //QWidget *leftFrame = new QWidget( mainBox );
431 //QBoxLayout * mainBoxLayout; 431 //QBoxLayout * mainBoxLayout;
432 if ( KOPrefs::instance()->mVerticalScreen ) { 432 if ( KOPrefs::instance()->mVerticalScreen ) {
433 //mainBoxLayout = new QVBoxLayout(mainBox); 433 //mainBoxLayout = new QVBoxLayout(mainBox);
434 //leftFrameLayout = new QHBoxLayout(leftFrame ); 434 //leftFrameLayout = new QHBoxLayout(leftFrame );
435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
439 } else { 439 } else {
440 //mainBoxLayout = new QHBoxLayout(mainBox); 440 //mainBoxLayout = new QHBoxLayout(mainBox);
441 //leftFrameLayout = new QVBoxLayout(leftFrame ); 441 //leftFrameLayout = new QVBoxLayout(leftFrame );
442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
446 } 446 }
447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
448 //QBoxLayout * leftFrameLayout; 448 //QBoxLayout * leftFrameLayout;
449 topLayout->addWidget( mMainFrame ); 449 topLayout->addWidget( mMainFrame );
450#ifdef DESKTOP_VERSION 450#ifdef DESKTOP_VERSION
451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); 451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this );
452 topLayout->addWidget( mDateScrollBar ); 452 topLayout->addWidget( mDateScrollBar );
453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
454 if ( QApplication::desktop()->width() < 800 ) 454 if ( QApplication::desktop()->width() < 800 )
455 mDateScrollBar->hide(); 455 mDateScrollBar->hide();
456#endif 456#endif
457 //mainBoxLayout->addWidget (mLeftFrame); 457 //mainBoxLayout->addWidget (mLeftFrame);
458 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 458 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
459 "CalendarView::DateNavigator" ); 459 "CalendarView::DateNavigator" );
460#if 0 460#if 0
461 // FIXME 461 // FIXME
462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
463 "CalendarView::DateNavigator", QDate::currentDate()); 463 "CalendarView::DateNavigator", QDate::currentDate());
464#endif 464#endif
465 // mDateNavigator->blockSignals( true ); 465 // mDateNavigator->blockSignals( true );
466 //leftFrameLayout->addWidget( mDateNavigator ); 466 //leftFrameLayout->addWidget( mDateNavigator );
467 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 467 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
468 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 468 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
469 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 469 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
470 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 470 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
471 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 471 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
472 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); 472 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) );
473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
474 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 474 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
475 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 475 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
476 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 476 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
478 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); 478 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() ));
479 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 479 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
480 480
481 mTodoList->setNavigator( mNavigator ); 481 mTodoList->setNavigator( mNavigator );
482#if 0 482#if 0
483 if ( QApplication::desktop()->width() < 480 ) { 483 if ( QApplication::desktop()->width() < 480 ) {
484 leftFrameLayout->addWidget(mFilterView); 484 leftFrameLayout->addWidget(mFilterView);
485 leftFrameLayout->addWidget(mTodoList, 2 ); 485 leftFrameLayout->addWidget(mTodoList, 2 );
486 486
487 } else { 487 } else {
488 leftFrameLayout->addWidget(mTodoList,2 ); 488 leftFrameLayout->addWidget(mTodoList,2 );
489 leftFrameLayout->addWidget(mFilterView ); 489 leftFrameLayout->addWidget(mFilterView );
490 } 490 }
491#endif 491#endif
492 mFilterView->hide(); 492 mFilterView->hide();
493 mCalEditView->hide(); 493 mCalEditView->hide();
494 QWidget *rightBox = new QWidget( mMainFrame ); 494 QWidget *rightBox = new QWidget( mMainFrame );
495 //mainBoxLayout->addWidget ( rightBox, 10 ); 495 //mainBoxLayout->addWidget ( rightBox, 10 );
496 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 496 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
497 mRightFrame = new QWidgetStack( rightBox ); 497 mRightFrame = new QWidgetStack( rightBox );
498 rightLayout->addWidget( mRightFrame, 10 ); 498 rightLayout->addWidget( mRightFrame, 10 );
499 499
500 //mLeftFrame = (QWidget *)leftFrame; 500 //mLeftFrame = (QWidget *)leftFrame;
501 if ( KOPrefs::instance()->mVerticalScreen ) { 501 if ( KOPrefs::instance()->mVerticalScreen ) {
@@ -2668,309 +2668,309 @@ void CalendarView::writeFilterSettings(KConfig *config)
2668void CalendarView::goToday() 2668void CalendarView::goToday()
2669{ 2669{
2670 if ( mViewManager->currentView()->isMonthView() ) 2670 if ( mViewManager->currentView()->isMonthView() )
2671 mNavigator->selectTodayMonth(); 2671 mNavigator->selectTodayMonth();
2672 else 2672 else
2673 mNavigator->selectToday(); 2673 mNavigator->selectToday();
2674} 2674}
2675 2675
2676void CalendarView::goNext() 2676void CalendarView::goNext()
2677{ 2677{
2678 mNavigator->selectNext(); 2678 mNavigator->selectNext();
2679} 2679}
2680 2680
2681void CalendarView::goPrevious() 2681void CalendarView::goPrevious()
2682{ 2682{
2683 mNavigator->selectPrevious(); 2683 mNavigator->selectPrevious();
2684} 2684}
2685void CalendarView::goNextMonth() 2685void CalendarView::goNextMonth()
2686{ 2686{
2687 mNavigator->selectNextMonth(); 2687 mNavigator->selectNextMonth();
2688} 2688}
2689 2689
2690void CalendarView::goPreviousMonth() 2690void CalendarView::goPreviousMonth()
2691{ 2691{
2692 mNavigator->selectPreviousMonth(); 2692 mNavigator->selectPreviousMonth();
2693} 2693}
2694 2694
2695void CalendarView::updateConfig() 2695void CalendarView::updateConfig()
2696{ 2696{
2697 if ( KOPrefs::instance()->mUseAppColors ) 2697 if ( KOPrefs::instance()->mUseAppColors )
2698 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2698 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2699 emit configChanged(); 2699 emit configChanged();
2700 mTodoList->updateConfig(); 2700 mTodoList->updateConfig();
2701 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2701 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2702 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2702 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2703 // To make the "fill window" configurations work 2703 // To make the "fill window" configurations work
2704 //mViewManager->raiseCurrentView(); 2704 //mViewManager->raiseCurrentView();
2705} 2705}
2706 2706
2707 2707
2708void CalendarView::eventChanged(Event *event) 2708void CalendarView::eventChanged(Event *event)
2709{ 2709{
2710 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2710 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2711 //updateUnmanagedViews(); 2711 //updateUnmanagedViews();
2712} 2712}
2713 2713
2714void CalendarView::eventAdded(Event *event) 2714void CalendarView::eventAdded(Event *event)
2715{ 2715{
2716 changeEventDisplay(event,KOGlobals::EVENTADDED); 2716 changeEventDisplay(event,KOGlobals::EVENTADDED);
2717} 2717}
2718 2718
2719void CalendarView::eventToBeDeleted(Event *) 2719void CalendarView::eventToBeDeleted(Event *)
2720{ 2720{
2721 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2721 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2722} 2722}
2723 2723
2724void CalendarView::eventDeleted() 2724void CalendarView::eventDeleted()
2725{ 2725{
2726 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2726 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2727} 2727}
2728void CalendarView::changeTodoDisplay(Todo *which, int action) 2728void CalendarView::changeTodoDisplay(Todo *which, int action)
2729{ 2729{
2730 changeIncidenceDisplay((Incidence *)which, action); 2730 changeIncidenceDisplay((Incidence *)which, action);
2731 mDateNavigator->updateView(); //LR 2731 mDateNavigator->updateView(); //LR
2732 //mDialogManager->updateSearchDialog(); 2732 //mDialogManager->updateSearchDialog();
2733 2733
2734 if (which) { 2734 if (which) {
2735 mViewManager->updateWNview(); 2735 mViewManager->updateWNview();
2736 //mTodoList->updateView(); 2736 //mTodoList->updateView();
2737 } 2737 }
2738 2738
2739} 2739}
2740 2740
2741void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2741void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2742{ 2742{
2743 updateUnmanagedViews(); 2743 updateUnmanagedViews();
2744 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2744 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2745 if ( action == KOGlobals::EVENTDELETED ) { //delete 2745 if ( action == KOGlobals::EVENTDELETED ) { //delete
2746 mCalendar->checkAlarmForIncidence( 0, true ); 2746 mCalendar->checkAlarmForIncidence( 0, true );
2747 if ( mEventViewerDialog ) 2747 if ( mEventViewerDialog )
2748 mEventViewerDialog->hide(); 2748 mEventViewerDialog->hide();
2749 } 2749 }
2750 else 2750 else
2751 mCalendar->checkAlarmForIncidence( which , false ); 2751 mCalendar->checkAlarmForIncidence( which , false );
2752} 2752}
2753 2753
2754// most of the changeEventDisplays() right now just call the view's 2754// most of the changeEventDisplays() right now just call the view's
2755// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2755// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2756void CalendarView::changeEventDisplay(Event *which, int action) 2756void CalendarView::changeEventDisplay(Event *which, int action)
2757{ 2757{
2758 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2758 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2759 changeIncidenceDisplay((Incidence *)which, action); 2759 changeIncidenceDisplay((Incidence *)which, action);
2760 static bool clearallviews = false; 2760 static bool clearallviews = false;
2761 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 2761 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2762 if ( clearallviews ) { 2762 if ( clearallviews ) {
2763 clearAllViews(); 2763 clearAllViews();
2764 clearallviews = false; 2764 clearallviews = false;
2765 } 2765 }
2766 return; 2766 return;
2767 } 2767 }
2768 clearallviews = true; 2768 clearallviews = true;
2769 mDateNavigator->updateView(); 2769 mDateNavigator->updateView();
2770 //mDialogManager->updateSearchDialog(); 2770 //mDialogManager->updateSearchDialog();
2771 if (which) { 2771 if (which) {
2772 // If there is an event view visible update the display 2772 // If there is an event view visible update the display
2773 mViewManager->currentView()->changeEventDisplay(which,action); 2773 mViewManager->currentView()->changeEventDisplay(which,action);
2774 // TODO: check, if update needed 2774 // TODO: check, if update needed
2775 // if (which->getTodoStatus()) { 2775 // if (which->getTodoStatus()) {
2776 mTodoList->updateView(); 2776 mTodoList->updateView();
2777 if ( action != KOGlobals::EVENTDELETED ) { 2777 if ( action != KOGlobals::EVENTDELETED ) {
2778 mConflictingEvent = which ; 2778 mConflictingEvent = which ;
2779 int time = 1000; 2779 int time = 1000;
2780#ifdef DESKTOP_VERSION 2780#ifdef DESKTOP_VERSION
2781 time = 500; 2781 time = 500;
2782#endif 2782#endif
2783 QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); 2783 QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) );
2784 } 2784 }
2785 // } 2785 // }
2786 } else { 2786 } else {
2787 mViewManager->currentView()->updateView(); 2787 mViewManager->currentView()->updateView();
2788 } 2788 }
2789} 2789}
2790void CalendarView::checkConflictForEvent() 2790void CalendarView::checkConflictForEvent()
2791{ 2791{
2792 2792
2793 if (!KOPrefs::instance()->mConfirm) 2793 if (!KOPrefs::instance()->mConfirm)
2794 return; 2794 return;
2795 if ( ! mConflictingEvent ) return; 2795 if ( ! mConflictingEvent ) return;
2796 Event * conflictingEvent = mConflictingEvent;
2797 mConflictingEvent = 0;
2796 QDateTime current = QDateTime::currentDateTime(); 2798 QDateTime current = QDateTime::currentDateTime();
2797 if ( ! mConflictingEvent->matchTime( &current, 0 ) ) { 2799 if ( ! conflictingEvent->matchTime( &current, 0 ) ) {
2798 mConflictingEvent = 0;
2799 return; 2800 return;
2800 } 2801 }
2801 QPtrList<Event> testlist = mCalendar->events(); 2802 QPtrList<Event> testlist = mCalendar->events();
2802 Event * test = testlist.first(); 2803 Event * test = testlist.first();
2803 QDateTime conflict; 2804 QDateTime conflict;
2804 QDateTime retVal; 2805 QDateTime retVal;
2805 bool found = false; 2806 bool found = false;
2806 Event * cE = 0; 2807 Event * cE = 0;
2807 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); 2808 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
2808 while ( test ) { 2809 while ( test ) {
2809 qApp->processEvents(); 2810 qApp->processEvents();
2810 bool skip = false; 2811 bool skip = false;
2811 if ( found ) 2812 if ( found )
2812 skip = !test->matchTime( &current, &conflict ); 2813 skip = !test->matchTime( &current, &conflict );
2813 else 2814 else
2814 skip = !test->matchTime( &current, 0 ); 2815 skip = !test->matchTime( &current, 0 );
2815 if ( !skip && !test->doesFloat() ) { 2816 if ( !skip && !test->doesFloat() ) {
2816 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) { 2817 if ( conflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
2817 if ( ! found ) { 2818 if ( ! found ) {
2818 conflict = retVal; 2819 conflict = retVal;
2819 cE = test; 2820 cE = test;
2820 } else { 2821 } else {
2821 if ( retVal < conflict ) { 2822 if ( retVal < conflict ) {
2822 conflict = retVal; 2823 conflict = retVal;
2823 cE = test; 2824 cE = test;
2824 } 2825 }
2825 } 2826 }
2826 found = true; 2827 found = true;
2827 } 2828 }
2828 } 2829 }
2829 test = testlist.next(); 2830 test = testlist.next();
2830 } 2831 }
2831 topLevelWidget()->setCaption( i18n("KO/Pi") ); 2832 topLevelWidget()->setCaption( i18n("KO/Pi") );
2832 if ( found ) { 2833 if ( found ) {
2833 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; 2834 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ;
2834 qApp->processEvents(); 2835 qApp->processEvents();
2835 int km = KMessageBox::warningContinueCancel(this,mess, 2836 int km = KMessageBox::warningContinueCancel(this,mess,
2836 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); 2837 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
2837 if ( km != KMessageBox::Continue ) { 2838 if ( km != KMessageBox::Continue ) {
2838 return; 2839 return;
2839 } 2840 }
2840 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 2841 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
2841 mViewManager->showDayView(); 2842 mViewManager->showDayView();
2842 mNavigator->slotDaySelect( conflict.date() ); 2843 mNavigator->slotDaySelect( conflict.date() );
2843 int hour = conflict.time().hour(); 2844 int hour = conflict.time().hour();
2844 mViewManager->agendaView()->setStartHour( hour ); 2845 mViewManager->agendaView()->setStartHour( hour );
2845 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); 2846 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) );
2846 } else 2847 } else
2847 topLevelWidget()->setCaption( i18n("No conflict found") ); 2848 topLevelWidget()->setCaption( i18n("No conflict found") );
2848 mConflictingEvent = 0;
2849 return; 2849 return;
2850 2850
2851} 2851}
2852 2852
2853void CalendarView::updateTodoViews() 2853void CalendarView::updateTodoViews()
2854{ 2854{
2855 mTodoList->updateView(); 2855 mTodoList->updateView();
2856 mViewManager->currentView()->updateView(); 2856 mViewManager->currentView()->updateView();
2857 2857
2858} 2858}
2859 2859
2860 2860
2861 2861
2862void CalendarView::clearAllViews() 2862void CalendarView::clearAllViews()
2863{ 2863{
2864 mTodoList->clearList(); 2864 mTodoList->clearList();
2865 mViewManager->clearAllViews(); 2865 mViewManager->clearAllViews();
2866 SearchDialog * sd = mDialogManager->getSearchDialog(); 2866 SearchDialog * sd = mDialogManager->getSearchDialog();
2867 if ( sd ) { 2867 if ( sd ) {
2868 KOListView* kol = sd->listview(); 2868 KOListView* kol = sd->listview();
2869 if ( kol ) 2869 if ( kol )
2870 kol->clearList(); 2870 kol->clearList();
2871 } 2871 }
2872} 2872}
2873void CalendarView::updateView() 2873void CalendarView::updateView()
2874{ 2874{
2875 static bool clearallviews = false; 2875 static bool clearallviews = false;
2876 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 2876 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2877 if ( clearallviews ) { 2877 if ( clearallviews ) {
2878 clearAllViews(); 2878 clearAllViews();
2879 clearallviews = false; 2879 clearallviews = false;
2880 } 2880 }
2881 return; 2881 return;
2882 } 2882 }
2883 clearallviews = true; 2883 clearallviews = true;
2884 DateList tmpList = mNavigator->selectedDates(); 2884 DateList tmpList = mNavigator->selectedDates();
2885 2885
2886 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2886 if ( KOPrefs::instance()->mHideNonStartedTodos )
2887 mTodoList->updateView(); 2887 mTodoList->updateView();
2888 // We assume that the navigator only selects consecutive days. 2888 // We assume that the navigator only selects consecutive days.
2889 updateView( tmpList.first(), tmpList.last() ); 2889 updateView( tmpList.first(), tmpList.last() );
2890} 2890}
2891 2891
2892void CalendarView::updateUnmanagedViews() 2892void CalendarView::updateUnmanagedViews()
2893{ 2893{
2894 mDateNavigator->updateDayMatrix(); 2894 mDateNavigator->updateDayMatrix();
2895} 2895}
2896 2896
2897int CalendarView::msgItemDelete(const QString name) 2897int CalendarView::msgItemDelete(const QString name)
2898{ 2898{
2899 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2899 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2900 i18n("This item will be\npermanently deleted."), 2900 i18n("This item will be\npermanently deleted."),
2901 i18n("KO/Pi Confirmation"),i18n("Delete")); 2901 i18n("KO/Pi Confirmation"),i18n("Delete"));
2902} 2902}
2903 2903
2904 2904
2905void CalendarView::edit_cut() 2905void CalendarView::edit_cut()
2906{ 2906{
2907 Event *anEvent=0; 2907 Event *anEvent=0;
2908 2908
2909 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2909 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2910 2910
2911 if (mViewManager->currentView()->isEventView()) { 2911 if (mViewManager->currentView()->isEventView()) {
2912 if ( incidence && incidence->typeID() == eventID ) { 2912 if ( incidence && incidence->typeID() == eventID ) {
2913 anEvent = static_cast<Event *>(incidence); 2913 anEvent = static_cast<Event *>(incidence);
2914 } 2914 }
2915 } 2915 }
2916 2916
2917 if (!anEvent) { 2917 if (!anEvent) {
2918 KNotifyClient::beep(); 2918 KNotifyClient::beep();
2919 return; 2919 return;
2920 } 2920 }
2921 DndFactory factory( mCalendar ); 2921 DndFactory factory( mCalendar );
2922 factory.cutIncidence(anEvent); 2922 factory.cutIncidence(anEvent);
2923 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2923 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2924} 2924}
2925 2925
2926void CalendarView::edit_copy() 2926void CalendarView::edit_copy()
2927{ 2927{
2928 Event *anEvent=0; 2928 Event *anEvent=0;
2929 2929
2930 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2930 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2931 2931
2932 if (mViewManager->currentView()->isEventView()) { 2932 if (mViewManager->currentView()->isEventView()) {
2933 if ( incidence && incidence->typeID() == eventID ) { 2933 if ( incidence && incidence->typeID() == eventID ) {
2934 anEvent = static_cast<Event *>(incidence); 2934 anEvent = static_cast<Event *>(incidence);
2935 } 2935 }
2936 } 2936 }
2937 2937
2938 if (!anEvent) { 2938 if (!anEvent) {
2939 KNotifyClient::beep(); 2939 KNotifyClient::beep();
2940 return; 2940 return;
2941 } 2941 }
2942 DndFactory factory( mCalendar ); 2942 DndFactory factory( mCalendar );
2943 factory.copyIncidence(anEvent); 2943 factory.copyIncidence(anEvent);
2944} 2944}
2945 2945
2946void CalendarView::edit_paste() 2946void CalendarView::edit_paste()
2947{ 2947{
2948 QDate date = mNavigator->selectedDates().first(); 2948 QDate date = mNavigator->selectedDates().first();
2949 2949
2950 DndFactory factory( mCalendar ); 2950 DndFactory factory( mCalendar );
2951 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2951 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2952 2952
2953 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2953 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2954} 2954}
2955void CalendarView::edit_global_options() 2955void CalendarView::edit_global_options()
2956{ 2956{
2957 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2957 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2958 emit save(); 2958 emit save();
2959 emit saveStopTimer(); 2959 emit saveStopTimer();
2960 mDialogManager->showGlobalOptionsDialog(); 2960 mDialogManager->showGlobalOptionsDialog();
2961 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2961 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2962 emit saveStopTimer(); 2962 emit saveStopTimer();
2963 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2963 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2964 i18n("Timezone settings"),i18n("Reload"))) { 2964 i18n("Timezone settings"),i18n("Reload"))) {
2965 qDebug("KO: TZ reload cancelled "); 2965 qDebug("KO: TZ reload cancelled ");
2966 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2966 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2967 return; 2967 return;
2968 } 2968 }
2969 qDebug("KO: Timezone change "); 2969 qDebug("KO: Timezone change ");
2970 loadCalendars(); 2970 loadCalendars();
2971 setModified(true); 2971 setModified(true);
2972 } 2972 }
2973 else 2973 else
2974 qDebug("KO: No tz change "); 2974 qDebug("KO: No tz change ");
2975} 2975}
2976void CalendarView::edit_options() 2976void CalendarView::edit_options()
@@ -3967,262 +3967,263 @@ void CalendarView::schedule_publish(Incidence *incidence)
3967void CalendarView::schedule_request(Incidence *incidence) 3967void CalendarView::schedule_request(Incidence *incidence)
3968{ 3968{
3969 schedule(Scheduler::Request,incidence); 3969 schedule(Scheduler::Request,incidence);
3970} 3970}
3971 3971
3972void CalendarView::schedule_refresh(Incidence *incidence) 3972void CalendarView::schedule_refresh(Incidence *incidence)
3973{ 3973{
3974 schedule(Scheduler::Refresh,incidence); 3974 schedule(Scheduler::Refresh,incidence);
3975} 3975}
3976 3976
3977void CalendarView::schedule_cancel(Incidence *incidence) 3977void CalendarView::schedule_cancel(Incidence *incidence)
3978{ 3978{
3979 schedule(Scheduler::Cancel,incidence); 3979 schedule(Scheduler::Cancel,incidence);
3980} 3980}
3981 3981
3982void CalendarView::schedule_add(Incidence *incidence) 3982void CalendarView::schedule_add(Incidence *incidence)
3983{ 3983{
3984 schedule(Scheduler::Add,incidence); 3984 schedule(Scheduler::Add,incidence);
3985} 3985}
3986 3986
3987void CalendarView::schedule_reply(Incidence *incidence) 3987void CalendarView::schedule_reply(Incidence *incidence)
3988{ 3988{
3989 schedule(Scheduler::Reply,incidence); 3989 schedule(Scheduler::Reply,incidence);
3990} 3990}
3991 3991
3992void CalendarView::schedule_counter(Incidence *incidence) 3992void CalendarView::schedule_counter(Incidence *incidence)
3993{ 3993{
3994 schedule(Scheduler::Counter,incidence); 3994 schedule(Scheduler::Counter,incidence);
3995} 3995}
3996 3996
3997void CalendarView::schedule_declinecounter(Incidence *incidence) 3997void CalendarView::schedule_declinecounter(Incidence *incidence)
3998{ 3998{
3999 schedule(Scheduler::Declinecounter,incidence); 3999 schedule(Scheduler::Declinecounter,incidence);
4000} 4000}
4001 4001
4002void CalendarView::schedule_publish_freebusy(int daysToPublish) 4002void CalendarView::schedule_publish_freebusy(int daysToPublish)
4003{ 4003{
4004 QDateTime start = QDateTime::currentDateTime(); 4004 QDateTime start = QDateTime::currentDateTime();
4005 QDateTime end = start.addDays(daysToPublish); 4005 QDateTime end = start.addDays(daysToPublish);
4006 4006
4007 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 4007 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
4008 freebusy->setOrganizer(KOPrefs::instance()->email()); 4008 freebusy->setOrganizer(KOPrefs::instance()->email());
4009 4009
4010 4010
4011 PublishDialog *publishdlg = new PublishDialog(); 4011 PublishDialog *publishdlg = new PublishDialog();
4012 if ( publishdlg->exec() == QDialog::Accepted ) { 4012 if ( publishdlg->exec() == QDialog::Accepted ) {
4013 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 4013 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
4014 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 4014 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
4015 delete(freebusy); 4015 delete(freebusy);
4016 } 4016 }
4017 } 4017 }
4018 delete publishdlg; 4018 delete publishdlg;
4019} 4019}
4020 4020
4021void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 4021void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
4022{ 4022{
4023 Event *event = 0; 4023 Event *event = 0;
4024 Todo *todo = 0; 4024 Todo *todo = 0;
4025 4025
4026 if (incidence == 0) { 4026 if (incidence == 0) {
4027 incidence = mViewManager->currentView()->selectedIncidences().first(); 4027 incidence = mViewManager->currentView()->selectedIncidences().first();
4028 if (incidence == 0) { 4028 if (incidence == 0) {
4029 incidence = mTodoList->selectedIncidences().first(); 4029 incidence = mTodoList->selectedIncidences().first();
4030 } 4030 }
4031 } 4031 }
4032 if ( incidence && incidence->typeID() == eventID ) { 4032 if ( incidence && incidence->typeID() == eventID ) {
4033 event = static_cast<Event *>(incidence); 4033 event = static_cast<Event *>(incidence);
4034 } 4034 }
4035 if ( incidence && incidence->typeID() == todoID ) { 4035 if ( incidence && incidence->typeID() == todoID ) {
4036 todo = static_cast<Todo *>(incidence); 4036 todo = static_cast<Todo *>(incidence);
4037 } 4037 }
4038 4038
4039 if (!event && !todo) { 4039 if (!event && !todo) {
4040 KMessageBox::sorry(this,i18n("No event selected.")); 4040 KMessageBox::sorry(this,i18n("No event selected."));
4041 return; 4041 return;
4042 } 4042 }
4043 4043
4044 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 4044 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
4045 KMessageBox::sorry(this,i18n("The event has no attendees.")); 4045 KMessageBox::sorry(this,i18n("The event has no attendees."));
4046 return; 4046 return;
4047 } 4047 }
4048 4048
4049 Event *ev = 0; 4049 Event *ev = 0;
4050 if (event) ev = new Event(*event); 4050 if (event) ev = new Event(*event);
4051 Todo *to = 0; 4051 Todo *to = 0;
4052 if (todo) to = new Todo(*todo); 4052 if (todo) to = new Todo(*todo);
4053 4053
4054 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 4054 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
4055 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 4055 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
4056 if (!me) { 4056 if (!me) {
4057 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 4057 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
4058 return; 4058 return;
4059 } 4059 }
4060 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 4060 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
4061 StatusDialog *statdlg = new StatusDialog(this); 4061 StatusDialog *statdlg = new StatusDialog(this);
4062 if (!statdlg->exec()==QDialog::Accepted) return; 4062 if (!statdlg->exec()==QDialog::Accepted) return;
4063 me->setStatus( statdlg->status() ); 4063 me->setStatus( statdlg->status() );
4064 delete(statdlg); 4064 delete(statdlg);
4065 } 4065 }
4066 Attendee *menew = new Attendee(*me); 4066 Attendee *menew = new Attendee(*me);
4067 if (ev) { 4067 if (ev) {
4068 ev->clearAttendees(); 4068 ev->clearAttendees();
4069 ev->addAttendee(menew,false); 4069 ev->addAttendee(menew,false);
4070 } else { 4070 } else {
4071 if (to) { 4071 if (to) {
4072 todo->clearAttendees(); 4072 todo->clearAttendees();
4073 todo->addAttendee(menew,false); 4073 todo->addAttendee(menew,false);
4074 } 4074 }
4075 } 4075 }
4076 } 4076 }
4077 4077
4078 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 4078 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
4079 if (ev) { 4079 if (ev) {
4080 if ( !dlg->addMessage(ev,method) ) delete(ev); 4080 if ( !dlg->addMessage(ev,method) ) delete(ev);
4081 } else { 4081 } else {
4082 if (to) { 4082 if (to) {
4083 if ( !dlg->addMessage(to,method) ) delete(to); 4083 if ( !dlg->addMessage(to,method) ) delete(to);
4084 } 4084 }
4085 } 4085 }
4086} 4086}
4087 4087
4088void CalendarView::openAddressbook() 4088void CalendarView::openAddressbook()
4089{ 4089{
4090 KRun::runCommand("kaddressbook"); 4090 KRun::runCommand("kaddressbook");
4091} 4091}
4092 4092
4093void CalendarView::setModified(bool modified) 4093void CalendarView::setModified(bool modified)
4094{ 4094{
4095 //qDebug("CalendarView::setModified %d ", modified);
4095 if ( modified ) 4096 if ( modified )
4096 emit signalmodified(); 4097 emit signalmodified();
4097 if (mModified != modified) { 4098 mModified = modified;
4098 mModified = modified; 4099 if ( mModified )
4099 emit modifiedChanged(mModified); 4100 emit modifiedChanged(mModified);
4100 } 4101
4101} 4102}
4102 4103
4103bool CalendarView::isReadOnly() 4104bool CalendarView::isReadOnly()
4104{ 4105{
4105 return mReadOnly; 4106 return mReadOnly;
4106} 4107}
4107 4108
4108void CalendarView::setReadOnly(bool readOnly) 4109void CalendarView::setReadOnly(bool readOnly)
4109{ 4110{
4110 if (mReadOnly != readOnly) { 4111 if (mReadOnly != readOnly) {
4111 mReadOnly = readOnly; 4112 mReadOnly = readOnly;
4112 emit readOnlyChanged(mReadOnly); 4113 emit readOnlyChanged(mReadOnly);
4113 } 4114 }
4114} 4115}
4115 4116
4116bool CalendarView::isModified() 4117bool CalendarView::isModified()
4117{ 4118{
4118 return mModified; 4119 return mModified;
4119} 4120}
4120void CalendarView::slotprintSelInc() 4121void CalendarView::slotprintSelInc()
4121{ 4122{
4122 if ( currentSelection() == 0 ) { 4123 if ( currentSelection() == 0 ) {
4123 KMessageBox::sorry(this,i18n("There is nothing selected!")); 4124 KMessageBox::sorry(this,i18n("There is nothing selected!"));
4124 return; 4125 return;
4125 } 4126 }
4126 showIncidence(); 4127 showIncidence();
4127 getEventViewerDialog()->print(); 4128 getEventViewerDialog()->print();
4128 4129
4129} 4130}
4130void CalendarView::printSetup() 4131void CalendarView::printSetup()
4131{ 4132{
4132#ifndef KORG_NOPRINTER 4133#ifndef KORG_NOPRINTER
4133 createPrinter(); 4134 createPrinter();
4134 4135
4135 mCalPrinter->setupPrinter(); 4136 mCalPrinter->setupPrinter();
4136#endif 4137#endif
4137} 4138}
4138 4139
4139void CalendarView::print() 4140void CalendarView::print()
4140{ 4141{
4141#ifndef KORG_NOPRINTER 4142#ifndef KORG_NOPRINTER
4142 createPrinter(); 4143 createPrinter();
4143 4144
4144 DateList tmpDateList = mNavigator->selectedDates(); 4145 DateList tmpDateList = mNavigator->selectedDates();
4145 mCalPrinter->print(CalPrinter::Month, 4146 mCalPrinter->print(CalPrinter::Month,
4146 tmpDateList.first(), tmpDateList.last()); 4147 tmpDateList.first(), tmpDateList.last());
4147#endif 4148#endif
4148} 4149}
4149 4150
4150void CalendarView::printPreview() 4151void CalendarView::printPreview()
4151{ 4152{
4152#ifndef KORG_NOPRINTER 4153#ifndef KORG_NOPRINTER
4153 kdDebug() << "CalendarView::printPreview()" << endl; 4154 kdDebug() << "CalendarView::printPreview()" << endl;
4154 4155
4155 createPrinter(); 4156 createPrinter();
4156 4157
4157 DateList tmpDateList = mNavigator->selectedDates(); 4158 DateList tmpDateList = mNavigator->selectedDates();
4158 4159
4159 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 4160 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
4160 tmpDateList.last()); 4161 tmpDateList.last());
4161#endif 4162#endif
4162} 4163}
4163 4164
4164void CalendarView::exportICalendar() 4165void CalendarView::exportICalendar()
4165{ 4166{
4166 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 4167 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
4167 4168
4168 // Force correct extension 4169 // Force correct extension
4169 if (filename.right(4) != ".ics") filename += ".ics"; 4170 if (filename.right(4) != ".ics") filename += ".ics";
4170 4171
4171 FileStorage storage( mCalendar, filename, new ICalFormat() ); 4172 FileStorage storage( mCalendar, filename, new ICalFormat() );
4172 storage.save(); 4173 storage.save();
4173} 4174}
4174 4175
4175bool CalendarView::exportVCalendar( QString filename ) 4176bool CalendarView::exportVCalendar( QString filename )
4176{ 4177{
4177 if (mCalendar->journals().count() > 0) { 4178 if (mCalendar->journals().count() > 0) {
4178 int result = KMessageBox::warningContinueCancel(this, 4179 int result = KMessageBox::warningContinueCancel(this,
4179 i18n("The journal entries can not be\nexported to a vCalendar file."), 4180 i18n("The journal entries can not be\nexported to a vCalendar file."),
4180 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 4181 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
4181 true); 4182 true);
4182 if (result != KMessageBox::Continue) return false; 4183 if (result != KMessageBox::Continue) return false;
4183 } 4184 }
4184 4185
4185 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 4186 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
4186 4187
4187 // Force correct extension 4188 // Force correct extension
4188 if (filename.right(4) != ".vcs") filename += ".vcs"; 4189 if (filename.right(4) != ".vcs") filename += ".vcs";
4189 4190
4190 FileStorage storage( mCalendar, filename, new VCalFormat ); 4191 FileStorage storage( mCalendar, filename, new VCalFormat );
4191 return storage.save(); 4192 return storage.save();
4192 4193
4193} 4194}
4194 4195
4195void CalendarView::eventUpdated(Incidence *) 4196void CalendarView::eventUpdated(Incidence *)
4196{ 4197{
4197 setModified(); 4198 setModified();
4198 // Don't call updateView here. The code, which has caused the update of the 4199 // Don't call updateView here. The code, which has caused the update of the
4199 // event is responsible for updating the view. 4200 // event is responsible for updating the view.
4200 // updateView(); 4201 // updateView();
4201} 4202}
4202 4203
4203void CalendarView::adaptNavigationUnits() 4204void CalendarView::adaptNavigationUnits()
4204{ 4205{
4205 if (mViewManager->currentView()->isEventView()) { 4206 if (mViewManager->currentView()->isEventView()) {
4206 int days = mViewManager->currentView()->currentDateCount(); 4207 int days = mViewManager->currentView()->currentDateCount();
4207 if (days == 1) { 4208 if (days == 1) {
4208 emit changeNavStringPrev(i18n("&Previous Day")); 4209 emit changeNavStringPrev(i18n("&Previous Day"));
4209 emit changeNavStringNext(i18n("&Next Day")); 4210 emit changeNavStringNext(i18n("&Next Day"));
4210 } else { 4211 } else {
4211 emit changeNavStringPrev(i18n("&Previous Week")); 4212 emit changeNavStringPrev(i18n("&Previous Week"));
4212 emit changeNavStringNext(i18n("&Next Week")); 4213 emit changeNavStringNext(i18n("&Next Week"));
4213 } 4214 }
4214 } 4215 }
4215} 4216}
4216 4217
4217void CalendarView::processMainViewSelection( Incidence *incidence ) 4218void CalendarView::processMainViewSelection( Incidence *incidence )
4218{ 4219{
4219 if ( incidence ) mTodoList->clearSelection(); 4220 if ( incidence ) mTodoList->clearSelection();
4220 processIncidenceSelection( incidence ); 4221 processIncidenceSelection( incidence );
4221} 4222}
4222 4223
4223void CalendarView::processTodoListSelection( Incidence *incidence ) 4224void CalendarView::processTodoListSelection( Incidence *incidence )
4224{ 4225{
4225 if ( incidence && mViewManager->currentView() ) { 4226 if ( incidence && mViewManager->currentView() ) {
4226 mViewManager->currentView()->clearSelection(); 4227 mViewManager->currentView()->clearSelection();
4227 } 4228 }
4228 processIncidenceSelection( incidence ); 4229 processIncidenceSelection( incidence );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 279955f..77d0ac8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1789,345 +1789,353 @@ void MainWindow::enableIncidenceActions( bool enabled )
1789 mBeamAction->setEnabled( enabled ); 1789 mBeamAction->setEnabled( enabled );
1790#else 1790#else
1791 mPrintSelAction->setEnabled( enabled ); 1791 mPrintSelAction->setEnabled( enabled );
1792#endif 1792#endif
1793 mCancelAction->setEnabled( enabled ); 1793 mCancelAction->setEnabled( enabled );
1794} 1794}
1795 1795
1796void MainWindow::importOL() 1796void MainWindow::importOL()
1797{ 1797{
1798#ifdef _OL_IMPORT_ 1798#ifdef _OL_IMPORT_
1799 mView->clearAllViews(); 1799 mView->clearAllViews();
1800 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1800 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1801 id->exec(); 1801 id->exec();
1802 delete id; 1802 delete id;
1803 mView->calendar()->checkAlarmForIncidence( 0, true ); 1803 mView->calendar()->checkAlarmForIncidence( 0, true );
1804 mView->updateView(); 1804 mView->updateView();
1805#endif 1805#endif
1806} 1806}
1807void MainWindow::importBday() 1807void MainWindow::importBday()
1808{ 1808{
1809 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1809 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1810 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1810 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1811 i18n("Import!"), i18n("Cancel"), 0, 1811 i18n("Import!"), i18n("Cancel"), 0,
1812 0, 1 ); 1812 0, 1 );
1813 if ( result == 0 ) { 1813 if ( result == 0 ) {
1814 mView->importBday(); 1814 mView->importBday();
1815 1815
1816 } 1816 }
1817 1817
1818 1818
1819} 1819}
1820void MainWindow::importQtopia() 1820void MainWindow::importQtopia()
1821{ 1821{
1822 //#ifndef DESKTOP_VERSION 1822 //#ifndef DESKTOP_VERSION
1823 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1823 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1824#ifdef DESKTOP_VERSION 1824#ifdef DESKTOP_VERSION
1825 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1825 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1826#endif 1826#endif
1827 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1827 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1828 i18n("Import!"), i18n("Cancel"), 0, 1828 i18n("Import!"), i18n("Cancel"), 0,
1829 0, 1 ); 1829 0, 1 );
1830 if ( result == 0 ) { 1830 if ( result == 0 ) {
1831#ifndef DESKTOP_VERSION 1831#ifndef DESKTOP_VERSION
1832 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1832 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1833 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1833 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1834 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1834 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1835#else 1835#else
1836 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1836 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1837 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1837 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1838 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1838 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1839#endif 1839#endif
1840 mView->importQtopia( categories, datebook, todolist ); 1840 mView->importQtopia( categories, datebook, todolist );
1841 } 1841 }
1842 mView->calendar()->reInitAlarmSettings(); 1842 mView->calendar()->reInitAlarmSettings();
1843#if 0 1843#if 0
1844 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1844 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1845 i18n("Not supported \non desktop!\n"), 1845 i18n("Not supported \non desktop!\n"),
1846 i18n("Ok"), i18n("Cancel"), 0, 1846 i18n("Ok"), i18n("Cancel"), 0,
1847 0, 1 ); 1847 0, 1 );
1848 1848
1849#endif 1849#endif
1850} 1850}
1851 1851
1852void MainWindow::saveOnClose() 1852void MainWindow::saveOnClose()
1853{ 1853{
1854 KOPrefs *p = KOPrefs::instance(); 1854 KOPrefs *p = KOPrefs::instance();
1855 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1855 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1856 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1856 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1857 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1857 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1858 if ( filterToolBar ) { 1858 if ( filterToolBar ) {
1859 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1859 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1860 } 1860 }
1861#ifdef DESKTOP_VERSION 1861#ifdef DESKTOP_VERSION
1862 1862
1863 QPoint myP; 1863 QPoint myP;
1864 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1864 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1865 if ( p->mToolBarHor ) 1865 if ( p->mToolBarHor )
1866 p->mToolBarUp = myP.y() > height()/2; 1866 p->mToolBarUp = myP.y() > height()/2;
1867 else 1867 else
1868 p->mToolBarUp = myP.x() > width()/2; 1868 p->mToolBarUp = myP.x() > width()/2;
1869 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1869 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1870 if ( p->mToolBarHorV ) 1870 if ( p->mToolBarHorV )
1871 p->mToolBarUpV = myP.y() > height()/2; 1871 p->mToolBarUpV = myP.y() > height()/2;
1872 else 1872 else
1873 p->mToolBarUpV = myP.x() > width()/2 ; 1873 p->mToolBarUpV = myP.x() > width()/2 ;
1874 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1874 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1875 if ( p->mToolBarHorN ) 1875 if ( p->mToolBarHorN )
1876 p->mToolBarUpN = myP.y() > height()/2; 1876 p->mToolBarUpN = myP.y() > height()/2;
1877 else 1877 else
1878 p->mToolBarUpN = myP.x() > width()/2 ; 1878 p->mToolBarUpN = myP.x() > width()/2 ;
1879 if ( filterToolBar ) { 1879 if ( filterToolBar ) {
1880 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1880 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1881 if ( p->mToolBarHorF ) 1881 if ( p->mToolBarHorF )
1882 p->mToolBarUpF = myP.y() > height()/2; 1882 p->mToolBarUpF = myP.y() > height()/2;
1883 else 1883 else
1884 p->mToolBarUpF = myP.x() > width()/2 ; 1884 p->mToolBarUpF = myP.x() > width()/2 ;
1885 } 1885 }
1886#else 1886#else
1887 if ( p->mToolBarHor ) 1887 if ( p->mToolBarHor )
1888 p->mToolBarUp = iconToolBar->y() > height()/2; 1888 p->mToolBarUp = iconToolBar->y() > height()/2;
1889 else 1889 else
1890 p->mToolBarUp = iconToolBar->x() > width()/2; 1890 p->mToolBarUp = iconToolBar->x() > width()/2;
1891 if ( p->mToolBarHorV ) 1891 if ( p->mToolBarHorV )
1892 p->mToolBarUpV = viewToolBar->y() > height()/2; 1892 p->mToolBarUpV = viewToolBar->y() > height()/2;
1893 else 1893 else
1894 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1894 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1895 1895
1896 if ( p->mToolBarHorN ) 1896 if ( p->mToolBarHorN )
1897 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1897 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1898 else 1898 else
1899 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1899 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1900 if ( filterToolBar ) { 1900 if ( filterToolBar ) {
1901 if ( p->mToolBarHorF ) 1901 if ( p->mToolBarHorF )
1902 p->mToolBarUpF = filterToolBar->y() > height()/2; 1902 p->mToolBarUpF = filterToolBar->y() > height()/2;
1903 else 1903 else
1904 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1904 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1905 } 1905 }
1906#endif 1906#endif
1907 save(); 1907 save();
1908 mView->writeSettings(); 1908 mView->writeSettings();
1909 mView->checkSuspendAlarm(); 1909 mView->checkSuspendAlarm();
1910} 1910}
1911void MainWindow::slotModifiedChanged( bool ) 1911void MainWindow::slotModifiedChanged( bool )
1912{ 1912{
1913 if ( mBlockAtStartup ) 1913 if ( mBlockAtStartup )
1914 return; 1914 return;
1915 1915
1916 int msec; 1916 int msec;
1917 if ( mCalendarModifiedFlag ) {
1918 //qDebug(" MainWindow timer is running ");
1919 return;
1920 }
1917 // we store the changes after 1 minute, 1921 // we store the changes after 1 minute,
1918 // and for safety reasons after 10 minutes again 1922 // and for safety reasons after 10 minutes again
1919 if ( !mSyncManager->blockSave() ) 1923 if ( !mSyncManager->blockSave() )
1920 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1924 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1921 else 1925 else
1922 msec = 1000 * 600; 1926 msec = 1000 * 600;
1923 mSaveTimer.start( msec, true ); // 1 minute 1927 mSaveTimer.start( msec, true ); // 1 minute
1924 qDebug("KO: Saving File in %d secs!", msec/1000); 1928 qDebug("KO: Saving File in %d secs!", msec/1000);
1925 mCalendarModifiedFlag = true; 1929 mCalendarModifiedFlag = true;
1926} 1930}
1927void MainWindow::saveStopTimer() 1931void MainWindow::saveStopTimer()
1928{ 1932{
1929 mSaveTimer.stop(); 1933 mSaveTimer.stop();
1930} 1934}
1931void MainWindow::backupAllFiles() 1935void MainWindow::backupAllFiles()
1932{ 1936{
1933 QDate reference ( 2000,1,1); 1937 QDate reference ( 2000,1,1);
1934 int daysTo = reference.daysTo ( QDate::currentDate() ); 1938 int daysTo = reference.daysTo ( QDate::currentDate() );
1935 setCaption(i18n("Creating backup ... please wait ..." )); 1939 setCaption(i18n("Creating backup ... please wait ..." ));
1936 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1940 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1937 // we need the file path, the backup dir and the number of bups as param 1941 // we need the file path, the backup dir and the number of bups as param
1938 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1942 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1939 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1943 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1940 bupDir = KGlobalSettings::backupDataDir(); 1944 bupDir = KGlobalSettings::backupDataDir();
1941 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1945 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1942 if ( retval == 0 ) { 1946 if ( retval == 0 ) {
1943 setCaption(i18n("Backup cancelled" )); 1947 setCaption(i18n("Backup cancelled" ));
1944 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1948 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1945 // retval == 0 : backup skipped for today, try again tomorrow 1949 // retval == 0 : backup skipped for today, try again tomorrow
1946 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1950 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1947 } else if ( retval == 1 ){ 1951 } else if ( retval == 1 ){
1948 qDebug("KO: Backup created."); 1952 qDebug("KO: Backup created.");
1949 // backup ok 1953 // backup ok
1950 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1954 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1951 KopiCalendarFile * cal = calendars.first(); 1955 KopiCalendarFile * cal = calendars.first();
1952 cal = calendars.next(); 1956 cal = calendars.next();
1953 while ( cal ) { 1957 while ( cal ) {
1954 if ( !cal->mErrorOnLoad ) { 1958 if ( !cal->mErrorOnLoad ) {
1955 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1959 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1956 } 1960 }
1957 cal = calendars.next(); 1961 cal = calendars.next();
1958 } 1962 }
1959 KOPrefs::instance()->mLastBackupDate = daysTo; 1963 KOPrefs::instance()->mLastBackupDate = daysTo;
1960 setCaption(i18n("Backup succesfully finished" )); 1964 setCaption(i18n("Backup succesfully finished" ));
1961 } else if ( retval == 2 ){ 1965 } else if ( retval == 2 ){
1962 setCaption(i18n("Backup globally disabled" )); 1966 setCaption(i18n("Backup globally disabled" ));
1963 qDebug("KO: Backup globally cancelled."); 1967 qDebug("KO: Backup globally cancelled.");
1964 // backup globally cancelled 1968 // backup globally cancelled
1965 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1969 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1966 } 1970 }
1967 // retval == 3: do nothing, try again later 1971 // retval == 3: do nothing, try again later
1968} 1972}
1969void MainWindow::save() 1973void MainWindow::save()
1970{ 1974{
1971 1975
1972 if ( mView->viewManager()->journalView() ) 1976 if ( mView->viewManager()->journalView() )
1973 mView->viewManager()->journalView()->checkModified(); 1977 mView->viewManager()->journalView()->checkModified();
1974 if ( !mCalendarModifiedFlag ) { 1978 if ( !mCalendarModifiedFlag ) {
1975 qDebug("KO: Calendar not modified. Nothing saved."); 1979 qDebug("KO: Calendar not modified. Nothing saved.");
1976 return; 1980 return;
1977 } 1981 }
1978 if ( mSyncManager->blockSave() ) 1982 if ( mSyncManager->blockSave() ) {
1979 return; 1983 return;
1984 }
1980 mSyncManager->setBlockSave(true); 1985 mSyncManager->setBlockSave(true);
1981 if ( mView->checkAllFileVersions() ) { 1986 if ( mView->checkAllFileVersions() ) {
1982 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1987 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1983 QDate reference ( 2000,1,1); 1988 QDate reference ( 2000,1,1);
1984 int daysTo = reference.daysTo ( QDate::currentDate() ); 1989 int daysTo = reference.daysTo ( QDate::currentDate() );
1985 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1990 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1986 backupAllFiles(); 1991 backupAllFiles();
1987 } 1992 }
1988 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1993 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1989 } 1994 }
1990 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1995 QTime neededSaveTime = QDateTime::currentDateTime().time();
1991 if ( !isMinimized () ) 1996 if ( !isMinimized () )
1992 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1997 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1993 qDebug("KO: Start saving data to file!"); 1998 qDebug("KO: Start saving data to file!");
1994 mView->saveCalendars(); 1999 mView->saveCalendars();
1995 mCalendarModifiedFlag = false; 2000 mCalendarModifiedFlag = false;
1996 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 2001 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1997 qDebug("KO: Needed %d ms for saving.",msNeeded ); 2002 qDebug("KO: Needed %d ms for saving.",msNeeded );
1998 QString savemes; 2003 QString savemes;
1999 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 2004 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
2000 if ( !isMinimized () ) 2005 if ( !isMinimized () )
2001 setCaption(savemes); 2006 setCaption(savemes);
2002 else 2007 else
2003 qDebug(savemes); 2008 qDebug(savemes);
2004 } else 2009 } else {
2005 setCaption(i18n("Saving cancelled!")); 2010 setCaption(i18n("Saving cancelled!"));
2011 mCalendarModifiedFlag = false;
2012 slotModifiedChanged( true );
2013 }
2006 mSyncManager->setBlockSave( false ); 2014 mSyncManager->setBlockSave( false );
2007} 2015}
2008 2016
2009void MainWindow::keyReleaseEvent ( QKeyEvent * e) 2017void MainWindow::keyReleaseEvent ( QKeyEvent * e)
2010{ 2018{
2011 if ( !e->isAutoRepeat() ) { 2019 if ( !e->isAutoRepeat() ) {
2012 mFlagKeyPressed = false; 2020 mFlagKeyPressed = false;
2013 } 2021 }
2014} 2022}
2015void MainWindow::keyPressEvent ( QKeyEvent * e ) 2023void MainWindow::keyPressEvent ( QKeyEvent * e )
2016{ 2024{
2017 qApp->processEvents(); 2025 qApp->processEvents();
2018 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2026 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
2019 e->ignore(); 2027 e->ignore();
2020 // qDebug(" ignore %d",e->isAutoRepeat() ); 2028 // qDebug(" ignore %d",e->isAutoRepeat() );
2021 return; 2029 return;
2022 } 2030 }
2023 if (! e->isAutoRepeat() ) 2031 if (! e->isAutoRepeat() )
2024 mFlagKeyPressed = true; 2032 mFlagKeyPressed = true;
2025 KOPrefs *p = KOPrefs::instance(); 2033 KOPrefs *p = KOPrefs::instance();
2026 bool showSelectedDates = false; 2034 bool showSelectedDates = false;
2027 int size; 2035 int size;
2028 int pro = 0; 2036 int pro = 0;
2029 //qDebug("MainWindow::keyPressEvent "); 2037 //qDebug("MainWindow::keyPressEvent ");
2030 switch ( e->key() ) { 2038 switch ( e->key() ) {
2031 case Qt::Key_Right: 2039 case Qt::Key_Right:
2032 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2040 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2033 mView->goNextMonth(); 2041 mView->goNextMonth();
2034 else 2042 else
2035 mView->goNext(); 2043 mView->goNext();
2036 showSelectedDates = true; 2044 showSelectedDates = true;
2037 break; 2045 break;
2038 case Qt::Key_Left: 2046 case Qt::Key_Left:
2039 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2047 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2040 mView->goPreviousMonth(); 2048 mView->goPreviousMonth();
2041 else 2049 else
2042 mView->goPrevious(); 2050 mView->goPrevious();
2043 showSelectedDates = true; 2051 showSelectedDates = true;
2044 break; 2052 break;
2045 case Qt::Key_Down: 2053 case Qt::Key_Down:
2046 mView->viewManager()->agendaView()->scrollOneHourDown(); 2054 mView->viewManager()->agendaView()->scrollOneHourDown();
2047 break; 2055 break;
2048 case Qt::Key_Up: 2056 case Qt::Key_Up:
2049 mView->viewManager()->agendaView()->scrollOneHourUp(); 2057 mView->viewManager()->agendaView()->scrollOneHourUp();
2050 break; 2058 break;
2051 case Qt::Key_K: 2059 case Qt::Key_K:
2052 mView->viewManager()->showMonthViewWeek(); 2060 mView->viewManager()->showMonthViewWeek();
2053 break; 2061 break;
2054 case Qt::Key_I: 2062 case Qt::Key_I:
2055 mView->showIncidence(); 2063 mView->showIncidence();
2056 break; 2064 break;
2057 case Qt::Key_Delete: 2065 case Qt::Key_Delete:
2058 case Qt::Key_Backspace: 2066 case Qt::Key_Backspace:
2059 mView->deleteIncidence(); 2067 mView->deleteIncidence();
2060 break; 2068 break;
2061 case Qt::Key_D: 2069 case Qt::Key_D:
2062 mView->viewManager()->showDayView(); 2070 mView->viewManager()->showDayView();
2063 showSelectedDates = true; 2071 showSelectedDates = true;
2064 break; 2072 break;
2065 case Qt::Key_O: 2073 case Qt::Key_O:
2066 mView->toggleFilerEnabled( ); 2074 mView->toggleFilerEnabled( );
2067 break; 2075 break;
2068 case Qt::Key_0: 2076 case Qt::Key_0:
2069 case Qt::Key_1: 2077 case Qt::Key_1:
2070 case Qt::Key_2: 2078 case Qt::Key_2:
2071 case Qt::Key_3: 2079 case Qt::Key_3:
2072 case Qt::Key_4: 2080 case Qt::Key_4:
2073 case Qt::Key_5: 2081 case Qt::Key_5:
2074 case Qt::Key_6: 2082 case Qt::Key_6:
2075 case Qt::Key_7: 2083 case Qt::Key_7:
2076 case Qt::Key_8: 2084 case Qt::Key_8:
2077 case Qt::Key_9: 2085 case Qt::Key_9:
2078 pro = e->key()-48; 2086 pro = e->key()-48;
2079 if ( pro == 0 ) 2087 if ( pro == 0 )
2080 pro = 10; 2088 pro = 10;
2081 if ( e->state() == Qt::ControlButton) 2089 if ( e->state() == Qt::ControlButton)
2082 pro += 10; 2090 pro += 10;
2083 break; 2091 break;
2084 case Qt::Key_M: 2092 case Qt::Key_M:
2085 mView->viewManager()->showMonthView(); 2093 mView->viewManager()->showMonthView();
2086 showSelectedDates = true; 2094 showSelectedDates = true;
2087 break; 2095 break;
2088 case Qt::Key_Insert: 2096 case Qt::Key_Insert:
2089 mView->newEvent(); 2097 mView->newEvent();
2090 break; 2098 break;
2091 case Qt::Key_S : 2099 case Qt::Key_S :
2092 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2100 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2093 mView->newSubTodo(); 2101 mView->newSubTodo();
2094 else 2102 else
2095 mView->dialogManager()->showSearchDialog(); 2103 mView->dialogManager()->showSearchDialog();
2096 break; 2104 break;
2097 case Qt::Key_Y : 2105 case Qt::Key_Y :
2098 case Qt::Key_Z : 2106 case Qt::Key_Z :
2099 mView->viewManager()->showWorkWeekView(); 2107 mView->viewManager()->showWorkWeekView();
2100 showSelectedDates = true; 2108 showSelectedDates = true;
2101 break; 2109 break;
2102 case Qt::Key_U : 2110 case Qt::Key_U :
2103 mView->viewManager()->showWeekView(); 2111 mView->viewManager()->showWeekView();
2104 showSelectedDates = true; 2112 showSelectedDates = true;
2105 break; 2113 break;
2106 case Qt::Key_H : 2114 case Qt::Key_H :
2107 keyBindings(); 2115 keyBindings();
2108 break; 2116 break;
2109 case Qt::Key_W: 2117 case Qt::Key_W:
2110 mView->viewManager()->showWhatsNextView(); 2118 mView->viewManager()->showWhatsNextView();
2111 break; 2119 break;
2112 case Qt::Key_L: 2120 case Qt::Key_L:
2113 mView->viewManager()->showListView(); 2121 mView->viewManager()->showListView();
2114 break; 2122 break;
2115 case Qt::Key_N: 2123 case Qt::Key_N:
2116 mView->viewManager()->showNextView(); 2124 mView->viewManager()->showNextView();
2117 break; 2125 break;
2118 case Qt::Key_V: 2126 case Qt::Key_V:
2119 mView->viewManager()->showTodoView(); 2127 mView->viewManager()->showTodoView();
2120 break; 2128 break;
2121 case Qt::Key_C: 2129 case Qt::Key_C:
2122 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2130 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2123 break; 2131 break;
2124 case Qt::Key_P: 2132 case Qt::Key_P:
2125 mView->showDatePicker( ); 2133 mView->showDatePicker( );
2126 break; 2134 break;
2127 case Qt::Key_F: 2135 case Qt::Key_F:
2128 mView->editFilters(); 2136 mView->editFilters();
2129 break; 2137 break;
2130 case Qt::Key_R: 2138 case Qt::Key_R:
2131 mView->toggleFilter(); 2139 mView->toggleFilter();
2132 break; 2140 break;
2133 case Qt::Key_X: 2141 case Qt::Key_X: