-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 6 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 159 |
4 files changed, 96 insertions, 73 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ba0e6c6..bbed05b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1683,513 +1683,513 @@ void CalendarView::readSettings() | |||
1683 | mTodoEditor->setGeometry(x,y,w,h); | 1683 | mTodoEditor->setGeometry(x,y,w,h); |
1684 | 1684 | ||
1685 | } | 1685 | } |
1686 | list = config->readListEntry("ViewerLayout"); | 1686 | list = config->readListEntry("ViewerLayout"); |
1687 | if ( ! list.isEmpty() ) { | 1687 | if ( ! list.isEmpty() ) { |
1688 | x = list[0].toInt(); | 1688 | x = list[0].toInt(); |
1689 | y = list[1].toInt(); | 1689 | y = list[1].toInt(); |
1690 | w = list[2].toInt(); | 1690 | w = list[2].toInt(); |
1691 | h = list[3].toInt(); | 1691 | h = list[3].toInt(); |
1692 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1692 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1693 | } | 1693 | } |
1694 | #endif | 1694 | #endif |
1695 | 1695 | ||
1696 | } | 1696 | } |
1697 | 1697 | ||
1698 | 1698 | ||
1699 | void CalendarView::writeSettings() | 1699 | void CalendarView::writeSettings() |
1700 | { | 1700 | { |
1701 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1701 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1702 | 1702 | ||
1703 | KConfig *config = KOGlobals::config(); | 1703 | KConfig *config = KOGlobals::config(); |
1704 | 1704 | ||
1705 | #ifndef KORG_NOSPLITTER | 1705 | #ifndef KORG_NOSPLITTER |
1706 | config->setGroup("KOrganizer Geometry"); | 1706 | config->setGroup("KOrganizer Geometry"); |
1707 | 1707 | ||
1708 | QValueList<int> list = mPanner->sizes(); | 1708 | QValueList<int> list = mPanner->sizes(); |
1709 | config->writeEntry("Separator1",list); | 1709 | config->writeEntry("Separator1",list); |
1710 | 1710 | ||
1711 | list = mLeftSplitter->sizes(); | 1711 | list = mLeftSplitter->sizes(); |
1712 | config->writeEntry("Separator2",list); | 1712 | config->writeEntry("Separator2",list); |
1713 | #endif | 1713 | #endif |
1714 | 1714 | ||
1715 | mViewManager->writeSettings( config ); | 1715 | mViewManager->writeSettings( config ); |
1716 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1716 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1717 | mDialogManager->writeSettings( config ); | 1717 | mDialogManager->writeSettings( config ); |
1718 | //KOPrefs::instance()->usrWriteConfig(); | 1718 | //KOPrefs::instance()->usrWriteConfig(); |
1719 | KOPrefs::instance()->writeConfig(); | 1719 | KOPrefs::instance()->writeConfig(); |
1720 | 1720 | ||
1721 | writeFilterSettings(config); | 1721 | writeFilterSettings(config); |
1722 | 1722 | ||
1723 | config->setGroup( "Views" ); | 1723 | config->setGroup( "Views" ); |
1724 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1724 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1725 | 1725 | ||
1726 | #ifdef DESKTOP_VERSION | 1726 | #ifdef DESKTOP_VERSION |
1727 | config->setGroup("WidgetLayout"); | 1727 | config->setGroup("WidgetLayout"); |
1728 | QStringList list ;//= config->readListEntry("MainLayout"); | 1728 | QStringList list ;//= config->readListEntry("MainLayout"); |
1729 | int x,y,w,h; | 1729 | int x,y,w,h; |
1730 | QWidget* wid; | 1730 | QWidget* wid; |
1731 | wid = topLevelWidget(); | 1731 | wid = topLevelWidget(); |
1732 | x = wid->geometry().x(); | 1732 | x = wid->geometry().x(); |
1733 | y = wid->geometry().y(); | 1733 | y = wid->geometry().y(); |
1734 | w = wid->width(); | 1734 | w = wid->width(); |
1735 | h = wid->height(); | 1735 | h = wid->height(); |
1736 | list.clear(); | 1736 | list.clear(); |
1737 | list << QString::number( x ); | 1737 | list << QString::number( x ); |
1738 | list << QString::number( y ); | 1738 | list << QString::number( y ); |
1739 | list << QString::number( w ); | 1739 | list << QString::number( w ); |
1740 | list << QString::number( h ); | 1740 | list << QString::number( h ); |
1741 | config->writeEntry("MainLayout",list ); | 1741 | config->writeEntry("MainLayout",list ); |
1742 | 1742 | ||
1743 | wid = mEventEditor; | 1743 | wid = mEventEditor; |
1744 | x = wid->geometry().x(); | 1744 | x = wid->geometry().x(); |
1745 | y = wid->geometry().y(); | 1745 | y = wid->geometry().y(); |
1746 | w = wid->width(); | 1746 | w = wid->width(); |
1747 | h = wid->height(); | 1747 | h = wid->height(); |
1748 | list.clear(); | 1748 | list.clear(); |
1749 | list << QString::number( x ); | 1749 | list << QString::number( x ); |
1750 | list << QString::number( y ); | 1750 | list << QString::number( y ); |
1751 | list << QString::number( w ); | 1751 | list << QString::number( w ); |
1752 | list << QString::number( h ); | 1752 | list << QString::number( h ); |
1753 | config->writeEntry("EditEventLayout",list ); | 1753 | config->writeEntry("EditEventLayout",list ); |
1754 | 1754 | ||
1755 | wid = mTodoEditor; | 1755 | wid = mTodoEditor; |
1756 | x = wid->geometry().x(); | 1756 | x = wid->geometry().x(); |
1757 | y = wid->geometry().y(); | 1757 | y = wid->geometry().y(); |
1758 | w = wid->width(); | 1758 | w = wid->width(); |
1759 | h = wid->height(); | 1759 | h = wid->height(); |
1760 | list.clear(); | 1760 | list.clear(); |
1761 | list << QString::number( x ); | 1761 | list << QString::number( x ); |
1762 | list << QString::number( y ); | 1762 | list << QString::number( y ); |
1763 | list << QString::number( w ); | 1763 | list << QString::number( w ); |
1764 | list << QString::number( h ); | 1764 | list << QString::number( h ); |
1765 | config->writeEntry("EditTodoLayout",list ); | 1765 | config->writeEntry("EditTodoLayout",list ); |
1766 | wid = getEventViewerDialog(); | 1766 | wid = getEventViewerDialog(); |
1767 | x = wid->geometry().x(); | 1767 | x = wid->geometry().x(); |
1768 | y = wid->geometry().y(); | 1768 | y = wid->geometry().y(); |
1769 | w = wid->width(); | 1769 | w = wid->width(); |
1770 | h = wid->height(); | 1770 | h = wid->height(); |
1771 | list.clear(); | 1771 | list.clear(); |
1772 | list << QString::number( x ); | 1772 | list << QString::number( x ); |
1773 | list << QString::number( y ); | 1773 | list << QString::number( y ); |
1774 | list << QString::number( w ); | 1774 | list << QString::number( w ); |
1775 | list << QString::number( h ); | 1775 | list << QString::number( h ); |
1776 | config->writeEntry("ViewerLayout",list ); | 1776 | config->writeEntry("ViewerLayout",list ); |
1777 | wid = mDialogManager->getSearchDialog(); | 1777 | wid = mDialogManager->getSearchDialog(); |
1778 | if ( wid ) { | 1778 | if ( wid ) { |
1779 | x = wid->geometry().x(); | 1779 | x = wid->geometry().x(); |
1780 | y = wid->geometry().y(); | 1780 | y = wid->geometry().y(); |
1781 | w = wid->width(); | 1781 | w = wid->width(); |
1782 | h = wid->height(); | 1782 | h = wid->height(); |
1783 | list.clear(); | 1783 | list.clear(); |
1784 | list << QString::number( x ); | 1784 | list << QString::number( x ); |
1785 | list << QString::number( y ); | 1785 | list << QString::number( y ); |
1786 | list << QString::number( w ); | 1786 | list << QString::number( w ); |
1787 | list << QString::number( h ); | 1787 | list << QString::number( h ); |
1788 | config->writeEntry("SearchLayout",list ); | 1788 | config->writeEntry("SearchLayout",list ); |
1789 | } | 1789 | } |
1790 | #endif | 1790 | #endif |
1791 | 1791 | ||
1792 | 1792 | ||
1793 | config->sync(); | 1793 | config->sync(); |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | void CalendarView::readFilterSettings(KConfig *config) | 1796 | void CalendarView::readFilterSettings(KConfig *config) |
1797 | { | 1797 | { |
1798 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 1798 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
1799 | 1799 | ||
1800 | mFilters.clear(); | 1800 | mFilters.clear(); |
1801 | 1801 | ||
1802 | config->setGroup("General"); | 1802 | config->setGroup("General"); |
1803 | QStringList filterList = config->readListEntry("CalendarFilters"); | 1803 | QStringList filterList = config->readListEntry("CalendarFilters"); |
1804 | 1804 | ||
1805 | QStringList::ConstIterator it = filterList.begin(); | 1805 | QStringList::ConstIterator it = filterList.begin(); |
1806 | QStringList::ConstIterator end = filterList.end(); | 1806 | QStringList::ConstIterator end = filterList.end(); |
1807 | while(it != end) { | 1807 | while(it != end) { |
1808 | // kdDebug() << " filter: " << (*it) << endl; | 1808 | // kdDebug() << " filter: " << (*it) << endl; |
1809 | 1809 | ||
1810 | CalFilter *filter; | 1810 | CalFilter *filter; |
1811 | filter = new CalFilter(*it); | 1811 | filter = new CalFilter(*it); |
1812 | config->setGroup("Filter_" + (*it)); | 1812 | config->setGroup("Filter_" + (*it)); |
1813 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 1813 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
1814 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 1814 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
1815 | filter->setCategoryList(config->readListEntry("CategoryList")); | 1815 | filter->setCategoryList(config->readListEntry("CategoryList")); |
1816 | mFilters.append(filter); | 1816 | mFilters.append(filter); |
1817 | 1817 | ||
1818 | ++it; | 1818 | ++it; |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | if (mFilters.count() == 0) { | 1821 | if (mFilters.count() == 0) { |
1822 | CalFilter *filter = new CalFilter(i18n("Default")); | 1822 | CalFilter *filter = new CalFilter(i18n("Default")); |
1823 | mFilters.append(filter); | 1823 | mFilters.append(filter); |
1824 | } | 1824 | } |
1825 | mFilterView->updateFilters(); | 1825 | mFilterView->updateFilters(); |
1826 | config->setGroup("FilterView"); | 1826 | config->setGroup("FilterView"); |
1827 | 1827 | ||
1828 | mFilterView->blockSignals(true); | 1828 | mFilterView->blockSignals(true); |
1829 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 1829 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
1830 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 1830 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
1831 | mFilterView->blockSignals(false); | 1831 | mFilterView->blockSignals(false); |
1832 | // We do it manually to avoid it being done twice by the above calls | 1832 | // We do it manually to avoid it being done twice by the above calls |
1833 | updateFilter(); | 1833 | updateFilter(); |
1834 | } | 1834 | } |
1835 | 1835 | ||
1836 | void CalendarView::writeFilterSettings(KConfig *config) | 1836 | void CalendarView::writeFilterSettings(KConfig *config) |
1837 | { | 1837 | { |
1838 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 1838 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
1839 | 1839 | ||
1840 | QStringList filterList; | 1840 | QStringList filterList; |
1841 | 1841 | ||
1842 | CalFilter *filter = mFilters.first(); | 1842 | CalFilter *filter = mFilters.first(); |
1843 | while(filter) { | 1843 | while(filter) { |
1844 | // kdDebug() << " fn: " << filter->name() << endl; | 1844 | // kdDebug() << " fn: " << filter->name() << endl; |
1845 | filterList << filter->name(); | 1845 | filterList << filter->name(); |
1846 | config->setGroup("Filter_" + filter->name()); | 1846 | config->setGroup("Filter_" + filter->name()); |
1847 | config->writeEntry("Criteria",filter->criteria()); | 1847 | config->writeEntry("Criteria",filter->criteria()); |
1848 | config->writeEntry("CategoryList",filter->categoryList()); | 1848 | config->writeEntry("CategoryList",filter->categoryList()); |
1849 | filter = mFilters.next(); | 1849 | filter = mFilters.next(); |
1850 | } | 1850 | } |
1851 | config->setGroup("General"); | 1851 | config->setGroup("General"); |
1852 | config->writeEntry("CalendarFilters",filterList); | 1852 | config->writeEntry("CalendarFilters",filterList); |
1853 | 1853 | ||
1854 | config->setGroup("FilterView"); | 1854 | config->setGroup("FilterView"); |
1855 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1855 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1856 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1856 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1857 | } | 1857 | } |
1858 | 1858 | ||
1859 | 1859 | ||
1860 | void CalendarView::goToday() | 1860 | void CalendarView::goToday() |
1861 | { | 1861 | { |
1862 | mNavigator->selectToday(); | 1862 | mNavigator->selectToday(); |
1863 | } | 1863 | } |
1864 | 1864 | ||
1865 | void CalendarView::goNext() | 1865 | void CalendarView::goNext() |
1866 | { | 1866 | { |
1867 | mNavigator->selectNext(); | 1867 | mNavigator->selectNext(); |
1868 | } | 1868 | } |
1869 | 1869 | ||
1870 | void CalendarView::goPrevious() | 1870 | void CalendarView::goPrevious() |
1871 | { | 1871 | { |
1872 | mNavigator->selectPrevious(); | 1872 | mNavigator->selectPrevious(); |
1873 | } | 1873 | } |
1874 | void CalendarView::goNextMonth() | 1874 | void CalendarView::goNextMonth() |
1875 | { | 1875 | { |
1876 | mNavigator->selectNextMonth(); | 1876 | mNavigator->selectNextMonth(); |
1877 | } | 1877 | } |
1878 | 1878 | ||
1879 | void CalendarView::goPreviousMonth() | 1879 | void CalendarView::goPreviousMonth() |
1880 | { | 1880 | { |
1881 | mNavigator->selectPreviousMonth(); | 1881 | mNavigator->selectPreviousMonth(); |
1882 | } | 1882 | } |
1883 | void CalendarView::writeLocale() | 1883 | void CalendarView::writeLocale() |
1884 | { | 1884 | { |
1885 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 1885 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
1886 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 1886 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
1887 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 1887 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
1888 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 1888 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
1889 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1889 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1890 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 1890 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
1891 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 1891 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
1892 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 1892 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
1893 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 1893 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
1894 | KOPrefs::instance()->mDaylightsavingStart, | 1894 | KOPrefs::instance()->mDaylightsavingStart, |
1895 | KOPrefs::instance()->mDaylightsavingEnd ); | 1895 | KOPrefs::instance()->mDaylightsavingEnd ); |
1896 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); | 1896 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); |
1897 | } | 1897 | } |
1898 | void CalendarView::updateConfig() | 1898 | void CalendarView::updateConfig() |
1899 | { | 1899 | { |
1900 | writeLocale(); | 1900 | writeLocale(); |
1901 | if ( KOPrefs::instance()->mUseAppColors ) | 1901 | if ( KOPrefs::instance()->mUseAppColors ) |
1902 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 1902 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
1903 | emit configChanged(); | 1903 | emit configChanged(); |
1904 | mTodoList->updateConfig(); | 1904 | mTodoList->updateConfig(); |
1905 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 1905 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
1906 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1906 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1907 | // To make the "fill window" configurations work | 1907 | // To make the "fill window" configurations work |
1908 | //mViewManager->raiseCurrentView(); | 1908 | //mViewManager->raiseCurrentView(); |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | 1911 | ||
1912 | void CalendarView::eventChanged(Event *event) | 1912 | void CalendarView::eventChanged(Event *event) |
1913 | { | 1913 | { |
1914 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 1914 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
1915 | //updateUnmanagedViews(); | 1915 | //updateUnmanagedViews(); |
1916 | } | 1916 | } |
1917 | 1917 | ||
1918 | void CalendarView::eventAdded(Event *event) | 1918 | void CalendarView::eventAdded(Event *event) |
1919 | { | 1919 | { |
1920 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 1920 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | void CalendarView::eventToBeDeleted(Event *) | 1923 | void CalendarView::eventToBeDeleted(Event *) |
1924 | { | 1924 | { |
1925 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 1925 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
1926 | } | 1926 | } |
1927 | 1927 | ||
1928 | void CalendarView::eventDeleted() | 1928 | void CalendarView::eventDeleted() |
1929 | { | 1929 | { |
1930 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 1930 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
1931 | } | 1931 | } |
1932 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 1932 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
1933 | { | 1933 | { |
1934 | changeIncidenceDisplay((Incidence *)which, action); | 1934 | changeIncidenceDisplay((Incidence *)which, action); |
1935 | mDateNavigator->updateView(); //LR | 1935 | mDateNavigator->updateView(); //LR |
1936 | //mDialogManager->updateSearchDialog(); | 1936 | //mDialogManager->updateSearchDialog(); |
1937 | 1937 | ||
1938 | if (which) { | 1938 | if (which) { |
1939 | //mViewManager->currentView()->updateView();//LR | 1939 | mViewManager->updateWNview(); |
1940 | //mTodoList->updateView(); | 1940 | //mTodoList->updateView(); |
1941 | } | 1941 | } |
1942 | 1942 | ||
1943 | } | 1943 | } |
1944 | 1944 | ||
1945 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 1945 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
1946 | { | 1946 | { |
1947 | updateUnmanagedViews(); | 1947 | updateUnmanagedViews(); |
1948 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 1948 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
1949 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 1949 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
1950 | mCalendar->checkAlarmForIncidence( 0, true ); | 1950 | mCalendar->checkAlarmForIncidence( 0, true ); |
1951 | if ( mEventViewerDialog ) | 1951 | if ( mEventViewerDialog ) |
1952 | mEventViewerDialog->hide(); | 1952 | mEventViewerDialog->hide(); |
1953 | } | 1953 | } |
1954 | else | 1954 | else |
1955 | mCalendar->checkAlarmForIncidence( which , false ); | 1955 | mCalendar->checkAlarmForIncidence( which , false ); |
1956 | } | 1956 | } |
1957 | 1957 | ||
1958 | // most of the changeEventDisplays() right now just call the view's | 1958 | // most of the changeEventDisplays() right now just call the view's |
1959 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 1959 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
1960 | void CalendarView::changeEventDisplay(Event *which, int action) | 1960 | void CalendarView::changeEventDisplay(Event *which, int action) |
1961 | { | 1961 | { |
1962 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 1962 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
1963 | changeIncidenceDisplay((Incidence *)which, action); | 1963 | changeIncidenceDisplay((Incidence *)which, action); |
1964 | mDateNavigator->updateView(); | 1964 | mDateNavigator->updateView(); |
1965 | //mDialogManager->updateSearchDialog(); | 1965 | //mDialogManager->updateSearchDialog(); |
1966 | 1966 | ||
1967 | if (which) { | 1967 | if (which) { |
1968 | // If there is an event view visible update the display | 1968 | // If there is an event view visible update the display |
1969 | mViewManager->currentView()->changeEventDisplay(which,action); | 1969 | mViewManager->currentView()->changeEventDisplay(which,action); |
1970 | // TODO: check, if update needed | 1970 | // TODO: check, if update needed |
1971 | // if (which->getTodoStatus()) { | 1971 | // if (which->getTodoStatus()) { |
1972 | mTodoList->updateView(); | 1972 | mTodoList->updateView(); |
1973 | // } | 1973 | // } |
1974 | } else { | 1974 | } else { |
1975 | mViewManager->currentView()->updateView(); | 1975 | mViewManager->currentView()->updateView(); |
1976 | } | 1976 | } |
1977 | } | 1977 | } |
1978 | 1978 | ||
1979 | 1979 | ||
1980 | void CalendarView::updateTodoViews() | 1980 | void CalendarView::updateTodoViews() |
1981 | { | 1981 | { |
1982 | 1982 | ||
1983 | mTodoList->updateView(); | 1983 | mTodoList->updateView(); |
1984 | mViewManager->currentView()->updateView(); | 1984 | mViewManager->currentView()->updateView(); |
1985 | 1985 | ||
1986 | } | 1986 | } |
1987 | 1987 | ||
1988 | 1988 | ||
1989 | void CalendarView::updateView(const QDate &start, const QDate &end) | 1989 | void CalendarView::updateView(const QDate &start, const QDate &end) |
1990 | { | 1990 | { |
1991 | mTodoList->updateView(); | 1991 | mTodoList->updateView(); |
1992 | mViewManager->updateView(start, end); | 1992 | mViewManager->updateView(start, end); |
1993 | //mDateNavigator->updateView(); | 1993 | //mDateNavigator->updateView(); |
1994 | } | 1994 | } |
1995 | 1995 | ||
1996 | void CalendarView::updateView() | 1996 | void CalendarView::updateView() |
1997 | { | 1997 | { |
1998 | DateList tmpList = mNavigator->selectedDates(); | 1998 | DateList tmpList = mNavigator->selectedDates(); |
1999 | 1999 | ||
2000 | // We assume that the navigator only selects consecutive days. | 2000 | // We assume that the navigator only selects consecutive days. |
2001 | updateView( tmpList.first(), tmpList.last() ); | 2001 | updateView( tmpList.first(), tmpList.last() ); |
2002 | } | 2002 | } |
2003 | 2003 | ||
2004 | void CalendarView::updateUnmanagedViews() | 2004 | void CalendarView::updateUnmanagedViews() |
2005 | { | 2005 | { |
2006 | mDateNavigator->updateDayMatrix(); | 2006 | mDateNavigator->updateDayMatrix(); |
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | int CalendarView::msgItemDelete() | 2009 | int CalendarView::msgItemDelete() |
2010 | { | 2010 | { |
2011 | return KMessageBox::warningContinueCancel(this, | 2011 | return KMessageBox::warningContinueCancel(this, |
2012 | i18n("This item will be\npermanently deleted."), | 2012 | i18n("This item will be\npermanently deleted."), |
2013 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2013 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2014 | } | 2014 | } |
2015 | 2015 | ||
2016 | 2016 | ||
2017 | void CalendarView::edit_cut() | 2017 | void CalendarView::edit_cut() |
2018 | { | 2018 | { |
2019 | Event *anEvent=0; | 2019 | Event *anEvent=0; |
2020 | 2020 | ||
2021 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2021 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2022 | 2022 | ||
2023 | if (mViewManager->currentView()->isEventView()) { | 2023 | if (mViewManager->currentView()->isEventView()) { |
2024 | if ( incidence && incidence->type() == "Event" ) { | 2024 | if ( incidence && incidence->type() == "Event" ) { |
2025 | anEvent = static_cast<Event *>(incidence); | 2025 | anEvent = static_cast<Event *>(incidence); |
2026 | } | 2026 | } |
2027 | } | 2027 | } |
2028 | 2028 | ||
2029 | if (!anEvent) { | 2029 | if (!anEvent) { |
2030 | KNotifyClient::beep(); | 2030 | KNotifyClient::beep(); |
2031 | return; | 2031 | return; |
2032 | } | 2032 | } |
2033 | DndFactory factory( mCalendar ); | 2033 | DndFactory factory( mCalendar ); |
2034 | factory.cutEvent(anEvent); | 2034 | factory.cutEvent(anEvent); |
2035 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2035 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2036 | } | 2036 | } |
2037 | 2037 | ||
2038 | void CalendarView::edit_copy() | 2038 | void CalendarView::edit_copy() |
2039 | { | 2039 | { |
2040 | Event *anEvent=0; | 2040 | Event *anEvent=0; |
2041 | 2041 | ||
2042 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2042 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2043 | 2043 | ||
2044 | if (mViewManager->currentView()->isEventView()) { | 2044 | if (mViewManager->currentView()->isEventView()) { |
2045 | if ( incidence && incidence->type() == "Event" ) { | 2045 | if ( incidence && incidence->type() == "Event" ) { |
2046 | anEvent = static_cast<Event *>(incidence); | 2046 | anEvent = static_cast<Event *>(incidence); |
2047 | } | 2047 | } |
2048 | } | 2048 | } |
2049 | 2049 | ||
2050 | if (!anEvent) { | 2050 | if (!anEvent) { |
2051 | KNotifyClient::beep(); | 2051 | KNotifyClient::beep(); |
2052 | return; | 2052 | return; |
2053 | } | 2053 | } |
2054 | DndFactory factory( mCalendar ); | 2054 | DndFactory factory( mCalendar ); |
2055 | factory.copyEvent(anEvent); | 2055 | factory.copyEvent(anEvent); |
2056 | } | 2056 | } |
2057 | 2057 | ||
2058 | void CalendarView::edit_paste() | 2058 | void CalendarView::edit_paste() |
2059 | { | 2059 | { |
2060 | QDate date = mNavigator->selectedDates().first(); | 2060 | QDate date = mNavigator->selectedDates().first(); |
2061 | 2061 | ||
2062 | DndFactory factory( mCalendar ); | 2062 | DndFactory factory( mCalendar ); |
2063 | Event *pastedEvent = factory.pasteEvent( date ); | 2063 | Event *pastedEvent = factory.pasteEvent( date ); |
2064 | 2064 | ||
2065 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2065 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2066 | } | 2066 | } |
2067 | 2067 | ||
2068 | void CalendarView::edit_options() | 2068 | void CalendarView::edit_options() |
2069 | { | 2069 | { |
2070 | mDialogManager->showOptionsDialog(); | 2070 | mDialogManager->showOptionsDialog(); |
2071 | //writeSettings(); | 2071 | //writeSettings(); |
2072 | } | 2072 | } |
2073 | void CalendarView::edit_sync_options() | 2073 | void CalendarView::edit_sync_options() |
2074 | { | 2074 | { |
2075 | //mDialogManager->showSyncOptions(); | 2075 | //mDialogManager->showSyncOptions(); |
2076 | //KOPrefs::instance()->mSyncAlgoPrefs | 2076 | //KOPrefs::instance()->mSyncAlgoPrefs |
2077 | QDialog dia( this, "dia", true ); | 2077 | QDialog dia( this, "dia", true ); |
2078 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 2078 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
2079 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 2079 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
2080 | QVBoxLayout lay ( &dia ); | 2080 | QVBoxLayout lay ( &dia ); |
2081 | lay.setSpacing( 2 ); | 2081 | lay.setSpacing( 2 ); |
2082 | lay.setMargin( 3 ); | 2082 | lay.setMargin( 3 ); |
2083 | lay.addWidget(&gr); | 2083 | lay.addWidget(&gr); |
2084 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); | 2084 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); |
2085 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); | 2085 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); |
2086 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); | 2086 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); |
2087 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); | 2087 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); |
2088 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); | 2088 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); |
2089 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); | 2089 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); |
2090 | //QRadioButton both( i18n("Take both on conflict"), &gr ); | 2090 | //QRadioButton both( i18n("Take both on conflict"), &gr ); |
2091 | QPushButton pb ( "OK", &dia); | 2091 | QPushButton pb ( "OK", &dia); |
2092 | lay.addWidget( &pb ); | 2092 | lay.addWidget( &pb ); |
2093 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 2093 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
2094 | switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { | 2094 | switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { |
2095 | case 0: | 2095 | case 0: |
2096 | loc.setChecked( true); | 2096 | loc.setChecked( true); |
2097 | break; | 2097 | break; |
2098 | case 1: | 2098 | case 1: |
2099 | rem.setChecked( true ); | 2099 | rem.setChecked( true ); |
2100 | break; | 2100 | break; |
2101 | case 2: | 2101 | case 2: |
2102 | newest.setChecked( true); | 2102 | newest.setChecked( true); |
2103 | break; | 2103 | break; |
2104 | case 3: | 2104 | case 3: |
2105 | ask.setChecked( true); | 2105 | ask.setChecked( true); |
2106 | break; | 2106 | break; |
2107 | case 4: | 2107 | case 4: |
2108 | f_loc.setChecked( true); | 2108 | f_loc.setChecked( true); |
2109 | break; | 2109 | break; |
2110 | case 5: | 2110 | case 5: |
2111 | f_rem.setChecked( true); | 2111 | f_rem.setChecked( true); |
2112 | break; | 2112 | break; |
2113 | case 6: | 2113 | case 6: |
2114 | // both.setChecked( true); | 2114 | // both.setChecked( true); |
2115 | break; | 2115 | break; |
2116 | default: | 2116 | default: |
2117 | break; | 2117 | break; |
2118 | } | 2118 | } |
2119 | if ( dia.exec() ) { | 2119 | if ( dia.exec() ) { |
2120 | KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 2120 | KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | } | 2123 | } |
2124 | 2124 | ||
2125 | void CalendarView::slotSelectPickerDate( QDate d) | 2125 | void CalendarView::slotSelectPickerDate( QDate d) |
2126 | { | 2126 | { |
2127 | mDateFrame->hide(); | 2127 | mDateFrame->hide(); |
2128 | if ( mDatePickerMode == 1 ) { | 2128 | if ( mDatePickerMode == 1 ) { |
2129 | mNavigator->slotDaySelect( d ); | 2129 | mNavigator->slotDaySelect( d ); |
2130 | } else if ( mDatePickerMode == 2 ) { | 2130 | } else if ( mDatePickerMode == 2 ) { |
2131 | if ( mMoveIncidence->type() == "Todo" ) { | 2131 | if ( mMoveIncidence->type() == "Todo" ) { |
2132 | Todo * to = (Todo *) mMoveIncidence; | 2132 | Todo * to = (Todo *) mMoveIncidence; |
2133 | QTime tim; | 2133 | QTime tim; |
2134 | if ( to->hasDueDate() ) | 2134 | if ( to->hasDueDate() ) |
2135 | tim = to->dtDue().time(); | 2135 | tim = to->dtDue().time(); |
2136 | else { | 2136 | else { |
2137 | tim = QTime ( 0,0,0 ); | 2137 | tim = QTime ( 0,0,0 ); |
2138 | to->setFloats( true ); | 2138 | to->setFloats( true ); |
2139 | to->setHasDueDate( true ); | 2139 | to->setHasDueDate( true ); |
2140 | } | 2140 | } |
2141 | QDateTime dt ( d,tim ); | 2141 | QDateTime dt ( d,tim ); |
2142 | to->setDtDue( dt ); | 2142 | to->setDtDue( dt ); |
2143 | todoChanged( to ); | 2143 | todoChanged( to ); |
2144 | } else { | 2144 | } else { |
2145 | QTime tim = mMoveIncidence->dtStart().time(); | 2145 | QTime tim = mMoveIncidence->dtStart().time(); |
2146 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2146 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2147 | QDateTime dt ( d,tim ); | 2147 | QDateTime dt ( d,tim ); |
2148 | mMoveIncidence->setDtStart( dt ); | 2148 | mMoveIncidence->setDtStart( dt ); |
2149 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2149 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2150 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2150 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2151 | } | 2151 | } |
2152 | 2152 | ||
2153 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2153 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2154 | } | 2154 | } |
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | void CalendarView::removeCategories() | 2157 | void CalendarView::removeCategories() |
2158 | { | 2158 | { |
2159 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2159 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2160 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2160 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2161 | QStringList catIncList; | 2161 | QStringList catIncList; |
2162 | QStringList newCatList; | 2162 | QStringList newCatList; |
2163 | Incidence* inc = incList.first(); | 2163 | Incidence* inc = incList.first(); |
2164 | int i; | 2164 | int i; |
2165 | int count = 0; | 2165 | int count = 0; |
2166 | while ( inc ) { | 2166 | while ( inc ) { |
2167 | newCatList.clear(); | 2167 | newCatList.clear(); |
2168 | catIncList = inc->categories() ; | 2168 | catIncList = inc->categories() ; |
2169 | for( i = 0; i< catIncList.count(); ++i ) { | 2169 | for( i = 0; i< catIncList.count(); ++i ) { |
2170 | if ( catList.contains (catIncList[i])) | 2170 | if ( catList.contains (catIncList[i])) |
2171 | newCatList.append( catIncList[i] ); | 2171 | newCatList.append( catIncList[i] ); |
2172 | } | 2172 | } |
2173 | newCatList.sort(); | 2173 | newCatList.sort(); |
2174 | inc->setCategories( newCatList.join(",") ); | 2174 | inc->setCategories( newCatList.join(",") ); |
2175 | inc = incList.next(); | 2175 | inc = incList.next(); |
2176 | } | 2176 | } |
2177 | } | 2177 | } |
2178 | 2178 | ||
2179 | int CalendarView::addCategories() | 2179 | int CalendarView::addCategories() |
2180 | { | 2180 | { |
2181 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2181 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2182 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2182 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2183 | QStringList catIncList; | 2183 | QStringList catIncList; |
2184 | Incidence* inc = incList.first(); | 2184 | Incidence* inc = incList.first(); |
2185 | int i; | 2185 | int i; |
2186 | int count = 0; | 2186 | int count = 0; |
2187 | while ( inc ) { | 2187 | while ( inc ) { |
2188 | catIncList = inc->categories() ; | 2188 | catIncList = inc->categories() ; |
2189 | for( i = 0; i< catIncList.count(); ++i ) { | 2189 | for( i = 0; i< catIncList.count(); ++i ) { |
2190 | if ( !catList.contains (catIncList[i])) { | 2190 | if ( !catList.contains (catIncList[i])) { |
2191 | catList.append( catIncList[i] ); | 2191 | catList.append( catIncList[i] ); |
2192 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2192 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2193 | ++count; | 2193 | ++count; |
2194 | } | 2194 | } |
2195 | } | 2195 | } |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index fc2bc77..ba77b45 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,481 +1,487 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include "calendarview.h" | 35 | #include "calendarview.h" |
36 | #include "datenavigator.h" | 36 | #include "datenavigator.h" |
37 | #include "kotodoview.h" | 37 | #include "kotodoview.h" |
38 | #include "koagendaview.h" | 38 | #include "koagendaview.h" |
39 | #include "kodialogmanager.h" | 39 | #include "kodialogmanager.h" |
40 | #include "komonthview.h" | 40 | #include "komonthview.h" |
41 | #include "kolistview.h" | 41 | #include "kolistview.h" |
42 | #include "kowhatsnextview.h" | 42 | #include "kowhatsnextview.h" |
43 | #include "kojournalview.h" | 43 | #include "kojournalview.h" |
44 | #include "kotimespanview.h" | 44 | #include "kotimespanview.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "navigatorbar.h" | 46 | #include "navigatorbar.h" |
47 | 47 | ||
48 | #include "koviewmanager.h" | 48 | #include "koviewmanager.h" |
49 | //extern bool externFlagMonthviewBlockPainting; | 49 | //extern bool externFlagMonthviewBlockPainting; |
50 | 50 | ||
51 | //bool globalFlagBlockPainting = false; | 51 | //bool globalFlagBlockPainting = false; |
52 | int globalFlagBlockAgenda = 0; | 52 | int globalFlagBlockAgenda = 0; |
53 | int globalFlagBlockLabel = 0; | 53 | int globalFlagBlockLabel = 0; |
54 | int globalFlagBlockAgendaItemPaint = 1; | 54 | int globalFlagBlockAgendaItemPaint = 1; |
55 | int globalFlagBlockAgendaItemUpdate = 1; | 55 | int globalFlagBlockAgendaItemUpdate = 1; |
56 | 56 | ||
57 | 57 | ||
58 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 58 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
59 | QObject(), mMainView( mainView ) | 59 | QObject(), mMainView( mainView ) |
60 | { | 60 | { |
61 | mCurrentView = 0; | 61 | mCurrentView = 0; |
62 | 62 | ||
63 | mWhatsNextView = 0; | 63 | mWhatsNextView = 0; |
64 | mTodoView = 0; | 64 | mTodoView = 0; |
65 | mAgendaView = 0; | 65 | mAgendaView = 0; |
66 | mMonthView = 0; | 66 | mMonthView = 0; |
67 | mListView = 0; | 67 | mListView = 0; |
68 | mJournalView = 0; | 68 | mJournalView = 0; |
69 | mTimeSpanView = 0; | 69 | mTimeSpanView = 0; |
70 | mCurrentAgendaView = 0 ; | 70 | mCurrentAgendaView = 0 ; |
71 | mFlagShowNextxDays = false; | 71 | mFlagShowNextxDays = false; |
72 | } | 72 | } |
73 | 73 | ||
74 | KOViewManager::~KOViewManager() | 74 | KOViewManager::~KOViewManager() |
75 | { | 75 | { |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | KOrg::BaseView *KOViewManager::currentView() | 79 | KOrg::BaseView *KOViewManager::currentView() |
80 | { | 80 | { |
81 | return mCurrentView; | 81 | return mCurrentView; |
82 | } | 82 | } |
83 | 83 | ||
84 | void KOViewManager::readSettings(KConfig *config) | 84 | void KOViewManager::readSettings(KConfig *config) |
85 | { | 85 | { |
86 | config->setGroup("General"); | 86 | config->setGroup("General"); |
87 | QString view = config->readEntry("Current View"); | 87 | QString view = config->readEntry("Current View"); |
88 | if (view == "WhatsNext") showWhatsNextView(); | 88 | if (view == "WhatsNext") showWhatsNextView(); |
89 | else if (view == "Month") showMonthView(); | 89 | else if (view == "Month") showMonthView(); |
90 | else if (view == "List") showListView(); | 90 | else if (view == "List") showListView(); |
91 | else if (view == "Journal") showJournalView(); | 91 | else if (view == "Journal") showJournalView(); |
92 | else if (view == "TimeSpan") showTimeSpanView(); | 92 | else if (view == "TimeSpan") showTimeSpanView(); |
93 | else if (view == "Todo") showTodoView(); | 93 | else if (view == "Todo") showTodoView(); |
94 | else { | 94 | else { |
95 | showAgendaView(); | 95 | showAgendaView(); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | void KOViewManager::writeSettings(KConfig *config) | 99 | void KOViewManager::writeSettings(KConfig *config) |
100 | { | 100 | { |
101 | config->setGroup("General"); | 101 | config->setGroup("General"); |
102 | 102 | ||
103 | QString view; | 103 | QString view; |
104 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 104 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
105 | else if (mCurrentView == mMonthView) view = "Month"; | 105 | else if (mCurrentView == mMonthView) view = "Month"; |
106 | else if (mCurrentView == mListView) view = "List"; | 106 | else if (mCurrentView == mListView) view = "List"; |
107 | else if (mCurrentView == mJournalView) view = "Journal"; | 107 | else if (mCurrentView == mJournalView) view = "Journal"; |
108 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 108 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
109 | else if (mCurrentView == mTodoView) view = "Todo"; | 109 | else if (mCurrentView == mTodoView) view = "Todo"; |
110 | else view = "Agenda"; | 110 | else view = "Agenda"; |
111 | 111 | ||
112 | config->writeEntry("Current View",view); | 112 | config->writeEntry("Current View",view); |
113 | 113 | ||
114 | if (mAgendaView) { | 114 | if (mAgendaView) { |
115 | mAgendaView->writeSettings(config); | 115 | mAgendaView->writeSettings(config); |
116 | } | 116 | } |
117 | if (mTimeSpanView) { | 117 | if (mTimeSpanView) { |
118 | mTimeSpanView->writeSettings(config); | 118 | mTimeSpanView->writeSettings(config); |
119 | } | 119 | } |
120 | if (mListView) { | 120 | if (mListView) { |
121 | mListView->writeSettings(config); | 121 | mListView->writeSettings(config); |
122 | } | 122 | } |
123 | if (mTodoView) { | 123 | if (mTodoView) { |
124 | mTodoView->saveLayout(config,"Todo View"); | 124 | mTodoView->saveLayout(config,"Todo View"); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 128 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
129 | { | 129 | { |
130 | 130 | ||
131 | //mFlagShowNextxDays = false; | 131 | //mFlagShowNextxDays = false; |
132 | //if(view == mCurrentView) return; | 132 | //if(view == mCurrentView) return; |
133 | if ( view == 0 ) { | 133 | if ( view == 0 ) { |
134 | view = mCurrentView; | 134 | view = mCurrentView; |
135 | if ( view == 0 ) | 135 | if ( view == 0 ) |
136 | return; | 136 | return; |
137 | } | 137 | } |
138 | bool full = fullScreen; | 138 | bool full = fullScreen; |
139 | if(view == mCurrentView && view != mWhatsNextView ) { | 139 | if(view == mCurrentView && view != mWhatsNextView ) { |
140 | if ( mCurrentAgendaView < 0 ) | 140 | if ( mCurrentAgendaView < 0 ) |
141 | return; | 141 | return; |
142 | full = mMainView->leftFrame()->isVisible(); | 142 | full = mMainView->leftFrame()->isVisible(); |
143 | } else { | 143 | } else { |
144 | mCurrentView = view; | 144 | mCurrentView = view; |
145 | 145 | ||
146 | // bool full = fullScreen; | 146 | // bool full = fullScreen; |
147 | bool isFull = !mMainView->leftFrame()->isVisible(); | 147 | bool isFull = !mMainView->leftFrame()->isVisible(); |
148 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 148 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
149 | full = true; | 149 | full = true; |
150 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 150 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
151 | full = false; | 151 | full = false; |
152 | } | 152 | } |
153 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 153 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
154 | raiseCurrentView( full ); | 154 | raiseCurrentView( full ); |
155 | mMainView->processIncidenceSelection( 0 ); | 155 | mMainView->processIncidenceSelection( 0 ); |
156 | mMainView->updateView(); | 156 | mMainView->updateView(); |
157 | mMainView->adaptNavigationUnits(); | 157 | mMainView->adaptNavigationUnits(); |
158 | } | 158 | } |
159 | 159 | ||
160 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 160 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
161 | { | 161 | { |
162 | //qDebug("raiseCurrentView "); | 162 | //qDebug("raiseCurrentView "); |
163 | mCurrentAgendaView = 0; | 163 | mCurrentAgendaView = 0; |
164 | int wid = mMainView->width() ; | 164 | int wid = mMainView->width() ; |
165 | int hei = mMainView->height(); | 165 | int hei = mMainView->height(); |
166 | if ( mCurrentView == mMonthView ) { | 166 | if ( mCurrentView == mMonthView ) { |
167 | mMainView->navigatorBar()->show(); | 167 | mMainView->navigatorBar()->show(); |
168 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 168 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
169 | //mMainView->navigatorBar()->hide(); | 169 | //mMainView->navigatorBar()->hide(); |
170 | } else { | 170 | } else { |
171 | mMainView->navigatorBar()->hide(); | 171 | mMainView->navigatorBar()->hide(); |
172 | } | 172 | } |
173 | if ( fullScreen ) { | 173 | if ( fullScreen ) { |
174 | mMainView->leftFrame()->hide(); | 174 | mMainView->leftFrame()->hide(); |
175 | } else { | 175 | } else { |
176 | mMainView->leftFrame()->show(); | 176 | mMainView->leftFrame()->show(); |
177 | if ( KOPrefs::instance()->mVerticalScreen ) | 177 | if ( KOPrefs::instance()->mVerticalScreen ) |
178 | hei -= mMainView->leftFrame()->height(); | 178 | hei -= mMainView->leftFrame()->height(); |
179 | else | 179 | else |
180 | wid -= mMainView->leftFrame()->width(); | 180 | wid -= mMainView->leftFrame()->width(); |
181 | } | 181 | } |
182 | 182 | ||
183 | if ( globalFlagBlockAgenda == 5 ) { | 183 | if ( globalFlagBlockAgenda == 5 ) { |
184 | globalFlagBlockAgenda = 4; | 184 | globalFlagBlockAgenda = 4; |
185 | globalFlagBlockAgendaItemPaint = 1; | 185 | globalFlagBlockAgendaItemPaint = 1; |
186 | } | 186 | } |
187 | mMainView->viewStack()->raiseWidget(mCurrentView); | 187 | mMainView->viewStack()->raiseWidget(mCurrentView); |
188 | if ( globalFlagBlockAgenda == 4 ) { | 188 | if ( globalFlagBlockAgenda == 4 ) { |
189 | if ( mCurrentView == mAgendaView ) { | 189 | if ( mCurrentView == mAgendaView ) { |
190 | //globalFlagBlockAgenda =1 ; | 190 | //globalFlagBlockAgenda =1 ; |
191 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 191 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
192 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 192 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
193 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 193 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
194 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 194 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
195 | qApp->processEvents(); | 195 | qApp->processEvents(); |
196 | //qDebug("qApp->processEvents() "); | 196 | //qDebug("qApp->processEvents() "); |
197 | globalFlagBlockAgenda = 0; | 197 | globalFlagBlockAgenda = 0; |
198 | mAgendaView->repaintAgenda(); | 198 | mAgendaView->repaintAgenda(); |
199 | 199 | ||
200 | } | 200 | } |
201 | globalFlagBlockAgenda = 0; | 201 | globalFlagBlockAgenda = 0; |
202 | } | 202 | } |
203 | //qDebug("raiseCurrentView ende "); | 203 | //qDebug("raiseCurrentView ende "); |
204 | } | 204 | } |
205 | 205 | ||
206 | void KOViewManager::updateView() | 206 | void KOViewManager::updateView() |
207 | { | 207 | { |
208 | // qDebug("KOViewManager::updateView() "); | 208 | // qDebug("KOViewManager::updateView() "); |
209 | // if we are updating mTodoView, we get endless recursion | 209 | // if we are updating mTodoView, we get endless recursion |
210 | if ( mTodoView == mCurrentView ) | 210 | if ( mTodoView == mCurrentView ) |
211 | return; | 211 | return; |
212 | if ( mCurrentView ) mCurrentView->updateView(); | 212 | if ( mCurrentView ) mCurrentView->updateView(); |
213 | 213 | ||
214 | } | 214 | } |
215 | 215 | ||
216 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 216 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
217 | { | 217 | { |
218 | // kdDebug() << "KOViewManager::updateView()" << endl; | 218 | // kdDebug() << "KOViewManager::updateView()" << endl; |
219 | 219 | ||
220 | if (mCurrentView) mCurrentView->showDates(start, end); | 220 | if (mCurrentView) mCurrentView->showDates(start, end); |
221 | 221 | ||
222 | if (mTodoView) mTodoView->updateView(); | 222 | if (mTodoView) mTodoView->updateView(); |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | void KOViewManager::updateWNview() | ||
227 | { | ||
228 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | ||
229 | mWhatsNextView->updateView(); | ||
230 | |||
231 | } | ||
226 | void KOViewManager::showWhatsNextView() | 232 | void KOViewManager::showWhatsNextView() |
227 | { | 233 | { |
228 | if (!mWhatsNextView) { | 234 | if (!mWhatsNextView) { |
229 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 235 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
230 | "KOViewManager::WhatsNextView"); | 236 | "KOViewManager::WhatsNextView"); |
231 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 237 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
232 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 238 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
233 | addView(mWhatsNextView); | 239 | addView(mWhatsNextView); |
234 | } | 240 | } |
235 | globalFlagBlockAgenda = 1; | 241 | globalFlagBlockAgenda = 1; |
236 | showView(mWhatsNextView, true ); | 242 | showView(mWhatsNextView, true ); |
237 | mWhatsNextView->updateView(); | 243 | mWhatsNextView->updateView(); |
238 | 244 | ||
239 | } | 245 | } |
240 | 246 | ||
241 | void KOViewManager::showListView() | 247 | void KOViewManager::showListView() |
242 | { | 248 | { |
243 | if (!mListView) { | 249 | if (!mListView) { |
244 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 250 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
245 | addView(mListView); | 251 | addView(mListView); |
246 | 252 | ||
247 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 253 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
248 | mMainView, SLOT(showIncidence(Incidence *))); | 254 | mMainView, SLOT(showIncidence(Incidence *))); |
249 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 255 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
250 | mMainView, SLOT(editIncidence(Incidence *))); | 256 | mMainView, SLOT(editIncidence(Incidence *))); |
251 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 257 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
252 | mMainView, SLOT(deleteIncidence(Incidence *))); | 258 | mMainView, SLOT(deleteIncidence(Incidence *))); |
253 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 259 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
254 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 260 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
255 | connect( mListView, SIGNAL( signalNewEvent() ), | 261 | connect( mListView, SIGNAL( signalNewEvent() ), |
256 | mMainView, SLOT( newEvent() ) ); | 262 | mMainView, SLOT( newEvent() ) ); |
257 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 263 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
258 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 264 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
259 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 265 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
260 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 266 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
261 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 267 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
262 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 268 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
263 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 269 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
264 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 270 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
265 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 271 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
266 | } | 272 | } |
267 | // bool temp = mFlagShowNextxDays; | 273 | // bool temp = mFlagShowNextxDays; |
268 | //globalFlagBlockPainting = true; | 274 | //globalFlagBlockPainting = true; |
269 | globalFlagBlockAgenda = 1; | 275 | globalFlagBlockAgenda = 1; |
270 | if ( KOPrefs::instance()->mListViewMonthTimespan ) | 276 | if ( KOPrefs::instance()->mListViewMonthTimespan ) |
271 | mMainView->dateNavigator()->selectMonth(); | 277 | mMainView->dateNavigator()->selectMonth(); |
272 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 278 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
273 | //mFlagShowNextxDays = temp; | 279 | //mFlagShowNextxDays = temp; |
274 | } | 280 | } |
275 | 281 | ||
276 | void KOViewManager::showAgendaView( bool fullScreen ) | 282 | void KOViewManager::showAgendaView( bool fullScreen ) |
277 | { | 283 | { |
278 | 284 | ||
279 | mMainView->dialogManager()->hideSearchDialog(); | 285 | mMainView->dialogManager()->hideSearchDialog(); |
280 | // qDebug("KOViewManager::showAgendaView "); | 286 | // qDebug("KOViewManager::showAgendaView "); |
281 | bool full; | 287 | bool full; |
282 | full = fullScreen; | 288 | full = fullScreen; |
283 | if (!mAgendaView) { | 289 | if (!mAgendaView) { |
284 | full = false; | 290 | full = false; |
285 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 291 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
286 | addView(mAgendaView); | 292 | addView(mAgendaView); |
287 | #ifndef DESKTOP_VERSION | 293 | #ifndef DESKTOP_VERSION |
288 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 294 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
289 | #endif | 295 | #endif |
290 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 296 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
291 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 297 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
292 | 298 | ||
293 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 299 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
294 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 300 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
295 | mMainView, SLOT(newEvent(QDateTime))); | 301 | mMainView, SLOT(newEvent(QDateTime))); |
296 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 302 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
297 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 303 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
298 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 304 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
299 | mMainView, SLOT(newEvent(QDate))); | 305 | mMainView, SLOT(newEvent(QDate))); |
300 | 306 | ||
301 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 307 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
302 | mMainView, SLOT(editIncidence(Incidence *))); | 308 | mMainView, SLOT(editIncidence(Incidence *))); |
303 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 309 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
304 | mMainView, SLOT(showIncidence(Incidence *))); | 310 | mMainView, SLOT(showIncidence(Incidence *))); |
305 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 311 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
306 | mMainView, SLOT(deleteIncidence(Incidence *))); | 312 | mMainView, SLOT(deleteIncidence(Incidence *))); |
307 | 313 | ||
308 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 314 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
309 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
310 | 316 | ||
311 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 317 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
312 | mMainView, SLOT( toggleExpand() ) ); | 318 | mMainView, SLOT( toggleExpand() ) ); |
313 | 319 | ||
314 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 320 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
315 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 321 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
316 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 322 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
317 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 323 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
318 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 324 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
319 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 325 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
320 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 326 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
321 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 327 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
322 | SLOT( updateTodo( Todo *, int ) ) ); | 328 | SLOT( updateTodo( Todo *, int ) ) ); |
323 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 329 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
324 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 330 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
325 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 331 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
326 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 332 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
327 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 333 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
328 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
329 | mAgendaView->readSettings(); | 335 | mAgendaView->readSettings(); |
330 | mAgendaView->updateConfig(); | 336 | mAgendaView->updateConfig(); |
331 | } | 337 | } |
332 | 338 | ||
333 | showView( mAgendaView, full); | 339 | showView( mAgendaView, full); |
334 | 340 | ||
335 | } | 341 | } |
336 | 342 | ||
337 | void KOViewManager::showDayView() | 343 | void KOViewManager::showDayView() |
338 | { | 344 | { |
339 | mFlagShowNextxDays = false; | 345 | mFlagShowNextxDays = false; |
340 | globalFlagBlockLabel = 1; | 346 | globalFlagBlockLabel = 1; |
341 | globalFlagBlockAgenda = 1; | 347 | globalFlagBlockAgenda = 1; |
342 | if ( mCurrentAgendaView != 1 ) | 348 | if ( mCurrentAgendaView != 1 ) |
343 | mCurrentAgendaView = -1; | 349 | mCurrentAgendaView = -1; |
344 | showAgendaView(); | 350 | showAgendaView(); |
345 | qApp->processEvents(); | 351 | qApp->processEvents(); |
346 | globalFlagBlockAgenda = 2; | 352 | globalFlagBlockAgenda = 2; |
347 | globalFlagBlockLabel = 0; | 353 | globalFlagBlockLabel = 0; |
348 | mMainView->dateNavigator()->selectDates( 1 ); | 354 | mMainView->dateNavigator()->selectDates( 1 ); |
349 | mCurrentAgendaView = 1 ; | 355 | mCurrentAgendaView = 1 ; |
350 | 356 | ||
351 | } | 357 | } |
352 | 358 | ||
353 | void KOViewManager::showWorkWeekView() | 359 | void KOViewManager::showWorkWeekView() |
354 | { | 360 | { |
355 | mFlagShowNextxDays = false; | 361 | mFlagShowNextxDays = false; |
356 | globalFlagBlockAgenda = 1; | 362 | globalFlagBlockAgenda = 1; |
357 | globalFlagBlockLabel = 1; | 363 | globalFlagBlockLabel = 1; |
358 | if ( mCurrentAgendaView != 5 ) | 364 | if ( mCurrentAgendaView != 5 ) |
359 | mCurrentAgendaView = -1; | 365 | mCurrentAgendaView = -1; |
360 | showAgendaView(); | 366 | showAgendaView(); |
361 | qApp->processEvents(); | 367 | qApp->processEvents(); |
362 | globalFlagBlockAgenda = 2; | 368 | globalFlagBlockAgenda = 2; |
363 | globalFlagBlockLabel = 0; | 369 | globalFlagBlockLabel = 0; |
364 | mMainView->dateNavigator()->selectWorkWeek(); | 370 | mMainView->dateNavigator()->selectWorkWeek(); |
365 | mCurrentAgendaView = 5 ; | 371 | mCurrentAgendaView = 5 ; |
366 | 372 | ||
367 | } | 373 | } |
368 | 374 | ||
369 | void KOViewManager::showWeekView() | 375 | void KOViewManager::showWeekView() |
370 | { | 376 | { |
371 | /* | 377 | /* |
372 | globalFlagBlockAgenda = 2; | 378 | globalFlagBlockAgenda = 2; |
373 | qDebug("4globalFlagBlockAgenda = 2; "); | 379 | qDebug("4globalFlagBlockAgenda = 2; "); |
374 | //globalFlagBlockPainting = true; | 380 | //globalFlagBlockPainting = true; |
375 | mMainView->dateNavigator()->selectWeek(); | 381 | mMainView->dateNavigator()->selectWeek(); |
376 | showAgendaView(); | 382 | showAgendaView(); |
377 | */ | 383 | */ |
378 | 384 | ||
379 | 385 | ||
380 | mFlagShowNextxDays = false; | 386 | mFlagShowNextxDays = false; |
381 | globalFlagBlockAgenda = 1; | 387 | globalFlagBlockAgenda = 1; |
382 | globalFlagBlockLabel = 1; | 388 | globalFlagBlockLabel = 1; |
383 | if ( mCurrentAgendaView != 7 ) | 389 | if ( mCurrentAgendaView != 7 ) |
384 | mCurrentAgendaView = -1; | 390 | mCurrentAgendaView = -1; |
385 | showAgendaView(); | 391 | showAgendaView(); |
386 | qApp->processEvents(); | 392 | qApp->processEvents(); |
387 | globalFlagBlockAgenda = 2; | 393 | globalFlagBlockAgenda = 2; |
388 | globalFlagBlockLabel = 0; | 394 | globalFlagBlockLabel = 0; |
389 | mMainView->dateNavigator()->selectWeek(); | 395 | mMainView->dateNavigator()->selectWeek(); |
390 | mCurrentAgendaView = 7 ; | 396 | mCurrentAgendaView = 7 ; |
391 | } | 397 | } |
392 | 398 | ||
393 | void KOViewManager::showNextXView() | 399 | void KOViewManager::showNextXView() |
394 | { | 400 | { |
395 | 401 | ||
396 | globalFlagBlockAgenda = 1; | 402 | globalFlagBlockAgenda = 1; |
397 | if ( mCurrentAgendaView != 3 ) | 403 | if ( mCurrentAgendaView != 3 ) |
398 | mCurrentAgendaView = -1; | 404 | mCurrentAgendaView = -1; |
399 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 405 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
400 | globalFlagBlockAgenda = 2; | 406 | globalFlagBlockAgenda = 2; |
401 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 407 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
402 | KOPrefs::instance()->mNextXDays ); | 408 | KOPrefs::instance()->mNextXDays ); |
403 | mFlagShowNextxDays = true; | 409 | mFlagShowNextxDays = true; |
404 | mCurrentAgendaView = 3 ; | 410 | mCurrentAgendaView = 3 ; |
405 | } | 411 | } |
406 | bool KOViewManager::showsNextDays() | 412 | bool KOViewManager::showsNextDays() |
407 | { | 413 | { |
408 | return mFlagShowNextxDays; | 414 | return mFlagShowNextxDays; |
409 | } | 415 | } |
410 | void KOViewManager::showMonthView() | 416 | void KOViewManager::showMonthView() |
411 | { | 417 | { |
412 | if (!mMonthView) { | 418 | if (!mMonthView) { |
413 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 419 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
414 | 420 | ||
415 | addView(mMonthView); | 421 | addView(mMonthView); |
416 | // mMonthView->show(); | 422 | // mMonthView->show(); |
417 | // SIGNALS/SLOTS FOR MONTH VIEW | 423 | // SIGNALS/SLOTS FOR MONTH VIEW |
418 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 424 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
419 | mMainView, SLOT(newEvent(QDateTime))); | 425 | mMainView, SLOT(newEvent(QDateTime))); |
420 | 426 | ||
421 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 427 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
422 | mMainView, SLOT(showIncidence(Incidence *))); | 428 | mMainView, SLOT(showIncidence(Incidence *))); |
423 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 429 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
424 | mMainView, SLOT(editIncidence(Incidence *))); | 430 | mMainView, SLOT(editIncidence(Incidence *))); |
425 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 431 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
426 | mMainView, SLOT(deleteIncidence(Incidence *))); | 432 | mMainView, SLOT(deleteIncidence(Incidence *))); |
427 | 433 | ||
428 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 434 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
429 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 435 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
430 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 436 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
431 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 437 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
432 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 438 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
433 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 439 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
434 | 440 | ||
435 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 441 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
436 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 442 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
437 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 443 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
438 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 444 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
439 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 445 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
440 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 446 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
441 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 447 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
442 | mMonthView->updateConfig(); | 448 | mMonthView->updateConfig(); |
443 | } | 449 | } |
444 | 450 | ||
445 | globalFlagBlockAgenda = 1; | 451 | globalFlagBlockAgenda = 1; |
446 | //mFlagShowNextxDays = false; | 452 | //mFlagShowNextxDays = false; |
447 | // if(mMonthView == mCurrentView) return; | 453 | // if(mMonthView == mCurrentView) return; |
448 | mMainView->dateNavigator()->selectMonth(); | 454 | mMainView->dateNavigator()->selectMonth(); |
449 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 455 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
450 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 456 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
451 | 457 | ||
452 | showView(mMonthView, true ); | 458 | showView(mMonthView, true ); |
453 | 459 | ||
454 | } | 460 | } |
455 | 461 | ||
456 | void KOViewManager::showTodoView() | 462 | void KOViewManager::showTodoView() |
457 | { | 463 | { |
458 | //mFlagShowNextxDays = false; | 464 | //mFlagShowNextxDays = false; |
459 | if ( !mTodoView ) { | 465 | if ( !mTodoView ) { |
460 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 466 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
461 | "KOViewManager::TodoView" ); | 467 | "KOViewManager::TodoView" ); |
462 | 468 | ||
463 | addView( mTodoView ); | 469 | addView( mTodoView ); |
464 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 470 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
465 | 471 | ||
466 | // SIGNALS/SLOTS FOR TODO VIEW | 472 | // SIGNALS/SLOTS FOR TODO VIEW |
467 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 473 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
468 | mMainView, SLOT( newTodo() ) ); | 474 | mMainView, SLOT( newTodo() ) ); |
469 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 475 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
470 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 476 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
471 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 477 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
472 | mMainView, SLOT( showTodo( Todo * ) ) ); | 478 | mMainView, SLOT( showTodo( Todo * ) ) ); |
473 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 479 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
474 | mMainView, SLOT( editTodo( Todo * ) ) ); | 480 | mMainView, SLOT( editTodo( Todo * ) ) ); |
475 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 481 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
476 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 482 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
477 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 483 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
478 | mMainView, SLOT( purgeCompleted() ) ); | 484 | mMainView, SLOT( purgeCompleted() ) ); |
479 | 485 | ||
480 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 486 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
481 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 487 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index f814c36..26b22be 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,113 +1,113 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 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 KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | 56 | void updateWNview(); | |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView(); | 69 | void updateView(); |
70 | void updateView( const QDate &start, const QDate &end ); | 70 | void updateView( const QDate &start, const QDate &end ); |
71 | 71 | ||
72 | void raiseCurrentView( bool fullScreen = false ); | 72 | void raiseCurrentView( bool fullScreen = false ); |
73 | 73 | ||
74 | void addView(KOrg::BaseView *); | 74 | void addView(KOrg::BaseView *); |
75 | 75 | ||
76 | Incidence *currentSelection(); | 76 | Incidence *currentSelection(); |
77 | QDate currentSelectionDate(); | 77 | QDate currentSelectionDate(); |
78 | 78 | ||
79 | KOAgendaView *agendaView() const { return mAgendaView; } | 79 | KOAgendaView *agendaView() const { return mAgendaView; } |
80 | 80 | ||
81 | public slots: | 81 | public slots: |
82 | void showWhatsNextView(); | 82 | void showWhatsNextView(); |
83 | void showListView(); | 83 | void showListView(); |
84 | void showAgendaView( bool fullScreen = false ); | 84 | void showAgendaView( bool fullScreen = false ); |
85 | void showDayView(); | 85 | void showDayView(); |
86 | void showWorkWeekView(); | 86 | void showWorkWeekView(); |
87 | void showWeekView(); | 87 | void showWeekView(); |
88 | void showNextXView(); | 88 | void showNextXView(); |
89 | void showMonthView(); | 89 | void showMonthView(); |
90 | void showTodoView(); | 90 | void showTodoView(); |
91 | void showJournalView(); | 91 | void showJournalView(); |
92 | void showTimeSpanView(); | 92 | void showTimeSpanView(); |
93 | 93 | ||
94 | private: | 94 | private: |
95 | CalendarView *mMainView; | 95 | CalendarView *mMainView; |
96 | 96 | ||
97 | int mCurrentAgendaView; | 97 | int mCurrentAgendaView; |
98 | KOAgendaView *mAgendaView; | 98 | KOAgendaView *mAgendaView; |
99 | KOListView *mListView; | 99 | KOListView *mListView; |
100 | KOMonthView *mMonthView; | 100 | KOMonthView *mMonthView; |
101 | KOTodoView *mTodoView; | 101 | KOTodoView *mTodoView; |
102 | KOWhatsNextView *mWhatsNextView; | 102 | KOWhatsNextView *mWhatsNextView; |
103 | KOJournalView *mJournalView; | 103 | KOJournalView *mJournalView; |
104 | KOTimeSpanView *mTimeSpanView; | 104 | KOTimeSpanView *mTimeSpanView; |
105 | 105 | ||
106 | KOrg::BaseView *mCurrentView; // currently active event view | 106 | KOrg::BaseView *mCurrentView; // currently active event view |
107 | 107 | ||
108 | int mAgendaViewMode; | 108 | int mAgendaViewMode; |
109 | bool mFlagShowNextxDays; | 109 | bool mFlagShowNextxDays; |
110 | 110 | ||
111 | }; | 111 | }; |
112 | 112 | ||
113 | #endif | 113 | #endif |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index b2001ec..2a8a7c1 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -10,634 +10,651 @@ | |||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
22 | #include <qtextcodec.h> | 22 | #include <qtextcodec.h> |
23 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | 27 | ||
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kiconloader.h> | 31 | #include <kiconloader.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | 35 | ||
36 | #ifndef KORG_NOPRINTER | 36 | #ifndef KORG_NOPRINTER |
37 | #include "calprinter.h" | 37 | #include "calprinter.h" |
38 | #endif | 38 | #endif |
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "koeventviewerdialog.h" | 41 | #include "koeventviewerdialog.h" |
42 | 42 | ||
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | using namespace KOrg; | 44 | using namespace KOrg; |
45 | 45 | ||
46 | void WhatsNextTextBrowser::setSource(const QString& n) | 46 | void WhatsNextTextBrowser::setSource(const QString& n) |
47 | { | 47 | { |
48 | 48 | ||
49 | if (n.startsWith("event:")) { | 49 | if (n.startsWith("event:")) { |
50 | emit showIncidence(n); | 50 | emit showIncidence(n); |
51 | return; | 51 | return; |
52 | } else if (n.startsWith("todo:")) { | 52 | } else if (n.startsWith("todo:")) { |
53 | emit showIncidence(n); | 53 | emit showIncidence(n); |
54 | return; | 54 | return; |
55 | } else { | 55 | } else { |
56 | QTextBrowser::setSource(n); | 56 | QTextBrowser::setSource(n); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | 60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, |
61 | const char *name) | 61 | const char *name) |
62 | : KOrg::BaseView(calendar, parent, name) | 62 | : KOrg::BaseView(calendar, parent, name) |
63 | { | 63 | { |
64 | // mDateLabel = | 64 | // mDateLabel = |
65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); | 65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); |
66 | // mDateLabel->setMargin(2); | 66 | // mDateLabel->setMargin(2); |
67 | // mDateLabel->setAlignment(AlignCenter); | 67 | // mDateLabel->setAlignment(AlignCenter); |
68 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 68 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
69 | mView = new WhatsNextTextBrowser(this); | 69 | mView = new WhatsNextTextBrowser(this); |
70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); | 70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); |
71 | 71 | ||
72 | mEventViewer = 0; | 72 | mEventViewer = 0; |
73 | 73 | ||
74 | QBoxLayout *topLayout = new QVBoxLayout(this); | 74 | QBoxLayout *topLayout = new QVBoxLayout(this); |
75 | // topLayout->addWidget(mDateLabel); | 75 | // topLayout->addWidget(mDateLabel); |
76 | topLayout->addWidget(mView); | 76 | topLayout->addWidget(mView); |
77 | } | 77 | } |
78 | 78 | ||
79 | KOWhatsNextView::~KOWhatsNextView() | 79 | KOWhatsNextView::~KOWhatsNextView() |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
83 | int KOWhatsNextView::maxDatesHint() | 83 | int KOWhatsNextView::maxDatesHint() |
84 | { | 84 | { |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | int KOWhatsNextView::currentDateCount() | 88 | int KOWhatsNextView::currentDateCount() |
89 | { | 89 | { |
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | 92 | ||
93 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 93 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() |
94 | { | 94 | { |
95 | QPtrList<Incidence> eventList; | 95 | QPtrList<Incidence> eventList; |
96 | 96 | ||
97 | return eventList; | 97 | return eventList; |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 101 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
102 | const QDate &td) | 102 | const QDate &td) |
103 | { | 103 | { |
104 | #ifndef KORG_NOPRINTER | 104 | #ifndef KORG_NOPRINTER |
105 | calPrinter->preview(CalPrinter::Day, fd, td); | 105 | calPrinter->preview(CalPrinter::Day, fd, td); |
106 | #endif | 106 | #endif |
107 | } | 107 | } |
108 | void KOWhatsNextView::updateConfig() | 108 | void KOWhatsNextView::updateConfig() |
109 | { | 109 | { |
110 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 110 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
111 | updateView(); | 111 | updateView(); |
112 | 112 | ||
113 | } | 113 | } |
114 | void KOWhatsNextView::updateView() | 114 | void KOWhatsNextView::updateView() |
115 | { | 115 | { |
116 | 116 | ||
117 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 117 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
118 | KIconLoader kil("korganizer"); | 118 | KIconLoader kil("korganizer"); |
119 | QString ipath;// = new QString(); | 119 | QString ipath;// = new QString(); |
120 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 120 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
121 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 121 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
122 | mText = "<table width=\"100%\">\n"; | 122 | mText = "<table width=\"100%\">\n"; |
123 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 123 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
124 | #ifdef DESKTOP_VERSION | 124 | #ifdef DESKTOP_VERSION |
125 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 125 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
126 | #else | 126 | #else |
127 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 127 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
128 | #endif | 128 | #endif |
129 | // mText += "<img src=\""; | 129 | // mText += "<img src=\""; |
130 | // mText += ipath; | 130 | // mText += ipath; |
131 | // mText += "\">"; | 131 | // mText += "\">"; |
132 | mEventDate = QDate::currentDate(); | 132 | mEventDate = QDate::currentDate(); |
133 | #ifdef DESKTOP_VERSION | 133 | #ifdef DESKTOP_VERSION |
134 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 134 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
135 | #else | 135 | #else |
136 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 136 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
137 | #endif | 137 | #endif |
138 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 138 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
139 | int iii; | 139 | int iii; |
140 | mTodos.clear(); | 140 | mTodos.clear(); |
141 | QPtrList<Event> events; | 141 | QPtrList<Event> events; |
142 | QPtrList<Todo> todos = calendar()->todos(); | 142 | QPtrList<Todo> todos = calendar()->todos(); |
143 | Todo * todo; | 143 | Todo * todo; |
144 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 144 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
145 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 145 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
146 | bool itemAdded = false; | 146 | bool itemAdded = false; |
147 | for ( iii = 0; iii < daysToShow; ++iii ) { | 147 | for ( iii = 0; iii < daysToShow; ++iii ) { |
148 | QString date; | 148 | QString date; |
149 | itemAdded = false; | 149 | itemAdded = false; |
150 | events = calendar()->events( mEventDate, true ); | 150 | events = calendar()->events( mEventDate, true ); |
151 | 151 | ||
152 | if ( iii == 0 ) { // today !!! | 152 | if ( iii == 0 ) { // today !!! |
153 | todo = todos.first(); | 153 | todo = todos.first(); |
154 | while(todo) { | 154 | while(todo) { |
155 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 155 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
156 | if ( ! itemAdded ) { | 156 | if ( ! itemAdded ) { |
157 | appendDay ( iii, mEventDate ); | 157 | appendDay ( iii, mEventDate ); |
158 | itemAdded = true; | 158 | itemAdded = true; |
159 | 159 | ||
160 | } | 160 | } |
161 | appendEvent(todo); | 161 | appendEvent(todo); |
162 | } | 162 | } |
163 | todo = todos.next(); | 163 | todo = todos.next(); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | if (events.count() > 0) { | 168 | if (events.count() > 0) { |
169 | // mText += "<p></p>"; | 169 | // mText += "<p></p>"; |
170 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 170 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
171 | // mText += "<h2>"; | 171 | // mText += "<h2>"; |
172 | //mText += " <img src=\""; | 172 | //mText += " <img src=\""; |
173 | //mText += ipath; | 173 | //mText += ipath; |
174 | //mText += "\">"; | 174 | //mText += "\">"; |
175 | if ( ! itemAdded ) { | 175 | if ( ! itemAdded ) { |
176 | appendDay ( iii, mEventDate ); | 176 | appendDay ( iii, mEventDate ); |
177 | itemAdded = true; | 177 | itemAdded = true; |
178 | 178 | ||
179 | } | 179 | } |
180 | Event *ev = events.first(); | 180 | Event *ev = events.first(); |
181 | while(ev) { | 181 | while(ev) { |
182 | //qDebug("+++++event append %s", ev->summary().latin1()); | 182 | //qDebug("+++++event append %s", ev->summary().latin1()); |
183 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 183 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
184 | appendEvent(ev, false , iii!= 0 ); | 184 | appendEvent(ev, false , iii!= 0 ); |
185 | } | 185 | } |
186 | ev = events.next(); | 186 | ev = events.next(); |
187 | } | 187 | } |
188 | 188 | ||
189 | //mText += "</table>\n"; | 189 | //mText += "</table>\n"; |
190 | } | 190 | } |
191 | 191 | ||
192 | todo = todos.first(); | 192 | todo = todos.first(); |
193 | while(todo) { | 193 | while(todo) { |
194 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 194 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
195 | if ( ! itemAdded ) { | 195 | if ( ! itemAdded ) { |
196 | appendDay ( iii, mEventDate ); | 196 | appendDay ( iii, mEventDate ); |
197 | itemAdded = true; | 197 | itemAdded = true; |
198 | } | 198 | } |
199 | appendEvent(todo); | 199 | appendEvent(todo); |
200 | } | 200 | } |
201 | todo = todos.next(); | 201 | todo = todos.next(); |
202 | } | 202 | } |
203 | if ( !itemAdded && iii == 0 ) { | 203 | if ( !itemAdded && iii == 0 ) { |
204 | // appendDay ( iii, mEventDate ); | 204 | // appendDay ( iii, mEventDate ); |
205 | //mText += "<table>"; | 205 | //mText += "<table>"; |
206 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 206 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; |
207 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; | 207 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; |
208 | //mText +="</table>"; | 208 | //mText +="</table>"; |
209 | } | 209 | } |
210 | if ( itemAdded ) | 210 | if ( itemAdded ) |
211 | mText += "</table>\n"; | 211 | mText += "</table>\n"; |
212 | mEventDate = mEventDate.addDays( 1 ); | 212 | mEventDate = mEventDate.addDays( 1 ); |
213 | } | 213 | } |
214 | 214 | ||
215 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 215 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
216 | if (todos.count() > 0 && topmostPrios > 0 ) { | 216 | if (todos.count() > 0 && topmostPrios > 0 ) { |
217 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 217 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
218 | // mText += "<h2>"; | 218 | // mText += "<h2>"; |
219 | //<img src=\""; | 219 | //<img src=\""; |
220 | // mText += ipath; | 220 | // mText += ipath; |
221 | // mText += "\">"; | 221 | // mText += "\">"; |
222 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 222 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
223 | 223 | ||
224 | //mText += "<ul>\n"; | 224 | //mText += "<ul>\n"; |
225 | bool gotone = false; | 225 | bool gotone = false; |
226 | int priority = 1; | 226 | int priority = 1; |
227 | int priosFound = 0; | 227 | int priosFound = 0; |
228 | #ifdef DESKTOP_VERSION | 228 | #ifdef DESKTOP_VERSION |
229 | mText +="<p></p>"; | 229 | mText +="<p></p>"; |
230 | #endif | 230 | #endif |
231 | 231 | ||
232 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; | 232 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; |
233 | mText += "<ul>\n"; | 233 | mText += "<ul>\n"; |
234 | while (!gotone && priority<6) { | 234 | while (!gotone && priority<6) { |
235 | todo = todos.first(); | 235 | todo = todos.first(); |
236 | while(todo) { | 236 | while(todo) { |
237 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 237 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
238 | if ( appendTodo(todo) ) | 238 | if ( appendTodo(todo) ) |
239 | gotone = true; | 239 | gotone = true; |
240 | } | 240 | } |
241 | todo = todos.next(); | 241 | todo = todos.next(); |
242 | } | 242 | } |
243 | if ( gotone ) { | 243 | if ( gotone ) { |
244 | gotone = false; | 244 | gotone = false; |
245 | ++priosFound; | 245 | ++priosFound; |
246 | if ( priosFound == topmostPrios ) | 246 | if ( priosFound == topmostPrios ) |
247 | break; | 247 | break; |
248 | } | 248 | } |
249 | priority++; | 249 | priority++; |
250 | // kdDebug() << "adding the todos..." << endl; | 250 | // kdDebug() << "adding the todos..." << endl; |
251 | } | 251 | } |
252 | mText += "</ul>\n"; | 252 | mText += "</ul>\n"; |
253 | } | 253 | } |
254 | 254 | ||
255 | int replys = 0; | 255 | int replys = 0; |
256 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); | 256 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); |
257 | if (events.count() > 0) { | 257 | if (events.count() > 0) { |
258 | Event *ev = events.first(); | 258 | Event *ev = events.first(); |
259 | while(ev) { | 259 | while(ev) { |
260 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 260 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
261 | if (me!=0) { | 261 | if (me!=0) { |
262 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 262 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
263 | if (replys == 0) { | 263 | if (replys == 0) { |
264 | mText += "<p></p>"; | 264 | mText += "<p></p>"; |
265 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 265 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
266 | mText += "<h2>"; | 266 | //mText += "<h2>"; |
267 | //<img src=\""; | 267 | //<img src=\""; |
268 | // mText += ipath; | 268 | // mText += ipath; |
269 | // mText += "\">"; | 269 | // mText += "\">"; |
270 | mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | 270 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; |
271 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; | ||
271 | mText += "<table>\n"; | 272 | mText += "<table>\n"; |
272 | } | 273 | } |
273 | replys++; | 274 | replys++; |
274 | appendEvent(ev,true); | 275 | appendEvent(ev,true); |
275 | } | 276 | } |
276 | } | 277 | } |
277 | ev = events.next(); | 278 | ev = events.next(); |
278 | } | 279 | } |
279 | } | 280 | } |
280 | todos = calendar()->todos(); | 281 | todos = calendar()->todos(); |
281 | if (todos.count() > 0) { | 282 | if (todos.count() > 0) { |
282 | Todo *to = todos.first(); | 283 | Todo *to = todos.first(); |
283 | while(to) { | 284 | while(to) { |
284 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 285 | if ( !to->isCompleted() ){ |
285 | if (me!=0) { | 286 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
286 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 287 | if (me!=0) { |
287 | if (replys == 0) { | 288 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
288 | mText += "<p></p>"; | 289 | if (replys == 0) { |
289 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 290 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; |
290 | mText += "<h2>"; | 291 | mText += "<table>\n"; |
291 | //<img src=\""; | 292 | } |
292 | // mText += ipath; | 293 | replys++; |
293 | // mText += "\">"; | 294 | appendEvent(to, true); |
294 | mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | ||
295 | mText += "<table>\n"; | ||
296 | } | 295 | } |
297 | replys++; | ||
298 | appendEvent(to); | ||
299 | } | 296 | } |
300 | } | 297 | } |
301 | kdDebug () << "check for todo-replys..." << endl; | ||
302 | to = todos.next(); | 298 | to = todos.next(); |
303 | } | 299 | } |
304 | } | 300 | } |
305 | if (replys > 0 ) mText += "</table>\n"; | 301 | if (replys > 0 ) mText += "</table>\n"; |
306 | 302 | ||
307 | 303 | ||
308 | mText += "</td></tr>\n</table>\n"; | 304 | mText += "</td></tr>\n</table>\n"; |
309 | 305 | ||
310 | kdDebug() << "KOWhatsNextView::updateView: text: " << mText << endl; | ||
311 | mView->setText(mText); | 306 | mView->setText(mText); |
312 | mView->setFocus(); | 307 | mView->setFocus(); |
313 | 308 | ||
314 | // QPixmap bPix = SmallIcon( "back" ); | 309 | // QPixmap bPix = SmallIcon( "back" ); |
315 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 310 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
316 | // QWidget* test = new QWidget(); | 311 | // QWidget* test = new QWidget(); |
317 | // test->setBackgroundMode(FixedPixmap ); | 312 | // test->setBackgroundMode(FixedPixmap ); |
318 | // test->setBackgroundPixmap ( bPix ); | 313 | // test->setBackgroundPixmap ( bPix ); |
319 | // test->resize( 300, 400 ); | 314 | // test->resize( 300, 400 ); |
320 | // test->show(); | 315 | // test->show(); |
321 | // mView->setBackgroundMode(FixedPixmap ); | 316 | // mView->setBackgroundMode(FixedPixmap ); |
322 | // mView->setBackgroundPixmap ( bPix ); | 317 | // mView->setBackgroundPixmap ( bPix ); |
323 | } | 318 | } |
324 | 319 | ||
325 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 320 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
326 | { | 321 | { |
327 | QString date; | 322 | QString date; |
328 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 323 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
329 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 324 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
330 | if ( i == 0 ) { | 325 | if ( i == 0 ) { |
331 | mText += "<table>\n"; | 326 | mText += "<table>\n"; |
332 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 327 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
333 | } | 328 | } |
334 | else if ( i == 1 ) | 329 | else if ( i == 1 ) |
335 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 330 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
336 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 331 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
337 | //mText += "<h2>" + date + "</h2>\n"; | 332 | //mText += "<h2>" + date + "</h2>\n"; |
338 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 333 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
339 | mText += "<table>\n"; | 334 | mText += "<table>\n"; |
340 | 335 | ||
341 | 336 | ||
342 | 337 | ||
343 | } else { | 338 | } else { |
344 | if ( i == 0 ) { | 339 | if ( i == 0 ) { |
345 | mText += "<table>\n"; | 340 | mText += "<table>\n"; |
346 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 341 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
347 | } | 342 | } |
348 | 343 | ||
349 | #ifdef DESKTOP_VERSION | 344 | #ifdef DESKTOP_VERSION |
350 | else if ( i == 1 ) { | 345 | else if ( i == 1 ) { |
351 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 346 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
352 | } | 347 | } |
353 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 348 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
354 | #else | 349 | #else |
355 | else if ( i == 1 ) { | 350 | else if ( i == 1 ) { |
356 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 351 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
357 | } | 352 | } |
358 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 353 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
359 | 354 | ||
360 | #endif | 355 | #endif |
361 | //mText += "<h2>" + date + "</h2>\n"; | 356 | //mText += "<h2>" + date + "</h2>\n"; |
362 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 357 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
363 | mText += "<table>\n"; | 358 | mText += "<table>\n"; |
364 | } | 359 | } |
365 | } | 360 | } |
366 | 361 | ||
367 | 362 | ||
368 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 363 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
369 | { | 364 | { |
370 | updateView(); | 365 | updateView(); |
371 | } | 366 | } |
372 | 367 | ||
373 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 368 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
374 | { | 369 | { |
375 | } | 370 | } |
376 | 371 | ||
377 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 372 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
378 | { | 373 | { |
379 | switch(action) { | 374 | switch(action) { |
380 | case KOGlobals::EVENTADDED: | 375 | case KOGlobals::EVENTADDED: |
381 | updateView(); | 376 | updateView(); |
382 | break; | 377 | break; |
383 | case KOGlobals::EVENTEDITED: | 378 | case KOGlobals::EVENTEDITED: |
384 | updateView(); | 379 | updateView(); |
385 | break; | 380 | break; |
386 | case KOGlobals::EVENTDELETED: | 381 | case KOGlobals::EVENTDELETED: |
387 | updateView(); | 382 | updateView(); |
388 | break; | 383 | break; |
389 | default: | 384 | default: |
390 | updateView(); | 385 | updateView(); |
391 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 386 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
392 | } | 387 | } |
393 | } | 388 | } |
394 | 389 | ||
395 | void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) | 390 | void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) |
396 | { | 391 | { |
397 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") ) | 392 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
398 | return; | 393 | return; |
399 | QDateTime cdt = QDateTime::currentDateTime(); | 394 | QDateTime cdt = QDateTime::currentDateTime(); |
395 | QDateTime noc; | ||
396 | bool ok = true; | ||
397 | if ( reply ) { | ||
398 | noc = ev->getNextOccurence( cdt, &ok ); | ||
399 | if (! ok && ev->type() == "Event") | ||
400 | return; | ||
401 | } | ||
400 | mText += "<tr><td><b>"; | 402 | mText += "<tr><td><b>"; |
401 | if (ev->type()=="Event") { | 403 | if (ev->type()=="Event") { |
404 | if (reply) { | ||
405 | if (!ev->doesFloat()) | ||
406 | mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | ||
407 | else | ||
408 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | ||
409 | |||
410 | } else { | ||
411 | if (!ev->doesFloat()) { | ||
412 | Event *event = static_cast<Event *>(ev); | ||
413 | QDateTime st,end; | ||
414 | if ( event->recurrence()->doesRecur() ) { | ||
415 | QDate recDate= mEventDate; | ||
416 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | ||
417 | while ( ! event->recursOn( recDate ) ) { | ||
418 | recDate = recDate.addDays( -1 ); | ||
402 | 419 | ||
403 | if (!ev->doesFloat()) { | 420 | } |
404 | Event *event = static_cast<Event *>(ev); | 421 | st = QDateTime ( recDate, event->dtStart().time() ); |
405 | QDateTime st,end; | 422 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
406 | if ( event->recurrence()->doesRecur() ) { | 423 | } |
407 | QDate recDate= mEventDate; | 424 | else { |
408 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 425 | st = event->dtStart(); |
409 | while ( ! event->recursOn( recDate ) ) { | 426 | end = event->dtEnd(); |
410 | recDate = recDate.addDays( -1 ); | ||
411 | |||
412 | } | 427 | } |
413 | st = QDateTime ( recDate, event->dtStart().time() ); | ||
414 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | ||
415 | } | ||
416 | else { | ||
417 | st = event->dtStart(); | ||
418 | end = event->dtEnd(); | ||
419 | } | ||
420 | 428 | ||
421 | if (reply) mText += "on " + event->dtStartDateStr() + ": "; | 429 | |
422 | QString dateText; | 430 | QString dateText; |
423 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 431 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
424 | if ( st.date() < mEventDate ) | 432 | if ( st.date() < mEventDate ) |
425 | dateText = "++:++-"; | 433 | dateText = "++:++-"; |
426 | else | 434 | else |
427 | dateText = event->dtStartTimeStr() + "-"; | 435 | dateText = event->dtStartTimeStr() + "-"; |
428 | if ( end.date() > mEventDate ) | 436 | if ( end.date() > mEventDate ) |
429 | dateText += "++:++"; | 437 | dateText += "++:++"; |
430 | else | ||
431 | dateText += event->dtEndTimeStr(); | ||
432 | if ( notRed ) | ||
433 | mText += dateText; | ||
434 | else { | ||
435 | if ( end < cdt ) | ||
436 | mText += "<font color=\"#F00000\">" + dateText + "</font>"; | ||
437 | else if ( st < cdt ) | ||
438 | mText += "<font color=\"#008000\">" + dateText + "</font>"; | ||
439 | else | 438 | else |
439 | dateText += event->dtEndTimeStr(); | ||
440 | if ( notRed ) | ||
440 | mText += dateText; | 441 | mText += dateText; |
441 | } | 442 | else { |
443 | if ( end < cdt ) | ||
444 | mText += "<font color=\"#F00000\">" + dateText + "</font>"; | ||
445 | else if ( st < cdt ) | ||
446 | mText += "<font color=\"#008000\">" + dateText + "</font>"; | ||
447 | else | ||
448 | mText += dateText; | ||
449 | |||
450 | } | ||
442 | 451 | ||
443 | } else { | 452 | } else { |
444 | mText += i18n("Allday:"); | 453 | mText += i18n("Allday:"); |
445 | 454 | ||
455 | } | ||
446 | } | 456 | } |
447 | } else { | 457 | } else { |
448 | mTodos.append( ev ); | 458 | mTodos.append( ev ); |
449 | mText += i18n("ToDo:"); | 459 | mText += i18n("ToDo:"); |
450 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 460 | if (reply) { |
451 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 461 | mText += " "; |
452 | QString dfs = KGlobal::locale()->dateFormatShort(); | 462 | if ( noc != cdt ) { |
453 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 463 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
454 | mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 464 | } |
455 | KGlobal::locale()->setDateFormatShort(dfs); | ||
456 | } else { | 465 | } else { |
457 | if (!ev->doesFloat() ) | 466 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
458 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 467 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
459 | mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 468 | QString dfs = KGlobal::locale()->dateFormatShort(); |
460 | 469 | KGlobal::locale()->setDateFormatShort("%d.%b"); | |
461 | 470 | mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | |
462 | } else | 471 | KGlobal::locale()->setDateFormatShort(dfs); |
463 | mText +=((Todo*)ev)->dtDueTimeStr(); | 472 | } else { |
464 | mTodos.append( ev ); | 473 | if (!ev->doesFloat() ) |
474 | if( ( (Todo*)ev)->dtDue() < cdt ) { | ||
475 | mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | ||
476 | |||
477 | |||
478 | } else | ||
479 | mText +=((Todo*)ev)->dtDueTimeStr(); | ||
480 | mTodos.append( ev ); | ||
481 | } | ||
465 | } | 482 | } |
466 | } | 483 | } |
467 | mText += "</b></td><td>"; | 484 | mText += "</b></td><td>"; |
468 | bool needClose = false; | 485 | bool needClose = false; |
469 | if ( ev->cancelled() ) { | 486 | if ( ev->cancelled() ) { |
470 | mText += "<font color=\"#F00000\">[c"; | 487 | mText += "<font color=\"#F00000\">[c"; |
471 | needClose =true; | 488 | needClose =true; |
472 | 489 | ||
473 | } | 490 | } |
474 | if ( ev->isAlarmEnabled() ) { | 491 | if ( ev->isAlarmEnabled() ) { |
475 | if ( !needClose) | 492 | if ( !needClose) |
476 | mText +="["; | 493 | mText +="["; |
477 | mText += "a"; | 494 | mText += "a"; |
478 | needClose =true; | 495 | needClose =true; |
479 | 496 | ||
480 | } | 497 | } |
481 | if ( ev->description().length() > 0 ) { | 498 | if ( ev->description().length() > 0 ) { |
482 | if ( !needClose) | 499 | if ( !needClose) |
483 | mText +="["; | 500 | mText +="["; |
484 | mText += "i"; | 501 | mText += "i"; |
485 | needClose =true; | 502 | needClose =true; |
486 | } | 503 | } |
487 | if ( ev->recurrence()->doesRecur() ) { | 504 | if ( ev->recurrence()->doesRecur() ) { |
488 | if ( !needClose) | 505 | if ( !needClose) |
489 | mText +="["; | 506 | mText +="["; |
490 | mText += "r"; | 507 | mText += "r"; |
491 | needClose =true; | 508 | needClose =true; |
492 | } | 509 | } |
493 | if ( needClose ) { | 510 | if ( needClose ) { |
494 | mText += "] "; | 511 | mText += "] "; |
495 | } | 512 | } |
496 | if ( ev->cancelled() ) | 513 | if ( ev->cancelled() ) |
497 | mText += "</font>"; | 514 | mText += "</font>"; |
498 | mText += "<a "; | 515 | mText += "<a "; |
499 | if (ev->type()=="Event") mText += "href=\"event:"; | 516 | if (ev->type()=="Event") mText += "href=\"event:"; |
500 | if (ev->type()=="Todo") mText += "href=\"todo:"; | 517 | if (ev->type()=="Todo") mText += "href=\"todo:"; |
501 | mText += ev->uid() + "\">"; | 518 | mText += ev->uid() + "\">"; |
502 | if ( ev->summary().length() > 0 ) | 519 | if ( ev->summary().length() > 0 ) |
503 | mText += ev->summary(); | 520 | mText += ev->summary(); |
504 | else | 521 | else |
505 | mText += i18n("-no summary-"); | 522 | mText += i18n("-no summary-"); |
506 | mText += "</a>"; | 523 | mText += "</a>"; |
507 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 524 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
508 | if ( !ev->location().isEmpty() ) | 525 | if ( !ev->location().isEmpty() ) |
509 | mText += " ("+ev->location() +")"; | 526 | mText += " ("+ev->location() +")"; |
510 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 527 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
511 | mText += " ["+ev->relatedTo()->summary() +"]"; | 528 | mText += " ["+ev->relatedTo()->summary() +"]"; |
512 | mText += "</td></tr>\n"; | 529 | mText += "</td></tr>\n"; |
513 | } | 530 | } |
514 | 531 | ||
515 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 532 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
516 | { | 533 | { |
517 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 534 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
518 | 535 | ||
519 | mTodos.append( ev ); | 536 | mTodos.append( ev ); |
520 | if ( !isSub ) | 537 | if ( !isSub ) |
521 | mText += "<p>"; | 538 | mText += "<p>"; |
522 | else | 539 | else |
523 | mText += "<li>"; | 540 | mText += "<li>"; |
524 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 541 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
525 | 542 | ||
526 | 543 | ||
527 | mText += ind; | 544 | mText += ind; |
528 | bool needClose = false; | 545 | bool needClose = false; |
529 | if ( ev->cancelled() ) { | 546 | if ( ev->cancelled() ) { |
530 | mText += "<font color=\"#F00000\">[c"; | 547 | mText += "<font color=\"#F00000\">[c"; |
531 | needClose =true; | 548 | needClose =true; |
532 | 549 | ||
533 | } | 550 | } |
534 | if ( ev->isAlarmEnabled() ) { | 551 | if ( ev->isAlarmEnabled() ) { |
535 | if ( !needClose) | 552 | if ( !needClose) |
536 | mText +="["; | 553 | mText +="["; |
537 | mText += "a"; | 554 | mText += "a"; |
538 | needClose =true; | 555 | needClose =true; |
539 | 556 | ||
540 | } | 557 | } |
541 | 558 | ||
542 | if ( ev->description().length() > 0 ) { | 559 | if ( ev->description().length() > 0 ) { |
543 | if ( !needClose) | 560 | if ( !needClose) |
544 | mText +="["; | 561 | mText +="["; |
545 | mText += "i"; | 562 | mText += "i"; |
546 | needClose =true; | 563 | needClose =true; |
547 | } | 564 | } |
548 | // if ( ev->recurrence()->doesRecur() ) { | 565 | // if ( ev->recurrence()->doesRecur() ) { |
549 | // if ( !needClose) | 566 | // if ( !needClose) |
550 | // mText +="("; | 567 | // mText +="("; |
551 | // mText += "r"; | 568 | // mText += "r"; |
552 | // needClose =true; | 569 | // needClose =true; |
553 | // } | 570 | // } |
554 | if ( needClose ) | 571 | if ( needClose ) |
555 | mText += "] "; | 572 | mText += "] "; |
556 | if ( ev->cancelled() ) | 573 | if ( ev->cancelled() ) |
557 | mText += "</font>"; | 574 | mText += "</font>"; |
558 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 575 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
559 | mText += ev->summary(); | 576 | mText += ev->summary(); |
560 | mText += "</a>"; | 577 | mText += "</a>"; |
561 | if ( ((Todo*)ev)->hasDueDate () ) { | 578 | if ( ((Todo*)ev)->hasDueDate () ) { |
562 | QString year = ""; | 579 | QString year = ""; |
563 | int ye = ((Todo*)ev)->dtDue().date().year(); | 580 | int ye = ((Todo*)ev)->dtDue().date().year(); |
564 | if ( QDateTime::currentDateTime().date().year() != ye ) | 581 | if ( QDateTime::currentDateTime().date().year() != ye ) |
565 | year = QString::number( ye ); | 582 | year = QString::number( ye ); |
566 | QString dfs = KGlobal::locale()->dateFormatShort(); | 583 | QString dfs = KGlobal::locale()->dateFormatShort(); |
567 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 584 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
568 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; | 585 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; |
569 | KGlobal::locale()->setDateFormatShort(dfs); | 586 | KGlobal::locale()->setDateFormatShort(dfs); |
570 | } | 587 | } |
571 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 588 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
572 | if ( !ev->location().isEmpty() ) | 589 | if ( !ev->location().isEmpty() ) |
573 | mText += " ("+ev->location() +")"; | 590 | mText += " ("+ev->location() +")"; |
574 | if ( !isSub ) { | 591 | if ( !isSub ) { |
575 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 592 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
576 | mText += " ["+ev->relatedTo()->summary() +"]"; | 593 | mText += " ["+ev->relatedTo()->summary() +"]"; |
577 | mText += "</p>\n"; | 594 | mText += "</p>\n"; |
578 | } | 595 | } |
579 | else { | 596 | else { |
580 | ind += "-"; | 597 | ind += "-"; |
581 | mText += "</li>\n"; | 598 | mText += "</li>\n"; |
582 | } | 599 | } |
583 | QPtrList<Incidence> Relations = ev->relations(); | 600 | QPtrList<Incidence> Relations = ev->relations(); |
584 | Incidence *to; | 601 | Incidence *to; |
585 | for (to=Relations.first();to;to=Relations.next()) { | 602 | for (to=Relations.first();to;to=Relations.next()) { |
586 | if (!((Todo*)to)->isCompleted()) | 603 | if (!((Todo*)to)->isCompleted()) |
587 | appendTodo( to, ind , true ); | 604 | appendTodo( to, ind , true ); |
588 | } | 605 | } |
589 | 606 | ||
590 | return true; | 607 | return true; |
591 | } | 608 | } |
592 | 609 | ||
593 | /* | 610 | /* |
594 | void KOWhatsNextView::createEventViewer() | 611 | void KOWhatsNextView::createEventViewer() |
595 | { | 612 | { |
596 | if (!mEventViewer) { | 613 | if (!mEventViewer) { |
597 | 614 | ||
598 | mEventViewer = new KOEventViewerDialog(this); | 615 | mEventViewer = new KOEventViewerDialog(this); |
599 | } | 616 | } |
600 | } | 617 | } |
601 | */ | 618 | */ |
602 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 619 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
603 | { | 620 | { |
604 | if ( mEventViewer ) | 621 | if ( mEventViewer ) |
605 | delete mEventViewer; | 622 | delete mEventViewer; |
606 | mEventViewer = v; | 623 | mEventViewer = v; |
607 | } | 624 | } |
608 | 625 | ||
609 | // TODO: Create this function in CalendarView and remove it from here | 626 | // TODO: Create this function in CalendarView and remove it from here |
610 | void KOWhatsNextView::showIncidence(const QString &uid) | 627 | void KOWhatsNextView::showIncidence(const QString &uid) |
611 | { | 628 | { |
612 | if ( !mEventViewer ) { | 629 | if ( !mEventViewer ) { |
613 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 630 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
614 | return; | 631 | return; |
615 | } | 632 | } |
616 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 633 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |
617 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 634 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
618 | if (uid.startsWith("event:")) { | 635 | if (uid.startsWith("event:")) { |
619 | #ifdef DESKTOP_VERSION | 636 | #ifdef DESKTOP_VERSION |
620 | Event *event = calendar()->event(uid.mid(8)); | 637 | Event *event = calendar()->event(uid.mid(8)); |
621 | #else | 638 | #else |
622 | Event *event = calendar()->event(uid.mid(6)); | 639 | Event *event = calendar()->event(uid.mid(6)); |
623 | #endif | 640 | #endif |
624 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); | 641 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); |
625 | if (!event) return; | 642 | if (!event) return; |
626 | //createEventViewer(); | 643 | //createEventViewer(); |
627 | mEventViewer->setEvent(event); | 644 | mEventViewer->setEvent(event); |
628 | } else if (uid.startsWith("todo:")) { | 645 | } else if (uid.startsWith("todo:")) { |
629 | #ifdef DESKTOP_VERSION | 646 | #ifdef DESKTOP_VERSION |
630 | Todo *todo = calendar()->todo(uid.mid(7)); | 647 | Todo *todo = calendar()->todo(uid.mid(7)); |
631 | #else | 648 | #else |
632 | Todo *todo = calendar()->todo(uid.mid(5)); | 649 | Todo *todo = calendar()->todo(uid.mid(5)); |
633 | #endif | 650 | #endif |
634 | if (!todo) return; | 651 | if (!todo) return; |
635 | //createEventViewer(); | 652 | //createEventViewer(); |
636 | mEventViewer->setTodo(todo); | 653 | mEventViewer->setTodo(todo); |
637 | } else { | 654 | } else { |
638 | return; | 655 | return; |
639 | 656 | ||
640 | } | 657 | } |
641 | mEventViewer->showMe(); | 658 | mEventViewer->showMe(); |
642 | mEventViewer->raise(); | 659 | mEventViewer->raise(); |
643 | } | 660 | } |