-rw-r--r-- | korganizer/mainwindow.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 1776dcc..883a9d1 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -431,415 +431,412 @@ void MainWindow::loadDataAfterStart() | |||
431 | mBlockAtStartup = false; | 431 | mBlockAtStartup = false; |
432 | mView->setModified( false ); | 432 | mView->setModified( false ); |
433 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 433 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
434 | processIncidenceSelection( 0 ); | 434 | processIncidenceSelection( 0 ); |
435 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 435 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
436 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 436 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
437 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 437 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
438 | SLOT( slotModifiedChanged( bool ) ) ); | 438 | SLOT( slotModifiedChanged( bool ) ) ); |
439 | #ifndef DESKTOP_VERSION | 439 | #ifndef DESKTOP_VERSION |
440 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 440 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
441 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); | 441 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); |
442 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); | 442 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); |
443 | if ( !mCStringMess.isEmpty() ) | 443 | if ( !mCStringMess.isEmpty() ) |
444 | recieve( mCStringMess, mByteData ); | 444 | recieve( mCStringMess, mByteData ); |
445 | #endif | 445 | #endif |
446 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 446 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
447 | } | 447 | } |
448 | 448 | ||
449 | void MainWindow::slotResetFocus() | 449 | void MainWindow::slotResetFocus() |
450 | { | 450 | { |
451 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 451 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
452 | mFocusLoop = 3; | 452 | mFocusLoop = 3; |
453 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 453 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
454 | } | 454 | } |
455 | void MainWindow::slotResetFocusLoop() | 455 | void MainWindow::slotResetFocusLoop() |
456 | { | 456 | { |
457 | --mFocusLoop; | 457 | --mFocusLoop; |
458 | QWidget* fw = mView->viewManager()->currentView(); | 458 | QWidget* fw = mView->viewManager()->currentView(); |
459 | if ( fw ) { | 459 | if ( fw ) { |
460 | //qDebug("loop "); | 460 | //qDebug("loop "); |
461 | fw->setFocus(); | 461 | fw->setFocus(); |
462 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 462 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
463 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 463 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
464 | } | 464 | } |
465 | 465 | ||
466 | } | 466 | } |
467 | void MainWindow::disableBR(bool b) | 467 | void MainWindow::disableBR(bool b) |
468 | { | 468 | { |
469 | #ifndef DESKTOP_VERSION | 469 | #ifndef DESKTOP_VERSION |
470 | if ( b ) { | 470 | if ( b ) { |
471 | if ( infrared ) { | 471 | if ( infrared ) { |
472 | toggleBeamReceive(); | 472 | toggleBeamReceive(); |
473 | mBRdisabled = true; | 473 | mBRdisabled = true; |
474 | } | 474 | } |
475 | mBRdisabled = true; | 475 | mBRdisabled = true; |
476 | } else { | 476 | } else { |
477 | if ( mBRdisabled ) { | 477 | if ( mBRdisabled ) { |
478 | mBRdisabled = false; | 478 | mBRdisabled = false; |
479 | //makes no sense,because other cal ap is probably running | 479 | //makes no sense,because other cal ap is probably running |
480 | // toggleBeamReceive(); | 480 | // toggleBeamReceive(); |
481 | } | 481 | } |
482 | } | 482 | } |
483 | #endif | 483 | #endif |
484 | 484 | ||
485 | } | 485 | } |
486 | bool MainWindow::beamReceiveEnabled() | 486 | bool MainWindow::beamReceiveEnabled() |
487 | { | 487 | { |
488 | #ifndef DESKTOP_VERSION | 488 | #ifndef DESKTOP_VERSION |
489 | return ( infrared != 0 ); | 489 | return ( infrared != 0 ); |
490 | #endif | 490 | #endif |
491 | return false; | 491 | return false; |
492 | } | 492 | } |
493 | 493 | ||
494 | void MainWindow::toggleBeamReceive() | 494 | void MainWindow::toggleBeamReceive() |
495 | { | 495 | { |
496 | if ( mBRdisabled ) | 496 | if ( mBRdisabled ) |
497 | return; | 497 | return; |
498 | #ifndef DESKTOP_VERSION | 498 | #ifndef DESKTOP_VERSION |
499 | if ( infrared ) { | 499 | if ( infrared ) { |
500 | qDebug("KO: Disable BeamReceive "); | 500 | qDebug("KO: Disable BeamReceive "); |
501 | delete infrared; | 501 | delete infrared; |
502 | infrared = 0; | 502 | infrared = 0; |
503 | brAction->setOn(false); | 503 | brAction->setOn(false); |
504 | return; | 504 | return; |
505 | } | 505 | } |
506 | qDebug("KO: Enable BeamReceive "); | 506 | qDebug("KO: Enable BeamReceive "); |
507 | brAction->setOn(true); | 507 | brAction->setOn(true); |
508 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 508 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
509 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 509 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
510 | #endif | 510 | #endif |
511 | } | 511 | } |
512 | void MainWindow::showMaximized () | 512 | void MainWindow::showMaximized () |
513 | { | 513 | { |
514 | #ifndef DESKTOP_VERSION | 514 | #ifndef DESKTOP_VERSION |
515 | if ( ! globalFlagBlockStartup ) | 515 | if ( ! globalFlagBlockStartup ) |
516 | if ( mClosed ) | 516 | if ( mClosed ) |
517 | mView->goToday(); | 517 | mView->goToday(); |
518 | #endif | 518 | #endif |
519 | QWidget::showMaximized () ; | 519 | QWidget::showMaximized () ; |
520 | mClosed = false; | 520 | mClosed = false; |
521 | } | 521 | } |
522 | 522 | ||
523 | bool MainWindow::askForQuitOnSaveError() | 523 | bool MainWindow::askForQuitOnSaveError() |
524 | { | 524 | { |
525 | bool retval = false; | 525 | bool retval = false; |
526 | switch( QMessageBox::information( this, "KO/Pi", | 526 | switch( QMessageBox::information( this, "KO/Pi", |
527 | i18n("Error saving data") + "!\n" + | 527 | i18n("Error saving data") + "!\n" + |
528 | i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + | 528 | i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + |
529 | i18n("Do you really want\nto close KO/Pi?"), | 529 | i18n("Do you really want\nto close KO/Pi?"), |
530 | i18n(" Yes, close "), i18n("No"), | 530 | i18n(" Yes, close "), i18n("No"), |
531 | 0, 1 ) ) { | 531 | 0, 1 ) ) { |
532 | case 0: | 532 | case 0: |
533 | retval = true; | 533 | retval = true; |
534 | break; | 534 | break; |
535 | default: | 535 | default: |
536 | break; | 536 | break; |
537 | } | 537 | } |
538 | return retval; | 538 | return retval; |
539 | } | 539 | } |
540 | 540 | ||
541 | void MainWindow::closeEvent( QCloseEvent* ce ) | 541 | void MainWindow::closeEvent( QCloseEvent* ce ) |
542 | { | 542 | { |
543 | 543 | ||
544 | 544 | ||
545 | 545 | ||
546 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 546 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
547 | saveOnClose(); | 547 | saveOnClose(); |
548 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { | 548 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { |
549 | ce->ignore(); | 549 | ce->ignore(); |
550 | return; | 550 | return; |
551 | } | 551 | } |
552 | mClosed = true; | 552 | mClosed = true; |
553 | ce->accept(); | 553 | ce->accept(); |
554 | return; | 554 | return; |
555 | 555 | ||
556 | } | 556 | } |
557 | 557 | ||
558 | switch( QMessageBox::information( this, "KO/Pi", | 558 | switch( QMessageBox::information( this, "KO/Pi", |
559 | i18n("Do you really want\nto close KO/Pi?"), | 559 | i18n("Do you really want\nto close KO/Pi?"), |
560 | i18n("Close"), i18n("No"), | 560 | i18n("Close"), i18n("No"), |
561 | 0, 0 ) ) { | 561 | 0, 0 ) ) { |
562 | case 0: | 562 | case 0: |
563 | saveOnClose(); | 563 | saveOnClose(); |
564 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { | 564 | if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { |
565 | ce->ignore(); | 565 | ce->ignore(); |
566 | return; | 566 | return; |
567 | } | 567 | } |
568 | mClosed = true; | 568 | mClosed = true; |
569 | ce->accept(); | 569 | ce->accept(); |
570 | break; | 570 | break; |
571 | case 1: | 571 | case 1: |
572 | ce->ignore(); | 572 | ce->ignore(); |
573 | break; | 573 | break; |
574 | case 2: | 574 | case 2: |
575 | 575 | ||
576 | default: | 576 | default: |
577 | break; | 577 | break; |
578 | } | 578 | } |
579 | 579 | ||
580 | 580 | ||
581 | } | 581 | } |
582 | void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) | 582 | void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) |
583 | { | 583 | { |
584 | qDebug("KO: QCOP start message received: %s ", cmsg.data() ); | 584 | qDebug("KO: QCOP start message received: %s ", cmsg.data() ); |
585 | mCStringMess = cmsg; | 585 | mCStringMess = cmsg; |
586 | mByteData = data; | 586 | mByteData = data; |
587 | } | 587 | } |
588 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 588 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
589 | { | 589 | { |
590 | QDataStream stream( data, IO_ReadOnly ); | 590 | QDataStream stream( data, IO_ReadOnly ); |
591 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 591 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
592 | //QString datamess; | 592 | //QString datamess; |
593 | //qDebug("message "); | 593 | //qDebug("message "); |
594 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 594 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
595 | 595 | ||
596 | if ( cmsg == "setDocument(QString)" ) { | 596 | if ( cmsg == "setDocument(QString)" ) { |
597 | QDataStream stream( data, IO_ReadOnly ); | 597 | QDataStream stream( data, IO_ReadOnly ); |
598 | QString fileName; | 598 | QString fileName; |
599 | stream >> fileName; | 599 | stream >> fileName; |
600 | //qDebug("filename %s ", fileName.latin1()); | 600 | //qDebug("filename %s ", fileName.latin1()); |
601 | showMaximized(); | 601 | showMaximized(); |
602 | raise(); | 602 | raise(); |
603 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 603 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
604 | mSyncManager->slotSyncMenu( 1002 ); | 604 | mSyncManager->slotSyncMenu( 1002 ); |
605 | return; | 605 | return; |
606 | } | 606 | } |
607 | 607 | ||
608 | if ( cmsg == "-writeFile" ) { | 608 | if ( cmsg == "-writeFile" ) { |
609 | // I made from the "-writeFile" an "-writeAlarm" | 609 | // I made from the "-writeFile" an "-writeAlarm" |
610 | mView->viewManager()->showWhatsNextView(); | 610 | mView->viewManager()->showWhatsNextView(); |
611 | mCalendar->checkAlarmForIncidence( 0, true); | 611 | mCalendar->checkAlarmForIncidence( 0, true); |
612 | showMaximized(); | 612 | showMaximized(); |
613 | raise(); | 613 | raise(); |
614 | return; | 614 | return; |
615 | 615 | ||
616 | } | 616 | } |
617 | if ( cmsg == "-writeFileSilent" ) { | 617 | if ( cmsg == "-writeFileSilent" ) { |
618 | // I made from the "-writeFile" an "-writeAlarm" | 618 | // I made from the "-writeFile" an "-writeAlarm" |
619 | // mView->viewManager()->showWhatsNextView(); | 619 | // mView->viewManager()->showWhatsNextView(); |
620 | mCalendar->checkAlarmForIncidence( 0, true); | 620 | mCalendar->checkAlarmForIncidence( 0, true); |
621 | //showMaximized(); | 621 | //showMaximized(); |
622 | //raise(); | 622 | //raise(); |
623 | hide(); | 623 | //hide(); |
624 | return; | 624 | return; |
625 | } | 625 | } |
626 | if ( cmsg == "-newCountdown" ) { | 626 | if ( cmsg == "-newCountdown" ) { |
627 | qDebug("newCountdown "); | 627 | qDebug("newCountdown "); |
628 | 628 | ||
629 | } | 629 | } |
630 | QString msg ; | 630 | QString msg ; |
631 | QString allmsg = cmsg; | 631 | QString allmsg = cmsg; |
632 | while ( allmsg.length() > 0 ) { | 632 | while ( allmsg.length() > 0 ) { |
633 | int nextC = allmsg.find( "-", 1 ); | 633 | int nextC = allmsg.find( "-", 1 ); |
634 | if ( nextC == -1 ) { | 634 | if ( nextC == -1 ) { |
635 | msg = allmsg; | 635 | msg = allmsg; |
636 | allmsg = ""; | 636 | allmsg = ""; |
637 | } else{ | 637 | } else{ |
638 | msg = allmsg.left( nextC ); | 638 | msg = allmsg.left( nextC ); |
639 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 639 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
640 | } | 640 | } |
641 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 641 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
642 | if ( msg == "-newEvent" ) { | 642 | if ( msg == "-newEvent" ) { |
643 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); | 643 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); |
644 | } | 644 | } |
645 | if ( msg == "-newTodo" ) { | 645 | if ( msg == "-newTodo" ) { |
646 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); | 646 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); |
647 | } | 647 | } |
648 | if ( msg == "-showWN" ) { | 648 | if ( msg == "-showWN" ) { |
649 | mView->viewManager()->showWhatsNextView(); | 649 | mView->viewManager()->showWhatsNextView(); |
650 | } | 650 | } |
651 | if ( msg == "-showTodo" ) { | ||
652 | mView->viewManager()->showTodoView(); | ||
653 | } | ||
654 | if ( msg == "-showList" ) { | 651 | if ( msg == "-showList" ) { |
655 | mView->viewManager()->showListView(); | 652 | mView->viewManager()->showListView(); |
656 | } | 653 | } |
657 | else if ( msg == "-showDay" ) { | 654 | else if ( msg == "-showDay" ) { |
658 | mView->viewManager()->showDayView(); | 655 | mView->viewManager()->showDayView(); |
659 | } | 656 | } |
660 | else if ( msg == "-showWWeek" ) { | 657 | else if ( msg == "-showWWeek" ) { |
661 | mView->viewManager()->showWorkWeekView(); | 658 | mView->viewManager()->showWorkWeekView(); |
662 | } | 659 | } |
663 | else if ( msg == "-ringSync" ) { | 660 | else if ( msg == "-ringSync" ) { |
664 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); | 661 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); |
665 | } | 662 | } |
666 | else if ( msg == "-showWeek" ) { | 663 | else if ( msg == "-showWeek" ) { |
667 | mView->viewManager()->showWeekView(); | 664 | mView->viewManager()->showWeekView(); |
668 | } | 665 | } |
669 | else if ( msg == "-showTodo" ) { | 666 | else if ( msg == "-showTodo" ) { |
670 | mView->viewManager()->showTodoView(); | 667 | mView->viewManager()->showTodoView(); |
671 | } | 668 | } |
672 | else if ( msg == "-showJournal" ) { | 669 | else if ( msg == "-showJournal" ) { |
673 | mView->dateNavigator()->selectDates( 1 ); | 670 | mView->dateNavigator()->selectDates( 1 ); |
674 | mView->dateNavigator()->selectToday(); | 671 | mView->dateNavigator()->selectToday(); |
675 | mView->viewManager()->showJournalView(); | 672 | mView->viewManager()->showJournalView(); |
676 | } | 673 | } |
677 | else if ( msg == "-showKO" ) { | 674 | else if ( msg == "-showKO" ) { |
678 | mView->viewManager()->showNextXView(); | 675 | mView->viewManager()->showNextXView(); |
679 | } | 676 | } |
680 | else if ( msg == "-showWNext" ) { | 677 | else if ( msg == "-showWNext" ) { |
681 | mView->viewManager()->showWhatsNextView(); | 678 | mView->viewManager()->showWhatsNextView(); |
682 | } | 679 | } |
683 | else if ( msg == "nextView()" ) { | 680 | else if ( msg == "nextView()" ) { |
684 | mView->viewManager()->showNextView(); | 681 | mView->viewManager()->showNextView(); |
685 | } | 682 | } |
686 | else if ( msg == "-showNextXView" ) { | 683 | else if ( msg == "-showNextXView" ) { |
687 | mView->viewManager()->showNextXView(); | 684 | mView->viewManager()->showNextXView(); |
688 | } | 685 | } |
689 | 686 | ||
690 | 687 | ||
691 | } | 688 | } |
692 | 689 | ||
693 | showMaximized(); | 690 | showMaximized(); |
694 | raise(); | 691 | raise(); |
695 | } | 692 | } |
696 | void MainWindow::startMultiSync() | 693 | void MainWindow::startMultiSync() |
697 | { | 694 | { |
698 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 695 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
699 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), | 696 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), |
700 | question, | 697 | question, |
701 | i18n("Yes"), i18n("No"), | 698 | i18n("Yes"), i18n("No"), |
702 | 0, 0 ) != 0 ) { | 699 | 0, 0 ) != 0 ) { |
703 | setCaption(i18n("Aborted! Nothing synced!")); | 700 | setCaption(i18n("Aborted! Nothing synced!")); |
704 | return; | 701 | return; |
705 | } | 702 | } |
706 | mSyncManager->multiSync( false ); | 703 | mSyncManager->multiSync( false ); |
707 | #ifndef DESKTOP_VERSION | 704 | #ifndef DESKTOP_VERSION |
708 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); | 705 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); |
709 | #endif | 706 | #endif |
710 | } | 707 | } |
711 | QPixmap MainWindow::loadPixmap( QString name ) | 708 | QPixmap MainWindow::loadPixmap( QString name ) |
712 | { | 709 | { |
713 | return SmallIcon( name ); | 710 | return SmallIcon( name ); |
714 | 711 | ||
715 | } | 712 | } |
716 | void MainWindow::setUsesBigPixmaps ( bool b ) | 713 | void MainWindow::setUsesBigPixmaps ( bool b ) |
717 | { | 714 | { |
718 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 715 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
719 | if ( b ) | 716 | if ( b ) |
720 | qDebug("KO: BigPixmaps are not supported "); | 717 | qDebug("KO: BigPixmaps are not supported "); |
721 | } | 718 | } |
722 | void MainWindow::initActions() | 719 | void MainWindow::initActions() |
723 | { | 720 | { |
724 | //KOPrefs::instance()->mShowFullMenu | 721 | //KOPrefs::instance()->mShowFullMenu |
725 | iconToolBar->clear(); | 722 | iconToolBar->clear(); |
726 | KOPrefs *p = KOPrefs::instance(); | 723 | KOPrefs *p = KOPrefs::instance(); |
727 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 724 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
728 | 725 | ||
729 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 726 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
730 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 727 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
731 | mCurrentItemMenu = new QPopupMenu ( this ); | 728 | mCurrentItemMenu = new QPopupMenu ( this ); |
732 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); | 729 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); |
733 | QPopupMenu *importMenu = new QPopupMenu( this ); | 730 | QPopupMenu *importMenu = new QPopupMenu( this ); |
734 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 731 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
735 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 732 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
736 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 733 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
737 | selectFilterMenu = new QPopupMenu( this ); | 734 | selectFilterMenu = new QPopupMenu( this ); |
738 | selectFilterMenu->setCheckable( true ); | 735 | selectFilterMenu->setCheckable( true ); |
739 | syncMenu = new QPopupMenu( this ); | 736 | syncMenu = new QPopupMenu( this ); |
740 | configureAgendaMenu = new QPopupMenu( this ); | 737 | configureAgendaMenu = new QPopupMenu( this ); |
741 | configureToolBarMenu = new QPopupMenu( this ); | 738 | configureToolBarMenu = new QPopupMenu( this ); |
742 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 739 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
743 | QIconSet icon; | 740 | QIconSet icon; |
744 | int pixWid = 22, pixHei = 22; | 741 | int pixWid = 22, pixHei = 22; |
745 | QString pathString = ""; | 742 | QString pathString = ""; |
746 | if ( !p->mToolBarMiniIcons ) { | 743 | if ( !p->mToolBarMiniIcons ) { |
747 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 744 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
748 | pathString += "icons16/"; | 745 | pathString += "icons16/"; |
749 | pixWid = 18; pixHei = 16; | 746 | pixWid = 18; pixHei = 16; |
750 | } | 747 | } |
751 | } else { | 748 | } else { |
752 | pathString += "iconsmini/"; | 749 | pathString += "iconsmini/"; |
753 | pixWid = 18; pixHei = 16; | 750 | pixWid = 18; pixHei = 16; |
754 | } | 751 | } |
755 | 752 | ||
756 | if ( KOPrefs::instance()->mShowFullMenu ) { | 753 | if ( KOPrefs::instance()->mShowFullMenu ) { |
757 | menuBar1 = new KMenuBar( this );//menuBar(); | 754 | menuBar1 = new KMenuBar( this );//menuBar(); |
758 | //setMenuBar( menuBar1 ); | 755 | //setMenuBar( menuBar1 ); |
759 | menuBar1->show(); | 756 | menuBar1->show(); |
760 | menuBar1->insertItem( i18n("File"), importMenu ); | 757 | menuBar1->insertItem( i18n("File"), importMenu ); |
761 | menuBar1->insertItem( i18n("View"), viewMenu ); | 758 | menuBar1->insertItem( i18n("View"), viewMenu ); |
762 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); | 759 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); |
763 | menuBar1->insertItem( i18n("Action"), actionMenu ); | 760 | menuBar1->insertItem( i18n("Action"), actionMenu ); |
764 | #ifdef DESKTOP_VERSION | 761 | #ifdef DESKTOP_VERSION |
765 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 762 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
766 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 763 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
767 | #else | 764 | #else |
768 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 765 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
769 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 766 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
770 | #endif | 767 | #endif |
771 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 768 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
772 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 769 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
773 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 770 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
774 | } else { | 771 | } else { |
775 | menuBar1 = new KMenuBar( iconToolBar ); | 772 | menuBar1 = new KMenuBar( iconToolBar ); |
776 | QPopupMenu *menuBar = new QPopupMenu( this ); | 773 | QPopupMenu *menuBar = new QPopupMenu( this ); |
777 | icon = loadPixmap( pathString + "z_menu" ); | 774 | icon = loadPixmap( pathString + "z_menu" ); |
778 | menuBar1->insertItem( icon.pixmap(), menuBar); | 775 | menuBar1->insertItem( icon.pixmap(), menuBar); |
779 | //menuBar1->insertItem( i18n("ME"), menuBar); | 776 | //menuBar1->insertItem( i18n("ME"), menuBar); |
780 | menuBar->insertItem( i18n("File"), importMenu ); | 777 | menuBar->insertItem( i18n("File"), importMenu ); |
781 | menuBar->insertItem( i18n("View"), viewMenu ); | 778 | menuBar->insertItem( i18n("View"), viewMenu ); |
782 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); | 779 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); |
783 | menuBar->insertItem( i18n("Action"), actionMenu ); | 780 | menuBar->insertItem( i18n("Action"), actionMenu ); |
784 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 781 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
785 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 782 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
786 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 783 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
787 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 784 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
788 | menuBar->insertItem( i18n("Help"), helpMenu ); | 785 | menuBar->insertItem( i18n("Help"), helpMenu ); |
789 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 786 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
790 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 787 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
791 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); | 788 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); |
792 | } | 789 | } |
793 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 790 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
794 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 791 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
795 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 792 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
796 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 793 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
797 | 794 | ||
798 | 795 | ||
799 | mWeekBgColor = iconToolBar->backgroundColor(); | 796 | mWeekBgColor = iconToolBar->backgroundColor(); |
800 | mWeekPixmap.resize( pixWid , pixHei ); | 797 | mWeekPixmap.resize( pixWid , pixHei ); |
801 | mWeekPixmap.fill( mWeekBgColor ); | 798 | mWeekPixmap.fill( mWeekBgColor ); |
802 | icon = mWeekPixmap; | 799 | icon = mWeekPixmap; |
803 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 800 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
804 | if ( p-> mShowIconWeekNum ) | 801 | if ( p-> mShowIconWeekNum ) |
805 | mWeekAction->addTo( iconToolBar ); | 802 | mWeekAction->addTo( iconToolBar ); |
806 | mWeekFont = font(); | 803 | mWeekFont = font(); |
807 | 804 | ||
808 | int fontPoint = mWeekFont.pointSize(); | 805 | int fontPoint = mWeekFont.pointSize(); |
809 | QFontMetrics f( mWeekFont ); | 806 | QFontMetrics f( mWeekFont ); |
810 | int fontWid = f.width( "30" ); | 807 | int fontWid = f.width( "30" ); |
811 | while ( fontWid > pixWid ) { | 808 | while ( fontWid > pixWid ) { |
812 | --fontPoint; | 809 | --fontPoint; |
813 | mWeekFont.setPointSize( fontPoint ); | 810 | mWeekFont.setPointSize( fontPoint ); |
814 | QFontMetrics f( mWeekFont ); | 811 | QFontMetrics f( mWeekFont ); |
815 | fontWid = f.width( "30" ); | 812 | fontWid = f.width( "30" ); |
816 | //qDebug("dec-- "); | 813 | //qDebug("dec-- "); |
817 | } | 814 | } |
818 | 815 | ||
819 | connect( mWeekAction, SIGNAL( activated() ), | 816 | connect( mWeekAction, SIGNAL( activated() ), |
820 | this, SLOT( weekAction() ) ); | 817 | this, SLOT( weekAction() ) ); |
821 | 818 | ||
822 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 819 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
823 | if ( p->mShowIconFilterview ) { | 820 | if ( p->mShowIconFilterview ) { |
824 | icon = loadPixmap( pathString + "filter" ); | 821 | icon = loadPixmap( pathString + "filter" ); |
825 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 822 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
826 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 823 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
827 | this, SLOT( fillFilterMenuTB() ) ); | 824 | this, SLOT( fillFilterMenuTB() ) ); |
828 | actionFilterMenuTB->addTo( iconToolBar ); | 825 | actionFilterMenuTB->addTo( iconToolBar ); |
829 | selectFilterMenuTB = new QPopupMenu( this ); | 826 | selectFilterMenuTB = new QPopupMenu( this ); |
830 | selectFilterMenuTB->setCheckable( true ); | 827 | selectFilterMenuTB->setCheckable( true ); |
831 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 828 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
832 | } | 829 | } |
833 | 830 | ||
834 | //#endif | 831 | //#endif |
835 | // ****************** | 832 | // ****************** |
836 | QAction *action; | 833 | QAction *action; |
837 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 834 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
838 | configureToolBarMenu->setCheckable( true ); | 835 | configureToolBarMenu->setCheckable( true ); |
839 | 836 | ||
840 | 837 | ||
841 | configureAgendaMenu->setCheckable( true ); | 838 | configureAgendaMenu->setCheckable( true ); |
842 | int iii ; | 839 | int iii ; |
843 | for ( iii = 1;iii<= 10 ;++iii ){ | 840 | for ( iii = 1;iii<= 10 ;++iii ){ |
844 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 841 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
845 | } | 842 | } |