-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8e83723..ba0e6c6 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1743,389 +1743,389 @@ void CalendarView::writeSettings() | |||
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(); | 1935 | mDateNavigator->updateView(); //LR |
1936 | //mDialogManager->updateSearchDialog(); | 1936 | //mDialogManager->updateSearchDialog(); |
1937 | 1937 | ||
1938 | if (which) { | 1938 | if (which) { |
1939 | mViewManager->currentView()->updateView(); | 1939 | //mViewManager->currentView()->updateView();//LR |
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" ) { |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index d9e0a03..da46eca 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -304,384 +304,390 @@ KOQuickTodo::KOQuickTodo(QWidget *parent) : | |||
304 | QLineEdit(parent) | 304 | QLineEdit(parent) |
305 | { | 305 | { |
306 | setText(i18n("Click to add a new Todo")); | 306 | setText(i18n("Click to add a new Todo")); |
307 | } | 307 | } |
308 | 308 | ||
309 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 309 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
310 | { | 310 | { |
311 | if ( text()==i18n("Click to add a new Todo") ) | 311 | if ( text()==i18n("Click to add a new Todo") ) |
312 | setText(""); | 312 | setText(""); |
313 | QLineEdit::focusInEvent(ev); | 313 | QLineEdit::focusInEvent(ev); |
314 | } | 314 | } |
315 | 315 | ||
316 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 316 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
317 | { | 317 | { |
318 | setText(i18n("Click to add a new Todo")); | 318 | setText(i18n("Click to add a new Todo")); |
319 | QLineEdit::focusOutEvent(ev); | 319 | QLineEdit::focusOutEvent(ev); |
320 | } | 320 | } |
321 | 321 | ||
322 | ///////////////////////////////////////////////////////////////////////////// | 322 | ///////////////////////////////////////////////////////////////////////////// |
323 | 323 | ||
324 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 324 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
325 | KOrg::BaseView(calendar,parent,name) | 325 | KOrg::BaseView(calendar,parent,name) |
326 | { | 326 | { |
327 | QBoxLayout *topLayout = new QVBoxLayout(this); | 327 | QBoxLayout *topLayout = new QVBoxLayout(this); |
328 | mName = QString ( name ); | 328 | mName = QString ( name ); |
329 | mBlockUpdate = false; | 329 | mBlockUpdate = false; |
330 | mQuickAdd = new KOQuickTodo(this); | 330 | mQuickAdd = new KOQuickTodo(this); |
331 | topLayout->addWidget(mQuickAdd); | 331 | topLayout->addWidget(mQuickAdd); |
332 | 332 | ||
333 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 333 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
334 | 334 | ||
335 | mTodoListView = new KOTodoListView(calendar,this); | 335 | mTodoListView = new KOTodoListView(calendar,this); |
336 | topLayout->addWidget(mTodoListView); | 336 | topLayout->addWidget(mTodoListView); |
337 | //mTodoListView->header()->setMaximumHeight(30); | 337 | //mTodoListView->header()->setMaximumHeight(30); |
338 | mTodoListView->setRootIsDecorated(true); | 338 | mTodoListView->setRootIsDecorated(true); |
339 | mTodoListView->setAllColumnsShowFocus(true); | 339 | mTodoListView->setAllColumnsShowFocus(true); |
340 | 340 | ||
341 | mTodoListView->setShowSortIndicator(true); | 341 | mTodoListView->setShowSortIndicator(true); |
342 | 342 | ||
343 | mTodoListView->addColumn(i18n("Todo")); | 343 | mTodoListView->addColumn(i18n("Todo")); |
344 | mTodoListView->addColumn(i18n("Prio")); | 344 | mTodoListView->addColumn(i18n("Prio")); |
345 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 345 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
346 | mTodoListView->addColumn(i18n("Complete")); | 346 | mTodoListView->addColumn(i18n("Complete")); |
347 | mTodoListView->setColumnAlignment(2,AlignHCenter); | 347 | mTodoListView->setColumnAlignment(2,AlignHCenter); |
348 | mTodoListView->addColumn(i18n("Due Date")); | 348 | mTodoListView->addColumn(i18n("Due Date")); |
349 | mTodoListView->setColumnAlignment(3,AlignLeft); | 349 | mTodoListView->setColumnAlignment(3,AlignLeft); |
350 | mTodoListView->addColumn(i18n("Due Time")); | 350 | mTodoListView->addColumn(i18n("Due Time")); |
351 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 351 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
352 | mTodoListView->addColumn(i18n("Cancelled")); | 352 | mTodoListView->addColumn(i18n("Cancelled")); |
353 | mTodoListView->addColumn(i18n("Categories")); | 353 | mTodoListView->addColumn(i18n("Categories")); |
354 | #if 0 | 354 | #if 0 |
355 | mTodoListView->addColumn(i18n("Sort Id")); | 355 | mTodoListView->addColumn(i18n("Sort Id")); |
356 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 356 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
357 | #endif | 357 | #endif |
358 | 358 | ||
359 | mTodoListView->setMinimumHeight( 60 ); | 359 | mTodoListView->setMinimumHeight( 60 ); |
360 | mTodoListView->setItemsRenameable( true ); | 360 | mTodoListView->setItemsRenameable( true ); |
361 | mTodoListView->setRenameable( 0 ); | 361 | mTodoListView->setRenameable( 0 ); |
362 | mTodoListView->setColumnWidth( 0, 120 ); | 362 | mTodoListView->setColumnWidth( 0, 120 ); |
363 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 363 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
364 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 364 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
365 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 365 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
366 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 366 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
367 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 367 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
368 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 368 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
369 | mTodoListView->setColumnAlignment( 2, AlignCenter ); | 369 | mTodoListView->setColumnAlignment( 2, AlignCenter ); |
370 | #if 0 | 370 | #if 0 |
371 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 371 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
372 | #endif | 372 | #endif |
373 | 373 | ||
374 | mPriorityPopupMenu = new QPopupMenu(this); | 374 | mPriorityPopupMenu = new QPopupMenu(this); |
375 | for (int i = 1; i <= 5; i++) { | 375 | for (int i = 1; i <= 5; i++) { |
376 | QString label = QString ("%1").arg (i); | 376 | QString label = QString ("%1").arg (i); |
377 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 377 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
378 | } | 378 | } |
379 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 379 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
380 | 380 | ||
381 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 381 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
382 | for (int i = 0; i <= 100; i+=20) { | 382 | for (int i = 0; i <= 100; i+=20) { |
383 | QString label = QString ("%1 %").arg (i); | 383 | QString label = QString ("%1 %").arg (i); |
384 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 384 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
385 | } | 385 | } |
386 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 386 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
387 | 387 | ||
388 | 388 | ||
389 | 389 | ||
390 | mItemPopupMenu = new QPopupMenu(this); | 390 | mItemPopupMenu = new QPopupMenu(this); |
391 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 391 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
392 | SLOT (showTodo())); | 392 | SLOT (showTodo())); |
393 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 393 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
394 | SLOT (editTodo())); | 394 | SLOT (editTodo())); |
395 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 395 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
396 | SLOT (deleteTodo())); | 396 | SLOT (deleteTodo())); |
397 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 397 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
398 | SLOT (cloneTodo())); | 398 | SLOT (cloneTodo())); |
399 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 399 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
400 | SLOT (moveTodo())); | 400 | SLOT (moveTodo())); |
401 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 401 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
402 | SLOT (beamTodo())); | 402 | SLOT (beamTodo())); |
403 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 403 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
404 | SLOT (cancelTodo())); | 404 | SLOT (cancelTodo())); |
405 | mItemPopupMenu->insertSeparator(); | 405 | mItemPopupMenu->insertSeparator(); |
406 | 406 | ||
407 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 407 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
408 | SLOT (newTodo())); | 408 | SLOT (newTodo())); |
409 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 409 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
410 | SLOT (newSubTodo())); | 410 | SLOT (newSubTodo())); |
411 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 411 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
412 | SLOT (unparentTodo())); | 412 | SLOT (unparentTodo())); |
413 | mItemPopupMenu->insertSeparator(); | 413 | mItemPopupMenu->insertSeparator(); |
414 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 414 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
415 | this, SLOT( purgeCompleted() ) ); | 415 | this, SLOT( purgeCompleted() ) ); |
416 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 416 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
417 | this, SLOT( toggleCompleted() ),0, 33 ); | 417 | this, SLOT( toggleCompleted() ),0, 33 ); |
418 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 418 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
419 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 419 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
420 | 420 | ||
421 | mPopupMenu = new QPopupMenu(this); | 421 | mPopupMenu = new QPopupMenu(this); |
422 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 422 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
423 | SLOT (newTodo()),0,1); | 423 | SLOT (newTodo()),0,1); |
424 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 424 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
425 | this, SLOT(purgeCompleted()),0,2); | 425 | this, SLOT(purgeCompleted()),0,2); |
426 | mPopupMenu->insertItem(i18n("Show Completed"), | 426 | mPopupMenu->insertItem(i18n("Show Completed"), |
427 | this, SLOT( toggleCompleted() ),0,3 ); | 427 | this, SLOT( toggleCompleted() ),0,3 ); |
428 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 428 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
429 | this, SLOT( toggleQuickTodo() ),0,4 ); | 429 | this, SLOT( toggleQuickTodo() ),0,4 ); |
430 | mDocPrefs = new DocPrefs( name ); | 430 | mDocPrefs = new DocPrefs( name ); |
431 | 431 | ||
432 | mPopupMenu->setCheckable( true ); | 432 | mPopupMenu->setCheckable( true ); |
433 | mItemPopupMenu->setCheckable( true ); | 433 | mItemPopupMenu->setCheckable( true ); |
434 | // Double clicking conflicts with opening/closing the subtree | 434 | // Double clicking conflicts with opening/closing the subtree |
435 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 435 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
436 | SLOT( editItem( QListViewItem *) ) ); | 436 | SLOT( editItem( QListViewItem *) ) ); |
437 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 437 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
438 | const QPoint &,int ) ), | 438 | const QPoint &,int ) ), |
439 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 439 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
440 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 440 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
441 | SLOT( itemClicked( QListViewItem * ) ) ); | 441 | SLOT( itemClicked( QListViewItem * ) ) ); |
442 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 442 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
443 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 443 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
444 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), | 444 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), |
445 | SLOT( updateView() ) ); | 445 | SLOT( updateView() ) ); |
446 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 446 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
447 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 447 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
448 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 448 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
449 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 449 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
450 | 450 | ||
451 | #if 0 | 451 | #if 0 |
452 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 452 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
453 | SLOT(selectionChanged(QListViewItem *))); | 453 | SLOT(selectionChanged(QListViewItem *))); |
454 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 454 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
455 | SLOT(selectionChanged(QListViewItem *))); | 455 | SLOT(selectionChanged(QListViewItem *))); |
456 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 456 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
457 | SLOT(selectionChanged(QListViewItem *))); | 457 | SLOT(selectionChanged(QListViewItem *))); |
458 | #endif | 458 | #endif |
459 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 459 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
460 | SLOT( processSelectionChange() ) ); | 460 | SLOT( processSelectionChange() ) ); |
461 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 461 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
462 | SLOT( addQuickTodo() ) ); | 462 | SLOT( addQuickTodo() ) ); |
463 | // if ( QApplication::desktop()->width() < 480 ) { | 463 | // if ( QApplication::desktop()->width() < 480 ) { |
464 | // setNarrow(); | 464 | // setNarrow(); |
465 | // mTodoListView->setColumnWidth( 0, 100 ); | 465 | // mTodoListView->setColumnWidth( 0, 100 ); |
466 | 466 | ||
467 | // } | 467 | // } |
468 | 468 | ||
469 | } | 469 | } |
470 | 470 | ||
471 | KOTodoView::~KOTodoView() | 471 | KOTodoView::~KOTodoView() |
472 | { | 472 | { |
473 | delete mDocPrefs; | 473 | delete mDocPrefs; |
474 | } | 474 | } |
475 | 475 | ||
476 | void KOTodoView::jumpToDate () | 476 | void KOTodoView::jumpToDate () |
477 | { | 477 | { |
478 | // if (mActiveItem) { | 478 | // if (mActiveItem) { |
479 | // mActiveItem->todo()); | 479 | // mActiveItem->todo()); |
480 | // if ( mActiveItem->todo()->hasDueDate() ) | 480 | // if ( mActiveItem->todo()->hasDueDate() ) |
481 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 481 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
482 | } | 482 | } |
483 | 483 | ||
484 | void KOTodoView::setNarrow() | 484 | void KOTodoView::setNarrow() |
485 | { | 485 | { |
486 | //mTodoListView->setColumnWidth( 0, 120 ); | 486 | //mTodoListView->setColumnWidth( 0, 120 ); |
487 | mTodoListView->setColumnWidth( 1, 35 ); | 487 | mTodoListView->setColumnWidth( 1, 35 ); |
488 | mTodoListView->setColumnWidth( 2, 40 ); | 488 | mTodoListView->setColumnWidth( 2, 40 ); |
489 | mTodoListView->setColumnWidth( 3, 80 ); | 489 | mTodoListView->setColumnWidth( 3, 80 ); |
490 | mTodoListView->setColumnWidth( 4, 40 ); | 490 | mTodoListView->setColumnWidth( 4, 40 ); |
491 | mTodoListView->setColumnWidth( 5, 90 ); | 491 | mTodoListView->setColumnWidth( 5, 90 ); |
492 | 492 | ||
493 | } | 493 | } |
494 | void KOTodoView::updateView() | 494 | void KOTodoView::updateView() |
495 | { | 495 | { |
496 | |||
497 | if ( mBlockUpdate ) { | ||
498 | //qDebug("blocked "); | ||
499 | return; | ||
500 | } | ||
501 | //qDebug("update "); | ||
496 | // kdDebug() << "KOTodoView::updateView()" << endl; | 502 | // kdDebug() << "KOTodoView::updateView()" << endl; |
497 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 503 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
498 | mTodoListView->clear(); | 504 | mTodoListView->clear(); |
499 | if ( mName == "todolistsmall" ) { | 505 | if ( mName == "todolistsmall" ) { |
500 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 506 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
501 | int ps = fo.pointSize() -2; | 507 | int ps = fo.pointSize() -2; |
502 | if ( ps > 12 ) | 508 | if ( ps > 12 ) |
503 | ps -= 2; | 509 | ps -= 2; |
504 | fo.setPointSize( ps ); | 510 | fo.setPointSize( ps ); |
505 | } | 511 | } |
506 | } | 512 | } |
507 | 513 | ||
508 | mTodoListView->setFont( fo ); | 514 | mTodoListView->setFont( fo ); |
509 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 515 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
510 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 516 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
511 | QPtrList<Todo> todoList = calendar()->todos(); | 517 | QPtrList<Todo> todoList = calendar()->todos(); |
512 | 518 | ||
513 | /* | 519 | /* |
514 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 520 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
515 | Event *t; | 521 | Event *t; |
516 | for(t = todoList.first(); t; t = todoList.next()) { | 522 | for(t = todoList.first(); t; t = todoList.next()) { |
517 | kdDebug() << " " << t->getSummary() << endl; | 523 | kdDebug() << " " << t->getSummary() << endl; |
518 | 524 | ||
519 | if (t->getRelatedTo()) { | 525 | if (t->getRelatedTo()) { |
520 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 526 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
521 | } | 527 | } |
522 | 528 | ||
523 | QPtrList<Event> l = t->getRelations(); | 529 | QPtrList<Event> l = t->getRelations(); |
524 | Event *c; | 530 | Event *c; |
525 | for(c=l.first();c;c=l.next()) { | 531 | for(c=l.first();c;c=l.next()) { |
526 | kdDebug() << " - relation: " << c->getSummary() << endl; | 532 | kdDebug() << " - relation: " << c->getSummary() << endl; |
527 | } | 533 | } |
528 | } | 534 | } |
529 | */ | 535 | */ |
530 | 536 | ||
531 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 537 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
532 | // specific order of events. That means that we have to generate parent items | 538 | // specific order of events. That means that we have to generate parent items |
533 | // recursively for proper hierarchical display of Todos. | 539 | // recursively for proper hierarchical display of Todos. |
534 | mTodoMap.clear(); | 540 | mTodoMap.clear(); |
535 | Todo *todo; | 541 | Todo *todo; |
536 | todo = todoList.first();// todo; todo = todoList.next()) { | 542 | todo = todoList.first();// todo; todo = todoList.next()) { |
537 | while ( todo ) { | 543 | while ( todo ) { |
538 | bool next = true; | 544 | bool next = true; |
539 | // qDebug("todo %s ", todo->summary().latin1()); | 545 | // qDebug("todo %s ", todo->summary().latin1()); |
540 | Incidence *incidence = todo->relatedTo(); | 546 | Incidence *incidence = todo->relatedTo(); |
541 | while ( incidence ) { | 547 | while ( incidence ) { |
542 | if ( incidence->type() == "Todo") { | 548 | if ( incidence->type() == "Todo") { |
543 | //qDebug("related %s ",incidence->summary().latin1() ); | 549 | //qDebug("related %s ",incidence->summary().latin1() ); |
544 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 550 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
545 | //qDebug("related not found "); | 551 | //qDebug("related not found "); |
546 | todoList.remove( ); | 552 | todoList.remove( ); |
547 | todo = todoList.current(); | 553 | todo = todoList.current(); |
548 | next = false; | 554 | next = false; |
549 | incidence = 0; | 555 | incidence = 0; |
550 | 556 | ||
551 | } else { | 557 | } else { |
552 | //qDebug("related found "); | 558 | //qDebug("related found "); |
553 | incidence = incidence->relatedTo(); | 559 | incidence = incidence->relatedTo(); |
554 | } | 560 | } |
555 | } else | 561 | } else |
556 | incidence = 0; | 562 | incidence = 0; |
557 | } | 563 | } |
558 | if ( next ) | 564 | if ( next ) |
559 | todo = todoList.next(); | 565 | todo = todoList.next(); |
560 | } | 566 | } |
561 | // qDebug("again .... "); | 567 | // qDebug("again .... "); |
562 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 568 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
563 | 569 | ||
564 | // qDebug("yytodo %s ", todo->summary().latin1()); | 570 | // qDebug("yytodo %s ", todo->summary().latin1()); |
565 | // } | 571 | // } |
566 | //qDebug("for "); | 572 | //qDebug("for "); |
567 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 573 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
568 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) | 574 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) |
569 | { | 575 | { |
570 | insertTodoItem(todo); | 576 | insertTodoItem(todo); |
571 | } | 577 | } |
572 | } | 578 | } |
573 | //qDebug("for end "); | 579 | //qDebug("for end "); |
574 | // Restore opened/closed state | 580 | // Restore opened/closed state |
575 | mTodoListView->blockSignals( true ); | 581 | mTodoListView->blockSignals( true ); |
576 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 582 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
577 | mTodoListView->blockSignals( false ); | 583 | mTodoListView->blockSignals( false ); |
578 | mTodoListView->setFocus(); | 584 | mTodoListView->setFocus(); |
579 | processSelectionChange(); | 585 | processSelectionChange(); |
580 | } | 586 | } |
581 | 587 | ||
582 | void KOTodoView::restoreItemState( QListViewItem *item ) | 588 | void KOTodoView::restoreItemState( QListViewItem *item ) |
583 | { | 589 | { |
584 | while( item ) { | 590 | while( item ) { |
585 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 591 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
586 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 592 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
587 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 593 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
588 | item = item->nextSibling(); | 594 | item = item->nextSibling(); |
589 | } | 595 | } |
590 | } | 596 | } |
591 | 597 | ||
592 | 598 | ||
593 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 599 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
594 | KOTodoView::insertTodoItem(Todo *todo) | 600 | KOTodoView::insertTodoItem(Todo *todo) |
595 | { | 601 | { |
596 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 602 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
597 | // TODO: Check, if dynmaic cast is necessary | 603 | // TODO: Check, if dynmaic cast is necessary |
598 | 604 | ||
599 | 605 | ||
600 | Incidence *incidence = todo->relatedTo(); | 606 | Incidence *incidence = todo->relatedTo(); |
601 | if (incidence && incidence->type() == "Todo") { | 607 | if (incidence && incidence->type() == "Todo") { |
602 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 608 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
603 | 609 | ||
604 | // kdDebug() << " has Related" << endl; | 610 | // kdDebug() << " has Related" << endl; |
605 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 611 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
606 | itemIterator = mTodoMap.find(relatedTodo); | 612 | itemIterator = mTodoMap.find(relatedTodo); |
607 | if (itemIterator == mTodoMap.end()) { | 613 | if (itemIterator == mTodoMap.end()) { |
608 | // kdDebug() << " related not yet in list" << endl; | 614 | // kdDebug() << " related not yet in list" << endl; |
609 | itemIterator = insertTodoItem (relatedTodo); | 615 | itemIterator = insertTodoItem (relatedTodo); |
610 | } | 616 | } |
611 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 617 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
612 | // and one into the map. Sure finding is more easy but why? -zecke | 618 | // and one into the map. Sure finding is more easy but why? -zecke |
613 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 619 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
614 | return mTodoMap.insert(todo,todoItem); | 620 | return mTodoMap.insert(todo,todoItem); |
615 | } else { | 621 | } else { |
616 | // kdDebug() << " no Related" << endl; | 622 | // kdDebug() << " no Related" << endl; |
617 | // see above -zecke | 623 | // see above -zecke |
618 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 624 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
619 | return mTodoMap.insert(todo,todoItem); | 625 | return mTodoMap.insert(todo,todoItem); |
620 | } | 626 | } |
621 | } | 627 | } |
622 | 628 | ||
623 | 629 | ||
624 | void KOTodoView::updateConfig() | 630 | void KOTodoView::updateConfig() |
625 | { | 631 | { |
626 | updateView(); | 632 | updateView(); |
627 | mTodoListView->repaintContents(); | 633 | mTodoListView->repaintContents(); |
628 | } | 634 | } |
629 | 635 | ||
630 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 636 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
631 | { | 637 | { |
632 | QPtrList<Incidence> selected; | 638 | QPtrList<Incidence> selected; |
633 | 639 | ||
634 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 640 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
635 | // if (!item) item = mActiveItem; | 641 | // if (!item) item = mActiveItem; |
636 | if (item) selected.append(item->todo()); | 642 | if (item) selected.append(item->todo()); |
637 | 643 | ||
638 | return selected; | 644 | return selected; |
639 | } | 645 | } |
640 | 646 | ||
641 | QPtrList<Todo> KOTodoView::selectedTodos() | 647 | QPtrList<Todo> KOTodoView::selectedTodos() |
642 | { | 648 | { |
643 | QPtrList<Todo> selected; | 649 | QPtrList<Todo> selected; |
644 | 650 | ||
645 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 651 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
646 | // if (!item) item = mActiveItem; | 652 | // if (!item) item = mActiveItem; |
647 | if (item) selected.append(item->todo()); | 653 | if (item) selected.append(item->todo()); |
648 | 654 | ||
649 | return selected; | 655 | return selected; |
650 | } | 656 | } |
651 | 657 | ||
652 | void KOTodoView::changeEventDisplay(Event *, int) | 658 | void KOTodoView::changeEventDisplay(Event *, int) |
653 | { | 659 | { |
654 | updateView(); | 660 | updateView(); |
655 | } | 661 | } |
656 | 662 | ||
657 | void KOTodoView::showDates(const QDate &, const QDate &) | 663 | void KOTodoView::showDates(const QDate &, const QDate &) |
658 | { | 664 | { |
659 | } | 665 | } |
660 | 666 | ||
661 | void KOTodoView::showEvents(QPtrList<Event>) | 667 | void KOTodoView::showEvents(QPtrList<Event>) |
662 | { | 668 | { |
663 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 669 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
664 | } | 670 | } |
665 | 671 | ||
666 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 672 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
667 | const QDate &td) | 673 | const QDate &td) |
668 | { | 674 | { |
669 | #ifndef KORG_NOPRINTER | 675 | #ifndef KORG_NOPRINTER |
670 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 676 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
671 | #endif | 677 | #endif |
672 | } | 678 | } |
673 | 679 | ||
674 | void KOTodoView::editItem(QListViewItem *item ) | 680 | void KOTodoView::editItem(QListViewItem *item ) |
675 | { | 681 | { |
676 | // qDebug("editItem(QListViewItem *item ) "); | 682 | // qDebug("editItem(QListViewItem *item ) "); |
677 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 683 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
678 | } | 684 | } |
679 | 685 | ||
680 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 686 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
681 | { | 687 | { |
682 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 688 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
683 | } | 689 | } |
684 | 690 | ||
685 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) | 691 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) |
686 | { | 692 | { |
687 | 693 | ||