author | zautrix <zautrix> | 2004-08-06 15:59:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-06 15:59:14 (UTC) |
commit | f3307379ea27ad1394c9107c0129ecd3efd6bca6 (patch) (unidiff) | |
tree | fdfebbebf84b2e86812165fac2bec09f95008ee2 /korganizer | |
parent | fc862590cffbef8429bb8804dadfa61a21a52c7b (diff) | |
download | kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.zip kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.tar.gz kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.tar.bz2 |
Added qick filter selection to kopi menu
-rw-r--r-- | korganizer/calendarview.cpp | 9 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 47 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 3 |
4 files changed, 59 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 53c079c..fab4540 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1625,1874 +1625,1883 @@ void CalendarView::writeSettings() | |||
1625 | 1625 | ||
1626 | config->setGroup( "Views" ); | 1626 | config->setGroup( "Views" ); |
1627 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1627 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1628 | 1628 | ||
1629 | #ifdef DESKTOP_VERSION | 1629 | #ifdef DESKTOP_VERSION |
1630 | config->setGroup("WidgetLayout"); | 1630 | config->setGroup("WidgetLayout"); |
1631 | QStringList list ;//= config->readListEntry("MainLayout"); | 1631 | QStringList list ;//= config->readListEntry("MainLayout"); |
1632 | int x,y,w,h; | 1632 | int x,y,w,h; |
1633 | QWidget* wid; | 1633 | QWidget* wid; |
1634 | wid = topLevelWidget(); | 1634 | wid = topLevelWidget(); |
1635 | x = wid->geometry().x(); | 1635 | x = wid->geometry().x(); |
1636 | y = wid->geometry().y(); | 1636 | y = wid->geometry().y(); |
1637 | w = wid->width(); | 1637 | w = wid->width(); |
1638 | h = wid->height(); | 1638 | h = wid->height(); |
1639 | list.clear(); | 1639 | list.clear(); |
1640 | list << QString::number( x ); | 1640 | list << QString::number( x ); |
1641 | list << QString::number( y ); | 1641 | list << QString::number( y ); |
1642 | list << QString::number( w ); | 1642 | list << QString::number( w ); |
1643 | list << QString::number( h ); | 1643 | list << QString::number( h ); |
1644 | config->writeEntry("MainLayout",list ); | 1644 | config->writeEntry("MainLayout",list ); |
1645 | 1645 | ||
1646 | wid = mEventEditor; | 1646 | wid = mEventEditor; |
1647 | x = wid->geometry().x(); | 1647 | x = wid->geometry().x(); |
1648 | y = wid->geometry().y(); | 1648 | y = wid->geometry().y(); |
1649 | w = wid->width(); | 1649 | w = wid->width(); |
1650 | h = wid->height(); | 1650 | h = wid->height(); |
1651 | list.clear(); | 1651 | list.clear(); |
1652 | list << QString::number( x ); | 1652 | list << QString::number( x ); |
1653 | list << QString::number( y ); | 1653 | list << QString::number( y ); |
1654 | list << QString::number( w ); | 1654 | list << QString::number( w ); |
1655 | list << QString::number( h ); | 1655 | list << QString::number( h ); |
1656 | config->writeEntry("EditEventLayout",list ); | 1656 | config->writeEntry("EditEventLayout",list ); |
1657 | 1657 | ||
1658 | wid = mTodoEditor; | 1658 | wid = mTodoEditor; |
1659 | x = wid->geometry().x(); | 1659 | x = wid->geometry().x(); |
1660 | y = wid->geometry().y(); | 1660 | y = wid->geometry().y(); |
1661 | w = wid->width(); | 1661 | w = wid->width(); |
1662 | h = wid->height(); | 1662 | h = wid->height(); |
1663 | list.clear(); | 1663 | list.clear(); |
1664 | list << QString::number( x ); | 1664 | list << QString::number( x ); |
1665 | list << QString::number( y ); | 1665 | list << QString::number( y ); |
1666 | list << QString::number( w ); | 1666 | list << QString::number( w ); |
1667 | list << QString::number( h ); | 1667 | list << QString::number( h ); |
1668 | config->writeEntry("EditTodoLayout",list ); | 1668 | config->writeEntry("EditTodoLayout",list ); |
1669 | wid = getEventViewerDialog(); | 1669 | wid = getEventViewerDialog(); |
1670 | x = wid->geometry().x(); | 1670 | x = wid->geometry().x(); |
1671 | y = wid->geometry().y(); | 1671 | y = wid->geometry().y(); |
1672 | w = wid->width(); | 1672 | w = wid->width(); |
1673 | h = wid->height(); | 1673 | h = wid->height(); |
1674 | list.clear(); | 1674 | list.clear(); |
1675 | list << QString::number( x ); | 1675 | list << QString::number( x ); |
1676 | list << QString::number( y ); | 1676 | list << QString::number( y ); |
1677 | list << QString::number( w ); | 1677 | list << QString::number( w ); |
1678 | list << QString::number( h ); | 1678 | list << QString::number( h ); |
1679 | config->writeEntry("ViewerLayout",list ); | 1679 | config->writeEntry("ViewerLayout",list ); |
1680 | wid = mDialogManager->getSearchDialog(); | 1680 | wid = mDialogManager->getSearchDialog(); |
1681 | if ( wid ) { | 1681 | if ( wid ) { |
1682 | x = wid->geometry().x(); | 1682 | x = wid->geometry().x(); |
1683 | y = wid->geometry().y(); | 1683 | y = wid->geometry().y(); |
1684 | w = wid->width(); | 1684 | w = wid->width(); |
1685 | h = wid->height(); | 1685 | h = wid->height(); |
1686 | list.clear(); | 1686 | list.clear(); |
1687 | list << QString::number( x ); | 1687 | list << QString::number( x ); |
1688 | list << QString::number( y ); | 1688 | list << QString::number( y ); |
1689 | list << QString::number( w ); | 1689 | list << QString::number( w ); |
1690 | list << QString::number( h ); | 1690 | list << QString::number( h ); |
1691 | config->writeEntry("SearchLayout",list ); | 1691 | config->writeEntry("SearchLayout",list ); |
1692 | } | 1692 | } |
1693 | #endif | 1693 | #endif |
1694 | 1694 | ||
1695 | 1695 | ||
1696 | config->sync(); | 1696 | config->sync(); |
1697 | } | 1697 | } |
1698 | 1698 | ||
1699 | void CalendarView::readFilterSettings(KConfig *config) | 1699 | void CalendarView::readFilterSettings(KConfig *config) |
1700 | { | 1700 | { |
1701 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 1701 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
1702 | 1702 | ||
1703 | mFilters.clear(); | 1703 | mFilters.clear(); |
1704 | 1704 | ||
1705 | config->setGroup("General"); | 1705 | config->setGroup("General"); |
1706 | QStringList filterList = config->readListEntry("CalendarFilters"); | 1706 | QStringList filterList = config->readListEntry("CalendarFilters"); |
1707 | 1707 | ||
1708 | QStringList::ConstIterator it = filterList.begin(); | 1708 | QStringList::ConstIterator it = filterList.begin(); |
1709 | QStringList::ConstIterator end = filterList.end(); | 1709 | QStringList::ConstIterator end = filterList.end(); |
1710 | while(it != end) { | 1710 | while(it != end) { |
1711 | // kdDebug() << " filter: " << (*it) << endl; | 1711 | // kdDebug() << " filter: " << (*it) << endl; |
1712 | 1712 | ||
1713 | CalFilter *filter; | 1713 | CalFilter *filter; |
1714 | filter = new CalFilter(*it); | 1714 | filter = new CalFilter(*it); |
1715 | config->setGroup("Filter_" + (*it)); | 1715 | config->setGroup("Filter_" + (*it)); |
1716 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 1716 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
1717 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 1717 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
1718 | filter->setCategoryList(config->readListEntry("CategoryList")); | 1718 | filter->setCategoryList(config->readListEntry("CategoryList")); |
1719 | mFilters.append(filter); | 1719 | mFilters.append(filter); |
1720 | 1720 | ||
1721 | ++it; | 1721 | ++it; |
1722 | } | 1722 | } |
1723 | 1723 | ||
1724 | if (mFilters.count() == 0) { | 1724 | if (mFilters.count() == 0) { |
1725 | CalFilter *filter = new CalFilter(i18n("Default")); | 1725 | CalFilter *filter = new CalFilter(i18n("Default")); |
1726 | mFilters.append(filter); | 1726 | mFilters.append(filter); |
1727 | } | 1727 | } |
1728 | mFilterView->updateFilters(); | 1728 | mFilterView->updateFilters(); |
1729 | config->setGroup("FilterView"); | 1729 | config->setGroup("FilterView"); |
1730 | 1730 | ||
1731 | mFilterView->blockSignals(true); | 1731 | mFilterView->blockSignals(true); |
1732 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 1732 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
1733 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 1733 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
1734 | mFilterView->blockSignals(false); | 1734 | mFilterView->blockSignals(false); |
1735 | // We do it manually to avoid it being done twice by the above calls | 1735 | // We do it manually to avoid it being done twice by the above calls |
1736 | updateFilter(); | 1736 | updateFilter(); |
1737 | } | 1737 | } |
1738 | 1738 | ||
1739 | void CalendarView::writeFilterSettings(KConfig *config) | 1739 | void CalendarView::writeFilterSettings(KConfig *config) |
1740 | { | 1740 | { |
1741 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 1741 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
1742 | 1742 | ||
1743 | QStringList filterList; | 1743 | QStringList filterList; |
1744 | 1744 | ||
1745 | CalFilter *filter = mFilters.first(); | 1745 | CalFilter *filter = mFilters.first(); |
1746 | while(filter) { | 1746 | while(filter) { |
1747 | // kdDebug() << " fn: " << filter->name() << endl; | 1747 | // kdDebug() << " fn: " << filter->name() << endl; |
1748 | filterList << filter->name(); | 1748 | filterList << filter->name(); |
1749 | config->setGroup("Filter_" + filter->name()); | 1749 | config->setGroup("Filter_" + filter->name()); |
1750 | config->writeEntry("Criteria",filter->criteria()); | 1750 | config->writeEntry("Criteria",filter->criteria()); |
1751 | config->writeEntry("CategoryList",filter->categoryList()); | 1751 | config->writeEntry("CategoryList",filter->categoryList()); |
1752 | filter = mFilters.next(); | 1752 | filter = mFilters.next(); |
1753 | } | 1753 | } |
1754 | config->setGroup("General"); | 1754 | config->setGroup("General"); |
1755 | config->writeEntry("CalendarFilters",filterList); | 1755 | config->writeEntry("CalendarFilters",filterList); |
1756 | 1756 | ||
1757 | config->setGroup("FilterView"); | 1757 | config->setGroup("FilterView"); |
1758 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1758 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1759 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1759 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | 1762 | ||
1763 | void CalendarView::goToday() | 1763 | void CalendarView::goToday() |
1764 | { | 1764 | { |
1765 | mNavigator->selectToday(); | 1765 | mNavigator->selectToday(); |
1766 | } | 1766 | } |
1767 | 1767 | ||
1768 | void CalendarView::goNext() | 1768 | void CalendarView::goNext() |
1769 | { | 1769 | { |
1770 | mNavigator->selectNext(); | 1770 | mNavigator->selectNext(); |
1771 | } | 1771 | } |
1772 | 1772 | ||
1773 | void CalendarView::goPrevious() | 1773 | void CalendarView::goPrevious() |
1774 | { | 1774 | { |
1775 | mNavigator->selectPrevious(); | 1775 | mNavigator->selectPrevious(); |
1776 | } | 1776 | } |
1777 | void CalendarView::goNextMonth() | 1777 | void CalendarView::goNextMonth() |
1778 | { | 1778 | { |
1779 | mNavigator->selectNextMonth(); | 1779 | mNavigator->selectNextMonth(); |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | void CalendarView::goPreviousMonth() | 1782 | void CalendarView::goPreviousMonth() |
1783 | { | 1783 | { |
1784 | mNavigator->selectPreviousMonth(); | 1784 | mNavigator->selectPreviousMonth(); |
1785 | } | 1785 | } |
1786 | void CalendarView::writeLocale() | 1786 | void CalendarView::writeLocale() |
1787 | { | 1787 | { |
1788 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 1788 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
1789 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 1789 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
1790 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 1790 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
1791 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 1791 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
1792 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1792 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1793 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 1793 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
1794 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 1794 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
1795 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 1795 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
1796 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 1796 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
1797 | KOPrefs::instance()->mDaylightsavingStart, | 1797 | KOPrefs::instance()->mDaylightsavingStart, |
1798 | KOPrefs::instance()->mDaylightsavingEnd ); | 1798 | KOPrefs::instance()->mDaylightsavingEnd ); |
1799 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); | 1799 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); |
1800 | } | 1800 | } |
1801 | void CalendarView::updateConfig() | 1801 | void CalendarView::updateConfig() |
1802 | { | 1802 | { |
1803 | writeLocale(); | 1803 | writeLocale(); |
1804 | if ( KOPrefs::instance()->mUseAppColors ) | 1804 | if ( KOPrefs::instance()->mUseAppColors ) |
1805 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 1805 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
1806 | emit configChanged(); | 1806 | emit configChanged(); |
1807 | mTodoList->updateConfig(); | 1807 | mTodoList->updateConfig(); |
1808 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 1808 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
1809 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1809 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1810 | // To make the "fill window" configurations work | 1810 | // To make the "fill window" configurations work |
1811 | //mViewManager->raiseCurrentView(); | 1811 | //mViewManager->raiseCurrentView(); |
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | 1814 | ||
1815 | void CalendarView::eventChanged(Event *event) | 1815 | void CalendarView::eventChanged(Event *event) |
1816 | { | 1816 | { |
1817 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 1817 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
1818 | //updateUnmanagedViews(); | 1818 | //updateUnmanagedViews(); |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | void CalendarView::eventAdded(Event *event) | 1821 | void CalendarView::eventAdded(Event *event) |
1822 | { | 1822 | { |
1823 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 1823 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
1824 | } | 1824 | } |
1825 | 1825 | ||
1826 | void CalendarView::eventToBeDeleted(Event *) | 1826 | void CalendarView::eventToBeDeleted(Event *) |
1827 | { | 1827 | { |
1828 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 1828 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
1829 | } | 1829 | } |
1830 | 1830 | ||
1831 | void CalendarView::eventDeleted() | 1831 | void CalendarView::eventDeleted() |
1832 | { | 1832 | { |
1833 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 1833 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
1834 | } | 1834 | } |
1835 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 1835 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
1836 | { | 1836 | { |
1837 | changeIncidenceDisplay((Incidence *)which, action); | 1837 | changeIncidenceDisplay((Incidence *)which, action); |
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 1840 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
1841 | { | 1841 | { |
1842 | updateUnmanagedViews(); | 1842 | updateUnmanagedViews(); |
1843 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 1843 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
1844 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 1844 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
1845 | mCalendar->checkAlarmForIncidence( 0, true ); | 1845 | mCalendar->checkAlarmForIncidence( 0, true ); |
1846 | if ( mEventViewerDialog ) | 1846 | if ( mEventViewerDialog ) |
1847 | mEventViewerDialog->hide(); | 1847 | mEventViewerDialog->hide(); |
1848 | } | 1848 | } |
1849 | else | 1849 | else |
1850 | mCalendar->checkAlarmForIncidence( which , false ); | 1850 | mCalendar->checkAlarmForIncidence( which , false ); |
1851 | } | 1851 | } |
1852 | 1852 | ||
1853 | // most of the changeEventDisplays() right now just call the view's | 1853 | // most of the changeEventDisplays() right now just call the view's |
1854 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 1854 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
1855 | void CalendarView::changeEventDisplay(Event *which, int action) | 1855 | void CalendarView::changeEventDisplay(Event *which, int action) |
1856 | { | 1856 | { |
1857 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 1857 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
1858 | changeIncidenceDisplay((Incidence *)which, action); | 1858 | changeIncidenceDisplay((Incidence *)which, action); |
1859 | mDateNavigator->updateView(); | 1859 | mDateNavigator->updateView(); |
1860 | //mDialogManager->updateSearchDialog(); | 1860 | //mDialogManager->updateSearchDialog(); |
1861 | 1861 | ||
1862 | if (which) { | 1862 | if (which) { |
1863 | // If there is an event view visible update the display | 1863 | // If there is an event view visible update the display |
1864 | mViewManager->currentView()->changeEventDisplay(which,action); | 1864 | mViewManager->currentView()->changeEventDisplay(which,action); |
1865 | // TODO: check, if update needed | 1865 | // TODO: check, if update needed |
1866 | // if (which->getTodoStatus()) { | 1866 | // if (which->getTodoStatus()) { |
1867 | mTodoList->updateView(); | 1867 | mTodoList->updateView(); |
1868 | // } | 1868 | // } |
1869 | } else { | 1869 | } else { |
1870 | mViewManager->currentView()->updateView(); | 1870 | mViewManager->currentView()->updateView(); |
1871 | } | 1871 | } |
1872 | } | 1872 | } |
1873 | 1873 | ||
1874 | 1874 | ||
1875 | void CalendarView::updateTodoViews() | 1875 | void CalendarView::updateTodoViews() |
1876 | { | 1876 | { |
1877 | 1877 | ||
1878 | mTodoList->updateView(); | 1878 | mTodoList->updateView(); |
1879 | mViewManager->currentView()->updateView(); | 1879 | mViewManager->currentView()->updateView(); |
1880 | 1880 | ||
1881 | } | 1881 | } |
1882 | 1882 | ||
1883 | 1883 | ||
1884 | void CalendarView::updateView(const QDate &start, const QDate &end) | 1884 | void CalendarView::updateView(const QDate &start, const QDate &end) |
1885 | { | 1885 | { |
1886 | mTodoList->updateView(); | 1886 | mTodoList->updateView(); |
1887 | mViewManager->updateView(start, end); | 1887 | mViewManager->updateView(start, end); |
1888 | //mDateNavigator->updateView(); | 1888 | //mDateNavigator->updateView(); |
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | void CalendarView::updateView() | 1891 | void CalendarView::updateView() |
1892 | { | 1892 | { |
1893 | DateList tmpList = mNavigator->selectedDates(); | 1893 | DateList tmpList = mNavigator->selectedDates(); |
1894 | 1894 | ||
1895 | // We assume that the navigator only selects consecutive days. | 1895 | // We assume that the navigator only selects consecutive days. |
1896 | updateView( tmpList.first(), tmpList.last() ); | 1896 | updateView( tmpList.first(), tmpList.last() ); |
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | void CalendarView::updateUnmanagedViews() | 1899 | void CalendarView::updateUnmanagedViews() |
1900 | { | 1900 | { |
1901 | mDateNavigator->updateDayMatrix(); | 1901 | mDateNavigator->updateDayMatrix(); |
1902 | } | 1902 | } |
1903 | 1903 | ||
1904 | int CalendarView::msgItemDelete() | 1904 | int CalendarView::msgItemDelete() |
1905 | { | 1905 | { |
1906 | return KMessageBox::warningContinueCancel(this, | 1906 | return KMessageBox::warningContinueCancel(this, |
1907 | i18n("This item will be\npermanently deleted."), | 1907 | i18n("This item will be\npermanently deleted."), |
1908 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 1908 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | 1911 | ||
1912 | void CalendarView::edit_cut() | 1912 | void CalendarView::edit_cut() |
1913 | { | 1913 | { |
1914 | Event *anEvent=0; | 1914 | Event *anEvent=0; |
1915 | 1915 | ||
1916 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 1916 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
1917 | 1917 | ||
1918 | if (mViewManager->currentView()->isEventView()) { | 1918 | if (mViewManager->currentView()->isEventView()) { |
1919 | if ( incidence && incidence->type() == "Event" ) { | 1919 | if ( incidence && incidence->type() == "Event" ) { |
1920 | anEvent = static_cast<Event *>(incidence); | 1920 | anEvent = static_cast<Event *>(incidence); |
1921 | } | 1921 | } |
1922 | } | 1922 | } |
1923 | 1923 | ||
1924 | if (!anEvent) { | 1924 | if (!anEvent) { |
1925 | KNotifyClient::beep(); | 1925 | KNotifyClient::beep(); |
1926 | return; | 1926 | return; |
1927 | } | 1927 | } |
1928 | DndFactory factory( mCalendar ); | 1928 | DndFactory factory( mCalendar ); |
1929 | factory.cutEvent(anEvent); | 1929 | factory.cutEvent(anEvent); |
1930 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 1930 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
1931 | } | 1931 | } |
1932 | 1932 | ||
1933 | void CalendarView::edit_copy() | 1933 | void CalendarView::edit_copy() |
1934 | { | 1934 | { |
1935 | Event *anEvent=0; | 1935 | Event *anEvent=0; |
1936 | 1936 | ||
1937 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 1937 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
1938 | 1938 | ||
1939 | if (mViewManager->currentView()->isEventView()) { | 1939 | if (mViewManager->currentView()->isEventView()) { |
1940 | if ( incidence && incidence->type() == "Event" ) { | 1940 | if ( incidence && incidence->type() == "Event" ) { |
1941 | anEvent = static_cast<Event *>(incidence); | 1941 | anEvent = static_cast<Event *>(incidence); |
1942 | } | 1942 | } |
1943 | } | 1943 | } |
1944 | 1944 | ||
1945 | if (!anEvent) { | 1945 | if (!anEvent) { |
1946 | KNotifyClient::beep(); | 1946 | KNotifyClient::beep(); |
1947 | return; | 1947 | return; |
1948 | } | 1948 | } |
1949 | DndFactory factory( mCalendar ); | 1949 | DndFactory factory( mCalendar ); |
1950 | factory.copyEvent(anEvent); | 1950 | factory.copyEvent(anEvent); |
1951 | } | 1951 | } |
1952 | 1952 | ||
1953 | void CalendarView::edit_paste() | 1953 | void CalendarView::edit_paste() |
1954 | { | 1954 | { |
1955 | QDate date = mNavigator->selectedDates().first(); | 1955 | QDate date = mNavigator->selectedDates().first(); |
1956 | 1956 | ||
1957 | DndFactory factory( mCalendar ); | 1957 | DndFactory factory( mCalendar ); |
1958 | Event *pastedEvent = factory.pasteEvent( date ); | 1958 | Event *pastedEvent = factory.pasteEvent( date ); |
1959 | 1959 | ||
1960 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 1960 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
1961 | } | 1961 | } |
1962 | 1962 | ||
1963 | void CalendarView::edit_options() | 1963 | void CalendarView::edit_options() |
1964 | { | 1964 | { |
1965 | mDialogManager->showOptionsDialog(); | 1965 | mDialogManager->showOptionsDialog(); |
1966 | //writeSettings(); | 1966 | //writeSettings(); |
1967 | } | 1967 | } |
1968 | void CalendarView::edit_sync_options() | 1968 | void CalendarView::edit_sync_options() |
1969 | { | 1969 | { |
1970 | //mDialogManager->showSyncOptions(); | 1970 | //mDialogManager->showSyncOptions(); |
1971 | //KOPrefs::instance()->mSyncAlgoPrefs | 1971 | //KOPrefs::instance()->mSyncAlgoPrefs |
1972 | QDialog dia( this, "dia", true ); | 1972 | QDialog dia( this, "dia", true ); |
1973 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 1973 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
1974 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 1974 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
1975 | QVBoxLayout lay ( &dia ); | 1975 | QVBoxLayout lay ( &dia ); |
1976 | lay.setSpacing( 2 ); | 1976 | lay.setSpacing( 2 ); |
1977 | lay.setMargin( 3 ); | 1977 | lay.setMargin( 3 ); |
1978 | lay.addWidget(&gr); | 1978 | lay.addWidget(&gr); |
1979 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); | 1979 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); |
1980 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); | 1980 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); |
1981 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); | 1981 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); |
1982 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); | 1982 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); |
1983 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); | 1983 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); |
1984 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); | 1984 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); |
1985 | //QRadioButton both( i18n("Take both on conflict"), &gr ); | 1985 | //QRadioButton both( i18n("Take both on conflict"), &gr ); |
1986 | QPushButton pb ( "OK", &dia); | 1986 | QPushButton pb ( "OK", &dia); |
1987 | lay.addWidget( &pb ); | 1987 | lay.addWidget( &pb ); |
1988 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1988 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1989 | switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { | 1989 | switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { |
1990 | case 0: | 1990 | case 0: |
1991 | loc.setChecked( true); | 1991 | loc.setChecked( true); |
1992 | break; | 1992 | break; |
1993 | case 1: | 1993 | case 1: |
1994 | rem.setChecked( true ); | 1994 | rem.setChecked( true ); |
1995 | break; | 1995 | break; |
1996 | case 2: | 1996 | case 2: |
1997 | newest.setChecked( true); | 1997 | newest.setChecked( true); |
1998 | break; | 1998 | break; |
1999 | case 3: | 1999 | case 3: |
2000 | ask.setChecked( true); | 2000 | ask.setChecked( true); |
2001 | break; | 2001 | break; |
2002 | case 4: | 2002 | case 4: |
2003 | f_loc.setChecked( true); | 2003 | f_loc.setChecked( true); |
2004 | break; | 2004 | break; |
2005 | case 5: | 2005 | case 5: |
2006 | f_rem.setChecked( true); | 2006 | f_rem.setChecked( true); |
2007 | break; | 2007 | break; |
2008 | case 6: | 2008 | case 6: |
2009 | // both.setChecked( true); | 2009 | // both.setChecked( true); |
2010 | break; | 2010 | break; |
2011 | default: | 2011 | default: |
2012 | break; | 2012 | break; |
2013 | } | 2013 | } |
2014 | if ( dia.exec() ) { | 2014 | if ( dia.exec() ) { |
2015 | KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 2015 | KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
2016 | } | 2016 | } |
2017 | 2017 | ||
2018 | } | 2018 | } |
2019 | 2019 | ||
2020 | void CalendarView::slotSelectPickerDate( QDate d) | 2020 | void CalendarView::slotSelectPickerDate( QDate d) |
2021 | { | 2021 | { |
2022 | mDateFrame->hide(); | 2022 | mDateFrame->hide(); |
2023 | if ( mDatePickerMode == 1 ) { | 2023 | if ( mDatePickerMode == 1 ) { |
2024 | mNavigator->slotDaySelect( d ); | 2024 | mNavigator->slotDaySelect( d ); |
2025 | } else if ( mDatePickerMode == 2 ) { | 2025 | } else if ( mDatePickerMode == 2 ) { |
2026 | if ( mMoveIncidence->type() == "Todo" ) { | 2026 | if ( mMoveIncidence->type() == "Todo" ) { |
2027 | Todo * to = (Todo *) mMoveIncidence; | 2027 | Todo * to = (Todo *) mMoveIncidence; |
2028 | QTime tim; | 2028 | QTime tim; |
2029 | if ( to->hasDueDate() ) | 2029 | if ( to->hasDueDate() ) |
2030 | tim = to->dtDue().time(); | 2030 | tim = to->dtDue().time(); |
2031 | else { | 2031 | else { |
2032 | tim = QTime ( 0,0,0 ); | 2032 | tim = QTime ( 0,0,0 ); |
2033 | to->setFloats( true ); | 2033 | to->setFloats( true ); |
2034 | to->setHasDueDate( true ); | 2034 | to->setHasDueDate( true ); |
2035 | } | 2035 | } |
2036 | QDateTime dt ( d,tim ); | 2036 | QDateTime dt ( d,tim ); |
2037 | to->setDtDue( dt ); | 2037 | to->setDtDue( dt ); |
2038 | todoChanged( to ); | 2038 | todoChanged( to ); |
2039 | } else { | 2039 | } else { |
2040 | QTime tim = mMoveIncidence->dtStart().time(); | 2040 | QTime tim = mMoveIncidence->dtStart().time(); |
2041 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2041 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2042 | QDateTime dt ( d,tim ); | 2042 | QDateTime dt ( d,tim ); |
2043 | mMoveIncidence->setDtStart( dt ); | 2043 | mMoveIncidence->setDtStart( dt ); |
2044 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2044 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2045 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2045 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2048 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2049 | } | 2049 | } |
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | void CalendarView::removeCategories() | 2052 | void CalendarView::removeCategories() |
2053 | { | 2053 | { |
2054 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2054 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2055 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2055 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2056 | QStringList catIncList; | 2056 | QStringList catIncList; |
2057 | QStringList newCatList; | 2057 | QStringList newCatList; |
2058 | Incidence* inc = incList.first(); | 2058 | Incidence* inc = incList.first(); |
2059 | int i; | 2059 | int i; |
2060 | int count = 0; | 2060 | int count = 0; |
2061 | while ( inc ) { | 2061 | while ( inc ) { |
2062 | newCatList.clear(); | 2062 | newCatList.clear(); |
2063 | catIncList = inc->categories() ; | 2063 | catIncList = inc->categories() ; |
2064 | for( i = 0; i< catIncList.count(); ++i ) { | 2064 | for( i = 0; i< catIncList.count(); ++i ) { |
2065 | if ( catList.contains (catIncList[i])) | 2065 | if ( catList.contains (catIncList[i])) |
2066 | newCatList.append( catIncList[i] ); | 2066 | newCatList.append( catIncList[i] ); |
2067 | } | 2067 | } |
2068 | newCatList.sort(); | 2068 | newCatList.sort(); |
2069 | inc->setCategories( newCatList.join(",") ); | 2069 | inc->setCategories( newCatList.join(",") ); |
2070 | inc = incList.next(); | 2070 | inc = incList.next(); |
2071 | } | 2071 | } |
2072 | } | 2072 | } |
2073 | 2073 | ||
2074 | int CalendarView::addCategories() | 2074 | int CalendarView::addCategories() |
2075 | { | 2075 | { |
2076 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2076 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2077 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2077 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2078 | QStringList catIncList; | 2078 | QStringList catIncList; |
2079 | Incidence* inc = incList.first(); | 2079 | Incidence* inc = incList.first(); |
2080 | int i; | 2080 | int i; |
2081 | int count = 0; | 2081 | int count = 0; |
2082 | while ( inc ) { | 2082 | while ( inc ) { |
2083 | catIncList = inc->categories() ; | 2083 | catIncList = inc->categories() ; |
2084 | for( i = 0; i< catIncList.count(); ++i ) { | 2084 | for( i = 0; i< catIncList.count(); ++i ) { |
2085 | if ( !catList.contains (catIncList[i])) { | 2085 | if ( !catList.contains (catIncList[i])) { |
2086 | catList.append( catIncList[i] ); | 2086 | catList.append( catIncList[i] ); |
2087 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2087 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2088 | ++count; | 2088 | ++count; |
2089 | } | 2089 | } |
2090 | } | 2090 | } |
2091 | inc = incList.next(); | 2091 | inc = incList.next(); |
2092 | } | 2092 | } |
2093 | catList.sort(); | 2093 | catList.sort(); |
2094 | KOPrefs::instance()->mCustomCategories = catList; | 2094 | KOPrefs::instance()->mCustomCategories = catList; |
2095 | return count; | 2095 | return count; |
2096 | } | 2096 | } |
2097 | 2097 | ||
2098 | void CalendarView::manageCategories() | 2098 | void CalendarView::manageCategories() |
2099 | { | 2099 | { |
2100 | KOCatPrefs* cp = new KOCatPrefs(); | 2100 | KOCatPrefs* cp = new KOCatPrefs(); |
2101 | cp->show(); | 2101 | cp->show(); |
2102 | int w =cp->sizeHint().width() ; | 2102 | int w =cp->sizeHint().width() ; |
2103 | int h = cp->sizeHint().height() ; | 2103 | int h = cp->sizeHint().height() ; |
2104 | int dw = QApplication::desktop()->width(); | 2104 | int dw = QApplication::desktop()->width(); |
2105 | int dh = QApplication::desktop()->height(); | 2105 | int dh = QApplication::desktop()->height(); |
2106 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2106 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2107 | if ( !cp->exec() ) { | 2107 | if ( !cp->exec() ) { |
2108 | delete cp; | 2108 | delete cp; |
2109 | return; | 2109 | return; |
2110 | } | 2110 | } |
2111 | int count = 0; | 2111 | int count = 0; |
2112 | if ( cp->addCat() ) { | 2112 | if ( cp->addCat() ) { |
2113 | count = addCategories(); | 2113 | count = addCategories(); |
2114 | if ( count ) { | 2114 | if ( count ) { |
2115 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2115 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2116 | writeSettings(); | 2116 | writeSettings(); |
2117 | } | 2117 | } |
2118 | } else { | 2118 | } else { |
2119 | removeCategories(); | 2119 | removeCategories(); |
2120 | updateView(); | 2120 | updateView(); |
2121 | } | 2121 | } |
2122 | delete cp; | 2122 | delete cp; |
2123 | } | 2123 | } |
2124 | 2124 | ||
2125 | void CalendarView::beamIncidence(Incidence * Inc) | 2125 | void CalendarView::beamIncidence(Incidence * Inc) |
2126 | { | 2126 | { |
2127 | QPtrList<Incidence> delSel ; | 2127 | QPtrList<Incidence> delSel ; |
2128 | delSel.append(Inc); | 2128 | delSel.append(Inc); |
2129 | beamIncidenceList( delSel ); | 2129 | beamIncidenceList( delSel ); |
2130 | } | 2130 | } |
2131 | void CalendarView::beamCalendar() | 2131 | void CalendarView::beamCalendar() |
2132 | { | 2132 | { |
2133 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2133 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2134 | //qDebug("beamCalendar() "); | 2134 | //qDebug("beamCalendar() "); |
2135 | beamIncidenceList( delSel ); | 2135 | beamIncidenceList( delSel ); |
2136 | } | 2136 | } |
2137 | void CalendarView::beamFilteredCalendar() | 2137 | void CalendarView::beamFilteredCalendar() |
2138 | { | 2138 | { |
2139 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2139 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2140 | //qDebug("beamFilteredCalendar() "); | 2140 | //qDebug("beamFilteredCalendar() "); |
2141 | beamIncidenceList( delSel ); | 2141 | beamIncidenceList( delSel ); |
2142 | } | 2142 | } |
2143 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2143 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2144 | { | 2144 | { |
2145 | if ( beamDialog->exec () == QDialog::Rejected ) | 2145 | if ( beamDialog->exec () == QDialog::Rejected ) |
2146 | return; | 2146 | return; |
2147 | 2147 | ||
2148 | QString fn = "/tmp/kopibeamfile"; | 2148 | QString fn = "/tmp/kopibeamfile"; |
2149 | QString mes; | 2149 | QString mes; |
2150 | bool createbup = true; | 2150 | bool createbup = true; |
2151 | if ( createbup ) { | 2151 | if ( createbup ) { |
2152 | QString description = "\n"; | 2152 | QString description = "\n"; |
2153 | CalendarLocal* cal = new CalendarLocal(); | 2153 | CalendarLocal* cal = new CalendarLocal(); |
2154 | if ( beamDialog->beamLocal() ) | 2154 | if ( beamDialog->beamLocal() ) |
2155 | cal->setLocalTime(); | 2155 | cal->setLocalTime(); |
2156 | else | 2156 | else |
2157 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 2157 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
2158 | Incidence *incidence = delSel.first(); | 2158 | Incidence *incidence = delSel.first(); |
2159 | bool addText = false; | 2159 | bool addText = false; |
2160 | if ( delSel.count() < 10 ) | 2160 | if ( delSel.count() < 10 ) |
2161 | addText = true; | 2161 | addText = true; |
2162 | else { | 2162 | else { |
2163 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2163 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2164 | } | 2164 | } |
2165 | while ( incidence ) { | 2165 | while ( incidence ) { |
2166 | Incidence *in = incidence->clone(); | 2166 | Incidence *in = incidence->clone(); |
2167 | if ( addText ) | 2167 | if ( addText ) |
2168 | description += in->summary() + "\n"; | 2168 | description += in->summary() + "\n"; |
2169 | cal->addIncidence( in ); | 2169 | cal->addIncidence( in ); |
2170 | incidence = delSel.next(); | 2170 | incidence = delSel.next(); |
2171 | } | 2171 | } |
2172 | if ( beamDialog->beamVcal() ) { | 2172 | if ( beamDialog->beamVcal() ) { |
2173 | fn += ".vcs"; | 2173 | fn += ".vcs"; |
2174 | FileStorage storage( cal, fn, new VCalFormat ); | 2174 | FileStorage storage( cal, fn, new VCalFormat ); |
2175 | storage.save(); | 2175 | storage.save(); |
2176 | } else { | 2176 | } else { |
2177 | fn += ".ics"; | 2177 | fn += ".ics"; |
2178 | FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 2178 | FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
2179 | storage.save(); | 2179 | storage.save(); |
2180 | } | 2180 | } |
2181 | delete cal; | 2181 | delete cal; |
2182 | mes = i18n("KO/Pi: Ready for beaming"); | 2182 | mes = i18n("KO/Pi: Ready for beaming"); |
2183 | setCaption(mes); | 2183 | setCaption(mes); |
2184 | 2184 | ||
2185 | #ifndef DESKTOP_VERSION | 2185 | #ifndef DESKTOP_VERSION |
2186 | Ir *ir = new Ir( this ); | 2186 | Ir *ir = new Ir( this ); |
2187 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2187 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2188 | ir->send( fn, description, "text/x-vCalendar" ); | 2188 | ir->send( fn, description, "text/x-vCalendar" ); |
2189 | #endif | 2189 | #endif |
2190 | } | 2190 | } |
2191 | } | 2191 | } |
2192 | void CalendarView::beamDone( Ir *ir ) | 2192 | void CalendarView::beamDone( Ir *ir ) |
2193 | { | 2193 | { |
2194 | #ifndef DESKTOP_VERSION | 2194 | #ifndef DESKTOP_VERSION |
2195 | delete ir; | 2195 | delete ir; |
2196 | #endif | 2196 | #endif |
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | void CalendarView::moveIncidence(Incidence * inc ) | 2199 | void CalendarView::moveIncidence(Incidence * inc ) |
2200 | { | 2200 | { |
2201 | if ( !inc ) return; | 2201 | if ( !inc ) return; |
2202 | // qDebug("showDatePickerForIncidence( ) "); | 2202 | // qDebug("showDatePickerForIncidence( ) "); |
2203 | if ( mDateFrame->isVisible() ) | 2203 | if ( mDateFrame->isVisible() ) |
2204 | mDateFrame->hide(); | 2204 | mDateFrame->hide(); |
2205 | else { | 2205 | else { |
2206 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | 2206 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; |
2207 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | 2207 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; |
2208 | int dw = QApplication::desktop()->width(); | 2208 | int dw = QApplication::desktop()->width(); |
2209 | int dh = QApplication::desktop()->height(); | 2209 | int dh = QApplication::desktop()->height(); |
2210 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2210 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2211 | mDateFrame->show(); | 2211 | mDateFrame->show(); |
2212 | } | 2212 | } |
2213 | mDatePickerMode = 2; | 2213 | mDatePickerMode = 2; |
2214 | mMoveIncidence = inc ; | 2214 | mMoveIncidence = inc ; |
2215 | QDate da; | 2215 | QDate da; |
2216 | if ( mMoveIncidence->type() == "Todo" ) { | 2216 | if ( mMoveIncidence->type() == "Todo" ) { |
2217 | Todo * to = (Todo *) mMoveIncidence; | 2217 | Todo * to = (Todo *) mMoveIncidence; |
2218 | if ( to->hasDueDate() ) | 2218 | if ( to->hasDueDate() ) |
2219 | da = to->dtDue().date(); | 2219 | da = to->dtDue().date(); |
2220 | else | 2220 | else |
2221 | da = QDate::currentDate(); | 2221 | da = QDate::currentDate(); |
2222 | } else { | 2222 | } else { |
2223 | da = mMoveIncidence->dtStart().date(); | 2223 | da = mMoveIncidence->dtStart().date(); |
2224 | } | 2224 | } |
2225 | mDatePicker->setDate( da ); | 2225 | mDatePicker->setDate( da ); |
2226 | } | 2226 | } |
2227 | void CalendarView::showDatePicker( ) | 2227 | void CalendarView::showDatePicker( ) |
2228 | { | 2228 | { |
2229 | //qDebug("CalendarView::showDatePicker( ) "); | 2229 | //qDebug("CalendarView::showDatePicker( ) "); |
2230 | if ( mDateFrame->isVisible() ) | 2230 | if ( mDateFrame->isVisible() ) |
2231 | mDateFrame->hide(); | 2231 | mDateFrame->hide(); |
2232 | else { | 2232 | else { |
2233 | int w =mDatePicker->sizeHint().width() ; | 2233 | int w =mDatePicker->sizeHint().width() ; |
2234 | int h = mDatePicker->sizeHint().height() ; | 2234 | int h = mDatePicker->sizeHint().height() ; |
2235 | int dw = QApplication::desktop()->width(); | 2235 | int dw = QApplication::desktop()->width(); |
2236 | int dh = QApplication::desktop()->height(); | 2236 | int dh = QApplication::desktop()->height(); |
2237 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2237 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2238 | mDateFrame->show(); | 2238 | mDateFrame->show(); |
2239 | } | 2239 | } |
2240 | mDatePickerMode = 1; | 2240 | mDatePickerMode = 1; |
2241 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2241 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2242 | } | 2242 | } |
2243 | 2243 | ||
2244 | void CalendarView::showEventEditor() | 2244 | void CalendarView::showEventEditor() |
2245 | { | 2245 | { |
2246 | #ifdef DESKTOP_VERSION | 2246 | #ifdef DESKTOP_VERSION |
2247 | mEventEditor->show(); | 2247 | mEventEditor->show(); |
2248 | #else | 2248 | #else |
2249 | mEventEditor->showMaximized(); | 2249 | mEventEditor->showMaximized(); |
2250 | #endif | 2250 | #endif |
2251 | } | 2251 | } |
2252 | void CalendarView::showTodoEditor() | 2252 | void CalendarView::showTodoEditor() |
2253 | { | 2253 | { |
2254 | #ifdef DESKTOP_VERSION | 2254 | #ifdef DESKTOP_VERSION |
2255 | mTodoEditor->show(); | 2255 | mTodoEditor->show(); |
2256 | #else | 2256 | #else |
2257 | mTodoEditor->showMaximized(); | 2257 | mTodoEditor->showMaximized(); |
2258 | #endif | 2258 | #endif |
2259 | } | 2259 | } |
2260 | void CalendarView::cancelIncidence(Incidence * inc ) | 2260 | void CalendarView::cancelIncidence(Incidence * inc ) |
2261 | { | 2261 | { |
2262 | inc->setCancelled( ! inc->cancelled() ); | 2262 | inc->setCancelled( ! inc->cancelled() ); |
2263 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2263 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2264 | updateView(); | 2264 | updateView(); |
2265 | } | 2265 | } |
2266 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2266 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2267 | { | 2267 | { |
2268 | Incidence * newInc = orgInc->clone(); | 2268 | Incidence * newInc = orgInc->clone(); |
2269 | newInc->recreate(); | 2269 | newInc->recreate(); |
2270 | 2270 | ||
2271 | if ( newInc->type() == "Todo" ) { | 2271 | if ( newInc->type() == "Todo" ) { |
2272 | Todo* t = (Todo*) newInc; | 2272 | Todo* t = (Todo*) newInc; |
2273 | mTodoEditor->editTodo( t ); | 2273 | mTodoEditor->editTodo( t ); |
2274 | showTodoEditor(); | 2274 | showTodoEditor(); |
2275 | if ( mTodoEditor->exec() ) { | 2275 | if ( mTodoEditor->exec() ) { |
2276 | mCalendar->addTodo( t ); | 2276 | mCalendar->addTodo( t ); |
2277 | updateView(); | 2277 | updateView(); |
2278 | } else { | 2278 | } else { |
2279 | delete t; | 2279 | delete t; |
2280 | } | 2280 | } |
2281 | } | 2281 | } |
2282 | else { | 2282 | else { |
2283 | Event* e = (Event*) newInc; | 2283 | Event* e = (Event*) newInc; |
2284 | mEventEditor->editEvent( e ); | 2284 | mEventEditor->editEvent( e ); |
2285 | showEventEditor(); | 2285 | showEventEditor(); |
2286 | if ( mEventEditor->exec() ) { | 2286 | if ( mEventEditor->exec() ) { |
2287 | mCalendar->addEvent( e ); | 2287 | mCalendar->addEvent( e ); |
2288 | updateView(); | 2288 | updateView(); |
2289 | } else { | 2289 | } else { |
2290 | delete e; | 2290 | delete e; |
2291 | } | 2291 | } |
2292 | } | 2292 | } |
2293 | } | 2293 | } |
2294 | 2294 | ||
2295 | void CalendarView::newEvent() | 2295 | void CalendarView::newEvent() |
2296 | { | 2296 | { |
2297 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2297 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2298 | KOAgendaView *aView = mViewManager->agendaView(); | 2298 | KOAgendaView *aView = mViewManager->agendaView(); |
2299 | if (aView) { | 2299 | if (aView) { |
2300 | if (aView->selectionStart().isValid()) { | 2300 | if (aView->selectionStart().isValid()) { |
2301 | if (aView->selectedIsAllDay()) { | 2301 | if (aView->selectedIsAllDay()) { |
2302 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2302 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2303 | } else { | 2303 | } else { |
2304 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2304 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2305 | } | 2305 | } |
2306 | return; | 2306 | return; |
2307 | } | 2307 | } |
2308 | } | 2308 | } |
2309 | 2309 | ||
2310 | QDate date = mNavigator->selectedDates().first(); | 2310 | QDate date = mNavigator->selectedDates().first(); |
2311 | QDateTime current = QDateTime::currentDateTime(); | 2311 | QDateTime current = QDateTime::currentDateTime(); |
2312 | if ( date <= current.date() ) { | 2312 | if ( date <= current.date() ) { |
2313 | int hour = current.time().hour() +1; | 2313 | int hour = current.time().hour() +1; |
2314 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2314 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2315 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2315 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2316 | } else | 2316 | } else |
2317 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2317 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2318 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2318 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2319 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2319 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | void CalendarView::newEvent(QDateTime fh) | 2322 | void CalendarView::newEvent(QDateTime fh) |
2323 | { | 2323 | { |
2324 | newEvent(fh, | 2324 | newEvent(fh, |
2325 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2325 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2326 | } | 2326 | } |
2327 | 2327 | ||
2328 | void CalendarView::newEvent(QDate dt) | 2328 | void CalendarView::newEvent(QDate dt) |
2329 | { | 2329 | { |
2330 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2330 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2331 | QDateTime(dt, QTime(0,0,0)), true); | 2331 | QDateTime(dt, QTime(0,0,0)), true); |
2332 | } | 2332 | } |
2333 | 2333 | ||
2334 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2334 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2335 | { | 2335 | { |
2336 | 2336 | ||
2337 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2337 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2338 | if ( mFilterView->filtersEnabled() ) { | 2338 | if ( mFilterView->filtersEnabled() ) { |
2339 | CalFilter *filter = mFilterView->selectedFilter(); | 2339 | CalFilter *filter = mFilterView->selectedFilter(); |
2340 | if (filter && filter->showCategories()) { | 2340 | if (filter && filter->showCategories()) { |
2341 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2341 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2342 | } | 2342 | } |
2343 | if ( filter ) | 2343 | if ( filter ) |
2344 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2344 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2345 | } | 2345 | } |
2346 | showEventEditor(); | 2346 | showEventEditor(); |
2347 | } | 2347 | } |
2348 | void CalendarView::todoAdded(Todo * t) | 2348 | void CalendarView::todoAdded(Todo * t) |
2349 | { | 2349 | { |
2350 | 2350 | ||
2351 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2351 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2352 | updateTodoViews(); | 2352 | updateTodoViews(); |
2353 | } | 2353 | } |
2354 | void CalendarView::todoChanged(Todo * t) | 2354 | void CalendarView::todoChanged(Todo * t) |
2355 | { | 2355 | { |
2356 | emit todoModified( t, 4 ); | 2356 | emit todoModified( t, 4 ); |
2357 | // updateTodoViews(); | 2357 | // updateTodoViews(); |
2358 | } | 2358 | } |
2359 | void CalendarView::todoToBeDeleted(Todo *) | 2359 | void CalendarView::todoToBeDeleted(Todo *) |
2360 | { | 2360 | { |
2361 | //qDebug("todoToBeDeleted(Todo *) "); | 2361 | //qDebug("todoToBeDeleted(Todo *) "); |
2362 | updateTodoViews(); | 2362 | updateTodoViews(); |
2363 | } | 2363 | } |
2364 | void CalendarView::todoDeleted() | 2364 | void CalendarView::todoDeleted() |
2365 | { | 2365 | { |
2366 | //qDebug(" todoDeleted()"); | 2366 | //qDebug(" todoDeleted()"); |
2367 | updateTodoViews(); | 2367 | updateTodoViews(); |
2368 | } | 2368 | } |
2369 | 2369 | ||
2370 | 2370 | ||
2371 | 2371 | ||
2372 | void CalendarView::newTodo() | 2372 | void CalendarView::newTodo() |
2373 | { | 2373 | { |
2374 | 2374 | ||
2375 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); | 2375 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); |
2376 | if ( mFilterView->filtersEnabled() ) { | 2376 | if ( mFilterView->filtersEnabled() ) { |
2377 | CalFilter *filter = mFilterView->selectedFilter(); | 2377 | CalFilter *filter = mFilterView->selectedFilter(); |
2378 | if (filter && filter->showCategories()) { | 2378 | if (filter && filter->showCategories()) { |
2379 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2379 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2380 | } | 2380 | } |
2381 | if ( filter ) | 2381 | if ( filter ) |
2382 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2382 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2383 | } | 2383 | } |
2384 | showTodoEditor(); | 2384 | showTodoEditor(); |
2385 | } | 2385 | } |
2386 | 2386 | ||
2387 | void CalendarView::newSubTodo() | 2387 | void CalendarView::newSubTodo() |
2388 | { | 2388 | { |
2389 | Todo *todo = selectedTodo(); | 2389 | Todo *todo = selectedTodo(); |
2390 | if ( todo ) newSubTodo( todo ); | 2390 | if ( todo ) newSubTodo( todo ); |
2391 | } | 2391 | } |
2392 | 2392 | ||
2393 | void CalendarView::newSubTodo(Todo *parentEvent) | 2393 | void CalendarView::newSubTodo(Todo *parentEvent) |
2394 | { | 2394 | { |
2395 | 2395 | ||
2396 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | 2396 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); |
2397 | showTodoEditor(); | 2397 | showTodoEditor(); |
2398 | } | 2398 | } |
2399 | 2399 | ||
2400 | void CalendarView::newFloatingEvent() | 2400 | void CalendarView::newFloatingEvent() |
2401 | { | 2401 | { |
2402 | DateList tmpList = mNavigator->selectedDates(); | 2402 | DateList tmpList = mNavigator->selectedDates(); |
2403 | QDate date = tmpList.first(); | 2403 | QDate date = tmpList.first(); |
2404 | 2404 | ||
2405 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2405 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2406 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2406 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2407 | } | 2407 | } |
2408 | 2408 | ||
2409 | 2409 | ||
2410 | void CalendarView::editEvent( Event *event ) | 2410 | void CalendarView::editEvent( Event *event ) |
2411 | { | 2411 | { |
2412 | 2412 | ||
2413 | if ( !event ) return; | 2413 | if ( !event ) return; |
2414 | if ( event->isReadOnly() ) { | 2414 | if ( event->isReadOnly() ) { |
2415 | showEvent( event ); | 2415 | showEvent( event ); |
2416 | return; | 2416 | return; |
2417 | } | 2417 | } |
2418 | mEventEditor->editEvent( event , mFlagEditDescription); | 2418 | mEventEditor->editEvent( event , mFlagEditDescription); |
2419 | showEventEditor(); | 2419 | showEventEditor(); |
2420 | } | 2420 | } |
2421 | void CalendarView::editJournal( Journal *jour ) | 2421 | void CalendarView::editJournal( Journal *jour ) |
2422 | { | 2422 | { |
2423 | if ( !jour ) return; | 2423 | if ( !jour ) return; |
2424 | mDialogManager->hideSearchDialog(); | 2424 | mDialogManager->hideSearchDialog(); |
2425 | mViewManager->showJournalView(); | 2425 | mViewManager->showJournalView(); |
2426 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2426 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2427 | } | 2427 | } |
2428 | void CalendarView::editTodo( Todo *todo ) | 2428 | void CalendarView::editTodo( Todo *todo ) |
2429 | { | 2429 | { |
2430 | if ( !todo ) return; | 2430 | if ( !todo ) return; |
2431 | 2431 | ||
2432 | if ( todo->isReadOnly() ) { | 2432 | if ( todo->isReadOnly() ) { |
2433 | showTodo( todo ); | 2433 | showTodo( todo ); |
2434 | return; | 2434 | return; |
2435 | } | 2435 | } |
2436 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2436 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2437 | showTodoEditor(); | 2437 | showTodoEditor(); |
2438 | 2438 | ||
2439 | } | 2439 | } |
2440 | 2440 | ||
2441 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2441 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2442 | { | 2442 | { |
2443 | if ( !mEventViewerDialog ) { | 2443 | if ( !mEventViewerDialog ) { |
2444 | mEventViewerDialog = new KOEventViewerDialog(this); | 2444 | mEventViewerDialog = new KOEventViewerDialog(this); |
2445 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2445 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2446 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2446 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2447 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2447 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2448 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2448 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2449 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2449 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2450 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2450 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2451 | mEventViewerDialog->resize( 640, 480 ); | 2451 | mEventViewerDialog->resize( 640, 480 ); |
2452 | 2452 | ||
2453 | } | 2453 | } |
2454 | return mEventViewerDialog; | 2454 | return mEventViewerDialog; |
2455 | } | 2455 | } |
2456 | void CalendarView::showEvent(Event *event) | 2456 | void CalendarView::showEvent(Event *event) |
2457 | { | 2457 | { |
2458 | getEventViewerDialog()->setEvent(event); | 2458 | getEventViewerDialog()->setEvent(event); |
2459 | getEventViewerDialog()->showMe(); | 2459 | getEventViewerDialog()->showMe(); |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | void CalendarView::showTodo(Todo *event) | 2462 | void CalendarView::showTodo(Todo *event) |
2463 | { | 2463 | { |
2464 | getEventViewerDialog()->setTodo(event); | 2464 | getEventViewerDialog()->setTodo(event); |
2465 | getEventViewerDialog()->showMe(); | 2465 | getEventViewerDialog()->showMe(); |
2466 | } | 2466 | } |
2467 | void CalendarView::showJournal( Journal *jour ) | 2467 | void CalendarView::showJournal( Journal *jour ) |
2468 | { | 2468 | { |
2469 | getEventViewerDialog()->setJournal(jour); | 2469 | getEventViewerDialog()->setJournal(jour); |
2470 | getEventViewerDialog()->showMe(); | 2470 | getEventViewerDialog()->showMe(); |
2471 | 2471 | ||
2472 | } | 2472 | } |
2473 | // void CalendarView::todoModified (Todo *event, int changed) | 2473 | // void CalendarView::todoModified (Todo *event, int changed) |
2474 | // { | 2474 | // { |
2475 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2475 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2476 | // // kdDebug() << "Todo modified and open" << endl; | 2476 | // // kdDebug() << "Todo modified and open" << endl; |
2477 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2477 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2478 | // // temp->modified (changed); | 2478 | // // temp->modified (changed); |
2479 | 2479 | ||
2480 | // // } | 2480 | // // } |
2481 | 2481 | ||
2482 | // mViewManager->updateView(); | 2482 | // mViewManager->updateView(); |
2483 | // } | 2483 | // } |
2484 | 2484 | ||
2485 | void CalendarView::appointment_show() | 2485 | void CalendarView::appointment_show() |
2486 | { | 2486 | { |
2487 | Event *anEvent = 0; | 2487 | Event *anEvent = 0; |
2488 | 2488 | ||
2489 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2489 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2490 | 2490 | ||
2491 | if (mViewManager->currentView()->isEventView()) { | 2491 | if (mViewManager->currentView()->isEventView()) { |
2492 | if ( incidence && incidence->type() == "Event" ) { | 2492 | if ( incidence && incidence->type() == "Event" ) { |
2493 | anEvent = static_cast<Event *>(incidence); | 2493 | anEvent = static_cast<Event *>(incidence); |
2494 | } | 2494 | } |
2495 | } | 2495 | } |
2496 | 2496 | ||
2497 | if (!anEvent) { | 2497 | if (!anEvent) { |
2498 | KNotifyClient::beep(); | 2498 | KNotifyClient::beep(); |
2499 | return; | 2499 | return; |
2500 | } | 2500 | } |
2501 | 2501 | ||
2502 | showEvent(anEvent); | 2502 | showEvent(anEvent); |
2503 | } | 2503 | } |
2504 | 2504 | ||
2505 | void CalendarView::appointment_edit() | 2505 | void CalendarView::appointment_edit() |
2506 | { | 2506 | { |
2507 | Event *anEvent = 0; | 2507 | Event *anEvent = 0; |
2508 | 2508 | ||
2509 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2509 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2510 | 2510 | ||
2511 | if (mViewManager->currentView()->isEventView()) { | 2511 | if (mViewManager->currentView()->isEventView()) { |
2512 | if ( incidence && incidence->type() == "Event" ) { | 2512 | if ( incidence && incidence->type() == "Event" ) { |
2513 | anEvent = static_cast<Event *>(incidence); | 2513 | anEvent = static_cast<Event *>(incidence); |
2514 | } | 2514 | } |
2515 | } | 2515 | } |
2516 | 2516 | ||
2517 | if (!anEvent) { | 2517 | if (!anEvent) { |
2518 | KNotifyClient::beep(); | 2518 | KNotifyClient::beep(); |
2519 | return; | 2519 | return; |
2520 | } | 2520 | } |
2521 | 2521 | ||
2522 | editEvent(anEvent); | 2522 | editEvent(anEvent); |
2523 | } | 2523 | } |
2524 | 2524 | ||
2525 | void CalendarView::appointment_delete() | 2525 | void CalendarView::appointment_delete() |
2526 | { | 2526 | { |
2527 | Event *anEvent = 0; | 2527 | Event *anEvent = 0; |
2528 | 2528 | ||
2529 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2529 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2530 | 2530 | ||
2531 | if (mViewManager->currentView()->isEventView()) { | 2531 | if (mViewManager->currentView()->isEventView()) { |
2532 | if ( incidence && incidence->type() == "Event" ) { | 2532 | if ( incidence && incidence->type() == "Event" ) { |
2533 | anEvent = static_cast<Event *>(incidence); | 2533 | anEvent = static_cast<Event *>(incidence); |
2534 | } | 2534 | } |
2535 | } | 2535 | } |
2536 | 2536 | ||
2537 | if (!anEvent) { | 2537 | if (!anEvent) { |
2538 | KNotifyClient::beep(); | 2538 | KNotifyClient::beep(); |
2539 | return; | 2539 | return; |
2540 | } | 2540 | } |
2541 | 2541 | ||
2542 | deleteEvent(anEvent); | 2542 | deleteEvent(anEvent); |
2543 | } | 2543 | } |
2544 | 2544 | ||
2545 | void CalendarView::todo_unsub(Todo *anTodo ) | 2545 | void CalendarView::todo_unsub(Todo *anTodo ) |
2546 | { | 2546 | { |
2547 | // Todo *anTodo = selectedTodo(); | 2547 | // Todo *anTodo = selectedTodo(); |
2548 | if (!anTodo) return; | 2548 | if (!anTodo) return; |
2549 | if (!anTodo->relatedTo()) return; | 2549 | if (!anTodo->relatedTo()) return; |
2550 | anTodo->relatedTo()->removeRelation(anTodo); | 2550 | anTodo->relatedTo()->removeRelation(anTodo); |
2551 | anTodo->setRelatedTo(0); | 2551 | anTodo->setRelatedTo(0); |
2552 | anTodo->updated(); | 2552 | anTodo->updated(); |
2553 | anTodo->setRelatedToUid(""); | 2553 | anTodo->setRelatedToUid(""); |
2554 | setModified(true); | 2554 | setModified(true); |
2555 | updateView(); | 2555 | updateView(); |
2556 | } | 2556 | } |
2557 | 2557 | ||
2558 | void CalendarView::deleteTodo(Todo *todo) | 2558 | void CalendarView::deleteTodo(Todo *todo) |
2559 | { | 2559 | { |
2560 | if (!todo) { | 2560 | if (!todo) { |
2561 | KNotifyClient::beep(); | 2561 | KNotifyClient::beep(); |
2562 | return; | 2562 | return; |
2563 | } | 2563 | } |
2564 | if (KOPrefs::instance()->mConfirm) { | 2564 | if (KOPrefs::instance()->mConfirm) { |
2565 | switch (msgItemDelete()) { | 2565 | switch (msgItemDelete()) { |
2566 | case KMessageBox::Continue: // OK | 2566 | case KMessageBox::Continue: // OK |
2567 | if (!todo->relations().isEmpty()) { | 2567 | if (!todo->relations().isEmpty()) { |
2568 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2568 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2569 | i18n("Delete To-Do")); | 2569 | i18n("Delete To-Do")); |
2570 | } else { | 2570 | } else { |
2571 | checkExternalId( todo ); | 2571 | checkExternalId( todo ); |
2572 | calendar()->deleteTodo(todo); | 2572 | calendar()->deleteTodo(todo); |
2573 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2573 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2574 | updateView(); | 2574 | updateView(); |
2575 | } | 2575 | } |
2576 | break; | 2576 | break; |
2577 | } // switch | 2577 | } // switch |
2578 | } else { | 2578 | } else { |
2579 | if (!todo->relations().isEmpty()) { | 2579 | if (!todo->relations().isEmpty()) { |
2580 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2580 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2581 | i18n("Delete To-Do")); | 2581 | i18n("Delete To-Do")); |
2582 | } else { | 2582 | } else { |
2583 | checkExternalId( todo ); | 2583 | checkExternalId( todo ); |
2584 | mCalendar->deleteTodo(todo); | 2584 | mCalendar->deleteTodo(todo); |
2585 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2585 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2586 | updateView(); | 2586 | updateView(); |
2587 | } | 2587 | } |
2588 | } | 2588 | } |
2589 | emit updateSearchDialog(); | 2589 | emit updateSearchDialog(); |
2590 | } | 2590 | } |
2591 | void CalendarView::deleteJournal(Journal *jour) | 2591 | void CalendarView::deleteJournal(Journal *jour) |
2592 | { | 2592 | { |
2593 | if (!jour) { | 2593 | if (!jour) { |
2594 | KNotifyClient::beep(); | 2594 | KNotifyClient::beep(); |
2595 | return; | 2595 | return; |
2596 | } | 2596 | } |
2597 | if (KOPrefs::instance()->mConfirm) { | 2597 | if (KOPrefs::instance()->mConfirm) { |
2598 | switch (msgItemDelete()) { | 2598 | switch (msgItemDelete()) { |
2599 | case KMessageBox::Continue: // OK | 2599 | case KMessageBox::Continue: // OK |
2600 | calendar()->deleteJournal(jour); | 2600 | calendar()->deleteJournal(jour); |
2601 | updateView(); | 2601 | updateView(); |
2602 | break; | 2602 | break; |
2603 | } // switch | 2603 | } // switch |
2604 | } else { | 2604 | } else { |
2605 | calendar()->deleteJournal(jour);; | 2605 | calendar()->deleteJournal(jour);; |
2606 | updateView(); | 2606 | updateView(); |
2607 | } | 2607 | } |
2608 | emit updateSearchDialog(); | 2608 | emit updateSearchDialog(); |
2609 | } | 2609 | } |
2610 | 2610 | ||
2611 | void CalendarView::deleteEvent(Event *anEvent) | 2611 | void CalendarView::deleteEvent(Event *anEvent) |
2612 | { | 2612 | { |
2613 | if (!anEvent) { | 2613 | if (!anEvent) { |
2614 | KNotifyClient::beep(); | 2614 | KNotifyClient::beep(); |
2615 | return; | 2615 | return; |
2616 | } | 2616 | } |
2617 | 2617 | ||
2618 | if (anEvent->recurrence()->doesRecur()) { | 2618 | if (anEvent->recurrence()->doesRecur()) { |
2619 | QDate itemDate = mViewManager->currentSelectionDate(); | 2619 | QDate itemDate = mViewManager->currentSelectionDate(); |
2620 | int km; | 2620 | int km; |
2621 | if (!itemDate.isValid()) { | 2621 | if (!itemDate.isValid()) { |
2622 | //kdDebug() << "Date Not Valid" << endl; | 2622 | //kdDebug() << "Date Not Valid" << endl; |
2623 | if (KOPrefs::instance()->mConfirm) { | 2623 | if (KOPrefs::instance()->mConfirm) { |
2624 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2624 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2625 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 2625 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
2626 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 2626 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
2627 | if ( km == KMessageBox::Continue ) | 2627 | if ( km == KMessageBox::Continue ) |
2628 | km = KMessageBox::No; // No = all below | 2628 | km = KMessageBox::No; // No = all below |
2629 | } else | 2629 | } else |
2630 | km = KMessageBox::No; | 2630 | km = KMessageBox::No; |
2631 | } else { | 2631 | } else { |
2632 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + | 2632 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + |
2633 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 2633 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
2634 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 2634 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
2635 | i18n("KO/Pi Confirmation"),i18n("Current"), | 2635 | i18n("KO/Pi Confirmation"),i18n("Current"), |
2636 | i18n("All")); | 2636 | i18n("All")); |
2637 | } | 2637 | } |
2638 | switch(km) { | 2638 | switch(km) { |
2639 | 2639 | ||
2640 | case KMessageBox::No: // Continue // all | 2640 | case KMessageBox::No: // Continue // all |
2641 | //qDebug("KMessageBox::No "); | 2641 | //qDebug("KMessageBox::No "); |
2642 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2642 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2643 | schedule(Scheduler::Cancel,anEvent); | 2643 | schedule(Scheduler::Cancel,anEvent); |
2644 | 2644 | ||
2645 | checkExternalId( anEvent); | 2645 | checkExternalId( anEvent); |
2646 | mCalendar->deleteEvent(anEvent); | 2646 | mCalendar->deleteEvent(anEvent); |
2647 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 2647 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
2648 | break; | 2648 | break; |
2649 | 2649 | ||
2650 | // Disabled because it does not work | 2650 | // Disabled because it does not work |
2651 | //#if 0 | 2651 | //#if 0 |
2652 | case KMessageBox::Yes: // just this one | 2652 | case KMessageBox::Yes: // just this one |
2653 | //QDate qd = mNavigator->selectedDates().first(); | 2653 | //QDate qd = mNavigator->selectedDates().first(); |
2654 | //if (!qd.isValid()) { | 2654 | //if (!qd.isValid()) { |
2655 | // kdDebug() << "no date selected, or invalid date" << endl; | 2655 | // kdDebug() << "no date selected, or invalid date" << endl; |
2656 | // KNotifyClient::beep(); | 2656 | // KNotifyClient::beep(); |
2657 | // return; | 2657 | // return; |
2658 | //} | 2658 | //} |
2659 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 2659 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
2660 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 2660 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
2661 | anEvent->addExDate(itemDate); | 2661 | anEvent->addExDate(itemDate); |
2662 | int duration = anEvent->recurrence()->duration(); | 2662 | int duration = anEvent->recurrence()->duration(); |
2663 | if ( duration > 0 ) { | 2663 | if ( duration > 0 ) { |
2664 | anEvent->recurrence()->setDuration( duration - 1 ); | 2664 | anEvent->recurrence()->setDuration( duration - 1 ); |
2665 | } | 2665 | } |
2666 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 2666 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
2667 | } | 2667 | } |
2668 | break; | 2668 | break; |
2669 | //#endif | 2669 | //#endif |
2670 | } // switch | 2670 | } // switch |
2671 | } else { | 2671 | } else { |
2672 | if (KOPrefs::instance()->mConfirm) { | 2672 | if (KOPrefs::instance()->mConfirm) { |
2673 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2673 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2674 | i18n("\nAre you sure you want\nto delete this event?"), | 2674 | i18n("\nAre you sure you want\nto delete this event?"), |
2675 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 2675 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
2676 | case KMessageBox::Continue: // OK | 2676 | case KMessageBox::Continue: // OK |
2677 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2677 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2678 | schedule(Scheduler::Cancel,anEvent); | 2678 | schedule(Scheduler::Cancel,anEvent); |
2679 | checkExternalId( anEvent); | 2679 | checkExternalId( anEvent); |
2680 | mCalendar->deleteEvent(anEvent); | 2680 | mCalendar->deleteEvent(anEvent); |
2681 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2681 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2682 | break; | 2682 | break; |
2683 | } // switch | 2683 | } // switch |
2684 | } else { | 2684 | } else { |
2685 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2685 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2686 | schedule(Scheduler::Cancel,anEvent); | 2686 | schedule(Scheduler::Cancel,anEvent); |
2687 | checkExternalId( anEvent); | 2687 | checkExternalId( anEvent); |
2688 | mCalendar->deleteEvent(anEvent); | 2688 | mCalendar->deleteEvent(anEvent); |
2689 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2689 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2690 | } | 2690 | } |
2691 | } // if-else | 2691 | } // if-else |
2692 | emit updateSearchDialog(); | 2692 | emit updateSearchDialog(); |
2693 | } | 2693 | } |
2694 | 2694 | ||
2695 | bool CalendarView::deleteEvent(const QString &uid) | 2695 | bool CalendarView::deleteEvent(const QString &uid) |
2696 | { | 2696 | { |
2697 | Event *ev = mCalendar->event(uid); | 2697 | Event *ev = mCalendar->event(uid); |
2698 | if (ev) { | 2698 | if (ev) { |
2699 | deleteEvent(ev); | 2699 | deleteEvent(ev); |
2700 | return true; | 2700 | return true; |
2701 | } else { | 2701 | } else { |
2702 | return false; | 2702 | return false; |
2703 | } | 2703 | } |
2704 | } | 2704 | } |
2705 | 2705 | ||
2706 | /*****************************************************************************/ | 2706 | /*****************************************************************************/ |
2707 | 2707 | ||
2708 | void CalendarView::action_mail() | 2708 | void CalendarView::action_mail() |
2709 | { | 2709 | { |
2710 | #ifndef KORG_NOMAIL | 2710 | #ifndef KORG_NOMAIL |
2711 | KOMailClient mailClient; | 2711 | KOMailClient mailClient; |
2712 | 2712 | ||
2713 | Incidence *incidence = currentSelection(); | 2713 | Incidence *incidence = currentSelection(); |
2714 | 2714 | ||
2715 | if (!incidence) { | 2715 | if (!incidence) { |
2716 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 2716 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2717 | return; | 2717 | return; |
2718 | } | 2718 | } |
2719 | if(incidence->attendeeCount() == 0 ) { | 2719 | if(incidence->attendeeCount() == 0 ) { |
2720 | KMessageBox::sorry(this, | 2720 | KMessageBox::sorry(this, |
2721 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 2721 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2722 | return; | 2722 | return; |
2723 | } | 2723 | } |
2724 | 2724 | ||
2725 | CalendarLocal cal_tmp; | 2725 | CalendarLocal cal_tmp; |
2726 | Event *event = 0; | 2726 | Event *event = 0; |
2727 | Event *ev = 0; | 2727 | Event *ev = 0; |
2728 | if ( incidence && incidence->type() == "Event" ) { | 2728 | if ( incidence && incidence->type() == "Event" ) { |
2729 | event = static_cast<Event *>(incidence); | 2729 | event = static_cast<Event *>(incidence); |
2730 | ev = new Event(*event); | 2730 | ev = new Event(*event); |
2731 | cal_tmp.addEvent(ev); | 2731 | cal_tmp.addEvent(ev); |
2732 | } | 2732 | } |
2733 | ICalFormat mForm( KOPrefs::instance()->mUseQuicksave); | 2733 | ICalFormat mForm( KOPrefs::instance()->mUseQuicksave); |
2734 | QString attachment = mForm.toString( &cal_tmp ); | 2734 | QString attachment = mForm.toString( &cal_tmp ); |
2735 | if (ev) delete(ev); | 2735 | if (ev) delete(ev); |
2736 | 2736 | ||
2737 | mailClient.mailAttendees(currentSelection(), attachment); | 2737 | mailClient.mailAttendees(currentSelection(), attachment); |
2738 | 2738 | ||
2739 | #endif | 2739 | #endif |
2740 | 2740 | ||
2741 | #if 0 | 2741 | #if 0 |
2742 | Event *anEvent = 0; | 2742 | Event *anEvent = 0; |
2743 | if (mViewManager->currentView()->isEventView()) { | 2743 | if (mViewManager->currentView()->isEventView()) { |
2744 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 2744 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
2745 | } | 2745 | } |
2746 | 2746 | ||
2747 | if (!anEvent) { | 2747 | if (!anEvent) { |
2748 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 2748 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2749 | return; | 2749 | return; |
2750 | } | 2750 | } |
2751 | if(anEvent->attendeeCount() == 0 ) { | 2751 | if(anEvent->attendeeCount() == 0 ) { |
2752 | KMessageBox::sorry(this, | 2752 | KMessageBox::sorry(this, |
2753 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 2753 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2754 | return; | 2754 | return; |
2755 | } | 2755 | } |
2756 | 2756 | ||
2757 | mailobject.emailEvent(anEvent); | 2757 | mailobject.emailEvent(anEvent); |
2758 | #endif | 2758 | #endif |
2759 | } | 2759 | } |
2760 | 2760 | ||
2761 | 2761 | ||
2762 | void CalendarView::schedule_publish(Incidence *incidence) | 2762 | void CalendarView::schedule_publish(Incidence *incidence) |
2763 | { | 2763 | { |
2764 | Event *event = 0; | 2764 | Event *event = 0; |
2765 | Todo *todo = 0; | 2765 | Todo *todo = 0; |
2766 | 2766 | ||
2767 | if (incidence == 0) { | 2767 | if (incidence == 0) { |
2768 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 2768 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
2769 | if (incidence == 0) { | 2769 | if (incidence == 0) { |
2770 | incidence = mTodoList->selectedIncidences().first(); | 2770 | incidence = mTodoList->selectedIncidences().first(); |
2771 | } | 2771 | } |
2772 | } | 2772 | } |
2773 | if ( incidence && incidence->type() == "Event" ) { | 2773 | if ( incidence && incidence->type() == "Event" ) { |
2774 | event = static_cast<Event *>(incidence); | 2774 | event = static_cast<Event *>(incidence); |
2775 | } else { | 2775 | } else { |
2776 | if ( incidence && incidence->type() == "Todo" ) { | 2776 | if ( incidence && incidence->type() == "Todo" ) { |
2777 | todo = static_cast<Todo *>(incidence); | 2777 | todo = static_cast<Todo *>(incidence); |
2778 | } | 2778 | } |
2779 | } | 2779 | } |
2780 | 2780 | ||
2781 | if (!event && !todo) { | 2781 | if (!event && !todo) { |
2782 | KMessageBox::sorry(this,i18n("No event selected.")); | 2782 | KMessageBox::sorry(this,i18n("No event selected.")); |
2783 | return; | 2783 | return; |
2784 | } | 2784 | } |
2785 | 2785 | ||
2786 | PublishDialog *publishdlg = new PublishDialog(); | 2786 | PublishDialog *publishdlg = new PublishDialog(); |
2787 | if (incidence->attendeeCount()>0) { | 2787 | if (incidence->attendeeCount()>0) { |
2788 | QPtrList<Attendee> attendees = incidence->attendees(); | 2788 | QPtrList<Attendee> attendees = incidence->attendees(); |
2789 | attendees.first(); | 2789 | attendees.first(); |
2790 | while ( attendees.current()!=0 ) { | 2790 | while ( attendees.current()!=0 ) { |
2791 | publishdlg->addAttendee(attendees.current()); | 2791 | publishdlg->addAttendee(attendees.current()); |
2792 | attendees.next(); | 2792 | attendees.next(); |
2793 | } | 2793 | } |
2794 | } | 2794 | } |
2795 | bool send = true; | 2795 | bool send = true; |
2796 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 2796 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
2797 | if ( publishdlg->exec() != QDialog::Accepted ) | 2797 | if ( publishdlg->exec() != QDialog::Accepted ) |
2798 | send = false; | 2798 | send = false; |
2799 | } | 2799 | } |
2800 | if ( send ) { | 2800 | if ( send ) { |
2801 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 2801 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
2802 | if ( event ) { | 2802 | if ( event ) { |
2803 | Event *ev = new Event(*event); | 2803 | Event *ev = new Event(*event); |
2804 | ev->registerObserver(0); | 2804 | ev->registerObserver(0); |
2805 | ev->clearAttendees(); | 2805 | ev->clearAttendees(); |
2806 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 2806 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
2807 | delete(ev); | 2807 | delete(ev); |
2808 | } | 2808 | } |
2809 | } else { | 2809 | } else { |
2810 | if ( todo ) { | 2810 | if ( todo ) { |
2811 | Todo *ev = new Todo(*todo); | 2811 | Todo *ev = new Todo(*todo); |
2812 | ev->registerObserver(0); | 2812 | ev->registerObserver(0); |
2813 | ev->clearAttendees(); | 2813 | ev->clearAttendees(); |
2814 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 2814 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
2815 | delete(ev); | 2815 | delete(ev); |
2816 | } | 2816 | } |
2817 | } | 2817 | } |
2818 | } | 2818 | } |
2819 | } | 2819 | } |
2820 | delete publishdlg; | 2820 | delete publishdlg; |
2821 | } | 2821 | } |
2822 | 2822 | ||
2823 | void CalendarView::schedule_request(Incidence *incidence) | 2823 | void CalendarView::schedule_request(Incidence *incidence) |
2824 | { | 2824 | { |
2825 | schedule(Scheduler::Request,incidence); | 2825 | schedule(Scheduler::Request,incidence); |
2826 | } | 2826 | } |
2827 | 2827 | ||
2828 | void CalendarView::schedule_refresh(Incidence *incidence) | 2828 | void CalendarView::schedule_refresh(Incidence *incidence) |
2829 | { | 2829 | { |
2830 | schedule(Scheduler::Refresh,incidence); | 2830 | schedule(Scheduler::Refresh,incidence); |
2831 | } | 2831 | } |
2832 | 2832 | ||
2833 | void CalendarView::schedule_cancel(Incidence *incidence) | 2833 | void CalendarView::schedule_cancel(Incidence *incidence) |
2834 | { | 2834 | { |
2835 | schedule(Scheduler::Cancel,incidence); | 2835 | schedule(Scheduler::Cancel,incidence); |
2836 | } | 2836 | } |
2837 | 2837 | ||
2838 | void CalendarView::schedule_add(Incidence *incidence) | 2838 | void CalendarView::schedule_add(Incidence *incidence) |
2839 | { | 2839 | { |
2840 | schedule(Scheduler::Add,incidence); | 2840 | schedule(Scheduler::Add,incidence); |
2841 | } | 2841 | } |
2842 | 2842 | ||
2843 | void CalendarView::schedule_reply(Incidence *incidence) | 2843 | void CalendarView::schedule_reply(Incidence *incidence) |
2844 | { | 2844 | { |
2845 | schedule(Scheduler::Reply,incidence); | 2845 | schedule(Scheduler::Reply,incidence); |
2846 | } | 2846 | } |
2847 | 2847 | ||
2848 | void CalendarView::schedule_counter(Incidence *incidence) | 2848 | void CalendarView::schedule_counter(Incidence *incidence) |
2849 | { | 2849 | { |
2850 | schedule(Scheduler::Counter,incidence); | 2850 | schedule(Scheduler::Counter,incidence); |
2851 | } | 2851 | } |
2852 | 2852 | ||
2853 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 2853 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
2854 | { | 2854 | { |
2855 | schedule(Scheduler::Declinecounter,incidence); | 2855 | schedule(Scheduler::Declinecounter,incidence); |
2856 | } | 2856 | } |
2857 | 2857 | ||
2858 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 2858 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
2859 | { | 2859 | { |
2860 | QDateTime start = QDateTime::currentDateTime(); | 2860 | QDateTime start = QDateTime::currentDateTime(); |
2861 | QDateTime end = start.addDays(daysToPublish); | 2861 | QDateTime end = start.addDays(daysToPublish); |
2862 | 2862 | ||
2863 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 2863 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
2864 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 2864 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
2865 | 2865 | ||
2866 | 2866 | ||
2867 | PublishDialog *publishdlg = new PublishDialog(); | 2867 | PublishDialog *publishdlg = new PublishDialog(); |
2868 | if ( publishdlg->exec() == QDialog::Accepted ) { | 2868 | if ( publishdlg->exec() == QDialog::Accepted ) { |
2869 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 2869 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
2870 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 2870 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
2871 | delete(freebusy); | 2871 | delete(freebusy); |
2872 | } | 2872 | } |
2873 | } | 2873 | } |
2874 | delete publishdlg; | 2874 | delete publishdlg; |
2875 | } | 2875 | } |
2876 | 2876 | ||
2877 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 2877 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
2878 | { | 2878 | { |
2879 | Event *event = 0; | 2879 | Event *event = 0; |
2880 | Todo *todo = 0; | 2880 | Todo *todo = 0; |
2881 | 2881 | ||
2882 | if (incidence == 0) { | 2882 | if (incidence == 0) { |
2883 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 2883 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
2884 | if (incidence == 0) { | 2884 | if (incidence == 0) { |
2885 | incidence = mTodoList->selectedIncidences().first(); | 2885 | incidence = mTodoList->selectedIncidences().first(); |
2886 | } | 2886 | } |
2887 | } | 2887 | } |
2888 | if ( incidence && incidence->type() == "Event" ) { | 2888 | if ( incidence && incidence->type() == "Event" ) { |
2889 | event = static_cast<Event *>(incidence); | 2889 | event = static_cast<Event *>(incidence); |
2890 | } | 2890 | } |
2891 | if ( incidence && incidence->type() == "Todo" ) { | 2891 | if ( incidence && incidence->type() == "Todo" ) { |
2892 | todo = static_cast<Todo *>(incidence); | 2892 | todo = static_cast<Todo *>(incidence); |
2893 | } | 2893 | } |
2894 | 2894 | ||
2895 | if (!event && !todo) { | 2895 | if (!event && !todo) { |
2896 | KMessageBox::sorry(this,i18n("No event selected.")); | 2896 | KMessageBox::sorry(this,i18n("No event selected.")); |
2897 | return; | 2897 | return; |
2898 | } | 2898 | } |
2899 | 2899 | ||
2900 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 2900 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
2901 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 2901 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
2902 | return; | 2902 | return; |
2903 | } | 2903 | } |
2904 | 2904 | ||
2905 | Event *ev = 0; | 2905 | Event *ev = 0; |
2906 | if (event) ev = new Event(*event); | 2906 | if (event) ev = new Event(*event); |
2907 | Todo *to = 0; | 2907 | Todo *to = 0; |
2908 | if (todo) to = new Todo(*todo); | 2908 | if (todo) to = new Todo(*todo); |
2909 | 2909 | ||
2910 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 2910 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
2911 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 2911 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
2912 | if (!me) { | 2912 | if (!me) { |
2913 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 2913 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
2914 | return; | 2914 | return; |
2915 | } | 2915 | } |
2916 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 2916 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
2917 | StatusDialog *statdlg = new StatusDialog(this); | 2917 | StatusDialog *statdlg = new StatusDialog(this); |
2918 | if (!statdlg->exec()==QDialog::Accepted) return; | 2918 | if (!statdlg->exec()==QDialog::Accepted) return; |
2919 | me->setStatus( statdlg->status() ); | 2919 | me->setStatus( statdlg->status() ); |
2920 | delete(statdlg); | 2920 | delete(statdlg); |
2921 | } | 2921 | } |
2922 | Attendee *menew = new Attendee(*me); | 2922 | Attendee *menew = new Attendee(*me); |
2923 | if (ev) { | 2923 | if (ev) { |
2924 | ev->clearAttendees(); | 2924 | ev->clearAttendees(); |
2925 | ev->addAttendee(menew,false); | 2925 | ev->addAttendee(menew,false); |
2926 | } else { | 2926 | } else { |
2927 | if (to) { | 2927 | if (to) { |
2928 | todo->clearAttendees(); | 2928 | todo->clearAttendees(); |
2929 | todo->addAttendee(menew,false); | 2929 | todo->addAttendee(menew,false); |
2930 | } | 2930 | } |
2931 | } | 2931 | } |
2932 | } | 2932 | } |
2933 | 2933 | ||
2934 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 2934 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
2935 | if (ev) { | 2935 | if (ev) { |
2936 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 2936 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
2937 | } else { | 2937 | } else { |
2938 | if (to) { | 2938 | if (to) { |
2939 | if ( !dlg->addMessage(to,method) ) delete(to); | 2939 | if ( !dlg->addMessage(to,method) ) delete(to); |
2940 | } | 2940 | } |
2941 | } | 2941 | } |
2942 | } | 2942 | } |
2943 | 2943 | ||
2944 | void CalendarView::openAddressbook() | 2944 | void CalendarView::openAddressbook() |
2945 | { | 2945 | { |
2946 | KRun::runCommand("kaddressbook"); | 2946 | KRun::runCommand("kaddressbook"); |
2947 | } | 2947 | } |
2948 | 2948 | ||
2949 | void CalendarView::setModified(bool modified) | 2949 | void CalendarView::setModified(bool modified) |
2950 | { | 2950 | { |
2951 | if ( modified ) | 2951 | if ( modified ) |
2952 | emit signalmodified(); | 2952 | emit signalmodified(); |
2953 | if (mModified != modified) { | 2953 | if (mModified != modified) { |
2954 | mModified = modified; | 2954 | mModified = modified; |
2955 | emit modifiedChanged(mModified); | 2955 | emit modifiedChanged(mModified); |
2956 | } | 2956 | } |
2957 | } | 2957 | } |
2958 | 2958 | ||
2959 | bool CalendarView::isReadOnly() | 2959 | bool CalendarView::isReadOnly() |
2960 | { | 2960 | { |
2961 | return mReadOnly; | 2961 | return mReadOnly; |
2962 | } | 2962 | } |
2963 | 2963 | ||
2964 | void CalendarView::setReadOnly(bool readOnly) | 2964 | void CalendarView::setReadOnly(bool readOnly) |
2965 | { | 2965 | { |
2966 | if (mReadOnly != readOnly) { | 2966 | if (mReadOnly != readOnly) { |
2967 | mReadOnly = readOnly; | 2967 | mReadOnly = readOnly; |
2968 | emit readOnlyChanged(mReadOnly); | 2968 | emit readOnlyChanged(mReadOnly); |
2969 | } | 2969 | } |
2970 | } | 2970 | } |
2971 | 2971 | ||
2972 | bool CalendarView::isModified() | 2972 | bool CalendarView::isModified() |
2973 | { | 2973 | { |
2974 | return mModified; | 2974 | return mModified; |
2975 | } | 2975 | } |
2976 | 2976 | ||
2977 | void CalendarView::printSetup() | 2977 | void CalendarView::printSetup() |
2978 | { | 2978 | { |
2979 | #ifndef KORG_NOPRINTER | 2979 | #ifndef KORG_NOPRINTER |
2980 | createPrinter(); | 2980 | createPrinter(); |
2981 | 2981 | ||
2982 | mCalPrinter->setupPrinter(); | 2982 | mCalPrinter->setupPrinter(); |
2983 | #endif | 2983 | #endif |
2984 | } | 2984 | } |
2985 | 2985 | ||
2986 | void CalendarView::print() | 2986 | void CalendarView::print() |
2987 | { | 2987 | { |
2988 | #ifndef KORG_NOPRINTER | 2988 | #ifndef KORG_NOPRINTER |
2989 | createPrinter(); | 2989 | createPrinter(); |
2990 | 2990 | ||
2991 | DateList tmpDateList = mNavigator->selectedDates(); | 2991 | DateList tmpDateList = mNavigator->selectedDates(); |
2992 | mCalPrinter->print(CalPrinter::Month, | 2992 | mCalPrinter->print(CalPrinter::Month, |
2993 | tmpDateList.first(), tmpDateList.last()); | 2993 | tmpDateList.first(), tmpDateList.last()); |
2994 | #endif | 2994 | #endif |
2995 | } | 2995 | } |
2996 | 2996 | ||
2997 | void CalendarView::printPreview() | 2997 | void CalendarView::printPreview() |
2998 | { | 2998 | { |
2999 | #ifndef KORG_NOPRINTER | 2999 | #ifndef KORG_NOPRINTER |
3000 | kdDebug() << "CalendarView::printPreview()" << endl; | 3000 | kdDebug() << "CalendarView::printPreview()" << endl; |
3001 | 3001 | ||
3002 | createPrinter(); | 3002 | createPrinter(); |
3003 | 3003 | ||
3004 | DateList tmpDateList = mNavigator->selectedDates(); | 3004 | DateList tmpDateList = mNavigator->selectedDates(); |
3005 | 3005 | ||
3006 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3006 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3007 | tmpDateList.last()); | 3007 | tmpDateList.last()); |
3008 | #endif | 3008 | #endif |
3009 | } | 3009 | } |
3010 | 3010 | ||
3011 | void CalendarView::exportICalendar() | 3011 | void CalendarView::exportICalendar() |
3012 | { | 3012 | { |
3013 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3013 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3014 | 3014 | ||
3015 | // Force correct extension | 3015 | // Force correct extension |
3016 | if (filename.right(4) != ".ics") filename += ".ics"; | 3016 | if (filename.right(4) != ".ics") filename += ".ics"; |
3017 | 3017 | ||
3018 | FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 3018 | FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
3019 | storage.save(); | 3019 | storage.save(); |
3020 | } | 3020 | } |
3021 | 3021 | ||
3022 | bool CalendarView::exportVCalendar( QString filename ) | 3022 | bool CalendarView::exportVCalendar( QString filename ) |
3023 | { | 3023 | { |
3024 | if (mCalendar->journals().count() > 0) { | 3024 | if (mCalendar->journals().count() > 0) { |
3025 | int result = KMessageBox::warningContinueCancel(this, | 3025 | int result = KMessageBox::warningContinueCancel(this, |
3026 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3026 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3027 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3027 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3028 | true); | 3028 | true); |
3029 | if (result != KMessageBox::Continue) return false; | 3029 | if (result != KMessageBox::Continue) return false; |
3030 | } | 3030 | } |
3031 | 3031 | ||
3032 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3032 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3033 | 3033 | ||
3034 | // Force correct extension | 3034 | // Force correct extension |
3035 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3035 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3036 | 3036 | ||
3037 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3037 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3038 | return storage.save(); | 3038 | return storage.save(); |
3039 | 3039 | ||
3040 | } | 3040 | } |
3041 | 3041 | ||
3042 | void CalendarView::eventUpdated(Incidence *) | 3042 | void CalendarView::eventUpdated(Incidence *) |
3043 | { | 3043 | { |
3044 | setModified(); | 3044 | setModified(); |
3045 | // Don't call updateView here. The code, which has caused the update of the | 3045 | // Don't call updateView here. The code, which has caused the update of the |
3046 | // event is responsible for updating the view. | 3046 | // event is responsible for updating the view. |
3047 | // updateView(); | 3047 | // updateView(); |
3048 | } | 3048 | } |
3049 | 3049 | ||
3050 | void CalendarView::adaptNavigationUnits() | 3050 | void CalendarView::adaptNavigationUnits() |
3051 | { | 3051 | { |
3052 | if (mViewManager->currentView()->isEventView()) { | 3052 | if (mViewManager->currentView()->isEventView()) { |
3053 | int days = mViewManager->currentView()->currentDateCount(); | 3053 | int days = mViewManager->currentView()->currentDateCount(); |
3054 | if (days == 1) { | 3054 | if (days == 1) { |
3055 | emit changeNavStringPrev(i18n("&Previous Day")); | 3055 | emit changeNavStringPrev(i18n("&Previous Day")); |
3056 | emit changeNavStringNext(i18n("&Next Day")); | 3056 | emit changeNavStringNext(i18n("&Next Day")); |
3057 | } else { | 3057 | } else { |
3058 | emit changeNavStringPrev(i18n("&Previous Week")); | 3058 | emit changeNavStringPrev(i18n("&Previous Week")); |
3059 | emit changeNavStringNext(i18n("&Next Week")); | 3059 | emit changeNavStringNext(i18n("&Next Week")); |
3060 | } | 3060 | } |
3061 | } | 3061 | } |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3064 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3065 | { | 3065 | { |
3066 | if ( incidence ) mTodoList->clearSelection(); | 3066 | if ( incidence ) mTodoList->clearSelection(); |
3067 | processIncidenceSelection( incidence ); | 3067 | processIncidenceSelection( incidence ); |
3068 | } | 3068 | } |
3069 | 3069 | ||
3070 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3070 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3071 | { | 3071 | { |
3072 | if ( incidence && mViewManager->currentView() ) { | 3072 | if ( incidence && mViewManager->currentView() ) { |
3073 | mViewManager->currentView()->clearSelection(); | 3073 | mViewManager->currentView()->clearSelection(); |
3074 | } | 3074 | } |
3075 | processIncidenceSelection( incidence ); | 3075 | processIncidenceSelection( incidence ); |
3076 | } | 3076 | } |
3077 | 3077 | ||
3078 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3078 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3079 | { | 3079 | { |
3080 | if ( incidence == mSelectedIncidence ) return; | 3080 | if ( incidence == mSelectedIncidence ) return; |
3081 | 3081 | ||
3082 | mSelectedIncidence = incidence; | 3082 | mSelectedIncidence = incidence; |
3083 | 3083 | ||
3084 | emit incidenceSelected( mSelectedIncidence ); | 3084 | emit incidenceSelected( mSelectedIncidence ); |
3085 | 3085 | ||
3086 | if ( incidence && incidence->type() == "Event" ) { | 3086 | if ( incidence && incidence->type() == "Event" ) { |
3087 | Event *event = static_cast<Event *>( incidence ); | 3087 | Event *event = static_cast<Event *>( incidence ); |
3088 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3088 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3089 | emit organizerEventsSelected( true ); | 3089 | emit organizerEventsSelected( true ); |
3090 | } else { | 3090 | } else { |
3091 | emit organizerEventsSelected(false); | 3091 | emit organizerEventsSelected(false); |
3092 | } | 3092 | } |
3093 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3093 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3094 | KOPrefs::instance()->email() ) ) { | 3094 | KOPrefs::instance()->email() ) ) { |
3095 | emit groupEventsSelected( true ); | 3095 | emit groupEventsSelected( true ); |
3096 | } else { | 3096 | } else { |
3097 | emit groupEventsSelected(false); | 3097 | emit groupEventsSelected(false); |
3098 | } | 3098 | } |
3099 | return; | 3099 | return; |
3100 | } else { | 3100 | } else { |
3101 | if ( incidence && incidence->type() == "Todo" ) { | 3101 | if ( incidence && incidence->type() == "Todo" ) { |
3102 | emit todoSelected( true ); | 3102 | emit todoSelected( true ); |
3103 | Todo *event = static_cast<Todo *>( incidence ); | 3103 | Todo *event = static_cast<Todo *>( incidence ); |
3104 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3104 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3105 | emit organizerEventsSelected( true ); | 3105 | emit organizerEventsSelected( true ); |
3106 | } else { | 3106 | } else { |
3107 | emit organizerEventsSelected(false); | 3107 | emit organizerEventsSelected(false); |
3108 | } | 3108 | } |
3109 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3109 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3110 | KOPrefs::instance()->email() ) ) { | 3110 | KOPrefs::instance()->email() ) ) { |
3111 | emit groupEventsSelected( true ); | 3111 | emit groupEventsSelected( true ); |
3112 | } else { | 3112 | } else { |
3113 | emit groupEventsSelected(false); | 3113 | emit groupEventsSelected(false); |
3114 | } | 3114 | } |
3115 | return; | 3115 | return; |
3116 | } else { | 3116 | } else { |
3117 | emit todoSelected( false ); | 3117 | emit todoSelected( false ); |
3118 | emit organizerEventsSelected(false); | 3118 | emit organizerEventsSelected(false); |
3119 | emit groupEventsSelected(false); | 3119 | emit groupEventsSelected(false); |
3120 | } | 3120 | } |
3121 | return; | 3121 | return; |
3122 | } | 3122 | } |
3123 | 3123 | ||
3124 | /* if ( incidence && incidence->type() == "Todo" ) { | 3124 | /* if ( incidence && incidence->type() == "Todo" ) { |
3125 | emit todoSelected( true ); | 3125 | emit todoSelected( true ); |
3126 | } else { | 3126 | } else { |
3127 | emit todoSelected( false ); | 3127 | emit todoSelected( false ); |
3128 | }*/ | 3128 | }*/ |
3129 | } | 3129 | } |
3130 | 3130 | ||
3131 | 3131 | ||
3132 | void CalendarView::checkClipboard() | 3132 | void CalendarView::checkClipboard() |
3133 | { | 3133 | { |
3134 | #ifndef KORG_NODND | 3134 | #ifndef KORG_NODND |
3135 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3135 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3136 | emit pasteEnabled(true); | 3136 | emit pasteEnabled(true); |
3137 | } else { | 3137 | } else { |
3138 | emit pasteEnabled(false); | 3138 | emit pasteEnabled(false); |
3139 | } | 3139 | } |
3140 | #endif | 3140 | #endif |
3141 | } | 3141 | } |
3142 | 3142 | ||
3143 | void CalendarView::showDates(const DateList &selectedDates) | 3143 | void CalendarView::showDates(const DateList &selectedDates) |
3144 | { | 3144 | { |
3145 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3145 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3146 | 3146 | ||
3147 | if ( mViewManager->currentView() ) { | 3147 | if ( mViewManager->currentView() ) { |
3148 | updateView( selectedDates.first(), selectedDates.last() ); | 3148 | updateView( selectedDates.first(), selectedDates.last() ); |
3149 | } else { | 3149 | } else { |
3150 | mViewManager->showAgendaView(); | 3150 | mViewManager->showAgendaView(); |
3151 | } | 3151 | } |
3152 | 3152 | ||
3153 | QString selDates; | 3153 | QString selDates; |
3154 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3154 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); |
3155 | if (selectedDates.first() < selectedDates.last() ) | 3155 | if (selectedDates.first() < selectedDates.last() ) |
3156 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3156 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3157 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3157 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3158 | 3158 | ||
3159 | } | 3159 | } |
3160 | 3160 | ||
3161 | QPtrList<CalFilter> CalendarView::filters() | ||
3162 | { | ||
3163 | return mFilters; | ||
3164 | |||
3165 | } | ||
3161 | void CalendarView::editFilters() | 3166 | void CalendarView::editFilters() |
3162 | { | 3167 | { |
3163 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3168 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3164 | 3169 | ||
3165 | CalFilter *filter = mFilters.first(); | 3170 | CalFilter *filter = mFilters.first(); |
3166 | while(filter) { | 3171 | while(filter) { |
3167 | kdDebug() << " Filter: " << filter->name() << endl; | 3172 | kdDebug() << " Filter: " << filter->name() << endl; |
3168 | filter = mFilters.next(); | 3173 | filter = mFilters.next(); |
3169 | } | 3174 | } |
3170 | 3175 | ||
3171 | mDialogManager->showFilterEditDialog(&mFilters); | 3176 | mDialogManager->showFilterEditDialog(&mFilters); |
3172 | } | 3177 | } |
3173 | void CalendarView::toggleFilter() | 3178 | void CalendarView::toggleFilter() |
3174 | { | 3179 | { |
3175 | showFilter(! mFilterView->isVisible()); | 3180 | showFilter(! mFilterView->isVisible()); |
3176 | } | 3181 | } |
3177 | 3182 | ||
3183 | KOFilterView *CalendarView::filterView() | ||
3184 | { | ||
3185 | return mFilterView; | ||
3186 | } | ||
3178 | void CalendarView::selectFilter( int fil ) | 3187 | void CalendarView::selectFilter( int fil ) |
3179 | { | 3188 | { |
3180 | mFilterView->setSelectedFilter( fil ); | 3189 | mFilterView->setSelectedFilter( fil ); |
3181 | } | 3190 | } |
3182 | void CalendarView::showFilter(bool visible) | 3191 | void CalendarView::showFilter(bool visible) |
3183 | { | 3192 | { |
3184 | if (visible) mFilterView->show(); | 3193 | if (visible) mFilterView->show(); |
3185 | else mFilterView->hide(); | 3194 | else mFilterView->hide(); |
3186 | } | 3195 | } |
3187 | void CalendarView::toggleFilerEnabled( ) | 3196 | void CalendarView::toggleFilerEnabled( ) |
3188 | { | 3197 | { |
3189 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3198 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3190 | if ( !mFilterView->filtersEnabled() ) | 3199 | if ( !mFilterView->filtersEnabled() ) |
3191 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3200 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3192 | 3201 | ||
3193 | } | 3202 | } |
3194 | void CalendarView::updateFilter() | 3203 | void CalendarView::updateFilter() |
3195 | { | 3204 | { |
3196 | CalFilter *filter = mFilterView->selectedFilter(); | 3205 | CalFilter *filter = mFilterView->selectedFilter(); |
3197 | if (filter) { | 3206 | if (filter) { |
3198 | if (mFilterView->filtersEnabled()) { | 3207 | if (mFilterView->filtersEnabled()) { |
3199 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); | 3208 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); |
3200 | filter->setEnabled(true); | 3209 | filter->setEnabled(true); |
3201 | } | 3210 | } |
3202 | else filter->setEnabled(false); | 3211 | else filter->setEnabled(false); |
3203 | mCalendar->setFilter(filter); | 3212 | mCalendar->setFilter(filter); |
3204 | updateView(); | 3213 | updateView(); |
3205 | } | 3214 | } |
3206 | } | 3215 | } |
3207 | 3216 | ||
3208 | void CalendarView::filterEdited() | 3217 | void CalendarView::filterEdited() |
3209 | { | 3218 | { |
3210 | mFilterView->updateFilters(); | 3219 | mFilterView->updateFilters(); |
3211 | updateFilter(); | 3220 | updateFilter(); |
3212 | writeSettings(); | 3221 | writeSettings(); |
3213 | } | 3222 | } |
3214 | 3223 | ||
3215 | 3224 | ||
3216 | void CalendarView::takeOverEvent() | 3225 | void CalendarView::takeOverEvent() |
3217 | { | 3226 | { |
3218 | Incidence *incidence = currentSelection(); | 3227 | Incidence *incidence = currentSelection(); |
3219 | 3228 | ||
3220 | if (!incidence) return; | 3229 | if (!incidence) return; |
3221 | 3230 | ||
3222 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3231 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3223 | incidence->recreate(); | 3232 | incidence->recreate(); |
3224 | incidence->setReadOnly(false); | 3233 | incidence->setReadOnly(false); |
3225 | 3234 | ||
3226 | updateView(); | 3235 | updateView(); |
3227 | } | 3236 | } |
3228 | 3237 | ||
3229 | void CalendarView::takeOverCalendar() | 3238 | void CalendarView::takeOverCalendar() |
3230 | { | 3239 | { |
3231 | // TODO: Create Calendar::allIncidences() function and use it here | 3240 | // TODO: Create Calendar::allIncidences() function and use it here |
3232 | 3241 | ||
3233 | QPtrList<Event> events = mCalendar->events(); | 3242 | QPtrList<Event> events = mCalendar->events(); |
3234 | for(uint i=0; i<events.count(); ++i) { | 3243 | for(uint i=0; i<events.count(); ++i) { |
3235 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3244 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3236 | events.at(i)->recreate(); | 3245 | events.at(i)->recreate(); |
3237 | events.at(i)->setReadOnly(false); | 3246 | events.at(i)->setReadOnly(false); |
3238 | } | 3247 | } |
3239 | 3248 | ||
3240 | QPtrList<Todo> todos = mCalendar->todos(); | 3249 | QPtrList<Todo> todos = mCalendar->todos(); |
3241 | for(uint i=0; i<todos.count(); ++i) { | 3250 | for(uint i=0; i<todos.count(); ++i) { |
3242 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3251 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3243 | todos.at(i)->recreate(); | 3252 | todos.at(i)->recreate(); |
3244 | todos.at(i)->setReadOnly(false); | 3253 | todos.at(i)->setReadOnly(false); |
3245 | } | 3254 | } |
3246 | 3255 | ||
3247 | QPtrList<Journal> journals = mCalendar->journals(); | 3256 | QPtrList<Journal> journals = mCalendar->journals(); |
3248 | for(uint i=0; i<journals.count(); ++i) { | 3257 | for(uint i=0; i<journals.count(); ++i) { |
3249 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3258 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3250 | journals.at(i)->recreate(); | 3259 | journals.at(i)->recreate(); |
3251 | journals.at(i)->setReadOnly(false); | 3260 | journals.at(i)->setReadOnly(false); |
3252 | } | 3261 | } |
3253 | 3262 | ||
3254 | updateView(); | 3263 | updateView(); |
3255 | } | 3264 | } |
3256 | 3265 | ||
3257 | void CalendarView::showIntro() | 3266 | void CalendarView::showIntro() |
3258 | { | 3267 | { |
3259 | kdDebug() << "To be implemented." << endl; | 3268 | kdDebug() << "To be implemented." << endl; |
3260 | } | 3269 | } |
3261 | 3270 | ||
3262 | QWidgetStack *CalendarView::viewStack() | 3271 | QWidgetStack *CalendarView::viewStack() |
3263 | { | 3272 | { |
3264 | return mRightFrame; | 3273 | return mRightFrame; |
3265 | } | 3274 | } |
3266 | 3275 | ||
3267 | QWidget *CalendarView::leftFrame() | 3276 | QWidget *CalendarView::leftFrame() |
3268 | { | 3277 | { |
3269 | return mLeftFrame; | 3278 | return mLeftFrame; |
3270 | } | 3279 | } |
3271 | 3280 | ||
3272 | DateNavigator *CalendarView::dateNavigator() | 3281 | DateNavigator *CalendarView::dateNavigator() |
3273 | { | 3282 | { |
3274 | return mNavigator; | 3283 | return mNavigator; |
3275 | } | 3284 | } |
3276 | 3285 | ||
3277 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3286 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3278 | { | 3287 | { |
3279 | return mDateNavigator; | 3288 | return mDateNavigator; |
3280 | } | 3289 | } |
3281 | void CalendarView::toggleDateNavigatorWidget() | 3290 | void CalendarView::toggleDateNavigatorWidget() |
3282 | { | 3291 | { |
3283 | if (mDateNavigator->isVisible()) | 3292 | if (mDateNavigator->isVisible()) |
3284 | mDateNavigator->hide(); | 3293 | mDateNavigator->hide(); |
3285 | else | 3294 | else |
3286 | mDateNavigator->show(); | 3295 | mDateNavigator->show(); |
3287 | } | 3296 | } |
3288 | void CalendarView::addView(KOrg::BaseView *view) | 3297 | void CalendarView::addView(KOrg::BaseView *view) |
3289 | { | 3298 | { |
3290 | mViewManager->addView(view); | 3299 | mViewManager->addView(view); |
3291 | } | 3300 | } |
3292 | 3301 | ||
3293 | void CalendarView::showView(KOrg::BaseView *view) | 3302 | void CalendarView::showView(KOrg::BaseView *view) |
3294 | { | 3303 | { |
3295 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3304 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3296 | } | 3305 | } |
3297 | 3306 | ||
3298 | Incidence *CalendarView::currentSelection() | 3307 | Incidence *CalendarView::currentSelection() |
3299 | { | 3308 | { |
3300 | return mViewManager->currentSelection(); | 3309 | return mViewManager->currentSelection(); |
3301 | } | 3310 | } |
3302 | void CalendarView::toggleAllDaySize() | 3311 | void CalendarView::toggleAllDaySize() |
3303 | { | 3312 | { |
3304 | /* | 3313 | /* |
3305 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3314 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3306 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3315 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3307 | else | 3316 | else |
3308 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3317 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3309 | */ | 3318 | */ |
3310 | viewManager()->agendaView()->toggleAllDay(); | 3319 | viewManager()->agendaView()->toggleAllDay(); |
3311 | } | 3320 | } |
3312 | void CalendarView::toggleExpand() | 3321 | void CalendarView::toggleExpand() |
3313 | { | 3322 | { |
3314 | // if ( mLeftFrame->isHidden() ) { | 3323 | // if ( mLeftFrame->isHidden() ) { |
3315 | // mLeftFrame->show(); | 3324 | // mLeftFrame->show(); |
3316 | // emit calendarViewExpanded( false ); | 3325 | // emit calendarViewExpanded( false ); |
3317 | // } else { | 3326 | // } else { |
3318 | // mLeftFrame->hide(); | 3327 | // mLeftFrame->hide(); |
3319 | // emit calendarViewExpanded( true ); | 3328 | // emit calendarViewExpanded( true ); |
3320 | // } | 3329 | // } |
3321 | 3330 | ||
3322 | globalFlagBlockAgenda = 1; | 3331 | globalFlagBlockAgenda = 1; |
3323 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3332 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3324 | globalFlagBlockAgenda = 5; | 3333 | globalFlagBlockAgenda = 5; |
3325 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3334 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3326 | //mViewManager->showView( 0, true ); | 3335 | //mViewManager->showView( 0, true ); |
3327 | } | 3336 | } |
3328 | 3337 | ||
3329 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3338 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3330 | { | 3339 | { |
3331 | setModified( modified ); | 3340 | setModified( modified ); |
3332 | } | 3341 | } |
3333 | 3342 | ||
3334 | Todo *CalendarView::selectedTodo() | 3343 | Todo *CalendarView::selectedTodo() |
3335 | { | 3344 | { |
3336 | Incidence *incidence = currentSelection(); | 3345 | Incidence *incidence = currentSelection(); |
3337 | if ( incidence && incidence->type() == "Todo" ) { | 3346 | if ( incidence && incidence->type() == "Todo" ) { |
3338 | return static_cast<Todo *>( incidence ); | 3347 | return static_cast<Todo *>( incidence ); |
3339 | } | 3348 | } |
3340 | 3349 | ||
3341 | incidence = mTodoList->selectedIncidences().first(); | 3350 | incidence = mTodoList->selectedIncidences().first(); |
3342 | if ( incidence && incidence->type() == "Todo" ) { | 3351 | if ( incidence && incidence->type() == "Todo" ) { |
3343 | return static_cast<Todo *>( incidence ); | 3352 | return static_cast<Todo *>( incidence ); |
3344 | } | 3353 | } |
3345 | 3354 | ||
3346 | return 0; | 3355 | return 0; |
3347 | } | 3356 | } |
3348 | 3357 | ||
3349 | void CalendarView::dialogClosing(Incidence *in) | 3358 | void CalendarView::dialogClosing(Incidence *in) |
3350 | { | 3359 | { |
3351 | // mDialogList.remove(in); | 3360 | // mDialogList.remove(in); |
3352 | } | 3361 | } |
3353 | 3362 | ||
3354 | void CalendarView::showIncidence() | 3363 | void CalendarView::showIncidence() |
3355 | { | 3364 | { |
3356 | Incidence *incidence = currentSelection(); | 3365 | Incidence *incidence = currentSelection(); |
3357 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3366 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3358 | if ( incidence ) { | 3367 | if ( incidence ) { |
3359 | ShowIncidenceVisitor v; | 3368 | ShowIncidenceVisitor v; |
3360 | v.act( incidence, this ); | 3369 | v.act( incidence, this ); |
3361 | } | 3370 | } |
3362 | } | 3371 | } |
3363 | void CalendarView::editIncidenceDescription() | 3372 | void CalendarView::editIncidenceDescription() |
3364 | { | 3373 | { |
3365 | mFlagEditDescription = true; | 3374 | mFlagEditDescription = true; |
3366 | editIncidence(); | 3375 | editIncidence(); |
3367 | mFlagEditDescription = false; | 3376 | mFlagEditDescription = false; |
3368 | } | 3377 | } |
3369 | void CalendarView::editIncidence() | 3378 | void CalendarView::editIncidence() |
3370 | { | 3379 | { |
3371 | // qDebug("editIncidence() "); | 3380 | // qDebug("editIncidence() "); |
3372 | Incidence *incidence = currentSelection(); | 3381 | Incidence *incidence = currentSelection(); |
3373 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3382 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3374 | if ( incidence ) { | 3383 | if ( incidence ) { |
3375 | EditIncidenceVisitor v; | 3384 | EditIncidenceVisitor v; |
3376 | v.act( incidence, this ); | 3385 | v.act( incidence, this ); |
3377 | } | 3386 | } |
3378 | } | 3387 | } |
3379 | 3388 | ||
3380 | void CalendarView::deleteIncidence() | 3389 | void CalendarView::deleteIncidence() |
3381 | { | 3390 | { |
3382 | Incidence *incidence = currentSelection(); | 3391 | Incidence *incidence = currentSelection(); |
3383 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3392 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3384 | if ( incidence ) { | 3393 | if ( incidence ) { |
3385 | deleteIncidence(incidence); | 3394 | deleteIncidence(incidence); |
3386 | } | 3395 | } |
3387 | } | 3396 | } |
3388 | 3397 | ||
3389 | void CalendarView::showIncidence(Incidence *incidence) | 3398 | void CalendarView::showIncidence(Incidence *incidence) |
3390 | { | 3399 | { |
3391 | if ( incidence ) { | 3400 | if ( incidence ) { |
3392 | ShowIncidenceVisitor v; | 3401 | ShowIncidenceVisitor v; |
3393 | v.act( incidence, this ); | 3402 | v.act( incidence, this ); |
3394 | } | 3403 | } |
3395 | } | 3404 | } |
3396 | 3405 | ||
3397 | void CalendarView::editIncidence(Incidence *incidence) | 3406 | void CalendarView::editIncidence(Incidence *incidence) |
3398 | { | 3407 | { |
3399 | if ( incidence ) { | 3408 | if ( incidence ) { |
3400 | 3409 | ||
3401 | EditIncidenceVisitor v; | 3410 | EditIncidenceVisitor v; |
3402 | v.act( incidence, this ); | 3411 | v.act( incidence, this ); |
3403 | 3412 | ||
3404 | } | 3413 | } |
3405 | } | 3414 | } |
3406 | 3415 | ||
3407 | void CalendarView::deleteIncidence(Incidence *incidence) | 3416 | void CalendarView::deleteIncidence(Incidence *incidence) |
3408 | { | 3417 | { |
3409 | //qDebug(" CalendarView::deleteIncidence "); | 3418 | //qDebug(" CalendarView::deleteIncidence "); |
3410 | if ( incidence ) { | 3419 | if ( incidence ) { |
3411 | DeleteIncidenceVisitor v; | 3420 | DeleteIncidenceVisitor v; |
3412 | v.act( incidence, this ); | 3421 | v.act( incidence, this ); |
3413 | } | 3422 | } |
3414 | } | 3423 | } |
3415 | 3424 | ||
3416 | 3425 | ||
3417 | void CalendarView::lookForOutgoingMessages() | 3426 | void CalendarView::lookForOutgoingMessages() |
3418 | { | 3427 | { |
3419 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3428 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3420 | ogd->loadMessages(); | 3429 | ogd->loadMessages(); |
3421 | } | 3430 | } |
3422 | 3431 | ||
3423 | void CalendarView::lookForIncomingMessages() | 3432 | void CalendarView::lookForIncomingMessages() |
3424 | { | 3433 | { |
3425 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3434 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3426 | icd->retrieve(); | 3435 | icd->retrieve(); |
3427 | } | 3436 | } |
3428 | 3437 | ||
3429 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3438 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3430 | { | 3439 | { |
3431 | bool deleteTodo = true; | 3440 | bool deleteTodo = true; |
3432 | QPtrList<Incidence> subTodos; | 3441 | QPtrList<Incidence> subTodos; |
3433 | Incidence *aTodo; | 3442 | Incidence *aTodo; |
3434 | subTodos = t->relations(); | 3443 | subTodos = t->relations(); |
3435 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3444 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3436 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3445 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3437 | deleteTodo = false; | 3446 | deleteTodo = false; |
3438 | } | 3447 | } |
3439 | if ( deleteTodo ) { | 3448 | if ( deleteTodo ) { |
3440 | if ( t->isCompleted() ) { | 3449 | if ( t->isCompleted() ) { |
3441 | checkExternalId( t ); | 3450 | checkExternalId( t ); |
3442 | mCalendar->deleteTodo( t ); | 3451 | mCalendar->deleteTodo( t ); |
3443 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3452 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3444 | } | 3453 | } |
3445 | else | 3454 | else |
3446 | deleteTodo = false; | 3455 | deleteTodo = false; |
3447 | } | 3456 | } |
3448 | return deleteTodo; | 3457 | return deleteTodo; |
3449 | 3458 | ||
3450 | } | 3459 | } |
3451 | void CalendarView::purgeCompleted() | 3460 | void CalendarView::purgeCompleted() |
3452 | { | 3461 | { |
3453 | int result = KMessageBox::warningContinueCancel(this, | 3462 | int result = KMessageBox::warningContinueCancel(this, |
3454 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3463 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3455 | 3464 | ||
3456 | if (result == KMessageBox::Continue) { | 3465 | if (result == KMessageBox::Continue) { |
3457 | 3466 | ||
3458 | QPtrList<Todo> todoCal; | 3467 | QPtrList<Todo> todoCal; |
3459 | QPtrList<Todo> rootTodos; | 3468 | QPtrList<Todo> rootTodos; |
3460 | //QPtrList<Incidence> rel; | 3469 | //QPtrList<Incidence> rel; |
3461 | Todo *aTodo;//, *rTodo; | 3470 | Todo *aTodo;//, *rTodo; |
3462 | Incidence *rIncidence; | 3471 | Incidence *rIncidence; |
3463 | bool childDelete = false; | 3472 | bool childDelete = false; |
3464 | bool deletedOne = true; | 3473 | bool deletedOne = true; |
3465 | todoCal = calendar()->todos(); | 3474 | todoCal = calendar()->todos(); |
3466 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3475 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3467 | if ( !aTodo->relatedTo() ) | 3476 | if ( !aTodo->relatedTo() ) |
3468 | rootTodos.append( aTodo ); | 3477 | rootTodos.append( aTodo ); |
3469 | } | 3478 | } |
3470 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3479 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3471 | removeCompletedSubTodos( aTodo ); | 3480 | removeCompletedSubTodos( aTodo ); |
3472 | } | 3481 | } |
3473 | 3482 | ||
3474 | updateView(); | 3483 | updateView(); |
3475 | } | 3484 | } |
3476 | } | 3485 | } |
3477 | 3486 | ||
3478 | void CalendarView::slotCalendarChanged() | 3487 | void CalendarView::slotCalendarChanged() |
3479 | { | 3488 | { |
3480 | ; | 3489 | ; |
3481 | } | 3490 | } |
3482 | 3491 | ||
3483 | NavigatorBar *CalendarView::navigatorBar() | 3492 | NavigatorBar *CalendarView::navigatorBar() |
3484 | { | 3493 | { |
3485 | return mNavigatorBar; | 3494 | return mNavigatorBar; |
3486 | } | 3495 | } |
3487 | 3496 | ||
3488 | 3497 | ||
3489 | 3498 | ||
3490 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3499 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3491 | { | 3500 | { |
3492 | //qDebug(" alendarView::keyPressEvent "); | 3501 | //qDebug(" alendarView::keyPressEvent "); |
3493 | e->ignore(); | 3502 | e->ignore(); |
3494 | } | 3503 | } |
3495 | 3504 | ||
3496 | //#include "calendarview.moc" | 3505 | //#include "calendarview.moc" |
3497 | 3506 | ||
3498 | //#include "calendarviewbase.moc" | 3507 | //#include "calendarviewbase.moc" |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index f7a1213..d564473 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,587 +1,588 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | 42 | ||
43 | #include <korganizer/calendarviewbase.h> | 43 | #include <korganizer/calendarviewbase.h> |
44 | 44 | ||
45 | class QWidgetStack; | 45 | class QWidgetStack; |
46 | class QSplitter; | 46 | class QSplitter; |
47 | 47 | ||
48 | class CalPrinter; | 48 | class CalPrinter; |
49 | class KOFilterView; | 49 | class KOFilterView; |
50 | class KOViewManager; | 50 | class KOViewManager; |
51 | class KODialogManager; | 51 | class KODialogManager; |
52 | class KOTodoView; | 52 | class KOTodoView; |
53 | class KDateNavigator; | 53 | class KDateNavigator; |
54 | class DateNavigator; | 54 | class DateNavigator; |
55 | class KOIncidenceEditor; | 55 | class KOIncidenceEditor; |
56 | class KDatePicker; | 56 | class KDatePicker; |
57 | class ResourceView; | 57 | class ResourceView; |
58 | class NavigatorBar; | 58 | class NavigatorBar; |
59 | class KOEventEditor; | 59 | class KOEventEditor; |
60 | class KOTodoEditor ; | 60 | class KOTodoEditor ; |
61 | class KOEventViewerDialog; | 61 | class KOEventViewerDialog; |
62 | class KOBeamPrefs; | 62 | class KOBeamPrefs; |
63 | class KSyncProfile; | 63 | class KSyncProfile; |
64 | class AlarmDialog; | 64 | class AlarmDialog; |
65 | class KCal::Attendee; | 65 | class KCal::Attendee; |
66 | 66 | ||
67 | namespace KCal { class FileStorage; } | 67 | namespace KCal { class FileStorage; } |
68 | 68 | ||
69 | using namespace KCal; | 69 | using namespace KCal; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | This is the main calendar widget. It provides the different vies on t he | 72 | This is the main calendar widget. It provides the different vies on t he |
73 | calendar data as well as the date navigator. It also handles synchronisation | 73 | calendar data as well as the date navigator. It also handles synchronisation |
74 | of the different views and controls the different dialogs like preferences, | 74 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 75 | event editor, search dialog etc. |
76 | 76 | ||
77 | @short main calendar view widget | 77 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 78 | @author Cornelius Schumacher |
79 | */ | 79 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | /** | 84 | /** |
85 | Constructs a new calendar view widget. | 85 | Constructs a new calendar view widget. |
86 | 86 | ||
87 | @param calendar calendar document | 87 | @param calendar calendar document |
88 | @param parent parent window | 88 | @param parent parent window |
89 | @param name Qt internal widget object name | 89 | @param name Qt internal widget object name |
90 | */ | 90 | */ |
91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
92 | const char *name = 0 ); | 92 | const char *name = 0 ); |
93 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 93 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | virtual ~CalendarView(); | 95 | virtual ~CalendarView(); |
96 | 96 | ||
97 | Calendar *calendar() { return mCalendar; } | 97 | Calendar *calendar() { return mCalendar; } |
98 | 98 | ||
99 | KOViewManager *viewManager(); | 99 | KOViewManager *viewManager(); |
100 | KODialogManager *dialogManager(); | 100 | KODialogManager *dialogManager(); |
101 | 101 | ||
102 | QDate startDate(); | 102 | QDate startDate(); |
103 | QDate endDate(); | 103 | QDate endDate(); |
104 | 104 | ||
105 | QWidgetStack *viewStack(); | 105 | QWidgetStack *viewStack(); |
106 | QWidget *leftFrame(); | 106 | QWidget *leftFrame(); |
107 | NavigatorBar *navigatorBar(); | 107 | NavigatorBar *navigatorBar(); |
108 | 108 | ||
109 | DateNavigator *dateNavigator(); | 109 | DateNavigator *dateNavigator(); |
110 | KDateNavigator *dateNavigatorWidget(); | 110 | KDateNavigator *dateNavigatorWidget(); |
111 | 111 | ||
112 | void addView(KOrg::BaseView *); | 112 | void addView(KOrg::BaseView *); |
113 | void showView(KOrg::BaseView *); | 113 | void showView(KOrg::BaseView *); |
114 | KOEventViewerDialog* getEventViewerDialog(); | 114 | KOEventViewerDialog* getEventViewerDialog(); |
115 | Incidence *currentSelection(); | 115 | Incidence *currentSelection(); |
116 | void setupExternSyncProfiles(); | 116 | void setupExternSyncProfiles(); |
117 | 117 | ||
118 | signals: | 118 | signals: |
119 | /** This todo has been modified */ | 119 | /** This todo has been modified */ |
120 | void todoModified(Todo *, int); | 120 | void todoModified(Todo *, int); |
121 | 121 | ||
122 | /** when change is made to options dialog, the topwidget will catch this | 122 | /** when change is made to options dialog, the topwidget will catch this |
123 | * and emit this signal which notifies all widgets which have registered | 123 | * and emit this signal which notifies all widgets which have registered |
124 | * for notification to update their settings. */ | 124 | * for notification to update their settings. */ |
125 | void configChanged(); | 125 | void configChanged(); |
126 | /** emitted when the topwidget is closing down, so that any attached | 126 | /** emitted when the topwidget is closing down, so that any attached |
127 | child windows can also close. */ | 127 | child windows can also close. */ |
128 | void closingDown(); | 128 | void closingDown(); |
129 | /** emitted right before we die */ | 129 | /** emitted right before we die */ |
130 | void closed(QWidget *); | 130 | void closed(QWidget *); |
131 | 131 | ||
132 | /** Emitted when state of modified flag changes */ | 132 | /** Emitted when state of modified flag changes */ |
133 | void modifiedChanged(bool); | 133 | void modifiedChanged(bool); |
134 | void signalmodified(); | 134 | void signalmodified(); |
135 | 135 | ||
136 | /** Emitted when state of read-only flag changes */ | 136 | /** Emitted when state of read-only flag changes */ |
137 | void readOnlyChanged(bool); | 137 | void readOnlyChanged(bool); |
138 | 138 | ||
139 | /** Emitted when the unit of navigation changes */ | 139 | /** Emitted when the unit of navigation changes */ |
140 | void changeNavStringPrev(const QString &); | 140 | void changeNavStringPrev(const QString &); |
141 | void changeNavStringNext(const QString &); | 141 | void changeNavStringNext(const QString &); |
142 | 142 | ||
143 | /** Emitted when state of events selection has changed and user is organizer*/ | 143 | /** Emitted when state of events selection has changed and user is organizer*/ |
144 | void organizerEventsSelected(bool); | 144 | void organizerEventsSelected(bool); |
145 | /** Emitted when state of events selection has changed and user is attendee*/ | 145 | /** Emitted when state of events selection has changed and user is attendee*/ |
146 | void groupEventsSelected(bool); | 146 | void groupEventsSelected(bool); |
147 | /** | 147 | /** |
148 | Emitted when an incidence gets selected. If the selection is cleared the | 148 | Emitted when an incidence gets selected. If the selection is cleared the |
149 | signal is emitted with 0 as argument. | 149 | signal is emitted with 0 as argument. |
150 | */ | 150 | */ |
151 | void incidenceSelected( Incidence * ); | 151 | void incidenceSelected( Incidence * ); |
152 | /** Emitted, when a todoitem is selected or deselected. */ | 152 | /** Emitted, when a todoitem is selected or deselected. */ |
153 | void todoSelected( bool ); | 153 | void todoSelected( bool ); |
154 | 154 | ||
155 | /** | 155 | /** |
156 | Emitted, when clipboard content changes. Parameter indicates if paste | 156 | Emitted, when clipboard content changes. Parameter indicates if paste |
157 | is possible or not. | 157 | is possible or not. |
158 | */ | 158 | */ |
159 | void pasteEnabled(bool); | 159 | void pasteEnabled(bool); |
160 | 160 | ||
161 | /** Emitted, when the number of incoming messages has changed. */ | 161 | /** Emitted, when the number of incoming messages has changed. */ |
162 | void numIncomingChanged(int); | 162 | void numIncomingChanged(int); |
163 | 163 | ||
164 | /** Emitted, when the number of outgoing messages has changed. */ | 164 | /** Emitted, when the number of outgoing messages has changed. */ |
165 | void numOutgoingChanged(int); | 165 | void numOutgoingChanged(int); |
166 | 166 | ||
167 | /** Send status message, which can e.g. be displayed in the status bar. */ | 167 | /** Send status message, which can e.g. be displayed in the status bar. */ |
168 | void statusMessage(const QString &); | 168 | void statusMessage(const QString &); |
169 | 169 | ||
170 | void calendarViewExpanded( bool ); | 170 | void calendarViewExpanded( bool ); |
171 | void updateSearchDialog(); | 171 | void updateSearchDialog(); |
172 | 172 | ||
173 | 173 | ||
174 | public slots: | 174 | public slots: |
175 | void recheckTimerAlarm(); | 175 | void recheckTimerAlarm(); |
176 | void checkNextTimerAlarm(); | 176 | void checkNextTimerAlarm(); |
177 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 177 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
178 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 178 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
179 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 179 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
180 | 180 | ||
181 | /** options dialog made a changed to the configuration. we catch this | 181 | /** options dialog made a changed to the configuration. we catch this |
182 | * and notify all widgets which need to update their configuration. */ | 182 | * and notify all widgets which need to update their configuration. */ |
183 | void updateConfig(); | 183 | void updateConfig(); |
184 | 184 | ||
185 | /** | 185 | /** |
186 | Load calendar from file \a filename. If \a merge is true, load | 186 | Load calendar from file \a filename. If \a merge is true, load |
187 | calendar into existing one, if it is false, clear calendar, before | 187 | calendar into existing one, if it is false, clear calendar, before |
188 | loading. Return true, if calendar could be successfully loaded. | 188 | loading. Return true, if calendar could be successfully loaded. |
189 | */ | 189 | */ |
190 | bool openCalendar(QString filename, bool merge=false); | 190 | bool openCalendar(QString filename, bool merge=false); |
191 | bool syncCalendar(QString filename,int mode = 0 ); | 191 | bool syncCalendar(QString filename,int mode = 0 ); |
192 | 192 | ||
193 | /** | 193 | /** |
194 | Save calendar data to file. Return true if calendar could be | 194 | Save calendar data to file. Return true if calendar could be |
195 | successfully saved. | 195 | successfully saved. |
196 | */ | 196 | */ |
197 | bool saveCalendar(QString filename); | 197 | bool saveCalendar(QString filename); |
198 | 198 | ||
199 | /** | 199 | /** |
200 | Close calendar. Clear calendar data and reset views to display an empty | 200 | Close calendar. Clear calendar data and reset views to display an empty |
201 | calendar. | 201 | calendar. |
202 | */ | 202 | */ |
203 | void closeCalendar(); | 203 | void closeCalendar(); |
204 | 204 | ||
205 | /** Archive old events of calendar */ | 205 | /** Archive old events of calendar */ |
206 | void archiveCalendar(); | 206 | void archiveCalendar(); |
207 | 207 | ||
208 | void showIncidence(); | 208 | void showIncidence(); |
209 | void editIncidence(); | 209 | void editIncidence(); |
210 | void editIncidenceDescription(); | 210 | void editIncidenceDescription(); |
211 | void deleteIncidence(); | 211 | void deleteIncidence(); |
212 | 212 | ||
213 | /** create an editeventwin with supplied date/time, and if bool is true, | 213 | /** create an editeventwin with supplied date/time, and if bool is true, |
214 | * make the event take all day. */ | 214 | * make the event take all day. */ |
215 | void newEvent(QDateTime, QDateTime, bool allDay = false); | 215 | void newEvent(QDateTime, QDateTime, bool allDay = false); |
216 | void newEvent(QDateTime fh); | 216 | void newEvent(QDateTime fh); |
217 | void newEvent(QDate dt); | 217 | void newEvent(QDate dt); |
218 | /** create new event without having a date hint. Takes current date as | 218 | /** create new event without having a date hint. Takes current date as |
219 | default hint. */ | 219 | default hint. */ |
220 | void newEvent(); | 220 | void newEvent(); |
221 | void newFloatingEvent(); | 221 | void newFloatingEvent(); |
222 | 222 | ||
223 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 223 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
224 | void showIncidence(Incidence *); | 224 | void showIncidence(Incidence *); |
225 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 225 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
226 | void editIncidence(Incidence *); | 226 | void editIncidence(Incidence *); |
227 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 227 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
228 | void deleteIncidence(Incidence *); | 228 | void deleteIncidence(Incidence *); |
229 | void cloneIncidence(Incidence *); | 229 | void cloneIncidence(Incidence *); |
230 | void cancelIncidence(Incidence *); | 230 | void cancelIncidence(Incidence *); |
231 | /** Create an editor for the supplied event. */ | 231 | /** Create an editor for the supplied event. */ |
232 | void editEvent(Event *); | 232 | void editEvent(Event *); |
233 | /** Delete the supplied event. */ | 233 | /** Delete the supplied event. */ |
234 | void deleteEvent(Event *); | 234 | void deleteEvent(Event *); |
235 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 235 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
236 | found. */ | 236 | found. */ |
237 | bool deleteEvent(const QString &uid); | 237 | bool deleteEvent(const QString &uid); |
238 | /** Create a read-only viewer dialog for the supplied event. */ | 238 | /** Create a read-only viewer dialog for the supplied event. */ |
239 | void showEvent(Event *); | 239 | void showEvent(Event *); |
240 | 240 | ||
241 | void editJournal(Journal *); | 241 | void editJournal(Journal *); |
242 | void showJournal(Journal *); | 242 | void showJournal(Journal *); |
243 | void deleteJournal(Journal *); | 243 | void deleteJournal(Journal *); |
244 | /** Create an editor dialog for a todo */ | 244 | /** Create an editor dialog for a todo */ |
245 | void editTodo(Todo *); | 245 | void editTodo(Todo *); |
246 | /** Create a read-only viewer dialog for the supplied todo */ | 246 | /** Create a read-only viewer dialog for the supplied todo */ |
247 | void showTodo(Todo *); | 247 | void showTodo(Todo *); |
248 | /** create new todo */ | 248 | /** create new todo */ |
249 | void newTodo(); | 249 | void newTodo(); |
250 | /** create new todo with a parent todo */ | 250 | /** create new todo with a parent todo */ |
251 | void newSubTodo(); | 251 | void newSubTodo(); |
252 | /** create new todo with a parent todo */ | 252 | /** create new todo with a parent todo */ |
253 | void newSubTodo(Todo *); | 253 | void newSubTodo(Todo *); |
254 | /** Delete todo */ | 254 | /** Delete todo */ |
255 | void deleteTodo(Todo *); | 255 | void deleteTodo(Todo *); |
256 | 256 | ||
257 | 257 | ||
258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
259 | * emitted as result. */ | 259 | * emitted as result. */ |
260 | void checkClipboard(); | 260 | void checkClipboard(); |
261 | 261 | ||
262 | /** using the KConfig associated with the kapp variable, read in the | 262 | /** using the KConfig associated with the kapp variable, read in the |
263 | * settings from the config file. | 263 | * settings from the config file. |
264 | */ | 264 | */ |
265 | void readSettings(); | 265 | void readSettings(); |
266 | 266 | ||
267 | /** write current state to config file. */ | 267 | /** write current state to config file. */ |
268 | void writeSettings(); | 268 | void writeSettings(); |
269 | 269 | ||
270 | /** read settings for calendar filters */ | 270 | /** read settings for calendar filters */ |
271 | void readFilterSettings(KConfig *config); | 271 | void readFilterSettings(KConfig *config); |
272 | 272 | ||
273 | /** write settings for calendar filters */ | 273 | /** write settings for calendar filters */ |
274 | void writeFilterSettings(KConfig *config); | 274 | void writeFilterSettings(KConfig *config); |
275 | 275 | ||
276 | /** passes on the message that an event has changed to the currently | 276 | /** passes on the message that an event has changed to the currently |
277 | * activated view so that it can make appropriate display changes. */ | 277 | * activated view so that it can make appropriate display changes. */ |
278 | void changeEventDisplay(Event *, int); | 278 | void changeEventDisplay(Event *, int); |
279 | void changeIncidenceDisplay(Incidence *, int); | 279 | void changeIncidenceDisplay(Incidence *, int); |
280 | void changeTodoDisplay(Todo *, int); | 280 | void changeTodoDisplay(Todo *, int); |
281 | 281 | ||
282 | void eventAdded(Event *); | 282 | void eventAdded(Event *); |
283 | void eventChanged(Event *); | 283 | void eventChanged(Event *); |
284 | void eventToBeDeleted(Event *); | 284 | void eventToBeDeleted(Event *); |
285 | void eventDeleted(); | 285 | void eventDeleted(); |
286 | 286 | ||
287 | void todoAdded(Todo *); | 287 | void todoAdded(Todo *); |
288 | void todoChanged(Todo *); | 288 | void todoChanged(Todo *); |
289 | void todoToBeDeleted(Todo *); | 289 | void todoToBeDeleted(Todo *); |
290 | void todoDeleted(); | 290 | void todoDeleted(); |
291 | 291 | ||
292 | void updateView(const QDate &start, const QDate &end); | 292 | void updateView(const QDate &start, const QDate &end); |
293 | void updateView(); | 293 | void updateView(); |
294 | 294 | ||
295 | /** Full update of visible todo views */ | 295 | /** Full update of visible todo views */ |
296 | void updateTodoViews(); | 296 | void updateTodoViews(); |
297 | 297 | ||
298 | void updateUnmanagedViews(); | 298 | void updateUnmanagedViews(); |
299 | 299 | ||
300 | /** cut the current appointment to the clipboard */ | 300 | /** cut the current appointment to the clipboard */ |
301 | void edit_cut(); | 301 | void edit_cut(); |
302 | 302 | ||
303 | /** copy the current appointment(s) to the clipboard */ | 303 | /** copy the current appointment(s) to the clipboard */ |
304 | void edit_copy(); | 304 | void edit_copy(); |
305 | 305 | ||
306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
307 | void edit_paste(); | 307 | void edit_paste(); |
308 | 308 | ||
309 | /** edit viewing and configuration options. */ | 309 | /** edit viewing and configuration options. */ |
310 | void edit_options(); | 310 | void edit_options(); |
311 | void edit_sync_options(); | 311 | void edit_sync_options(); |
312 | /** | 312 | /** |
313 | Functions for printing, previewing a print, and setting up printing | 313 | Functions for printing, previewing a print, and setting up printing |
314 | parameters. | 314 | parameters. |
315 | */ | 315 | */ |
316 | void print(); | 316 | void print(); |
317 | void printSetup(); | 317 | void printSetup(); |
318 | void printPreview(); | 318 | void printPreview(); |
319 | 319 | ||
320 | /** Export as iCalendar file */ | 320 | /** Export as iCalendar file */ |
321 | void exportICalendar(); | 321 | void exportICalendar(); |
322 | 322 | ||
323 | /** Export as vCalendar file */ | 323 | /** Export as vCalendar file */ |
324 | bool exportVCalendar( QString fn); | 324 | bool exportVCalendar( QString fn); |
325 | 325 | ||
326 | /** pop up a dialog to show an existing appointment. */ | 326 | /** pop up a dialog to show an existing appointment. */ |
327 | void appointment_show(); | 327 | void appointment_show(); |
328 | /** | 328 | /** |
329 | * pop up an Appointment Dialog to edit an existing appointment.Get | 329 | * pop up an Appointment Dialog to edit an existing appointment.Get |
330 | * information on the appointment from the list of unique IDs that is | 330 | * information on the appointment from the list of unique IDs that is |
331 | * currently in the View, called currIds. | 331 | * currently in the View, called currIds. |
332 | */ | 332 | */ |
333 | void appointment_edit(); | 333 | void appointment_edit(); |
334 | /** | 334 | /** |
335 | * pop up dialog confirming deletion of currently selected event in the | 335 | * pop up dialog confirming deletion of currently selected event in the |
336 | * View. | 336 | * View. |
337 | */ | 337 | */ |
338 | void appointment_delete(); | 338 | void appointment_delete(); |
339 | 339 | ||
340 | /** mails the currently selected event to a particular user as a vCalendar | 340 | /** mails the currently selected event to a particular user as a vCalendar |
341 | attachment. */ | 341 | attachment. */ |
342 | void action_mail(); | 342 | void action_mail(); |
343 | 343 | ||
344 | /* frees a subtodo from it's relation */ | 344 | /* frees a subtodo from it's relation */ |
345 | void todo_unsub( Todo * ); | 345 | void todo_unsub( Todo * ); |
346 | 346 | ||
347 | /** Take ownership of selected event. */ | 347 | /** Take ownership of selected event. */ |
348 | void takeOverEvent(); | 348 | void takeOverEvent(); |
349 | 349 | ||
350 | /** Take ownership of all events in calendar. */ | 350 | /** Take ownership of all events in calendar. */ |
351 | void takeOverCalendar(); | 351 | void takeOverCalendar(); |
352 | 352 | ||
353 | /** query whether or not the calendar is "dirty". */ | 353 | /** query whether or not the calendar is "dirty". */ |
354 | bool isModified(); | 354 | bool isModified(); |
355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
356 | void setModified(bool modified=true); | 356 | void setModified(bool modified=true); |
357 | 357 | ||
358 | /** query if the calendar is read-only. */ | 358 | /** query if the calendar is read-only. */ |
359 | bool isReadOnly(); | 359 | bool isReadOnly(); |
360 | /** set state of calendar to read-only */ | 360 | /** set state of calendar to read-only */ |
361 | void setReadOnly(bool readOnly=true); | 361 | void setReadOnly(bool readOnly=true); |
362 | 362 | ||
363 | void eventUpdated(Incidence *); | 363 | void eventUpdated(Incidence *); |
364 | 364 | ||
365 | /* iTIP scheduling actions */ | 365 | /* iTIP scheduling actions */ |
366 | void schedule_publish(Incidence *incidence = 0); | 366 | void schedule_publish(Incidence *incidence = 0); |
367 | void schedule_request(Incidence *incidence = 0); | 367 | void schedule_request(Incidence *incidence = 0); |
368 | void schedule_refresh(Incidence *incidence = 0); | 368 | void schedule_refresh(Incidence *incidence = 0); |
369 | void schedule_cancel(Incidence *incidence = 0); | 369 | void schedule_cancel(Incidence *incidence = 0); |
370 | void schedule_add(Incidence *incidence = 0); | 370 | void schedule_add(Incidence *incidence = 0); |
371 | void schedule_reply(Incidence *incidence = 0); | 371 | void schedule_reply(Incidence *incidence = 0); |
372 | void schedule_counter(Incidence *incidence = 0); | 372 | void schedule_counter(Incidence *incidence = 0); |
373 | void schedule_declinecounter(Incidence *incidence = 0); | 373 | void schedule_declinecounter(Incidence *incidence = 0); |
374 | void schedule_publish_freebusy(int daysToPublish = 30); | 374 | void schedule_publish_freebusy(int daysToPublish = 30); |
375 | 375 | ||
376 | void openAddressbook(); | 376 | void openAddressbook(); |
377 | 377 | ||
378 | void editFilters(); | 378 | void editFilters(); |
379 | void toggleFilerEnabled(); | 379 | void toggleFilerEnabled(); |
380 | 380 | QPtrList<CalFilter> filters(); | |
381 | void toggleFilter(); | 381 | void toggleFilter(); |
382 | void showFilter(bool visible); | 382 | void showFilter(bool visible); |
383 | void updateFilter(); | 383 | void updateFilter(); |
384 | void filterEdited(); | 384 | void filterEdited(); |
385 | void selectFilter( int ); | 385 | void selectFilter( int ); |
386 | KOFilterView *filterView(); | ||
386 | 387 | ||
387 | void showIntro(); | 388 | void showIntro(); |
388 | 389 | ||
389 | /** Move the curdatepient view date to today */ | 390 | /** Move the curdatepient view date to today */ |
390 | void goToday(); | 391 | void goToday(); |
391 | 392 | ||
392 | /** Move to the next date(s) in the current view */ | 393 | /** Move to the next date(s) in the current view */ |
393 | void goNext(); | 394 | void goNext(); |
394 | 395 | ||
395 | /** Move to the previous date(s) in the current view */ | 396 | /** Move to the previous date(s) in the current view */ |
396 | void goPrevious(); | 397 | void goPrevious(); |
397 | /** Move to the next date(s) in the current view */ | 398 | /** Move to the next date(s) in the current view */ |
398 | void goNextMonth(); | 399 | void goNextMonth(); |
399 | 400 | ||
400 | /** Move to the previous date(s) in the current view */ | 401 | /** Move to the previous date(s) in the current view */ |
401 | void goPreviousMonth(); | 402 | void goPreviousMonth(); |
402 | 403 | ||
403 | void toggleExpand(); | 404 | void toggleExpand(); |
404 | void toggleDateNavigatorWidget(); | 405 | void toggleDateNavigatorWidget(); |
405 | void toggleAllDaySize(); | 406 | void toggleAllDaySize(); |
406 | void dialogClosing(Incidence *); | 407 | void dialogClosing(Incidence *); |
407 | 408 | ||
408 | /** Look for new messages in the inbox */ | 409 | /** Look for new messages in the inbox */ |
409 | void lookForIncomingMessages(); | 410 | void lookForIncomingMessages(); |
410 | /** Look for new messages in the outbox */ | 411 | /** Look for new messages in the outbox */ |
411 | void lookForOutgoingMessages(); | 412 | void lookForOutgoingMessages(); |
412 | 413 | ||
413 | void processMainViewSelection( Incidence * ); | 414 | void processMainViewSelection( Incidence * ); |
414 | void processTodoListSelection( Incidence * ); | 415 | void processTodoListSelection( Incidence * ); |
415 | 416 | ||
416 | void processIncidenceSelection( Incidence * ); | 417 | void processIncidenceSelection( Incidence * ); |
417 | 418 | ||
418 | void purgeCompleted(); | 419 | void purgeCompleted(); |
419 | bool removeCompletedSubTodos( Todo* ); | 420 | bool removeCompletedSubTodos( Todo* ); |
420 | void slotCalendarChanged(); | 421 | void slotCalendarChanged(); |
421 | bool importBday(); | 422 | bool importBday(); |
422 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 423 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
423 | bool importQtopia( const QString &categoriesFile, | 424 | bool importQtopia( const QString &categoriesFile, |
424 | const QString &datebookFile, | 425 | const QString &datebookFile, |
425 | const QString &tasklistFile ); | 426 | const QString &tasklistFile ); |
426 | void syncSharp( ); | 427 | void syncSharp( ); |
427 | void slotSelectPickerDate( QDate ) ; | 428 | void slotSelectPickerDate( QDate ) ; |
428 | void showDatePicker( ) ; | 429 | void showDatePicker( ) ; |
429 | void moveIncidence(Incidence *) ; | 430 | void moveIncidence(Incidence *) ; |
430 | void beamIncidence(Incidence *) ; | 431 | void beamIncidence(Incidence *) ; |
431 | void beamCalendar() ; | 432 | void beamCalendar() ; |
432 | void beamFilteredCalendar() ; | 433 | void beamFilteredCalendar() ; |
433 | void beamIncidenceList(QPtrList<Incidence>) ; | 434 | void beamIncidenceList(QPtrList<Incidence>) ; |
434 | void manageCategories(); | 435 | void manageCategories(); |
435 | int addCategories(); | 436 | int addCategories(); |
436 | void removeCategories(); | 437 | void removeCategories(); |
437 | void setSyncDevice( QString ); | 438 | void setSyncDevice( QString ); |
438 | void setSyncName( QString ); | 439 | void setSyncName( QString ); |
439 | protected slots: | 440 | protected slots: |
440 | void timerAlarm(); | 441 | void timerAlarm(); |
441 | void suspendAlarm(); | 442 | void suspendAlarm(); |
442 | void beamDone( Ir *ir ); | 443 | void beamDone( Ir *ir ); |
443 | /** Select a view or adapt the current view to display the specified dates. */ | 444 | /** Select a view or adapt the current view to display the specified dates. */ |
444 | void showDates( const KCal::DateList & ); | 445 | void showDates( const KCal::DateList & ); |
445 | void selectWeekNum ( int ); | 446 | void selectWeekNum ( int ); |
446 | 447 | ||
447 | public: | 448 | public: |
448 | // show a standard warning | 449 | // show a standard warning |
449 | // returns KMsgBox::yesNoCancel() | 450 | // returns KMsgBox::yesNoCancel() |
450 | int msgCalModified(); | 451 | int msgCalModified(); |
451 | void confSync(); | 452 | void confSync(); |
452 | void setLoadedFileVersion(QDateTime); | 453 | void setLoadedFileVersion(QDateTime); |
453 | bool checkFileVersion(QString fn); | 454 | bool checkFileVersion(QString fn); |
454 | bool checkFileChanged(QString fn); | 455 | bool checkFileChanged(QString fn); |
455 | Event* getLastSyncEvent(); | 456 | Event* getLastSyncEvent(); |
456 | /** Adapt navigation units correpsonding to step size of navigation of the | 457 | /** Adapt navigation units correpsonding to step size of navigation of the |
457 | * current view. | 458 | * current view. |
458 | */ | 459 | */ |
459 | void adaptNavigationUnits(); | 460 | void adaptNavigationUnits(); |
460 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 461 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
461 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 462 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
462 | //Attendee* getYourAttendee(Event *event); | 463 | //Attendee* getYourAttendee(Event *event); |
463 | protected: | 464 | protected: |
464 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 465 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
465 | 466 | ||
466 | // returns KMsgBox::OKCandel() | 467 | // returns KMsgBox::OKCandel() |
467 | int msgItemDelete(); | 468 | int msgItemDelete(); |
468 | void showEventEditor(); | 469 | void showEventEditor(); |
469 | void showTodoEditor(); | 470 | void showTodoEditor(); |
470 | void writeLocale(); | 471 | void writeLocale(); |
471 | Todo *selectedTodo(); | 472 | Todo *selectedTodo(); |
472 | 473 | ||
473 | private: | 474 | private: |
474 | AlarmDialog * mAlarmDialog; | 475 | AlarmDialog * mAlarmDialog; |
475 | QString mAlarmNotification; | 476 | QString mAlarmNotification; |
476 | QString mSuspendAlarmNotification; | 477 | QString mSuspendAlarmNotification; |
477 | QTimer* mSuspendTimer; | 478 | QTimer* mSuspendTimer; |
478 | QTimer* mAlarmTimer; | 479 | QTimer* mAlarmTimer; |
479 | QTimer* mRecheckAlarmTimer; | 480 | QTimer* mRecheckAlarmTimer; |
480 | void computeAlarm( QString ); | 481 | void computeAlarm( QString ); |
481 | void startAlarm( QString, QString ); | 482 | void startAlarm( QString, QString ); |
482 | void setSyncEventsReadOnly(); | 483 | void setSyncEventsReadOnly(); |
483 | 484 | ||
484 | QDateTime loadedFileVersion; | 485 | QDateTime loadedFileVersion; |
485 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 486 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
486 | void checkExternalId( Incidence * inc ); | 487 | void checkExternalId( Incidence * inc ); |
487 | int mGlobalSyncMode; | 488 | int mGlobalSyncMode; |
488 | QString mCurrentSyncDevice; | 489 | QString mCurrentSyncDevice; |
489 | QString mCurrentSyncName; | 490 | QString mCurrentSyncName; |
490 | KOBeamPrefs* beamDialog; | 491 | KOBeamPrefs* beamDialog; |
491 | void init(); | 492 | void init(); |
492 | int mDatePickerMode; | 493 | int mDatePickerMode; |
493 | bool mFlagEditDescription; | 494 | bool mFlagEditDescription; |
494 | QDateTime mLastCalendarSync; | 495 | QDateTime mLastCalendarSync; |
495 | void createPrinter(); | 496 | void createPrinter(); |
496 | 497 | ||
497 | void calendarModified( bool, Calendar * ); | 498 | void calendarModified( bool, Calendar * ); |
498 | 499 | ||
499 | CalPrinter *mCalPrinter; | 500 | CalPrinter *mCalPrinter; |
500 | 501 | ||
501 | QSplitter *mPanner; | 502 | QSplitter *mPanner; |
502 | QSplitter *mLeftSplitter; | 503 | QSplitter *mLeftSplitter; |
503 | QWidget *mLeftFrame; | 504 | QWidget *mLeftFrame; |
504 | QWidgetStack *mRightFrame; | 505 | QWidgetStack *mRightFrame; |
505 | 506 | ||
506 | KDatePicker* mDatePicker; | 507 | KDatePicker* mDatePicker; |
507 | QVBox* mDateFrame; | 508 | QVBox* mDateFrame; |
508 | NavigatorBar *mNavigatorBar; | 509 | NavigatorBar *mNavigatorBar; |
509 | 510 | ||
510 | KDateNavigator *mDateNavigator; // widget showing small month view. | 511 | KDateNavigator *mDateNavigator; // widget showing small month view. |
511 | 512 | ||
512 | KOFilterView *mFilterView; | 513 | KOFilterView *mFilterView; |
513 | 514 | ||
514 | ResourceView *mResourceView; | 515 | ResourceView *mResourceView; |
515 | 516 | ||
516 | // calendar object for this viewing instance | 517 | // calendar object for this viewing instance |
517 | Calendar *mCalendar; | 518 | Calendar *mCalendar; |
518 | 519 | ||
519 | CalendarResourceManager *mResourceManager; | 520 | CalendarResourceManager *mResourceManager; |
520 | 521 | ||
521 | FileStorage *mStorage; | 522 | FileStorage *mStorage; |
522 | 523 | ||
523 | DateNavigator *mNavigator; | 524 | DateNavigator *mNavigator; |
524 | 525 | ||
525 | KOViewManager *mViewManager; | 526 | KOViewManager *mViewManager; |
526 | KODialogManager *mDialogManager; | 527 | KODialogManager *mDialogManager; |
527 | 528 | ||
528 | // Calendar filters | 529 | // Calendar filters |
529 | QPtrList<CalFilter> mFilters; | 530 | QPtrList<CalFilter> mFilters; |
530 | 531 | ||
531 | // various housekeeping variables. | 532 | // various housekeeping variables. |
532 | bool mModified; // flag indicating if calendar is modified | 533 | bool mModified; // flag indicating if calendar is modified |
533 | bool mReadOnly; // flag indicating if calendar is read-only | 534 | bool mReadOnly; // flag indicating if calendar is read-only |
534 | QDate mSaveSingleDate; | 535 | QDate mSaveSingleDate; |
535 | 536 | ||
536 | Incidence *mSelectedIncidence; | 537 | Incidence *mSelectedIncidence; |
537 | Incidence *mMoveIncidence; | 538 | Incidence *mMoveIncidence; |
538 | QPtrList<Event> mExternLastSyncEvent; | 539 | QPtrList<Event> mExternLastSyncEvent; |
539 | KOTodoView *mTodoList; | 540 | KOTodoView *mTodoList; |
540 | KOEventEditor * mEventEditor; | 541 | KOEventEditor * mEventEditor; |
541 | KOTodoEditor * mTodoEditor; | 542 | KOTodoEditor * mTodoEditor; |
542 | KOEventViewerDialog * mEventViewerDialog; | 543 | KOEventViewerDialog * mEventViewerDialog; |
543 | void keyPressEvent ( QKeyEvent *e) ; | 544 | void keyPressEvent ( QKeyEvent *e) ; |
544 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 545 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
545 | }; | 546 | }; |
546 | 547 | ||
547 | 548 | ||
548 | class CalendarViewVisitor : public Incidence::Visitor | 549 | class CalendarViewVisitor : public Incidence::Visitor |
549 | { | 550 | { |
550 | public: | 551 | public: |
551 | CalendarViewVisitor() : mView( 0 ) {} | 552 | CalendarViewVisitor() : mView( 0 ) {} |
552 | 553 | ||
553 | bool act( Incidence *incidence, CalendarView *view ) | 554 | bool act( Incidence *incidence, CalendarView *view ) |
554 | { | 555 | { |
555 | mView = view; | 556 | mView = view; |
556 | return incidence->accept( *this ); | 557 | return incidence->accept( *this ); |
557 | } | 558 | } |
558 | 559 | ||
559 | protected: | 560 | protected: |
560 | CalendarView *mView; | 561 | CalendarView *mView; |
561 | }; | 562 | }; |
562 | 563 | ||
563 | class ShowIncidenceVisitor : public CalendarViewVisitor | 564 | class ShowIncidenceVisitor : public CalendarViewVisitor |
564 | { | 565 | { |
565 | protected: | 566 | protected: |
566 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 567 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
567 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 568 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
568 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 569 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
569 | }; | 570 | }; |
570 | 571 | ||
571 | class EditIncidenceVisitor : public CalendarViewVisitor | 572 | class EditIncidenceVisitor : public CalendarViewVisitor |
572 | { | 573 | { |
573 | protected: | 574 | protected: |
574 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 575 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
575 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 576 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
576 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 577 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
577 | }; | 578 | }; |
578 | 579 | ||
579 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 580 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
580 | { | 581 | { |
581 | protected: | 582 | protected: |
582 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 583 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
583 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 584 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
584 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 585 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
585 | }; | 586 | }; |
586 | 587 | ||
587 | #endif | 588 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 57b299f..a93d8e5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2008 +1,2051 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qapp.h> | 11 | #include <qapp.h> |
12 | #include <qfileinfo.h> | 12 | #include <qfileinfo.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qwmatrix.h> | 14 | #include <qwmatrix.h> |
15 | #include <qtextbrowser.h> | 15 | #include <qtextbrowser.h> |
16 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #ifndef DESKTOP_VERSION | 17 | #ifndef DESKTOP_VERSION |
18 | #include <qpe/global.h> | 18 | #include <qpe/global.h> |
19 | #include <qpe/qpemenubar.h> | 19 | #include <qpe/qpemenubar.h> |
20 | #include <qpe/qpetoolbar.h> | 20 | #include <qpe/qpetoolbar.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qtopia/alarmserver.h> | 23 | #include <qtopia/alarmserver.h> |
24 | #include <qtopia/qcopenvelope_qws.h> | 24 | #include <qtopia/qcopenvelope_qws.h> |
25 | #else | 25 | #else |
26 | #include <qmenubar.h> | 26 | #include <qmenubar.h> |
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | //#include <resource.h> | 29 | //#include <resource.h> |
30 | 30 | ||
31 | #endif | 31 | #endif |
32 | #include <libkcal/calendarlocal.h> | 32 | #include <libkcal/calendarlocal.h> |
33 | #include <libkcal/todo.h> | 33 | #include <libkcal/todo.h> |
34 | #include <libkdepim/ksyncprofile.h> | 34 | #include <libkdepim/ksyncprofile.h> |
35 | #include <libkdepim/kincidenceformatter.h> | 35 | #include <libkdepim/kincidenceformatter.h> |
36 | 36 | ||
37 | #include "calendarview.h" | 37 | #include "calendarview.h" |
38 | #include "koviewmanager.h" | 38 | #include "koviewmanager.h" |
39 | #include "datenavigator.h" | 39 | #include "datenavigator.h" |
40 | #include "koagendaview.h" | 40 | #include "koagendaview.h" |
41 | #include "koagenda.h" | 41 | #include "koagenda.h" |
42 | #include "kodialogmanager.h" | 42 | #include "kodialogmanager.h" |
43 | #include "kdialogbase.h" | 43 | #include "kdialogbase.h" |
44 | #include "kapplication.h" | 44 | #include "kapplication.h" |
45 | #include "kofilterview.h" | ||
45 | #include "kstandarddirs.h" | 46 | #include "kstandarddirs.h" |
46 | #include "koprefs.h" | 47 | #include "koprefs.h" |
47 | #include "kfiledialog.h" | 48 | #include "kfiledialog.h" |
48 | #include "koglobals.h" | 49 | #include "koglobals.h" |
49 | #include "kglobal.h" | 50 | #include "kglobal.h" |
50 | #include "klocale.h" | 51 | #include "klocale.h" |
51 | #include "kconfig.h" | 52 | #include "kconfig.h" |
52 | #include "simplealarmclient.h" | 53 | #include "simplealarmclient.h" |
53 | using namespace KCal; | 54 | using namespace KCal; |
54 | #ifndef _WIN32_ | 55 | #ifndef _WIN32_ |
55 | #include <unistd.h> | 56 | #include <unistd.h> |
56 | #else | 57 | #else |
57 | #include "koimportoldialog.h" | 58 | #include "koimportoldialog.h" |
58 | #endif | 59 | #endif |
59 | #include "mainwindow.h" | 60 | #include "mainwindow.h" |
60 | 61 | ||
61 | int globalFlagBlockStartup; | 62 | int globalFlagBlockStartup; |
62 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 63 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
63 | QMainWindow( parent, name ) | 64 | QMainWindow( parent, name ) |
64 | { | 65 | { |
65 | 66 | ||
66 | #ifdef DESKTOP_VERSION | 67 | #ifdef DESKTOP_VERSION |
67 | setFont( QFont("Arial"), 14 ); | 68 | setFont( QFont("Arial"), 14 ); |
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 71 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
71 | QString confFile = locateLocal("config","korganizerrc"); | 72 | QString confFile = locateLocal("config","korganizerrc"); |
72 | QFileInfo finf ( confFile ); | 73 | QFileInfo finf ( confFile ); |
73 | bool showWarning = !finf.exists(); | 74 | bool showWarning = !finf.exists(); |
74 | setIcon(SmallIcon( "ko24" ) ); | 75 | setIcon(SmallIcon( "ko24" ) ); |
75 | mBlockAtStartup = true; | 76 | mBlockAtStartup = true; |
76 | mFlagKeyPressed = false; | 77 | mFlagKeyPressed = false; |
77 | setCaption("KOrganizer/Pi"); | 78 | setCaption("KOrganizer/Pi"); |
78 | KOPrefs *p = KOPrefs::instance(); | 79 | KOPrefs *p = KOPrefs::instance(); |
79 | // if ( QApplication::desktop()->height() > 480 ) { | 80 | // if ( QApplication::desktop()->height() > 480 ) { |
80 | // if ( p->mHourSize == 4 ) | 81 | // if ( p->mHourSize == 4 ) |
81 | // p->mHourSize = 6; | 82 | // p->mHourSize = 6; |
82 | // } | 83 | // } |
83 | if ( p->mHourSize > 18 ) | 84 | if ( p->mHourSize > 18 ) |
84 | p->mHourSize = 18; | 85 | p->mHourSize = 18; |
85 | QMainWindow::ToolBarDock tbd; | 86 | QMainWindow::ToolBarDock tbd; |
86 | if ( p->mToolBarHor ) { | 87 | if ( p->mToolBarHor ) { |
87 | if ( p->mToolBarUp ) | 88 | if ( p->mToolBarUp ) |
88 | tbd = Bottom; | 89 | tbd = Bottom; |
89 | else | 90 | else |
90 | tbd = Top; | 91 | tbd = Top; |
91 | } | 92 | } |
92 | else { | 93 | else { |
93 | if ( p->mToolBarUp ) | 94 | if ( p->mToolBarUp ) |
94 | tbd = Right; | 95 | tbd = Right; |
95 | else | 96 | else |
96 | tbd = Left; | 97 | tbd = Left; |
97 | } | 98 | } |
98 | if ( KOPrefs::instance()->mUseAppColors ) | 99 | if ( KOPrefs::instance()->mUseAppColors ) |
99 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 100 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
100 | globalFlagBlockStartup = 1; | 101 | globalFlagBlockStartup = 1; |
101 | iconToolBar = new QPEToolBar( this ); | 102 | iconToolBar = new QPEToolBar( this ); |
102 | addToolBar (iconToolBar , tbd ); | 103 | addToolBar (iconToolBar , tbd ); |
103 | mBlockSaveFlag = false; | 104 | mBlockSaveFlag = false; |
104 | mCalendarModifiedFlag = false; | 105 | mCalendarModifiedFlag = false; |
105 | 106 | ||
106 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 107 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
107 | splash->setAlignment ( AlignCenter ); | 108 | splash->setAlignment ( AlignCenter ); |
108 | setCentralWidget( splash ); | 109 | setCentralWidget( splash ); |
109 | #ifndef DESKTOP_VERSION | 110 | #ifndef DESKTOP_VERSION |
110 | showMaximized(); | 111 | showMaximized(); |
111 | #endif | 112 | #endif |
112 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 113 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
113 | setDefaultPreferences(); | 114 | setDefaultPreferences(); |
114 | mCalendar = new CalendarLocal(); | 115 | mCalendar = new CalendarLocal(); |
115 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 116 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
116 | mView->hide(); | 117 | mView->hide(); |
117 | //mView->resize(splash->size() ); | 118 | //mView->resize(splash->size() ); |
118 | initActions(); | 119 | initActions(); |
119 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
120 | iconToolBar->show(); | 121 | iconToolBar->show(); |
121 | qApp->processEvents(); | 122 | qApp->processEvents(); |
122 | #endif | 123 | #endif |
123 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 124 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
124 | int vh = height() ; | 125 | int vh = height() ; |
125 | int vw = width(); | 126 | int vw = width(); |
126 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 127 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
127 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 128 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
128 | vh -= iconToolBar->height(); | 129 | vh -= iconToolBar->height(); |
129 | } else { | 130 | } else { |
130 | vw -= iconToolBar->height(); | 131 | vw -= iconToolBar->height(); |
131 | } | 132 | } |
132 | //mView->setMaximumSize( splash->size() ); | 133 | //mView->setMaximumSize( splash->size() ); |
133 | //mView->resize( splash->size() ); | 134 | //mView->resize( splash->size() ); |
134 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 135 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
135 | mView->readSettings(); | 136 | mView->readSettings(); |
136 | bool oldOpened = false; | 137 | bool oldOpened = false; |
137 | bool newFile = false; | 138 | bool newFile = false; |
138 | if( !QFile::exists( defaultFileName() ) ) { | 139 | if( !QFile::exists( defaultFileName() ) ) { |
139 | QFileInfo finfo ( defaultFileName() ); | 140 | QFileInfo finfo ( defaultFileName() ); |
140 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 141 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
141 | qDebug("oldfile %s ", oldFile.latin1()); | 142 | qDebug("oldfile %s ", oldFile.latin1()); |
142 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 143 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
143 | finfo.setFile( oldFile ); | 144 | finfo.setFile( oldFile ); |
144 | if (finfo.exists() ) { | 145 | if (finfo.exists() ) { |
145 | KMessageBox::information( this, message); | 146 | KMessageBox::information( this, message); |
146 | mView->openCalendar( oldFile ); | 147 | mView->openCalendar( oldFile ); |
147 | qApp->processEvents(); | 148 | qApp->processEvents(); |
148 | } else { | 149 | } else { |
149 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 150 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
150 | finfo.setFile( oldFile ); | 151 | finfo.setFile( oldFile ); |
151 | if (finfo.exists() ) { | 152 | if (finfo.exists() ) { |
152 | KMessageBox::information( this, message); | 153 | KMessageBox::information( this, message); |
153 | mView->openCalendar( oldFile ); | 154 | mView->openCalendar( oldFile ); |
154 | qApp->processEvents(); | 155 | qApp->processEvents(); |
155 | } | 156 | } |
156 | } | 157 | } |
157 | mView->saveCalendar( defaultFileName() ); | 158 | mView->saveCalendar( defaultFileName() ); |
158 | newFile = true; | 159 | newFile = true; |
159 | } | 160 | } |
160 | 161 | ||
161 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 162 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
162 | if ( ! oldOpened ) | 163 | if ( ! oldOpened ) |
163 | mView->openCalendar( defaultFileName() ); | 164 | mView->openCalendar( defaultFileName() ); |
164 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 165 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
165 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 166 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
166 | 167 | ||
167 | if ( KOPrefs::instance()->mLanguageChanged ) { | 168 | if ( KOPrefs::instance()->mLanguageChanged ) { |
168 | KOPrefs::instance()->setCategoryDefaults(); | 169 | KOPrefs::instance()->setCategoryDefaults(); |
169 | int count = mView->addCategories(); | 170 | int count = mView->addCategories(); |
170 | KOPrefs::instance()->mLanguageChanged = false; | 171 | KOPrefs::instance()->mLanguageChanged = false; |
171 | } | 172 | } |
172 | processIncidenceSelection( 0 ); | 173 | processIncidenceSelection( 0 ); |
173 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 174 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
174 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 175 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
175 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 176 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
176 | SLOT( slotModifiedChanged( bool ) ) ); | 177 | SLOT( slotModifiedChanged( bool ) ) ); |
177 | 178 | ||
178 | 179 | ||
179 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 180 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
180 | mView->setModified( false ); | 181 | mView->setModified( false ); |
181 | mBlockAtStartup = false; | 182 | mBlockAtStartup = false; |
182 | mView->setModified( false ); | 183 | mView->setModified( false ); |
183 | setCentralWidget( mView ); | 184 | setCentralWidget( mView ); |
184 | globalFlagBlockStartup = 0; | 185 | globalFlagBlockStartup = 0; |
185 | mView->show(); | 186 | mView->show(); |
186 | delete splash; | 187 | delete splash; |
187 | if ( newFile ) | 188 | if ( newFile ) |
188 | mView->updateConfig(); | 189 | mView->updateConfig(); |
189 | // qApp->processEvents(); | 190 | // qApp->processEvents(); |
190 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 191 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
191 | fillSyncMenu(); | 192 | fillSyncMenu(); |
192 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 193 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
193 | if ( showWarning ) { | 194 | if ( showWarning ) { |
194 | KMessageBox::information( this, | 195 | KMessageBox::information( this, |
195 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 196 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
196 | qApp->processEvents(); | 197 | qApp->processEvents(); |
197 | mView->dialogManager()->showSyncOptions(); | 198 | mView->dialogManager()->showSyncOptions(); |
198 | } | 199 | } |
199 | } | 200 | } |
200 | MainWindow::~MainWindow() | 201 | MainWindow::~MainWindow() |
201 | { | 202 | { |
202 | //qDebug("MainWindow::~MainWindow() "); | 203 | //qDebug("MainWindow::~MainWindow() "); |
203 | //save toolbar location | 204 | //save toolbar location |
204 | 205 | ||
205 | delete mCalendar; | 206 | delete mCalendar; |
206 | delete KOPrefs::instance(); | 207 | delete KOPrefs::instance(); |
207 | delete KIncidenceFormatter::instance(); | 208 | delete KIncidenceFormatter::instance(); |
208 | 209 | ||
209 | 210 | ||
210 | } | 211 | } |
211 | void MainWindow::closeEvent( QCloseEvent* ce ) | 212 | void MainWindow::closeEvent( QCloseEvent* ce ) |
212 | { | 213 | { |
213 | 214 | ||
214 | 215 | ||
215 | 216 | ||
216 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 217 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
217 | saveOnClose(); | 218 | saveOnClose(); |
218 | ce->accept(); | 219 | ce->accept(); |
219 | return; | 220 | return; |
220 | 221 | ||
221 | } | 222 | } |
222 | 223 | ||
223 | switch( QMessageBox::information( this, "KO/Pi", | 224 | switch( QMessageBox::information( this, "KO/Pi", |
224 | i18n("Do you really want\nto close KO/Pi?"), | 225 | i18n("Do you really want\nto close KO/Pi?"), |
225 | i18n("Close"), i18n("No"), | 226 | i18n("Close"), i18n("No"), |
226 | 0, 0 ) ) { | 227 | 0, 0 ) ) { |
227 | case 0: | 228 | case 0: |
228 | saveOnClose(); | 229 | saveOnClose(); |
229 | ce->accept(); | 230 | ce->accept(); |
230 | break; | 231 | break; |
231 | case 1: | 232 | case 1: |
232 | ce->ignore(); | 233 | ce->ignore(); |
233 | break; | 234 | break; |
234 | case 2: | 235 | case 2: |
235 | 236 | ||
236 | default: | 237 | default: |
237 | break; | 238 | break; |
238 | } | 239 | } |
239 | 240 | ||
240 | 241 | ||
241 | } | 242 | } |
242 | 243 | ||
243 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 244 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
244 | { | 245 | { |
245 | QDataStream stream( data, IO_ReadOnly ); | 246 | QDataStream stream( data, IO_ReadOnly ); |
246 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 247 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
247 | //QString datamess; | 248 | //QString datamess; |
248 | //qDebug("message "); | 249 | //qDebug("message "); |
249 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 250 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
250 | if ( cmsg == "-writeFile" ) { | 251 | if ( cmsg == "-writeFile" ) { |
251 | // I made from the "-writeFile" an "-writeAlarm" | 252 | // I made from the "-writeFile" an "-writeAlarm" |
252 | mView->viewManager()->showWhatsNextView(); | 253 | mView->viewManager()->showWhatsNextView(); |
253 | mCalendar->checkAlarmForIncidence( 0, true); | 254 | mCalendar->checkAlarmForIncidence( 0, true); |
254 | showMaximized(); | 255 | showMaximized(); |
255 | raise(); | 256 | raise(); |
256 | return; | 257 | return; |
257 | 258 | ||
258 | } | 259 | } |
259 | if ( cmsg == "-writeFileSilent" ) { | 260 | if ( cmsg == "-writeFileSilent" ) { |
260 | // I made from the "-writeFile" an "-writeAlarm" | 261 | // I made from the "-writeFile" an "-writeAlarm" |
261 | // mView->viewManager()->showWhatsNextView(); | 262 | // mView->viewManager()->showWhatsNextView(); |
262 | mCalendar->checkAlarmForIncidence( 0, true); | 263 | mCalendar->checkAlarmForIncidence( 0, true); |
263 | //showMaximized(); | 264 | //showMaximized(); |
264 | //raise(); | 265 | //raise(); |
265 | hide(); | 266 | hide(); |
266 | return; | 267 | return; |
267 | } | 268 | } |
268 | if ( cmsg == "-newCountdown" ) { | 269 | if ( cmsg == "-newCountdown" ) { |
269 | qDebug("newCountdown "); | 270 | qDebug("newCountdown "); |
270 | 271 | ||
271 | } | 272 | } |
272 | QString msg ; | 273 | QString msg ; |
273 | QString allmsg = cmsg; | 274 | QString allmsg = cmsg; |
274 | while ( allmsg.length() > 0 ) { | 275 | while ( allmsg.length() > 0 ) { |
275 | int nextC = allmsg.find( "-", 1 ); | 276 | int nextC = allmsg.find( "-", 1 ); |
276 | if ( nextC == -1 ) { | 277 | if ( nextC == -1 ) { |
277 | msg = allmsg; | 278 | msg = allmsg; |
278 | allmsg = ""; | 279 | allmsg = ""; |
279 | } else{ | 280 | } else{ |
280 | msg = allmsg.left( nextC ); | 281 | msg = allmsg.left( nextC ); |
281 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 282 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
282 | } | 283 | } |
283 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 284 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
284 | if ( msg == "-newEvent" ) { | 285 | if ( msg == "-newEvent" ) { |
285 | mView->newEvent(); | 286 | mView->newEvent(); |
286 | } | 287 | } |
287 | if ( msg == "-newTodo" ) { | 288 | if ( msg == "-newTodo" ) { |
288 | mView->newTodo(); | 289 | mView->newTodo(); |
289 | 290 | ||
290 | } | 291 | } |
291 | if ( msg == "-showWN" ) { | 292 | if ( msg == "-showWN" ) { |
292 | mView->viewManager()->showWhatsNextView(); | 293 | mView->viewManager()->showWhatsNextView(); |
293 | } | 294 | } |
294 | if ( msg == "-showTodo" ) { | 295 | if ( msg == "-showTodo" ) { |
295 | mView->viewManager()->showTodoView(); | 296 | mView->viewManager()->showTodoView(); |
296 | } | 297 | } |
297 | if ( msg == "-showList" ) { | 298 | if ( msg == "-showList" ) { |
298 | mView->viewManager()->showListView(); | 299 | mView->viewManager()->showListView(); |
299 | } | 300 | } |
300 | else if ( msg == "-showDay" ) { | 301 | else if ( msg == "-showDay" ) { |
301 | mView->viewManager()->showDayView(); | 302 | mView->viewManager()->showDayView(); |
302 | } | 303 | } |
303 | else if ( msg == "-showWWeek" ) { | 304 | else if ( msg == "-showWWeek" ) { |
304 | mView->viewManager()->showWorkWeekView(); | 305 | mView->viewManager()->showWorkWeekView(); |
305 | } | 306 | } |
306 | else if ( msg == "-ringSync" ) { | 307 | else if ( msg == "-ringSync" ) { |
307 | multiSync( false ); | 308 | multiSync( false ); |
308 | } | 309 | } |
309 | else if ( msg == "-showWeek" ) { | 310 | else if ( msg == "-showWeek" ) { |
310 | mView->viewManager()->showWeekView(); | 311 | mView->viewManager()->showWeekView(); |
311 | } | 312 | } |
312 | else if ( msg == "-showTodo" ) { | 313 | else if ( msg == "-showTodo" ) { |
313 | mView->viewManager()->showTodoView(); | 314 | mView->viewManager()->showTodoView(); |
314 | } | 315 | } |
315 | else if ( msg == "-showJournal" ) { | 316 | else if ( msg == "-showJournal" ) { |
316 | mView->dateNavigator()->selectDates( 1 ); | 317 | mView->dateNavigator()->selectDates( 1 ); |
317 | mView->dateNavigator()->selectToday(); | 318 | mView->dateNavigator()->selectToday(); |
318 | mView->viewManager()->showJournalView(); | 319 | mView->viewManager()->showJournalView(); |
319 | } | 320 | } |
320 | else if ( msg == "-showKO" ) { | 321 | else if ( msg == "-showKO" ) { |
321 | mView->viewManager()->showNextXView(); | 322 | mView->viewManager()->showNextXView(); |
322 | } | 323 | } |
323 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 324 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
324 | mView->viewManager()->showWhatsNextView(); | 325 | mView->viewManager()->showWhatsNextView(); |
325 | } | 326 | } |
326 | else if ( msg == "-showNextXView" ) { | 327 | else if ( msg == "-showNextXView" ) { |
327 | mView->viewManager()->showNextXView(); | 328 | mView->viewManager()->showNextXView(); |
328 | } | 329 | } |
329 | 330 | ||
330 | 331 | ||
331 | } | 332 | } |
332 | 333 | ||
333 | showMaximized(); | 334 | showMaximized(); |
334 | raise(); | 335 | raise(); |
335 | } | 336 | } |
336 | 337 | ||
337 | QPixmap MainWindow::loadPixmap( QString name ) | 338 | QPixmap MainWindow::loadPixmap( QString name ) |
338 | { | 339 | { |
339 | return SmallIcon( name ); | 340 | return SmallIcon( name ); |
340 | 341 | ||
341 | } | 342 | } |
342 | void MainWindow::initActions() | 343 | void MainWindow::initActions() |
343 | { | 344 | { |
344 | //KOPrefs::instance()->mShowFullMenu | 345 | //KOPrefs::instance()->mShowFullMenu |
345 | iconToolBar->clear(); | 346 | iconToolBar->clear(); |
346 | KOPrefs *p = KOPrefs::instance(); | 347 | KOPrefs *p = KOPrefs::instance(); |
347 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 348 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
348 | 349 | ||
349 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 350 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
350 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 351 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
351 | QPopupMenu *importMenu = new QPopupMenu( this ); | 352 | QPopupMenu *importMenu = new QPopupMenu( this ); |
352 | 353 | selectFilterMenu = new QPopupMenu( this ); | |
354 | selectFilterMenu->setCheckable( true ); | ||
353 | syncMenu = new QPopupMenu( this ); | 355 | syncMenu = new QPopupMenu( this ); |
354 | configureAgendaMenu = new QPopupMenu( this ); | 356 | configureAgendaMenu = new QPopupMenu( this ); |
355 | configureToolBarMenu = new QPopupMenu( this ); | 357 | configureToolBarMenu = new QPopupMenu( this ); |
356 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 358 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
357 | if ( KOPrefs::instance()->mShowFullMenu ) { | 359 | if ( KOPrefs::instance()->mShowFullMenu ) { |
358 | QMenuBar *menuBar1; | 360 | QMenuBar *menuBar1; |
359 | menuBar1 = menuBar(); | 361 | menuBar1 = menuBar(); |
360 | menuBar1->insertItem( i18n("File"), importMenu ); | 362 | menuBar1->insertItem( i18n("File"), importMenu ); |
361 | menuBar1->insertItem( i18n("View"), viewMenu ); | 363 | menuBar1->insertItem( i18n("View"), viewMenu ); |
362 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 364 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
363 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 365 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
364 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 366 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
365 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 367 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
368 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | ||
366 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 369 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
367 | } else { | 370 | } else { |
368 | QPEMenuBar *menuBar1; | 371 | QPEMenuBar *menuBar1; |
369 | menuBar1 = new QPEMenuBar( iconToolBar ); | 372 | menuBar1 = new QPEMenuBar( iconToolBar ); |
370 | QPopupMenu *menuBar = new QPopupMenu( this ); | 373 | QPopupMenu *menuBar = new QPopupMenu( this ); |
371 | menuBar1->insertItem( i18n("ME"), menuBar); | 374 | menuBar1->insertItem( i18n("ME"), menuBar); |
372 | menuBar->insertItem( i18n("File"), importMenu ); | 375 | menuBar->insertItem( i18n("File"), importMenu ); |
373 | menuBar->insertItem( i18n("View"), viewMenu ); | 376 | menuBar->insertItem( i18n("View"), viewMenu ); |
374 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 377 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
375 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 378 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
376 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 379 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
377 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 380 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
381 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | ||
378 | menuBar->insertItem( i18n("Help"), helpMenu ); | 382 | menuBar->insertItem( i18n("Help"), helpMenu ); |
379 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 383 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
380 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 384 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
381 | } | 385 | } |
382 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | 386 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); |
387 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | ||
388 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | ||
389 | |||
383 | // ****************** | 390 | // ****************** |
384 | QAction *action; | 391 | QAction *action; |
385 | QIconSet icon; | 392 | QIconSet icon; |
386 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 393 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
387 | configureToolBarMenu->setCheckable( true ); | 394 | configureToolBarMenu->setCheckable( true ); |
388 | 395 | ||
389 | QString pathString = ""; | 396 | QString pathString = ""; |
390 | if ( !p->mToolBarMiniIcons ) { | 397 | if ( !p->mToolBarMiniIcons ) { |
391 | if ( QApplication::desktop()->width() < 480 ) | 398 | if ( QApplication::desktop()->width() < 480 ) |
392 | pathString += "icons16/"; | 399 | pathString += "icons16/"; |
393 | } else | 400 | } else |
394 | pathString += "iconsmini/"; | 401 | pathString += "iconsmini/"; |
395 | configureAgendaMenu->setCheckable( true ); | 402 | configureAgendaMenu->setCheckable( true ); |
396 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 403 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
397 | configureAgendaMenu->insertSeparator(); | 404 | configureAgendaMenu->insertSeparator(); |
398 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 405 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
399 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 406 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
400 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 407 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
401 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 408 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
402 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 409 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
403 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 410 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
404 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 411 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
405 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 412 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
406 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 413 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
407 | 414 | ||
408 | icon = loadPixmap( pathString + "configure" ); | 415 | icon = loadPixmap( pathString + "configure" ); |
409 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 416 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
410 | action->addTo( actionMenu ); | 417 | action->addTo( actionMenu ); |
411 | connect( action, SIGNAL( activated() ), | 418 | connect( action, SIGNAL( activated() ), |
412 | mView, SLOT( edit_options() ) ); | 419 | mView, SLOT( edit_options() ) ); |
413 | actionMenu->insertSeparator(); | 420 | actionMenu->insertSeparator(); |
414 | icon = loadPixmap( pathString + "newevent" ); | 421 | icon = loadPixmap( pathString + "newevent" ); |
415 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 422 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
416 | configureToolBarMenu->insertSeparator(); | 423 | configureToolBarMenu->insertSeparator(); |
417 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 424 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
418 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 425 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
419 | ne_action->addTo( actionMenu ); | 426 | ne_action->addTo( actionMenu ); |
420 | connect( ne_action, SIGNAL( activated() ), | 427 | connect( ne_action, SIGNAL( activated() ), |
421 | mView, SLOT( newEvent() ) ); | 428 | mView, SLOT( newEvent() ) ); |
422 | icon = loadPixmap( pathString + "newtodo" ); | 429 | icon = loadPixmap( pathString + "newtodo" ); |
423 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 430 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
424 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 431 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
425 | nt_action->addTo( actionMenu ); | 432 | nt_action->addTo( actionMenu ); |
426 | connect( nt_action, SIGNAL( activated() ), | 433 | connect( nt_action, SIGNAL( activated() ), |
427 | mView, SLOT( newTodo() ) ); | 434 | mView, SLOT( newTodo() ) ); |
428 | icon = loadPixmap( pathString + "navi" ); | 435 | icon = loadPixmap( pathString + "navi" ); |
429 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 436 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
430 | action->addTo( viewMenu ); | 437 | action->addTo( viewMenu ); |
431 | connect( action, SIGNAL( activated() ), | 438 | connect( action, SIGNAL( activated() ), |
432 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 439 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
433 | icon = loadPixmap( pathString + "filter" ); | 440 | icon = loadPixmap( pathString + "filter" ); |
434 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 441 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
435 | action->addTo( viewMenu ); | 442 | action->addTo( viewMenu ); |
436 | connect( action, SIGNAL( activated() ), | 443 | connect( action, SIGNAL( activated() ), |
437 | mView, SLOT( toggleFilter() ) ); | 444 | mView, SLOT( toggleFilter() ) ); |
438 | 445 | ||
439 | 446 | ||
440 | viewMenu->insertSeparator(); | 447 | viewMenu->insertSeparator(); |
441 | icon = loadPixmap( pathString + "picker" ); | 448 | icon = loadPixmap( pathString + "picker" ); |
442 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 449 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
443 | action->addTo( viewMenu ); | 450 | action->addTo( viewMenu ); |
444 | connect( action, SIGNAL( activated() ), | 451 | connect( action, SIGNAL( activated() ), |
445 | mView, SLOT( showDatePicker() ) ); | 452 | mView, SLOT( showDatePicker() ) ); |
446 | action->addTo( iconToolBar ); | 453 | action->addTo( iconToolBar ); |
447 | viewMenu->insertSeparator(); | 454 | viewMenu->insertSeparator(); |
448 | icon = loadPixmap( pathString + "list" ); | 455 | icon = loadPixmap( pathString + "list" ); |
449 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 456 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
450 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 457 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
451 | showlist_action->addTo( viewMenu ); | 458 | showlist_action->addTo( viewMenu ); |
452 | connect( showlist_action, SIGNAL( activated() ), | 459 | connect( showlist_action, SIGNAL( activated() ), |
453 | mView->viewManager(), SLOT( showListView() ) ); | 460 | mView->viewManager(), SLOT( showListView() ) ); |
454 | 461 | ||
455 | 462 | ||
456 | icon = loadPixmap( pathString + "day" ); | 463 | icon = loadPixmap( pathString + "day" ); |
457 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 464 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
458 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 465 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
459 | day1_action->addTo( viewMenu ); | 466 | day1_action->addTo( viewMenu ); |
460 | // action->addTo( toolBar ); | 467 | // action->addTo( toolBar ); |
461 | connect( day1_action, SIGNAL( activated() ), | 468 | connect( day1_action, SIGNAL( activated() ), |
462 | mView->viewManager(), SLOT( showDayView() ) ); | 469 | mView->viewManager(), SLOT( showDayView() ) ); |
463 | 470 | ||
464 | icon = loadPixmap( pathString + "workweek" ); | 471 | icon = loadPixmap( pathString + "workweek" ); |
465 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 472 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
466 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 473 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
467 | day5_action->addTo( viewMenu ); | 474 | day5_action->addTo( viewMenu ); |
468 | connect( day5_action, SIGNAL( activated() ), | 475 | connect( day5_action, SIGNAL( activated() ), |
469 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 476 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
470 | 477 | ||
471 | icon = loadPixmap( pathString + "week" ); | 478 | icon = loadPixmap( pathString + "week" ); |
472 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 479 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
473 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 480 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
474 | day7_action->addTo( viewMenu ); | 481 | day7_action->addTo( viewMenu ); |
475 | connect( day7_action, SIGNAL( activated() ), | 482 | connect( day7_action, SIGNAL( activated() ), |
476 | mView->viewManager(), SLOT( showWeekView() ) ); | 483 | mView->viewManager(), SLOT( showWeekView() ) ); |
477 | 484 | ||
478 | icon = loadPixmap( pathString + "month" ); | 485 | icon = loadPixmap( pathString + "month" ); |
479 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 486 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
480 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 487 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
481 | month_action->addTo( viewMenu ); | 488 | month_action->addTo( viewMenu ); |
482 | connect( month_action, SIGNAL( activated() ), | 489 | connect( month_action, SIGNAL( activated() ), |
483 | mView->viewManager(), SLOT( showMonthView() ) ); | 490 | mView->viewManager(), SLOT( showMonthView() ) ); |
484 | 491 | ||
485 | icon = loadPixmap( pathString + "todo" ); | 492 | icon = loadPixmap( pathString + "todo" ); |
486 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 493 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
487 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 494 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
488 | todoview_action->addTo( viewMenu ); | 495 | todoview_action->addTo( viewMenu ); |
489 | connect( todoview_action, SIGNAL( activated() ), | 496 | connect( todoview_action, SIGNAL( activated() ), |
490 | mView->viewManager(), SLOT( showTodoView() ) ); | 497 | mView->viewManager(), SLOT( showTodoView() ) ); |
491 | 498 | ||
492 | icon = loadPixmap( pathString + "journal" ); | 499 | icon = loadPixmap( pathString + "journal" ); |
493 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 500 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
494 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 501 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
495 | viewjournal_action->addTo( viewMenu ); | 502 | viewjournal_action->addTo( viewMenu ); |
496 | connect( viewjournal_action, SIGNAL( activated() ), | 503 | connect( viewjournal_action, SIGNAL( activated() ), |
497 | mView->viewManager(), SLOT( showJournalView() ) ); | 504 | mView->viewManager(), SLOT( showJournalView() ) ); |
498 | 505 | ||
499 | icon = loadPixmap( pathString + "xdays" ); | 506 | icon = loadPixmap( pathString + "xdays" ); |
500 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 507 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
501 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 508 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
502 | xdays_action->addTo( viewMenu ); | 509 | xdays_action->addTo( viewMenu ); |
503 | connect( xdays_action, SIGNAL( activated() ), | 510 | connect( xdays_action, SIGNAL( activated() ), |
504 | mView->viewManager(), SLOT( showNextXView() ) ); | 511 | mView->viewManager(), SLOT( showNextXView() ) ); |
505 | 512 | ||
506 | icon = loadPixmap( pathString + "whatsnext" ); | 513 | icon = loadPixmap( pathString + "whatsnext" ); |
507 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 514 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
508 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 515 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
509 | whatsnext_action->addTo( viewMenu ); | 516 | whatsnext_action->addTo( viewMenu ); |
510 | connect( whatsnext_action, SIGNAL( activated() ), | 517 | connect( whatsnext_action, SIGNAL( activated() ), |
511 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 518 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
512 | 519 | ||
513 | #if 0 | 520 | #if 0 |
514 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 521 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
515 | action->addTo( viewMenu ); | 522 | action->addTo( viewMenu ); |
516 | connect( action, SIGNAL( activated() ), | 523 | connect( action, SIGNAL( activated() ), |
517 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 524 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
518 | #endif | 525 | #endif |
519 | 526 | ||
520 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 527 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
521 | this ); | 528 | this ); |
522 | mNewSubTodoAction->addTo( actionMenu ); | 529 | mNewSubTodoAction->addTo( actionMenu ); |
523 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 530 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
524 | mView, SLOT( newSubTodo() ) ); | 531 | mView, SLOT( newSubTodo() ) ); |
525 | 532 | ||
526 | actionMenu->insertSeparator(); | 533 | actionMenu->insertSeparator(); |
527 | 534 | ||
528 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 535 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
529 | mShowAction->addTo( actionMenu ); | 536 | mShowAction->addTo( actionMenu ); |
530 | connect( mShowAction, SIGNAL( activated() ), | 537 | connect( mShowAction, SIGNAL( activated() ), |
531 | mView, SLOT( showIncidence() ) ); | 538 | mView, SLOT( showIncidence() ) ); |
532 | 539 | ||
533 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 540 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
534 | mEditAction->addTo( actionMenu ); | 541 | mEditAction->addTo( actionMenu ); |
535 | connect( mEditAction, SIGNAL( activated() ), | 542 | connect( mEditAction, SIGNAL( activated() ), |
536 | mView, SLOT( editIncidence() ) ); | 543 | mView, SLOT( editIncidence() ) ); |
537 | 544 | ||
538 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 545 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
539 | mDeleteAction->addTo( actionMenu ); | 546 | mDeleteAction->addTo( actionMenu ); |
540 | connect( mDeleteAction, SIGNAL( activated() ), | 547 | connect( mDeleteAction, SIGNAL( activated() ), |
541 | mView, SLOT( deleteIncidence() ) ); | 548 | mView, SLOT( deleteIncidence() ) ); |
542 | 549 | ||
543 | actionMenu->insertSeparator(); | 550 | actionMenu->insertSeparator(); |
544 | 551 | ||
545 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 552 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
546 | this ); | 553 | this ); |
547 | action->addTo( actionMenu ); | 554 | action->addTo( actionMenu ); |
548 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 555 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
549 | 556 | ||
550 | icon = loadPixmap( pathString + "search" ); | 557 | icon = loadPixmap( pathString + "search" ); |
551 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 558 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
552 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 559 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
553 | search_action->addTo( actionMenu ); | 560 | search_action->addTo( actionMenu ); |
554 | connect( search_action, SIGNAL( activated() ), | 561 | connect( search_action, SIGNAL( activated() ), |
555 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 562 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
556 | 563 | ||
557 | icon = loadPixmap( pathString + "today" ); | 564 | icon = loadPixmap( pathString + "today" ); |
558 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 565 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
559 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 566 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
560 | today_action->addTo( actionMenu ); | 567 | today_action->addTo( actionMenu ); |
561 | connect( today_action, SIGNAL( activated() ), | 568 | connect( today_action, SIGNAL( activated() ), |
562 | mView, SLOT( goToday() ) ); | 569 | mView, SLOT( goToday() ) ); |
563 | 570 | ||
564 | if ( KOPrefs::instance()->mShowFullMenu ) { | 571 | if ( KOPrefs::instance()->mShowFullMenu ) { |
565 | actionMenu->insertSeparator(); | 572 | actionMenu->insertSeparator(); |
566 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 573 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
567 | 574 | ||
568 | } | 575 | } |
569 | // actionMenu->insertSeparator(); | 576 | // actionMenu->insertSeparator(); |
570 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 577 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
571 | this ); | 578 | this ); |
572 | action->addTo( importMenu ); | 579 | action->addTo( importMenu ); |
573 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 580 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
574 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 581 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
575 | this ); | 582 | this ); |
576 | action->addTo( importMenu ); | 583 | action->addTo( importMenu ); |
577 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 584 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
578 | importMenu->insertSeparator(); | 585 | importMenu->insertSeparator(); |
579 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 586 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
580 | this ); | 587 | this ); |
581 | action->addTo( importMenu ); | 588 | action->addTo( importMenu ); |
582 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 589 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
583 | #ifndef DESKTOP_VERSION | 590 | #ifndef DESKTOP_VERSION |
584 | importMenu->insertSeparator(); | 591 | importMenu->insertSeparator(); |
585 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 592 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
586 | this ); | 593 | this ); |
587 | action->addTo( importMenu ); | 594 | action->addTo( importMenu ); |
588 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 595 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
589 | #else | 596 | #else |
590 | #ifdef _WIN32_ | 597 | #ifdef _WIN32_ |
591 | importMenu->insertSeparator(); | 598 | importMenu->insertSeparator(); |
592 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 599 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
593 | this ); | 600 | this ); |
594 | action->addTo( importMenu ); | 601 | action->addTo( importMenu ); |
595 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 602 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
596 | #endif | 603 | #endif |
597 | #endif | 604 | #endif |
598 | 605 | ||
599 | importMenu->insertSeparator(); | 606 | importMenu->insertSeparator(); |
600 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 607 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
601 | this ); | 608 | this ); |
602 | action->addTo( importMenu ); | 609 | action->addTo( importMenu ); |
603 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 610 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
604 | 611 | ||
605 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 612 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
606 | this ); | 613 | this ); |
607 | action->addTo( importMenu ); | 614 | action->addTo( importMenu ); |
608 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 615 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
609 | 616 | ||
610 | importMenu->insertSeparator(); | 617 | importMenu->insertSeparator(); |
611 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 618 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
612 | this ); | 619 | this ); |
613 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 620 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
614 | importMenu->insertSeparator(); | 621 | importMenu->insertSeparator(); |
615 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 622 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
616 | this ); | 623 | this ); |
617 | action->addTo( importMenu ); | 624 | action->addTo( importMenu ); |
618 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 625 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
619 | #ifndef DESKTOP_VERSION | 626 | #ifndef DESKTOP_VERSION |
620 | importMenu->insertSeparator(); | 627 | importMenu->insertSeparator(); |
621 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 628 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
622 | this ); | 629 | this ); |
623 | action->addTo( importMenu ); | 630 | action->addTo( importMenu ); |
624 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 631 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
625 | 632 | ||
626 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 633 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
627 | this ); | 634 | this ); |
628 | action->addTo( importMenu ); | 635 | action->addTo( importMenu ); |
629 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 636 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
630 | #else | 637 | #else |
631 | importMenu->insertSeparator(); | 638 | importMenu->insertSeparator(); |
632 | icon = loadPixmap( pathString + "print" ); | 639 | icon = loadPixmap( pathString + "print" ); |
633 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 640 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
634 | action->addTo( importMenu ); | 641 | action->addTo( importMenu ); |
635 | connect( action, SIGNAL( activated() ), | 642 | connect( action, SIGNAL( activated() ), |
636 | this, SLOT( printCal() ) ); | 643 | this, SLOT( printCal() ) ); |
637 | 644 | ||
638 | icon = loadPixmap( pathString + "print" ); | 645 | icon = loadPixmap( pathString + "print" ); |
639 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 646 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
640 | action->addTo( importMenu ); | 647 | action->addTo( importMenu ); |
641 | connect( action, SIGNAL( activated() ), | 648 | connect( action, SIGNAL( activated() ), |
642 | this, SLOT( printSel() ) ); | 649 | this, SLOT( printSel() ) ); |
643 | #endif | 650 | #endif |
644 | importMenu->insertSeparator(); | 651 | importMenu->insertSeparator(); |
645 | action = new QAction( "beam all", i18n("Save"), 0, | 652 | action = new QAction( "beam all", i18n("Save"), 0, |
646 | this ); | 653 | this ); |
647 | action->addTo( importMenu ); | 654 | action->addTo( importMenu ); |
648 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 655 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
649 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 656 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
650 | this ); | 657 | this ); |
651 | action->addTo( importMenu ); | 658 | action->addTo( importMenu ); |
652 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 659 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
653 | 660 | ||
654 | //menuBar->insertItem( "Configure",configureMenu ); | 661 | //menuBar->insertItem( "Configure",configureMenu ); |
655 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 662 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
656 | icon = loadPixmap( "korganizer/korganizer" ); | 663 | icon = loadPixmap( "korganizer/korganizer" ); |
657 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 664 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
658 | action->addTo( helpMenu ); | 665 | action->addTo( helpMenu ); |
659 | connect( action, SIGNAL( activated() ), | 666 | connect( action, SIGNAL( activated() ), |
660 | SLOT( keyBindings() ) ); | 667 | SLOT( keyBindings() ) ); |
661 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 668 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
662 | action->addTo( helpMenu ); | 669 | action->addTo( helpMenu ); |
663 | connect( action, SIGNAL( activated() ), | 670 | connect( action, SIGNAL( activated() ), |
664 | SLOT( features() ) ); | 671 | SLOT( features() ) ); |
665 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 672 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
666 | action->addTo( helpMenu ); | 673 | action->addTo( helpMenu ); |
667 | connect( action, SIGNAL( activated() ), | 674 | connect( action, SIGNAL( activated() ), |
668 | SLOT( aboutAutoSaving() ) ); | 675 | SLOT( aboutAutoSaving() ) ); |
669 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 676 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
670 | action->addTo( helpMenu ); | 677 | action->addTo( helpMenu ); |
671 | connect( action, SIGNAL( activated() ), | 678 | connect( action, SIGNAL( activated() ), |
672 | SLOT( aboutKnownBugs() ) ); | 679 | SLOT( aboutKnownBugs() ) ); |
673 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 680 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
674 | action->addTo( helpMenu ); | 681 | action->addTo( helpMenu ); |
675 | connect( action, SIGNAL( activated() ), | 682 | connect( action, SIGNAL( activated() ), |
676 | SLOT( usertrans() ) ); | 683 | SLOT( usertrans() ) ); |
677 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 684 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
678 | action->addTo( helpMenu ); | 685 | action->addTo( helpMenu ); |
679 | connect( action, SIGNAL( activated() ), | 686 | connect( action, SIGNAL( activated() ), |
680 | SLOT( synchowto() ) ); | 687 | SLOT( synchowto() ) ); |
681 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 688 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
682 | action->addTo( helpMenu ); | 689 | action->addTo( helpMenu ); |
683 | connect( action, SIGNAL( activated() ), | 690 | connect( action, SIGNAL( activated() ), |
684 | SLOT( whatsNew() ) ); | 691 | SLOT( whatsNew() ) ); |
685 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 692 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
686 | action->addTo( helpMenu ); | 693 | action->addTo( helpMenu ); |
687 | connect( action, SIGNAL( activated() ), | 694 | connect( action, SIGNAL( activated() ), |
688 | SLOT( faq() ) ); | 695 | SLOT( faq() ) ); |
689 | 696 | ||
690 | 697 | ||
691 | action = new QAction( "about", i18n("About..."), 0, this ); | 698 | action = new QAction( "about", i18n("About..."), 0, this ); |
692 | action->addTo( helpMenu ); | 699 | action->addTo( helpMenu ); |
693 | connect( action, SIGNAL( activated() ), | 700 | connect( action, SIGNAL( activated() ), |
694 | SLOT( about() ) ); | 701 | SLOT( about() ) ); |
695 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 702 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
696 | action->addTo( helpMenu ); | 703 | action->addTo( helpMenu ); |
697 | connect( action, SIGNAL( activated() ), | 704 | connect( action, SIGNAL( activated() ), |
698 | SLOT( licence() ) ); | 705 | SLOT( licence() ) ); |
699 | //menuBar->insertSeparator(); | 706 | //menuBar->insertSeparator(); |
700 | 707 | ||
701 | // ****************************************************** | 708 | // ****************************************************** |
702 | // menubar icons | 709 | // menubar icons |
703 | 710 | ||
704 | 711 | ||
705 | iconToolBar->setHorizontalStretchable (true ); | 712 | iconToolBar->setHorizontalStretchable (true ); |
706 | //menuBar->insertItem( iconToolBar ); | 713 | //menuBar->insertItem( iconToolBar ); |
707 | //xdays_action | 714 | //xdays_action |
708 | if (p-> mShowIconNewEvent) | 715 | if (p-> mShowIconNewEvent) |
709 | ne_action->addTo( iconToolBar ); | 716 | ne_action->addTo( iconToolBar ); |
710 | if (p->mShowIconNewTodo ) | 717 | if (p->mShowIconNewTodo ) |
711 | nt_action->addTo( iconToolBar ); | 718 | nt_action->addTo( iconToolBar ); |
712 | if (p-> mShowIconSearch) | 719 | if (p-> mShowIconSearch) |
713 | search_action->addTo( iconToolBar ); | 720 | search_action->addTo( iconToolBar ); |
714 | if (p-> mShowIconNext) | 721 | if (p-> mShowIconNext) |
715 | whatsnext_action->addTo( iconToolBar ); | 722 | whatsnext_action->addTo( iconToolBar ); |
716 | if (p-> mShowIconNextDays) | 723 | if (p-> mShowIconNextDays) |
717 | xdays_action->addTo( iconToolBar ); | 724 | xdays_action->addTo( iconToolBar ); |
718 | if (p-> mShowIconList) | 725 | if (p-> mShowIconList) |
719 | showlist_action->addTo( iconToolBar ); | 726 | showlist_action->addTo( iconToolBar ); |
720 | if (p-> mShowIconDay1) | 727 | if (p-> mShowIconDay1) |
721 | day1_action->addTo( iconToolBar ); | 728 | day1_action->addTo( iconToolBar ); |
722 | if (p-> mShowIconDay5) | 729 | if (p-> mShowIconDay5) |
723 | day5_action->addTo( iconToolBar ); | 730 | day5_action->addTo( iconToolBar ); |
724 | if (p-> mShowIconDay7) | 731 | if (p-> mShowIconDay7) |
725 | day7_action->addTo( iconToolBar ); | 732 | day7_action->addTo( iconToolBar ); |
726 | if (p-> mShowIconMonth) | 733 | if (p-> mShowIconMonth) |
727 | month_action->addTo( iconToolBar ); | 734 | month_action->addTo( iconToolBar ); |
728 | if (p-> mShowIconTodoview) | 735 | if (p-> mShowIconTodoview) |
729 | todoview_action->addTo( iconToolBar ); | 736 | todoview_action->addTo( iconToolBar ); |
730 | if (p-> mShowIconJournal) | 737 | if (p-> mShowIconJournal) |
731 | viewjournal_action->addTo( iconToolBar ); | 738 | viewjournal_action->addTo( iconToolBar ); |
732 | icon = loadPixmap( pathString + "2leftarrowB" ); | 739 | icon = loadPixmap( pathString + "2leftarrowB" ); |
733 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 740 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
734 | if (p-> mShowIconBackFast) { | 741 | if (p-> mShowIconBackFast) { |
735 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 742 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
736 | connect( action, SIGNAL( activated() ), | 743 | connect( action, SIGNAL( activated() ), |
737 | mView, SLOT( goPreviousMonth() ) ); | 744 | mView, SLOT( goPreviousMonth() ) ); |
738 | action->addTo( iconToolBar ); | 745 | action->addTo( iconToolBar ); |
739 | } | 746 | } |
740 | icon = loadPixmap( pathString + "1leftarrowB" ); | 747 | icon = loadPixmap( pathString + "1leftarrowB" ); |
741 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 748 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
742 | if (p-> mShowIconBack) { | 749 | if (p-> mShowIconBack) { |
743 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 750 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
744 | connect( action, SIGNAL( activated() ), | 751 | connect( action, SIGNAL( activated() ), |
745 | mView, SLOT( goPrevious() ) ); | 752 | mView, SLOT( goPrevious() ) ); |
746 | action->addTo( iconToolBar ); | 753 | action->addTo( iconToolBar ); |
747 | } | 754 | } |
748 | if (p-> mShowIconToday) | 755 | if (p-> mShowIconToday) |
749 | today_action->addTo( iconToolBar ); | 756 | today_action->addTo( iconToolBar ); |
750 | icon = loadPixmap( pathString + "1rightarrowB" ); | 757 | icon = loadPixmap( pathString + "1rightarrowB" ); |
751 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 758 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
752 | if (p-> mShowIconForward) { | 759 | if (p-> mShowIconForward) { |
753 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 760 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
754 | connect( action, SIGNAL( activated() ), | 761 | connect( action, SIGNAL( activated() ), |
755 | mView, SLOT( goNext() ) ); | 762 | mView, SLOT( goNext() ) ); |
756 | action->addTo( iconToolBar ); | 763 | action->addTo( iconToolBar ); |
757 | } | 764 | } |
758 | icon = loadPixmap( pathString + "2rightarrowB" ); | 765 | icon = loadPixmap( pathString + "2rightarrowB" ); |
759 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 766 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
760 | if (p-> mShowIconForwardFast) { | 767 | if (p-> mShowIconForwardFast) { |
761 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 768 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
762 | connect( action, SIGNAL( activated() ), | 769 | connect( action, SIGNAL( activated() ), |
763 | mView, SLOT( goNextMonth() ) ); | 770 | mView, SLOT( goNextMonth() ) ); |
764 | action->addTo( iconToolBar ); | 771 | action->addTo( iconToolBar ); |
765 | } | 772 | } |
766 | 773 | ||
767 | 774 | ||
768 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 775 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
769 | 776 | ||
770 | if (p-> mShowIconNewEvent) | 777 | if (p-> mShowIconNewEvent) |
771 | configureToolBarMenu->setItemChecked( 10, true ); | 778 | configureToolBarMenu->setItemChecked( 10, true ); |
772 | if (p->mShowIconNewTodo ) | 779 | if (p->mShowIconNewTodo ) |
773 | configureToolBarMenu->setItemChecked( 20, true ); | 780 | configureToolBarMenu->setItemChecked( 20, true ); |
774 | if (p-> mShowIconSearch) | 781 | if (p-> mShowIconSearch) |
775 | configureToolBarMenu->setItemChecked( 120, true ); | 782 | configureToolBarMenu->setItemChecked( 120, true ); |
776 | if (p-> mShowIconList) | 783 | if (p-> mShowIconList) |
777 | configureToolBarMenu->setItemChecked( 30, true ); | 784 | configureToolBarMenu->setItemChecked( 30, true ); |
778 | if (p-> mShowIconDay1) | 785 | if (p-> mShowIconDay1) |
779 | configureToolBarMenu->setItemChecked( 40, true ); | 786 | configureToolBarMenu->setItemChecked( 40, true ); |
780 | if (p-> mShowIconDay5) | 787 | if (p-> mShowIconDay5) |
781 | configureToolBarMenu->setItemChecked( 50, true ); | 788 | configureToolBarMenu->setItemChecked( 50, true ); |
782 | if (p-> mShowIconDay7) | 789 | if (p-> mShowIconDay7) |
783 | configureToolBarMenu->setItemChecked( 60, true ); | 790 | configureToolBarMenu->setItemChecked( 60, true ); |
784 | if (p-> mShowIconMonth) | 791 | if (p-> mShowIconMonth) |
785 | configureToolBarMenu->setItemChecked( 70, true ); | 792 | configureToolBarMenu->setItemChecked( 70, true ); |
786 | if (p-> mShowIconTodoview) | 793 | if (p-> mShowIconTodoview) |
787 | configureToolBarMenu->setItemChecked( 80, true ); | 794 | configureToolBarMenu->setItemChecked( 80, true ); |
788 | if (p-> mShowIconBackFast) | 795 | if (p-> mShowIconBackFast) |
789 | configureToolBarMenu->setItemChecked( 200, true ); | 796 | configureToolBarMenu->setItemChecked( 200, true ); |
790 | if (p-> mShowIconBack) | 797 | if (p-> mShowIconBack) |
791 | configureToolBarMenu->setItemChecked( 210, true ); | 798 | configureToolBarMenu->setItemChecked( 210, true ); |
792 | if (p-> mShowIconToday) | 799 | if (p-> mShowIconToday) |
793 | configureToolBarMenu->setItemChecked( 130, true ); | 800 | configureToolBarMenu->setItemChecked( 130, true ); |
794 | if (p-> mShowIconForward) | 801 | if (p-> mShowIconForward) |
795 | configureToolBarMenu->setItemChecked( 220, true ); | 802 | configureToolBarMenu->setItemChecked( 220, true ); |
796 | if (p-> mShowIconForwardFast) | 803 | if (p-> mShowIconForwardFast) |
797 | configureToolBarMenu->setItemChecked( 230, true ); | 804 | configureToolBarMenu->setItemChecked( 230, true ); |
798 | if (p-> mShowIconNextDays) | 805 | if (p-> mShowIconNextDays) |
799 | configureToolBarMenu->setItemChecked( 100, true ); | 806 | configureToolBarMenu->setItemChecked( 100, true ); |
800 | if (p-> mShowIconNext) | 807 | if (p-> mShowIconNext) |
801 | configureToolBarMenu->setItemChecked( 110, true ); | 808 | configureToolBarMenu->setItemChecked( 110, true ); |
802 | if (p-> mShowIconJournal) | 809 | if (p-> mShowIconJournal) |
803 | configureToolBarMenu->setItemChecked( 90, true ); | 810 | configureToolBarMenu->setItemChecked( 90, true ); |
804 | if (p-> mShowIconWhatsThis) | 811 | if (p-> mShowIconWhatsThis) |
805 | configureToolBarMenu->setItemChecked( 300, true ); | 812 | configureToolBarMenu->setItemChecked( 300, true ); |
806 | 813 | ||
807 | QLabel* dummy = new QLabel( iconToolBar ); | 814 | QLabel* dummy = new QLabel( iconToolBar ); |
808 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 815 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
809 | if (!p-> mShowIconStretch) | 816 | if (!p-> mShowIconStretch) |
810 | iconToolBar->setStretchableWidget ( dummy ) ; | 817 | iconToolBar->setStretchableWidget ( dummy ) ; |
811 | else | 818 | else |
812 | configureToolBarMenu->setItemChecked( 5, true ); | 819 | configureToolBarMenu->setItemChecked( 5, true ); |
813 | if (p-> mShowIconWhatsThis) | 820 | if (p-> mShowIconWhatsThis) |
814 | QWhatsThis::whatsThisButton ( iconToolBar ); | 821 | QWhatsThis::whatsThisButton ( iconToolBar ); |
815 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 822 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
816 | configureAgenda( p->mHourSize ); | 823 | configureAgenda( p->mHourSize ); |
817 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 824 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
818 | } | 825 | } |
819 | void MainWindow::fillSyncMenu() | 826 | void MainWindow::fillSyncMenu() |
820 | { | 827 | { |
821 | syncMenu->clear(); | 828 | syncMenu->clear(); |
822 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 829 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
823 | syncMenu->insertSeparator(); | 830 | syncMenu->insertSeparator(); |
824 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 831 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
825 | syncMenu->insertSeparator(); | 832 | syncMenu->insertSeparator(); |
826 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 833 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
827 | config.setGroup("General"); | 834 | config.setGroup("General"); |
828 | QStringList prof = config.readListEntry("SyncProfileNames"); | 835 | QStringList prof = config.readListEntry("SyncProfileNames"); |
829 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 836 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
830 | if ( prof.count() < 3 ) { | 837 | if ( prof.count() < 3 ) { |
831 | prof.clear(); | 838 | prof.clear(); |
832 | prof << i18n("Sharp_DTM"); | 839 | prof << i18n("Sharp_DTM"); |
833 | prof << i18n("Local_file"); | 840 | prof << i18n("Local_file"); |
834 | prof << i18n("Last_file"); | 841 | prof << i18n("Last_file"); |
835 | KSyncProfile* temp = new KSyncProfile (); | 842 | KSyncProfile* temp = new KSyncProfile (); |
836 | temp->setName( prof[0] ); | 843 | temp->setName( prof[0] ); |
837 | temp->writeConfig(&config); | 844 | temp->writeConfig(&config); |
838 | temp->setName( prof[1] ); | 845 | temp->setName( prof[1] ); |
839 | temp->writeConfig(&config); | 846 | temp->writeConfig(&config); |
840 | temp->setName( prof[2] ); | 847 | temp->setName( prof[2] ); |
841 | temp->writeConfig(&config); | 848 | temp->writeConfig(&config); |
842 | config.setGroup("General"); | 849 | config.setGroup("General"); |
843 | config.writeEntry("SyncProfileNames",prof); | 850 | config.writeEntry("SyncProfileNames",prof); |
844 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 851 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
845 | config.sync(); | 852 | config.sync(); |
846 | delete temp; | 853 | delete temp; |
847 | } | 854 | } |
848 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 855 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
849 | KOPrefs::instance()->mSyncProfileNames = prof; | 856 | KOPrefs::instance()->mSyncProfileNames = prof; |
850 | int i; | 857 | int i; |
851 | for ( i = 0; i < prof.count(); ++i ) { | 858 | for ( i = 0; i < prof.count(); ++i ) { |
852 | 859 | ||
853 | syncMenu->insertItem( prof[i], 1000+i ); | 860 | syncMenu->insertItem( prof[i], 1000+i ); |
854 | if ( i == 2 ) | 861 | if ( i == 2 ) |
855 | syncMenu->insertSeparator(); | 862 | syncMenu->insertSeparator(); |
856 | } | 863 | } |
857 | QDir app_dir; | 864 | QDir app_dir; |
858 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 865 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
859 | syncMenu->setItemEnabled( false , 1000 ); | 866 | syncMenu->setItemEnabled( false , 1000 ); |
860 | } | 867 | } |
861 | mView->setupExternSyncProfiles(); | 868 | mView->setupExternSyncProfiles(); |
862 | } | 869 | } |
863 | 870 | ||
864 | int MainWindow::ringSync() | 871 | int MainWindow::ringSync() |
865 | { | 872 | { |
866 | int syncedProfiles = 0; | 873 | int syncedProfiles = 0; |
867 | int i; | 874 | int i; |
868 | QTime timer; | 875 | QTime timer; |
869 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 876 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
870 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 877 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
871 | KSyncProfile* temp = new KSyncProfile (); | 878 | KSyncProfile* temp = new KSyncProfile (); |
872 | KOPrefs::instance()->mAskForPreferences = false; | 879 | KOPrefs::instance()->mAskForPreferences = false; |
873 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 880 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
874 | mCurrentSyncProfile = i; | 881 | mCurrentSyncProfile = i; |
875 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 882 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
876 | temp->readConfig(&config); | 883 | temp->readConfig(&config); |
877 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 884 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
878 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 885 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
879 | ++syncedProfiles; | 886 | ++syncedProfiles; |
880 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 887 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
881 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 888 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
882 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 889 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
883 | KOPrefs::instance()->mShowSyncSummary = false; | 890 | KOPrefs::instance()->mShowSyncSummary = false; |
884 | mView->setSyncDevice(syncProfileNames[i] ); | 891 | mView->setSyncDevice(syncProfileNames[i] ); |
885 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 892 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
886 | if ( i == 0 ) { | 893 | if ( i == 0 ) { |
887 | syncSharp(); | 894 | syncSharp(); |
888 | } else { | 895 | } else { |
889 | if ( temp->getIsLocalFileSync() ) { | 896 | if ( temp->getIsLocalFileSync() ) { |
890 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 897 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
891 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 898 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
892 | } else { | 899 | } else { |
893 | syncRemote( temp, false ); | 900 | syncRemote( temp, false ); |
894 | 901 | ||
895 | } | 902 | } |
896 | } | 903 | } |
897 | timer.start(); | 904 | timer.start(); |
898 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 905 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
899 | while ( timer.elapsed () < 2000 ) { | 906 | while ( timer.elapsed () < 2000 ) { |
900 | qApp->processEvents(); | 907 | qApp->processEvents(); |
901 | #ifndef _WIN32_ | 908 | #ifndef _WIN32_ |
902 | sleep (1); | 909 | sleep (1); |
903 | #endif | 910 | #endif |
904 | } | 911 | } |
905 | 912 | ||
906 | } | 913 | } |
907 | 914 | ||
908 | } | 915 | } |
909 | delete temp; | 916 | delete temp; |
910 | return syncedProfiles; | 917 | return syncedProfiles; |
911 | } | 918 | } |
912 | 919 | ||
913 | void MainWindow::multiSync( bool askforPrefs ) | 920 | void MainWindow::multiSync( bool askforPrefs ) |
914 | { | 921 | { |
915 | if (mBlockSaveFlag) | 922 | if (mBlockSaveFlag) |
916 | return; | 923 | return; |
917 | mBlockSaveFlag = true; | 924 | mBlockSaveFlag = true; |
918 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 925 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
919 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 926 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
920 | question, | 927 | question, |
921 | i18n("Yes"), i18n("No"), | 928 | i18n("Yes"), i18n("No"), |
922 | 0, 0 ) != 0 ) { | 929 | 0, 0 ) != 0 ) { |
923 | mBlockSaveFlag = false; | 930 | mBlockSaveFlag = false; |
924 | setCaption(i18n("Aborted! Nothing synced!")); | 931 | setCaption(i18n("Aborted! Nothing synced!")); |
925 | return; | 932 | return; |
926 | } | 933 | } |
927 | mView->setSyncDevice(i18n("Multiple profiles") ); | 934 | mView->setSyncDevice(i18n("Multiple profiles") ); |
928 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 935 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
929 | if ( askforPrefs ) { | 936 | if ( askforPrefs ) { |
930 | mView->edit_sync_options(); | 937 | mView->edit_sync_options(); |
931 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 938 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
932 | } | 939 | } |
933 | setCaption(i18n("Multiple sync started.") ); | 940 | setCaption(i18n("Multiple sync started.") ); |
934 | qApp->processEvents(); | 941 | qApp->processEvents(); |
935 | int num = ringSync() ; | 942 | int num = ringSync() ; |
936 | if ( num > 1 ) | 943 | if ( num > 1 ) |
937 | ringSync(); | 944 | ringSync(); |
938 | mBlockSaveFlag = false; | 945 | mBlockSaveFlag = false; |
939 | if ( num ) | 946 | if ( num ) |
940 | save(); | 947 | save(); |
941 | if ( num ) | 948 | if ( num ) |
942 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 949 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
943 | else | 950 | else |
944 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 951 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
945 | return; | 952 | return; |
946 | } | 953 | } |
947 | void MainWindow::slotSyncMenu( int action ) | 954 | void MainWindow::slotSyncMenu( int action ) |
948 | { | 955 | { |
949 | //qDebug("syncaction %d ", action); | 956 | //qDebug("syncaction %d ", action); |
950 | if ( action == 0 ) { | 957 | if ( action == 0 ) { |
951 | 958 | ||
952 | confSync(); | 959 | confSync(); |
953 | 960 | ||
954 | return; | 961 | return; |
955 | } | 962 | } |
956 | if ( action == 1 ) { | 963 | if ( action == 1 ) { |
957 | multiSync( true ); | 964 | multiSync( true ); |
958 | return; | 965 | return; |
959 | } | 966 | } |
960 | 967 | ||
961 | if (mBlockSaveFlag) | 968 | if (mBlockSaveFlag) |
962 | return; | 969 | return; |
963 | mBlockSaveFlag = true; | 970 | mBlockSaveFlag = true; |
964 | mCurrentSyncProfile = action - 1000 ; | 971 | mCurrentSyncProfile = action - 1000 ; |
965 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 972 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
966 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 973 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
967 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 974 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
968 | KSyncProfile* temp = new KSyncProfile (); | 975 | KSyncProfile* temp = new KSyncProfile (); |
969 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 976 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
970 | temp->readConfig(&config); | 977 | temp->readConfig(&config); |
971 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 978 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
972 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 979 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
973 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 980 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
974 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 981 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
975 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 982 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
976 | if ( action == 1000 ) { | 983 | if ( action == 1000 ) { |
977 | syncSharp(); | 984 | syncSharp(); |
978 | 985 | ||
979 | } else if ( action == 1001 ) { | 986 | } else if ( action == 1001 ) { |
980 | syncLocalFile(); | 987 | syncLocalFile(); |
981 | 988 | ||
982 | } else if ( action == 1002 ) { | 989 | } else if ( action == 1002 ) { |
983 | quickSyncLocalFile(); | 990 | quickSyncLocalFile(); |
984 | 991 | ||
985 | } else if ( action >= 1003 ) { | 992 | } else if ( action >= 1003 ) { |
986 | if ( temp->getIsLocalFileSync() ) { | 993 | if ( temp->getIsLocalFileSync() ) { |
987 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 994 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
988 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 995 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
989 | } else { | 996 | } else { |
990 | syncRemote( temp ); | 997 | syncRemote( temp ); |
991 | 998 | ||
992 | } | 999 | } |
993 | } | 1000 | } |
994 | delete temp; | 1001 | delete temp; |
995 | mBlockSaveFlag = false; | 1002 | mBlockSaveFlag = false; |
996 | } | 1003 | } |
997 | void MainWindow::setDefaultPreferences() | 1004 | void MainWindow::setDefaultPreferences() |
998 | { | 1005 | { |
999 | KOPrefs *p = KOPrefs::instance(); | 1006 | KOPrefs *p = KOPrefs::instance(); |
1000 | 1007 | ||
1001 | p->mCompactDialogs = true; | 1008 | p->mCompactDialogs = true; |
1002 | p->mConfirm = true; | 1009 | p->mConfirm = true; |
1003 | // p->mEnableQuickTodo = false; | 1010 | // p->mEnableQuickTodo = false; |
1004 | } | 1011 | } |
1005 | 1012 | ||
1006 | QString MainWindow::resourcePath() | 1013 | QString MainWindow::resourcePath() |
1007 | { | 1014 | { |
1008 | return KGlobal::iconLoader()->iconPath(); | 1015 | return KGlobal::iconLoader()->iconPath(); |
1009 | } | 1016 | } |
1010 | 1017 | ||
1011 | void MainWindow::displayText( QString text ,QString cap ) | 1018 | void MainWindow::displayText( QString text ,QString cap ) |
1012 | { | 1019 | { |
1013 | QDialog dia( this, "name", true ); ; | 1020 | QDialog dia( this, "name", true ); ; |
1014 | dia.setCaption( cap ); | 1021 | dia.setCaption( cap ); |
1015 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1022 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1016 | lay->setSpacing( 3 ); | 1023 | lay->setSpacing( 3 ); |
1017 | lay->setMargin( 3 ); | 1024 | lay->setMargin( 3 ); |
1018 | QTextBrowser tb ( &dia ); | 1025 | QTextBrowser tb ( &dia ); |
1019 | lay->addWidget( &tb ); | 1026 | lay->addWidget( &tb ); |
1020 | tb.setText( text ); | 1027 | tb.setText( text ); |
1021 | #ifdef DESKTOP_VERSION | 1028 | #ifdef DESKTOP_VERSION |
1022 | dia.resize( 640, 480); | 1029 | dia.resize( 640, 480); |
1023 | #else | 1030 | #else |
1024 | dia.showMaximized(); | 1031 | dia.showMaximized(); |
1025 | #endif | 1032 | #endif |
1026 | dia.exec(); | 1033 | dia.exec(); |
1027 | } | 1034 | } |
1028 | void MainWindow::displayFile( QString fn, QString cap ) | 1035 | void MainWindow::displayFile( QString fn, QString cap ) |
1029 | { | 1036 | { |
1030 | QString fileName = resourcePath() + fn; | 1037 | QString fileName = resourcePath() + fn; |
1031 | QString text; | 1038 | QString text; |
1032 | QFile file( fileName ); | 1039 | QFile file( fileName ); |
1033 | if (!file.open( IO_ReadOnly ) ) { | 1040 | if (!file.open( IO_ReadOnly ) ) { |
1034 | return ; | 1041 | return ; |
1035 | 1042 | ||
1036 | } | 1043 | } |
1037 | QTextStream ts( &file ); | 1044 | QTextStream ts( &file ); |
1038 | text = ts.read(); | 1045 | text = ts.read(); |
1039 | file.close(); | 1046 | file.close(); |
1040 | displayText( text, cap); | 1047 | displayText( text, cap); |
1041 | } | 1048 | } |
1042 | void MainWindow::features() | 1049 | void MainWindow::features() |
1043 | { | 1050 | { |
1044 | 1051 | ||
1045 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1052 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1046 | } | 1053 | } |
1047 | 1054 | ||
1048 | void MainWindow::usertrans() | 1055 | void MainWindow::usertrans() |
1049 | { | 1056 | { |
1050 | 1057 | ||
1051 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1058 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1052 | } | 1059 | } |
1053 | void MainWindow::synchowto() | 1060 | void MainWindow::synchowto() |
1054 | { | 1061 | { |
1055 | 1062 | ||
1056 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); | 1063 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); |
1057 | } | 1064 | } |
1058 | void MainWindow::faq() | 1065 | void MainWindow::faq() |
1059 | { | 1066 | { |
1060 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1067 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1061 | 1068 | ||
1062 | } | 1069 | } |
1063 | void MainWindow::whatsNew() | 1070 | void MainWindow::whatsNew() |
1064 | { | 1071 | { |
1065 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); | 1072 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); |
1066 | 1073 | ||
1067 | } | 1074 | } |
1068 | void MainWindow::licence() | 1075 | void MainWindow::licence() |
1069 | { | 1076 | { |
1070 | KApplication::showLicence(); | 1077 | KApplication::showLicence(); |
1071 | 1078 | ||
1072 | } | 1079 | } |
1073 | void MainWindow::about() | 1080 | void MainWindow::about() |
1074 | { | 1081 | { |
1075 | QString version; | 1082 | QString version; |
1076 | #include <../version> | 1083 | #include <../version> |
1077 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1084 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1078 | i18n("KOrganizer/Platform-independent\n") + | 1085 | i18n("KOrganizer/Platform-independent\n") + |
1079 | "(KO/Pi) " + version + " - " + | 1086 | "(KO/Pi) " + version + " - " + |
1080 | 1087 | ||
1081 | #ifdef DESKTOP_VERSION | 1088 | #ifdef DESKTOP_VERSION |
1082 | i18n("Desktop Edition\n") + | 1089 | i18n("Desktop Edition\n") + |
1083 | #else | 1090 | #else |
1084 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1091 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1085 | #endif | 1092 | #endif |
1086 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1093 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1087 | } | 1094 | } |
1088 | void MainWindow::keyBindings() | 1095 | void MainWindow::keyBindings() |
1089 | { | 1096 | { |
1090 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1097 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1091 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1098 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1092 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1099 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1093 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1100 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1094 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1101 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1095 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1102 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1096 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1103 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1097 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1104 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1098 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1105 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1099 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1106 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1100 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1107 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1101 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1108 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1102 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1109 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1103 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1110 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1104 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1111 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1105 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1112 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1106 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1113 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1107 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1114 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1108 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1115 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1109 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1116 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1110 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1117 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1111 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1118 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1112 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1119 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1113 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1120 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1114 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1121 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1115 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1122 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1116 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1123 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1117 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1124 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1118 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1125 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1119 | i18n("<p><h3>In list view:</h3></p>\n") + | 1126 | i18n("<p><h3>In list view:</h3></p>\n") + |
1120 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1127 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1121 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1128 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1122 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1129 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1123 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1130 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1124 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1131 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1125 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1132 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1126 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1133 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1127 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1134 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1128 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1135 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1129 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1136 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1130 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1137 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1131 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1138 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1132 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1139 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1133 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1140 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1134 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1141 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1135 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1142 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1136 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1143 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1137 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1144 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1138 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1145 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1139 | displayText( text, cap); | 1146 | displayText( text, cap); |
1140 | 1147 | ||
1141 | } | 1148 | } |
1142 | void MainWindow::aboutAutoSaving() | 1149 | void MainWindow::aboutAutoSaving() |
1143 | { | 1150 | { |
1144 | QMessageBox* msg; | 1151 | QMessageBox* msg; |
1145 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1152 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1146 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1153 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1147 | QMessageBox::Ok, | 1154 | QMessageBox::Ok, |
1148 | QMessageBox::NoButton, | 1155 | QMessageBox::NoButton, |
1149 | QMessageBox::NoButton); | 1156 | QMessageBox::NoButton); |
1150 | msg->exec(); | 1157 | msg->exec(); |
1151 | delete msg; | 1158 | delete msg; |
1152 | 1159 | ||
1153 | 1160 | ||
1154 | } | 1161 | } |
1155 | void MainWindow::aboutKnownBugs() | 1162 | void MainWindow::aboutKnownBugs() |
1156 | { | 1163 | { |
1157 | QMessageBox* msg; | 1164 | QMessageBox* msg; |
1158 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1165 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1159 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1166 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1160 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1167 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1161 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1168 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1162 | i18n("\nor report them in the bugtracker on\n") + | 1169 | i18n("\nor report them in the bugtracker on\n") + |
1163 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1170 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1164 | QMessageBox::NoIcon, | 1171 | QMessageBox::NoIcon, |
1165 | QMessageBox::Ok, | 1172 | QMessageBox::Ok, |
1166 | QMessageBox::NoButton, | 1173 | QMessageBox::NoButton, |
1167 | QMessageBox::NoButton); | 1174 | QMessageBox::NoButton); |
1168 | msg->exec(); | 1175 | msg->exec(); |
1169 | delete msg; | 1176 | delete msg; |
1170 | 1177 | ||
1171 | } | 1178 | } |
1172 | 1179 | ||
1173 | QString MainWindow::defaultFileName() | 1180 | QString MainWindow::defaultFileName() |
1174 | { | 1181 | { |
1175 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1182 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1176 | } | 1183 | } |
1177 | 1184 | ||
1178 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1185 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1179 | { | 1186 | { |
1180 | if ( !incidence ) { | 1187 | if ( !incidence ) { |
1181 | enableIncidenceActions( false ); | 1188 | enableIncidenceActions( false ); |
1182 | 1189 | ||
1183 | mNewSubTodoAction->setEnabled( false ); | 1190 | mNewSubTodoAction->setEnabled( false ); |
1184 | setCaptionToDates(); | 1191 | setCaptionToDates(); |
1185 | return; | 1192 | return; |
1186 | 1193 | ||
1187 | } | 1194 | } |
1188 | 1195 | ||
1189 | //KGlobal::locale()->formatDateTime(nextA, true); | 1196 | //KGlobal::locale()->formatDateTime(nextA, true); |
1190 | QString startString = ""; | 1197 | QString startString = ""; |
1191 | if ( incidence->type() != "Todo" ) { | 1198 | if ( incidence->type() != "Todo" ) { |
1192 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1199 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1193 | if ( incidence->doesFloat() ) { | 1200 | if ( incidence->doesFloat() ) { |
1194 | startString += ": "+incidence->dtStartDateStr( true ); | 1201 | startString += ": "+incidence->dtStartDateStr( true ); |
1195 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1202 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1196 | 1203 | ||
1197 | } else { | 1204 | } else { |
1198 | startString = ": "+incidence->dtStartStr(true); | 1205 | startString = ": "+incidence->dtStartStr(true); |
1199 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1206 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1200 | 1207 | ||
1201 | } | 1208 | } |
1202 | 1209 | ||
1203 | } else { | 1210 | } else { |
1204 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1211 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1205 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1212 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1206 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1213 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1207 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1214 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1208 | } | 1215 | } |
1209 | 1216 | ||
1210 | } | 1217 | } |
1211 | else | 1218 | else |
1212 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1219 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1213 | if ( !incidence->location().isEmpty() ) | 1220 | if ( !incidence->location().isEmpty() ) |
1214 | startString += " (" +incidence->location()+")"; | 1221 | startString += " (" +incidence->location()+")"; |
1215 | setCaption( incidence->summary()+startString); | 1222 | setCaption( incidence->summary()+startString); |
1216 | 1223 | ||
1217 | enableIncidenceActions( true ); | 1224 | enableIncidenceActions( true ); |
1218 | 1225 | ||
1219 | if ( incidence->type() == "Event" ) { | 1226 | if ( incidence->type() == "Event" ) { |
1220 | mShowAction->setText( i18n("Show Event...") ); | 1227 | mShowAction->setText( i18n("Show Event...") ); |
1221 | mEditAction->setText( i18n("Edit Event...") ); | 1228 | mEditAction->setText( i18n("Edit Event...") ); |
1222 | mDeleteAction->setText( i18n("Delete Event...") ); | 1229 | mDeleteAction->setText( i18n("Delete Event...") ); |
1223 | 1230 | ||
1224 | mNewSubTodoAction->setEnabled( false ); | 1231 | mNewSubTodoAction->setEnabled( false ); |
1225 | } else if ( incidence->type() == "Todo" ) { | 1232 | } else if ( incidence->type() == "Todo" ) { |
1226 | mShowAction->setText( i18n("Show Todo...") ); | 1233 | mShowAction->setText( i18n("Show Todo...") ); |
1227 | mEditAction->setText( i18n("Edit Todo...") ); | 1234 | mEditAction->setText( i18n("Edit Todo...") ); |
1228 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1235 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1229 | 1236 | ||
1230 | mNewSubTodoAction->setEnabled( true ); | 1237 | mNewSubTodoAction->setEnabled( true ); |
1231 | } else { | 1238 | } else { |
1232 | mShowAction->setText( i18n("Show...") ); | 1239 | mShowAction->setText( i18n("Show...") ); |
1233 | mShowAction->setText( i18n("Edit...") ); | 1240 | mShowAction->setText( i18n("Edit...") ); |
1234 | mShowAction->setText( i18n("Delete...") ); | 1241 | mShowAction->setText( i18n("Delete...") ); |
1235 | 1242 | ||
1236 | mNewSubTodoAction->setEnabled( false ); | 1243 | mNewSubTodoAction->setEnabled( false ); |
1237 | } | 1244 | } |
1238 | } | 1245 | } |
1239 | 1246 | ||
1240 | void MainWindow::enableIncidenceActions( bool enabled ) | 1247 | void MainWindow::enableIncidenceActions( bool enabled ) |
1241 | { | 1248 | { |
1242 | mShowAction->setEnabled( enabled ); | 1249 | mShowAction->setEnabled( enabled ); |
1243 | mEditAction->setEnabled( enabled ); | 1250 | mEditAction->setEnabled( enabled ); |
1244 | mDeleteAction->setEnabled( enabled ); | 1251 | mDeleteAction->setEnabled( enabled ); |
1245 | } | 1252 | } |
1246 | 1253 | ||
1247 | void MainWindow::importOL() | 1254 | void MainWindow::importOL() |
1248 | { | 1255 | { |
1249 | #ifdef _WIN32_ | 1256 | #ifdef _WIN32_ |
1250 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1257 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1251 | id->exec(); | 1258 | id->exec(); |
1252 | delete id; | 1259 | delete id; |
1253 | mView->updateView(); | 1260 | mView->updateView(); |
1254 | #endif | 1261 | #endif |
1255 | } | 1262 | } |
1256 | void MainWindow::importBday() | 1263 | void MainWindow::importBday() |
1257 | { | 1264 | { |
1258 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1265 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1259 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1266 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1260 | i18n("Import!"), i18n("Cancel"), 0, | 1267 | i18n("Import!"), i18n("Cancel"), 0, |
1261 | 0, 1 ); | 1268 | 0, 1 ); |
1262 | if ( result == 0 ) { | 1269 | if ( result == 0 ) { |
1263 | mView->importBday(); | 1270 | mView->importBday(); |
1264 | 1271 | ||
1265 | } | 1272 | } |
1266 | 1273 | ||
1267 | 1274 | ||
1268 | } | 1275 | } |
1269 | void MainWindow::importQtopia() | 1276 | void MainWindow::importQtopia() |
1270 | { | 1277 | { |
1271 | #ifndef DESKTOP_VERSION | 1278 | #ifndef DESKTOP_VERSION |
1272 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1279 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1273 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1280 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1274 | i18n("Import!"), i18n("Cancel"), 0, | 1281 | i18n("Import!"), i18n("Cancel"), 0, |
1275 | 0, 1 ); | 1282 | 0, 1 ); |
1276 | if ( result == 0 ) { | 1283 | if ( result == 0 ) { |
1277 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1284 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1278 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1285 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1279 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1286 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1280 | mView->importQtopia( categories, datebook, todolist ); | 1287 | mView->importQtopia( categories, datebook, todolist ); |
1281 | } | 1288 | } |
1282 | #else | 1289 | #else |
1283 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1290 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1284 | i18n("Not supported \non desktop!\n"), | 1291 | i18n("Not supported \non desktop!\n"), |
1285 | i18n("Ok"), i18n("Cancel"), 0, | 1292 | i18n("Ok"), i18n("Cancel"), 0, |
1286 | 0, 1 ); | 1293 | 0, 1 ); |
1287 | 1294 | ||
1288 | #endif | 1295 | #endif |
1289 | } | 1296 | } |
1290 | 1297 | ||
1291 | void MainWindow::saveOnClose() | 1298 | void MainWindow::saveOnClose() |
1292 | { | 1299 | { |
1293 | KOPrefs *p = KOPrefs::instance(); | 1300 | KOPrefs *p = KOPrefs::instance(); |
1294 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1301 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1295 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1302 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1296 | iconToolBar->y() > height()/2; | 1303 | iconToolBar->y() > height()/2; |
1297 | mView->writeSettings(); | 1304 | mView->writeSettings(); |
1298 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1305 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1299 | save(); | 1306 | save(); |
1300 | } | 1307 | } |
1301 | void MainWindow::slotModifiedChanged( bool changed ) | 1308 | void MainWindow::slotModifiedChanged( bool changed ) |
1302 | { | 1309 | { |
1303 | if ( mBlockAtStartup ) | 1310 | if ( mBlockAtStartup ) |
1304 | return; | 1311 | return; |
1305 | int msec; | 1312 | int msec; |
1306 | // we store the changes after 1 minute, | 1313 | // we store the changes after 1 minute, |
1307 | // and for safety reasons after 10 minutes again | 1314 | // and for safety reasons after 10 minutes again |
1308 | if ( !mBlockSaveFlag ) | 1315 | if ( !mBlockSaveFlag ) |
1309 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1316 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1310 | else | 1317 | else |
1311 | msec = 1000 * 600; | 1318 | msec = 1000 * 600; |
1312 | mSaveTimer.start( msec, true ); // 1 minute | 1319 | mSaveTimer.start( msec, true ); // 1 minute |
1313 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1320 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1314 | mCalendarModifiedFlag = true; | 1321 | mCalendarModifiedFlag = true; |
1315 | } | 1322 | } |
1316 | #include <qfileinfo.h> | 1323 | #include <qfileinfo.h> |
1317 | void MainWindow::save() | 1324 | void MainWindow::save() |
1318 | { | 1325 | { |
1319 | if ( mBlockSaveFlag ) | 1326 | if ( mBlockSaveFlag ) |
1320 | return; | 1327 | return; |
1321 | bool store = mBlockSaveFlag; | 1328 | bool store = mBlockSaveFlag; |
1322 | mBlockSaveFlag = true; | 1329 | mBlockSaveFlag = true; |
1323 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1330 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1324 | 1331 | ||
1325 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1332 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1326 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1333 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1327 | qDebug("KO: Start saving data to file!"); | 1334 | qDebug("KO: Start saving data to file!"); |
1328 | mView->saveCalendar( defaultFileName() ); | 1335 | mView->saveCalendar( defaultFileName() ); |
1329 | 1336 | ||
1330 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1337 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1331 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); | 1338 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); |
1332 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1339 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1333 | QString savemes; | 1340 | QString savemes; |
1334 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1341 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1335 | setCaption(savemes); | 1342 | setCaption(savemes); |
1336 | } else | 1343 | } else |
1337 | setCaption(i18n("Saving cancelled!")); | 1344 | setCaption(i18n("Saving cancelled!")); |
1338 | mCalendarModifiedFlag = false; | 1345 | mCalendarModifiedFlag = false; |
1339 | mBlockSaveFlag = store; | 1346 | mBlockSaveFlag = store; |
1340 | } | 1347 | } |
1341 | 1348 | ||
1342 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1349 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1343 | { | 1350 | { |
1344 | if ( !e->isAutoRepeat() ) { | 1351 | if ( !e->isAutoRepeat() ) { |
1345 | mFlagKeyPressed = false; | 1352 | mFlagKeyPressed = false; |
1346 | } | 1353 | } |
1347 | } | 1354 | } |
1348 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1355 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1349 | { | 1356 | { |
1350 | qApp->processEvents(); | 1357 | qApp->processEvents(); |
1351 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1358 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1352 | e->ignore(); | 1359 | e->ignore(); |
1353 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1360 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1354 | return; | 1361 | return; |
1355 | } | 1362 | } |
1356 | if (! e->isAutoRepeat() ) | 1363 | if (! e->isAutoRepeat() ) |
1357 | mFlagKeyPressed = true; | 1364 | mFlagKeyPressed = true; |
1358 | KOPrefs *p = KOPrefs::instance(); | 1365 | KOPrefs *p = KOPrefs::instance(); |
1359 | bool showSelectedDates = false; | 1366 | bool showSelectedDates = false; |
1360 | int size; | 1367 | int size; |
1361 | int pro = 0; | 1368 | int pro = 0; |
1362 | //qDebug("MainWindow::keyPressEvent "); | 1369 | //qDebug("MainWindow::keyPressEvent "); |
1363 | switch ( e->key() ) { | 1370 | switch ( e->key() ) { |
1364 | case Qt::Key_Right: | 1371 | case Qt::Key_Right: |
1365 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1372 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1366 | mView->goNextMonth(); | 1373 | mView->goNextMonth(); |
1367 | else | 1374 | else |
1368 | mView->goNext(); | 1375 | mView->goNext(); |
1369 | showSelectedDates = true; | 1376 | showSelectedDates = true; |
1370 | break; | 1377 | break; |
1371 | case Qt::Key_Left: | 1378 | case Qt::Key_Left: |
1372 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1379 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1373 | mView->goPreviousMonth(); | 1380 | mView->goPreviousMonth(); |
1374 | else | 1381 | else |
1375 | mView->goPrevious(); | 1382 | mView->goPrevious(); |
1376 | showSelectedDates = true; | 1383 | showSelectedDates = true; |
1377 | break; | 1384 | break; |
1378 | case Qt::Key_Down: | 1385 | case Qt::Key_Down: |
1379 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1386 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1380 | break; | 1387 | break; |
1381 | case Qt::Key_Up: | 1388 | case Qt::Key_Up: |
1382 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1389 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1383 | break; | 1390 | break; |
1384 | case Qt::Key_I: | 1391 | case Qt::Key_I: |
1385 | mView->showIncidence(); | 1392 | mView->showIncidence(); |
1386 | break; | 1393 | break; |
1387 | case Qt::Key_Delete: | 1394 | case Qt::Key_Delete: |
1388 | case Qt::Key_Backspace: | 1395 | case Qt::Key_Backspace: |
1389 | mView->deleteIncidence(); | 1396 | mView->deleteIncidence(); |
1390 | break; | 1397 | break; |
1391 | case Qt::Key_D: | 1398 | case Qt::Key_D: |
1392 | mView->viewManager()->showDayView(); | 1399 | mView->viewManager()->showDayView(); |
1393 | showSelectedDates = true; | 1400 | showSelectedDates = true; |
1394 | break; | 1401 | break; |
1395 | case Qt::Key_O: | 1402 | case Qt::Key_O: |
1396 | mView->toggleFilerEnabled( ); | 1403 | mView->toggleFilerEnabled( ); |
1397 | break; | 1404 | break; |
1398 | case Qt::Key_0: | 1405 | case Qt::Key_0: |
1399 | case Qt::Key_1: | 1406 | case Qt::Key_1: |
1400 | case Qt::Key_2: | 1407 | case Qt::Key_2: |
1401 | case Qt::Key_3: | 1408 | case Qt::Key_3: |
1402 | case Qt::Key_4: | 1409 | case Qt::Key_4: |
1403 | case Qt::Key_5: | 1410 | case Qt::Key_5: |
1404 | case Qt::Key_6: | 1411 | case Qt::Key_6: |
1405 | case Qt::Key_7: | 1412 | case Qt::Key_7: |
1406 | case Qt::Key_8: | 1413 | case Qt::Key_8: |
1407 | case Qt::Key_9: | 1414 | case Qt::Key_9: |
1408 | pro = e->key()-48; | 1415 | pro = e->key()-48; |
1409 | if ( pro == 0 ) | 1416 | if ( pro == 0 ) |
1410 | pro = 10; | 1417 | pro = 10; |
1411 | if ( e->state() == Qt::ControlButton) | 1418 | if ( e->state() == Qt::ControlButton) |
1412 | pro += 10; | 1419 | pro += 10; |
1413 | break; | 1420 | break; |
1414 | case Qt::Key_M: | 1421 | case Qt::Key_M: |
1415 | mView->viewManager()->showMonthView(); | 1422 | mView->viewManager()->showMonthView(); |
1416 | showSelectedDates = true; | 1423 | showSelectedDates = true; |
1417 | break; | 1424 | break; |
1418 | case Qt::Key_Insert: | 1425 | case Qt::Key_Insert: |
1419 | mView->newEvent(); | 1426 | mView->newEvent(); |
1420 | break; | 1427 | break; |
1421 | case Qt::Key_S : | 1428 | case Qt::Key_S : |
1422 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1429 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1423 | mView->newSubTodo(); | 1430 | mView->newSubTodo(); |
1424 | else | 1431 | else |
1425 | mView->dialogManager()->showSearchDialog(); | 1432 | mView->dialogManager()->showSearchDialog(); |
1426 | break; | 1433 | break; |
1427 | case Qt::Key_Y : | 1434 | case Qt::Key_Y : |
1428 | case Qt::Key_Z : | 1435 | case Qt::Key_Z : |
1429 | mView->viewManager()->showWorkWeekView(); | 1436 | mView->viewManager()->showWorkWeekView(); |
1430 | showSelectedDates = true; | 1437 | showSelectedDates = true; |
1431 | break; | 1438 | break; |
1432 | case Qt::Key_U : | 1439 | case Qt::Key_U : |
1433 | mView->viewManager()->showWeekView(); | 1440 | mView->viewManager()->showWeekView(); |
1434 | showSelectedDates = true; | 1441 | showSelectedDates = true; |
1435 | break; | 1442 | break; |
1436 | case Qt::Key_H : | 1443 | case Qt::Key_H : |
1437 | keyBindings(); | 1444 | keyBindings(); |
1438 | break; | 1445 | break; |
1439 | case Qt::Key_W: | 1446 | case Qt::Key_W: |
1440 | mView->viewManager()->showWhatsNextView(); | 1447 | mView->viewManager()->showWhatsNextView(); |
1441 | break; | 1448 | break; |
1442 | case Qt::Key_L: | 1449 | case Qt::Key_L: |
1443 | mView->viewManager()->showListView(); | 1450 | mView->viewManager()->showListView(); |
1444 | break; | 1451 | break; |
1445 | case Qt::Key_N: | 1452 | case Qt::Key_N: |
1446 | mView->viewManager()->showNextXView(); | 1453 | mView->viewManager()->showNextXView(); |
1447 | showSelectedDates = true; | 1454 | showSelectedDates = true; |
1448 | break; | 1455 | break; |
1449 | case Qt::Key_V: | 1456 | case Qt::Key_V: |
1450 | mView->viewManager()->showTodoView(); | 1457 | mView->viewManager()->showTodoView(); |
1451 | break; | 1458 | break; |
1452 | case Qt::Key_C: | 1459 | case Qt::Key_C: |
1453 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1460 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1454 | break; | 1461 | break; |
1455 | case Qt::Key_P: | 1462 | case Qt::Key_P: |
1456 | mView->showDatePicker( ); | 1463 | mView->showDatePicker( ); |
1457 | break; | 1464 | break; |
1458 | case Qt::Key_F: | 1465 | case Qt::Key_F: |
1459 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1466 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1460 | mView->editFilters(); | 1467 | mView->editFilters(); |
1461 | else | 1468 | else |
1462 | mView->toggleFilter(); | 1469 | mView->toggleFilter(); |
1463 | break; | 1470 | break; |
1464 | case Qt::Key_X: | 1471 | case Qt::Key_X: |
1465 | mView->toggleDateNavigatorWidget(); | 1472 | mView->toggleDateNavigatorWidget(); |
1466 | break; | 1473 | break; |
1467 | case Qt::Key_Space: | 1474 | case Qt::Key_Space: |
1468 | mView->toggleExpand(); | 1475 | mView->toggleExpand(); |
1469 | break; | 1476 | break; |
1470 | case Qt::Key_A: | 1477 | case Qt::Key_A: |
1471 | mView->toggleAllDaySize(); | 1478 | mView->toggleAllDaySize(); |
1472 | break; | 1479 | break; |
1473 | case Qt::Key_T: | 1480 | case Qt::Key_T: |
1474 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1481 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1475 | mView->newTodo(); | 1482 | mView->newTodo(); |
1476 | else { | 1483 | else { |
1477 | mView->goToday(); | 1484 | mView->goToday(); |
1478 | showSelectedDates = true; | 1485 | showSelectedDates = true; |
1479 | } | 1486 | } |
1480 | break; | 1487 | break; |
1481 | case Qt::Key_J: | 1488 | case Qt::Key_J: |
1482 | mView->viewManager()->showJournalView(); | 1489 | mView->viewManager()->showJournalView(); |
1483 | break; | 1490 | break; |
1484 | case Qt::Key_B: | 1491 | case Qt::Key_B: |
1485 | mView->editIncidenceDescription();; | 1492 | mView->editIncidenceDescription();; |
1486 | break; | 1493 | break; |
1487 | // case Qt::Key_Return: | 1494 | // case Qt::Key_Return: |
1488 | case Qt::Key_E: | 1495 | case Qt::Key_E: |
1489 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1496 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1490 | mView->newEvent(); | 1497 | mView->newEvent(); |
1491 | else | 1498 | else |
1492 | mView->editIncidence(); | 1499 | mView->editIncidence(); |
1493 | break; | 1500 | break; |
1494 | case Qt::Key_Plus: | 1501 | case Qt::Key_Plus: |
1495 | size = p->mHourSize +2; | 1502 | size = p->mHourSize +2; |
1496 | if ( size <= 18 ) | 1503 | if ( size <= 18 ) |
1497 | configureAgenda( size ); | 1504 | configureAgenda( size ); |
1498 | break; | 1505 | break; |
1499 | case Qt::Key_Minus: | 1506 | case Qt::Key_Minus: |
1500 | size = p->mHourSize - 2; | 1507 | size = p->mHourSize - 2; |
1501 | if ( size >= 4 ) | 1508 | if ( size >= 4 ) |
1502 | configureAgenda( size ); | 1509 | configureAgenda( size ); |
1503 | break; | 1510 | break; |
1504 | 1511 | ||
1505 | 1512 | ||
1506 | default: | 1513 | default: |
1507 | e->ignore(); | 1514 | e->ignore(); |
1508 | } | 1515 | } |
1509 | if ( pro > 0 ) { | 1516 | if ( pro > 0 ) { |
1510 | mView->selectFilter( pro-1 ); | 1517 | mView->selectFilter( pro-1 ); |
1511 | } | 1518 | } |
1512 | if ( showSelectedDates ) { | 1519 | if ( showSelectedDates ) { |
1513 | ;// setCaptionToDates(); | 1520 | ;// setCaptionToDates(); |
1514 | } | 1521 | } |
1515 | 1522 | ||
1516 | } | 1523 | } |
1517 | 1524 | ||
1525 | void MainWindow::fillFilterMenu() | ||
1526 | { | ||
1527 | selectFilterMenu->clear(); | ||
1528 | bool disable = false; | ||
1529 | if ( mView->filterView()->filtersEnabled() ) { | ||
1530 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | ||
1531 | } | ||
1532 | else { | ||
1533 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | ||
1534 | disable = true; | ||
1535 | } | ||
1536 | selectFilterMenu->insertSeparator(); | ||
1537 | QPtrList<CalFilter> fili = mView->filters(); | ||
1538 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | ||
1539 | CalFilter *filter = fili.first(); | ||
1540 | int iii = 1; | ||
1541 | while(filter) { | ||
1542 | selectFilterMenu->insertItem( filter->name(), iii ); | ||
1543 | if ( filter == curfilter) | ||
1544 | selectFilterMenu->setItemChecked( iii, true ); | ||
1545 | if ( disable ) | ||
1546 | selectFilterMenu->setItemEnabled( iii, false ); | ||
1547 | filter = fili.next(); | ||
1548 | ++iii; | ||
1549 | } | ||
1550 | qDebug("rettich "); | ||
1551 | } | ||
1552 | void MainWindow::selectFilter( int fil ) | ||
1553 | { | ||
1554 | qDebug("selectFilter %d ", fil); | ||
1555 | if ( fil == 0 ) { | ||
1556 | mView->toggleFilerEnabled( ); | ||
1557 | } else { | ||
1558 | mView->selectFilter( fil-1 ); | ||
1559 | } | ||
1560 | } | ||
1518 | void MainWindow::configureToolBar( int item ) | 1561 | void MainWindow::configureToolBar( int item ) |
1519 | { | 1562 | { |
1520 | 1563 | ||
1521 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1564 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1522 | KOPrefs *p = KOPrefs::instance(); | 1565 | KOPrefs *p = KOPrefs::instance(); |
1523 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1566 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1524 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1567 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1525 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1568 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1526 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1569 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1527 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1570 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1528 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1571 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1529 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1572 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1530 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1573 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1531 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1574 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1532 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1575 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1533 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1576 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1534 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1577 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1535 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1578 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1536 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1579 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1537 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1580 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1538 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1581 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1539 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1582 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1540 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1583 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1541 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1584 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1542 | // initActions(); | 1585 | // initActions(); |
1543 | } | 1586 | } |
1544 | 1587 | ||
1545 | void MainWindow::setCaptionToDates() | 1588 | void MainWindow::setCaptionToDates() |
1546 | { | 1589 | { |
1547 | QString selDates; | 1590 | QString selDates; |
1548 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1591 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1549 | if (mView->startDate() < mView->endDate() ) | 1592 | if (mView->startDate() < mView->endDate() ) |
1550 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1593 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1551 | setCaption( i18n("Dates: ") + selDates ); | 1594 | setCaption( i18n("Dates: ") + selDates ); |
1552 | 1595 | ||
1553 | } | 1596 | } |
1554 | // parameter item == 0: reinit | 1597 | // parameter item == 0: reinit |
1555 | void MainWindow::configureAgenda( int item ) | 1598 | void MainWindow::configureAgenda( int item ) |
1556 | { | 1599 | { |
1557 | 1600 | ||
1558 | KOPrefs *p = KOPrefs::instance(); | 1601 | KOPrefs *p = KOPrefs::instance(); |
1559 | 1602 | ||
1560 | int i; | 1603 | int i; |
1561 | if ( item == 1 ) { | 1604 | if ( item == 1 ) { |
1562 | mView->toggleAllDaySize(); | 1605 | mView->toggleAllDaySize(); |
1563 | return; | 1606 | return; |
1564 | } | 1607 | } |
1565 | // do not allow 4 for widgets higher than 480 | 1608 | // do not allow 4 for widgets higher than 480 |
1566 | // if ( QApplication::desktop()->height() > 480 ) { | 1609 | // if ( QApplication::desktop()->height() > 480 ) { |
1567 | // if ( item == 4 ) | 1610 | // if ( item == 4 ) |
1568 | // item = 6; | 1611 | // item = 6; |
1569 | // } | 1612 | // } |
1570 | for ( i = 4; i <= 18; i= i+2 ) | 1613 | for ( i = 4; i <= 18; i= i+2 ) |
1571 | configureAgendaMenu->setItemChecked( i, false ); | 1614 | configureAgendaMenu->setItemChecked( i, false ); |
1572 | configureAgendaMenu->setItemChecked( item, true ); | 1615 | configureAgendaMenu->setItemChecked( item, true ); |
1573 | if ( p->mHourSize == item ) | 1616 | if ( p->mHourSize == item ) |
1574 | return; | 1617 | return; |
1575 | p->mHourSize=item; | 1618 | p->mHourSize=item; |
1576 | mView->viewManager()->agendaView()->updateConfig(); | 1619 | mView->viewManager()->agendaView()->updateConfig(); |
1577 | } | 1620 | } |
1578 | 1621 | ||
1579 | void MainWindow::saveCalendar() | 1622 | void MainWindow::saveCalendar() |
1580 | { | 1623 | { |
1581 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1624 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1582 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1583 | 1626 | ||
1584 | if ( fn == "" ) | 1627 | if ( fn == "" ) |
1585 | return; | 1628 | return; |
1586 | QFileInfo info; | 1629 | QFileInfo info; |
1587 | info.setFile( fn ); | 1630 | info.setFile( fn ); |
1588 | QString mes; | 1631 | QString mes; |
1589 | bool createbup = true; | 1632 | bool createbup = true; |
1590 | if ( info. exists() ) { | 1633 | if ( info. exists() ) { |
1591 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1634 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1592 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1635 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1593 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1636 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1594 | 0, 1 ); | 1637 | 0, 1 ); |
1595 | if ( result != 0 ) { | 1638 | if ( result != 0 ) { |
1596 | createbup = false; | 1639 | createbup = false; |
1597 | } | 1640 | } |
1598 | } | 1641 | } |
1599 | if ( createbup ) { | 1642 | if ( createbup ) { |
1600 | mView->saveCalendar( fn ); | 1643 | mView->saveCalendar( fn ); |
1601 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1644 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1602 | KOPrefs::instance()->mLastSaveFile = fn; | 1645 | KOPrefs::instance()->mLastSaveFile = fn; |
1603 | setCaption(mes); | 1646 | setCaption(mes); |
1604 | } | 1647 | } |
1605 | } | 1648 | } |
1606 | void MainWindow::loadCalendar() | 1649 | void MainWindow::loadCalendar() |
1607 | { | 1650 | { |
1608 | 1651 | ||
1609 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1652 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1610 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1653 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1611 | 1654 | ||
1612 | if ( fn == "" ) | 1655 | if ( fn == "" ) |
1613 | return; | 1656 | return; |
1614 | QFileInfo info; | 1657 | QFileInfo info; |
1615 | info.setFile( fn ); | 1658 | info.setFile( fn ); |
1616 | QString mess; | 1659 | QString mess; |
1617 | bool loadbup = true; | 1660 | bool loadbup = true; |
1618 | if ( info. exists() ) { | 1661 | if ( info. exists() ) { |
1619 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1662 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1620 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1663 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1621 | mess, | 1664 | mess, |
1622 | i18n("Load!"), i18n("Cancel"), 0, | 1665 | i18n("Load!"), i18n("Cancel"), 0, |
1623 | 0, 1 ); | 1666 | 0, 1 ); |
1624 | if ( result != 0 ) { | 1667 | if ( result != 0 ) { |
1625 | loadbup = false; | 1668 | loadbup = false; |
1626 | } | 1669 | } |
1627 | } else { | 1670 | } else { |
1628 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1671 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1629 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1672 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1630 | 0, 1 ); | 1673 | 0, 1 ); |
1631 | 1674 | ||
1632 | return; | 1675 | return; |
1633 | } | 1676 | } |
1634 | if ( loadbup ) { | 1677 | if ( loadbup ) { |
1635 | mView->openCalendar( fn ); | 1678 | mView->openCalendar( fn ); |
1636 | KOPrefs::instance()->mLastLoadFile = fn; | 1679 | KOPrefs::instance()->mLastLoadFile = fn; |
1637 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1680 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1638 | setCaption(mess); | 1681 | setCaption(mess); |
1639 | } | 1682 | } |
1640 | 1683 | ||
1641 | } | 1684 | } |
1642 | void MainWindow::quickImportIcal() | 1685 | void MainWindow::quickImportIcal() |
1643 | { | 1686 | { |
1644 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1687 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1645 | } | 1688 | } |
1646 | void MainWindow::importFile( QString fn, bool quick ) | 1689 | void MainWindow::importFile( QString fn, bool quick ) |
1647 | { | 1690 | { |
1648 | QFileInfo info; | 1691 | QFileInfo info; |
1649 | info.setFile( fn ); | 1692 | info.setFile( fn ); |
1650 | QString mess; | 1693 | QString mess; |
1651 | bool loadbup = true; | 1694 | bool loadbup = true; |
1652 | if ( !info. exists() ) { | 1695 | if ( !info. exists() ) { |
1653 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1696 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1654 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1697 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1655 | mess ); | 1698 | mess ); |
1656 | return; | 1699 | return; |
1657 | } | 1700 | } |
1658 | int result = 0; | 1701 | int result = 0; |
1659 | if ( !quick ) { | 1702 | if ( !quick ) { |
1660 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1703 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1661 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1704 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1662 | mess, | 1705 | mess, |
1663 | "Import", "Cancel", 0, | 1706 | "Import", "Cancel", 0, |
1664 | 0, 1 ); | 1707 | 0, 1 ); |
1665 | } | 1708 | } |
1666 | if ( result == 0 ) { | 1709 | if ( result == 0 ) { |
1667 | if ( mView->openCalendar( fn, true )) { | 1710 | if ( mView->openCalendar( fn, true )) { |
1668 | KOPrefs::instance()->mLastImportFile = fn; | 1711 | KOPrefs::instance()->mLastImportFile = fn; |
1669 | setCaption(i18n("Imported file successfully")); | 1712 | setCaption(i18n("Imported file successfully")); |
1670 | } else { | 1713 | } else { |
1671 | setCaption(i18n("Error importing file")); | 1714 | setCaption(i18n("Error importing file")); |
1672 | } | 1715 | } |
1673 | } | 1716 | } |
1674 | } | 1717 | } |
1675 | 1718 | ||
1676 | void MainWindow::importIcal() | 1719 | void MainWindow::importIcal() |
1677 | { | 1720 | { |
1678 | 1721 | ||
1679 | QString fn =KOPrefs::instance()->mLastImportFile; | 1722 | QString fn =KOPrefs::instance()->mLastImportFile; |
1680 | 1723 | ||
1681 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1724 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1682 | if ( fn == "" ) | 1725 | if ( fn == "" ) |
1683 | return; | 1726 | return; |
1684 | importFile( fn, true ); | 1727 | importFile( fn, true ); |
1685 | 1728 | ||
1686 | } | 1729 | } |
1687 | 1730 | ||
1688 | void MainWindow::exportVCalendar() | 1731 | void MainWindow::exportVCalendar() |
1689 | { | 1732 | { |
1690 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1733 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1691 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1734 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1692 | if ( fn == "" ) | 1735 | if ( fn == "" ) |
1693 | return; | 1736 | return; |
1694 | QFileInfo info; | 1737 | QFileInfo info; |
1695 | info.setFile( fn ); | 1738 | info.setFile( fn ); |
1696 | QString mes; | 1739 | QString mes; |
1697 | bool createbup = true; | 1740 | bool createbup = true; |
1698 | if ( info. exists() ) { | 1741 | if ( info. exists() ) { |
1699 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1742 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1700 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1743 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1701 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1744 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1702 | 0, 1 ); | 1745 | 0, 1 ); |
1703 | if ( result != 0 ) { | 1746 | if ( result != 0 ) { |
1704 | createbup = false; | 1747 | createbup = false; |
1705 | } | 1748 | } |
1706 | } | 1749 | } |
1707 | if ( createbup ) { | 1750 | if ( createbup ) { |
1708 | if ( mView->exportVCalendar( fn ) ) { | 1751 | if ( mView->exportVCalendar( fn ) ) { |
1709 | KOPrefs::instance()->mLastVcalFile = fn; | 1752 | KOPrefs::instance()->mLastVcalFile = fn; |
1710 | if ( fn.length() > 20 ) | 1753 | if ( fn.length() > 20 ) |
1711 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1754 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1712 | else | 1755 | else |
1713 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1756 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1714 | setCaption(mes); | 1757 | setCaption(mes); |
1715 | } | 1758 | } |
1716 | } | 1759 | } |
1717 | 1760 | ||
1718 | } | 1761 | } |
1719 | #include <qpushbutton.h> | 1762 | #include <qpushbutton.h> |
1720 | QString MainWindow::getPassword( ) | 1763 | QString MainWindow::getPassword( ) |
1721 | { | 1764 | { |
1722 | QString retfile = ""; | 1765 | QString retfile = ""; |
1723 | QDialog dia ( this, "input-dialog", true ); | 1766 | QDialog dia ( this, "input-dialog", true ); |
1724 | QLineEdit lab ( &dia ); | 1767 | QLineEdit lab ( &dia ); |
1725 | lab.setEchoMode( QLineEdit::Password ); | 1768 | lab.setEchoMode( QLineEdit::Password ); |
1726 | QVBoxLayout lay( &dia ); | 1769 | QVBoxLayout lay( &dia ); |
1727 | lay.setMargin(7); | 1770 | lay.setMargin(7); |
1728 | lay.setSpacing(7); | 1771 | lay.setSpacing(7); |
1729 | lay.addWidget( &lab); | 1772 | lay.addWidget( &lab); |
1730 | dia.setFixedSize( 230,50 ); | 1773 | dia.setFixedSize( 230,50 ); |
1731 | dia.setCaption( i18n("Enter password") ); | 1774 | dia.setCaption( i18n("Enter password") ); |
1732 | QPushButton pb ( "OK", &dia); | 1775 | QPushButton pb ( "OK", &dia); |
1733 | lay.addWidget( &pb ); | 1776 | lay.addWidget( &pb ); |
1734 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1777 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1735 | dia.show(); | 1778 | dia.show(); |
1736 | int res = dia.exec(); | 1779 | int res = dia.exec(); |
1737 | if ( res ) | 1780 | if ( res ) |
1738 | retfile = lab.text(); | 1781 | retfile = lab.text(); |
1739 | dia.hide(); | 1782 | dia.hide(); |
1740 | qApp->processEvents(); | 1783 | qApp->processEvents(); |
1741 | return retfile; | 1784 | return retfile; |
1742 | 1785 | ||
1743 | } | 1786 | } |
1744 | 1787 | ||
1745 | void MainWindow::syncLocalFile() | 1788 | void MainWindow::syncLocalFile() |
1746 | { | 1789 | { |
1747 | 1790 | ||
1748 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | 1791 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; |
1749 | 1792 | ||
1750 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 1793 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
1751 | if ( fn == "" ) | 1794 | if ( fn == "" ) |
1752 | return; | 1795 | return; |
1753 | //mView->setSyncDevice("local-file" ); | 1796 | //mView->setSyncDevice("local-file" ); |
1754 | if ( syncWithFile( fn, false ) ) { | 1797 | if ( syncWithFile( fn, false ) ) { |
1755 | // Event* e = mView->getLastSyncEvent(); | 1798 | // Event* e = mView->getLastSyncEvent(); |
1756 | // e->setReadOnly( false ); | 1799 | // e->setReadOnly( false ); |
1757 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1800 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1758 | // e->setReadOnly( true ); | 1801 | // e->setReadOnly( true ); |
1759 | } | 1802 | } |
1760 | 1803 | ||
1761 | } | 1804 | } |
1762 | 1805 | ||
1763 | bool MainWindow::syncWithFile( QString fn , bool quick ) | 1806 | bool MainWindow::syncWithFile( QString fn , bool quick ) |
1764 | { | 1807 | { |
1765 | bool ret = false; | 1808 | bool ret = false; |
1766 | QFileInfo info; | 1809 | QFileInfo info; |
1767 | info.setFile( fn ); | 1810 | info.setFile( fn ); |
1768 | QString mess; | 1811 | QString mess; |
1769 | bool loadbup = true; | 1812 | bool loadbup = true; |
1770 | if ( !info. exists() ) { | 1813 | if ( !info. exists() ) { |
1771 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 1814 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
1772 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1815 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1773 | mess ); | 1816 | mess ); |
1774 | return ret; | 1817 | return ret; |
1775 | } | 1818 | } |
1776 | int result = 0; | 1819 | int result = 0; |
1777 | if ( !quick ) { | 1820 | if ( !quick ) { |
1778 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1821 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1779 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1822 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1780 | mess, | 1823 | mess, |
1781 | i18n("Sync"), i18n("Cancel"), 0, | 1824 | i18n("Sync"), i18n("Cancel"), 0, |
1782 | 0, 1 ); | 1825 | 0, 1 ); |
1783 | if ( result ) | 1826 | if ( result ) |
1784 | return false; | 1827 | return false; |
1785 | } | 1828 | } |
1786 | if ( KOPrefs::instance()->mAskForPreferences ) | 1829 | if ( KOPrefs::instance()->mAskForPreferences ) |
1787 | mView->edit_sync_options(); | 1830 | mView->edit_sync_options(); |
1788 | if ( result == 0 ) { | 1831 | if ( result == 0 ) { |
1789 | //qDebug("Now sycing ... "); | 1832 | //qDebug("Now sycing ... "); |
1790 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) | 1833 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) |
1791 | setCaption( i18n("Synchronization successful") ); | 1834 | setCaption( i18n("Synchronization successful") ); |
1792 | else | 1835 | else |
1793 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 1836 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
1794 | if ( ! quick ) | 1837 | if ( ! quick ) |
1795 | KOPrefs::instance()->mLastSyncedLocalFile = fn; | 1838 | KOPrefs::instance()->mLastSyncedLocalFile = fn; |
1796 | slotModifiedChanged( true ); | 1839 | slotModifiedChanged( true ); |
1797 | } | 1840 | } |
1798 | return ret; | 1841 | return ret; |
1799 | } | 1842 | } |
1800 | void MainWindow::quickSyncLocalFile() | 1843 | void MainWindow::quickSyncLocalFile() |
1801 | { | 1844 | { |
1802 | //mView->setSyncDevice("local-file" ); | 1845 | //mView->setSyncDevice("local-file" ); |
1803 | //qDebug("quickSyncLocalFile() "); | 1846 | //qDebug("quickSyncLocalFile() "); |
1804 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { | 1847 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { |
1805 | // Event* e = mView->getLastSyncEvent(); | 1848 | // Event* e = mView->getLastSyncEvent(); |
1806 | // e->setReadOnly( false ); | 1849 | // e->setReadOnly( false ); |
1807 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1850 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1808 | // e->setReadOnly( true ); | 1851 | // e->setReadOnly( true ); |
1809 | 1852 | ||
1810 | } | 1853 | } |
1811 | } | 1854 | } |
1812 | 1855 | ||
1813 | void MainWindow::confSync() | 1856 | void MainWindow::confSync() |
1814 | { | 1857 | { |
1815 | mView->confSync(); | 1858 | mView->confSync(); |
1816 | fillSyncMenu(); | 1859 | fillSyncMenu(); |
1817 | //mView->writeSettings(); | 1860 | //mView->writeSettings(); |
1818 | 1861 | ||
1819 | 1862 | ||
1820 | } | 1863 | } |
1821 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | 1864 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) |
1822 | { | 1865 | { |
1823 | QString question; | 1866 | QString question; |
1824 | if ( ask ) { | 1867 | if ( ask ) { |
1825 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 1868 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
1826 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1869 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1827 | question, | 1870 | question, |
1828 | i18n("Yes"), i18n("No"), | 1871 | i18n("Yes"), i18n("No"), |
1829 | 0, 0 ) != 0 ) | 1872 | 0, 0 ) != 0 ) |
1830 | return; | 1873 | return; |
1831 | } | 1874 | } |
1832 | QString command = prof->getPreSyncCommand(); | 1875 | QString command = prof->getPreSyncCommand(); |
1833 | int fi; | 1876 | int fi; |
1834 | if ( (fi = command.find("$PWD$")) > 0 ) { | 1877 | if ( (fi = command.find("$PWD$")) > 0 ) { |
1835 | QString pwd = getPassword(); | 1878 | QString pwd = getPassword(); |
1836 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | 1879 | command = command.left( fi )+ pwd + command.mid( fi+5 ); |
1837 | 1880 | ||
1838 | } | 1881 | } |
1839 | int maxlen = 30; | 1882 | int maxlen = 30; |
1840 | if ( QApplication::desktop()->width() > 320 ) | 1883 | if ( QApplication::desktop()->width() > 320 ) |
1841 | maxlen += 25; | 1884 | maxlen += 25; |
1842 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1885 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1843 | int fileSize = 0; | 1886 | int fileSize = 0; |
1844 | int result = system ( command ); | 1887 | int result = system ( command ); |
1845 | // 0 : okay | 1888 | // 0 : okay |
1846 | // 256: no such file or dir | 1889 | // 256: no such file or dir |
1847 | // | 1890 | // |
1848 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1891 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1849 | if ( result != 0 ) { | 1892 | if ( result != 0 ) { |
1850 | int len = maxlen; | 1893 | int len = maxlen; |
1851 | while ( len < command.length() ) { | 1894 | while ( len < command.length() ) { |
1852 | command.insert( len , "\n" ); | 1895 | command.insert( len , "\n" ); |
1853 | len += maxlen +2; | 1896 | len += maxlen +2; |
1854 | } | 1897 | } |
1855 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 1898 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1856 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1899 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1857 | question, | 1900 | question, |
1858 | i18n("Okay!")) ; | 1901 | i18n("Okay!")) ; |
1859 | setCaption ("KO/Pi"); | 1902 | setCaption ("KO/Pi"); |
1860 | return; | 1903 | return; |
1861 | } | 1904 | } |
1862 | setCaption ( i18n( "Copying succeed." ) ); | 1905 | setCaption ( i18n( "Copying succeed." ) ); |
1863 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 1906 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
1864 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { | 1907 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { |
1865 | // Event* e = mView->getLastSyncEvent(); | 1908 | // Event* e = mView->getLastSyncEvent(); |
1866 | // e->setReadOnly( false ); | 1909 | // e->setReadOnly( false ); |
1867 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1910 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1868 | // e->setReadOnly( true ); | 1911 | // e->setReadOnly( true ); |
1869 | if ( KOPrefs::instance()->mWriteBackFile ) { | 1912 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1870 | command = prof->getPostSyncCommand(); | 1913 | command = prof->getPostSyncCommand(); |
1871 | setCaption ( i18n( "Writing back file ..." ) ); | 1914 | setCaption ( i18n( "Writing back file ..." ) ); |
1872 | result = system ( command ); | 1915 | result = system ( command ); |
1873 | qDebug("KO: Writing back file result: %d ", result); | 1916 | qDebug("KO: Writing back file result: %d ", result); |
1874 | if ( result != 0 ) { | 1917 | if ( result != 0 ) { |
1875 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 1918 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
1876 | return; | 1919 | return; |
1877 | } else { | 1920 | } else { |
1878 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 1921 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
1879 | } | 1922 | } |
1880 | } | 1923 | } |
1881 | } | 1924 | } |
1882 | return; | 1925 | return; |
1883 | } | 1926 | } |
1884 | void MainWindow::syncSSH() | 1927 | void MainWindow::syncSSH() |
1885 | { | 1928 | { |
1886 | // not used anymore | 1929 | // not used anymore |
1887 | QTime timer; | 1930 | QTime timer; |
1888 | timer.start(); | 1931 | timer.start(); |
1889 | //qDebug("MainWindow::syncssh() "); | 1932 | //qDebug("MainWindow::syncssh() "); |
1890 | KOPrefs *p = KOPrefs::instance(); | 1933 | KOPrefs *p = KOPrefs::instance(); |
1891 | QString localFile = p->mLocalTempFile; | 1934 | QString localFile = p->mLocalTempFile; |
1892 | QString remoteIP = p->mRemoteIP; | 1935 | QString remoteIP = p->mRemoteIP; |
1893 | QString remoteUser = p->mRemoteUser; | 1936 | QString remoteUser = p->mRemoteUser; |
1894 | QString remoteFile = p->mRemoteFile; | 1937 | QString remoteFile = p->mRemoteFile; |
1895 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) | 1938 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) |
1896 | remoteUser += ":" + p->mRemotePassWd; | 1939 | remoteUser += ":" + p->mRemotePassWd; |
1897 | 1940 | ||
1898 | QString question = i18n("Do you really want\nto remote sync?\n \n") + | 1941 | QString question = i18n("Do you really want\nto remote sync?\n \n") + |
1899 | i18n("IP: " ) +remoteIP +"\n" + | 1942 | i18n("IP: " ) +remoteIP +"\n" + |
1900 | i18n("User: " ) + remoteUser +"\n" ; | 1943 | i18n("User: " ) + remoteUser +"\n" ; |
1901 | int maxlen = 30; | 1944 | int maxlen = 30; |
1902 | if ( QApplication::desktop()->width() > 320 ) | 1945 | if ( QApplication::desktop()->width() > 320 ) |
1903 | maxlen += 25; | 1946 | maxlen += 25; |
1904 | if ( remoteFile.length() > maxlen ) | 1947 | if ( remoteFile.length() > maxlen ) |
1905 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; | 1948 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; |
1906 | else | 1949 | else |
1907 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; | 1950 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; |
1908 | if ( localFile.length() > maxlen ) | 1951 | if ( localFile.length() > maxlen ) |
1909 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; | 1952 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; |
1910 | else | 1953 | else |
1911 | question += i18n("Local temp file:\n " ) + localFile +"\n"; | 1954 | question += i18n("Local temp file:\n " ) + localFile +"\n"; |
1912 | 1955 | ||
1913 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1956 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1914 | question, | 1957 | question, |
1915 | i18n("Yes"), i18n("No"), | 1958 | i18n("Yes"), i18n("No"), |
1916 | 0, 0 ) != 0 ) | 1959 | 0, 0 ) != 0 ) |
1917 | return; | 1960 | return; |
1918 | // if ( !p->mUsePassWd ) { | 1961 | // if ( !p->mUsePassWd ) { |
1919 | // QString pass = getPassword(); | 1962 | // QString pass = getPassword(); |
1920 | // if ( pass.length() > 0 ) | 1963 | // if ( pass.length() > 0 ) |
1921 | // remoteUser += ":" + pass; | 1964 | // remoteUser += ":" + pass; |
1922 | // } | 1965 | // } |
1923 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; | 1966 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; |
1924 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1967 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1925 | int fileSize = 0; | 1968 | int fileSize = 0; |
1926 | int result = system ( command ); | 1969 | int result = system ( command ); |
1927 | // 0 : okay | 1970 | // 0 : okay |
1928 | // 256: no such file or dir | 1971 | // 256: no such file or dir |
1929 | // | 1972 | // |
1930 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1973 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1931 | if ( result != 0 ) { | 1974 | if ( result != 0 ) { |
1932 | int len = maxlen; | 1975 | int len = maxlen; |
1933 | while ( len < command.length() ) { | 1976 | while ( len < command.length() ) { |
1934 | command.insert( len , "\n" ); | 1977 | command.insert( len , "\n" ); |
1935 | len += maxlen +2; | 1978 | len += maxlen +2; |
1936 | } | 1979 | } |
1937 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 1980 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1938 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1981 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1939 | question, | 1982 | question, |
1940 | i18n("Okay!")) ; | 1983 | i18n("Okay!")) ; |
1941 | setCaption ("KO/Pi"); | 1984 | setCaption ("KO/Pi"); |
1942 | return; | 1985 | return; |
1943 | } | 1986 | } |
1944 | 1987 | ||
1945 | 1988 | ||
1946 | setCaption ( i18n( "Copying succeed." ) ); | 1989 | setCaption ( i18n( "Copying succeed." ) ); |
1947 | //mView->setSyncDevice("ssh-scp" ); | 1990 | //mView->setSyncDevice("ssh-scp" ); |
1948 | if ( syncWithFile(localFile , true ) ) { | 1991 | if ( syncWithFile(localFile , true ) ) { |
1949 | // Event* e = mView->getLastSyncEvent(); | 1992 | // Event* e = mView->getLastSyncEvent(); |
1950 | // e->setReadOnly( false ); | 1993 | // e->setReadOnly( false ); |
1951 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1994 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1952 | // e->setReadOnly( true ); | 1995 | // e->setReadOnly( true ); |
1953 | if ( KOPrefs::instance()->mWriteBackFile ) { | 1996 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1954 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; | 1997 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; |
1955 | setCaption ( i18n( "Writing back file ..." ) ); | 1998 | setCaption ( i18n( "Writing back file ..." ) ); |
1956 | result = system ( command ); | 1999 | result = system ( command ); |
1957 | if ( result != 0 ) { | 2000 | if ( result != 0 ) { |
1958 | int len = maxlen; | 2001 | int len = maxlen; |
1959 | while ( len < command.length() ) { | 2002 | while ( len < command.length() ) { |
1960 | command.insert( len , "\n" ); | 2003 | command.insert( len , "\n" ); |
1961 | len += maxlen +2; | 2004 | len += maxlen +2; |
1962 | } | 2005 | } |
1963 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 2006 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1964 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 2007 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1965 | question, | 2008 | question, |
1966 | i18n("Okay!")) ; | 2009 | i18n("Okay!")) ; |
1967 | setCaption ("KO/Pi"); | 2010 | setCaption ("KO/Pi"); |
1968 | return; | 2011 | return; |
1969 | } else { | 2012 | } else { |
1970 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 2013 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
1971 | } | 2014 | } |
1972 | } | 2015 | } |
1973 | } | 2016 | } |
1974 | return; | 2017 | return; |
1975 | #if 0 | 2018 | #if 0 |
1976 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); | 2019 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); |
1977 | while ( timer.elapsed() < 5000 ) | 2020 | while ( timer.elapsed() < 5000 ) |
1978 | qApp->processEvents(); | 2021 | qApp->processEvents(); |
1979 | 2022 | ||
1980 | qDebug("MainWindow::merging) "); | 2023 | qDebug("MainWindow::merging) "); |
1981 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); | 2024 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); |
1982 | while ( mBlockSaveFlag ) | 2025 | while ( mBlockSaveFlag ) |
1983 | qApp->processEvents(); | 2026 | qApp->processEvents(); |
1984 | save(); | 2027 | save(); |
1985 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); | 2028 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); |
1986 | #endif | 2029 | #endif |
1987 | 2030 | ||
1988 | } | 2031 | } |
1989 | 2032 | ||
1990 | 2033 | ||
1991 | void MainWindow::syncSharp() | 2034 | void MainWindow::syncSharp() |
1992 | { | 2035 | { |
1993 | if ( mCalendarModifiedFlag ) | 2036 | if ( mCalendarModifiedFlag ) |
1994 | save(); | 2037 | save(); |
1995 | mView->syncSharp(); | 2038 | mView->syncSharp(); |
1996 | slotModifiedChanged( true ); | 2039 | slotModifiedChanged( true ); |
1997 | 2040 | ||
1998 | } | 2041 | } |
1999 | 2042 | ||
2000 | void MainWindow::printSel( ) | 2043 | void MainWindow::printSel( ) |
2001 | { | 2044 | { |
2002 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2045 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2003 | } | 2046 | } |
2004 | 2047 | ||
2005 | void MainWindow::printCal() | 2048 | void MainWindow::printCal() |
2006 | { | 2049 | { |
2007 | mView->print();//mCp->showDialog(); | 2050 | mView->print();//mCp->showDialog(); |
2008 | } | 2051 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 8a3f7b3..fba8c52 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,117 +1,120 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | 7 | ||
8 | #include <libkcal/incidence.h> | 8 | #include <libkcal/incidence.h> |
9 | #include "simplealarmclient.h" | 9 | #include "simplealarmclient.h" |
10 | 10 | ||
11 | class QAction; | 11 | class QAction; |
12 | class CalendarView; | 12 | class CalendarView; |
13 | class KSyncProfile; | 13 | class KSyncProfile; |
14 | #ifdef DESKTOP_VERSION | 14 | #ifdef DESKTOP_VERSION |
15 | 15 | ||
16 | #define QPEToolBar QToolBar | 16 | #define QPEToolBar QToolBar |
17 | #define QPEMenuBar QMenuBar | 17 | #define QPEMenuBar QMenuBar |
18 | #endif | 18 | #endif |
19 | class QPEToolBar; | 19 | class QPEToolBar; |
20 | 20 | ||
21 | namespace KCal { | 21 | namespace KCal { |
22 | class CalendarLocal; | 22 | class CalendarLocal; |
23 | } | 23 | } |
24 | 24 | ||
25 | using namespace KCal; | 25 | using namespace KCal; |
26 | 26 | ||
27 | class MainWindow : public QMainWindow | 27 | class MainWindow : public QMainWindow |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
32 | ~MainWindow(); | 32 | ~MainWindow(); |
33 | public slots: | 33 | public slots: |
34 | void configureAgenda( int ); | 34 | void configureAgenda( int ); |
35 | void recieve( const QCString& msg, const QByteArray& data ); | 35 | void recieve( const QCString& msg, const QByteArray& data ); |
36 | static QString defaultFileName(); | 36 | static QString defaultFileName(); |
37 | static QString resourcePath(); | 37 | static QString resourcePath(); |
38 | protected slots: | 38 | protected slots: |
39 | void setCaptionToDates(); | 39 | void setCaptionToDates(); |
40 | int ringSync(); | 40 | int ringSync(); |
41 | void multiSync( bool askforPrefs = false ); | 41 | void multiSync( bool askforPrefs = false ); |
42 | void about(); | 42 | void about(); |
43 | void licence(); | 43 | void licence(); |
44 | void faq(); | 44 | void faq(); |
45 | void usertrans(); | 45 | void usertrans(); |
46 | void features(); | 46 | void features(); |
47 | void synchowto(); | 47 | void synchowto(); |
48 | void whatsNew(); | 48 | void whatsNew(); |
49 | void keyBindings(); | 49 | void keyBindings(); |
50 | void aboutAutoSaving();; | 50 | void aboutAutoSaving();; |
51 | void aboutKnownBugs(); | 51 | void aboutKnownBugs(); |
52 | 52 | ||
53 | void processIncidenceSelection( Incidence * ); | 53 | void processIncidenceSelection( Incidence * ); |
54 | 54 | ||
55 | void importQtopia(); | 55 | void importQtopia(); |
56 | void importBday(); | 56 | void importBday(); |
57 | void importOL(); | 57 | void importOL(); |
58 | void importIcal(); | 58 | void importIcal(); |
59 | void importFile( QString, bool ); | 59 | void importFile( QString, bool ); |
60 | void quickImportIcal(); | 60 | void quickImportIcal(); |
61 | 61 | ||
62 | void slotModifiedChanged( bool ); | 62 | void slotModifiedChanged( bool ); |
63 | 63 | ||
64 | void save(); | 64 | void save(); |
65 | void configureToolBar( int ); | 65 | void configureToolBar( int ); |
66 | void printSel(); | 66 | void printSel(); |
67 | void printCal(); | 67 | void printCal(); |
68 | void saveCalendar(); | 68 | void saveCalendar(); |
69 | void loadCalendar(); | 69 | void loadCalendar(); |
70 | void exportVCalendar(); | 70 | void exportVCalendar(); |
71 | void fillFilterMenu(); | ||
72 | void selectFilter( int ); | ||
71 | 73 | ||
72 | void slotSyncMenu( int ); | 74 | void slotSyncMenu( int ); |
73 | void syncSSH(); | 75 | void syncSSH(); |
74 | void confSync(); | 76 | void confSync(); |
75 | void syncSharp(); | 77 | void syncSharp(); |
76 | void syncLocalFile(); | 78 | void syncLocalFile(); |
77 | bool syncWithFile( QString, bool ); | 79 | bool syncWithFile( QString, bool ); |
78 | void quickSyncLocalFile(); | 80 | void quickSyncLocalFile(); |
79 | 81 | ||
80 | 82 | ||
81 | protected: | 83 | protected: |
82 | void displayText( QString, QString); | 84 | void displayText( QString, QString); |
83 | void displayFile( QString, QString); | 85 | void displayFile( QString, QString); |
84 | 86 | ||
85 | void enableIncidenceActions( bool ); | 87 | void enableIncidenceActions( bool ); |
86 | 88 | ||
87 | private: | 89 | private: |
88 | void saveOnClose(); | 90 | void saveOnClose(); |
89 | int mCurrentSyncProfile; | 91 | int mCurrentSyncProfile; |
90 | void syncRemote( KSyncProfile* , bool ask = true); | 92 | void syncRemote( KSyncProfile* , bool ask = true); |
91 | void fillSyncMenu(); | 93 | void fillSyncMenu(); |
92 | bool mFlagKeyPressed; | 94 | bool mFlagKeyPressed; |
93 | bool mBlockAtStartup; | 95 | bool mBlockAtStartup; |
94 | QPEToolBar *iconToolBar; | 96 | QPEToolBar *iconToolBar; |
95 | void initActions(); | 97 | void initActions(); |
96 | void setDefaultPreferences(); | 98 | void setDefaultPreferences(); |
97 | void keyPressEvent ( QKeyEvent * ) ; | 99 | void keyPressEvent ( QKeyEvent * ) ; |
98 | void keyReleaseEvent ( QKeyEvent * ) ; | 100 | void keyReleaseEvent ( QKeyEvent * ) ; |
99 | QPopupMenu *configureToolBarMenu; | 101 | QPopupMenu *configureToolBarMenu; |
102 | QPopupMenu *selectFilterMenu; | ||
100 | QPopupMenu *configureAgendaMenu, *syncMenu; | 103 | QPopupMenu *configureAgendaMenu, *syncMenu; |
101 | CalendarLocal *mCalendar; | 104 | CalendarLocal *mCalendar; |
102 | CalendarView *mView; | 105 | CalendarView *mView; |
103 | QString getPassword(); | 106 | QString getPassword(); |
104 | QAction *mNewSubTodoAction; | 107 | QAction *mNewSubTodoAction; |
105 | 108 | ||
106 | QAction *mShowAction; | 109 | QAction *mShowAction; |
107 | QAction *mEditAction; | 110 | QAction *mEditAction; |
108 | QAction *mDeleteAction; | 111 | QAction *mDeleteAction; |
109 | void closeEvent( QCloseEvent* ce ); | 112 | void closeEvent( QCloseEvent* ce ); |
110 | SimpleAlarmClient mAlarmClient; | 113 | SimpleAlarmClient mAlarmClient; |
111 | QTimer mSaveTimer; | 114 | QTimer mSaveTimer; |
112 | bool mBlockSaveFlag; | 115 | bool mBlockSaveFlag; |
113 | bool mCalendarModifiedFlag; | 116 | bool mCalendarModifiedFlag; |
114 | QPixmap loadPixmap( QString ); | 117 | QPixmap loadPixmap( QString ); |
115 | }; | 118 | }; |
116 | 119 | ||
117 | #endif | 120 | #endif |