summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp27
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
@@ -378,97 +378,114 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
378 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 378 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
379 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 379 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
380 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 380 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
381 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 381 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
382 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 382 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
383 mSyncManager->setDefaultFileName( sentSyncFile()); 383 mSyncManager->setDefaultFileName( sentSyncFile());
384 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 384 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
385 mSyncManager->fillSyncMenu(); 385 mSyncManager->fillSyncMenu();
386 386
387 387
388 388
389 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 389 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
390 if ( showWarning ) { 390 if ( showWarning ) {
391 KMessageBox::information( this, 391 KMessageBox::information( this,
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"); 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");
393 qApp->processEvents(); 393 qApp->processEvents();
394 mView->dialogManager()->showSyncOptions(); 394 mView->dialogManager()->showSyncOptions();
395 } 395 }
396 396
397 //US listen for result adressed from Ka/Pi 397 //US listen for result adressed from Ka/Pi
398#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
399 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 & )));
400#endif 400#endif
401#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
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}
413MainWindow::~MainWindow() 413MainWindow::~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 426void 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}
432void 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}
427void MainWindow::disableBR(bool b) 444void 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}
446bool MainWindow::beamReceiveEnabled() 463bool MainWindow::beamReceiveEnabled()
447{ 464{
448#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
449 return ( infrared != 0 ); 466 return ( infrared != 0 );
450#endif 467#endif
451 return false; 468 return false;
452} 469}
453 470
454void MainWindow::toggleBeamReceive() 471void MainWindow::toggleBeamReceive()
455{ 472{
456 if ( mBRdisabled ) 473 if ( mBRdisabled )
457 return; 474 return;
458#ifndef DESKTOP_VERSION 475#ifndef DESKTOP_VERSION
459 if ( infrared ) { 476 if ( infrared ) {
460 qDebug("KO: Disable BeamReceive "); 477 qDebug("KO: Disable BeamReceive ");
461 delete infrared; 478 delete infrared;
462 infrared = 0; 479 infrared = 0;
463 brAction->setOn(false); 480 brAction->setOn(false);
464 return; 481 return;
465 } 482 }
466 qDebug("KO: Enable BeamReceive "); 483 qDebug("KO: Enable BeamReceive ");
467 brAction->setOn(true); 484 brAction->setOn(true);
468 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 485 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
469 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 486 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
470#endif 487#endif
471} 488}
472void MainWindow::showMaximized () 489void MainWindow::showMaximized ()
473{ 490{
474#ifndef DESKTOP_VERSION 491#ifndef DESKTOP_VERSION
@@ -635,132 +652,136 @@ void MainWindow::startMultiSync()
635#ifndef DESKTOP_VERSION 652#ifndef DESKTOP_VERSION
636 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 653 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
637#endif 654#endif
638} 655}
639QPixmap MainWindow::loadPixmap( QString name ) 656QPixmap MainWindow::loadPixmap( QString name )
640{ 657{
641 return SmallIcon( name ); 658 return SmallIcon( name );
642 659
643} 660}
644void MainWindow::setUsesBigPixmaps ( bool b ) 661void MainWindow::setUsesBigPixmaps ( bool b )
645{ 662{
646 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 663 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
647 if ( b ) 664 if ( b )
648 qDebug("KO: BigPixmaps are not supported "); 665 qDebug("KO: BigPixmaps are not supported ");
649} 666}
650void MainWindow::initActions() 667void MainWindow::initActions()
651{ 668{
652 //KOPrefs::instance()->mShowFullMenu 669 //KOPrefs::instance()->mShowFullMenu
653 iconToolBar->clear(); 670 iconToolBar->clear();
654 KOPrefs *p = KOPrefs::instance(); 671 KOPrefs *p = KOPrefs::instance();
655 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 672 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
656 673
657 QPopupMenu *viewMenu = new QPopupMenu( this ); 674 QPopupMenu *viewMenu = new QPopupMenu( this );
658 QPopupMenu *actionMenu = new QPopupMenu( this ); 675 QPopupMenu *actionMenu = new QPopupMenu( this );
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
743 connect( mWeekAction, SIGNAL( activated() ), 764 connect( mWeekAction, SIGNAL( activated() ),
744 this, SLOT( weekAction() ) ); 765 this, SLOT( weekAction() ) );
745 766
746 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 767 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
747 if ( p->mShowIconFilterview ) { 768 if ( p->mShowIconFilterview ) {
748 icon = loadPixmap( pathString + "filter" ); 769 icon = loadPixmap( pathString + "filter" );
749 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 770 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
750 connect( actionFilterMenuTB, SIGNAL( activated() ), 771 connect( actionFilterMenuTB, SIGNAL( activated() ),
751 this, SLOT( fillFilterMenuTB() ) ); 772 this, SLOT( fillFilterMenuTB() ) );
752 actionFilterMenuTB->addTo( iconToolBar ); 773 actionFilterMenuTB->addTo( iconToolBar );
753 selectFilterMenuTB = new QPopupMenu( this ); 774 selectFilterMenuTB = new QPopupMenu( this );
754 selectFilterMenuTB->setCheckable( true ); 775 selectFilterMenuTB->setCheckable( true );
755 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 776 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
756 } 777 }
757 778
758 //#endif 779 //#endif
759 // ****************** 780 // ******************
760 QAction *action; 781 QAction *action;
761 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 782 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
762 configureToolBarMenu->setCheckable( true ); 783 configureToolBarMenu->setCheckable( true );
763 784
764 785
765 configureAgendaMenu->setCheckable( true ); 786 configureAgendaMenu->setCheckable( true );
766 int iii ; 787 int iii ;