-rw-r--r-- | korganizer/mainwindow.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 877b6f2..145b36c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -539,100 +539,110 @@ void MainWindow::initActions() | |||
539 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 539 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
540 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 540 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
541 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 541 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
542 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 542 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
543 | menuBar->insertItem( i18n("Help"), helpMenu ); | 543 | menuBar->insertItem( i18n("Help"), helpMenu ); |
544 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 544 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
545 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 545 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
546 | } | 546 | } |
547 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 547 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
548 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 548 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
549 | 549 | ||
550 | // ****************** | 550 | // ****************** |
551 | QAction *action; | 551 | QAction *action; |
552 | QIconSet icon; | 552 | QIconSet icon; |
553 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 553 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
554 | configureToolBarMenu->setCheckable( true ); | 554 | configureToolBarMenu->setCheckable( true ); |
555 | 555 | ||
556 | QString pathString = ""; | 556 | QString pathString = ""; |
557 | if ( !p->mToolBarMiniIcons ) { | 557 | if ( !p->mToolBarMiniIcons ) { |
558 | if ( QApplication::desktop()->width() < 480 ) | 558 | if ( QApplication::desktop()->width() < 480 ) |
559 | pathString += "icons16/"; | 559 | pathString += "icons16/"; |
560 | } else | 560 | } else |
561 | pathString += "iconsmini/"; | 561 | pathString += "iconsmini/"; |
562 | configureAgendaMenu->setCheckable( true ); | 562 | configureAgendaMenu->setCheckable( true ); |
563 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 563 | int iii ; |
564 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 564 | for ( iii = 1;iii<= 10 ;++iii ){ |
565 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 565 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
566 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 566 | } |
567 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | ||
568 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | ||
569 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | ||
570 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | ||
571 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 567 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
572 | 568 | ||
569 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | ||
570 | this, SLOT( showConfigureAgenda( ) ) ); | ||
571 | |||
573 | icon = loadPixmap( pathString + "configure" ); | 572 | icon = loadPixmap( pathString + "configure" ); |
574 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 573 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
575 | action->addTo( actionMenu ); | 574 | action->addTo( actionMenu ); |
576 | connect( action, SIGNAL( activated() ), | 575 | connect( action, SIGNAL( activated() ), |
577 | mView, SLOT( edit_options() ) ); | 576 | mView, SLOT( edit_options() ) ); |
578 | actionMenu->insertSeparator(); | 577 | actionMenu->insertSeparator(); |
579 | 578 | ||
580 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 579 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
581 | action->addTo( actionMenu ); | 580 | action->addTo( actionMenu ); |
582 | connect( action, SIGNAL( activated() ), | 581 | connect( action, SIGNAL( activated() ), |
583 | mView, SLOT( undo_delete() ) ); | 582 | mView, SLOT( undo_delete() ) ); |
584 | actionMenu->insertSeparator(); | 583 | actionMenu->insertSeparator(); |
585 | 584 | ||
586 | icon = loadPixmap( pathString + "newevent" ); | 585 | icon = loadPixmap( pathString + "newevent" ); |
587 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 586 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
588 | configureToolBarMenu->insertSeparator(); | 587 | configureToolBarMenu->insertSeparator(); |
589 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 588 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
590 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 589 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
591 | ne_action->addTo( actionMenu ); | 590 | ne_action->addTo( actionMenu ); |
592 | connect( ne_action, SIGNAL( activated() ), | 591 | connect( ne_action, SIGNAL( activated() ), |
593 | mView, SLOT( newEvent() ) ); | 592 | mView, SLOT( newEvent() ) ); |
594 | icon = loadPixmap( pathString + "newtodo" ); | 593 | icon = loadPixmap( pathString + "newtodo" ); |
595 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 594 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
596 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 595 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
597 | nt_action->addTo( actionMenu ); | 596 | nt_action->addTo( actionMenu ); |
598 | connect( nt_action, SIGNAL( activated() ), | 597 | connect( nt_action, SIGNAL( activated() ), |
599 | mView, SLOT( newTodo() ) ); | 598 | mView, SLOT( newTodo() ) ); |
600 | icon = loadPixmap( pathString + "navi" ); | 599 | icon = loadPixmap( pathString + "navi" ); |
601 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 600 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
602 | action->addTo( viewMenu ); | 601 | action->addTo( viewMenu ); |
603 | connect( action, SIGNAL( activated() ), | 602 | connect( action, SIGNAL( activated() ), |
604 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 603 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
604 | mToggleNav = action ; | ||
605 | icon = loadPixmap( pathString + "filter" ); | 605 | icon = loadPixmap( pathString + "filter" ); |
606 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 606 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
607 | action->addTo( viewMenu ); | 607 | action->addTo( viewMenu ); |
608 | connect( action, SIGNAL( activated() ), | 608 | connect( action, SIGNAL( activated() ), |
609 | mView, SLOT( toggleFilter() ) ); | 609 | mView, SLOT( toggleFilter() ) ); |
610 | mToggleFilter = action; | ||
610 | icon = loadPixmap( pathString + "allday" ); | 611 | icon = loadPixmap( pathString + "allday" ); |
611 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 612 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
612 | action->addTo( viewMenu ); | 613 | action->addTo( viewMenu ); |
613 | connect( action, SIGNAL( activated() ), | 614 | connect( action, SIGNAL( activated() ), |
614 | mView, SLOT( toggleAllDaySize() ) ); | 615 | mView, SLOT( toggleAllDaySize() ) ); |
616 | mToggleAllday = action; | ||
617 | |||
618 | |||
619 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | ||
620 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | ||
621 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | ||
622 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | ||
623 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | ||
624 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | ||
615 | 625 | ||
616 | viewMenu->insertSeparator(); | 626 | viewMenu->insertSeparator(); |
617 | icon = loadPixmap( pathString + "picker" ); | 627 | icon = loadPixmap( pathString + "picker" ); |
618 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 628 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
619 | action->addTo( viewMenu ); | 629 | action->addTo( viewMenu ); |
620 | connect( action, SIGNAL( activated() ), | 630 | connect( action, SIGNAL( activated() ), |
621 | mView, SLOT( showDatePicker() ) ); | 631 | mView, SLOT( showDatePicker() ) ); |
622 | action->addTo( iconToolBar ); | 632 | action->addTo( iconToolBar ); |
623 | viewMenu->insertSeparator(); | 633 | viewMenu->insertSeparator(); |
624 | icon = loadPixmap( pathString + "list" ); | 634 | icon = loadPixmap( pathString + "list" ); |
625 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 635 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
626 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 636 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
627 | showlist_action->addTo( viewMenu ); | 637 | showlist_action->addTo( viewMenu ); |
628 | connect( showlist_action, SIGNAL( activated() ), | 638 | connect( showlist_action, SIGNAL( activated() ), |
629 | mView->viewManager(), SLOT( showListView() ) ); | 639 | mView->viewManager(), SLOT( showListView() ) ); |
630 | 640 | ||
631 | 641 | ||
632 | icon = loadPixmap( pathString + "day" ); | 642 | icon = loadPixmap( pathString + "day" ); |
633 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 643 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
634 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 644 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
635 | day1_action->addTo( viewMenu ); | 645 | day1_action->addTo( viewMenu ); |
636 | // action->addTo( toolBar ); | 646 | // action->addTo( toolBar ); |
637 | connect( day1_action, SIGNAL( activated() ), | 647 | connect( day1_action, SIGNAL( activated() ), |
638 | mView->viewManager(), SLOT( showDayView() ) ); | 648 | mView->viewManager(), SLOT( showDayView() ) ); |
@@ -1699,66 +1709,61 @@ void MainWindow::configureToolBar( int item ) | |||
1699 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1709 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1700 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1710 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1701 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1711 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1702 | // initActions(); | 1712 | // initActions(); |
1703 | } | 1713 | } |
1704 | 1714 | ||
1705 | void MainWindow::setCaptionToDates() | 1715 | void MainWindow::setCaptionToDates() |
1706 | { | 1716 | { |
1707 | QString selDates; | 1717 | QString selDates; |
1708 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1718 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1709 | if (mView->startDate() < mView->endDate() ) | 1719 | if (mView->startDate() < mView->endDate() ) |
1710 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1720 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1711 | else { | 1721 | else { |
1712 | QString addString; | 1722 | QString addString; |
1713 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1723 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) |
1714 | addString = i18n("Today"); | 1724 | addString = i18n("Today"); |
1715 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1725 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) |
1716 | addString = i18n("Tomorrow"); | 1726 | addString = i18n("Tomorrow"); |
1717 | if ( !addString.isEmpty() ) | 1727 | if ( !addString.isEmpty() ) |
1718 | selDates = addString+", "+selDates ; | 1728 | selDates = addString+", "+selDates ; |
1719 | } | 1729 | } |
1720 | setCaption( i18n("Dates: ") + selDates ); | 1730 | setCaption( i18n("Dates: ") + selDates ); |
1721 | 1731 | ||
1722 | } | 1732 | } |
1723 | // parameter item == 0: reinit | 1733 | void MainWindow::showConfigureAgenda( ) |
1734 | { | ||
1735 | int iii; | ||
1736 | for ( iii = 1;iii<= 10 ;++iii ){ | ||
1737 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | ||
1738 | } | ||
1739 | configureAgendaMenu->setItemChecked( KOPrefs::instance()->mHourSize, true ); | ||
1740 | } | ||
1724 | void MainWindow::configureAgenda( int item ) | 1741 | void MainWindow::configureAgenda( int item ) |
1725 | { | 1742 | { |
1726 | 1743 | if ( KOPrefs::instance()->mHourSize == item ) | |
1727 | KOPrefs *p = KOPrefs::instance(); | ||
1728 | |||
1729 | int i; | ||
1730 | // do not allow 4 for widgets higher than 480 | ||
1731 | // if ( QApplication::desktop()->height() > 480 ) { | ||
1732 | // if ( item == 4 ) | ||
1733 | // item = 6; | ||
1734 | // } | ||
1735 | for ( i = 4; i <= 18; i= i+2 ) | ||
1736 | configureAgendaMenu->setItemChecked( i, false ); | ||
1737 | configureAgendaMenu->setItemChecked( item, true ); | ||
1738 | if ( p->mHourSize == item ) | ||
1739 | return; | 1744 | return; |
1740 | p->mHourSize=item; | 1745 | KOPrefs::instance()->mHourSize=item; |
1741 | mView->viewManager()->agendaView()->updateConfig(); | 1746 | mView->viewManager()->agendaView()->updateConfig(); |
1742 | } | 1747 | } |
1743 | 1748 | ||
1744 | void MainWindow::saveCalendar() | 1749 | void MainWindow::saveCalendar() |
1745 | { | 1750 | { |
1746 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1751 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1747 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1752 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1748 | 1753 | ||
1749 | if ( fn == "" ) | 1754 | if ( fn == "" ) |
1750 | return; | 1755 | return; |
1751 | QFileInfo info; | 1756 | QFileInfo info; |
1752 | info.setFile( fn ); | 1757 | info.setFile( fn ); |
1753 | QString mes; | 1758 | QString mes; |
1754 | bool createbup = true; | 1759 | bool createbup = true; |
1755 | if ( info. exists() ) { | 1760 | if ( info. exists() ) { |
1756 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1761 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1757 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1762 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1758 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1763 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1759 | 0, 1 ); | 1764 | 0, 1 ); |
1760 | if ( result != 0 ) { | 1765 | if ( result != 0 ) { |
1761 | createbup = false; | 1766 | createbup = false; |
1762 | } | 1767 | } |
1763 | } | 1768 | } |
1764 | if ( createbup ) { | 1769 | if ( createbup ) { |