summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 95b836c..7a4275b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -497,193 +497,193 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
497 497
498 } 498 }
499 499
500 showMaximized(); 500 showMaximized();
501 raise(); 501 raise();
502} 502}
503 503
504QPixmap MainWindow::loadPixmap( QString name ) 504QPixmap MainWindow::loadPixmap( QString name )
505{ 505{
506 return SmallIcon( name ); 506 return SmallIcon( name );
507 507
508} 508}
509void MainWindow::initActions() 509void MainWindow::initActions()
510{ 510{
511 //KOPrefs::instance()->mShowFullMenu 511 //KOPrefs::instance()->mShowFullMenu
512 iconToolBar->clear(); 512 iconToolBar->clear();
513 KOPrefs *p = KOPrefs::instance(); 513 KOPrefs *p = KOPrefs::instance();
514 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 514 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
515 515
516 QPopupMenu *viewMenu = new QPopupMenu( this ); 516 QPopupMenu *viewMenu = new QPopupMenu( this );
517 QPopupMenu *actionMenu = new QPopupMenu( this ); 517 QPopupMenu *actionMenu = new QPopupMenu( this );
518 QPopupMenu *importMenu = new QPopupMenu( this ); 518 QPopupMenu *importMenu = new QPopupMenu( this );
519 QPopupMenu *importMenu_X = new QPopupMenu( this ); 519 QPopupMenu *importMenu_X = new QPopupMenu( this );
520 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 520 QPopupMenu *exportMenu_X = new QPopupMenu( this );
521 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 521 QPopupMenu *beamMenu_X = new QPopupMenu( this );
522 selectFilterMenu = new QPopupMenu( this ); 522 selectFilterMenu = new QPopupMenu( this );
523 selectFilterMenu->setCheckable( true ); 523 selectFilterMenu->setCheckable( true );
524 syncMenu = new QPopupMenu( this ); 524 syncMenu = new QPopupMenu( this );
525 configureAgendaMenu = new QPopupMenu( this ); 525 configureAgendaMenu = new QPopupMenu( this );
526 configureToolBarMenu = new QPopupMenu( this ); 526 configureToolBarMenu = new QPopupMenu( this );
527 QPopupMenu *helpMenu = new QPopupMenu( this ); 527 QPopupMenu *helpMenu = new QPopupMenu( this );
528 QIconSet icon; 528 QIconSet icon;
529 int pixWid = 22, pixHei = 22; 529 int pixWid = 22, pixHei = 22;
530 QString pathString = ""; 530 QString pathString = "";
531 if ( !p->mToolBarMiniIcons ) { 531 if ( !p->mToolBarMiniIcons ) {
532 if ( QApplication::desktop()->width() < 480 ) { 532 if ( QApplication::desktop()->width() < 480 ) {
533 pathString += "icons16/"; 533 pathString += "icons16/";
534 pixWid = 18; pixHei = 16; 534 pixWid = 18; pixHei = 16;
535 } 535 }
536 } else { 536 } else {
537 pathString += "iconsmini/"; 537 pathString += "iconsmini/";
538 pixWid = 18; pixHei = 16; 538 pixWid = 18; pixHei = 16;
539 } 539 }
540 if ( KOPrefs::instance()->mShowFullMenu ) { 540 if ( KOPrefs::instance()->mShowFullMenu ) {
541 QMenuBar *menuBar1; 541 QMenuBar *menuBar1;
542 menuBar1 = menuBar(); 542 menuBar1 = menuBar();
543 menuBar1->insertItem( i18n("File"), importMenu ); 543 menuBar1->insertItem( i18n("File"), importMenu );
544 menuBar1->insertItem( i18n("View"), viewMenu ); 544 menuBar1->insertItem( i18n("View"), viewMenu );
545 menuBar1->insertItem( i18n("Actions"), actionMenu ); 545 menuBar1->insertItem( i18n("Actions"), actionMenu );
546#ifdef DESKTOP_VERSION 546#ifdef DESKTOP_VERSION
547 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 547 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
548 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 548 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
549#else 549#else
550 menuBar1->insertItem( i18n("Sync"), syncMenu ); 550 menuBar1->insertItem( i18n("Sync"), syncMenu );
551 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 551 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
552#endif 552#endif
553 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 553 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
554 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 554 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
555 menuBar1->insertItem( i18n("Help"), helpMenu ); 555 menuBar1->insertItem( i18n("Help"), helpMenu );
556 } else { 556 } else {
557 QPEMenuBar *menuBar1; 557 QPEMenuBar *menuBar1;
558 menuBar1 = new QPEMenuBar( iconToolBar ); 558 menuBar1 = new QPEMenuBar( iconToolBar );
559 QPopupMenu *menuBar = new QPopupMenu( this ); 559 QPopupMenu *menuBar = new QPopupMenu( this );
560 icon = loadPixmap( pathString + "z_menu" ); 560 icon = loadPixmap( pathString + "z_menu" );
561 menuBar1->insertItem( icon.pixmap(), menuBar); 561 menuBar1->insertItem( icon.pixmap(), menuBar);
562 //menuBar1->insertItem( i18n("ME"), menuBar); 562 //menuBar1->insertItem( i18n("ME"), menuBar);
563 menuBar->insertItem( i18n("File"), importMenu ); 563 menuBar->insertItem( i18n("File"), importMenu );
564 menuBar->insertItem( i18n("View"), viewMenu ); 564 menuBar->insertItem( i18n("View"), viewMenu );
565 menuBar->insertItem( i18n("Actions"), actionMenu ); 565 menuBar->insertItem( i18n("Actions"), actionMenu );
566 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 566 menuBar->insertItem( i18n("Synchronize"), syncMenu );
567 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 567 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
568 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 568 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
569 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 569 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
570 menuBar->insertItem( i18n("Help"), helpMenu ); 570 menuBar->insertItem( i18n("Help"), helpMenu );
571 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 571 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
572 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 572 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
573 } 573 }
574 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 574 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
575 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 575 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
576 mWeekBgColor = iconToolBar->backgroundColor(); 576 mWeekBgColor = iconToolBar->backgroundColor();
577 mWeekPixmap.resize( pixWid , pixHei ); 577 mWeekPixmap.resize( pixWid , pixHei );
578 mWeekPixmap.fill( mWeekBgColor ); 578 mWeekPixmap.fill( mWeekBgColor );
579 icon = mWeekPixmap; 579 icon = mWeekPixmap;
580 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 580 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
581 if ( p-> mShowIconWeekNum ) 581 if ( p-> mShowIconWeekNum )
582 mWeekAction->addTo( iconToolBar ); 582 mWeekAction->addTo( iconToolBar );
583 mWeekFont = font(); 583 mWeekFont = font();
584 584
585 int fontPoint = mWeekFont.pointSize(); 585 int fontPoint = mWeekFont.pointSize();
586 QFontMetrics f( mWeekFont ); 586 QFontMetrics f( mWeekFont );
587 int fontWid = f.width( "30" ); 587 int fontWid = f.width( "30" );
588 while ( fontWid > pixWid ) { 588 while ( fontWid > pixWid ) {
589 --fontPoint; 589 --fontPoint;
590 mWeekFont.setPointSize( fontPoint ); 590 mWeekFont.setPointSize( fontPoint );
591 QFontMetrics f( mWeekFont ); 591 QFontMetrics f( mWeekFont );
592 fontWid = f.width( "30" ); 592 fontWid = f.width( "30" );
593 qDebug("dec-- "); 593 //qDebug("dec-- ");
594 } 594 }
595 595
596 connect( mWeekAction, SIGNAL( activated() ), 596 connect( mWeekAction, SIGNAL( activated() ),
597 this, SLOT( weekAction() ) ); 597 this, SLOT( weekAction() ) );
598 598
599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
600 600
601 //#endif 601 //#endif
602 // ****************** 602 // ******************
603 QAction *action; 603 QAction *action;
604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
605 configureToolBarMenu->setCheckable( true ); 605 configureToolBarMenu->setCheckable( true );
606 606
607 607
608 configureAgendaMenu->setCheckable( true ); 608 configureAgendaMenu->setCheckable( true );
609 int iii ; 609 int iii ;
610 for ( iii = 1;iii<= 10 ;++iii ){ 610 for ( iii = 1;iii<= 10 ;++iii ){
611 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 611 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
612 } 612 }
613 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 613 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
614 614
615 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 615 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
616 this, SLOT( showConfigureAgenda( ) ) ); 616 this, SLOT( showConfigureAgenda( ) ) );
617 617
618 icon = loadPixmap( pathString + "configure" ); 618 icon = loadPixmap( pathString + "configure" );
619 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 619 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
620 action->addTo( actionMenu ); 620 action->addTo( actionMenu );
621 connect( action, SIGNAL( activated() ), 621 connect( action, SIGNAL( activated() ),
622 mView, SLOT( edit_options() ) ); 622 mView, SLOT( edit_options() ) );
623 actionMenu->insertSeparator(); 623 actionMenu->insertSeparator();
624 624
625 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 625 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
626 action->addTo( actionMenu ); 626 action->addTo( actionMenu );
627 connect( action, SIGNAL( activated() ), 627 connect( action, SIGNAL( activated() ),
628 mView, SLOT( undo_delete() ) ); 628 mView, SLOT( undo_delete() ) );
629 actionMenu->insertSeparator(); 629 actionMenu->insertSeparator();
630 630
631 icon = loadPixmap( pathString + "newevent" ); 631 icon = loadPixmap( pathString + "newevent" );
632 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 632 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
633 configureToolBarMenu->insertSeparator(); 633 configureToolBarMenu->insertSeparator();
634 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 634 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
635 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 635 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
636 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 636 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
637 ne_action->addTo( actionMenu ); 637 ne_action->addTo( actionMenu );
638 connect( ne_action, SIGNAL( activated() ), 638 connect( ne_action, SIGNAL( activated() ),
639 mView, SLOT( newEvent() ) ); 639 mView, SLOT( newEvent() ) );
640 icon = loadPixmap( pathString + "newtodo" ); 640 icon = loadPixmap( pathString + "newtodo" );
641 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 641 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
642 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 642 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
643 nt_action->addTo( actionMenu ); 643 nt_action->addTo( actionMenu );
644 connect( nt_action, SIGNAL( activated() ), 644 connect( nt_action, SIGNAL( activated() ),
645 mView, SLOT( newTodo() ) ); 645 mView, SLOT( newTodo() ) );
646 646
647 icon = loadPixmap( pathString + "today" ); 647 icon = loadPixmap( pathString + "today" );
648 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 648 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
649 today_action->addTo( viewMenu ); 649 today_action->addTo( viewMenu );
650 connect( today_action, SIGNAL( activated() ), 650 connect( today_action, SIGNAL( activated() ),
651 mView, SLOT( goToday() ) ); 651 mView, SLOT( goToday() ) );
652 viewMenu->insertSeparator(); 652 viewMenu->insertSeparator();
653 653
654 icon = loadPixmap( pathString + "navi" ); 654 icon = loadPixmap( pathString + "navi" );
655 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 655 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
656 action->addTo( viewMenu ); 656 action->addTo( viewMenu );
657 connect( action, SIGNAL( activated() ), 657 connect( action, SIGNAL( activated() ),
658 mView, SLOT( toggleDateNavigatorWidget() ) ); 658 mView, SLOT( toggleDateNavigatorWidget() ) );
659 mToggleNav = action ; 659 mToggleNav = action ;
660 icon = loadPixmap( pathString + "filter" ); 660 icon = loadPixmap( pathString + "filter" );
661 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 661 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
662 action->addTo( viewMenu ); 662 action->addTo( viewMenu );
663 connect( action, SIGNAL( activated() ), 663 connect( action, SIGNAL( activated() ),
664 mView, SLOT( toggleFilter() ) ); 664 mView, SLOT( toggleFilter() ) );
665 mToggleFilter = action; 665 mToggleFilter = action;
666 icon = loadPixmap( pathString + "allday" ); 666 icon = loadPixmap( pathString + "allday" );
667 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 667 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
668 action->addTo( viewMenu ); 668 action->addTo( viewMenu );
669 connect( action, SIGNAL( activated() ), 669 connect( action, SIGNAL( activated() ),
670 mView, SLOT( toggleAllDaySize() ) ); 670 mView, SLOT( toggleAllDaySize() ) );
671 mToggleAllday = action; 671 mToggleAllday = action;
672 672
673 673
674 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 674 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
675 mToggleNav, SLOT( setEnabled ( bool ) ) ); 675 mToggleNav, SLOT( setEnabled ( bool ) ) );
676 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 676 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
677 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 677 mToggleFilter, SLOT( setEnabled ( bool ) ) );
678 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 678 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
679 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 679 mToggleAllday, SLOT( setEnabled ( bool ) ) );
680 680
681 viewMenu->insertSeparator(); 681 viewMenu->insertSeparator();
682 icon = loadPixmap( pathString + "picker" ); 682 icon = loadPixmap( pathString + "picker" );
683 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 683 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
684 action->addTo( viewMenu ); 684 action->addTo( viewMenu );
685 connect( action, SIGNAL( activated() ), 685 connect( action, SIGNAL( activated() ),
686 mView, SLOT( showDatePicker() ) ); 686 mView, SLOT( showDatePicker() ) );
687 action->addTo( iconToolBar ); 687 action->addTo( iconToolBar );
688 viewMenu->insertSeparator(); 688 viewMenu->insertSeparator();
689 689
@@ -1655,193 +1655,196 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1655 case Qt::Key_Down: 1655 case Qt::Key_Down:
1656 mView->viewManager()->agendaView()->scrollOneHourDown(); 1656 mView->viewManager()->agendaView()->scrollOneHourDown();
1657 break; 1657 break;
1658 case Qt::Key_Up: 1658 case Qt::Key_Up:
1659 mView->viewManager()->agendaView()->scrollOneHourUp(); 1659 mView->viewManager()->agendaView()->scrollOneHourUp();
1660 break; 1660 break;
1661 case Qt::Key_K: 1661 case Qt::Key_K:
1662 mView->viewManager()->showMonthViewWeek(); 1662 mView->viewManager()->showMonthViewWeek();
1663 break; 1663 break;
1664 case Qt::Key_I: 1664 case Qt::Key_I:
1665 mView->showIncidence(); 1665 mView->showIncidence();
1666 break; 1666 break;
1667 case Qt::Key_Delete: 1667 case Qt::Key_Delete:
1668 case Qt::Key_Backspace: 1668 case Qt::Key_Backspace:
1669 mView->deleteIncidence(); 1669 mView->deleteIncidence();
1670 break; 1670 break;
1671 case Qt::Key_D: 1671 case Qt::Key_D:
1672 mView->viewManager()->showDayView(); 1672 mView->viewManager()->showDayView();
1673 showSelectedDates = true; 1673 showSelectedDates = true;
1674 break; 1674 break;
1675 case Qt::Key_O: 1675 case Qt::Key_O:
1676 mView->toggleFilerEnabled( ); 1676 mView->toggleFilerEnabled( );
1677 break; 1677 break;
1678 case Qt::Key_0: 1678 case Qt::Key_0:
1679 case Qt::Key_1: 1679 case Qt::Key_1:
1680 case Qt::Key_2: 1680 case Qt::Key_2:
1681 case Qt::Key_3: 1681 case Qt::Key_3:
1682 case Qt::Key_4: 1682 case Qt::Key_4:
1683 case Qt::Key_5: 1683 case Qt::Key_5:
1684 case Qt::Key_6: 1684 case Qt::Key_6:
1685 case Qt::Key_7: 1685 case Qt::Key_7:
1686 case Qt::Key_8: 1686 case Qt::Key_8:
1687 case Qt::Key_9: 1687 case Qt::Key_9:
1688 pro = e->key()-48; 1688 pro = e->key()-48;
1689 if ( pro == 0 ) 1689 if ( pro == 0 )
1690 pro = 10; 1690 pro = 10;
1691 if ( e->state() == Qt::ControlButton) 1691 if ( e->state() == Qt::ControlButton)
1692 pro += 10; 1692 pro += 10;
1693 break; 1693 break;
1694 case Qt::Key_M: 1694 case Qt::Key_M:
1695 mView->viewManager()->showMonthView(); 1695 mView->viewManager()->showMonthView();
1696 showSelectedDates = true; 1696 showSelectedDates = true;
1697 break; 1697 break;
1698 case Qt::Key_Insert: 1698 case Qt::Key_Insert:
1699 mView->newEvent(); 1699 mView->newEvent();
1700 break; 1700 break;
1701 case Qt::Key_S : 1701 case Qt::Key_S :
1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1703 mView->newSubTodo(); 1703 mView->newSubTodo();
1704 else 1704 else
1705 mView->dialogManager()->showSearchDialog(); 1705 mView->dialogManager()->showSearchDialog();
1706 break; 1706 break;
1707 case Qt::Key_Y : 1707 case Qt::Key_Y :
1708 case Qt::Key_Z : 1708 case Qt::Key_Z :
1709 mView->viewManager()->showWorkWeekView(); 1709 mView->viewManager()->showWorkWeekView();
1710 showSelectedDates = true; 1710 showSelectedDates = true;
1711 break; 1711 break;
1712 case Qt::Key_U : 1712 case Qt::Key_U :
1713 mView->viewManager()->showWeekView(); 1713 mView->viewManager()->showWeekView();
1714 showSelectedDates = true; 1714 showSelectedDates = true;
1715 break; 1715 break;
1716 case Qt::Key_H : 1716 case Qt::Key_H :
1717 keyBindings(); 1717 keyBindings();
1718 break; 1718 break;
1719 case Qt::Key_W: 1719 case Qt::Key_W:
1720 mView->viewManager()->showWhatsNextView(); 1720 mView->viewManager()->showWhatsNextView();
1721 break; 1721 break;
1722 case Qt::Key_L: 1722 case Qt::Key_L:
1723 mView->viewManager()->showListView(); 1723 mView->viewManager()->showListView();
1724 break; 1724 break;
1725 case Qt::Key_N: 1725 case Qt::Key_N:
1726 mView->viewManager()->showNextXView(); 1726 mView->viewManager()->showNextXView();
1727 showSelectedDates = true; 1727 showSelectedDates = true;
1728 break; 1728 break;
1729 case Qt::Key_V: 1729 case Qt::Key_V:
1730 mView->viewManager()->showTodoView(); 1730 mView->viewManager()->showTodoView();
1731 break; 1731 break;
1732 case Qt::Key_C: 1732 case Qt::Key_C:
1733 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1733 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1734 break; 1734 break;
1735 case Qt::Key_P: 1735 case Qt::Key_P:
1736 mView->showDatePicker( ); 1736 mView->showDatePicker( );
1737 break; 1737 break;
1738 case Qt::Key_F: 1738 case Qt::Key_F:
1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1740 mView->editFilters(); 1740 mView->editFilters();
1741 else 1741 else
1742 mView->toggleFilter(); 1742 mView->toggleFilter();
1743 break; 1743 break;
1744 case Qt::Key_X: 1744 case Qt::Key_X:
1745 mView->toggleDateNavigatorWidget(); 1745 mView->toggleDateNavigatorWidget();
1746 break; 1746 break;
1747 case Qt::Key_Space: 1747 case Qt::Key_Space:
1748 mView->toggleExpand(); 1748 mView->toggleExpand();
1749 break; 1749 break;
1750 case Qt::Key_A: 1750 case Qt::Key_A:
1751 mView->toggleAllDaySize(); 1751 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1752 mView->showNextAlarms();
1753 else
1754 mView->toggleAllDaySize();
1752 break; 1755 break;
1753 case Qt::Key_T: 1756 case Qt::Key_T:
1754 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1757 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1755 mView->newTodo(); 1758 mView->newTodo();
1756 else { 1759 else {
1757 mView->goToday(); 1760 mView->goToday();
1758 showSelectedDates = true; 1761 showSelectedDates = true;
1759 } 1762 }
1760 break; 1763 break;
1761 case Qt::Key_J: 1764 case Qt::Key_J:
1762 mView->viewManager()->showJournalView(); 1765 mView->viewManager()->showJournalView();
1763 break; 1766 break;
1764 case Qt::Key_B: 1767 case Qt::Key_B:
1765 mView->editIncidenceDescription();; 1768 mView->editIncidenceDescription();;
1766 break; 1769 break;
1767 // case Qt::Key_Return: 1770 // case Qt::Key_Return:
1768 case Qt::Key_E: 1771 case Qt::Key_E:
1769 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1772 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1770 mView->newEvent(); 1773 mView->newEvent();
1771 else 1774 else
1772 mView->editIncidence(); 1775 mView->editIncidence();
1773 break; 1776 break;
1774 case Qt::Key_Plus: 1777 case Qt::Key_Plus:
1775 size = p->mHourSize +2; 1778 size = p->mHourSize +2;
1776 if ( size <= 22 ) 1779 if ( size <= 22 )
1777 configureAgenda( size ); 1780 configureAgenda( size );
1778 break; 1781 break;
1779 case Qt::Key_Minus: 1782 case Qt::Key_Minus:
1780 size = p->mHourSize - 2; 1783 size = p->mHourSize - 2;
1781 if ( size >= 4 ) 1784 if ( size >= 4 )
1782 configureAgenda( size ); 1785 configureAgenda( size );
1783 break; 1786 break;
1784 1787
1785 1788
1786 default: 1789 default:
1787 e->ignore(); 1790 e->ignore();
1788 } 1791 }
1789 if ( pro > 0 ) { 1792 if ( pro > 0 ) {
1790 mView->selectFilter( pro-1 ); 1793 mView->selectFilter( pro-1 );
1791 } 1794 }
1792 if ( showSelectedDates ) { 1795 if ( showSelectedDates ) {
1793 ;// setCaptionToDates(); 1796 ;// setCaptionToDates();
1794 } 1797 }
1795 1798
1796} 1799}
1797 1800
1798void MainWindow::fillFilterMenu() 1801void MainWindow::fillFilterMenu()
1799{ 1802{
1800 selectFilterMenu->clear(); 1803 selectFilterMenu->clear();
1801 bool disable = false; 1804 bool disable = false;
1802 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1805 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1803 selectFilterMenu->insertSeparator(); 1806 selectFilterMenu->insertSeparator();
1804 if ( mView->filterView()->filtersEnabled() ) { 1807 if ( mView->filterView()->filtersEnabled() ) {
1805 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1808 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1806 } 1809 }
1807 else { 1810 else {
1808 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1811 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1809 disable = true; 1812 disable = true;
1810 } 1813 }
1811 selectFilterMenu->insertSeparator(); 1814 selectFilterMenu->insertSeparator();
1812 QPtrList<CalFilter> fili = mView->filters(); 1815 QPtrList<CalFilter> fili = mView->filters();
1813 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1816 CalFilter *curfilter = mView->filterView()->selectedFilter();
1814 CalFilter *filter = fili.first(); 1817 CalFilter *filter = fili.first();
1815 int iii = 2; 1818 int iii = 2;
1816 while(filter) { 1819 while(filter) {
1817 selectFilterMenu->insertItem( filter->name(), iii ); 1820 selectFilterMenu->insertItem( filter->name(), iii );
1818 if ( filter == curfilter) 1821 if ( filter == curfilter)
1819 selectFilterMenu->setItemChecked( iii, true ); 1822 selectFilterMenu->setItemChecked( iii, true );
1820 if ( disable ) 1823 if ( disable )
1821 selectFilterMenu->setItemEnabled( iii, false ); 1824 selectFilterMenu->setItemEnabled( iii, false );
1822 filter = fili.next(); 1825 filter = fili.next();
1823 ++iii; 1826 ++iii;
1824 } 1827 }
1825} 1828}
1826void MainWindow::selectFilter( int fil ) 1829void MainWindow::selectFilter( int fil )
1827{ 1830{
1828 if ( fil == 0 ) { 1831 if ( fil == 0 ) {
1829 mView->editFilters( ); 1832 mView->editFilters( );
1830 } else if ( fil == 1 ){ 1833 } else if ( fil == 1 ){
1831 mView->toggleFilerEnabled( ); 1834 mView->toggleFilerEnabled( );
1832 } else { 1835 } else {
1833 mView->selectFilter( fil-2 ); 1836 mView->selectFilter( fil-2 );
1834 } 1837 }
1835} 1838}
1836void MainWindow::configureToolBar( int item ) 1839void MainWindow::configureToolBar( int item )
1837{ 1840{
1838 1841
1839 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1842 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1840 KOPrefs *p = KOPrefs::instance(); 1843 KOPrefs *p = KOPrefs::instance();
1841 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1844 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1842 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1845 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1843 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1846 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1844 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1847 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1845 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1848 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1846 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1849 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1847 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1850 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
@@ -2040,96 +2043,108 @@ void MainWindow::exportVCalendar()
2040 if ( createbup ) { 2043 if ( createbup ) {
2041 if ( mView->exportVCalendar( fn ) ) { 2044 if ( mView->exportVCalendar( fn ) ) {
2042 KOPrefs::instance()->mLastVcalFile = fn; 2045 KOPrefs::instance()->mLastVcalFile = fn;
2043 if ( fn.length() > 20 ) 2046 if ( fn.length() > 20 )
2044 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2047 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2045 else 2048 else
2046 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2049 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2047 setCaption(mes); 2050 setCaption(mes);
2048 } 2051 }
2049 } 2052 }
2050 2053
2051} 2054}
2052QString MainWindow::sentSyncFile() 2055QString MainWindow::sentSyncFile()
2053{ 2056{
2054#ifdef DESKTOP_VERSION 2057#ifdef DESKTOP_VERSION
2055 return locateLocal( "tmp", "copysynccal.ics" ); 2058 return locateLocal( "tmp", "copysynccal.ics" );
2056#else 2059#else
2057 return QString( "/tmp/copysynccal.ics" ); 2060 return QString( "/tmp/copysynccal.ics" );
2058#endif 2061#endif
2059} 2062}
2060 2063
2061void MainWindow::syncFileRequest() 2064void MainWindow::syncFileRequest()
2062{ 2065{
2063 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2066 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2064 mSyncManager->slotSyncMenu( 999 ); 2067 mSyncManager->slotSyncMenu( 999 );
2065 } 2068 }
2066 2069
2067 setCaption(i18n("Saving Data to temp file ..." )); 2070 setCaption(i18n("Saving Data to temp file ..." ));
2068 mView->saveCalendar( sentSyncFile() ); 2071 mView->saveCalendar( sentSyncFile() );
2069 setCaption(i18n("Data saved to temp file!" )); 2072 setCaption(i18n("Data saved to temp file!" ));
2070 2073
2071} 2074}
2072void MainWindow::getFile( bool success ) 2075void MainWindow::getFile( bool success )
2073{ 2076{
2074 if ( ! success ) { 2077 if ( ! success ) {
2075 setCaption( i18n("Error receiving file. Nothing changed!") ); 2078 setCaption( i18n("Error receiving file. Nothing changed!") );
2076 return; 2079 return;
2077 } 2080 }
2078 mView->openCalendar( sentSyncFile() ); 2081 mView->openCalendar( sentSyncFile() );
2079 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2082 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2080 mSyncManager->slotSyncMenu( 999 ); 2083 mSyncManager->slotSyncMenu( 999 );
2081 } 2084 }
2082 setCaption( i18n("Pi-Sync successful!") ); 2085 setCaption( i18n("Pi-Sync successful!") );
2083} 2086}
2084 2087
2085void MainWindow::printSel( ) 2088void MainWindow::printSel( )
2086{ 2089{
2087 mView->viewManager()->agendaView()->agenda()->printSelection(); 2090 mView->viewManager()->agendaView()->agenda()->printSelection();
2088} 2091}
2089 2092
2090void MainWindow::printCal() 2093void MainWindow::printCal()
2091{ 2094{
2092 mView->print();//mCp->showDialog(); 2095 mView->print();//mCp->showDialog();
2093} 2096}
2094 2097
2095 2098
2096#include "libkdepim/kdatepicker.h" 2099#include "libkdepim/kdatepicker.h"
2097#include <kdatetbl.h> 2100#include <kdatetbl.h>
2098void MainWindow::weekAction() 2101void MainWindow::weekAction()
2099{ 2102{
2100 int month; 2103 int month;
2101 KPopupFrame* popup = new KPopupFrame(this); 2104 KPopupFrame* popup = new KPopupFrame(this);
2102 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2105 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2103 // ----- 2106 // -----
2104 picker->resize(picker->sizeHint()); 2107 picker->resize(picker->sizeHint());
2105 popup->setMainWidget(picker); 2108 popup->setMainWidget(picker);
2106 picker->setFocus(); 2109 picker->setFocus();
2107 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2110 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2108 int x = 0; 2111 int x = 0;
2109 int y = iconToolBar->height(); 2112 int y = iconToolBar->height();
2110 int dX = 0; 2113 int dX = 0;
2111 int dY = 0; 2114 int dY = 0;
2112 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2115 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2113 if ( iconToolBar->y() > height()/2 ) { 2116 if ( iconToolBar->y() > height()/2 ) {
2114 dY = picker->sizeHint().height()+8; 2117 dY = picker->sizeHint().height()+8;
2115 y = 0; 2118 y = 0;
2116 } 2119 }
2117 } else { 2120 } else {
2118 if ( iconToolBar->x() > width()/2 ) { // right side 2121 if ( iconToolBar->x() > width()/2 ) { // right side
2119 x=0; 2122 x=0;
2120 dX= picker->sizeHint().width()+8; 2123 dX= picker->sizeHint().width()+8;
2121 y = 0; 2124 y = 0;
2122 } else { 2125 } else {
2123 x= iconToolBar->width(); 2126 x= iconToolBar->width();
2124 y = 0; 2127 y = 0;
2125 } 2128 }
2126 } 2129 }
2127 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2130 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2128 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2131 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2129 { 2132 {
2130 month = picker->getResult(); 2133 month = picker->getResult();
2131 emit selectWeek ( month ); 2134 emit selectWeek ( month );
2132 //qDebug("weekSelected %d ", month); 2135 //qDebug("weekSelected %d ", month);
2133 } 2136 }
2134 delete popup; 2137 delete popup;
2135} 2138}
2139
2140void MainWindow::hideEvent ( QHideEvent * )
2141{
2142 QString message;
2143 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2144 if ( nextA.isValid() ) {
2145 QString sum = mCalendar->nextSummary();
2146
2147 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2148 setCaption( message );
2149 }
2150}