summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp7
-rw-r--r--korganizer/calendarview.h3
-rw-r--r--korganizer/koagenda.cpp5
-rw-r--r--korganizer/mainwindow.cpp12
-rw-r--r--korganizer/mainwindow.h5
-rw-r--r--microkde/kdeui/kbuttonbox.cpp2
-rw-r--r--microkde/kdeui/kpopupmenu.cpp19
-rw-r--r--microkde/kdeui/kpopupmenu.h22
-rw-r--r--microkde/microkde.pro2
-rw-r--r--microkde/microkdeE.pro2
10 files changed, 64 insertions, 15 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 5a2482e..17f1659 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -274,768 +274,775 @@ class 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
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 ) {
502 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 502 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
503 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 503 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
504 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 504 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
505 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 505 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
506 } else { 506 } else {
507 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 507 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
508 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 508 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
509 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 509 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
510 } 510 }
511 if ( !KOPrefs::instance()->mShowDateNavigator) 511 if ( !KOPrefs::instance()->mShowDateNavigator)
512 mDateNavigator->hide(); 512 mDateNavigator->hide();
513 //qDebug("Calendarview Size %d %d ", width(), height()); 513 //qDebug("Calendarview Size %d %d ", width(), height());
514#endif 514#endif
515 515
516 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 516 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
517 SLOT( showDates( const KCal::DateList & ) ) ); 517 SLOT( showDates( const KCal::DateList & ) ) );
518 518
519 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 519 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
520 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 520 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
521 521
522 522
523 523
524 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 524 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
525 mViewManager, SLOT( showMonth( const QDate & ) ) ); 525 mViewManager, SLOT( showMonth( const QDate & ) ) );
526 526
527 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 527 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
528 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 528 mNavigator, SLOT( selectWeek( const QDate & ) ) );
529 529
530 connect( mDateNavigator, SIGNAL( goPrevYear() ), 530 connect( mDateNavigator, SIGNAL( goPrevYear() ),
531 mNavigator, SLOT( selectPreviousYear() ) ); 531 mNavigator, SLOT( selectPreviousYear() ) );
532 connect( mDateNavigator, SIGNAL( goNextYear() ), 532 connect( mDateNavigator, SIGNAL( goNextYear() ),
533 mNavigator, SLOT( selectNextYear() ) ); 533 mNavigator, SLOT( selectNextYear() ) );
534 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 534 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
535 mNavigator, SLOT( selectPreviousMonth() ) ); 535 mNavigator, SLOT( selectPreviousMonth() ) );
536 connect( mDateNavigator, SIGNAL( goNextMonth() ), 536 connect( mDateNavigator, SIGNAL( goNextMonth() ),
537 mNavigator, SLOT( selectNextMonth() ) ); 537 mNavigator, SLOT( selectNextMonth() ) );
538 538
539 connect( mDateNavigator, SIGNAL( goPrevious() ), 539 connect( mDateNavigator, SIGNAL( goPrevious() ),
540 mNavigator, SLOT( selectPrevious() ) ); 540 mNavigator, SLOT( selectPrevious() ) );
541 connect( mDateNavigator, SIGNAL( goNext() ), 541 connect( mDateNavigator, SIGNAL( goNext() ),
542 mNavigator, SLOT( selectNext() ) ); 542 mNavigator, SLOT( selectNext() ) );
543 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 543 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
544 mNavigator, SLOT( slotMonthSelect( int ) ) ); 544 mNavigator, SLOT( slotMonthSelect( int ) ) );
545 545
546 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 546 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
547 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 547 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
548#if 0 548#if 0
549 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 549 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
550 SLOT( incidenceAdded( Incidence *) ) ); 550 SLOT( incidenceAdded( Incidence *) ) );
551#endif 551#endif
552 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 552 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
553 553
554 connect( this, SIGNAL( configChanged() ), 554 connect( this, SIGNAL( configChanged() ),
555 mDateNavigator, SLOT( updateConfig() ) ); 555 mDateNavigator, SLOT( updateConfig() ) );
556 556
557 connect( mTodoList, SIGNAL( newTodoSignal() ), 557 connect( mTodoList, SIGNAL( newTodoSignal() ),
558 SLOT( newTodo() ) ); 558 SLOT( newTodo() ) );
559 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 559 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
560 SLOT( newSubTodo( Todo * ) ) ); 560 SLOT( newSubTodo( Todo * ) ) );
561 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 561 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
562 SLOT( editTodo( Todo * ) ) ); 562 SLOT( editTodo( Todo * ) ) );
563 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 563 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
564 SLOT( showTodo( Todo *) ) ); 564 SLOT( showTodo( Todo *) ) );
565 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 565 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
566 SLOT( deleteTodo( Todo *) ) ); 566 SLOT( deleteTodo( Todo *) ) );
567 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 567 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
568 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 568 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
569 SLOT( purgeCompleted() ) ); 569 SLOT( purgeCompleted() ) );
570 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 570 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
571 SIGNAL( todoModified( Todo *, int ) ) ); 571 SIGNAL( todoModified( Todo *, int ) ) );
572 572
573 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 573 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
574 this, SLOT ( cloneIncidence( Incidence * ) ) ); 574 this, SLOT ( cloneIncidence( Incidence * ) ) );
575 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 575 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
576 this, SLOT (cancelIncidence( Incidence * ) ) ); 576 this, SLOT (cancelIncidence( Incidence * ) ) );
577 577
578 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 578 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
579 this, SLOT ( moveIncidence( Incidence * ) ) ); 579 this, SLOT ( moveIncidence( Incidence * ) ) );
580 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 580 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
581 this, SLOT ( beamIncidence( Incidence * ) ) ); 581 this, SLOT ( beamIncidence( Incidence * ) ) );
582 582
583 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 583 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
584 this, SLOT ( todo_unsub( Todo * ) ) ); 584 this, SLOT ( todo_unsub( Todo * ) ) );
585 585
586 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 586 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
587 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 587 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
588 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 588 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
589 SLOT( updateTodo( Todo *, int ) ) ); 589 SLOT( updateTodo( Todo *, int ) ) );
590 connect( this, SIGNAL( todoModified( Todo *, int )), this, 590 connect( this, SIGNAL( todoModified( Todo *, int )), this,
591 SLOT( changeTodoDisplay( Todo *, int ) ) ); 591 SLOT( changeTodoDisplay( Todo *, int ) ) );
592 592
593 593
594 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 594 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
595 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 595 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
596 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 596 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
597 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 597 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
598 598
599 599
600 600
601 601
602 602
603 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 603 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
604 SLOT(checkClipboard())); 604 SLOT(checkClipboard()));
605 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 605 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
606 SLOT( processTodoListSelection( Incidence * ) ) ); 606 SLOT( processTodoListSelection( Incidence * ) ) );
607 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 607 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
608 608
609 // kdDebug() << "CalendarView::CalendarView() done" << endl; 609 // kdDebug() << "CalendarView::CalendarView() done" << endl;
610 610
611 mDateFrame = new QVBox(0,0,WType_Popup); 611 mDateFrame = new QVBox(0,0,WType_Popup);
612 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 612 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
613 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 613 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
614 mDateFrame->setLineWidth(3); 614 mDateFrame->setLineWidth(3);
615 mDateFrame->hide(); 615 mDateFrame->hide();
616 mDateFrame->setCaption( i18n( "Pick a date to display")); 616 mDateFrame->setCaption( i18n( "Pick a date to display"));
617 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 617 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
618 618
619 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 619 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
620 620
621 mEventEditor = mDialogManager->getEventEditor(); 621 mEventEditor = mDialogManager->getEventEditor();
622 mTodoEditor = mDialogManager->getTodoEditor(); 622 mTodoEditor = mDialogManager->getTodoEditor();
623 623
624 mFlagEditDescription = false; 624 mFlagEditDescription = false;
625 625
626 mSuspendTimer = new QTimer( this ); 626 mSuspendTimer = new QTimer( this );
627 mAlarmTimer = new QTimer( this ); 627 mAlarmTimer = new QTimer( this );
628 mRecheckAlarmTimer = new QTimer( this ); 628 mRecheckAlarmTimer = new QTimer( this );
629 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 629 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
630 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 630 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
631 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 631 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
632 mAlarmDialog = new AlarmDialog( this ); 632 mAlarmDialog = new AlarmDialog( this );
633 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 633 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
634 mAlarmDialog->setServerNotification( false ); 634 mAlarmDialog->setServerNotification( false );
635 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 635 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
636 636
637 637
638#ifndef DESKTOP_VERSION 638#ifndef DESKTOP_VERSION
639//US listen for arriving address resultsets 639//US listen for arriving address resultsets
640 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 640 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
641 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 641 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
642#endif 642#endif
643 mDateNavigator->setCalendar( mCalendar ); 643 mDateNavigator->setCalendar( mCalendar );
644} 644}
645 645
646 646
647CalendarView::~CalendarView() 647CalendarView::~CalendarView()
648{ 648{
649 // kdDebug() << "~CalendarView()" << endl; 649 // kdDebug() << "~CalendarView()" << endl;
650 //qDebug("CalendarView::~CalendarView() "); 650 //qDebug("CalendarView::~CalendarView() ");
651 delete mDialogManager; 651 delete mDialogManager;
652 delete mViewManager; 652 delete mViewManager;
653 delete mStorage; 653 delete mStorage;
654 delete mDateFrame ; 654 delete mDateFrame ;
655 delete mEventViewerDialog; 655 delete mEventViewerDialog;
656 //kdDebug() << "~CalendarView() done" << endl; 656 //kdDebug() << "~CalendarView() done" << endl;
657} 657}
658
659void CalendarView::slotResetFocus()
660{
661 qDebug(" CalendarView::slotResetFocus() %x", qApp->focusWidget());
662
663}
664
658void CalendarView::nextConflict( bool all, bool allday ) 665void CalendarView::nextConflict( bool all, bool allday )
659{ 666{
660 667
661 QPtrList<Event> testlist = mCalendar->events(); 668 QPtrList<Event> testlist = mCalendar->events();
662 Event * test = testlist.first(); 669 Event * test = testlist.first();
663 while ( test ) { 670 while ( test ) {
664 test->setTagged( false ); 671 test->setTagged( false );
665 test = testlist.next(); 672 test = testlist.next();
666 } 673 }
667 QTime st ( 0,0,0); 674 QTime st ( 0,0,0);
668 if ( mViewManager->currentView() == mViewManager->agendaView() ) 675 if ( mViewManager->currentView() == mViewManager->agendaView() )
669 st = mViewManager->agendaView()->agenda()->getEndTime(); 676 st = mViewManager->agendaView()->agenda()->getEndTime();
670 //qDebug("time %s ", st.toString().latin1()); 677 //qDebug("time %s ", st.toString().latin1());
671 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); 678 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st);
672 QDateTime conflict; 679 QDateTime conflict;
673 QDateTime retVal; 680 QDateTime retVal;
674 bool found = false; 681 bool found = false;
675 Event * cE = 0; 682 Event * cE = 0;
676 Event * cE2 = 0; 683 Event * cE2 = 0;
677 QPtrList<Event> testlist2 = testlist; 684 QPtrList<Event> testlist2 = testlist;
678 test = testlist.first(); 685 test = testlist.first();
679 bool skip = false; 686 bool skip = false;
680 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); 687 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
681 while ( test ) { 688 while ( test ) {
682 qApp->processEvents(); 689 qApp->processEvents();
683 skip = false; 690 skip = false;
684 if ( !all ) skip = ( allday != test->doesFloat() ); 691 if ( !all ) skip = ( allday != test->doesFloat() );
685 if ( !skip ) { 692 if ( !skip ) {
686 Event * test2 = testlist2.first(); 693 Event * test2 = testlist2.first();
687 while ( test2 ) { 694 while ( test2 ) {
688 skip = false; 695 skip = false;
689 if ( !all ) skip = ( allday != test2->doesFloat() ); 696 if ( !all ) skip = ( allday != test2->doesFloat() );
690 if ( !skip ) { 697 if ( !skip ) {
691 if ( !test2->isTagged() ) { 698 if ( !test2->isTagged() ) {
692 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { 699 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
693 //qDebug("overlap "); 700 //qDebug("overlap ");
694 if ( ! found ) { 701 if ( ! found ) {
695 if ( retVal >= startDT ) { 702 if ( retVal >= startDT ) {
696 conflict = retVal; 703 conflict = retVal;
697 cE = test; 704 cE = test;
698 cE2 = test2; 705 cE2 = test2;
699 found = true; 706 found = true;
700 } 707 }
701 } else { 708 } else {
702 if ( retVal >= startDT && retVal < conflict ) { 709 if ( retVal >= startDT && retVal < conflict ) {
703 conflict = retVal; 710 conflict = retVal;
704 cE = test; 711 cE = test;
705 cE2 = test2; 712 cE2 = test2;
706 } 713 }
707 } 714 }
708 } 715 }
709 } 716 }
710 } 717 }
711 test2 = testlist2.next(); 718 test2 = testlist2.next();
712 } 719 }
713 } 720 }
714 test->setTagged( true ); 721 test->setTagged( true );
715 test = testlist.next(); 722 test = testlist.next();
716 } 723 }
717 if ( found ) { 724 if ( found ) {
718 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 725 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
719 mViewManager->showDayView(); 726 mViewManager->showDayView();
720 mNavigator->slotDaySelect( conflict.date() ); 727 mNavigator->slotDaySelect( conflict.date() );
721 int hour = conflict.time().hour(); 728 int hour = conflict.time().hour();
722 mViewManager->agendaView()->setStartHour( hour ); 729 mViewManager->agendaView()->setStartHour( hour );
723 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); 730 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
724 return; 731 return;
725 } 732 }
726 733
727 topLevelWidget()->setCaption( i18n("No conflict found") ); 734 topLevelWidget()->setCaption( i18n("No conflict found") );
728 qDebug("No conflict found "); 735 qDebug("No conflict found ");
729 return; 736 return;
730} 737}
731 738
732void CalendarView::conflictAll() 739void CalendarView::conflictAll()
733{ 740{
734 nextConflict ( true, true ); 741 nextConflict ( true, true );
735} 742}
736void CalendarView::conflictAllday() 743void CalendarView::conflictAllday()
737{ 744{
738 nextConflict ( false, true ); 745 nextConflict ( false, true );
739} 746}
740void CalendarView::conflictNotAll() 747void CalendarView::conflictNotAll()
741{ 748{
742 nextConflict ( false, false ); 749 nextConflict ( false, false );
743} 750}
744 751
745void CalendarView::setCalReadOnly( int id, bool readO ) 752void CalendarView::setCalReadOnly( int id, bool readO )
746{ 753{
747 if ( readO ) { 754 if ( readO ) {
748 emit save(); 755 emit save();
749 } 756 }
750 mCalendar->setReadOnly( id, readO ); 757 mCalendar->setReadOnly( id, readO );
751} 758}
752void CalendarView::setScrollBarStep(int val ) 759void CalendarView::setScrollBarStep(int val )
753{ 760{
754#ifdef DESKTOP_VERSION 761#ifdef DESKTOP_VERSION
755 mDateScrollBar->setLineStep ( val ); 762 mDateScrollBar->setLineStep ( val );
756#endif 763#endif
757} 764}
758void CalendarView::scrollBarValue(int val ) 765void CalendarView::scrollBarValue(int val )
759{ 766{
760#ifdef DESKTOP_VERSION 767#ifdef DESKTOP_VERSION
761 if ( QApplication::desktop()->width() < 800 ) return; 768 if ( QApplication::desktop()->width() < 800 ) return;
762 static bool block = false; 769 static bool block = false;
763 if ( block ) return; 770 if ( block ) return;
764 block = true; 771 block = true;
765 int count = mNavigator->selectedDates().count(); 772 int count = mNavigator->selectedDates().count();
766 int day = mNavigator->selectedDates().first().dayOfYear(); 773 int day = mNavigator->selectedDates().first().dayOfYear();
767 int stepdays = val; 774 int stepdays = val;
768 if ( mDateScrollBar->lineStep () <= count ) { 775 if ( mDateScrollBar->lineStep () <= count ) {
769 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 776 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
770 //qDebug("VAL %d ",val ); 777 //qDebug("VAL %d ",val );
771 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 778 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
772 stepdays = day+stepdays; 779 stepdays = day+stepdays;
773 if ( stepdays < 0 ) stepdays = 0; 780 if ( stepdays < 0 ) stepdays = 0;
774 } 781 }
775 if ( stepdays == day ) { 782 if ( stepdays == day ) {
776 block = false; 783 block = false;
777 return; 784 return;
778 } 785 }
779 int year = mNavigator->selectedDates().first().year(); 786 int year = mNavigator->selectedDates().first().year();
780 QDate d ( year,1,1 ); 787 QDate d ( year,1,1 );
781 mNavigator->selectDates( d.addDays( stepdays-1) , count ); 788 mNavigator->selectDates( d.addDays( stepdays-1) , count );
782 block = false; 789 block = false;
783#endif 790#endif
784 791
785} 792}
786void CalendarView::updateView(const QDate &start, const QDate &end) 793void CalendarView::updateView(const QDate &start, const QDate &end)
787{ 794{
788#ifdef DESKTOP_VERSION 795#ifdef DESKTOP_VERSION
789 if ( ! mDateScrollBar->draggingSlider () ) { 796 if ( ! mDateScrollBar->draggingSlider () ) {
790 int dof = start.dayOfYear(); 797 int dof = start.dayOfYear();
791 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); 798 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() );
792 if ( dof != mDateScrollBar->value() ) { 799 if ( dof != mDateScrollBar->value() ) {
793 mDateScrollBar->blockSignals( true ); 800 mDateScrollBar->blockSignals( true );
794 mDateScrollBar->setValue( start.dayOfYear()); 801 mDateScrollBar->setValue( start.dayOfYear());
795 mDateScrollBar->blockSignals( false ); 802 mDateScrollBar->blockSignals( false );
796 } 803 }
797 } 804 }
798#endif 805#endif
799 mTodoList->updateView(); 806 mTodoList->updateView();
800 mViewManager->updateView(start, end); 807 mViewManager->updateView(start, end);
801 //mDateNavigator->updateView(); 808 //mDateNavigator->updateView();
802} 809}
803 810
804 811
805 812
806void CalendarView::checkFiles() 813void CalendarView::checkFiles()
807{ 814{
808 QString message; 815 QString message;
809 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 816 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
810 KopiCalendarFile * cal = calendars.first(); 817 KopiCalendarFile * cal = calendars.first();
811 while ( cal ) { 818 while ( cal ) {
812 if ( cal->mErrorOnLoad ) { 819 if ( cal->mErrorOnLoad ) {
813 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 820 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
814 } 821 }
815 cal = calendars.next(); 822 cal = calendars.next();
816 } 823 }
817 if ( !message.isEmpty() ) { 824 if ( !message.isEmpty() ) {
818 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 825 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
819 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); 826 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
820 } 827 }
821 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 828 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
822} 829}
823void CalendarView::checkAlarms() 830void CalendarView::checkAlarms()
824{ 831{
825 832
826 833
827 KConfig *config = KOGlobals::config(); 834 KConfig *config = KOGlobals::config();
828 config->setGroup( "AppRun" ); 835 config->setGroup( "AppRun" );
829 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 836 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
830 int daysto = dt.daysTo( QDate::currentDate() ); 837 int daysto = dt.daysTo( QDate::currentDate() );
831 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 838 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
832 dt = dt.addDays( days ); 839 dt = dt.addDays( days );
833 int secto = dt.secsTo( QDateTime::currentDateTime() ); 840 int secto = dt.secsTo( QDateTime::currentDateTime() );
834 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 841 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
835 //qDebug("KO: Reading program stop %d ", secs); 842 //qDebug("KO: Reading program stop %d ", secs);
836 //secs -= ( 3600 * 24*3 ); // debug only 843 //secs -= ( 3600 * 24*3 ); // debug only
837 QDateTime latest = dt.addSecs ( secs ); 844 QDateTime latest = dt.addSecs ( secs );
838 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 845 qDebug("KO: Last termination on %s ", latest.toString().latin1());
839 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 846 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
840 QPtrList<Incidence> el = mCalendar->rawIncidences(); 847 QPtrList<Incidence> el = mCalendar->rawIncidences();
841 QPtrList<Incidence> al; 848 QPtrList<Incidence> al;
842 Incidence* inL = el.first(); 849 Incidence* inL = el.first();
843 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 850 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
844 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 851 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
845 while ( inL ) { 852 while ( inL ) {
846 bool ok = false; 853 bool ok = false;
847 int offset = 0; 854 int offset = 0;
848 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 855 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
849 if ( ok ) { 856 if ( ok ) {
850 //qDebug("OK %s",next.toString().latin1()); 857 //qDebug("OK %s",next.toString().latin1());
851 if ( next < cur ) { 858 if ( next < cur ) {
852 al.append( inL ); 859 al.append( inL );
853 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 860 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
854 } 861 }
855 } 862 }
856 inL = el.next(); 863 inL = el.next();
857 } 864 }
858 if ( al.count() ) { 865 if ( al.count() ) {
859 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 866 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
860 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 867 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
861 QVBoxLayout* lay = new QVBoxLayout( dia ); 868 QVBoxLayout* lay = new QVBoxLayout( dia );
862 lay->setSpacing( 0 ); 869 lay->setSpacing( 0 );
863 lay->setMargin( 0 ); 870 lay->setMargin( 0 );
864 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 871 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
865 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 872 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
866 lay->addWidget( matb ); 873 lay->addWidget( matb );
867 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 874 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
868 int wid = 210; 875 int wid = 210;
869 int x = QApplication::desktop()->width() - wid - 7; 876 int x = QApplication::desktop()->width() - wid - 7;
870 int y = QApplication::desktop()->height() - wid - 70; 877 int y = QApplication::desktop()->height() - wid - 70;
871 dia->setGeometry ( x,y,wid,wid); 878 dia->setGeometry ( x,y,wid,wid);
872 } else { 879 } else {
873 int si = 220; 880 int si = 220;
874 if ( QApplication::desktop()->width() > 470 ) 881 if ( QApplication::desktop()->width() > 470 )
875 si = 400; 882 si = 400;
876 dia->resize(si,si/2); 883 dia->resize(si,si/2);
877 } 884 }
878 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 885 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
879 dia->show(); 886 dia->show();
880 887
881 } 888 }
882} 889}
883void CalendarView::showDay( QDate d ) 890void CalendarView::showDay( QDate d )
884{ 891{
885 dateNavigator()->blockSignals( true ); 892 dateNavigator()->blockSignals( true );
886 dateNavigator()->selectDate( d ); 893 dateNavigator()->selectDate( d );
887 dateNavigator()->blockSignals( false ); 894 dateNavigator()->blockSignals( false );
888 mViewManager->showDayView(); 895 mViewManager->showDayView();
889 //dateNavigator()->selectDate( d ); 896 //dateNavigator()->selectDate( d );
890} 897}
891void CalendarView::timerAlarm() 898void CalendarView::timerAlarm()
892{ 899{
893 //qDebug("CalendarView::timerAlarm() "); 900 //qDebug("CalendarView::timerAlarm() ");
894 computeAlarm(mAlarmNotification ); 901 computeAlarm(mAlarmNotification );
895} 902}
896 903
897void CalendarView::suspendAlarm() 904void CalendarView::suspendAlarm()
898{ 905{
899 //qDebug(" CalendarView::suspendAlarm() "); 906 //qDebug(" CalendarView::suspendAlarm() ");
900 computeAlarm(mSuspendAlarmNotification ); 907 computeAlarm(mSuspendAlarmNotification );
901 908
902} 909}
903 910
904void CalendarView::startAlarm( QString mess , QString filename) 911void CalendarView::startAlarm( QString mess , QString filename)
905{ 912{
906 913
907 topLevelWidget()->showNormal(); 914 topLevelWidget()->showNormal();
908 topLevelWidget()->setActiveWindow(); 915 topLevelWidget()->setActiveWindow();
909 topLevelWidget()->raise(); 916 topLevelWidget()->raise();
910 917
911 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 918 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
912 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); 919 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) );
913 920
914} 921}
915 922
916void CalendarView::checkNextTimerAlarm() 923void CalendarView::checkNextTimerAlarm()
917{ 924{
918 mCalendar->checkAlarmForIncidence( 0, true ); 925 mCalendar->checkAlarmForIncidence( 0, true );
919} 926}
920 927
921void CalendarView::computeAlarm( QString msg ) 928void CalendarView::computeAlarm( QString msg )
922{ 929{
923 930
924 QString mess = msg; 931 QString mess = msg;
925 QString mAlarmMessage = mess.mid( 9 ); 932 QString mAlarmMessage = mess.mid( 9 );
926 QString filename = MainWindow::resourcePath(); 933 QString filename = MainWindow::resourcePath();
927 filename += "koalarm.wav"; 934 filename += "koalarm.wav";
928 QString tempfilename; 935 QString tempfilename;
929 if ( mess.left( 13 ) == "suspend_alarm") { 936 if ( mess.left( 13 ) == "suspend_alarm") {
930 bool error = false; 937 bool error = false;
931 int len = mess.mid( 13 ).find("+++"); 938 int len = mess.mid( 13 ).find("+++");
932 if ( len < 2 ) 939 if ( len < 2 )
933 error = true; 940 error = true;
934 else { 941 else {
935 tempfilename = mess.mid( 13, len ); 942 tempfilename = mess.mid( 13, len );
936 if ( !QFile::exists( tempfilename ) ) 943 if ( !QFile::exists( tempfilename ) )
937 error = true; 944 error = true;
938 } 945 }
939 if ( ! error ) { 946 if ( ! error ) {
940 filename = tempfilename; 947 filename = tempfilename;
941 } 948 }
942 mAlarmMessage = mess.mid( 13+len+3 ); 949 mAlarmMessage = mess.mid( 13+len+3 );
943 //qDebug("suspend file %s ",tempfilename.latin1() ); 950 //qDebug("suspend file %s ",tempfilename.latin1() );
944 startAlarm( mAlarmMessage, filename); 951 startAlarm( mAlarmMessage, filename);
945 return; 952 return;
946 } 953 }
947 if ( mess.left( 11 ) == "timer_alarm") { 954 if ( mess.left( 11 ) == "timer_alarm") {
948 //mTimerTime = 0; 955 //mTimerTime = 0;
949 startAlarm( mess.mid( 11 ), filename ); 956 startAlarm( mess.mid( 11 ), filename );
950 return; 957 return;
951 } 958 }
952 if ( mess.left( 10 ) == "proc_alarm") { 959 if ( mess.left( 10 ) == "proc_alarm") {
953 bool error = false; 960 bool error = false;
954 int len = mess.mid( 10 ).find("+++"); 961 int len = mess.mid( 10 ).find("+++");
955 if ( len < 2 ) 962 if ( len < 2 )
956 error = true; 963 error = true;
957 else { 964 else {
958 tempfilename = mess.mid( 10, len ); 965 tempfilename = mess.mid( 10, len );
959 if ( !QFile::exists( tempfilename ) ) 966 if ( !QFile::exists( tempfilename ) )
960 error = true; 967 error = true;
961 } 968 }
962 if ( error ) { 969 if ( error ) {
963 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 970 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
964 mAlarmMessage += mess.mid( 10+len+3+9 ); 971 mAlarmMessage += mess.mid( 10+len+3+9 );
965 } else { 972 } else {
966 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 973 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
967 //qDebug("-----system command %s ",tempfilename.latin1() ); 974 //qDebug("-----system command %s ",tempfilename.latin1() );
968#ifndef _WIN32_ 975#ifndef _WIN32_
969 if ( vfork () == 0 ) { 976 if ( vfork () == 0 ) {
970 execl ( tempfilename.latin1(), 0 ); 977 execl ( tempfilename.latin1(), 0 );
971 return; 978 return;
972 } 979 }
973#else 980#else
974 QProcess* p = new QProcess(); 981 QProcess* p = new QProcess();
975 p->addArgument( tempfilename.latin1() ); 982 p->addArgument( tempfilename.latin1() );
976 p->start(); 983 p->start();
977 return; 984 return;
978#endif 985#endif
979 986
980 return; 987 return;
981 } 988 }
982 989
983 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 990 //qDebug("+++++++system command %s ",tempfilename.latin1() );
984 } 991 }
985 if ( mess.left( 11 ) == "audio_alarm") { 992 if ( mess.left( 11 ) == "audio_alarm") {
986 bool error = false; 993 bool error = false;
987 int len = mess.mid( 11 ).find("+++"); 994 int len = mess.mid( 11 ).find("+++");
988 if ( len < 2 ) 995 if ( len < 2 )
989 error = true; 996 error = true;
990 else { 997 else {
991 tempfilename = mess.mid( 11, len ); 998 tempfilename = mess.mid( 11, len );
992 if ( !QFile::exists( tempfilename ) ) 999 if ( !QFile::exists( tempfilename ) )
993 error = true; 1000 error = true;
994 } 1001 }
995 if ( ! error ) { 1002 if ( ! error ) {
996 filename = tempfilename; 1003 filename = tempfilename;
997 } 1004 }
998 mAlarmMessage = mess.mid( 11+len+3+9 ); 1005 mAlarmMessage = mess.mid( 11+len+3+9 );
999 //qDebug("audio file command %s ",tempfilename.latin1() ); 1006 //qDebug("audio file command %s ",tempfilename.latin1() );
1000 } 1007 }
1001 if ( mess.left( 9 ) == "cal_alarm") { 1008 if ( mess.left( 9 ) == "cal_alarm") {
1002 mAlarmMessage = mess.mid( 9 ) ; 1009 mAlarmMessage = mess.mid( 9 ) ;
1003 } 1010 }
1004 1011
1005 startAlarm( mAlarmMessage, filename ); 1012 startAlarm( mAlarmMessage, filename );
1006 1013
1007 1014
1008} 1015}
1009 1016
1010void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 1017void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
1011{ 1018{
1012 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 1019 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
1013 1020
1014 mSuspendAlarmNotification = noti; 1021 mSuspendAlarmNotification = noti;
1015 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 1022 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
1016 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 1023 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
1017 mSuspendTimer->start( ms , true ); 1024 mSuspendTimer->start( ms , true );
1018 1025
1019} 1026}
1020 1027
1021void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 1028void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
1022{ 1029{
1023 mNextAlarmDateTime = qdt; 1030 mNextAlarmDateTime = qdt;
1024 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 1031 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
1025 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 1032 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
1026#ifndef DESKTOP_VERSION 1033#ifndef DESKTOP_VERSION
1027 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 1034 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
1028#endif 1035#endif
1029 return; 1036 return;
1030 } 1037 }
1031 int maxSec; 1038 int maxSec;
1032 //maxSec = 5; //testing only 1039 //maxSec = 5; //testing only
1033 maxSec = 86400+3600; // one day+1hour 1040 maxSec = 86400+3600; // one day+1hour
1034 mAlarmNotification = noti; 1041 mAlarmNotification = noti;
1035 int sec = QDateTime::currentDateTime().secsTo( qdt ); 1042 int sec = QDateTime::currentDateTime().secsTo( qdt );
1036 if ( sec > maxSec ) { 1043 if ( sec > maxSec ) {
1037 mRecheckAlarmTimer->start( maxSec * 1000 ); 1044 mRecheckAlarmTimer->start( maxSec * 1000 );
1038 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 1045 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
1039 return; 1046 return;
1040 } else { 1047 } else {
1041 mRecheckAlarmTimer->stop(); 1048 mRecheckAlarmTimer->stop();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 799c297..456c2d7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,587 +1,588 @@
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#include <qscrollbar.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qtopia/ir.h> 35#include <qtopia/ir.h>
36#else 36#else
37#define Ir char 37#define Ir char
38#endif 38#endif
39#include <libkcal/calendar.h> 39#include <libkcal/calendar.h>
40#include <libkcal/scheduler.h> 40#include <libkcal/scheduler.h>
41#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
42#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
43#include <KDGanttMinimizeSplitter.h> 43#include <KDGanttMinimizeSplitter.h>
44 44
45#include <korganizer/calendarviewbase.h> 45#include <korganizer/calendarviewbase.h>
46 46
47#include <ksyncmanager.h> 47#include <ksyncmanager.h>
48//#include <koprefs.h> 48//#include <koprefs.h>
49 49
50class QWidgetStack; 50class QWidgetStack;
51class QSplitter; 51class QSplitter;
52class KopiCalendarFile; 52class KopiCalendarFile;
53class CalPrinter; 53class CalPrinter;
54class KOFilterView; 54class KOFilterView;
55class KOCalEditView; 55class KOCalEditView;
56class KOViewManager; 56class KOViewManager;
57class KODialogManager; 57class KODialogManager;
58class KOTodoView; 58class KOTodoView;
59class KDateNavigator; 59class KDateNavigator;
60class DateNavigatorContainer; 60class DateNavigatorContainer;
61class DateNavigator; 61class DateNavigator;
62class KOIncidenceEditor; 62class KOIncidenceEditor;
63class KDatePicker; 63class KDatePicker;
64class ResourceView; 64class ResourceView;
65class KOEventEditor; 65class KOEventEditor;
66class KOTodoEditor ; 66class KOTodoEditor ;
67class KOEventViewerDialog; 67class KOEventViewerDialog;
68class KOBeamPrefs; 68class KOBeamPrefs;
69class KSyncProfile; 69class KSyncProfile;
70class AlarmDialog; 70class AlarmDialog;
71class KCal::Attendee; 71class KCal::Attendee;
72 72
73namespace KCal { class FileStorage; } 73namespace KCal { class FileStorage; }
74 74
75using namespace KCal; 75using namespace KCal;
76 76
77/** 77/**
78 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
79 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
80 of the different views and controls the different dialogs like preferences, 80 of the different views and controls the different dialogs like preferences,
81 event editor, search dialog etc. 81 event editor, search dialog etc.
82 82
83 @short main calendar view widget 83 @short main calendar view widget
84 @author Cornelius Schumacher 84 @author Cornelius Schumacher
85*/ 85*/
86 86
87#include <qtextbrowser.h> 87#include <qtextbrowser.h>
88#include <qtextcodec.h> 88#include <qtextcodec.h>
89 89
90class MissedAlarmTextBrowser : public QTextBrowser { 90class MissedAlarmTextBrowser : public QTextBrowser {
91 Q_OBJECT 91 Q_OBJECT
92 public: 92 public:
93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); 93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
94 ~MissedAlarmTextBrowser(); 94 ~MissedAlarmTextBrowser();
95 void setSource(const QString & n); 95 void setSource(const QString & n);
96 96
97 private: 97 private:
98 Incidence * getNextInc(QDateTime start ); 98 Incidence * getNextInc(QDateTime start );
99 QPtrList<Incidence> mAlarms; 99 QPtrList<Incidence> mAlarms;
100 signals: 100 signals:
101 void showIncidence( QString uid); 101 void showIncidence( QString uid);
102}; 102};
103 103
104 104
105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
106{ 106{
107 Q_OBJECT 107 Q_OBJECT
108 public: 108 public:
109 /** 109 /**
110 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
111 111
112 @param calendar calendar document 112 @param calendar calendar document
113 @param parent parent window 113 @param parent parent window
114 @param name Qt internal widget object name 114 @param name Qt internal widget object name
115 */ 115 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 119 const char *name = 0 );
120 virtual ~CalendarView(); 120 virtual ~CalendarView();
121 121
122 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
123 123
124 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
126 126
127 QDate startDate(); 127 QDate startDate();
128 QDate endDate(); 128 QDate endDate();
129 129
130 QWidgetStack *viewStack(); 130 QWidgetStack *viewStack();
131 QWidget *leftFrame(); 131 QWidget *leftFrame();
132 132
133 DateNavigator *dateNavigator(); 133 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 134 KDateNavigator *dateNavigatorWidget();
135 135
136 void addView(KOrg::BaseView *); 136 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 137 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 138 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 139 Incidence *currentSelection();
140 void checkSuspendAlarm(); 140 void checkSuspendAlarm();
141 void mergeFile( QString fn ); 141 void mergeFile( QString fn );
142 142
143 signals: 143 signals:
144 void save (); 144 void save ();
145 void saveStopTimer (); 145 void saveStopTimer ();
146 void tempDisableBR(bool); 146 void tempDisableBR(bool);
147 /** This todo has been modified */ 147 /** This todo has been modified */
148 void todoModified(Todo *, int); 148 void todoModified(Todo *, int);
149 149
150 /** when change is made to options dialog, the topwidget will catch this 150 /** when change is made to options dialog, the topwidget will catch this
151 * and emit this signal which notifies all widgets which have registered 151 * and emit this signal which notifies all widgets which have registered
152 * for notification to update their settings. */ 152 * for notification to update their settings. */
153 void configChanged(); 153 void configChanged();
154 /** emitted when the topwidget is closing down, so that any attached 154 /** emitted when the topwidget is closing down, so that any attached
155 child windows can also close. */ 155 child windows can also close. */
156 void closingDown(); 156 void closingDown();
157 /** emitted right before we die */ 157 /** emitted right before we die */
158 void closed(QWidget *); 158 void closed(QWidget *);
159 159
160 /** Emitted when state of modified flag changes */ 160 /** Emitted when state of modified flag changes */
161 void modifiedChanged(bool); 161 void modifiedChanged(bool);
162 void signalmodified(); 162 void signalmodified();
163 163
164 /** Emitted when state of read-only flag changes */ 164 /** Emitted when state of read-only flag changes */
165 void readOnlyChanged(bool); 165 void readOnlyChanged(bool);
166 166
167 /** Emitted when the unit of navigation changes */ 167 /** Emitted when the unit of navigation changes */
168 void changeNavStringPrev(const QString &); 168 void changeNavStringPrev(const QString &);
169 void changeNavStringNext(const QString &); 169 void changeNavStringNext(const QString &);
170 170
171 /** Emitted when state of events selection has changed and user is organizer*/ 171 /** Emitted when state of events selection has changed and user is organizer*/
172 void organizerEventsSelected(bool); 172 void organizerEventsSelected(bool);
173 /** Emitted when state of events selection has changed and user is attendee*/ 173 /** Emitted when state of events selection has changed and user is attendee*/
174 void groupEventsSelected(bool); 174 void groupEventsSelected(bool);
175 /** 175 /**
176 Emitted when an incidence gets selected. If the selection is cleared the 176 Emitted when an incidence gets selected. If the selection is cleared the
177 signal is emitted with 0 as argument. 177 signal is emitted with 0 as argument.
178 */ 178 */
179 void incidenceSelected( Incidence * ); 179 void incidenceSelected( Incidence * );
180 /** Emitted, when a todoitem is selected or deselected. */ 180 /** Emitted, when a todoitem is selected or deselected. */
181 void todoSelected( bool ); 181 void todoSelected( bool );
182 182
183 /** 183 /**
184 Emitted, when clipboard content changes. Parameter indicates if paste 184 Emitted, when clipboard content changes. Parameter indicates if paste
185 is possible or not. 185 is possible or not.
186 */ 186 */
187 void pasteEnabled(bool); 187 void pasteEnabled(bool);
188 188
189 /** Emitted, when the number of incoming messages has changed. */ 189 /** Emitted, when the number of incoming messages has changed. */
190 void numIncomingChanged(int); 190 void numIncomingChanged(int);
191 191
192 /** Emitted, when the number of outgoing messages has changed. */ 192 /** Emitted, when the number of outgoing messages has changed. */
193 void numOutgoingChanged(int); 193 void numOutgoingChanged(int);
194 194
195 /** Send status message, which can e.g. be displayed in the status bar. */ 195 /** Send status message, which can e.g. be displayed in the status bar. */
196 void statusMessage(const QString &); 196 void statusMessage(const QString &);
197 197
198 void calendarViewExpanded( bool ); 198 void calendarViewExpanded( bool );
199 void updateSearchDialog(); 199 void updateSearchDialog();
200 void filtersUpdated(); 200 void filtersUpdated();
201 201
202 202
203 public slots: 203 public slots:
204 void slotResetFocus();
204 void nextConflict( bool all, bool allday ); 205 void nextConflict( bool all, bool allday );
205 void conflictAll(); 206 void conflictAll();
206 void conflictAllday(); 207 void conflictAllday();
207 void conflictNotAll(); 208 void conflictNotAll();
208 void setCalReadOnly( int id, bool readO ); 209 void setCalReadOnly( int id, bool readO );
209 void checkAlarms(); 210 void checkAlarms();
210 void checkFiles(); 211 void checkFiles();
211 void slotprintSelInc(); 212 void slotprintSelInc();
212 void showNextAlarms(); 213 void showNextAlarms();
213 void showOpenError(); 214 void showOpenError();
214 void watchSavedFile(); 215 void watchSavedFile();
215 void recheckTimerAlarm(); 216 void recheckTimerAlarm();
216 void checkNextTimerAlarm(); 217 void checkNextTimerAlarm();
217 void addAlarm(const QDateTime &qdt, const QString &noti ); 218 void addAlarm(const QDateTime &qdt, const QString &noti );
218 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 219 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
219 void removeAlarm(const QDateTime &qdt, const QString &noti ); 220 void removeAlarm(const QDateTime &qdt, const QString &noti );
220 221
221 /** options dialog made a changed to the configuration. we catch this 222 /** options dialog made a changed to the configuration. we catch this
222 * and notify all widgets which need to update their configuration. */ 223 * and notify all widgets which need to update their configuration. */
223 void updateConfig(); 224 void updateConfig();
224 225
225 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 226 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
226 const QStringList& anniversaryList, const QStringList& realNameList, 227 const QStringList& anniversaryList, const QStringList& realNameList,
227 const QStringList& emailList, const QStringList& assembledNameList, 228 const QStringList& emailList, const QStringList& assembledNameList,
228 const QStringList& uidList); 229 const QStringList& uidList);
229 230
230 /** 231 /**
231 Load calendar from file \a filename. If \a merge is true, load 232 Load calendar from file \a filename. If \a merge is true, load
232 calendar into existing one, if it is false, clear calendar, before 233 calendar into existing one, if it is false, clear calendar, before
233 loading. Return true, if calendar could be successfully loaded. 234 loading. Return true, if calendar could be successfully loaded.
234 */ 235 */
235 bool openCalendar(QString filename, bool merge=false); 236 bool openCalendar(QString filename, bool merge=false);
236 bool loadCalendars(); 237 bool loadCalendars();
237 bool saveCalendars(); 238 bool saveCalendars();
238 bool restoreCalendarSettings(); 239 bool restoreCalendarSettings();
239 bool addCalendar( KopiCalendarFile * ); 240 bool addCalendar( KopiCalendarFile * );
240 void addCalendarId( int id ); 241 void addCalendarId( int id );
241 bool syncCalendar(QString filename,int mode = 0 ); 242 bool syncCalendar(QString filename,int mode = 0 );
242 243
243 /** 244 /**
244 Save calendar data to file. Return true if calendar could be 245 Save calendar data to file. Return true if calendar could be
245 successfully saved. 246 successfully saved.
246 */ 247 */
247 bool saveCalendar(QString filename); 248 bool saveCalendar(QString filename);
248 249
249 /** 250 /**
250 Close calendar. Clear calendar data and reset views to display an empty 251 Close calendar. Clear calendar data and reset views to display an empty
251 calendar. 252 calendar.
252 */ 253 */
253 void closeCalendar(); 254 void closeCalendar();
254 255
255 /** Archive old events of calendar */ 256 /** Archive old events of calendar */
256 void archiveCalendar(); 257 void archiveCalendar();
257 258
258 void showIncidence(); 259 void showIncidence();
259 void editIncidence(); 260 void editIncidence();
260 void editIncidenceDescription(); 261 void editIncidenceDescription();
261 void deleteIncidence(); 262 void deleteIncidence();
262 void cloneIncidence(); 263 void cloneIncidence();
263 void moveIncidence(); 264 void moveIncidence();
264 void beamIncidence(); 265 void beamIncidence();
265 void toggleCancelIncidence(); 266 void toggleCancelIncidence();
266 267
267 /** create an editeventwin with supplied date/time, and if bool is true, 268 /** create an editeventwin with supplied date/time, and if bool is true,
268 * make the event take all day. */ 269 * make the event take all day. */
269 void newEvent(QDateTime, QDateTime, bool allDay ); 270 void newEvent(QDateTime, QDateTime, bool allDay );
270 void newEvent(QDateTime, QDateTime); 271 void newEvent(QDateTime, QDateTime);
271 void newEvent(QDateTime fh); 272 void newEvent(QDateTime fh);
272 void newEvent(QDate dt); 273 void newEvent(QDate dt);
273 /** create new event without having a date hint. Takes current date as 274 /** create new event without having a date hint. Takes current date as
274 default hint. */ 275 default hint. */
275 void newEvent(); 276 void newEvent();
276 void newFloatingEvent(); 277 void newFloatingEvent();
277 278
278 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 279 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
279 void showIncidence(Incidence *); 280 void showIncidence(Incidence *);
280 void showIncidence(QString uid); 281 void showIncidence(QString uid);
281 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 282 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
282 void editIncidence(Incidence *); 283 void editIncidence(Incidence *);
283 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 284 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
284 void deleteIncidence(Incidence *); 285 void deleteIncidence(Incidence *);
285 void cloneIncidence(Incidence *); 286 void cloneIncidence(Incidence *);
286 void cancelIncidence(Incidence *); 287 void cancelIncidence(Incidence *);
287 /** Create an editor for the supplied event. */ 288 /** Create an editor for the supplied event. */
288 void editEvent(Event *); 289 void editEvent(Event *);
289 /** Delete the supplied event. */ 290 /** Delete the supplied event. */
290 void deleteEvent(Event *); 291 void deleteEvent(Event *);
291 /** Delete the event with the given unique ID. Returns false, if event wasn't 292 /** Delete the event with the given unique ID. Returns false, if event wasn't
292 found. */ 293 found. */
293 bool deleteEvent(const QString &uid); 294 bool deleteEvent(const QString &uid);
294 /** Create a read-only viewer dialog for the supplied event. */ 295 /** Create a read-only viewer dialog for the supplied event. */
295 void showEvent(Event *); 296 void showEvent(Event *);
296 297
297 void editJournal(Journal *); 298 void editJournal(Journal *);
298 void showJournal(Journal *); 299 void showJournal(Journal *);
299 void deleteJournal(Journal *); 300 void deleteJournal(Journal *);
300 /** Create an editor dialog for a todo */ 301 /** Create an editor dialog for a todo */
301 void editTodo(Todo *); 302 void editTodo(Todo *);
302 /** Create a read-only viewer dialog for the supplied todo */ 303 /** Create a read-only viewer dialog for the supplied todo */
303 void showTodo(Todo *); 304 void showTodo(Todo *);
304 /** create new todo */ 305 /** create new todo */
305 void newTodo(); 306 void newTodo();
306 void newTodoDateTime(QDateTime, bool allday); 307 void newTodoDateTime(QDateTime, bool allday);
307 /** create new todo with a parent todo */ 308 /** create new todo with a parent todo */
308 void newSubTodo(); 309 void newSubTodo();
309 /** create new todo with a parent todo */ 310 /** create new todo with a parent todo */
310 void newSubTodo(Todo *); 311 void newSubTodo(Todo *);
311 /** Delete todo */ 312 /** Delete todo */
312 void deleteTodo(Todo *); 313 void deleteTodo(Todo *);
313 314
314 315
315 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 316 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
316 * emitted as result. */ 317 * emitted as result. */
317 void checkClipboard(); 318 void checkClipboard();
318 319
319 /** using the KConfig associated with the kapp variable, read in the 320 /** using the KConfig associated with the kapp variable, read in the
320 * settings from the config file. 321 * settings from the config file.
321 */ 322 */
322 void readSettings(); 323 void readSettings();
323 324
324 /** write current state to config file. */ 325 /** write current state to config file. */
325 void writeSettings(); 326 void writeSettings();
326 327
327 /** read settings for calendar filters */ 328 /** read settings for calendar filters */
328 void readFilterSettings(KConfig *config); 329 void readFilterSettings(KConfig *config);
329 330
330 /** write settings for calendar filters */ 331 /** write settings for calendar filters */
331 void writeFilterSettings(KConfig *config); 332 void writeFilterSettings(KConfig *config);
332 333
333 /** passes on the message that an event has changed to the currently 334 /** passes on the message that an event has changed to the currently
334 * activated view so that it can make appropriate display changes. */ 335 * activated view so that it can make appropriate display changes. */
335 void changeEventDisplay(Event *, int); 336 void changeEventDisplay(Event *, int);
336 void changeIncidenceDisplay(Incidence *, int); 337 void changeIncidenceDisplay(Incidence *, int);
337 void changeTodoDisplay(Todo *, int); 338 void changeTodoDisplay(Todo *, int);
338 339
339 void eventAdded(Event *); 340 void eventAdded(Event *);
340 void eventChanged(Event *); 341 void eventChanged(Event *);
341 void eventToBeDeleted(Event *); 342 void eventToBeDeleted(Event *);
342 void eventDeleted(); 343 void eventDeleted();
343 344
344 void todoAdded(Todo *); 345 void todoAdded(Todo *);
345 void todoChanged(Todo *); 346 void todoChanged(Todo *);
346 void todoToBeDeleted(Todo *); 347 void todoToBeDeleted(Todo *);
347 void todoDeleted(); 348 void todoDeleted();
348 349
349 void updateView(const QDate &start, const QDate &end); 350 void updateView(const QDate &start, const QDate &end);
350 void updateView(); 351 void updateView();
351 void clearAllViews(); 352 void clearAllViews();
352 353
353 /** Full update of visible todo views */ 354 /** Full update of visible todo views */
354 void updateTodoViews(); 355 void updateTodoViews();
355 356
356 void updateUnmanagedViews(); 357 void updateUnmanagedViews();
357 358
358 /** cut the current appointment to the clipboard */ 359 /** cut the current appointment to the clipboard */
359 void edit_cut(); 360 void edit_cut();
360 361
361 /** copy the current appointment(s) to the clipboard */ 362 /** copy the current appointment(s) to the clipboard */
362 void edit_copy(); 363 void edit_copy();
363 364
364 /** paste the current vobject(s) in the clipboard buffer into calendar */ 365 /** paste the current vobject(s) in the clipboard buffer into calendar */
365 void edit_paste(); 366 void edit_paste();
366 367
367 /** edit viewing and configuration options. */ 368 /** edit viewing and configuration options. */
368 void edit_options(); 369 void edit_options();
369 void edit_global_options(); 370 void edit_global_options();
370 /** 371 /**
371 Functions for printing, previewing a print, and setting up printing 372 Functions for printing, previewing a print, and setting up printing
372 parameters. 373 parameters.
373 */ 374 */
374 void print(); 375 void print();
375 void printSetup(); 376 void printSetup();
376 void printPreview(); 377 void printPreview();
377 378
378 /** Export as iCalendar file */ 379 /** Export as iCalendar file */
379 void exportICalendar(); 380 void exportICalendar();
380 381
381 /** Export as vCalendar file */ 382 /** Export as vCalendar file */
382 bool exportVCalendar( QString fn); 383 bool exportVCalendar( QString fn);
383 384
384 /** pop up a dialog to show an existing appointment. */ 385 /** pop up a dialog to show an existing appointment. */
385 void appointment_show(); 386 void appointment_show();
386 /** 387 /**
387 * pop up an Appointment Dialog to edit an existing appointment.Get 388 * pop up an Appointment Dialog to edit an existing appointment.Get
388 * information on the appointment from the list of unique IDs that is 389 * information on the appointment from the list of unique IDs that is
389 * currently in the View, called currIds. 390 * currently in the View, called currIds.
390 */ 391 */
391 void appointment_edit(); 392 void appointment_edit();
392 /** 393 /**
393 * pop up dialog confirming deletion of currently selected event in the 394 * pop up dialog confirming deletion of currently selected event in the
394 * View. 395 * View.
395 */ 396 */
396 void appointment_delete(); 397 void appointment_delete();
397 398
398 /** mails the currently selected event to a particular user as a vCalendar 399 /** mails the currently selected event to a particular user as a vCalendar
399 attachment. */ 400 attachment. */
400 void action_mail(); 401 void action_mail();
401 402
402 /* frees a subtodo from it's relation */ 403 /* frees a subtodo from it's relation */
403 void todo_unsub( Todo * ); 404 void todo_unsub( Todo * );
404 void todo_resub( Todo * parent, Todo * sub ); 405 void todo_resub( Todo * parent, Todo * sub );
405 406
406 /** Take ownership of selected event. */ 407 /** Take ownership of selected event. */
407 void takeOverEvent(); 408 void takeOverEvent();
408 409
409 /** Take ownership of all events in calendar. */ 410 /** Take ownership of all events in calendar. */
410 void takeOverCalendar(); 411 void takeOverCalendar();
411 412
412 /** query whether or not the calendar is "dirty". */ 413 /** query whether or not the calendar is "dirty". */
413 bool isModified(); 414 bool isModified();
414 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 415 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
415 void setModified(bool modified=true); 416 void setModified(bool modified=true);
416 417
417 /** query if the calendar is read-only. */ 418 /** query if the calendar is read-only. */
418 bool isReadOnly(); 419 bool isReadOnly();
419 /** set state of calendar to read-only */ 420 /** set state of calendar to read-only */
420 void setReadOnly(bool readOnly=true); 421 void setReadOnly(bool readOnly=true);
421 422
422 void eventUpdated(Incidence *); 423 void eventUpdated(Incidence *);
423 424
424 /* iTIP scheduling actions */ 425 /* iTIP scheduling actions */
425 void schedule_publish(Incidence *incidence = 0); 426 void schedule_publish(Incidence *incidence = 0);
426 void schedule_request(Incidence *incidence = 0); 427 void schedule_request(Incidence *incidence = 0);
427 void schedule_refresh(Incidence *incidence = 0); 428 void schedule_refresh(Incidence *incidence = 0);
428 void schedule_cancel(Incidence *incidence = 0); 429 void schedule_cancel(Incidence *incidence = 0);
429 void schedule_add(Incidence *incidence = 0); 430 void schedule_add(Incidence *incidence = 0);
430 void schedule_reply(Incidence *incidence = 0); 431 void schedule_reply(Incidence *incidence = 0);
431 void schedule_counter(Incidence *incidence = 0); 432 void schedule_counter(Incidence *incidence = 0);
432 void schedule_declinecounter(Incidence *incidence = 0); 433 void schedule_declinecounter(Incidence *incidence = 0);
433 void schedule_publish_freebusy(int daysToPublish = 30); 434 void schedule_publish_freebusy(int daysToPublish = 30);
434 435
435 void openAddressbook(); 436 void openAddressbook();
436 437
437 void editFilters(); 438 void editFilters();
438 void toggleFilerEnabled(); 439 void toggleFilerEnabled();
439 QPtrList<CalFilter> filters(); 440 QPtrList<CalFilter> filters();
440 void toggleFilter(); 441 void toggleFilter();
441 void showFilter(bool visible); 442 void showFilter(bool visible);
442 void updateFilter(); 443 void updateFilter();
443 void filterEdited(); 444 void filterEdited();
444 void selectFilter( int ); 445 void selectFilter( int );
445 KOFilterView *filterView(); 446 KOFilterView *filterView();
446 447
447 void showIntro(); 448 void showIntro();
448 449
449 /** Move the curdatepient view date to today */ 450 /** Move the curdatepient view date to today */
450 void goToday(); 451 void goToday();
451 452
452 /** Move to the next date(s) in the current view */ 453 /** Move to the next date(s) in the current view */
453 void goNext(); 454 void goNext();
454 455
455 /** Move to the previous date(s) in the current view */ 456 /** Move to the previous date(s) in the current view */
456 void goPrevious(); 457 void goPrevious();
457 /** Move to the next date(s) in the current view */ 458 /** Move to the next date(s) in the current view */
458 void goNextMonth(); 459 void goNextMonth();
459 460
460 /** Move to the previous date(s) in the current view */ 461 /** Move to the previous date(s) in the current view */
461 void goPreviousMonth(); 462 void goPreviousMonth();
462 463
463 void toggleExpand(); 464 void toggleExpand();
464 void toggleDateNavigatorWidget(); 465 void toggleDateNavigatorWidget();
465 void toggleAllDaySize(); 466 void toggleAllDaySize();
466 467
467 /** Look for new messages in the inbox */ 468 /** Look for new messages in the inbox */
468 void lookForIncomingMessages(); 469 void lookForIncomingMessages();
469 /** Look for new messages in the outbox */ 470 /** Look for new messages in the outbox */
470 void lookForOutgoingMessages(); 471 void lookForOutgoingMessages();
471 472
472 void processMainViewSelection( Incidence * ); 473 void processMainViewSelection( Incidence * );
473 void processTodoListSelection( Incidence * ); 474 void processTodoListSelection( Incidence * );
474 475
475 void processIncidenceSelection( Incidence * ); 476 void processIncidenceSelection( Incidence * );
476 477
477 void purgeCompleted(); 478 void purgeCompleted();
478 bool removeCompletedSubTodos( Todo* ); 479 bool removeCompletedSubTodos( Todo* );
479 void slotCalendarChanged(); 480 void slotCalendarChanged();
480 bool importBday(); 481 bool importBday();
481 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 482 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
482 bool importQtopia( const QString &categoriesFile, 483 bool importQtopia( const QString &categoriesFile,
483 const QString &datebookFile, 484 const QString &datebookFile,
484 const QString &tasklistFile ); 485 const QString &tasklistFile );
485 void syncExternal( int mode ); 486 void syncExternal( int mode );
486 void slotSelectPickerDate( QDate ) ; 487 void slotSelectPickerDate( QDate ) ;
487 void showDatePicker() ; 488 void showDatePicker() ;
488 void showDatePickerPopup() ; 489 void showDatePickerPopup() ;
489 void moveIncidence(Incidence *) ; 490 void moveIncidence(Incidence *) ;
490 void beamIncidence(Incidence *) ; 491 void beamIncidence(Incidence *) ;
491 void beamCalendar() ; 492 void beamCalendar() ;
492 void beamFilteredCalendar() ; 493 void beamFilteredCalendar() ;
493 void beamIncidenceList(QPtrList<Incidence>) ; 494 void beamIncidenceList(QPtrList<Incidence>) ;
494 void manageCategories(); 495 void manageCategories();
495 void editCategories(); 496 void editCategories();
496 int addCategories(); 497 int addCategories();
497 void removeCategories(); 498 void removeCategories();
498 void setSyncDevice( QString ); 499 void setSyncDevice( QString );
499 void setSyncName( QString ); 500 void setSyncName( QString );
500 void showDay( QDate ); 501 void showDay( QDate );
501 void undo_delete(); 502 void undo_delete();
502 protected slots: 503 protected slots:
503 void resetFocus(); 504 void resetFocus();
504 void scrollBarValue(int); 505 void scrollBarValue(int);
505 void slotViewerClosed(); 506 void slotViewerClosed();
506 void timerAlarm(); 507 void timerAlarm();
507 void suspendAlarm(); 508 void suspendAlarm();
508 void beamDone( Ir *ir ); 509 void beamDone( Ir *ir );
509 /** Select a view or adapt the current view to display the specified dates. */ 510 /** Select a view or adapt the current view to display the specified dates. */
510 void showDates( const KCal::DateList & ); 511 void showDates( const KCal::DateList & );
511 void selectWeekNum ( int ); 512 void selectWeekNum ( int );
512 void checkConflictForEvent(); 513 void checkConflictForEvent();
513 514
514 public: 515 public:
515 // show a standard warning 516 // show a standard warning
516 // returns KMsgBox::yesNoCancel() 517 // returns KMsgBox::yesNoCancel()
517 int msgCalModified(); 518 int msgCalModified();
518 virtual bool sync(KSyncManager* manager, QString filename, int mode); 519 virtual bool sync(KSyncManager* manager, QString filename, int mode);
519 520
520 virtual bool syncExternal(KSyncManager* manager, QString resource); 521 virtual bool syncExternal(KSyncManager* manager, QString resource);
521 virtual void removeSyncInfo( QString syncProfile); 522 virtual void removeSyncInfo( QString syncProfile);
522 void setSyncManager(KSyncManager* manager); 523 void setSyncManager(KSyncManager* manager);
523 void setLoadedFileVersion(QDateTime); 524 void setLoadedFileVersion(QDateTime);
524 bool checkFileVersion(QString fn); 525 bool checkFileVersion(QString fn);
525 bool checkAllFileVersions(); 526 bool checkAllFileVersions();
526 bool checkFileChanged(QString fn); 527 bool checkFileChanged(QString fn);
527 Event* getLastSyncEvent(); 528 Event* getLastSyncEvent();
528 /** Adapt navigation units correpsonding to step size of navigation of the 529 /** Adapt navigation units correpsonding to step size of navigation of the
529 * current view. 530 * current view.
530 */ 531 */
531 void adaptNavigationUnits(); 532 void adaptNavigationUnits();
532 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 533 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
533 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 534 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
534 //Attendee* getYourAttendee(Event *event); 535 //Attendee* getYourAttendee(Event *event);
535 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 536 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
536 void setScrollBarStep(int val ); 537 void setScrollBarStep(int val );
537 538
538 protected: 539 protected:
539 Event *mConflictingEvent; 540 Event *mConflictingEvent;
540 void schedule(Scheduler::Method, Incidence *incidence = 0); 541 void schedule(Scheduler::Method, Incidence *incidence = 0);
541 542
542 // returns KMsgBox::OKCandel() 543 // returns KMsgBox::OKCandel()
543 int msgItemDelete(const QString name); 544 int msgItemDelete(const QString name);
544 void showEventEditor(); 545 void showEventEditor();
545 void showTodoEditor(); 546 void showTodoEditor();
546 Todo *selectedTodo(); 547 Todo *selectedTodo();
547 private: 548 private:
548#ifdef DESKTOP_VERSION 549#ifdef DESKTOP_VERSION
549 QScrollBar * mDateScrollBar; 550 QScrollBar * mDateScrollBar;
550#endif 551#endif
551 QDateTime mNextAlarmDateTime; 552 QDateTime mNextAlarmDateTime;
552 bool mViewerCallerIsSearchDialog; 553 bool mViewerCallerIsSearchDialog;
553 bool mBlockShowDates; 554 bool mBlockShowDates;
554 KSyncManager* mSyncManager; 555 KSyncManager* mSyncManager;
555 AlarmDialog * mAlarmDialog; 556 AlarmDialog * mAlarmDialog;
556 QString mAlarmNotification; 557 QString mAlarmNotification;
557 QString mSuspendAlarmNotification; 558 QString mSuspendAlarmNotification;
558 QTimer* mSuspendTimer; 559 QTimer* mSuspendTimer;
559 QTimer* mAlarmTimer; 560 QTimer* mAlarmTimer;
560 QTimer* mRecheckAlarmTimer; 561 QTimer* mRecheckAlarmTimer;
561 void computeAlarm( QString ); 562 void computeAlarm( QString );
562 void startAlarm( QString, QString ); 563 void startAlarm( QString, QString );
563 void setSyncEventsReadOnly(); 564 void setSyncEventsReadOnly();
564 565
565 QDateTime loadedFileVersion; 566 QDateTime loadedFileVersion;
566 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 567 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
567 void checkExternalId( Incidence * inc ); 568 void checkExternalId( Incidence * inc );
568 int mGlobalSyncMode; 569 int mGlobalSyncMode;
569 QString mCurrentSyncDevice; 570 QString mCurrentSyncDevice;
570 QString mCurrentSyncName; 571 QString mCurrentSyncName;
571 void init(); 572 void init();
572 int mDatePickerMode; 573 int mDatePickerMode;
573 bool mFlagEditDescription; 574 bool mFlagEditDescription;
574 QDateTime mLastCalendarSync; 575 QDateTime mLastCalendarSync;
575 void createPrinter(); 576 void createPrinter();
576 577
577 void calendarModified( bool, Calendar * ); 578 void calendarModified( bool, Calendar * );
578 579
579 CalPrinter *mCalPrinter; 580 CalPrinter *mCalPrinter;
580 581
581 QSplitter *mPanner; 582 QSplitter *mPanner;
582 QSplitter *mLeftSplitter; 583 QSplitter *mLeftSplitter;
583 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 584 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
584 QWidgetStack *mRightFrame; 585 QWidgetStack *mRightFrame;
585 586
586 KDatePicker* mDatePicker; 587 KDatePicker* mDatePicker;
587 QVBox* mDateFrame; 588 QVBox* mDateFrame;
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 779f12e..0dd5ef5 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1254,769 +1254,772 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1254 } 1254 }
1255 } else { 1255 } else {
1256 placeItem->setSubCell(0); 1256 placeItem->setSubCell(0);
1257 placeItem->setSubCells(1); 1257 placeItem->setSubCells(1);
1258 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); 1258 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
1259 else placeItem->resize(mGridSpacingX,placeItem->height()); 1259 else placeItem->resize(mGridSpacingX,placeItem->height());
1260 int x,y; 1260 int x,y;
1261 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); 1261 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
1262 moveChild(placeItem,x,y); 1262 moveChild(placeItem,x,y);
1263 } 1263 }
1264 placeItem->setConflictItems(conflictItems); 1264 placeItem->setConflictItems(conflictItems);
1265 // for ( item=conflictItems.first(); item != 0; 1265 // for ( item=conflictItems.first(); item != 0;
1266// item=conflictItems.next() ) { 1266// item=conflictItems.next() ) {
1267// //item->updateItem(); 1267// //item->updateItem();
1268// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1268// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1269// } 1269// }
1270// placeItem->updateItem(); 1270// placeItem->updateItem();
1271} 1271}
1272 1272
1273void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1273void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1274{ 1274{
1275 if ( globalFlagBlockAgenda ) 1275 if ( globalFlagBlockAgenda )
1276 return; 1276 return;
1277 1277
1278 if ( mInvalidPixmap ) { 1278 if ( mInvalidPixmap ) {
1279 mInvalidPixmap = false; 1279 mInvalidPixmap = false;
1280 qDebug("KO: Upsizing Pixmaps "); 1280 qDebug("KO: Upsizing Pixmaps ");
1281 computeSizes(); 1281 computeSizes();
1282 emit updateViewSignal(); 1282 emit updateViewSignal();
1283 return; 1283 return;
1284 } 1284 }
1285 if ( ! mAllDayMode ) { 1285 if ( ! mAllDayMode ) {
1286 // currently not working for 1286 // currently not working for
1287 1287
1288 //qDebug("KOAgenda::drawContents "); 1288 //qDebug("KOAgenda::drawContents ");
1289#if 0 1289#if 0
1290 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { 1290 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
1291 qDebug("WAU "); 1291 qDebug("WAU ");
1292 drawContentsToPainter(); 1292 drawContentsToPainter();
1293 } 1293 }
1294#endif 1294#endif
1295 QPaintDevice* pd = p->device(); 1295 QPaintDevice* pd = p->device();
1296 p->end(); 1296 p->end();
1297 int vx, vy; 1297 int vx, vy;
1298 int selectionX = KOGlobals::self()->reverseLayout() ? 1298 int selectionX = KOGlobals::self()->reverseLayout() ?
1299 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1299 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1300 mSelectionCellX * mGridSpacingX; 1300 mSelectionCellX * mGridSpacingX;
1301 contentsToViewport ( cx, cy, vx,vy); 1301 contentsToViewport ( cx, cy, vx,vy);
1302 //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; 1302 //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ;
1303 1303
1304 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { 1304 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) {
1305 if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1305 if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1306 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { 1306 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) {
1307 1307
1308 int vxSel, vySel; 1308 int vxSel, vySel;
1309 contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); 1309 contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel);
1310 int off = mSelectionHeight; 1310 int off = mSelectionHeight;
1311 if ( vySel < 0 ) 1311 if ( vySel < 0 )
1312 off += vySel; 1312 off += vySel;
1313 //qDebug("OFF %d %d %d", off,vySel, vy ); 1313 //qDebug("OFF %d %d %d", off,vySel, vy );
1314 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); 1314 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP);
1315 } else { 1315 } else {
1316 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1316 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1317 } 1317 }
1318 } 1318 }
1319 if ( mSelectionHeight > 0 ) { 1319 if ( mSelectionHeight > 0 ) {
1320 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1320 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1321 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1321 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1322 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1322 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1323 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1323 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1324 // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1324 // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1325 int hei = mSelectionHeight; 1325 int hei = mSelectionHeight;
1326 int offset = 0; 1326 int offset = 0;
1327 while ( hei > 0 ) { 1327 while ( hei > 0 ) {
1328 int p_hei = 5; 1328 int p_hei = 5;
1329 if ( hei < 5 ) p_hei = hei; 1329 if ( hei < 5 ) p_hei = hei;
1330 hei -= 5; 1330 hei -= 5;
1331 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); 1331 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP);
1332 offset += 5; 1332 offset += 5;
1333 } 1333 }
1334 } 1334 }
1335 } 1335 }
1336 p->begin( pd ); 1336 p->begin( pd );
1337 } else { 1337 } else {
1338#if 0 1338#if 0
1339 qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); 1339 qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() );
1340 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { 1340 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
1341 qDebug("WAUWAU "); 1341 qDebug("WAUWAU ");
1342 drawContentsToPainter(); 1342 drawContentsToPainter();
1343 } 1343 }
1344#endif 1344#endif
1345 QPaintDevice* pd = p->device(); 1345 QPaintDevice* pd = p->device();
1346 p->end(); 1346 p->end();
1347 int vx, vy; 1347 int vx, vy;
1348 int selectionX = KOGlobals::self()->reverseLayout() ? 1348 int selectionX = KOGlobals::self()->reverseLayout() ?
1349 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1349 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1350 mSelectionCellX * mGridSpacingX; 1350 mSelectionCellX * mGridSpacingX;
1351 contentsToViewport ( cx, cy, vx,vy); 1351 contentsToViewport ( cx, cy, vx,vy);
1352 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1352 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1353 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1353 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1354 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1354 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1355 1355
1356 if ( mSelectionHeight > 0 ) { 1356 if ( mSelectionHeight > 0 ) {
1357 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1357 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1358 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1358 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1359 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1359 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1360 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1360 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1361 //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1361 //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1362 int hei = mSelectionHeight; 1362 int hei = mSelectionHeight;
1363 int offset = 0; 1363 int offset = 0;
1364 while ( hei > 0 ) { 1364 while ( hei > 0 ) {
1365 int p_hei = 5; 1365 int p_hei = 5;
1366 if ( hei < 5 ) p_hei = hei; 1366 if ( hei < 5 ) p_hei = hei;
1367 hei -= 5; 1367 hei -= 5;
1368 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); 1368 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP);
1369 offset += 5; 1369 offset += 5;
1370 } 1370 }
1371 } 1371 }
1372 } 1372 }
1373 p->begin( pd ); 1373 p->begin( pd );
1374 } 1374 }
1375 1375
1376} 1376}
1377 1377
1378void KOAgenda::finishUpdate() 1378void KOAgenda::finishUpdate()
1379{ 1379{
1380 1380
1381 KOAgendaItem *item; 1381 KOAgendaItem *item;
1382 globalFlagBlockAgendaItemPaint = 1; 1382 globalFlagBlockAgendaItemPaint = 1;
1383 // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems 1383 // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems
1384 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1384 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1385 if ( !item->checkLayout() ) { 1385 if ( !item->checkLayout() ) {
1386 //qDebug(" conflictitem found "); 1386 //qDebug(" conflictitem found ");
1387 int newSubCellWidth; 1387 int newSubCellWidth;
1388 if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); 1388 if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells();
1389 else newSubCellWidth = mGridSpacingX / item->subCells(); 1389 else newSubCellWidth = mGridSpacingX / item->subCells();
1390 1390
1391 if (mAllDayMode) { 1391 if (mAllDayMode) {
1392 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); 1392 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
1393 } else { 1393 } else {
1394 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); 1394 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
1395 } 1395 }
1396 int x,y; 1396 int x,y;
1397 gridToContents(item->cellX(),item->cellYTop(),x,y); 1397 gridToContents(item->cellX(),item->cellYTop(),x,y);
1398 if (mAllDayMode) { 1398 if (mAllDayMode) {
1399 y += item->subCell() * newSubCellWidth; 1399 y += item->subCell() * newSubCellWidth;
1400 } else { 1400 } else {
1401 x += item->subCell() * newSubCellWidth; 1401 x += item->subCell() * newSubCellWidth;
1402 } 1402 }
1403 moveChild(item,x,y); 1403 moveChild(item,x,y);
1404 } 1404 }
1405 } 1405 }
1406 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1406 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1407 if ( !item->isVisible() ) 1407 if ( !item->isVisible() )
1408 item->show(); 1408 item->show();
1409 1409
1410 } 1410 }
1411 globalFlagBlockAgendaItemUpdate = 0; 1411 globalFlagBlockAgendaItemUpdate = 0;
1412 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1412 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1413 item->repaintMe( ); 1413 item->repaintMe( );
1414 } 1414 }
1415 globalFlagBlockAgendaItemUpdate = 1; 1415 globalFlagBlockAgendaItemUpdate = 1;
1416 qApp->processEvents(); 1416 qApp->processEvents();
1417 globalFlagBlockAgendaItemPaint = 0; 1417 globalFlagBlockAgendaItemPaint = 0;
1418 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1418 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1419 item->repaint( false ); 1419 item->repaint( false );
1420 } 1420 }
1421 marcus_bains(); 1421 marcus_bains();
1422} 1422}
1423 1423
1424/* 1424/*
1425 Draw grid in the background of the agenda. 1425 Draw grid in the background of the agenda.
1426*/ 1426*/
1427void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) 1427void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch)
1428{ 1428{
1429 1429
1430 1430
1431 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) 1431 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask )
1432 return; 1432 return;
1433 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) 1433 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 )
1434 return; 1434 return;
1435 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); 1435 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight();
1436 if ( ch < 1 ) 1436 if ( ch < 1 )
1437 ch = 1; 1437 ch = 1;
1438 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { 1438 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) {
1439 mPaintPixmap.resize( contentsWidth()+42, ch ); 1439 mPaintPixmap.resize( contentsWidth()+42, ch );
1440 } 1440 }
1441 mCurPixWid = contentsWidth(); 1441 mCurPixWid = contentsWidth();
1442 mCurPixHei = ch; 1442 mCurPixHei = ch;
1443 if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { 1443 if ( mHighlightPixmap.width() < mGridSpacingX-1 ) {
1444 mHighlightPixmap.resize( mGridSpacingX-1, 5 ); 1444 mHighlightPixmap.resize( mGridSpacingX-1, 5 );
1445 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); 1445 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor );
1446 } 1446 }
1447 mPixPainter.begin( &mPaintPixmap) ; 1447 mPixPainter.begin( &mPaintPixmap) ;
1448 //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); 1448 //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() );
1449 QPainter * p ; 1449 QPainter * p ;
1450 if (paint == 0) { 1450 if (paint == 0) {
1451 mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); 1451 mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor);
1452 p = &mPixPainter; 1452 p = &mPixPainter;
1453 } 1453 }
1454 else 1454 else
1455 p = paint ; 1455 p = paint ;
1456 // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); 1456 // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch);
1457 1457
1458 //--cx;++cw; 1458 //--cx;++cw;
1459 int lGridSpacingY = mGridSpacingY*2; 1459 int lGridSpacingY = mGridSpacingY*2;
1460 int selDay; 1460 int selDay;
1461 QDate curDate = QDate::currentDate(); 1461 QDate curDate = QDate::currentDate();
1462 if ( !backgroundOnly ) { 1462 if ( !backgroundOnly ) {
1463 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) 1463 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
1464 { 1464 {
1465 if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { 1465 if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) {
1466 int x1 = cx; 1466 int x1 = cx;
1467 int y1 = 0; 1467 int y1 = 0;
1468 if (y1 < cy) y1 = cy; 1468 if (y1 < cy) y1 = cy;
1469 int x2 = cx+cw-1; 1469 int x2 = cx+cw-1;
1470 int y2 = contentsHeight(); 1470 int y2 = contentsHeight();
1471 if (y2 > cy+ch-1) y2=cy+ch-1; 1471 if (y2 > cy+ch-1) y2=cy+ch-1;
1472 if (x2 >= x1 && y2 >= y1) { 1472 if (x2 >= x1 && y2 >= y1) {
1473 int gxStart = selDay; 1473 int gxStart = selDay;
1474 int gxEnd = gxStart ; 1474 int gxEnd = gxStart ;
1475 int xStart = KOGlobals::self()->reverseLayout() ? 1475 int xStart = KOGlobals::self()->reverseLayout() ?
1476 (mColumns - 1 - gxStart)*mGridSpacingX : 1476 (mColumns - 1 - gxStart)*mGridSpacingX :
1477 gxStart*mGridSpacingX; 1477 gxStart*mGridSpacingX;
1478 if (xStart < x1) xStart = x1; 1478 if (xStart < x1) xStart = x1;
1479 int xEnd = KOGlobals::self()->reverseLayout() ? 1479 int xEnd = KOGlobals::self()->reverseLayout() ?
1480 (mColumns - gxStart)*mGridSpacingX-1 : 1480 (mColumns - gxStart)*mGridSpacingX-1 :
1481 (gxStart+1)*mGridSpacingX-1; 1481 (gxStart+1)*mGridSpacingX-1;
1482 if (xEnd > x2) xEnd = x2; 1482 if (xEnd > x2) xEnd = x2;
1483 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1483 if ( KOPrefs::instance()->mUseHighlightLightColor )
1484 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1484 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1485 KOPrefs::instance()->mAgendaBgColor.light()); 1485 KOPrefs::instance()->mAgendaBgColor.light());
1486 else 1486 else
1487 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1487 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1488 KOPrefs::instance()->mAgendaBgColor.dark()); 1488 KOPrefs::instance()->mAgendaBgColor.dark());
1489 1489
1490 } 1490 }
1491 } 1491 }
1492 } 1492 }
1493 } 1493 }
1494 // Highlight working hours 1494 // Highlight working hours
1495 1495
1496 if ( !backgroundOnly ) 1496 if ( !backgroundOnly )
1497 if (mWorkingHoursEnable) { 1497 if (mWorkingHoursEnable) {
1498 int x1 = cx; 1498 int x1 = cx;
1499 int y1 = mWorkingHoursYTop; 1499 int y1 = mWorkingHoursYTop;
1500 if (y1 < cy) y1 = cy; 1500 if (y1 < cy) y1 = cy;
1501 int x2 = cx+cw-1; 1501 int x2 = cx+cw-1;
1502 // int x2 = mGridSpacingX * 5 - 1; 1502 // int x2 = mGridSpacingX * 5 - 1;
1503 // if (x2 > cx+cw-1) x2 = cx + cw - 1; 1503 // if (x2 > cx+cw-1) x2 = cx + cw - 1;
1504 int y2 = mWorkingHoursYBottom; 1504 int y2 = mWorkingHoursYBottom;
1505 if (y2 > cy+ch-1) y2=cy+ch-1; 1505 if (y2 > cy+ch-1) y2=cy+ch-1;
1506 1506
1507 if (x2 >= x1 && y2 >= y1) { 1507 if (x2 >= x1 && y2 >= y1) {
1508 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); 1508 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX );
1509 int gxStart = x1/mGridSpacingX; 1509 int gxStart = x1/mGridSpacingX;
1510 int gxEnd = x2/mGridSpacingX; 1510 int gxEnd = x2/mGridSpacingX;
1511 while(gxStart <= gxEnd) { 1511 while(gxStart <= gxEnd) {
1512 if (gxStart < int(mHolidayMask->count()) && 1512 if (gxStart < int(mHolidayMask->count()) &&
1513 !mHolidayMask->at(gxStart)) { 1513 !mHolidayMask->at(gxStart)) {
1514 int xStart = KOGlobals::self()->reverseLayout() ? 1514 int xStart = KOGlobals::self()->reverseLayout() ?
1515 (mColumns - 1 - gxStart)*mGridSpacingX : 1515 (mColumns - 1 - gxStart)*mGridSpacingX :
1516 gxStart*mGridSpacingX; 1516 gxStart*mGridSpacingX;
1517 if (xStart < x1) xStart = x1; 1517 if (xStart < x1) xStart = x1;
1518 int xEnd = KOGlobals::self()->reverseLayout() ? 1518 int xEnd = KOGlobals::self()->reverseLayout() ?
1519 (mColumns - gxStart)*mGridSpacingX-1 : 1519 (mColumns - gxStart)*mGridSpacingX-1 :
1520 (gxStart+1)*mGridSpacingX-1; 1520 (gxStart+1)*mGridSpacingX-1;
1521 if (xEnd > x2) xEnd = x2; 1521 if (xEnd > x2) xEnd = x2;
1522 if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { 1522 if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) {
1523 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1523 if ( KOPrefs::instance()->mUseHighlightLightColor )
1524 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1524 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1525 KOPrefs::instance()->mWorkingHoursColor.light()); 1525 KOPrefs::instance()->mWorkingHoursColor.light());
1526 else 1526 else
1527 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1527 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1528 KOPrefs::instance()->mWorkingHoursColor.dark()); 1528 KOPrefs::instance()->mWorkingHoursColor.dark());
1529 } else { 1529 } else {
1530 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1530 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1531 KOPrefs::instance()->mWorkingHoursColor); 1531 KOPrefs::instance()->mWorkingHoursColor);
1532 } 1532 }
1533 } 1533 }
1534 ++gxStart; 1534 ++gxStart;
1535 } 1535 }
1536 } 1536 }
1537 } 1537 }
1538 /* 1538 /*
1539 int selectionX = KOGlobals::self()->reverseLayout() ? 1539 int selectionX = KOGlobals::self()->reverseLayout() ?
1540 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1540 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1541 mSelectionCellX * mGridSpacingX; 1541 mSelectionCellX * mGridSpacingX;
1542 1542
1543 // Draw selection 1543 // Draw selection
1544 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1544 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1545 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1545 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1546 // TODO: paint only part within cx,cy,cw,ch 1546 // TODO: paint only part within cx,cy,cw,ch
1547 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, 1547 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
1548 mSelectionHeight, KOPrefs::instance()->mHighlightColor ); 1548 mSelectionHeight, KOPrefs::instance()->mHighlightColor );
1549 } 1549 }
1550 */ 1550 */
1551 // Draw vertical lines of grid 1551 // Draw vertical lines of grid
1552 1552
1553 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 1553 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
1554 if ( mGridSpacingX > 0 ) { 1554 if ( mGridSpacingX > 0 ) {
1555 while (x < cx + cw) { 1555 while (x < cx + cw) {
1556 p->drawLine(x,cy,x,cy+ch); 1556 p->drawLine(x,cy,x,cy+ch);
1557 x+=mGridSpacingX; 1557 x+=mGridSpacingX;
1558 } 1558 }
1559 } 1559 }
1560 // Draw horizontal lines of grid 1560 // Draw horizontal lines of grid
1561 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1561 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1562 if ( lGridSpacingY > 0 ) { 1562 if ( lGridSpacingY > 0 ) {
1563 while (y < cy + ch) { 1563 while (y < cy + ch) {
1564 p->setPen( SolidLine ); 1564 p->setPen( SolidLine );
1565 p->drawLine(cx,y,cx+cw,y); 1565 p->drawLine(cx,y,cx+cw,y);
1566 y+=lGridSpacingY; 1566 y+=lGridSpacingY;
1567 p->setPen( DotLine ); 1567 p->setPen( DotLine );
1568 p->drawLine(cx,y,cx+cw,y); 1568 p->drawLine(cx,y,cx+cw,y);
1569 y+=lGridSpacingY; 1569 y+=lGridSpacingY;
1570 } 1570 }
1571 p->setPen( SolidLine ); 1571 p->setPen( SolidLine );
1572 } 1572 }
1573 mPixPainter.end() ; 1573 mPixPainter.end() ;
1574} 1574}
1575 1575
1576/* 1576/*
1577 Convert srcollview contents coordinates to agenda grid coordinates. 1577 Convert srcollview contents coordinates to agenda grid coordinates.
1578*/ 1578*/
1579void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1579void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1580{ 1580{
1581 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1581 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1582 x/mGridSpacingX; 1582 x/mGridSpacingX;
1583 gy = y/mGridSpacingY; 1583 gy = y/mGridSpacingY;
1584} 1584}
1585 1585
1586/* 1586/*
1587 Convert agenda grid coordinates to scrollview contents coordinates. 1587 Convert agenda grid coordinates to scrollview contents coordinates.
1588*/ 1588*/
1589void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) 1589void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
1590{ 1590{
1591 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: 1591 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
1592 gx*mGridSpacingX; 1592 gx*mGridSpacingX;
1593 y = gy*mGridSpacingY; 1593 y = gy*mGridSpacingY;
1594} 1594}
1595 1595
1596 1596
1597/* 1597/*
1598 Return Y coordinate corresponding to time. Coordinates are rounded to fit into 1598 Return Y coordinate corresponding to time. Coordinates are rounded to fit into
1599 the grid. 1599 the grid.
1600*/ 1600*/
1601int KOAgenda::timeToY(const QTime &time) 1601int KOAgenda::timeToY(const QTime &time)
1602{ 1602{
1603 int minutesPerCell = 24 * 60 / mRows; 1603 int minutesPerCell = 24 * 60 / mRows;
1604 int timeMinutes = time.hour() * 60 + time.minute(); 1604 int timeMinutes = time.hour() * 60 + time.minute();
1605 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; 1605 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell;
1606 return Y; 1606 return Y;
1607} 1607}
1608 1608
1609 1609
1610/* 1610/*
1611 Return time corresponding to cell y coordinate. Coordinates are rounded to 1611 Return time corresponding to cell y coordinate. Coordinates are rounded to
1612 fit into the grid. 1612 fit into the grid.
1613*/ 1613*/
1614QTime KOAgenda::gyToTime(int gy) 1614QTime KOAgenda::gyToTime(int gy)
1615{ 1615{
1616 1616
1617 int secondsPerCell = 24 * 60 * 60/ mRows; 1617 int secondsPerCell = 24 * 60 * 60/ mRows;
1618 1618
1619 int timeSeconds = secondsPerCell * gy; 1619 int timeSeconds = secondsPerCell * gy;
1620 1620
1621 QTime time( 0, 0, 0 ); 1621 QTime time( 0, 0, 0 );
1622 if ( timeSeconds < 24 * 60 * 60 ) { 1622 if ( timeSeconds < 24 * 60 * 60 ) {
1623 time = time.addSecs(timeSeconds); 1623 time = time.addSecs(timeSeconds);
1624 } else { 1624 } else {
1625 time.setHMS( 23, 59, 59 ); 1625 time.setHMS( 23, 59, 59 );
1626 } 1626 }
1627 1627
1628 return time; 1628 return time;
1629} 1629}
1630 1630
1631void KOAgenda::setStartHour(int startHour) 1631void KOAgenda::setStartHour(int startHour)
1632{ 1632{
1633 int startCell = startHour * mRows / 24; 1633 int startCell = startHour * mRows / 24;
1634 setContentsPos(0,startCell * gridSpacingY()); 1634 setContentsPos(0,startCell * gridSpacingY());
1635} 1635}
1636QTime KOAgenda::getEndTime() 1636QTime KOAgenda::getEndTime()
1637{ 1637{
1638 return QTime ( (contentsY ()+viewport()->height())*24/contentsHeight ()+1,0,0); 1638 int tim = (contentsY ()+viewport()->height())*24/contentsHeight ();
1639 if ( tim > 23 )
1640 return QTime ( 23,59,59);
1641 return QTime ( tim,0,0);
1639} 1642}
1640void KOAgenda::hideUnused() 1643void KOAgenda::hideUnused()
1641{ 1644{
1642 // experimental only 1645 // experimental only
1643 // return; 1646 // return;
1644 KOAgendaItem *item; 1647 KOAgendaItem *item;
1645 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { 1648 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) {
1646 item->hide(); 1649 item->hide();
1647 } 1650 }
1648} 1651}
1649 1652
1650 1653
1651KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) 1654KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
1652{ 1655{
1653 1656
1654 KOAgendaItem *fi; 1657 KOAgendaItem *fi;
1655 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { 1658 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) {
1656 if ( fi->incidence() == event ) { 1659 if ( fi->incidence() == event ) {
1657 mUnusedItems.remove(); 1660 mUnusedItems.remove();
1658 fi->init( event, qd ); 1661 fi->init( event, qd );
1659 return fi; 1662 return fi;
1660 } 1663 }
1661 } 1664 }
1662 fi=mUnusedItems.first(); 1665 fi=mUnusedItems.first();
1663 if ( fi ) { 1666 if ( fi ) {
1664 mUnusedItems.remove(); 1667 mUnusedItems.remove();
1665 fi->init( event, qd ); 1668 fi->init( event, qd );
1666 return fi; 1669 return fi;
1667 } 1670 }
1668 // qDebug("new KOAgendaItem "); 1671 // qDebug("new KOAgendaItem ");
1669 1672
1670 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); 1673 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode );
1671 agendaItem->installEventFilter(this); 1674 agendaItem->installEventFilter(this);
1672 addChild(agendaItem,0,0); 1675 addChild(agendaItem,0,0);
1673 return agendaItem; 1676 return agendaItem;
1674} 1677}
1675KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) 1678KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1676{ 1679{
1677 KOAgendaItem *item; 1680 KOAgendaItem *item;
1678 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1681 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1679 if ( item->incidence() == todo ) { 1682 if ( item->incidence() == todo ) {
1680 mItems.remove(); 1683 mItems.remove();
1681 return item; 1684 return item;
1682 } 1685 }
1683 } 1686 }
1684 return 0; 1687 return 0;
1685} 1688}
1686 1689
1687 1690
1688void KOAgenda::updateTodo( Todo * todo, int days, bool remove) 1691void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1689{ 1692{
1690 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| 1693 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
1691 KOAgendaItem *item; 1694 KOAgendaItem *item;
1692 item = getItemForTodo ( todo ); 1695 item = getItemForTodo ( todo );
1693 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); 1696 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
1694 if ( item ) { 1697 if ( item ) {
1695 blockSignals( true ); 1698 blockSignals( true );
1696 //qDebug("item found "); 1699 //qDebug("item found ");
1697 item->hide(); 1700 item->hide();
1698 item->setCellX(-2, -1 ); 1701 item->setCellX(-2, -1 );
1699 item->select(false); 1702 item->select(false);
1700 mUnusedItems.append( item ); 1703 mUnusedItems.append( item );
1701 mItems.remove( item ); 1704 mItems.remove( item );
1702 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1705 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1703 KOAgendaItem *itemit; 1706 KOAgendaItem *itemit;
1704 //globalFlagBlockAgendaItemPaint = 1; 1707 //globalFlagBlockAgendaItemPaint = 1;
1705 for ( itemit=oldconflictItems.first(); itemit != 0; 1708 for ( itemit=oldconflictItems.first(); itemit != 0;
1706 itemit=oldconflictItems.next() ) { 1709 itemit=oldconflictItems.next() ) {
1707 if ( itemit != item ) 1710 if ( itemit != item )
1708 placeSubCells(itemit); 1711 placeSubCells(itemit);
1709 } 1712 }
1710 qApp->processEvents(); 1713 qApp->processEvents();
1711 //globalFlagBlockAgendaItemPaint = 0; 1714 //globalFlagBlockAgendaItemPaint = 0;
1712 for ( itemit=oldconflictItems.first(); itemit != 0; 1715 for ( itemit=oldconflictItems.first(); itemit != 0;
1713 itemit=oldconflictItems.next() ) { 1716 itemit=oldconflictItems.next() ) {
1714 globalFlagBlockAgendaItemUpdate = 0; 1717 globalFlagBlockAgendaItemUpdate = 0;
1715 if ( itemit != item ) 1718 if ( itemit != item )
1716 itemit->repaintMe(); 1719 itemit->repaintMe();
1717 globalFlagBlockAgendaItemUpdate = 1; 1720 globalFlagBlockAgendaItemUpdate = 1;
1718 //qDebug("sigleshot "); 1721 //qDebug("sigleshot ");
1719 QTimer::singleShot( 0, itemit, SLOT ( repaintItem() )); 1722 QTimer::singleShot( 0, itemit, SLOT ( repaintItem() ));
1720 //itemit->repaint( false ); repaintItem() 1723 //itemit->repaint( false ); repaintItem()
1721 } 1724 }
1722 blockSignals( false ); 1725 blockSignals( false );
1723 } 1726 }
1724 if ( remove ) { 1727 if ( remove ) {
1725 //qDebug("remove****************************************** "); 1728 //qDebug("remove****************************************** ");
1726 return; 1729 return;
1727 } 1730 }
1728 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) 1731 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda )
1729 return; 1732 return;
1730 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1733 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1731 QDate currentDate = QDate::currentDate(); 1734 QDate currentDate = QDate::currentDate();
1732 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1735 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda );
1733 QDateTime dt; 1736 QDateTime dt;
1734 if ( todo->hasCompletedDate() ) 1737 if ( todo->hasCompletedDate() )
1735 dt = todo->completed(); 1738 dt = todo->completed();
1736 else 1739 else
1737 dt = todo->dtDue(); 1740 dt = todo->dtDue();
1738 if ( overdue ) { 1741 if ( overdue ) {
1739 days += todo->dtDue().date().daysTo( currentDate ); 1742 days += todo->dtDue().date().daysTo( currentDate );
1740 } 1743 }
1741 else 1744 else
1742 currentDate = dt.date(); 1745 currentDate = dt.date();
1743 1746
1744 if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) { 1747 if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) {
1745 if ( ! mAllDayMode ) return; 1748 if ( ! mAllDayMode ) return;
1746 // aldayagenda 1749 // aldayagenda
1747 globalFlagBlockAgendaItemPaint = 1; 1750 globalFlagBlockAgendaItemPaint = 1;
1748 item = insertAllDayItem(todo, currentDate,days, days); 1751 item = insertAllDayItem(todo, currentDate,days, days);
1749 item->show(); 1752 item->show();
1750 1753
1751 } 1754 }
1752 else { 1755 else {
1753 if ( mAllDayMode ) return; 1756 if ( mAllDayMode ) return;
1754 // mAgenda 1757 // mAgenda
1755 globalFlagBlockAgendaItemPaint = 1; 1758 globalFlagBlockAgendaItemPaint = 1;
1756 int endY = timeToY(dt.time()) - 1; 1759 int endY = timeToY(dt.time()) - 1;
1757 int hi = 12/KOPrefs::instance()->mHourSize; 1760 int hi = 12/KOPrefs::instance()->mHourSize;
1758 int startY = endY - 1-hi; 1761 int startY = endY - 1-hi;
1759 item = insertItem(todo,currentDate,days,startY,endY); 1762 item = insertItem(todo,currentDate,days,startY,endY);
1760 item->show(); 1763 item->show();
1761 } 1764 }
1762 qApp->processEvents(); 1765 qApp->processEvents();
1763 globalFlagBlockAgendaItemPaint = 0; 1766 globalFlagBlockAgendaItemPaint = 0;
1764 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1767 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1765 KOAgendaItem *itemit; 1768 KOAgendaItem *itemit;
1766 for ( itemit=oldconflictItems.first(); itemit != 0; 1769 for ( itemit=oldconflictItems.first(); itemit != 0;
1767 itemit=oldconflictItems.next() ) { 1770 itemit=oldconflictItems.next() ) {
1768 globalFlagBlockAgendaItemUpdate = 0; 1771 globalFlagBlockAgendaItemUpdate = 0;
1769 itemit->repaintMe(); 1772 itemit->repaintMe();
1770 globalFlagBlockAgendaItemUpdate = 1; 1773 globalFlagBlockAgendaItemUpdate = 1;
1771 itemit->repaint(); 1774 itemit->repaint();
1772 } 1775 }
1773 globalFlagBlockAgendaItemUpdate = 0; 1776 globalFlagBlockAgendaItemUpdate = 0;
1774 item->repaintMe(); 1777 item->repaintMe();
1775 globalFlagBlockAgendaItemUpdate = 1; 1778 globalFlagBlockAgendaItemUpdate = 1;
1776 item->repaint(); 1779 item->repaint();
1777} 1780}
1778/* 1781/*
1779 Insert KOAgendaItem into agenda. 1782 Insert KOAgendaItem into agenda.
1780*/ 1783*/
1781KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) 1784KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom)
1782{ 1785{
1783 if (mAllDayMode) { 1786 if (mAllDayMode) {
1784 qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); 1787 qDebug("KOAgenda: calling insertItem in all-day mode is illegal. ");
1785 return 0; 1788 return 0;
1786 } 1789 }
1787 1790
1788 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1791 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1789 //agendaItem->setFrameStyle(WinPanel|Raised); 1792 //agendaItem->setFrameStyle(WinPanel|Raised);
1790 1793
1791 int YSize = YBottom - YTop + 1; 1794 int YSize = YBottom - YTop + 1;
1792 if (YSize < 0) { 1795 if (YSize < 0) {
1793 YSize = 1; 1796 YSize = 1;
1794 } 1797 }
1795 int iheight = mGridSpacingY * YSize; 1798 int iheight = mGridSpacingY * YSize;
1796 1799
1797 agendaItem->resize(mGridSpacingX,iheight ); 1800 agendaItem->resize(mGridSpacingX,iheight );
1798 agendaItem->setCellXY(X,YTop,YBottom); 1801 agendaItem->setCellXY(X,YTop,YBottom);
1799 agendaItem->setCellXWidth(X); 1802 agendaItem->setCellXWidth(X);
1800 1803
1801 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); 1804 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY);
1802 mItems.append(agendaItem); 1805 mItems.append(agendaItem);
1803 1806
1804 placeSubCells(agendaItem); 1807 placeSubCells(agendaItem);
1805 1808
1806 //agendaItem->show(); 1809 //agendaItem->show();
1807 1810
1808 1811
1809 return agendaItem; 1812 return agendaItem;
1810} 1813}
1811 1814
1812 1815
1813/* 1816/*
1814 Insert all-day KOAgendaItem into agenda. 1817 Insert all-day KOAgendaItem into agenda.
1815*/ 1818*/
1816KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) 1819KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd)
1817{ 1820{
1818 if (!mAllDayMode) { 1821 if (!mAllDayMode) {
1819 return 0; 1822 return 0;
1820 } 1823 }
1821 1824
1822 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); 1825 KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
1823 1826
1824 agendaItem->setCellXY(XBegin,0,0); 1827 agendaItem->setCellXY(XBegin,0,0);
1825 agendaItem->setCellXWidth(XEnd); 1828 agendaItem->setCellXWidth(XEnd);
1826 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); 1829 agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY);
1827 1830
1828 //addChild(agendaItem,XBegin*mGridSpacingX,0); 1831 //addChild(agendaItem,XBegin*mGridSpacingX,0);
1829 mItems.append(agendaItem); 1832 mItems.append(agendaItem);
1830 1833
1831 placeSubCells(agendaItem); 1834 placeSubCells(agendaItem);
1832 1835
1833 //agendaItem->show(); 1836 //agendaItem->show();
1834 1837
1835 return agendaItem; 1838 return agendaItem;
1836} 1839}
1837 1840
1838 1841
1839void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 1842void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1840 int YTop,int YBottom) 1843 int YTop,int YBottom)
1841{ 1844{
1842 if (mAllDayMode) { 1845 if (mAllDayMode) {
1843 ; 1846 ;
1844 return; 1847 return;
1845 } 1848 }
1846 1849
1847 int cellX,cellYTop,cellYBottom; 1850 int cellX,cellYTop,cellYBottom;
1848 QString newtext; 1851 QString newtext;
1849 int width = XEnd - XBegin + 1; 1852 int width = XEnd - XBegin + 1;
1850 int count = 0; 1853 int count = 0;
1851 KOAgendaItem *current = 0; 1854 KOAgendaItem *current = 0;
1852 QPtrList<KOAgendaItem> multiItems; 1855 QPtrList<KOAgendaItem> multiItems;
1853 for (cellX = XBegin;cellX <= XEnd;++cellX) { 1856 for (cellX = XBegin;cellX <= XEnd;++cellX) {
1854 if (cellX == XBegin) cellYTop = YTop; 1857 if (cellX == XBegin) cellYTop = YTop;
1855 else cellYTop = 0; 1858 else cellYTop = 0;
1856 if (cellX == XEnd) cellYBottom = YBottom; 1859 if (cellX == XEnd) cellYBottom = YBottom;
1857 else cellYBottom = rows() - 1; 1860 else cellYBottom = rows() - 1;
1858 newtext = QString("(%1/%2): ").arg(++count).arg(width); 1861 newtext = QString("(%1/%2): ").arg(++count).arg(width);
1859 newtext.append(event->summary()); 1862 newtext.append(event->summary());
1860 current = insertItem(event,qd,cellX,cellYTop,cellYBottom); 1863 current = insertItem(event,qd,cellX,cellYTop,cellYBottom);
1861 current->setText(newtext); 1864 current->setText(newtext);
1862 multiItems.append(current); 1865 multiItems.append(current);
1863 } 1866 }
1864 1867
1865 KOAgendaItem *next = 0; 1868 KOAgendaItem *next = 0;
1866 KOAgendaItem *last = multiItems.last(); 1869 KOAgendaItem *last = multiItems.last();
1867 KOAgendaItem *first = multiItems.first(); 1870 KOAgendaItem *first = multiItems.first();
1868 KOAgendaItem *setFirst,*setLast; 1871 KOAgendaItem *setFirst,*setLast;
1869 current = first; 1872 current = first;
1870 while (current) { 1873 while (current) {
1871 next = multiItems.next(); 1874 next = multiItems.next();
1872 if (current == first) setFirst = 0; 1875 if (current == first) setFirst = 0;
1873 else setFirst = first; 1876 else setFirst = first;
1874 if (current == last) setLast = 0; 1877 if (current == last) setLast = 0;
1875 else setLast = last; 1878 else setLast = last;
1876 1879
1877 current->setMultiItem(setFirst,next,setLast); 1880 current->setMultiItem(setFirst,next,setLast);
1878 current = next; 1881 current = next;
1879 } 1882 }
1880} 1883}
1881 1884
1882 1885
1883//QSizePolicy KOAgenda::sizePolicy() const 1886//QSizePolicy KOAgenda::sizePolicy() const
1884//{ 1887//{
1885 // Thought this would make the all-day event agenda minimum size and the 1888 // Thought this would make the all-day event agenda minimum size and the
1886 // normal agenda take the remaining space. But it doesn´t work. The QSplitter 1889 // normal agenda take the remaining space. But it doesn´t work. The QSplitter
1887 // don´t seem to think that an Expanding widget needs more space than a 1890 // don´t seem to think that an Expanding widget needs more space than a
1888 // Preferred one. 1891 // Preferred one.
1889 // But it doesn´t hurt, so it stays. 1892 // But it doesn´t hurt, so it stays.
1890// if (mAllDayMode) { 1893// if (mAllDayMode) {
1891// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); 1894// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
1892// } else { 1895// } else {
1893// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); 1896// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
1894// } 1897// }
1895//} 1898//}
1896void KOAgenda::finishResize ( ) 1899void KOAgenda::finishResize ( )
1897{ 1900{
1898 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); 1901 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) ");
1899 if ( globalFlagBlockAgenda == 0 ) { 1902 if ( globalFlagBlockAgenda == 0 ) {
1900 finishUpdate(); 1903 finishUpdate();
1901 //qDebug("finishUpdate() called "); 1904 //qDebug("finishUpdate() called ");
1902 } 1905 }
1903} 1906}
1904/* 1907/*
1905 Overridden from QScrollView to provide proper resizing of KOAgendaItems. 1908 Overridden from QScrollView to provide proper resizing of KOAgendaItems.
1906*/ 1909*/
1907void KOAgenda::resizeEvent ( QResizeEvent *ev ) 1910void KOAgenda::resizeEvent ( QResizeEvent *ev )
1908{ 1911{
1909 mSelectionHeight = 0; 1912 mSelectionHeight = 0;
1910 mResizeTimer.start( 150 , true ); 1913 mResizeTimer.start( 150 , true );
1911 computeSizes(); 1914 computeSizes();
1912 return; 1915 return;
1913 1916
1914} 1917}
1915void KOAgenda::computeSizes() 1918void KOAgenda::computeSizes()
1916{ 1919{
1917 if ( globalFlagBlockStartup ) 1920 if ( globalFlagBlockStartup )
1918 return; 1921 return;
1919 int frameOffset = frameWidth() * 2 +1; 1922 int frameOffset = frameWidth() * 2 +1;
1920 if (mAllDayMode) { 1923 if (mAllDayMode) {
1921 mGridSpacingX = (width()-frameOffset) / mColumns; 1924 mGridSpacingX = (width()-frameOffset) / mColumns;
1922 mGridSpacingY = height() - 2 * frameWidth() - 1; 1925 mGridSpacingY = height() - 2 * frameWidth() - 1;
1923 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); 1926 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
1924 // mGridSpacingY = height(); 1927 // mGridSpacingY = height();
1925 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1928 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1926 1929
1927 KOAgendaItem *item; 1930 KOAgendaItem *item;
1928 int subCellWidth; 1931 int subCellWidth;
1929 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1932 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1930 subCellWidth = mGridSpacingY / item->subCells(); 1933 subCellWidth = mGridSpacingY / item->subCells();
1931 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); 1934 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
1932 moveChild(item,KOGlobals::self()->reverseLayout() ? 1935 moveChild(item,KOGlobals::self()->reverseLayout() ?
1933 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1936 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1934 item->cellX() * mGridSpacingX, 1937 item->cellX() * mGridSpacingX,
1935 item->subCell() * subCellWidth); 1938 item->subCell() * subCellWidth);
1936 } 1939 }
1937 KOPrefs::instance()->mAllDaySize = mGridSpacingY; 1940 KOPrefs::instance()->mAllDaySize = mGridSpacingY;
1938 } else { 1941 } else {
1939 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; 1942 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns;
1940 if (height() > mGridSpacingY * mRows + 1 ) { 1943 if (height() > mGridSpacingY * mRows + 1 ) {
1941 KOPrefs::instance()->mHourSize = ((height())/mRows)+1; 1944 KOPrefs::instance()->mHourSize = ((height())/mRows)+1;
1942 mGridSpacingY = KOPrefs::instance()->mHourSize ; 1945 mGridSpacingY = KOPrefs::instance()->mHourSize ;
1943 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1946 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1944 emit resizedSignal(); 1947 emit resizedSignal();
1945 } else 1948 } else
1946 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1949 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1947 KOAgendaItem *item; 1950 KOAgendaItem *item;
1948 int subCellWidth; 1951 int subCellWidth;
1949 1952
1950 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1953 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1951 subCellWidth = mGridSpacingX / item->subCells(); 1954 subCellWidth = mGridSpacingX / item->subCells();
1952 item->resize(subCellWidth,item->height()); 1955 item->resize(subCellWidth,item->height());
1953 moveChild(item,(KOGlobals::self()->reverseLayout() ? 1956 moveChild(item,(KOGlobals::self()->reverseLayout() ?
1954 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1957 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1955 item->cellX() * mGridSpacingX) + 1958 item->cellX() * mGridSpacingX) +
1956 item->subCell() * subCellWidth,childY(item)); 1959 item->subCell() * subCellWidth,childY(item));
1957 } 1960 }
1958 } 1961 }
1959 int cw = contentsWidth(); 1962 int cw = contentsWidth();
1960 int ch = contentsHeight(); 1963 int ch = contentsHeight();
1961 if ( mAllDayMode ) { 1964 if ( mAllDayMode ) {
1962 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); 1965 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
1963 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { 1966 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) {
1964 //qDebug("paintPixAll->resize "); 1967 //qDebug("paintPixAll->resize ");
1965 paintPixAll->resize( cw, ch ); 1968 paintPixAll->resize( cw, ch );
1966 } 1969 }
1967 } else { 1970 } else {
1968 QPixmap* paintPix = KOAgendaItem::paintPix(); 1971 QPixmap* paintPix = KOAgendaItem::paintPix();
1969 if ( paintPix->width() < cw || paintPix->height() < ch ) { 1972 if ( paintPix->width() < cw || paintPix->height() < ch ) {
1970 //qDebug("paintPix->resize "); 1973 //qDebug("paintPix->resize ");
1971 paintPix->resize( cw , ch ); 1974 paintPix->resize( cw , ch );
1972 } 1975 }
1973 } 1976 }
1974 1977
1975 checkScrollBoundaries(); 1978 checkScrollBoundaries();
1976 drawContentsToPainter(); 1979 drawContentsToPainter();
1977 viewport()->repaint(false); 1980 viewport()->repaint(false);
1978} 1981}
1979 1982
1980void KOAgenda::scrollUp() 1983void KOAgenda::scrollUp()
1981{ 1984{
1982 scrollBy(0,-mScrollOffset); 1985 scrollBy(0,-mScrollOffset);
1983} 1986}
1984 1987
1985 1988
1986void KOAgenda::scrollDown() 1989void KOAgenda::scrollDown()
1987{ 1990{
1988 scrollBy(0,mScrollOffset); 1991 scrollBy(0,mScrollOffset);
1989} 1992}
1990 1993
1991void KOAgenda::popupAlarm() 1994void KOAgenda::popupAlarm()
1992{ 1995{
1993 if (!mClickedItem) { 1996 if (!mClickedItem) {
1994 qDebug("KOAgenda::popupAlarm() called without having a clicked item "); 1997 qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
1995 return; 1998 return;
1996 } 1999 }
1997 // TODO: deal correctly with multiple alarms 2000 // TODO: deal correctly with multiple alarms
1998 Alarm* alarm; 2001 Alarm* alarm;
1999 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 2002 QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
2000 for(alarm=list.first();alarm;alarm=list.next()) { 2003 for(alarm=list.first();alarm;alarm=list.next()) {
2001 alarm->toggleAlarm(); 2004 alarm->toggleAlarm();
2002 } 2005 }
2003 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); 2006 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED );
2004 mClickedItem->paintMe( true ); 2007 mClickedItem->paintMe( true );
2005 mClickedItem->repaint( false ); 2008 mClickedItem->repaint( false );
2006} 2009}
2007 2010
2008/* 2011/*
2009 Calculates the minimum width 2012 Calculates the minimum width
2010*/ 2013*/
2011int KOAgenda::minimumWidth() const 2014int KOAgenda::minimumWidth() const
2012{ 2015{
2013 // TODO:: develop a way to dynamically determine the minimum width 2016 // TODO:: develop a way to dynamically determine the minimum width
2014 int min = 100; 2017 int min = 100;
2015 2018
2016 return min; 2019 return min;
2017} 2020}
2018 2021
2019void KOAgenda::updateConfig() 2022void KOAgenda::updateConfig()
2020{ 2023{
2021 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) 2024 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor)
2022 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); 2025 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 4bedb61..21d5a35 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1104 +1,1102 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 25#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 27#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 28#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 29#include <unistd.h> // for sleep
31#else 30#else
32#include <qmenubar.h>
33#include <qtoolbar.h> 31#include <qtoolbar.h>
34#include <qapplication.h> 32#include <qapplication.h>
35//#include <resource.h> 33//#include <resource.h>
36 34
37#endif 35#endif
38#include <libkcal/calendarlocal.h> 36#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 37#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 38#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 39#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 40#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 41#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
45 43
46#include "calendarview.h" 44#include "calendarview.h"
47#include "koviewmanager.h" 45#include "koviewmanager.h"
48#include "datenavigator.h" 46#include "datenavigator.h"
49#include "koagendaview.h" 47#include "koagendaview.h"
50#include "kojournalview.h" 48#include "kojournalview.h"
51#include "koagenda.h" 49#include "koagenda.h"
52#include "kodialogmanager.h" 50#include "kodialogmanager.h"
53#include "kdialogbase.h" 51#include "kdialogbase.h"
54#include "kapplication.h" 52#include "kapplication.h"
55#include "kofilterview.h" 53#include "kofilterview.h"
56#include "kstandarddirs.h" 54#include "kstandarddirs.h"
57#include "koprefs.h" 55#include "koprefs.h"
58#include "kfiledialog.h" 56#include "kfiledialog.h"
59#include "koglobals.h" 57#include "koglobals.h"
60#include "kglobal.h" 58#include "kglobal.h"
61#include "ktoolbar.h" 59#include "ktoolbar.h"
62#include "klocale.h" 60#include "klocale.h"
63#include "kconfig.h" 61#include "kconfig.h"
64#include "externalapphandler.h" 62#include "externalapphandler.h"
65#include <kglobalsettings.h> 63#include <kglobalsettings.h>
66 64
67using namespace KCal; 65using namespace KCal;
68#ifndef _WIN32_ 66#ifndef _WIN32_
69#include <unistd.h> 67#include <unistd.h>
70#else 68#else
71#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
72#include "koimportoldialog.h" 70#include "koimportoldialog.h"
73#endif 71#endif
74#endif 72#endif
75#include "mainwindow.h" 73#include "mainwindow.h"
76 74
77 75
78class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
79{ 77{
80 public: 78 public:
81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
82 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
83 { 81 {
84 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
85 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
86 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
87 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
88 QLabel *lab; 86 QLabel *lab;
89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
90 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
91 QHBox* temphb; 89 QHBox* temphb;
92 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
93 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
94 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
95 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
96 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
97 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
98 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
99 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
100 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
101 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
102 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
103 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
105 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
106 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
107 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
108 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
110 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
111 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
113 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
115 lay->addWidget( ok ); 113 lay->addWidget( ok );
116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
117 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
120 resize( 220, 240 ); 118 resize( 220, 240 );
121 qApp->processEvents(); 119 qApp->processEvents();
122 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
123 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
124 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
125 } 123 }
126 124
127public: 125public:
128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
129 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
130 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
131}; 129};
132 130
133QPixmap* sgListViewCompletedPix[6]; 131QPixmap* sgListViewCompletedPix[6];
134QPixmap* sgListViewJournalPix; 132QPixmap* sgListViewJournalPix;
135 133
136 134
137int globalFlagBlockStartup; 135int globalFlagBlockStartup;
138MainWindow::MainWindow( QWidget *parent, const char *name ) : 136MainWindow::MainWindow( QWidget *parent, const char *name ) :
139 QMainWindow( parent, name ) 137 QMainWindow( parent, name )
140{ 138{
141 sgListViewCompletedPix[5] = &listviewPix; 139 sgListViewCompletedPix[5] = &listviewPix;
142 sgListViewCompletedPix[0] = &listviewPix0; 140 sgListViewCompletedPix[0] = &listviewPix0;
143 sgListViewCompletedPix[1] = &listviewPix20; 141 sgListViewCompletedPix[1] = &listviewPix20;
144 sgListViewCompletedPix[2] = &listviewPix40; 142 sgListViewCompletedPix[2] = &listviewPix40;
145 sgListViewCompletedPix[3] = &listviewPix60; 143 sgListViewCompletedPix[3] = &listviewPix60;
146 sgListViewCompletedPix[4] = &listviewPix80; 144 sgListViewCompletedPix[4] = &listviewPix80;
147 //int size = 12; 145 //int size = 12;
148 { 146 {
149 sgListViewCompletedPix[5]->resize( 11, 11 ); 147 sgListViewCompletedPix[5]->resize( 11, 11 );
150 sgListViewCompletedPix[5]->fill( Qt::white ); 148 sgListViewCompletedPix[5]->fill( Qt::white );
151 QPainter p ( sgListViewCompletedPix[5] ); 149 QPainter p ( sgListViewCompletedPix[5] );
152 p.drawRect( 0,0,11,11); 150 p.drawRect( 0,0,11,11);
153 p.drawLine ( 2, 5, 4 , 7 ) ; 151 p.drawLine ( 2, 5, 4 , 7 ) ;
154 p.drawLine ( 4 , 7 , 8, 3) ; 152 p.drawLine ( 4 , 7 , 8, 3) ;
155 int iii = 0; 153 int iii = 0;
156 for ( iii = 0; iii < 5; ++iii ) { 154 for ( iii = 0; iii < 5; ++iii ) {
157 sgListViewCompletedPix[iii]->resize( 11, 11 ); 155 sgListViewCompletedPix[iii]->resize( 11, 11 );
158 sgListViewCompletedPix[iii]->fill( Qt::white ); 156 sgListViewCompletedPix[iii]->fill( Qt::white );
159 QPainter p ( sgListViewCompletedPix[iii] ); 157 QPainter p ( sgListViewCompletedPix[iii] );
160 p.drawRect( 0,0,11,11); 158 p.drawRect( 0,0,11,11);
161 if ( iii ) 159 if ( iii )
162 p.fillRect( 1,1,iii*2,9,Qt::gray ); 160 p.fillRect( 1,1,iii*2,9,Qt::gray );
163 } 161 }
164 sgListViewJournalPix = &journalPix; 162 sgListViewJournalPix = &journalPix;
165 sgListViewJournalPix->resize( 11, 11 ); 163 sgListViewJournalPix->resize( 11, 11 );
166 sgListViewJournalPix->fill( Qt::white ); 164 sgListViewJournalPix->fill( Qt::white );
167 { 165 {
168 QPainter p ( sgListViewJournalPix ); 166 QPainter p ( sgListViewJournalPix );
169 p.drawRect( 0,0,11,11); 167 p.drawRect( 0,0,11,11);
170 p.drawLine( 2,3,5,3); 168 p.drawLine( 2,3,5,3);
171 p.drawLine( 2,5,8,5); 169 p.drawLine( 2,5,8,5);
172 p.drawLine( 2,7,6,7); 170 p.drawLine( 2,7,6,7);
173 } 171 }
174 } 172 }
175 mClosed = false; 173 mClosed = false;
176 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
177 QString confFile = locateLocal("config","korganizerrc"); 175 QString confFile = locateLocal("config","korganizerrc");
178 QFileInfo finf ( confFile ); 176 QFileInfo finf ( confFile );
179 bool showWarning = !finf.exists(); 177 bool showWarning = !finf.exists();
180 setIcon(SmallIcon( "ko24" ) ); 178 setIcon(SmallIcon( "ko24" ) );
181 mBlockAtStartup = true; 179 mBlockAtStartup = true;
182 mFlagKeyPressed = false; 180 mFlagKeyPressed = false;
183 setCaption("KO/Pi"); 181 setCaption("KO/Pi");
184 KOPrefs *p = KOPrefs::instance(); 182 KOPrefs *p = KOPrefs::instance();
185 //KPimGlobalPrefs::instance()->setGlobalConfig(); 183 //KPimGlobalPrefs::instance()->setGlobalConfig();
186 p->mCurrentDisplayedView = 0; 184 p->mCurrentDisplayedView = 0;
187 if ( p->mHourSize > 22 ) 185 if ( p->mHourSize > 22 )
188 p->mHourSize = 22; 186 p->mHourSize = 22;
189 QMainWindow::ToolBarDock tbd; 187 QMainWindow::ToolBarDock tbd;
190 if ( p->mToolBarHor ) { 188 if ( p->mToolBarHor ) {
191 if ( p->mToolBarUp ) 189 if ( p->mToolBarUp )
192 tbd = Bottom; 190 tbd = Bottom;
193 else 191 else
194 tbd = Top; 192 tbd = Top;
195 } 193 }
196 else { 194 else {
197 if ( p->mToolBarUp ) 195 if ( p->mToolBarUp )
198 tbd = Right; 196 tbd = Right;
199 else 197 else
200 tbd = Left; 198 tbd = Left;
201 } 199 }
202 if ( KOPrefs::instance()->mUseAppColors ) 200 if ( KOPrefs::instance()->mUseAppColors )
203 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
204 globalFlagBlockStartup = 1; 202 globalFlagBlockStartup = 1;
205 iconToolBar = new QPEToolBar( this ); 203 iconToolBar = new QPEToolBar( this );
206 addToolBar (iconToolBar , tbd ); 204 addToolBar (iconToolBar , tbd );
207 205
208#ifdef DESKTOP_VERSION 206#ifdef DESKTOP_VERSION
209 if ( KOPrefs::instance()->mShowIconFilter ) 207 if ( KOPrefs::instance()->mShowIconFilter )
210#else 208#else
211 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 209 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
212#endif 210#endif
213 211
214{ 212{
215 if ( p->mToolBarHorF ) { 213 if ( p->mToolBarHorF ) {
216 if ( p->mToolBarUpF ) 214 if ( p->mToolBarUpF )
217 tbd = Bottom; 215 tbd = Bottom;
218 else 216 else
219 tbd = Top; 217 tbd = Top;
220 } 218 }
221 else { 219 else {
222 if ( p->mToolBarUpF ) 220 if ( p->mToolBarUpF )
223 tbd = Right; 221 tbd = Right;
224 else 222 else
225 tbd = Left; 223 tbd = Left;
226 } 224 }
227 filterToolBar = new QPEToolBar ( this ); 225 filterToolBar = new QPEToolBar ( this );
228 filterMenubar = new QMenuBar( 0 ); 226 filterMenubar = new KMenuBar( 0 );
229 QFontMetrics fm ( filterMenubar->font() ); 227 QFontMetrics fm ( filterMenubar->font() );
230 228
231 filterPopupMenu = new QPopupMenu( this ); 229 filterPopupMenu = new QPopupMenu( this );
232 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 230 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
233 QString addTest = "A"; 231 QString addTest = "A";
234 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 232 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
235#ifdef DESKTOP_VERSION 233#ifdef DESKTOP_VERSION
236 addTest = "AAABBBCCCx"; 234 addTest = "AAABBBCCCx";
237#else 235#else
238 addTest = "AAx"; 236 addTest = "AAx";
239#endif 237#endif
240 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 238 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
241 addToolBar (filterToolBar , tbd ); 239 addToolBar (filterToolBar , tbd );
242 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 240 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
243 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 241 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
244 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 242 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
245 filterToolBar->hide(); 243 filterToolBar->hide();
246 } else { 244 } else {
247 filterToolBar = 0; 245 filterToolBar = 0;
248 filterMenubar = 0; 246 filterMenubar = 0;
249 filterPopupMenu = 0; 247 filterPopupMenu = 0;
250 } 248 }
251 if ( p->mShowIconOnetoolbar ) { 249 if ( p->mShowIconOnetoolbar ) {
252 viewToolBar = iconToolBar ; 250 viewToolBar = iconToolBar ;
253 navigatorToolBar = iconToolBar ; 251 navigatorToolBar = iconToolBar ;
254 } else { 252 } else {
255#ifndef DESKTOP_VERSION 253#ifndef DESKTOP_VERSION
256 setToolBarsMovable( false ); 254 setToolBarsMovable( false );
257#endif 255#endif
258 if ( p->mToolBarHorV ) { 256 if ( p->mToolBarHorV ) {
259 if ( p->mToolBarUpV ) 257 if ( p->mToolBarUpV )
260 tbd = Bottom; 258 tbd = Bottom;
261 else 259 else
262 tbd = Top; 260 tbd = Top;
263 } 261 }
264 else { 262 else {
265 if ( p->mToolBarUpV ) 263 if ( p->mToolBarUpV )
266 tbd = Right; 264 tbd = Right;
267 else 265 else
268 tbd = Left; 266 tbd = Left;
269 } 267 }
270 viewToolBar = new QPEToolBar( this ); 268 viewToolBar = new QPEToolBar( this );
271 addToolBar (viewToolBar , tbd ); 269 addToolBar (viewToolBar , tbd );
272 if ( p->mToolBarHorN ) { 270 if ( p->mToolBarHorN ) {
273 if ( p->mToolBarUpN ) 271 if ( p->mToolBarUpN )
274 tbd = Bottom; 272 tbd = Bottom;
275 else 273 else
276 tbd = Top; 274 tbd = Top;
277 } 275 }
278 else { 276 else {
279 if ( p->mToolBarUpN ) 277 if ( p->mToolBarUpN )
280 tbd = Right; 278 tbd = Right;
281 else 279 else
282 tbd = Left; 280 tbd = Left;
283 } 281 }
284 navigatorToolBar = new QPEToolBar( this ); 282 navigatorToolBar = new QPEToolBar( this );
285 addToolBar (navigatorToolBar , tbd ); 283 addToolBar (navigatorToolBar , tbd );
286 } 284 }
287 285
288 286
289 287
290 mCalendarModifiedFlag = false; 288 mCalendarModifiedFlag = false;
291 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 289 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
292 splash->setAlignment ( AlignCenter ); 290 splash->setAlignment ( AlignCenter );
293 setCentralWidget( splash ); 291 setCentralWidget( splash );
294#ifndef DESKTOP_VERSION 292#ifndef DESKTOP_VERSION
295 showMaximized(); 293 showMaximized();
296#endif 294#endif
297 295
298 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 296 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
299 setDefaultPreferences(); 297 setDefaultPreferences();
300 mCalendar = new CalendarLocal(); 298 mCalendar = new CalendarLocal();
301 mView = new CalendarView( mCalendar, this,"mCalendar " ); 299 mView = new CalendarView( mCalendar, this,"mCalendar " );
302 mView->hide(); 300 mView->hide();
303 //mView->resize(splash->size() ); 301 //mView->resize(splash->size() );
304 initActions(); 302 initActions();
305 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 303 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
306 mSyncManager->setBlockSave(false); 304 mSyncManager->setBlockSave(false);
307 mView->setSyncManager(mSyncManager); 305 mView->setSyncManager(mSyncManager);
308#ifndef DESKTOP_VERSION 306#ifndef DESKTOP_VERSION
309 iconToolBar->show(); 307 iconToolBar->show();
310 qApp->processEvents(); 308 qApp->processEvents();
311#endif 309#endif
312 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 310 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
313 int vh = height() ; 311 int vh = height() ;
314 int vw = width(); 312 int vw = width();
315 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 313 //qDebug("Toolbar hei %d ",iconToolBar->height() );
316 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 314 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
317 vh -= iconToolBar->height(); 315 vh -= iconToolBar->height();
318 } else { 316 } else {
319 vw -= iconToolBar->height(); 317 vw -= iconToolBar->height();
320 } 318 }
321 //mView->setMaximumSize( splash->size() ); 319 //mView->setMaximumSize( splash->size() );
322 //mView->resize( splash->size() ); 320 //mView->resize( splash->size() );
323 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 321 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
324 mView->readSettings(); 322 mView->readSettings();
325 bool newFile = false; 323 bool newFile = false;
326 if( !QFile::exists( defaultFileName() ) ) { 324 if( !QFile::exists( defaultFileName() ) ) {
327 QFileInfo finfo ( defaultFileName() ); 325 QFileInfo finfo ( defaultFileName() );
328 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 326 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
329 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 327 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
330 finfo.setFile( oldFile ); 328 finfo.setFile( oldFile );
331 if (finfo.exists() ) { 329 if (finfo.exists() ) {
332 KMessageBox::information( this, message); 330 KMessageBox::information( this, message);
333 mView->openCalendar( oldFile ); 331 mView->openCalendar( oldFile );
334 qApp->processEvents(); 332 qApp->processEvents();
335 } else { 333 } else {
336 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 334 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
337 finfo.setFile( oldFile ); 335 finfo.setFile( oldFile );
338 if (finfo.exists() ) { 336 if (finfo.exists() ) {
339 KMessageBox::information( this, message); 337 KMessageBox::information( this, message);
340 mView->openCalendar( oldFile ); 338 mView->openCalendar( oldFile );
341 qApp->processEvents(); 339 qApp->processEvents();
342 } 340 }
343 } 341 }
344 mView->saveCalendar( defaultFileName() ); 342 mView->saveCalendar( defaultFileName() );
345 newFile = true; 343 newFile = true;
346 } 344 }
347 345
348 QTime neededSaveTime = QDateTime::currentDateTime().time(); 346 QTime neededSaveTime = QDateTime::currentDateTime().time();
349 mView->loadCalendars(); 347 mView->loadCalendars();
350 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 348 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
351 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 349 qDebug("KO: Calendar loading time: %d ms",msNeeded );
352 350
353 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 351 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
354 KOPrefs::instance()->setAllDefaults(); 352 KOPrefs::instance()->setAllDefaults();
355 } 353 }
356 processIncidenceSelection( 0 ); 354 processIncidenceSelection( 0 );
357 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 355 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
358 SLOT( processIncidenceSelection( Incidence * ) ) ); 356 SLOT( processIncidenceSelection( Incidence * ) ) );
359 connect( mView, SIGNAL( modifiedChanged( bool ) ), 357 connect( mView, SIGNAL( modifiedChanged( bool ) ),
360 SLOT( slotModifiedChanged( bool ) ) ); 358 SLOT( slotModifiedChanged( bool ) ) );
361 359
362 360
363 connect( mView, SIGNAL( tempDisableBR(bool) ), 361 connect( mView, SIGNAL( tempDisableBR(bool) ),
364 SLOT( disableBR(bool) ) ); 362 SLOT( disableBR(bool) ) );
365 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 363 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
366 mView->setModified( false ); 364 mView->setModified( false );
367 mBlockAtStartup = false; 365 mBlockAtStartup = false;
368 mView->setModified( false ); 366 mView->setModified( false );
369 setCentralWidget( mView ); 367 setCentralWidget( mView );
370 globalFlagBlockStartup = 0; 368 globalFlagBlockStartup = 0;
371 mView->show(); 369 mView->show();
372 delete splash; 370 delete splash;
373 if ( newFile ) 371 if ( newFile )
374 mView->updateConfig(); 372 mView->updateConfig();
375 // qApp->processEvents(); 373 // qApp->processEvents();
376 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 374 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
377 //fillSyncMenu(); 375 //fillSyncMenu();
378 376
379 377
380 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 378 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
381 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 379 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
382 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 380 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
383 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 381 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
384 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 382 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
385 mSyncManager->setDefaultFileName( sentSyncFile()); 383 mSyncManager->setDefaultFileName( sentSyncFile());
386 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 384 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
387 mSyncManager->fillSyncMenu(); 385 mSyncManager->fillSyncMenu();
388 386
389 387
390 388
391 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 389 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
392 if ( showWarning ) { 390 if ( showWarning ) {
393 KMessageBox::information( this, 391 KMessageBox::information( this,
394 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 392 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
395 qApp->processEvents(); 393 qApp->processEvents();
396 mView->dialogManager()->showSyncOptions(); 394 mView->dialogManager()->showSyncOptions();
397 } 395 }
398 396
399 //US listen for result adressed from Ka/Pi 397 //US listen for result adressed from Ka/Pi
400#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
401 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 399 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
402#endif 400#endif
403#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
404 infrared = 0; 402 infrared = 0;
405#endif 403#endif
406 updateFilterToolbar(); 404 updateFilterToolbar();
407 updateWeek( mView->startDate() ); 405 updateWeek( mView->startDate() );
408 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 406 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
409 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 407 SLOT( updateWeekNum( const KCal::DateList & ) ) );
410 mBRdisabled = false; 408 mBRdisabled = false;
411 //toggleBeamReceive(); 409 //toggleBeamReceive();
412 410
413 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 411 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
414} 412}
415MainWindow::~MainWindow() 413MainWindow::~MainWindow()
416{ 414{
417 //qDebug("MainWindow::~MainWindow() "); 415 //qDebug("MainWindow::~MainWindow() ");
418 //save toolbar location 416 //save toolbar location
419 delete mCalendar; 417 delete mCalendar;
420 delete mSyncManager; 418 delete mSyncManager;
421#ifndef DESKTOP_VERSION 419#ifndef DESKTOP_VERSION
422 if ( infrared ) 420 if ( infrared )
423 delete infrared; 421 delete infrared;
424#endif 422#endif
425 423
426 424
427} 425}
428 426
429void MainWindow::disableBR(bool b) 427void MainWindow::disableBR(bool b)
430{ 428{
431#ifndef DESKTOP_VERSION 429#ifndef DESKTOP_VERSION
432 if ( b ) { 430 if ( b ) {
433 if ( infrared ) { 431 if ( infrared ) {
434 toggleBeamReceive(); 432 toggleBeamReceive();
435 mBRdisabled = true; 433 mBRdisabled = true;
436 } 434 }
437 mBRdisabled = true; 435 mBRdisabled = true;
438 } else { 436 } else {
439 if ( mBRdisabled ) { 437 if ( mBRdisabled ) {
440 mBRdisabled = false; 438 mBRdisabled = false;
441 //makes no sense,because other cal ap is probably running 439 //makes no sense,because other cal ap is probably running
442 // toggleBeamReceive(); 440 // toggleBeamReceive();
443 } 441 }
444 } 442 }
445#endif 443#endif
446 444
447} 445}
448bool MainWindow::beamReceiveEnabled() 446bool MainWindow::beamReceiveEnabled()
449{ 447{
450#ifndef DESKTOP_VERSION 448#ifndef DESKTOP_VERSION
451 return ( infrared != 0 ); 449 return ( infrared != 0 );
452#endif 450#endif
453 return false; 451 return false;
454} 452}
455 453
456void MainWindow::toggleBeamReceive() 454void MainWindow::toggleBeamReceive()
457{ 455{
458 if ( mBRdisabled ) 456 if ( mBRdisabled )
459 return; 457 return;
460#ifndef DESKTOP_VERSION 458#ifndef DESKTOP_VERSION
461 if ( infrared ) { 459 if ( infrared ) {
462 qDebug("KO: Disable BeamReceive "); 460 qDebug("KO: Disable BeamReceive ");
463 delete infrared; 461 delete infrared;
464 infrared = 0; 462 infrared = 0;
465 brAction->setOn(false); 463 brAction->setOn(false);
466 return; 464 return;
467 } 465 }
468 qDebug("KO: Enable BeamReceive "); 466 qDebug("KO: Enable BeamReceive ");
469 brAction->setOn(true); 467 brAction->setOn(true);
470 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 468 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
471 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 469 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
472#endif 470#endif
473} 471}
474void MainWindow::showMaximized () 472void MainWindow::showMaximized ()
475{ 473{
476#ifndef DESKTOP_VERSION 474#ifndef DESKTOP_VERSION
477 if ( ! globalFlagBlockStartup ) 475 if ( ! globalFlagBlockStartup )
478 if ( mClosed ) 476 if ( mClosed )
479 mView->goToday(); 477 mView->goToday();
480#endif 478#endif
481 QWidget::showMaximized () ; 479 QWidget::showMaximized () ;
482 mClosed = false; 480 mClosed = false;
483} 481}
484void MainWindow::closeEvent( QCloseEvent* ce ) 482void MainWindow::closeEvent( QCloseEvent* ce )
485{ 483{
486 484
487 485
488 486
489 if ( ! KOPrefs::instance()->mAskForQuit ) { 487 if ( ! KOPrefs::instance()->mAskForQuit ) {
490 saveOnClose(); 488 saveOnClose();
491 mClosed = true; 489 mClosed = true;
492 ce->accept(); 490 ce->accept();
493 return; 491 return;
494 492
495 } 493 }
496 494
497 switch( QMessageBox::information( this, "KO/Pi", 495 switch( QMessageBox::information( this, "KO/Pi",
498 i18n("Do you really want\nto close KO/Pi?"), 496 i18n("Do you really want\nto close KO/Pi?"),
499 i18n("Close"), i18n("No"), 497 i18n("Close"), i18n("No"),
500 0, 0 ) ) { 498 0, 0 ) ) {
501 case 0: 499 case 0:
502 saveOnClose(); 500 saveOnClose();
503 mClosed = true; 501 mClosed = true;
504 ce->accept(); 502 ce->accept();
505 break; 503 break;
506 case 1: 504 case 1:
507 ce->ignore(); 505 ce->ignore();
508 break; 506 break;
509 case 2: 507 case 2:
510 508
511 default: 509 default:
512 break; 510 break;
513 } 511 }
514 512
515 513
516} 514}
517 515
518void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 516void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
519{ 517{
520 QDataStream stream( data, IO_ReadOnly ); 518 QDataStream stream( data, IO_ReadOnly );
521 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 519 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
522 //QString datamess; 520 //QString datamess;
523 //qDebug("message "); 521 //qDebug("message ");
524 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 522 qDebug("KO: QCOP message received: %s ", cmsg.data() );
525 523
526 if ( cmsg == "setDocument(QString)" ) { 524 if ( cmsg == "setDocument(QString)" ) {
527 QDataStream stream( data, IO_ReadOnly ); 525 QDataStream stream( data, IO_ReadOnly );
528 QString fileName; 526 QString fileName;
529 stream >> fileName; 527 stream >> fileName;
530 //qDebug("filename %s ", fileName.latin1()); 528 //qDebug("filename %s ", fileName.latin1());
531 showMaximized(); 529 showMaximized();
532 raise(); 530 raise();
533 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 531 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
534 mSyncManager->slotSyncMenu( 1002 ); 532 mSyncManager->slotSyncMenu( 1002 );
535 return; 533 return;
536 } 534 }
537 535
538 if ( cmsg == "-writeFile" ) { 536 if ( cmsg == "-writeFile" ) {
539 // I made from the "-writeFile" an "-writeAlarm" 537 // I made from the "-writeFile" an "-writeAlarm"
540 mView->viewManager()->showWhatsNextView(); 538 mView->viewManager()->showWhatsNextView();
541 mCalendar->checkAlarmForIncidence( 0, true); 539 mCalendar->checkAlarmForIncidence( 0, true);
542 showMaximized(); 540 showMaximized();
543 raise(); 541 raise();
544 return; 542 return;
545 543
546 } 544 }
547 if ( cmsg == "-writeFileSilent" ) { 545 if ( cmsg == "-writeFileSilent" ) {
548 // I made from the "-writeFile" an "-writeAlarm" 546 // I made from the "-writeFile" an "-writeAlarm"
549 // mView->viewManager()->showWhatsNextView(); 547 // mView->viewManager()->showWhatsNextView();
550 mCalendar->checkAlarmForIncidence( 0, true); 548 mCalendar->checkAlarmForIncidence( 0, true);
551 //showMaximized(); 549 //showMaximized();
552 //raise(); 550 //raise();
553 hide(); 551 hide();
554 return; 552 return;
555 } 553 }
556 if ( cmsg == "-newCountdown" ) { 554 if ( cmsg == "-newCountdown" ) {
557 qDebug("newCountdown "); 555 qDebug("newCountdown ");
558 556
559 } 557 }
560 QString msg ; 558 QString msg ;
561 QString allmsg = cmsg; 559 QString allmsg = cmsg;
562 while ( allmsg.length() > 0 ) { 560 while ( allmsg.length() > 0 ) {
563 int nextC = allmsg.find( "-", 1 ); 561 int nextC = allmsg.find( "-", 1 );
564 if ( nextC == -1 ) { 562 if ( nextC == -1 ) {
565 msg = allmsg; 563 msg = allmsg;
566 allmsg = ""; 564 allmsg = "";
567 } else{ 565 } else{
568 msg = allmsg.left( nextC ); 566 msg = allmsg.left( nextC );
569 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 567 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
570 } 568 }
571 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 569 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
572 if ( msg == "-newEvent" ) { 570 if ( msg == "-newEvent" ) {
573 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 571 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
574 } 572 }
575 if ( msg == "-newTodo" ) { 573 if ( msg == "-newTodo" ) {
576 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 574 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
577 } 575 }
578 if ( msg == "-showWN" ) { 576 if ( msg == "-showWN" ) {
579 mView->viewManager()->showWhatsNextView(); 577 mView->viewManager()->showWhatsNextView();
580 } 578 }
581 if ( msg == "-showTodo" ) { 579 if ( msg == "-showTodo" ) {
582 mView->viewManager()->showTodoView(); 580 mView->viewManager()->showTodoView();
583 } 581 }
584 if ( msg == "-showList" ) { 582 if ( msg == "-showList" ) {
585 mView->viewManager()->showListView(); 583 mView->viewManager()->showListView();
586 } 584 }
587 else if ( msg == "-showDay" ) { 585 else if ( msg == "-showDay" ) {
588 mView->viewManager()->showDayView(); 586 mView->viewManager()->showDayView();
589 } 587 }
590 else if ( msg == "-showWWeek" ) { 588 else if ( msg == "-showWWeek" ) {
591 mView->viewManager()->showWorkWeekView(); 589 mView->viewManager()->showWorkWeekView();
592 } 590 }
593 else if ( msg == "-ringSync" ) { 591 else if ( msg == "-ringSync" ) {
594 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 592 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
595 } 593 }
596 else if ( msg == "-showWeek" ) { 594 else if ( msg == "-showWeek" ) {
597 mView->viewManager()->showWeekView(); 595 mView->viewManager()->showWeekView();
598 } 596 }
599 else if ( msg == "-showTodo" ) { 597 else if ( msg == "-showTodo" ) {
600 mView->viewManager()->showTodoView(); 598 mView->viewManager()->showTodoView();
601 } 599 }
602 else if ( msg == "-showJournal" ) { 600 else if ( msg == "-showJournal" ) {
603 mView->dateNavigator()->selectDates( 1 ); 601 mView->dateNavigator()->selectDates( 1 );
604 mView->dateNavigator()->selectToday(); 602 mView->dateNavigator()->selectToday();
605 mView->viewManager()->showJournalView(); 603 mView->viewManager()->showJournalView();
606 } 604 }
607 else if ( msg == "-showKO" ) { 605 else if ( msg == "-showKO" ) {
608 mView->viewManager()->showNextXView(); 606 mView->viewManager()->showNextXView();
609 } 607 }
610 else if ( msg == "-showWNext" ) { 608 else if ( msg == "-showWNext" ) {
611 mView->viewManager()->showWhatsNextView(); 609 mView->viewManager()->showWhatsNextView();
612 } 610 }
613 else if ( msg == "nextView()" ) { 611 else if ( msg == "nextView()" ) {
614 mView->viewManager()->showNextView(); 612 mView->viewManager()->showNextView();
615 } 613 }
616 else if ( msg == "-showNextXView" ) { 614 else if ( msg == "-showNextXView" ) {
617 mView->viewManager()->showNextXView(); 615 mView->viewManager()->showNextXView();
618 } 616 }
619 617
620 618
621 } 619 }
622 620
623 showMaximized(); 621 showMaximized();
624 raise(); 622 raise();
625} 623}
626void MainWindow::startMultiSync() 624void MainWindow::startMultiSync()
627{ 625{
628 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 626 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
629 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 627 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
630 question, 628 question,
631 i18n("Yes"), i18n("No"), 629 i18n("Yes"), i18n("No"),
632 0, 0 ) != 0 ) { 630 0, 0 ) != 0 ) {
633 setCaption(i18n("Aborted! Nothing synced!")); 631 setCaption(i18n("Aborted! Nothing synced!"));
634 return; 632 return;
635 } 633 }
636 mSyncManager->multiSync( false ); 634 mSyncManager->multiSync( false );
637#ifndef DESKTOP_VERSION 635#ifndef DESKTOP_VERSION
638 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 636 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
639#endif 637#endif
640} 638}
641QPixmap MainWindow::loadPixmap( QString name ) 639QPixmap MainWindow::loadPixmap( QString name )
642{ 640{
643 return SmallIcon( name ); 641 return SmallIcon( name );
644 642
645} 643}
646void MainWindow::setUsesBigPixmaps ( bool b ) 644void MainWindow::setUsesBigPixmaps ( bool b )
647{ 645{
648 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 646 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
649 if ( b ) 647 if ( b )
650 qDebug("KO: BigPixmaps are not supported "); 648 qDebug("KO: BigPixmaps are not supported ");
651} 649}
652void MainWindow::initActions() 650void MainWindow::initActions()
653{ 651{
654 //KOPrefs::instance()->mShowFullMenu 652 //KOPrefs::instance()->mShowFullMenu
655 iconToolBar->clear(); 653 iconToolBar->clear();
656 KOPrefs *p = KOPrefs::instance(); 654 KOPrefs *p = KOPrefs::instance();
657 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 655 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
658 656
659 QPopupMenu *viewMenu = new QPopupMenu( this ); 657 QPopupMenu *viewMenu = new QPopupMenu( this );
660 QPopupMenu *actionMenu = new QPopupMenu( this ); 658 QPopupMenu *actionMenu = new QPopupMenu( this );
661 mCurrentItemMenu = new QPopupMenu ( this ); 659 mCurrentItemMenu = new QPopupMenu ( this );
662 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 660 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
663 QPopupMenu *importMenu = new QPopupMenu( this ); 661 QPopupMenu *importMenu = new QPopupMenu( this );
664 QPopupMenu *importMenu_X = new QPopupMenu( this ); 662 QPopupMenu *importMenu_X = new QPopupMenu( this );
665 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 663 QPopupMenu *exportMenu_X = new QPopupMenu( this );
666 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 664 QPopupMenu *beamMenu_X = new QPopupMenu( this );
667 selectFilterMenu = new QPopupMenu( this ); 665 selectFilterMenu = new QPopupMenu( this );
668 selectFilterMenu->setCheckable( true ); 666 selectFilterMenu->setCheckable( true );
669 syncMenu = new QPopupMenu( this ); 667 syncMenu = new QPopupMenu( this );
670 configureAgendaMenu = new QPopupMenu( this ); 668 configureAgendaMenu = new QPopupMenu( this );
671 configureToolBarMenu = new QPopupMenu( this ); 669 configureToolBarMenu = new QPopupMenu( this );
672 QPopupMenu *helpMenu = new QPopupMenu( this ); 670 QPopupMenu *helpMenu = new QPopupMenu( this );
673 QIconSet icon; 671 QIconSet icon;
674 int pixWid = 22, pixHei = 22; 672 int pixWid = 22, pixHei = 22;
675 QString pathString = ""; 673 QString pathString = "";
676 if ( !p->mToolBarMiniIcons ) { 674 if ( !p->mToolBarMiniIcons ) {
677 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 675 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
678 pathString += "icons16/"; 676 pathString += "icons16/";
679 pixWid = 18; pixHei = 16; 677 pixWid = 18; pixHei = 16;
680 } 678 }
681 } else { 679 } else {
682 pathString += "iconsmini/"; 680 pathString += "iconsmini/";
683 pixWid = 18; pixHei = 16; 681 pixWid = 18; pixHei = 16;
684 } 682 }
683 KMenuBar *menuBar1;
685 if ( KOPrefs::instance()->mShowFullMenu ) { 684 if ( KOPrefs::instance()->mShowFullMenu ) {
686 QMenuBar *menuBar1; 685 menuBar1 = new KMenuBar( this );//menuBar();
687 menuBar1 = menuBar();
688 menuBar1->insertItem( i18n("File"), importMenu ); 686 menuBar1->insertItem( i18n("File"), importMenu );
689 menuBar1->insertItem( i18n("View"), viewMenu ); 687 menuBar1->insertItem( i18n("View"), viewMenu );
690 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 688 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
691 menuBar1->insertItem( i18n("Action"), actionMenu ); 689 menuBar1->insertItem( i18n("Action"), actionMenu );
692#ifdef DESKTOP_VERSION 690#ifdef DESKTOP_VERSION
693 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 691 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
694 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 692 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
695#else 693#else
696 menuBar1->insertItem( i18n("Sync"), syncMenu ); 694 menuBar1->insertItem( i18n("Sync"), syncMenu );
697 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 695 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
698#endif 696#endif
699 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 697 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
700 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 698 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
701 menuBar1->insertItem( i18n("Help"), helpMenu ); 699 menuBar1->insertItem( i18n("Help"), helpMenu );
702 } else { 700 } else {
703 QPEMenuBar *menuBar1; 701 menuBar1 = new KMenuBar( iconToolBar );
704 menuBar1 = new QPEMenuBar( iconToolBar );
705 QPopupMenu *menuBar = new QPopupMenu( this ); 702 QPopupMenu *menuBar = new QPopupMenu( this );
706 icon = loadPixmap( pathString + "z_menu" ); 703 icon = loadPixmap( pathString + "z_menu" );
707 menuBar1->insertItem( icon.pixmap(), menuBar); 704 menuBar1->insertItem( icon.pixmap(), menuBar);
708 //menuBar1->insertItem( i18n("ME"), menuBar); 705 //menuBar1->insertItem( i18n("ME"), menuBar);
709 menuBar->insertItem( i18n("File"), importMenu ); 706 menuBar->insertItem( i18n("File"), importMenu );
710 menuBar->insertItem( i18n("View"), viewMenu ); 707 menuBar->insertItem( i18n("View"), viewMenu );
711 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 708 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
712 menuBar->insertItem( i18n("Action"), actionMenu ); 709 menuBar->insertItem( i18n("Action"), actionMenu );
713 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 710 menuBar->insertItem( i18n("Synchronize"), syncMenu );
714 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 711 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
715 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 712 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
716 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 713 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
717 menuBar->insertItem( i18n("Help"), helpMenu ); 714 menuBar->insertItem( i18n("Help"), helpMenu );
718 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 715 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
719 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 716 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
720 } 717 }
718 connect ( menuBar1, SIGNAL( lostFocus () ), mView, SLOT ( slotResetFocus() ) );
721 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 719 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
722 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 720 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
723 721
724 722
725 mWeekBgColor = iconToolBar->backgroundColor(); 723 mWeekBgColor = iconToolBar->backgroundColor();
726 mWeekPixmap.resize( pixWid , pixHei ); 724 mWeekPixmap.resize( pixWid , pixHei );
727 mWeekPixmap.fill( mWeekBgColor ); 725 mWeekPixmap.fill( mWeekBgColor );
728 icon = mWeekPixmap; 726 icon = mWeekPixmap;
729 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 727 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
730 if ( p-> mShowIconWeekNum ) 728 if ( p-> mShowIconWeekNum )
731 mWeekAction->addTo( iconToolBar ); 729 mWeekAction->addTo( iconToolBar );
732 mWeekFont = font(); 730 mWeekFont = font();
733 731
734 int fontPoint = mWeekFont.pointSize(); 732 int fontPoint = mWeekFont.pointSize();
735 QFontMetrics f( mWeekFont ); 733 QFontMetrics f( mWeekFont );
736 int fontWid = f.width( "30" ); 734 int fontWid = f.width( "30" );
737 while ( fontWid > pixWid ) { 735 while ( fontWid > pixWid ) {
738 --fontPoint; 736 --fontPoint;
739 mWeekFont.setPointSize( fontPoint ); 737 mWeekFont.setPointSize( fontPoint );
740 QFontMetrics f( mWeekFont ); 738 QFontMetrics f( mWeekFont );
741 fontWid = f.width( "30" ); 739 fontWid = f.width( "30" );
742 //qDebug("dec-- "); 740 //qDebug("dec-- ");
743 } 741 }
744 742
745 connect( mWeekAction, SIGNAL( activated() ), 743 connect( mWeekAction, SIGNAL( activated() ),
746 this, SLOT( weekAction() ) ); 744 this, SLOT( weekAction() ) );
747 745
748 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 746 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
749 if ( p->mShowIconFilterview ) { 747 if ( p->mShowIconFilterview ) {
750 icon = loadPixmap( pathString + "filter" ); 748 icon = loadPixmap( pathString + "filter" );
751 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 749 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
752 connect( actionFilterMenuTB, SIGNAL( activated() ), 750 connect( actionFilterMenuTB, SIGNAL( activated() ),
753 this, SLOT( fillFilterMenuTB() ) ); 751 this, SLOT( fillFilterMenuTB() ) );
754 actionFilterMenuTB->addTo( iconToolBar ); 752 actionFilterMenuTB->addTo( iconToolBar );
755 selectFilterMenuTB = new QPopupMenu( this ); 753 selectFilterMenuTB = new QPopupMenu( this );
756 selectFilterMenuTB->setCheckable( true ); 754 selectFilterMenuTB->setCheckable( true );
757 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 755 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
758 } 756 }
759 757
760 //#endif 758 //#endif
761 // ****************** 759 // ******************
762 QAction *action; 760 QAction *action;
763 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 761 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
764 configureToolBarMenu->setCheckable( true ); 762 configureToolBarMenu->setCheckable( true );
765 763
766 764
767 configureAgendaMenu->setCheckable( true ); 765 configureAgendaMenu->setCheckable( true );
768 int iii ; 766 int iii ;
769 for ( iii = 1;iii<= 10 ;++iii ){ 767 for ( iii = 1;iii<= 10 ;++iii ){
770 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 768 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
771 } 769 }
772 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 770 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
773 771
774 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 772 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
775 this, SLOT( showConfigureAgenda( ) ) ); 773 this, SLOT( showConfigureAgenda( ) ) );
776 icon = loadPixmap( pathString + "today" ); 774 icon = loadPixmap( pathString + "today" );
777 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 775 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
778 today_action->addTo( actionMenu ); 776 today_action->addTo( actionMenu );
779 connect( today_action, SIGNAL( activated() ), 777 connect( today_action, SIGNAL( activated() ),
780 mView, SLOT( goToday() ) ); 778 mView, SLOT( goToday() ) );
781 779
782 icon = loadPixmap( pathString + "picker" ); 780 icon = loadPixmap( pathString + "picker" );
783 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 781 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
784 dPickerAction->addTo( actionMenu ); 782 dPickerAction->addTo( actionMenu );
785 connect( dPickerAction, SIGNAL( activated() ), 783 connect( dPickerAction, SIGNAL( activated() ),
786 mView, SLOT( showDatePicker() ) ); 784 mView, SLOT( showDatePicker() ) );
787 785
788 icon = loadPixmap( pathString + "search" ); 786 icon = loadPixmap( pathString + "search" );
789 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 787 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
790 search_action->addTo( actionMenu ); 788 search_action->addTo( actionMenu );
791 connect( search_action, SIGNAL( activated() ), 789 connect( search_action, SIGNAL( activated() ),
792 mView->dialogManager(), SLOT( showSearchDialog() ) ); 790 mView->dialogManager(), SLOT( showSearchDialog() ) );
793 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 791 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
794 792
795 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 793 action = new QAction( "Undo Delete", i18n("All events"), 0, this );
796 action->addTo( nextConflictMenu ); 794 action->addTo( nextConflictMenu );
797 connect( action, SIGNAL( activated() ), 795 connect( action, SIGNAL( activated() ),
798 mView, SLOT( conflictAll() ) ); 796 mView, SLOT( conflictAll() ) );
799 797
800 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 798 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
801 action->addTo( nextConflictMenu ); 799 action->addTo( nextConflictMenu );
802 connect( action, SIGNAL( activated() ), 800 connect( action, SIGNAL( activated() ),
803 mView, SLOT( conflictAllday() ) ); 801 mView, SLOT( conflictAllday() ) );
804 802
805 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 803 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
806 action->addTo( nextConflictMenu ); 804 action->addTo( nextConflictMenu );
807 connect( action, SIGNAL( activated() ), 805 connect( action, SIGNAL( activated() ),
808 mView, SLOT( conflictNotAll() ) ); 806 mView, SLOT( conflictNotAll() ) );
809 807
810 actionMenu->insertSeparator(); 808 actionMenu->insertSeparator();
811 809
812 icon = loadPixmap( pathString + "newevent" ); 810 icon = loadPixmap( pathString + "newevent" );
813 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 811 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
814 ne_action->addTo( mCurrentItemMenu ); 812 ne_action->addTo( mCurrentItemMenu );
815 connect( ne_action, SIGNAL( activated() ), 813 connect( ne_action, SIGNAL( activated() ),
816 mView, SLOT( newEvent() ) ); 814 mView, SLOT( newEvent() ) );
817 icon = loadPixmap( pathString + "newtodo" ); 815 icon = loadPixmap( pathString + "newtodo" );
818 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 816 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
819 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 817 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
820 nt_action->addTo( mCurrentItemMenu ); 818 nt_action->addTo( mCurrentItemMenu );
821 connect( nt_action, SIGNAL( activated() ), 819 connect( nt_action, SIGNAL( activated() ),
822 mView, SLOT( newTodo() ) ); 820 mView, SLOT( newTodo() ) );
823 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 821 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
824 this ); 822 this );
825 mNewSubTodoAction->addTo( mCurrentItemMenu ); 823 mNewSubTodoAction->addTo( mCurrentItemMenu );
826 connect( mNewSubTodoAction, SIGNAL( activated() ), 824 connect( mNewSubTodoAction, SIGNAL( activated() ),
827 mView, SLOT( newSubTodo() ) ); 825 mView, SLOT( newSubTodo() ) );
828 826
829 mCurrentItemMenu->insertSeparator(); 827 mCurrentItemMenu->insertSeparator();
830 icon = loadPixmap( pathString + "newevent" ); 828 icon = loadPixmap( pathString + "newevent" );
831 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 829 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
832 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 830 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
833 configureToolBarMenu->insertSeparator(); 831 configureToolBarMenu->insertSeparator();
834 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 832 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
835 configureToolBarMenu->insertSeparator(); 833 configureToolBarMenu->insertSeparator();
836 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 834 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
837 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 835 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
838 836
839 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 837 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
840 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 838 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
841 mShowAction->addTo( mCurrentItemMenu ); 839 mShowAction->addTo( mCurrentItemMenu );
842 connect( mShowAction, SIGNAL( activated() ), 840 connect( mShowAction, SIGNAL( activated() ),
843 mView, SLOT( showIncidence() ) ); 841 mView, SLOT( showIncidence() ) );
844 842
845 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 843 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
846 mEditAction->addTo( mCurrentItemMenu ); 844 mEditAction->addTo( mCurrentItemMenu );
847 connect( mEditAction, SIGNAL( activated() ), 845 connect( mEditAction, SIGNAL( activated() ),
848 mView, SLOT( editIncidence() ) ); 846 mView, SLOT( editIncidence() ) );
849 847
850 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 848 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
851 mDeleteAction->addTo( mCurrentItemMenu ); 849 mDeleteAction->addTo( mCurrentItemMenu );
852 connect( mDeleteAction, SIGNAL( activated() ), 850 connect( mDeleteAction, SIGNAL( activated() ),
853 mView, SLOT( deleteIncidence() ) ); 851 mView, SLOT( deleteIncidence() ) );
854 852
855 853
856 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 854 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
857 mCloneAction->addTo( mCurrentItemMenu ); 855 mCloneAction->addTo( mCurrentItemMenu );
858 connect( mCloneAction, SIGNAL( activated() ), 856 connect( mCloneAction, SIGNAL( activated() ),
859 mView, SLOT( cloneIncidence() ) ); 857 mView, SLOT( cloneIncidence() ) );
860 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 858 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
861 mMoveAction->addTo( mCurrentItemMenu ); 859 mMoveAction->addTo( mCurrentItemMenu );
862 connect( mMoveAction, SIGNAL( activated() ), 860 connect( mMoveAction, SIGNAL( activated() ),
863 mView, SLOT( moveIncidence() ) ); 861 mView, SLOT( moveIncidence() ) );
864#ifndef DESKTOP_VERSION 862#ifndef DESKTOP_VERSION
865 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 863 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
866 mBeamAction->addTo(mCurrentItemMenu ); 864 mBeamAction->addTo(mCurrentItemMenu );
867 connect( mBeamAction, SIGNAL( activated() ), 865 connect( mBeamAction, SIGNAL( activated() ),
868 mView, SLOT( beamIncidence() ) ); 866 mView, SLOT( beamIncidence() ) );
869#endif 867#endif
870 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 868 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
871 mCancelAction->addTo( mCurrentItemMenu ); 869 mCancelAction->addTo( mCurrentItemMenu );
872 connect( mCancelAction, SIGNAL( activated() ), 870 connect( mCancelAction, SIGNAL( activated() ),
873 mView, SLOT( toggleCancelIncidence() ) ); 871 mView, SLOT( toggleCancelIncidence() ) );
874 872
875 873
876 mCurrentItemMenu->insertSeparator(); 874 mCurrentItemMenu->insertSeparator();
877 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 875 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
878 action->addTo( mCurrentItemMenu ); 876 action->addTo( mCurrentItemMenu );
879 connect( action, SIGNAL( activated() ), 877 connect( action, SIGNAL( activated() ),
880 mView, SLOT( undo_delete() ) ); 878 mView, SLOT( undo_delete() ) );
881 879
882 // *********************** 880 // ***********************
883 if ( KOPrefs::instance()->mVerticalScreen ) { 881 if ( KOPrefs::instance()->mVerticalScreen ) {
884 icon = SmallIcon( "1updownarrow" ); 882 icon = SmallIcon( "1updownarrow" );
885 } else { 883 } else {
886 icon = SmallIcon("1leftrightarrow" ); 884 icon = SmallIcon("1leftrightarrow" );
887 } 885 }
888 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 886 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
889 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 887 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
890 FSaction->addTo( viewMenu ); 888 FSaction->addTo( viewMenu );
891 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 889 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
892 890
893 891
894 icon = loadPixmap( pathString + "filter" ); 892 icon = loadPixmap( pathString + "filter" );
895 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 893 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
896 icon = loadPixmap( pathString + "configure" ); 894 icon = loadPixmap( pathString + "configure" );
897 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 895 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
898 action->addTo( viewMenu ); 896 action->addTo( viewMenu );
899 connect( action, SIGNAL( activated() ), 897 connect( action, SIGNAL( activated() ),
900 mView, SLOT( toggleFilter() ) ); 898 mView, SLOT( toggleFilter() ) );
901 mToggleFilter = action; 899 mToggleFilter = action;
902 icon = loadPixmap( pathString + "navi" ); 900 icon = loadPixmap( pathString + "navi" );
903 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 901 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
904 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 902 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
905 action->addTo( viewMenu ); 903 action->addTo( viewMenu );
906 connect( action, SIGNAL( activated() ), 904 connect( action, SIGNAL( activated() ),
907 mView, SLOT( toggleDateNavigatorWidget() ) ); 905 mView, SLOT( toggleDateNavigatorWidget() ) );
908 mToggleNav = action ; 906 mToggleNav = action ;
909 icon = loadPixmap( pathString + "allday" ); 907 icon = loadPixmap( pathString + "allday" );
910 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 908 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
911 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 909 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
912 action->addTo( viewMenu ); 910 action->addTo( viewMenu );
913 connect( action, SIGNAL( activated() ), 911 connect( action, SIGNAL( activated() ),
914 mView, SLOT( toggleAllDaySize() ) ); 912 mView, SLOT( toggleAllDaySize() ) );
915 mToggleAllday = action; 913 mToggleAllday = action;
916 914
917 915
918 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 916 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
919 mToggleNav, SLOT( setEnabled ( bool ) ) ); 917 mToggleNav, SLOT( setEnabled ( bool ) ) );
920 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 918 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
921 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 919 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
922 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 920 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
923 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 921 mToggleAllday, SLOT( setEnabled ( bool ) ) );
924 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 922 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
925 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 923 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
926 924
927 925
928 dPickerAction->addTo( iconToolBar ); 926 dPickerAction->addTo( iconToolBar );
929 viewMenu->insertSeparator(); 927 viewMenu->insertSeparator();
930 928
931 if ( p-> mShowIconToggleFull ) 929 if ( p-> mShowIconToggleFull )
932 FSaction->addTo( iconToolBar ); 930 FSaction->addTo( iconToolBar );
933 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 931 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
934 932
935 //******************** 933 //********************
936 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 934 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
937 935
938 936
939 icon = loadPixmap( pathString + "whatsnext" ); 937 icon = loadPixmap( pathString + "whatsnext" );
940 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 938 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
941 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 939 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
942 whatsnext_action->addTo( viewMenu ); 940 whatsnext_action->addTo( viewMenu );
943 connect( whatsnext_action, SIGNAL( activated() ), 941 connect( whatsnext_action, SIGNAL( activated() ),
944 mView->viewManager(), SLOT( showWhatsNextView() ) ); 942 mView->viewManager(), SLOT( showWhatsNextView() ) );
945 943
946 icon = loadPixmap( pathString + "xdays" ); 944 icon = loadPixmap( pathString + "xdays" );
947 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 945 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
948 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 946 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
949 xdays_action->addTo( viewMenu ); 947 xdays_action->addTo( viewMenu );
950 connect( xdays_action, SIGNAL( activated() ), 948 connect( xdays_action, SIGNAL( activated() ),
951 mView->viewManager(), SLOT( showNextXView() ) ); 949 mView->viewManager(), SLOT( showNextXView() ) );
952 950
953 951
954 icon = loadPixmap( pathString + "journal" ); 952 icon = loadPixmap( pathString + "journal" );
955 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 953 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
956 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 954 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
957 viewjournal_action->addTo( viewMenu ); 955 viewjournal_action->addTo( viewMenu );
958 connect( viewjournal_action, SIGNAL( activated() ), 956 connect( viewjournal_action, SIGNAL( activated() ),
959 mView->viewManager(), SLOT( showJournalView() ) ); 957 mView->viewManager(), SLOT( showJournalView() ) );
960 958
961 959
962 icon = loadPixmap( pathString + "day" ); 960 icon = loadPixmap( pathString + "day" );
963 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 961 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
964 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 962 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
965 day1_action->addTo( viewMenu ); 963 day1_action->addTo( viewMenu );
966 // action->addTo( toolBar ); 964 // action->addTo( toolBar );
967 connect( day1_action, SIGNAL( activated() ), 965 connect( day1_action, SIGNAL( activated() ),
968 mView->viewManager(), SLOT( showDayView() ) ); 966 mView->viewManager(), SLOT( showDayView() ) );
969 967
970 icon = loadPixmap( pathString + "workweek" ); 968 icon = loadPixmap( pathString + "workweek" );
971 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 969 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
972 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 970 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
973 day5_action->addTo( viewMenu ); 971 day5_action->addTo( viewMenu );
974 connect( day5_action, SIGNAL( activated() ), 972 connect( day5_action, SIGNAL( activated() ),
975 mView->viewManager(), SLOT( showWorkWeekView() ) ); 973 mView->viewManager(), SLOT( showWorkWeekView() ) );
976 974
977 icon = loadPixmap( pathString + "week" ); 975 icon = loadPixmap( pathString + "week" );
978 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 976 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
979 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 977 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
980 day7_action->addTo( viewMenu ); 978 day7_action->addTo( viewMenu );
981 connect( day7_action, SIGNAL( activated() ), 979 connect( day7_action, SIGNAL( activated() ),
982 mView->viewManager(), SLOT( showWeekView() ) ); 980 mView->viewManager(), SLOT( showWeekView() ) );
983 981
984 icon = loadPixmap( pathString + "workweek2" ); 982 icon = loadPixmap( pathString + "workweek2" );
985 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 983 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
986 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 984 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
987 day6_action->addTo( viewMenu ); 985 day6_action->addTo( viewMenu );
988 connect( day6_action, SIGNAL( activated() ), 986 connect( day6_action, SIGNAL( activated() ),
989 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 987 mView->viewManager(), SLOT( showMonthViewWeek() ) );
990 988
991 icon = loadPixmap( pathString + "month" ); 989 icon = loadPixmap( pathString + "month" );
992 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 990 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
993 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 991 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
994 month_action->addTo( viewMenu ); 992 month_action->addTo( viewMenu );
995 connect( month_action, SIGNAL( activated() ), 993 connect( month_action, SIGNAL( activated() ),
996 mView->viewManager(), SLOT( showMonthView() ) ); 994 mView->viewManager(), SLOT( showMonthView() ) );
997 995
998 icon = loadPixmap( pathString + "list" ); 996 icon = loadPixmap( pathString + "list" );
999 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 997 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1000 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 998 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
1001 showlist_action->addTo( viewMenu ); 999 showlist_action->addTo( viewMenu );
1002 connect( showlist_action, SIGNAL( activated() ), 1000 connect( showlist_action, SIGNAL( activated() ),
1003 mView->viewManager(), SLOT( showListView() ) ); 1001 mView->viewManager(), SLOT( showListView() ) );
1004 1002
1005 icon = loadPixmap( pathString + "todo" ); 1003 icon = loadPixmap( pathString + "todo" );
1006 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1004 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1007 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1005 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1008 todoview_action->addTo( viewMenu ); 1006 todoview_action->addTo( viewMenu );
1009 connect( todoview_action, SIGNAL( activated() ), 1007 connect( todoview_action, SIGNAL( activated() ),
1010 mView->viewManager(), SLOT( showTodoView() ) ); 1008 mView->viewManager(), SLOT( showTodoView() ) );
1011 1009
1012 1010
1013 1011
1014#if 0 1012#if 0
1015 action = new QAction( "view_timespan", "Time Span", 0, this ); 1013 action = new QAction( "view_timespan", "Time Span", 0, this );
1016 action->addTo( viewMenu ); 1014 action->addTo( viewMenu );
1017 connect( action, SIGNAL( activated() ), 1015 connect( action, SIGNAL( activated() ),
1018 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1016 mView->viewManager(), SLOT( showTimeSpanView() ) );
1019#endif 1017#endif
1020 1018
1021 1019
1022 1020
1023 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1021 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
1024 this ); 1022 this );
1025 action->addTo( actionMenu ); 1023 action->addTo( actionMenu );
1026 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1024 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1027 1025
1028 1026
1029 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1027 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1030 1028
1031 1029
1032 1030
1033 actionMenu->insertSeparator(); 1031 actionMenu->insertSeparator();
1034 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1032 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1035 this ); 1033 this );
1036 action->addTo( actionMenu ); 1034 action->addTo( actionMenu );
1037 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1035 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1038 1036
1039 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1037 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1040 this ); 1038 this );
1041 action->addTo( actionMenu ); 1039 action->addTo( actionMenu );
1042 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1040 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1043 1041
1044 1042
1045 actionMenu->insertSeparator(); 1043 actionMenu->insertSeparator();
1046 icon = loadPixmap( pathString + "configure" ); 1044 icon = loadPixmap( pathString + "configure" );
1047 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1045 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1048 action->addTo( actionMenu ); 1046 action->addTo( actionMenu );
1049 connect( action, SIGNAL( activated() ), 1047 connect( action, SIGNAL( activated() ),
1050 mView, SLOT( edit_options() ) ); 1048 mView, SLOT( edit_options() ) );
1051 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1049 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1052 action->addTo( actionMenu ); 1050 action->addTo( actionMenu );
1053 connect( action, SIGNAL( activated() ), 1051 connect( action, SIGNAL( activated() ),
1054 this, SLOT( calHint() ) ); 1052 this, SLOT( calHint() ) );
1055 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1053 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1056 action->addTo( actionMenu ); 1054 action->addTo( actionMenu );
1057 connect( action, SIGNAL( activated() ), 1055 connect( action, SIGNAL( activated() ),
1058 mView, SLOT( edit_global_options() ) ); 1056 mView, SLOT( edit_global_options() ) );
1059 if ( KOPrefs::instance()->mShowFullMenu ) { 1057 if ( KOPrefs::instance()->mShowFullMenu ) {
1060 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1058 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1061 1059
1062 } 1060 }
1063 // actionMenu->insertSeparator(); 1061 // actionMenu->insertSeparator();
1064 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1062 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1065 this ); 1063 this );
1066 action->addTo( importMenu_X ); 1064 action->addTo( importMenu_X );
1067 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1065 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1068 action = new QAction( "import_quick", i18n("Import last file"), 0, 1066 action = new QAction( "import_quick", i18n("Import last file"), 0,
1069 this ); 1067 this );
1070 action->addTo( importMenu_X ); 1068 action->addTo( importMenu_X );
1071 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1069 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1072 importMenu_X->insertSeparator(); 1070 importMenu_X->insertSeparator();
1073 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1071 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1074 this ); 1072 this );
1075 action->addTo( importMenu_X ); 1073 action->addTo( importMenu_X );
1076 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1074 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1077 //#ifndef DESKTOP_VERSION 1075 //#ifndef DESKTOP_VERSION
1078 importMenu_X->insertSeparator(); 1076 importMenu_X->insertSeparator();
1079 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1077 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1080 this ); 1078 this );
1081 action->addTo( importMenu_X ); 1079 action->addTo( importMenu_X );
1082 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1080 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1083 //#else 1081 //#else
1084#ifdef _OL_IMPORT_ 1082#ifdef _OL_IMPORT_
1085 importMenu_X->insertSeparator(); 1083 importMenu_X->insertSeparator();
1086 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1084 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1087 this ); 1085 this );
1088 action->addTo( importMenu_X ); 1086 action->addTo( importMenu_X );
1089 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1087 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1090#endif 1088#endif
1091 //#endif 1089 //#endif
1092 1090
1093 //importMenu->insertSeparator(); 1091 //importMenu->insertSeparator();
1094#if 0 1092#if 0
1095 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1093 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1096 this ); 1094 this );
1097 action->addTo( importMenu ); 1095 action->addTo( importMenu );
1098 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1096 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1099#endif 1097#endif
1100 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1098 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1101 this ); 1099 this );
1102 action->addTo( importMenu ); 1100 action->addTo( importMenu );
1103 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1101 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1104 importMenu->insertSeparator(); 1102 importMenu->insertSeparator();
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index d648f14..e2de3ba 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,174 +1,173 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#include <kpopupmenu.h>
14#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
16#endif 17#endif
17class QAction; 18class QAction;
18class CalendarView; 19class CalendarView;
19class KSyncProfile; 20class KSyncProfile;
20#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
21 22
22#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar;
27 26
28 27
29namespace KCal { 28namespace KCal {
30class CalendarLocal; 29class CalendarLocal;
31} 30}
32 31
33using namespace KCal; 32using namespace KCal;
34 33
35class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
36{ 35{
37 Q_OBJECT 36 Q_OBJECT
38 public: 37 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0 ); 38 MainWindow( QWidget *parent = 0, const char *name = 0 );
40 ~MainWindow(); 39 ~MainWindow();
41 bool beamReceiveEnabled(); 40 bool beamReceiveEnabled();
42 static QString defaultFileName(); 41 static QString defaultFileName();
43 static QString syncFileName(); 42 static QString syncFileName();
44 static QString resourcePath(); 43 static QString resourcePath();
45 public slots: 44 public slots:
46 void setUsesBigPixmaps ( bool ); 45 void setUsesBigPixmaps ( bool );
47 void setCaption ( const QString & ); 46 void setCaption ( const QString & );
48 void updateWeekNum(const KCal::DateList &); 47 void updateWeekNum(const KCal::DateList &);
49 void updateWeek(QDate); 48 void updateWeek(QDate);
50 void updateFilterToolbar(); 49 void updateFilterToolbar();
51 virtual void showMaximized (); 50 virtual void showMaximized ();
52 void configureAgenda( int ); 51 void configureAgenda( int );
53 void recieve( const QCString& msg, const QByteArray& data ); 52 void recieve( const QCString& msg, const QByteArray& data );
54 protected slots: 53 protected slots:
55 void calHint(); 54 void calHint();
56 void startMultiSync(); 55 void startMultiSync();
57 void setCaptionToDates(); 56 void setCaptionToDates();
58 void weekAction(); 57 void weekAction();
59 void about(); 58 void about();
60 void licence(); 59 void licence();
61 void faq(); 60 void faq();
62 void usertrans(); 61 void usertrans();
63 void features(); 62 void features();
64 void synchowto(); 63 void synchowto();
65 void storagehowto(); 64 void storagehowto();
66 void timetrackinghowto(); 65 void timetrackinghowto();
67 void kdesynchowto(); 66 void kdesynchowto();
68 void multisynchowto(); 67 void multisynchowto();
69 void whatsNew(); 68 void whatsNew();
70 void keyBindings(); 69 void keyBindings();
71 void aboutAutoSaving();; 70 void aboutAutoSaving();;
72 void aboutKnownBugs(); 71 void aboutKnownBugs();
73 72
74 void processIncidenceSelection( Incidence * ); 73 void processIncidenceSelection( Incidence * );
75 74
76 void importQtopia(); 75 void importQtopia();
77 void importBday(); 76 void importBday();
78 void importOL(); 77 void importOL();
79 void importIcal(); 78 void importIcal();
80 void importFile( QString, bool ); 79 void importFile( QString, bool );
81 void quickImportIcal(); 80 void quickImportIcal();
82 81
83 void slotModifiedChanged( bool ); 82 void slotModifiedChanged( bool );
84 83
85 void save(); 84 void save();
86 void backupAllFiles(); 85 void backupAllFiles();
87 void saveStopTimer(); 86 void saveStopTimer();
88 void configureToolBar( int ); 87 void configureToolBar( int );
89 void printSel(); 88 void printSel();
90 void printCal(); 89 void printCal();
91 void printListView(); 90 void printListView();
92 void saveCalendar(); 91 void saveCalendar();
93 void loadCalendar(); 92 void loadCalendar();
94 void exportVCalendar(); 93 void exportVCalendar();
95 void fillFilterMenu(); 94 void fillFilterMenu();
96 void fillFilterMenuTB(); 95 void fillFilterMenuTB();
97 void selectFilter( int ); 96 void selectFilter( int );
98 void fillFilterMenuPopup(); 97 void fillFilterMenuPopup();
99 void selectFilterPopup( int ); 98 void selectFilterPopup( int );
100 void exportToPhone( int ); 99 void exportToPhone( int );
101 void toggleBeamReceive(); 100 void toggleBeamReceive();
102 void disableBR(bool); 101 void disableBR(bool);
103 signals: 102 signals:
104 void selectWeek ( int ); 103 void selectWeek ( int );
105 private slots: 104 private slots:
106 void showConfigureAgenda(); 105 void showConfigureAgenda();
107 void getFile( bool ); 106 void getFile( bool );
108 void syncFileRequest(); 107 void syncFileRequest();
109 108
110 protected: 109 protected:
111 void hideEvent ( QHideEvent * ); 110 void hideEvent ( QHideEvent * );
112 QString sentSyncFile(); 111 QString sentSyncFile();
113 void displayText( QString, QString); 112 void displayText( QString, QString);
114 void enableIncidenceActions( bool ); 113 void enableIncidenceActions( bool );
115 114
116 private: 115 private:
117 bool mBRdisabled; 116 bool mBRdisabled;
118#ifndef DESKTOP_VERSION 117#ifndef DESKTOP_VERSION
119 QCopChannel* infrared; 118 QCopChannel* infrared;
120#endif 119#endif
121 QAction* brAction; 120 QAction* brAction;
122 KSyncManager* mSyncManager; 121 KSyncManager* mSyncManager;
123 bool mClosed; 122 bool mClosed;
124 void saveOnClose(); 123 void saveOnClose();
125 bool mFlagKeyPressed; 124 bool mFlagKeyPressed;
126 bool mBlockAtStartup; 125 bool mBlockAtStartup;
127 QPEToolBar *iconToolBar; 126 QPEToolBar *iconToolBar;
128 QPEToolBar *viewToolBar; 127 QPEToolBar *viewToolBar;
129 QPEToolBar *navigatorToolBar; 128 QPEToolBar *navigatorToolBar;
130 QPEToolBar *filterToolBar; 129 QPEToolBar *filterToolBar;
131 QMenuBar *filterMenubar; 130 KMenuBar *filterMenubar;
132 QPopupMenu * filterPopupMenu; 131 QPopupMenu * filterPopupMenu;
133 QPopupMenu * mCurrentItemMenu; 132 QPopupMenu * mCurrentItemMenu;
134 void initActions(); 133 void initActions();
135 void setDefaultPreferences(); 134 void setDefaultPreferences();
136 void resizeEvent( QResizeEvent* e); 135 void resizeEvent( QResizeEvent* e);
137 void keyPressEvent ( QKeyEvent * ) ; 136 void keyPressEvent ( QKeyEvent * ) ;
138 void keyReleaseEvent ( QKeyEvent * ) ; 137 void keyReleaseEvent ( QKeyEvent * ) ;
139 QPopupMenu *configureToolBarMenu; 138 QPopupMenu *configureToolBarMenu;
140 QPopupMenu *selectFilterMenu; 139 QPopupMenu *selectFilterMenu;
141 QPopupMenu *selectFilterMenuTB; 140 QPopupMenu *selectFilterMenuTB;
142 QPopupMenu *configureAgendaMenu, *syncMenu; 141 QPopupMenu *configureAgendaMenu, *syncMenu;
143 CalendarLocal *mCalendar; 142 CalendarLocal *mCalendar;
144 CalendarView *mView; 143 CalendarView *mView;
145 QAction *mNewSubTodoAction; 144 QAction *mNewSubTodoAction;
146 QAction *mWeekAction; 145 QAction *mWeekAction;
147 QFont mWeekFont; 146 QFont mWeekFont;
148 QPixmap mWeekPixmap; 147 QPixmap mWeekPixmap;
149 QColor mWeekBgColor; 148 QColor mWeekBgColor;
150 149
151 QAction *mShowAction; 150 QAction *mShowAction;
152 QAction *mEditAction; 151 QAction *mEditAction;
153 QAction *mDeleteAction; 152 QAction *mDeleteAction;
154 QAction *mCloneAction; 153 QAction *mCloneAction;
155 QAction *mMoveAction; 154 QAction *mMoveAction;
156 QAction *mBeamAction; 155 QAction *mBeamAction;
157 QAction *mCancelAction; 156 QAction *mCancelAction;
158 QAction *mPrintSelAction; 157 QAction *mPrintSelAction;
159 158
160 QAction *mToggleNav; 159 QAction *mToggleNav;
161 QAction *mToggleFilter; 160 QAction *mToggleFilter;
162 QAction *mToggleAllday; 161 QAction *mToggleAllday;
163 QAction *actionFilterMenuTB; 162 QAction *actionFilterMenuTB;
164 163
165 void closeEvent( QCloseEvent* ce ); 164 void closeEvent( QCloseEvent* ce );
166 QTimer mSaveTimer; 165 QTimer mSaveTimer;
167 //bool mBlockSaveFlag; 166 //bool mBlockSaveFlag;
168 bool mCalendarModifiedFlag; 167 bool mCalendarModifiedFlag;
169 QPixmap loadPixmap( QString ); 168 QPixmap loadPixmap( QString );
170 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; 169 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix;
171}; 170};
172 171
173 172
174#endif 173#endif
diff --git a/microkde/kdeui/kbuttonbox.cpp b/microkde/kdeui/kbuttonbox.cpp
index 16206e8..83d622a 100644
--- a/microkde/kdeui/kbuttonbox.cpp
+++ b/microkde/kdeui/kbuttonbox.cpp
@@ -1,300 +1,300 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com) 2 Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20/* 20/*
21 * KButtonBox class 21 * KButtonBox class
22 * 22 *
23 * A container widget for buttons. Uses Qt layout control to place the 23 * A container widget for buttons. Uses Qt layout control to place the
24 * buttons, can handle both vertical and horizontal button placement. 24 * buttons, can handle both vertical and horizontal button placement.
25* 25*
26 * HISTORY 26 * HISTORY
27 * 27 *
28 * 03/08/2000 Mario Weilguni <mweilguni@kde.org> 28 * 03/08/2000 Mario Weilguni <mweilguni@kde.org>
29 * Removed all those long outdated Motif stuff 29 * Removed all those long outdated Motif stuff
30 * Improved and clarified some if conditions (easier to understand) 30 * Improved and clarified some if conditions (easier to understand)
31 * 31 *
32 * 11/13/98 Reginald Stadlbauer <reggie@kde.org> 32 * 11/13/98 Reginald Stadlbauer <reggie@kde.org>
33 * Now in Qt 1.4x motif default buttons have no extra width/height anymore. 33 * Now in Qt 1.4x motif default buttons have no extra width/height anymore.
34 * So the KButtonBox doesn't add this width/height to default buttons anymore 34 * So the KButtonBox doesn't add this width/height to default buttons anymore
35 * which makes the buttons look better. 35 * which makes the buttons look better.
36 * 36 *
37 * 01/17/98 Mario Weilguni <mweilguni@sime.com> 37 * 01/17/98 Mario Weilguni <mweilguni@sime.com>
38 * Fixed a bug in sizeHint() 38 * Fixed a bug in sizeHint()
39 * Improved the handling of Motif default buttons 39 * Improved the handling of Motif default buttons
40 * 40 *
41 * 01/09/98 Mario Weilguni <mweilguni@sime.com> 41 * 01/09/98 Mario Weilguni <mweilguni@sime.com>
42 * The last button was to far right away from the right/bottom border. 42 * The last button was to far right away from the right/bottom border.
43 * Fixed this. Removed old code. Buttons get now a minimum width. 43 * Fixed this. Removed old code. Buttons get now a minimum width.
44 * Programmer may now override minimum width and height of a button. 44 * Programmer may now override minimum width and height of a button.
45 * 45 *
46 */ 46 */
47 47
48//US #include "kbuttonbox.moc" 48//US #include "kbuttonbox.moc"
49 49
50#include <kbuttonbox.h> 50#include <kbuttonbox.h>
51#include <qpushbutton.h> 51#include <qpushbutton.h>
52#include <qptrlist.h> 52#include <qptrlist.h>
53#include <assert.h> 53#include <assert.h>
54 54
55#define minButtonWidth 50 55#define minButtonWidth 50
56 56
57class KButtonBox::Item { 57class KButtonBox::Item {
58public: 58public:
59 QPushButton *button; 59 QPushButton *button;
60 bool noexpand; 60 bool noexpand;
61 unsigned short stretch; 61 unsigned short stretch;
62 unsigned short actual_size; 62 unsigned short actual_size;
63}; 63};
64 64
65template class QPtrList<KButtonBox::Item>; 65template class QPtrList<KButtonBox::Item>;
66 66
67class KButtonBoxPrivate { 67class KButtonBoxPrivate {
68public: 68public:
69 unsigned short border; 69 unsigned short border;
70 unsigned short autoborder; 70 unsigned short autoborder;
71 unsigned short orientation; 71 unsigned short orientation;
72 bool activated; 72 bool activated;
73 QPtrList<KButtonBox::Item> buttons; 73 QPtrList<KButtonBox::Item> buttons;
74}; 74};
75 75
76KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation, 76KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation,
77 int border, int autoborder) 77 int border, int autoborder)
78 : QWidget(parent) 78 : QWidget(parent)
79{ 79{
80 data = new KButtonBoxPrivate; 80 data = new KButtonBoxPrivate;
81 assert(data != 0); 81 assert(data != 0);
82 82
83 data->orientation = _orientation; 83 data->orientation = _orientation;
84 data->border = border; 84 data->border = border;
85 data->autoborder = autoborder < 0 ? border : autoborder; 85 data->autoborder = autoborder < 0 ? border : autoborder;
86 data->buttons.setAutoDelete(TRUE); 86 data->buttons.setAutoDelete(TRUE);
87} 87}
88 88
89KButtonBox::~KButtonBox() { 89KButtonBox::~KButtonBox() {
90 delete data; 90 delete data;
91} 91}
92 92
93QPushButton *KButtonBox::addButton(const QString& text, bool noexpand) { 93QPushButton *KButtonBox::addButton(const QString& text, bool noexpand) {
94 Item *item = new Item; 94 Item *item = new Item;
95 95
96 item->button = new QPushButton(text, this); 96 item->button = new QPushButton(text, this);
97 item->noexpand = noexpand; 97 item->noexpand = noexpand;
98 data->buttons.append(item); 98 data->buttons.append(item);
99 item->button->adjustSize(); 99 item->button->adjustSize();
100 100
101 return item->button; 101 return item->button;
102} 102}
103 103
104 QPushButton * 104 QPushButton *
105KButtonBox::addButton( 105KButtonBox::addButton(
106 const QString & text, 106 const QString & text,
107 QObject * receiver, 107 QObject * receiver,
108 const char * slot, 108 const char * slot,
109 bool noexpand 109 bool noexpand
110) 110)
111{ 111{
112 QPushButton * pb = addButton(text, noexpand); 112 QPushButton * pb = addButton(text, noexpand);
113 113
114 if ((0 != receiver) && (0 != slot)) 114 if ((0 != receiver) && (0 != slot))
115 QObject::connect(pb, SIGNAL(clicked()), receiver, slot); 115 QObject::connect(pb, SIGNAL(clicked()), receiver, slot);
116 116
117 return pb; 117 return pb;
118} 118}
119 119
120 120
121void KButtonBox::addStretch(int scale) { 121void KButtonBox::addStretch(int scale) {
122 if(scale > 0) { 122 if(scale > 0) {
123 Item *item = new Item; 123 Item *item = new Item;
124 item->button = 0; 124 item->button = 0;
125 item->noexpand = FALSE; 125 item->noexpand = FALSE;
126 item->stretch = scale; 126 item->stretch = scale;
127 data->buttons.append(item); 127 data->buttons.append(item);
128 } 128 }
129} 129}
130 130
131void KButtonBox::layout() { 131void KButtonBox::layout() {
132 // resize all buttons 132 // resize all buttons
133 QSize bs = bestButtonSize(); 133 QSize bs = bestButtonSize();
134 134
135 for(unsigned int i = 0; i < data->buttons.count(); i++) { 135 for(unsigned int i = 0; i < data->buttons.count(); i++) {
136 Item *item = data->buttons.at(i); 136 Item *item = data->buttons.at(i);
137 QPushButton *b = item->button; 137 QPushButton *b = item->button;
138 if(b != 0) { 138 if(b != 0) {
139 if(item->noexpand) 139 if(item->noexpand)
140 b->setFixedSize(buttonSizeHint(b)); 140 b->setFixedSize(buttonSizeHint(b));
141 else 141 else
142 b->setFixedSize(bs); 142 b->setFixedSize(bs);
143 } 143 }
144 } 144 }
145 145
146 setMinimumSize(sizeHint()); 146 setMinimumSize(sizeHint());
147} 147}
148 148
149void KButtonBox::placeButtons() { 149void KButtonBox::placeButtons() {
150 unsigned int i; 150 unsigned int i;
151 151
152 if(data->orientation == Horizontal) { 152 if(data->orientation == Horizontal) {
153 // calculate free size and stretches 153 // calculate free size and stretches
154 int fs = width() - 2 * data->border; 154 int fs = width() - 2 * data->border;
155 int stretch = 0; 155 int stretch = 0;
156 for(i = 0; i < data->buttons.count(); i++) { 156 for(i = 0; i < data->buttons.count(); i++) {
157 Item *item = data->buttons.at(i); 157 Item *item = data->buttons.at(i);
158 if(item->button != 0) { 158 if(item->button != 0) {
159 fs -= item->button->width(); 159 fs -= item->button->width();
160 160
161 // Last button? 161 // Last button?
162 if(i != data->buttons.count() - 1) 162 if(i != data->buttons.count() - 1)
163 fs -= data->autoborder; 163 fs -= data->autoborder;
164 } else 164 } else
165 stretch +=item->stretch; 165 stretch +=item->stretch;
166 } 166 }
167 167
168 // distribute buttons 168 // distribute buttons
169 int x_pos = data->border; 169 int x_pos = data->border;
170 for(i = 0; i < data->buttons.count(); i++) { 170 for(i = 0; i < data->buttons.count(); i++) {
171 Item *item = data->buttons.at(i); 171 Item *item = data->buttons.at(i);
172 if(item->button != 0) { 172 if(item->button != 0) {
173 QPushButton *b = item->button; 173 QPushButton *b = item->button;
174 b->move(x_pos, (height() - b->height()) / 2); 174 b->move(x_pos, (height() - b->height()) / 2);
175 175
176 x_pos += b->width() + data->autoborder; 176 x_pos += b->width() + data->autoborder;
177 } else 177 } else
178 x_pos += (int)((((double)fs) * item->stretch) / stretch); 178 x_pos += (int)((((double)fs) * item->stretch) / stretch);
179 } 179 }
180 } else { // VERTICAL 180 } else { // VERTICAL
181 // calcualte free size and stretches 181 // calcualte free size and stretches
182 int fs = height() - 2 * data->border; 182 int fs = height() - 2 * data->border;
183 int stretch = 0; 183 int stretch = 0;
184 for(i = 0; i < data->buttons.count(); i++) { 184 for(i = 0; i < data->buttons.count(); i++) {
185 Item *item = data->buttons.at(i); 185 Item *item = data->buttons.at(i);
186 if(item->button != 0) 186 if(item->button != 0)
187 fs -= item->button->height() + data->autoborder; 187 fs -= item->button->height() + data->autoborder;
188 else 188 else
189 stretch +=item->stretch; 189 stretch +=item->stretch;
190 } 190 }
191 191
192 // distribute buttons 192 // distribute buttons
193 int y_pos = data->border; 193 int y_pos = data->border;
194 for(i = 0; i < data->buttons.count(); i++) { 194 for(i = 0; i < data->buttons.count(); i++) {
195 Item *item = data->buttons.at(i); 195 Item *item = data->buttons.at(i);
196 if(item->button != 0) { 196 if(item->button != 0) {
197 QPushButton *b = item->button; 197 QPushButton *b = item->button;
198 b->move((width() - b->width()) / 2, y_pos); 198 b->move((width() - b->width()) / 2, y_pos);
199 199
200 y_pos += b->height() + data->autoborder; 200 y_pos += b->height() + data->autoborder;
201 } else 201 } else
202 y_pos += (int)((((double)fs) * item->stretch) / stretch); 202 y_pos += (int)((((double)fs) * item->stretch) / stretch);
203 } 203 }
204 } 204 }
205} 205}
206 206
207void KButtonBox::resizeEvent(QResizeEvent *) { 207void KButtonBox::resizeEvent(QResizeEvent *) {
208 placeButtons(); 208 placeButtons();
209} 209}
210 210
211QSize KButtonBox::bestButtonSize() const { 211QSize KButtonBox::bestButtonSize() const {
212 QSize s(0, 0); 212 QSize s(0, 0);
213 unsigned int i; 213 unsigned int i;
214 214
215 // calculate optimal size 215 // calculate optimal size
216 for(i = 0; i < data->buttons.count(); i++) { 216 for(i = 0; i < data->buttons.count(); i++) {
217 KButtonBox *that = (KButtonBox*)this; // to remove the const ;( 217 KButtonBox *that = (KButtonBox*)this; // to remove the const ;(
218 Item *item = that->data->buttons.at(i); 218 Item *item = that->data->buttons.at(i);
219 QPushButton *b = item->button; 219 QPushButton *b = item->button;
220 220
221 if(b != 0 && !item->noexpand) { 221 if(b != 0 && !item->noexpand) {
222 QSize bs = buttonSizeHint(b); 222 QSize bs = buttonSizeHint(b);
223 223
224 if(bs.width() > s.width()) 224 if(bs.width() > s.width())
225 s.setWidth(bs.width()); 225 s.setWidth(bs.width());
226 if(bs.height() > s.height()) 226 if(bs.height() > s.height())
227 s.setHeight(bs.height()); 227 s.setHeight(bs.height());
228 } 228 }
229 } 229 }
230 230
231 return s; 231 return s;
232} 232}
233 233
234QSize KButtonBox::sizeHint() const { 234QSize KButtonBox::sizeHint() const {
235 unsigned int i, dw; 235 unsigned int i, dw;
236 236
237 if(data->buttons.count() == 0) 237 if(data->buttons.count() == 0)
238 return QSize(0, 0); 238 return QSize(0, 0);
239 else { 239 else {
240 dw = 2 * data->border; 240 dw = 2 * data->border;
241 241
242 QSize bs = bestButtonSize(); 242 QSize bs = bestButtonSize();
243 for(i = 0; i < data->buttons.count(); i++) { 243 for(i = 0; i < data->buttons.count(); i++) {
244 KButtonBox *that = (KButtonBox*)this; 244 KButtonBox *that = (KButtonBox*)this;
245 Item *item = that->data->buttons.at(i); 245 Item *item = that->data->buttons.at(i);
246 QPushButton *b = item->button; 246 QPushButton *b = item->button;
247 if(b != 0) { 247 if(b != 0) {
248 QSize s; 248 QSize s;
249 if(item->noexpand) 249 if(item->noexpand)
250 s = that->buttonSizeHint(b); 250 s = that->buttonSizeHint(b);
251 else 251 else
252 s = bs; 252 s = bs;
253 253
254 if(data->orientation == Horizontal) 254 if(data->orientation == Horizontal)
255 dw += s.width(); 255 dw += s.width();
256 else 256 else
257 dw += s.height(); 257 dw += s.height();
258 258
259 if( i != data->buttons.count() - 1 ) 259 if( i != data->buttons.count() - 1 )
260 dw += data->autoborder; 260 dw += data->autoborder;
261 } 261 }
262 } 262 }
263 263
264 if(data->orientation == Horizontal) 264 if(data->orientation == Horizontal)
265 return QSize(dw, bs.height() + 2 * data->border); 265 return QSize(dw, bs.height() + 2 * data->border);
266 else 266 else
267 return QSize(bs.width() + 2 * data->border, dw); 267 return QSize(bs.width() + 2 * data->border, dw);
268 } 268 }
269} 269}
270 270
271QSizePolicy KButtonBox::sizePolicy() const 271QSizePolicy KButtonBox::sizePolicy() const
272{ 272{
273 return data->orientation == Horizontal? 273 return data->orientation == Horizontal?
274 QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) : 274 QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) :
275 QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ); 275 QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum );
276} 276}
277 277
278/* 278/*
279 * Returns the best size for a button. If a button is less than 279 * Returns the best size for a button. If a button is less than
280 * minButtonWidth pixels wide, return minButtonWidth pixels 280 * minButtonWidth pixels wide, return minButtonWidth pixels
281 * as minimum width 281 * as minimum width
282 */ 282 */
283QSize KButtonBox::buttonSizeHint(QPushButton *b) const { 283QSize KButtonBox::buttonSizeHint(QPushButton *b) const {
284 QSize s = b->sizeHint(); 284 QSize s = b->sizeHint();
285 QSize ms = b->minimumSize(); 285 QSize ms = b->minimumSize();
286 if(s.width() < minButtonWidth) 286 if(s.width() < minButtonWidth)
287 s.setWidth(minButtonWidth); 287 s.setWidth(minButtonWidth);
288 288
289 // allows the programmer to override the settings 289 // allows the programmer to override the settings
290 if(ms.width() > s.width()) 290 if(ms.width() > s.width())
291 s.setWidth(ms.width()); 291 s.setWidth(ms.width());
292 if(ms.height() > s.height()) 292 if(ms.height() > s.height())
293 s.setHeight(ms.height()); 293 s.setHeight(ms.height());
294 294
295 return s; 295 return s;
296} 296}
297 297
298void KButtonBox::virtual_hook( int, void* ) 298void KButtonBox::virtual_hook( int, void* )
299{ /*BASE::virtual_hook( id, data );*/ } 299{ /*BASE::virtual_hook( id, data );*/ }
300 300
diff --git a/microkde/kdeui/kpopupmenu.cpp b/microkde/kdeui/kpopupmenu.cpp
new file mode 100644
index 0000000..96d2a87
--- a/dev/null
+++ b/microkde/kdeui/kpopupmenu.cpp
@@ -0,0 +1,19 @@
1
2#include <kpopupmenu.h>
3#include <qtimer.h>
4
5
6KPopupMenu::KPopupMenu ( QWidget * parent, const char * name )
7 : QPopupMenu ( parent, name ) {;}
8
9
10
11KMenuBar::KMenuBar ( QWidget * parent, const char * name )
12 : QPEMenuBar ( parent, name ) {}
13
14void KMenuBar::focusOutEvent ( QFocusEvent * e)
15{
16 QPEMenuBar::focusOutEvent( e );
17 QTimer::singleShot( 100, this, SIGNAL ( lostFocus() ) );
18
19}
diff --git a/microkde/kdeui/kpopupmenu.h b/microkde/kdeui/kpopupmenu.h
index 1352429..f16ce77 100644
--- a/microkde/kdeui/kpopupmenu.h
+++ b/microkde/kdeui/kpopupmenu.h
@@ -1,14 +1,32 @@
1#ifndef KPOPUPMENU_H 1#ifndef KPOPUPMENU_H
2#define KPOPUPMENU_H 2#define KPOPUPMENU_H
3 3
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#ifdef DESKTOP_VERSION
6#include <qmenubar.h>
7#define QPEMenuBar QMenubar
8#else
9#include <qpe/qpemenubar.h>
10#endif
5 11
6class KPopupMenu : public QPopupMenu 12class KPopupMenu : public QPopupMenu
7{ 13{
14Q_OBJECT
8 public: 15 public:
9 KPopupMenu ( QWidget * parent=0, const char * name=0 ) 16 KPopupMenu ( QWidget * parent=0, const char * name=0 );
10 : QPopupMenu ( parent, name ) {} 17
18};
11 19
20
21class KMenuBar : public QPEMenuBar
22{
23Q_OBJECT
24 public:
25 KMenuBar ( QWidget * parent=0, const char * name=0 );
26 signals:
27 void lostFocus();
28 protected:
29 void focusOutEvent ( QFocusEvent * e);
12}; 30};
13 31
14#endif 32#endif
diff --git a/microkde/microkde.pro b/microkde/microkde.pro
index 44e5f9d..7120bdd 100644
--- a/microkde/microkde.pro
+++ b/microkde/microkde.pro
@@ -1,178 +1,180 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3include( ../variables.pri ) 3include( ../variables.pri )
4#INCLUDEPATH += $(QTDIR)/include . 4#INCLUDEPATH += $(QTDIR)/include .
5#DEPENDPATH += $(QTDIR)/include 5#DEPENDPATH += $(QTDIR)/include
6INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio 6INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio
7#LIBS += -lqtcompat 7#LIBS += -lqtcompat
8 8
9 TARGET = microkde 9 TARGET = microkde
10DESTDIR= ../bin 10DESTDIR= ../bin
11DEFINES += DESKTOP_VERSION KDE_QT_ONLY 11DEFINES += DESKTOP_VERSION KDE_QT_ONLY
12unix : { 12unix : {
13staticlib: { 13staticlib: {
14INCLUDEPATH += ../kabc/plugins 14INCLUDEPATH += ../kabc/plugins
15DEFINES += STATIC_RESOURCES 15DEFINES += STATIC_RESOURCES
16} 16}
17 17
18 18
19OBJECTS_DIR = obj/unix 19OBJECTS_DIR = obj/unix
20MOC_DIR = moc/unix 20MOC_DIR = moc/unix
21} 21}
22win32: { 22win32: {
23DEFINES += _WIN32_ 23DEFINES += _WIN32_
24OBJECTS_DIR = obj/win 24OBJECTS_DIR = obj/win
25MOC_DIR = moc/win 25MOC_DIR = moc/win
26} 26}
27 27
28 28
29 29
30HEADERS = \ 30HEADERS = \
31qlayoutengine_p.h \ 31qlayoutengine_p.h \
32KDGanttMinimizeSplitter.h \ 32KDGanttMinimizeSplitter.h \
33 kapplication.h \ 33 kapplication.h \
34 kaudioplayer.h \ 34 kaudioplayer.h \
35 kcalendarsystem.h \ 35 kcalendarsystem.h \
36 kcalendarsystemgregorian.h \ 36 kcalendarsystemgregorian.h \
37 kcolorbutton.h \ 37 kcolorbutton.h \
38 kcombobox.h \ 38 kcombobox.h \
39 kconfig.h \ 39 kconfig.h \
40 kdatetbl.h \ 40 kdatetbl.h \
41 kdebug.h \ 41 kdebug.h \
42 kdialog.h \ 42 kdialog.h \
43 kdialogbase.h \ 43 kdialogbase.h \
44 keditlistbox.h \ 44 keditlistbox.h \
45 kemailsettings.h \ 45 kemailsettings.h \
46 kfiledialog.h \ 46 kfiledialog.h \
47 kfontdialog.h \ 47 kfontdialog.h \
48 kglobal.h \ 48 kglobal.h \
49 kglobalsettings.h \ 49 kglobalsettings.h \
50 kiconloader.h \ 50 kiconloader.h \
51 klineedit.h \ 51 klineedit.h \
52 klineeditdlg.h \ 52 klineeditdlg.h \
53 kmessagebox.h \ 53 kmessagebox.h \
54 knotifyclient.h \ 54 knotifyclient.h \
55 kprinter.h \ 55 kprinter.h \
56 kprocess.h \ 56 kprocess.h \
57 krestrictedline.h \ 57 krestrictedline.h \
58 krun.h \ 58 krun.h \
59 ksimpleconfig.h \ 59 ksimpleconfig.h \
60 kstaticdeleter.h \ 60 kstaticdeleter.h \
61 ksystemtray.h \ 61 ksystemtray.h \
62 ktempfile.h \ 62 ktempfile.h \
63 ktextedit.h \ 63 ktextedit.h \
64 kunload.h \ 64 kunload.h \
65 kurl.h \ 65 kurl.h \
66 kdeui/kguiitem.h \ 66 kdeui/kguiitem.h \
67 kdeui/kcmodule.h \ 67 kdeui/kcmodule.h \
68 kdeui/kbuttonbox.h \ 68 kdeui/kbuttonbox.h \
69 kdeui/klistbox.h \ 69 kdeui/klistbox.h \
70 kdeui/klistview.h \ 70 kdeui/klistview.h \
71 kdeui/kjanuswidget.h \ 71 kdeui/kjanuswidget.h \
72 kdeui/kseparator.h \ 72 kdeui/kseparator.h \
73 kdeui/knuminput.h \ 73 kdeui/knuminput.h \
74 kdeui/knumvalidator.h \ 74 kdeui/knumvalidator.h \
75 kdeui/ksqueezedtextlabel.h \ 75 kdeui/ksqueezedtextlabel.h \
76 kio/job.h \ 76 kio/job.h \
77 kio/kio/kdirwatch.h \ 77 kio/kio/kdirwatch.h \
78 kio/kio/kdirwatch_p.h \ 78 kio/kio/kdirwatch_p.h \
79 kio/kfile/kurlrequester.h \ 79 kio/kfile/kurlrequester.h \
80 kresources/resource.h \ 80 kresources/resource.h \
81 kresources/factory.h \ 81 kresources/factory.h \
82 kresources/managerimpl.h \ 82 kresources/managerimpl.h \
83 kresources/manager.h \ 83 kresources/manager.h \
84 kresources/selectdialog.h \ 84 kresources/selectdialog.h \
85 kresources/configpage.h \ 85 kresources/configpage.h \
86 kresources/configwidget.h \ 86 kresources/configwidget.h \
87 kresources/configdialog.h \ 87 kresources/configdialog.h \
88 kresources/kcmkresources.h \ 88 kresources/kcmkresources.h \
89 kdecore/kmdcodec.h \ 89 kdecore/kmdcodec.h \
90 kdecore/kconfigbase.h \ 90 kdecore/kconfigbase.h \
91 kdecore/klocale.h \ 91 kdecore/klocale.h \
92 kdecore/kcatalogue.h \ 92 kdecore/kcatalogue.h \
93 kdecore/ksharedptr.h \ 93 kdecore/ksharedptr.h \
94 kdecore/kshell.h \ 94 kdecore/kshell.h \
95 kdecore/kstandarddirs.h \ 95 kdecore/kstandarddirs.h \
96 kdecore/kstringhandler.h \ 96 kdecore/kstringhandler.h \
97 kdecore/kshortcut.h \ 97 kdecore/kshortcut.h \
98 kutils/kcmultidialog.h \ 98 kutils/kcmultidialog.h \
99 kdeui/kxmlguiclient.h \ 99 kdeui/kxmlguiclient.h \
100 kdeui/kstdaction.h \ 100 kdeui/kstdaction.h \
101 kdeui/kmainwindow.h \ 101 kdeui/kmainwindow.h \
102 kdeui/ktoolbar.h \ 102 kdeui/ktoolbar.h \
103 kdeui/ktoolbarbutton.h \ 103 kdeui/ktoolbarbutton.h \
104 kdeui/ktoolbarhandler.h \ 104 kdeui/ktoolbarhandler.h \
105 kdeui/kaction.h \ 105 kdeui/kaction.h \
106 kdeui/kpopupmenu.h \
106 kdeui/kactionclasses.h \ 107 kdeui/kactionclasses.h \
107 kdeui/kactioncollection.h \ 108 kdeui/kactioncollection.h \
108 kdecore/kprefs.h \ 109 kdecore/kprefs.h \
109 kdecore/klibloader.h \ 110 kdecore/klibloader.h \
110 kidmanager.h 111 kidmanager.h
111 112
112 113
113# kdecore/klibloader.h \ 114# kdecore/klibloader.h \
114 115
115 116
116SOURCES = \ 117SOURCES = \
117KDGanttMinimizeSplitter.cpp \ 118KDGanttMinimizeSplitter.cpp \
118 kapplication.cpp \ 119 kapplication.cpp \
119 kcalendarsystem.cpp \ 120 kcalendarsystem.cpp \
120 kcalendarsystemgregorian.cpp \ 121 kcalendarsystemgregorian.cpp \
121 kcolorbutton.cpp \ 122 kcolorbutton.cpp \
122 kconfig.cpp \ 123 kconfig.cpp \
123 kdatetbl.cpp \ 124 kdatetbl.cpp \
124 kdialog.cpp \ 125 kdialog.cpp \
125 kdialogbase.cpp \ 126 kdialogbase.cpp \
126 keditlistbox.cpp \ 127 keditlistbox.cpp \
127 kemailsettings.cpp \ 128 kemailsettings.cpp \
128 kfontdialog.cpp \ 129 kfontdialog.cpp \
129 kfiledialog.cpp \ 130 kfiledialog.cpp \
130 kglobal.cpp \ 131 kglobal.cpp \
131 kglobalsettings.cpp \ 132 kglobalsettings.cpp \
132 kiconloader.cpp \ 133 kiconloader.cpp \
133 kmessagebox.cpp \ 134 kmessagebox.cpp \
134 ktextedit.cpp \ 135 ktextedit.cpp \
135 kprocess.cpp \ 136 kprocess.cpp \
136 krun.cpp \ 137 krun.cpp \
137 ksystemtray.cpp \ 138 ksystemtray.cpp \
138 ktempfile.cpp \ 139 ktempfile.cpp \
139 kurl.cpp \ 140 kurl.cpp \
140 kdecore/kcatalogue.cpp \ 141 kdecore/kcatalogue.cpp \
141 kdecore/klocale.cpp \ 142 kdecore/klocale.cpp \
142 kdecore/kmdcodec.cpp \ 143 kdecore/kmdcodec.cpp \
143 kdecore/kshell.cpp \ 144 kdecore/kshell.cpp \
144 kdecore/kstandarddirs.cpp \ 145 kdecore/kstandarddirs.cpp \
145 kdecore/kstringhandler.cpp \ 146 kdecore/kstringhandler.cpp \
146 kdeui/kbuttonbox.cpp \ 147 kdeui/kbuttonbox.cpp \
147 kdeui/kcmodule.cpp \ 148 kdeui/kcmodule.cpp \
148 kdeui/kguiitem.cpp \ 149 kdeui/kguiitem.cpp \
149 kdeui/kjanuswidget.cpp \ 150 kdeui/kjanuswidget.cpp \
150 kdeui/klistbox.cpp \ 151 kdeui/klistbox.cpp \
151 kdeui/klistview.cpp \ 152 kdeui/klistview.cpp \
152 kdeui/knuminput.cpp \ 153 kdeui/knuminput.cpp \
153 kdeui/knumvalidator.cpp \ 154 kdeui/knumvalidator.cpp \
154 kdeui/kseparator.cpp \ 155 kdeui/kseparator.cpp \
155 kdeui/ksqueezedtextlabel.cpp \ 156 kdeui/ksqueezedtextlabel.cpp \
156 kio/kio/kdirwatch.cpp \ 157 kio/kio/kdirwatch.cpp \
157 kio/kfile/kurlrequester.cpp \ 158 kio/kfile/kurlrequester.cpp \
158 kresources/configpage.cpp \ 159 kresources/configpage.cpp \
159 kresources/configdialog.cpp \ 160 kresources/configdialog.cpp \
160 kresources/configwidget.cpp \ 161 kresources/configwidget.cpp \
161 kresources/factory.cpp \ 162 kresources/factory.cpp \
162 kresources/kcmkresources.cpp \ 163 kresources/kcmkresources.cpp \
163 kresources/managerimpl.cpp \ 164 kresources/managerimpl.cpp \
164 kresources/resource.cpp \ 165 kresources/resource.cpp \
165 kresources/selectdialog.cpp \ 166 kresources/selectdialog.cpp \
166 kutils/kcmultidialog.cpp \ 167 kutils/kcmultidialog.cpp \
167 kdeui/kaction.cpp \ 168 kdeui/kaction.cpp \
169 kdeui/kpopupmenu.cpp \
168 kdeui/kactionclasses.cpp \ 170 kdeui/kactionclasses.cpp \
169 kdeui/kactioncollection.cpp \ 171 kdeui/kactioncollection.cpp \
170 kdeui/kmainwindow.cpp \ 172 kdeui/kmainwindow.cpp \
171 kdeui/ktoolbar.cpp \ 173 kdeui/ktoolbar.cpp \
172 kdeui/ktoolbarbutton.cpp \ 174 kdeui/ktoolbarbutton.cpp \
173 kdeui/ktoolbarhandler.cpp \ 175 kdeui/ktoolbarhandler.cpp \
174 kdeui/kstdaction.cpp \ 176 kdeui/kstdaction.cpp \
175 kdeui/kxmlguiclient.cpp \ 177 kdeui/kxmlguiclient.cpp \
176 kdecore/kprefs.cpp \ 178 kdecore/kprefs.cpp \
177 kdecore/klibloader.cpp \ 179 kdecore/klibloader.cpp \
178 kidmanager.cpp 180 kidmanager.cpp
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro
index 335fcd0..8fe2bd5 100644
--- a/microkde/microkdeE.pro
+++ b/microkde/microkdeE.pro
@@ -1,172 +1,174 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include 3INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include
4 4
5DEPENDPATH += $(QPEDIR)/include 5DEPENDPATH += $(QPEDIR)/include
6LIBS += -lmicroqtcompat -L$(QPEDIR)/lib 6LIBS += -lmicroqtcompat -L$(QPEDIR)/lib
7 7
8DEFINES += KDE_QT_ONLY 8DEFINES += KDE_QT_ONLY
9 9
10 TARGET = microkde 10 TARGET = microkde
11OBJECTS_DIR = obj/$(PLATFORM) 11OBJECTS_DIR = obj/$(PLATFORM)
12MOC_DIR = moc/$(PLATFORM) 12MOC_DIR = moc/$(PLATFORM)
13DESTDIR=$(QPEDIR)/lib 13DESTDIR=$(QPEDIR)/lib
14 14
15 15
16INTERFACES = \ 16INTERFACES = \
17 17
18HEADERS = \ 18HEADERS = \
19qlayoutengine_p.h fncolordialog.h\ 19qlayoutengine_p.h fncolordialog.h\
20KDGanttMinimizeSplitter.h \ 20KDGanttMinimizeSplitter.h \
21 kapplication.h \ 21 kapplication.h \
22 kaudioplayer.h \ 22 kaudioplayer.h \
23 kcalendarsystem.h \ 23 kcalendarsystem.h \
24 kcalendarsystemgregorian.h \ 24 kcalendarsystemgregorian.h \
25 kcolorbutton.h \ 25 kcolorbutton.h \
26 kcolordialog.h \ 26 kcolordialog.h \
27 kcombobox.h \ 27 kcombobox.h \
28 kconfig.h \ 28 kconfig.h \
29 kdatetbl.h \ 29 kdatetbl.h \
30 kdebug.h \ 30 kdebug.h \
31 kdialog.h \ 31 kdialog.h \
32 kdialogbase.h \ 32 kdialogbase.h \
33 keditlistbox.h \ 33 keditlistbox.h \
34 kemailsettings.h \ 34 kemailsettings.h \
35 kfiledialog.h \ 35 kfiledialog.h \
36 kfontdialog.h \ 36 kfontdialog.h \
37 kglobal.h \ 37 kglobal.h \
38 kglobalsettings.h \ 38 kglobalsettings.h \
39 kiconloader.h \ 39 kiconloader.h \
40 klineedit.h \ 40 klineedit.h \
41 klineeditdlg.h \ 41 klineeditdlg.h \
42 kmessagebox.h \ 42 kmessagebox.h \
43 knotifyclient.h \ 43 knotifyclient.h \
44 kprinter.h \ 44 kprinter.h \
45 kprocess.h \ 45 kprocess.h \
46 krestrictedline.h \ 46 krestrictedline.h \
47 krun.h \ 47 krun.h \
48 ksimpleconfig.h \ 48 ksimpleconfig.h \
49 kstaticdeleter.h \ 49 kstaticdeleter.h \
50 ksystemtray.h \ 50 ksystemtray.h \
51 ktempfile.h \ 51 ktempfile.h \
52 ktextedit.h \ 52 ktextedit.h \
53 kunload.h \ 53 kunload.h \
54 kurl.h \ 54 kurl.h \
55 ofileselector_p.h \ 55 ofileselector_p.h \
56 ofontselector.h \ 56 ofontselector.h \
57 kdeui/kguiitem.h \ 57 kdeui/kguiitem.h \
58 kdeui/kaction.h \ 58 kdeui/kaction.h \
59 kdeui/kpopupmenu.h \
59 kdeui/kactionclasses.h \ 60 kdeui/kactionclasses.h \
60 kdeui/kactioncollection.h \ 61 kdeui/kactioncollection.h \
61 kdeui/kcmodule.h \ 62 kdeui/kcmodule.h \
62 kdeui/kstdaction.h \ 63 kdeui/kstdaction.h \
63 kdeui/kbuttonbox.h \ 64 kdeui/kbuttonbox.h \
64 kdeui/klistbox.h \ 65 kdeui/klistbox.h \
65 kdeui/klistview.h \ 66 kdeui/klistview.h \
66 kdeui/kjanuswidget.h \ 67 kdeui/kjanuswidget.h \
67 kdeui/kseparator.h \ 68 kdeui/kseparator.h \
68 kdeui/kmainwindow.h \ 69 kdeui/kmainwindow.h \
69 kdeui/knuminput.h \ 70 kdeui/knuminput.h \
70 kdeui/knumvalidator.h \ 71 kdeui/knumvalidator.h \
71 kdeui/ksqueezedtextlabel.h \ 72 kdeui/ksqueezedtextlabel.h \
72 kdeui/ktoolbar.h \ 73 kdeui/ktoolbar.h \
73 kdeui/ktoolbarbutton.h \ 74 kdeui/ktoolbarbutton.h \
74 kdeui/ktoolbarhandler.h \ 75 kdeui/ktoolbarhandler.h \
75 kdeui/kxmlguiclient.h \ 76 kdeui/kxmlguiclient.h \
76 kio/job.h \ 77 kio/job.h \
77 kio/kio/kdirwatch.h \ 78 kio/kio/kdirwatch.h \
78 kio/kio/kdirwatch_p.h \ 79 kio/kio/kdirwatch_p.h \
79 kio/kfile/kurlrequester.h \ 80 kio/kfile/kurlrequester.h \
80 kresources/resource.h \ 81 kresources/resource.h \
81 kresources/factory.h \ 82 kresources/factory.h \
82 kresources/managerimpl.h \ 83 kresources/managerimpl.h \
83 kresources/manager.h \ 84 kresources/manager.h \
84 kresources/selectdialog.h \ 85 kresources/selectdialog.h \
85 kresources/configpage.h \ 86 kresources/configpage.h \
86 kresources/configwidget.h \ 87 kresources/configwidget.h \
87 kresources/configdialog.h \ 88 kresources/configdialog.h \
88 kresources/kcmkresources.h \ 89 kresources/kcmkresources.h \
89 kdecore/kmdcodec.h \ 90 kdecore/kmdcodec.h \
90 kdecore/kconfigbase.h \ 91 kdecore/kconfigbase.h \
91 kdecore/klocale.h \ 92 kdecore/klocale.h \
92 kdecore/klibloader.h \ 93 kdecore/klibloader.h \
93 kdecore/kcatalogue.h \ 94 kdecore/kcatalogue.h \
94 kdecore/kprefs.h \ 95 kdecore/kprefs.h \
95 kdecore/ksharedptr.h \ 96 kdecore/ksharedptr.h \
96 kdecore/kshell.h \ 97 kdecore/kshell.h \
97 kdecore/kstandarddirs.h \ 98 kdecore/kstandarddirs.h \
98 kdecore/kstringhandler.h \ 99 kdecore/kstringhandler.h \
99 kdecore/kshortcut.h \ 100 kdecore/kshortcut.h \
100 kutils/kcmultidialog.h \ 101 kutils/kcmultidialog.h \
101 kidmanager.h 102 kidmanager.h
102 103
103 104
104 105
105 106
106SOURCES = \ 107SOURCES = \
107KDGanttMinimizeSplitter.cpp fncolordialog.cpp \ 108KDGanttMinimizeSplitter.cpp fncolordialog.cpp \
108 kapplication.cpp \ 109 kapplication.cpp \
109 kcalendarsystem.cpp \ 110 kcalendarsystem.cpp \
110 kcalendarsystemgregorian.cpp \ 111 kcalendarsystemgregorian.cpp \
111 kcolorbutton.cpp \ 112 kcolorbutton.cpp \
112 kcolordialog.cpp \ 113 kcolordialog.cpp \
113 kconfig.cpp \ 114 kconfig.cpp \
114 kdatetbl.cpp \ 115 kdatetbl.cpp \
115 kdialog.cpp \ 116 kdialog.cpp \
116 kdialogbase.cpp \ 117 kdialogbase.cpp \
117 keditlistbox.cpp \ 118 keditlistbox.cpp \
118 kemailsettings.cpp \ 119 kemailsettings.cpp \
119 kfontdialog.cpp \ 120 kfontdialog.cpp \
120 kfiledialog.cpp \ 121 kfiledialog.cpp \
121 kglobal.cpp \ 122 kglobal.cpp \
122 kglobalsettings.cpp \ 123 kglobalsettings.cpp \
123 kiconloader.cpp \ 124 kiconloader.cpp \
124 kmessagebox.cpp \ 125 kmessagebox.cpp \
125 kprocess.cpp \ 126 kprocess.cpp \
126 krun.cpp \ 127 krun.cpp \
127 ksystemtray.cpp \ 128 ksystemtray.cpp \
128 ktempfile.cpp \ 129 ktempfile.cpp \
129 kurl.cpp \ 130 kurl.cpp \
130 ktextedit.cpp \ 131 ktextedit.cpp \
131 ofileselector_p.cpp \ 132 ofileselector_p.cpp \
132 ofontselector.cpp \ 133 ofontselector.cpp \
133 kdecore/kcatalogue.cpp \ 134 kdecore/kcatalogue.cpp \
134 kdecore/klibloader.cpp \ 135 kdecore/klibloader.cpp \
135 kdecore/klocale.cpp \ 136 kdecore/klocale.cpp \
136 kdecore/kmdcodec.cpp \ 137 kdecore/kmdcodec.cpp \
137 kdecore/kprefs.cpp \ 138 kdecore/kprefs.cpp \
138 kdecore/kshell.cpp \ 139 kdecore/kshell.cpp \
139 kdecore/kstandarddirs.cpp \ 140 kdecore/kstandarddirs.cpp \
140 kdecore/kstringhandler.cpp \ 141 kdecore/kstringhandler.cpp \
141 kdeui/kaction.cpp \ 142 kdeui/kaction.cpp \
143 kdeui/kpopupmenu.cpp \
142 kdeui/kactionclasses.cpp \ 144 kdeui/kactionclasses.cpp \
143 kdeui/kactioncollection.cpp \ 145 kdeui/kactioncollection.cpp \
144 kdeui/kbuttonbox.cpp \ 146 kdeui/kbuttonbox.cpp \
145 kdeui/kcmodule.cpp \ 147 kdeui/kcmodule.cpp \
146 kdeui/kguiitem.cpp \ 148 kdeui/kguiitem.cpp \
147 kdeui/kjanuswidget.cpp \ 149 kdeui/kjanuswidget.cpp \
148 kdeui/klistbox.cpp \ 150 kdeui/klistbox.cpp \
149 kdeui/klistview.cpp \ 151 kdeui/klistview.cpp \
150 kdeui/kmainwindow.cpp \ 152 kdeui/kmainwindow.cpp \
151 kdeui/knuminput.cpp \ 153 kdeui/knuminput.cpp \
152 kdeui/knumvalidator.cpp \ 154 kdeui/knumvalidator.cpp \
153 kdeui/kseparator.cpp \ 155 kdeui/kseparator.cpp \
154 kdeui/kstdaction.cpp \ 156 kdeui/kstdaction.cpp \
155 kdeui/ksqueezedtextlabel.cpp \ 157 kdeui/ksqueezedtextlabel.cpp \
156 kdeui/ktoolbar.cpp \ 158 kdeui/ktoolbar.cpp \
157 kdeui/ktoolbarbutton.cpp \ 159 kdeui/ktoolbarbutton.cpp \
158 kdeui/ktoolbarhandler.cpp \ 160 kdeui/ktoolbarhandler.cpp \
159 kdeui/kxmlguiclient.cpp \ 161 kdeui/kxmlguiclient.cpp \
160 kio/kfile/kurlrequester.cpp \ 162 kio/kfile/kurlrequester.cpp \
161 kio/kio/kdirwatch.cpp \ 163 kio/kio/kdirwatch.cpp \
162 kresources/configpage.cpp \ 164 kresources/configpage.cpp \
163 kresources/configdialog.cpp \ 165 kresources/configdialog.cpp \
164 kresources/configwidget.cpp \ 166 kresources/configwidget.cpp \
165 kresources/factory.cpp \ 167 kresources/factory.cpp \
166 kresources/kcmkresources.cpp \ 168 kresources/kcmkresources.cpp \
167 kresources/managerimpl.cpp \ 169 kresources/managerimpl.cpp \
168 kresources/resource.cpp \ 170 kresources/resource.cpp \
169 kresources/selectdialog.cpp \ 171 kresources/selectdialog.cpp \
170 kutils/kcmultidialog.cpp \ 172 kutils/kcmultidialog.cpp \
171 kidmanager.cpp 173 kidmanager.cpp
172 174