-rw-r--r-- | korganizer/mainwindow.cpp | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5d26d35..88dbd4f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -777,76 +777,78 @@ void MainWindow::initActions() | |||
777 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 777 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
778 | search_action->addTo( actionMenu ); | 778 | search_action->addTo( actionMenu ); |
779 | connect( search_action, SIGNAL( activated() ), | 779 | connect( search_action, SIGNAL( activated() ), |
780 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 780 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
781 | 781 | ||
782 | actionMenu->insertSeparator(); | 782 | actionMenu->insertSeparator(); |
783 | 783 | ||
784 | 784 | ||
785 | 785 | ||
786 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 786 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
787 | action->addTo( mCurrentItemMenu ); | 787 | action->addTo( mCurrentItemMenu ); |
788 | connect( action, SIGNAL( activated() ), | 788 | connect( action, SIGNAL( activated() ), |
789 | mView, SLOT( undo_delete() ) ); | 789 | mView, SLOT( undo_delete() ) ); |
790 | mCurrentItemMenu->insertSeparator(); | 790 | mCurrentItemMenu->insertSeparator(); |
791 | icon = loadPixmap( pathString + "newevent" ); | 791 | icon = loadPixmap( pathString + "newevent" ); |
792 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 792 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
793 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 793 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
794 | configureToolBarMenu->insertSeparator(); | 794 | configureToolBarMenu->insertSeparator(); |
795 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 795 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
796 | configureToolBarMenu->insertSeparator(); | 796 | configureToolBarMenu->insertSeparator(); |
797 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 797 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
798 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 798 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
799 | 799 | ||
800 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); | 800 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); |
801 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 801 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); |
802 | mShowAction->addTo( mCurrentItemMenu ); | 802 | mShowAction->addTo( mCurrentItemMenu ); |
803 | connect( mShowAction, SIGNAL( activated() ), | 803 | connect( mShowAction, SIGNAL( activated() ), |
804 | mView, SLOT( showIncidence() ) ); | 804 | mView, SLOT( showIncidence() ) ); |
805 | 805 | ||
806 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 806 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
807 | mEditAction->addTo( mCurrentItemMenu ); | 807 | mEditAction->addTo( mCurrentItemMenu ); |
808 | connect( mEditAction, SIGNAL( activated() ), | 808 | connect( mEditAction, SIGNAL( activated() ), |
809 | mView, SLOT( editIncidence() ) ); | 809 | mView, SLOT( editIncidence() ) ); |
810 | 810 | ||
811 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 811 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
812 | mDeleteAction->addTo( mCurrentItemMenu ); | 812 | mDeleteAction->addTo( mCurrentItemMenu ); |
813 | connect( mDeleteAction, SIGNAL( activated() ), | 813 | connect( mDeleteAction, SIGNAL( activated() ), |
814 | mView, SLOT( deleteIncidence() ) ); | 814 | mView, SLOT( deleteIncidence() ) ); |
815 | 815 | ||
816 | 816 | ||
817 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 817 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
818 | mCloneAction->addTo( mCurrentItemMenu ); | 818 | mCloneAction->addTo( mCurrentItemMenu ); |
819 | connect( mCloneAction, SIGNAL( activated() ), | 819 | connect( mCloneAction, SIGNAL( activated() ), |
820 | mView, SLOT( cloneIncidence() ) ); | 820 | mView, SLOT( cloneIncidence() ) ); |
821 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 821 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
822 | mMoveAction->addTo( mCurrentItemMenu ); | 822 | mMoveAction->addTo( mCurrentItemMenu ); |
823 | connect( mMoveAction, SIGNAL( activated() ), | 823 | connect( mMoveAction, SIGNAL( activated() ), |
824 | mView, SLOT( moveIncidence() ) ); | 824 | mView, SLOT( moveIncidence() ) ); |
825 | #ifndef DESKTOP_VERSION | ||
825 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 826 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
826 | mBeamAction->addTo(mCurrentItemMenu ); | 827 | mBeamAction->addTo(mCurrentItemMenu ); |
827 | connect( mBeamAction, SIGNAL( activated() ), | 828 | connect( mBeamAction, SIGNAL( activated() ), |
828 | mView, SLOT( beamIncidence() ) ); | 829 | mView, SLOT( beamIncidence() ) ); |
830 | #endif | ||
829 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 831 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
830 | mCancelAction->addTo( mCurrentItemMenu ); | 832 | mCancelAction->addTo( mCurrentItemMenu ); |
831 | connect( mCancelAction, SIGNAL( activated() ), | 833 | connect( mCancelAction, SIGNAL( activated() ), |
832 | mView, SLOT( toggleCancelIncidence() ) ); | 834 | mView, SLOT( toggleCancelIncidence() ) ); |
833 | 835 | ||
834 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 836 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
835 | ne_action->addTo( actionMenu ); | 837 | ne_action->addTo( actionMenu ); |
836 | connect( ne_action, SIGNAL( activated() ), | 838 | connect( ne_action, SIGNAL( activated() ), |
837 | mView, SLOT( newEvent() ) ); | 839 | mView, SLOT( newEvent() ) ); |
838 | icon = loadPixmap( pathString + "newtodo" ); | 840 | icon = loadPixmap( pathString + "newtodo" ); |
839 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 841 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
840 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 842 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
841 | nt_action->addTo( actionMenu ); | 843 | nt_action->addTo( actionMenu ); |
842 | connect( nt_action, SIGNAL( activated() ), | 844 | connect( nt_action, SIGNAL( activated() ), |
843 | mView, SLOT( newTodo() ) ); | 845 | mView, SLOT( newTodo() ) ); |
844 | 846 | ||
845 | 847 | ||
846 | 848 | ||
847 | // *********************** | 849 | // *********************** |
848 | if ( KOPrefs::instance()->mVerticalScreen ) { | 850 | if ( KOPrefs::instance()->mVerticalScreen ) { |
849 | icon = SmallIcon( "1updownarrow" ); | 851 | icon = SmallIcon( "1updownarrow" ); |
850 | } else { | 852 | } else { |
851 | icon = SmallIcon("1leftrightarrow" ); | 853 | icon = SmallIcon("1leftrightarrow" ); |
852 | } | 854 | } |
@@ -1626,128 +1628,110 @@ QString MainWindow::syncFileName() | |||
1626 | #else | 1628 | #else |
1627 | return QString( "/tmp/synccalendar.ics" ); | 1629 | return QString( "/tmp/synccalendar.ics" ); |
1628 | #endif | 1630 | #endif |
1629 | } | 1631 | } |
1630 | #include "koglobals.h" | 1632 | #include "koglobals.h" |
1631 | #include <kcalendarsystem.h> | 1633 | #include <kcalendarsystem.h> |
1632 | void MainWindow::updateWeek(QDate seda) | 1634 | void MainWindow::updateWeek(QDate seda) |
1633 | { | 1635 | { |
1634 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1636 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1635 | mWeekPixmap.fill( mWeekBgColor ); | 1637 | mWeekPixmap.fill( mWeekBgColor ); |
1636 | QPainter p ( &mWeekPixmap ); | 1638 | QPainter p ( &mWeekPixmap ); |
1637 | p.setFont( mWeekFont ); | 1639 | p.setFont( mWeekFont ); |
1638 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1640 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1639 | p.end(); | 1641 | p.end(); |
1640 | QIconSet icon3 ( mWeekPixmap ); | 1642 | QIconSet icon3 ( mWeekPixmap ); |
1641 | mWeekAction->setIconSet ( icon3 ); | 1643 | mWeekAction->setIconSet ( icon3 ); |
1642 | 1644 | ||
1643 | } | 1645 | } |
1644 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1646 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1645 | { | 1647 | { |
1646 | updateWeek( selectedDates.first() ); | 1648 | updateWeek( selectedDates.first() ); |
1647 | } | 1649 | } |
1648 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1650 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1649 | { | 1651 | { |
1650 | |||
1651 | if ( !incidence ) { | 1652 | if ( !incidence ) { |
1653 | mShowAction->setMenuText( i18n("Show") ); | ||
1652 | enableIncidenceActions( false ); | 1654 | enableIncidenceActions( false ); |
1653 | |||
1654 | mNewSubTodoAction->setEnabled( false ); | 1655 | mNewSubTodoAction->setEnabled( false ); |
1655 | setCaptionToDates(); | 1656 | setCaptionToDates(); |
1656 | return; | 1657 | return; |
1657 | |||
1658 | } | 1658 | } |
1659 | |||
1660 | //KGlobal::locale()->formatDateTime(nextA, true); | ||
1661 | QString startString = ""; | 1659 | QString startString = ""; |
1662 | if ( incidence->typeID() != todoID ) { | 1660 | if ( incidence->typeID() != todoID ) { |
1663 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1661 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1664 | if ( incidence->doesFloat() ) { | 1662 | if ( incidence->doesFloat() ) { |
1665 | startString += ": "+incidence->dtStartDateStr( true ); | 1663 | startString += ": "+incidence->dtStartDateStr( true ); |
1666 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1664 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1667 | |||
1668 | } else { | 1665 | } else { |
1669 | startString = ": "+incidence->dtStartStr(true); | 1666 | startString = ": "+incidence->dtStartStr(true); |
1670 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1667 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1671 | |||
1672 | } | 1668 | } |
1673 | |||
1674 | } else { | 1669 | } else { |
1675 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1670 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1676 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1671 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1677 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1672 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1678 | |||
1679 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1673 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1680 | bool ok; | 1674 | bool ok; |
1681 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1675 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1682 | if ( ok ) { | 1676 | if ( ok ) { |
1683 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1677 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1684 | startString += i18n(" (%1 y.)"). arg( years ); | 1678 | startString += i18n(" (%1 y.)"). arg( years ); |
1685 | } | 1679 | } |
1686 | } | 1680 | } |
1687 | else | 1681 | else |
1688 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1682 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1689 | } | 1683 | } |
1690 | |||
1691 | } | 1684 | } |
1692 | else | 1685 | else |
1693 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1686 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1694 | if ( !incidence->location().isEmpty() ) | 1687 | if ( !incidence->location().isEmpty() ) |
1695 | startString += " (" +incidence->location()+")"; | 1688 | startString += " (" +incidence->location()+")"; |
1696 | setCaption( incidence->summary()+startString); | 1689 | setCaption( incidence->summary()+startString); |
1697 | |||
1698 | enableIncidenceActions( true ); | 1690 | enableIncidenceActions( true ); |
1699 | |||
1700 | if ( incidence->typeID() == eventID ) { | 1691 | if ( incidence->typeID() == eventID ) { |
1701 | mShowAction->setText( i18n("Show Event...") ); | 1692 | mShowAction->setMenuText( i18n("Show Event") ); |
1702 | mEditAction->setText( i18n("Edit Event...") ); | ||
1703 | mDeleteAction->setText( i18n("Delete Event...") ); | ||
1704 | |||
1705 | mNewSubTodoAction->setEnabled( false ); | 1693 | mNewSubTodoAction->setEnabled( false ); |
1706 | } else if ( incidence->typeID() == todoID ) { | 1694 | } else if ( incidence->typeID() == todoID ) { |
1707 | mShowAction->setText( i18n("Show Todo...") ); | 1695 | mShowAction->setMenuText( i18n("Show Todo") ); |
1708 | mEditAction->setText( i18n("Edit Todo...") ); | ||
1709 | mDeleteAction->setText( i18n("Delete Todo...") ); | ||
1710 | |||
1711 | mNewSubTodoAction->setEnabled( true ); | 1696 | mNewSubTodoAction->setEnabled( true ); |
1712 | } else { | 1697 | } else { |
1713 | mShowAction->setText( i18n("Show...") ); | 1698 | mShowAction->setMenuText( i18n("Show") ); |
1714 | mShowAction->setText( i18n("Edit...") ); | ||
1715 | mShowAction->setText( i18n("Delete...") ); | ||
1716 | |||
1717 | mNewSubTodoAction->setEnabled( false ); | 1699 | mNewSubTodoAction->setEnabled( false ); |
1718 | } | 1700 | } |
1719 | } | 1701 | } |
1720 | 1702 | ||
1721 | void MainWindow::enableIncidenceActions( bool enabled ) | 1703 | void MainWindow::enableIncidenceActions( bool enabled ) |
1722 | { | 1704 | { |
1723 | mShowAction->setEnabled( enabled ); | 1705 | mShowAction->setEnabled( enabled ); |
1724 | mEditAction->setEnabled( enabled ); | 1706 | mEditAction->setEnabled( enabled ); |
1725 | mDeleteAction->setEnabled( enabled ); | 1707 | mDeleteAction->setEnabled( enabled ); |
1726 | 1708 | ||
1727 | mCloneAction->setEnabled( enabled ); | 1709 | mCloneAction->setEnabled( enabled ); |
1728 | mMoveAction->setEnabled( enabled ); | 1710 | mMoveAction->setEnabled( enabled ); |
1711 | #ifndef DESKTOP_VERSION | ||
1729 | mBeamAction->setEnabled( enabled ); | 1712 | mBeamAction->setEnabled( enabled ); |
1713 | #endif | ||
1730 | mCancelAction->setEnabled( enabled ); | 1714 | mCancelAction->setEnabled( enabled ); |
1731 | } | 1715 | } |
1732 | 1716 | ||
1733 | void MainWindow::importOL() | 1717 | void MainWindow::importOL() |
1734 | { | 1718 | { |
1735 | #ifdef _OL_IMPORT_ | 1719 | #ifdef _OL_IMPORT_ |
1736 | mView->clearAllViews(); | 1720 | mView->clearAllViews(); |
1737 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1721 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1738 | id->exec(); | 1722 | id->exec(); |
1739 | delete id; | 1723 | delete id; |
1740 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1724 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1741 | mView->updateView(); | 1725 | mView->updateView(); |
1742 | #endif | 1726 | #endif |
1743 | } | 1727 | } |
1744 | void MainWindow::importBday() | 1728 | void MainWindow::importBday() |
1745 | { | 1729 | { |
1746 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1730 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1747 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1731 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1748 | i18n("Import!"), i18n("Cancel"), 0, | 1732 | i18n("Import!"), i18n("Cancel"), 0, |
1749 | 0, 1 ); | 1733 | 0, 1 ); |
1750 | if ( result == 0 ) { | 1734 | if ( result == 0 ) { |
1751 | mView->importBday(); | 1735 | mView->importBday(); |
1752 | 1736 | ||
1753 | } | 1737 | } |