-rw-r--r-- | korganizer/mainwindow.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 21d5a35..279955f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -402,49 +402,66 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
402 | infrared = 0; | 402 | infrared = 0; |
403 | #endif | 403 | #endif |
404 | updateFilterToolbar(); | 404 | updateFilterToolbar(); |
405 | updateWeek( mView->startDate() ); | 405 | updateWeek( mView->startDate() ); |
406 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 406 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
407 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 407 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
408 | mBRdisabled = false; | 408 | mBRdisabled = false; |
409 | //toggleBeamReceive(); | 409 | //toggleBeamReceive(); |
410 | 410 | ||
411 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 411 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
412 | } | 412 | } |
413 | MainWindow::~MainWindow() | 413 | MainWindow::~MainWindow() |
414 | { | 414 | { |
415 | //qDebug("MainWindow::~MainWindow() "); | 415 | //qDebug("MainWindow::~MainWindow() "); |
416 | //save toolbar location | 416 | //save toolbar location |
417 | delete mCalendar; | 417 | delete mCalendar; |
418 | delete mSyncManager; | 418 | delete mSyncManager; |
419 | #ifndef DESKTOP_VERSION | 419 | #ifndef DESKTOP_VERSION |
420 | if ( infrared ) | 420 | if ( infrared ) |
421 | delete infrared; | 421 | delete infrared; |
422 | #endif | 422 | #endif |
423 | 423 | ||
424 | 424 | ||
425 | } | 425 | } |
426 | 426 | void MainWindow::slotResetFocus() | |
427 | { | ||
428 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | ||
429 | mFocusLoop = 3; | ||
430 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | ||
431 | } | ||
432 | void MainWindow::slotResetFocusLoop() | ||
433 | { | ||
434 | --mFocusLoop; | ||
435 | QWidget* fw = mView->viewManager()->currentView(); | ||
436 | if ( fw ) { | ||
437 | //qDebug("loop "); | ||
438 | fw->setFocus(); | ||
439 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | ||
440 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | ||
441 | } | ||
442 | |||
443 | } | ||
427 | void MainWindow::disableBR(bool b) | 444 | void MainWindow::disableBR(bool b) |
428 | { | 445 | { |
429 | #ifndef DESKTOP_VERSION | 446 | #ifndef DESKTOP_VERSION |
430 | if ( b ) { | 447 | if ( b ) { |
431 | if ( infrared ) { | 448 | if ( infrared ) { |
432 | toggleBeamReceive(); | 449 | toggleBeamReceive(); |
433 | mBRdisabled = true; | 450 | mBRdisabled = true; |
434 | } | 451 | } |
435 | mBRdisabled = true; | 452 | mBRdisabled = true; |
436 | } else { | 453 | } else { |
437 | if ( mBRdisabled ) { | 454 | if ( mBRdisabled ) { |
438 | mBRdisabled = false; | 455 | mBRdisabled = false; |
439 | //makes no sense,because other cal ap is probably running | 456 | //makes no sense,because other cal ap is probably running |
440 | // toggleBeamReceive(); | 457 | // toggleBeamReceive(); |
441 | } | 458 | } |
442 | } | 459 | } |
443 | #endif | 460 | #endif |
444 | 461 | ||
445 | } | 462 | } |
446 | bool MainWindow::beamReceiveEnabled() | 463 | bool MainWindow::beamReceiveEnabled() |
447 | { | 464 | { |
448 | #ifndef DESKTOP_VERSION | 465 | #ifndef DESKTOP_VERSION |
449 | return ( infrared != 0 ); | 466 | return ( infrared != 0 ); |
450 | #endif | 467 | #endif |
@@ -659,84 +676,88 @@ void MainWindow::initActions() | |||
659 | mCurrentItemMenu = new QPopupMenu ( this ); | 676 | mCurrentItemMenu = new QPopupMenu ( this ); |
660 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); | 677 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); |
661 | QPopupMenu *importMenu = new QPopupMenu( this ); | 678 | QPopupMenu *importMenu = new QPopupMenu( this ); |
662 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 679 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
663 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 680 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
664 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 681 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
665 | selectFilterMenu = new QPopupMenu( this ); | 682 | selectFilterMenu = new QPopupMenu( this ); |
666 | selectFilterMenu->setCheckable( true ); | 683 | selectFilterMenu->setCheckable( true ); |
667 | syncMenu = new QPopupMenu( this ); | 684 | syncMenu = new QPopupMenu( this ); |
668 | configureAgendaMenu = new QPopupMenu( this ); | 685 | configureAgendaMenu = new QPopupMenu( this ); |
669 | configureToolBarMenu = new QPopupMenu( this ); | 686 | configureToolBarMenu = new QPopupMenu( this ); |
670 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 687 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
671 | QIconSet icon; | 688 | QIconSet icon; |
672 | int pixWid = 22, pixHei = 22; | 689 | int pixWid = 22, pixHei = 22; |
673 | QString pathString = ""; | 690 | QString pathString = ""; |
674 | if ( !p->mToolBarMiniIcons ) { | 691 | if ( !p->mToolBarMiniIcons ) { |
675 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 692 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
676 | pathString += "icons16/"; | 693 | pathString += "icons16/"; |
677 | pixWid = 18; pixHei = 16; | 694 | pixWid = 18; pixHei = 16; |
678 | } | 695 | } |
679 | } else { | 696 | } else { |
680 | pathString += "iconsmini/"; | 697 | pathString += "iconsmini/"; |
681 | pixWid = 18; pixHei = 16; | 698 | pixWid = 18; pixHei = 16; |
682 | } | 699 | } |
683 | KMenuBar *menuBar1; | 700 | |
684 | if ( KOPrefs::instance()->mShowFullMenu ) { | 701 | if ( KOPrefs::instance()->mShowFullMenu ) { |
685 | menuBar1 = new KMenuBar( this );//menuBar(); | 702 | menuBar1 = new KMenuBar( this );//menuBar(); |
703 | //setMenuBar( menuBar1 ); | ||
704 | menuBar1->show(); | ||
686 | menuBar1->insertItem( i18n("File"), importMenu ); | 705 | menuBar1->insertItem( i18n("File"), importMenu ); |
687 | menuBar1->insertItem( i18n("View"), viewMenu ); | 706 | menuBar1->insertItem( i18n("View"), viewMenu ); |
688 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); | 707 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); |
689 | menuBar1->insertItem( i18n("Action"), actionMenu ); | 708 | menuBar1->insertItem( i18n("Action"), actionMenu ); |
690 | #ifdef DESKTOP_VERSION | 709 | #ifdef DESKTOP_VERSION |
691 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 710 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
692 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 711 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
693 | #else | 712 | #else |
694 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 713 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
695 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 714 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
696 | #endif | 715 | #endif |
697 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 716 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
698 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 717 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
699 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 718 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
700 | } else { | 719 | } else { |
701 | menuBar1 = new KMenuBar( iconToolBar ); | 720 | menuBar1 = new KMenuBar( iconToolBar ); |
702 | QPopupMenu *menuBar = new QPopupMenu( this ); | 721 | QPopupMenu *menuBar = new QPopupMenu( this ); |
703 | icon = loadPixmap( pathString + "z_menu" ); | 722 | icon = loadPixmap( pathString + "z_menu" ); |
704 | menuBar1->insertItem( icon.pixmap(), menuBar); | 723 | menuBar1->insertItem( icon.pixmap(), menuBar); |
705 | //menuBar1->insertItem( i18n("ME"), menuBar); | 724 | //menuBar1->insertItem( i18n("ME"), menuBar); |
706 | menuBar->insertItem( i18n("File"), importMenu ); | 725 | menuBar->insertItem( i18n("File"), importMenu ); |
707 | menuBar->insertItem( i18n("View"), viewMenu ); | 726 | menuBar->insertItem( i18n("View"), viewMenu ); |
708 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); | 727 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); |
709 | menuBar->insertItem( i18n("Action"), actionMenu ); | 728 | menuBar->insertItem( i18n("Action"), actionMenu ); |
710 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 729 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
711 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 730 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
712 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 731 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
713 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 732 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
714 | menuBar->insertItem( i18n("Help"), helpMenu ); | 733 | menuBar->insertItem( i18n("Help"), helpMenu ); |
715 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 734 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
716 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 735 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
736 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); | ||
717 | } | 737 | } |
718 | connect ( menuBar1, SIGNAL( lostFocus () ), mView, SLOT ( slotResetFocus() ) ); | 738 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
739 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | ||
719 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 740 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
720 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 741 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
721 | 742 | ||
722 | 743 | ||
723 | mWeekBgColor = iconToolBar->backgroundColor(); | 744 | mWeekBgColor = iconToolBar->backgroundColor(); |
724 | mWeekPixmap.resize( pixWid , pixHei ); | 745 | mWeekPixmap.resize( pixWid , pixHei ); |
725 | mWeekPixmap.fill( mWeekBgColor ); | 746 | mWeekPixmap.fill( mWeekBgColor ); |
726 | icon = mWeekPixmap; | 747 | icon = mWeekPixmap; |
727 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 748 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
728 | if ( p-> mShowIconWeekNum ) | 749 | if ( p-> mShowIconWeekNum ) |
729 | mWeekAction->addTo( iconToolBar ); | 750 | mWeekAction->addTo( iconToolBar ); |
730 | mWeekFont = font(); | 751 | mWeekFont = font(); |
731 | 752 | ||
732 | int fontPoint = mWeekFont.pointSize(); | 753 | int fontPoint = mWeekFont.pointSize(); |
733 | QFontMetrics f( mWeekFont ); | 754 | QFontMetrics f( mWeekFont ); |
734 | int fontWid = f.width( "30" ); | 755 | int fontWid = f.width( "30" ); |
735 | while ( fontWid > pixWid ) { | 756 | while ( fontWid > pixWid ) { |
736 | --fontPoint; | 757 | --fontPoint; |
737 | mWeekFont.setPointSize( fontPoint ); | 758 | mWeekFont.setPointSize( fontPoint ); |
738 | QFontMetrics f( mWeekFont ); | 759 | QFontMetrics f( mWeekFont ); |
739 | fontWid = f.width( "30" ); | 760 | fontWid = f.width( "30" ); |
740 | //qDebug("dec-- "); | 761 | //qDebug("dec-- "); |
741 | } | 762 | } |
742 | 763 | ||