-rw-r--r-- | korganizer/calendarview.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7eca69d..7444bad 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1777,192 +1777,200 @@ void CalendarView::writeFilterSettings(KConfig *config) | |||
1777 | 1777 | ||
1778 | QStringList filterList; | 1778 | QStringList filterList; |
1779 | 1779 | ||
1780 | CalFilter *filter = mFilters.first(); | 1780 | CalFilter *filter = mFilters.first(); |
1781 | while(filter) { | 1781 | while(filter) { |
1782 | // kdDebug() << " fn: " << filter->name() << endl; | 1782 | // kdDebug() << " fn: " << filter->name() << endl; |
1783 | filterList << filter->name(); | 1783 | filterList << filter->name(); |
1784 | config->setGroup("Filter_" + filter->name()); | 1784 | config->setGroup("Filter_" + filter->name()); |
1785 | config->writeEntry("Criteria",filter->criteria()); | 1785 | config->writeEntry("Criteria",filter->criteria()); |
1786 | config->writeEntry("CategoryList",filter->categoryList()); | 1786 | config->writeEntry("CategoryList",filter->categoryList()); |
1787 | filter = mFilters.next(); | 1787 | filter = mFilters.next(); |
1788 | } | 1788 | } |
1789 | config->setGroup("General"); | 1789 | config->setGroup("General"); |
1790 | config->writeEntry("CalendarFilters",filterList); | 1790 | config->writeEntry("CalendarFilters",filterList); |
1791 | 1791 | ||
1792 | config->setGroup("FilterView"); | 1792 | config->setGroup("FilterView"); |
1793 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1793 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1794 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1794 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1795 | } | 1795 | } |
1796 | 1796 | ||
1797 | 1797 | ||
1798 | void CalendarView::goToday() | 1798 | void CalendarView::goToday() |
1799 | { | 1799 | { |
1800 | mNavigator->selectToday(); | 1800 | mNavigator->selectToday(); |
1801 | } | 1801 | } |
1802 | 1802 | ||
1803 | void CalendarView::goNext() | 1803 | void CalendarView::goNext() |
1804 | { | 1804 | { |
1805 | mNavigator->selectNext(); | 1805 | mNavigator->selectNext(); |
1806 | } | 1806 | } |
1807 | 1807 | ||
1808 | void CalendarView::goPrevious() | 1808 | void CalendarView::goPrevious() |
1809 | { | 1809 | { |
1810 | mNavigator->selectPrevious(); | 1810 | mNavigator->selectPrevious(); |
1811 | } | 1811 | } |
1812 | void CalendarView::goNextMonth() | 1812 | void CalendarView::goNextMonth() |
1813 | { | 1813 | { |
1814 | mNavigator->selectNextMonth(); | 1814 | mNavigator->selectNextMonth(); |
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | void CalendarView::goPreviousMonth() | 1817 | void CalendarView::goPreviousMonth() |
1818 | { | 1818 | { |
1819 | mNavigator->selectPreviousMonth(); | 1819 | mNavigator->selectPreviousMonth(); |
1820 | } | 1820 | } |
1821 | void CalendarView::writeLocale() | 1821 | void CalendarView::writeLocale() |
1822 | { | 1822 | { |
1823 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 1823 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
1824 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 1824 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
1825 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 1825 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
1826 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 1826 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
1827 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1827 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1828 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 1828 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
1829 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 1829 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
1830 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 1830 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
1831 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 1831 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
1832 | KOPrefs::instance()->mDaylightsavingStart, | 1832 | KOPrefs::instance()->mDaylightsavingStart, |
1833 | KOPrefs::instance()->mDaylightsavingEnd ); | 1833 | KOPrefs::instance()->mDaylightsavingEnd ); |
1834 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); | 1834 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); |
1835 | } | 1835 | } |
1836 | void CalendarView::updateConfig() | 1836 | void CalendarView::updateConfig() |
1837 | { | 1837 | { |
1838 | writeLocale(); | 1838 | writeLocale(); |
1839 | if ( KOPrefs::instance()->mUseAppColors ) | 1839 | if ( KOPrefs::instance()->mUseAppColors ) |
1840 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 1840 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
1841 | emit configChanged(); | 1841 | emit configChanged(); |
1842 | mTodoList->updateConfig(); | 1842 | mTodoList->updateConfig(); |
1843 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 1843 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
1844 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1844 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1845 | // To make the "fill window" configurations work | 1845 | // To make the "fill window" configurations work |
1846 | //mViewManager->raiseCurrentView(); | 1846 | //mViewManager->raiseCurrentView(); |
1847 | } | 1847 | } |
1848 | 1848 | ||
1849 | 1849 | ||
1850 | void CalendarView::eventChanged(Event *event) | 1850 | void CalendarView::eventChanged(Event *event) |
1851 | { | 1851 | { |
1852 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 1852 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
1853 | //updateUnmanagedViews(); | 1853 | //updateUnmanagedViews(); |
1854 | } | 1854 | } |
1855 | 1855 | ||
1856 | void CalendarView::eventAdded(Event *event) | 1856 | void CalendarView::eventAdded(Event *event) |
1857 | { | 1857 | { |
1858 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 1858 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
1859 | } | 1859 | } |
1860 | 1860 | ||
1861 | void CalendarView::eventToBeDeleted(Event *) | 1861 | void CalendarView::eventToBeDeleted(Event *) |
1862 | { | 1862 | { |
1863 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 1863 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | void CalendarView::eventDeleted() | 1866 | void CalendarView::eventDeleted() |
1867 | { | 1867 | { |
1868 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 1868 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
1869 | } | 1869 | } |
1870 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 1870 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
1871 | { | 1871 | { |
1872 | changeIncidenceDisplay((Incidence *)which, action); | 1872 | changeIncidenceDisplay((Incidence *)which, action); |
1873 | mDateNavigator->updateView(); | ||
1874 | //mDialogManager->updateSearchDialog(); | ||
1875 | |||
1876 | if (which) { | ||
1877 | mViewManager->currentView()->updateView(); | ||
1878 | mTodoList->updateView(); | ||
1879 | } | ||
1880 | |||
1873 | } | 1881 | } |
1874 | 1882 | ||
1875 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 1883 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
1876 | { | 1884 | { |
1877 | updateUnmanagedViews(); | 1885 | updateUnmanagedViews(); |
1878 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 1886 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
1879 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 1887 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
1880 | mCalendar->checkAlarmForIncidence( 0, true ); | 1888 | mCalendar->checkAlarmForIncidence( 0, true ); |
1881 | if ( mEventViewerDialog ) | 1889 | if ( mEventViewerDialog ) |
1882 | mEventViewerDialog->hide(); | 1890 | mEventViewerDialog->hide(); |
1883 | } | 1891 | } |
1884 | else | 1892 | else |
1885 | mCalendar->checkAlarmForIncidence( which , false ); | 1893 | mCalendar->checkAlarmForIncidence( which , false ); |
1886 | } | 1894 | } |
1887 | 1895 | ||
1888 | // most of the changeEventDisplays() right now just call the view's | 1896 | // most of the changeEventDisplays() right now just call the view's |
1889 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 1897 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
1890 | void CalendarView::changeEventDisplay(Event *which, int action) | 1898 | void CalendarView::changeEventDisplay(Event *which, int action) |
1891 | { | 1899 | { |
1892 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 1900 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
1893 | changeIncidenceDisplay((Incidence *)which, action); | 1901 | changeIncidenceDisplay((Incidence *)which, action); |
1894 | mDateNavigator->updateView(); | 1902 | mDateNavigator->updateView(); |
1895 | //mDialogManager->updateSearchDialog(); | 1903 | //mDialogManager->updateSearchDialog(); |
1896 | 1904 | ||
1897 | if (which) { | 1905 | if (which) { |
1898 | // If there is an event view visible update the display | 1906 | // If there is an event view visible update the display |
1899 | mViewManager->currentView()->changeEventDisplay(which,action); | 1907 | mViewManager->currentView()->changeEventDisplay(which,action); |
1900 | // TODO: check, if update needed | 1908 | // TODO: check, if update needed |
1901 | // if (which->getTodoStatus()) { | 1909 | // if (which->getTodoStatus()) { |
1902 | mTodoList->updateView(); | 1910 | mTodoList->updateView(); |
1903 | // } | 1911 | // } |
1904 | } else { | 1912 | } else { |
1905 | mViewManager->currentView()->updateView(); | 1913 | mViewManager->currentView()->updateView(); |
1906 | } | 1914 | } |
1907 | } | 1915 | } |
1908 | 1916 | ||
1909 | 1917 | ||
1910 | void CalendarView::updateTodoViews() | 1918 | void CalendarView::updateTodoViews() |
1911 | { | 1919 | { |
1912 | 1920 | ||
1913 | mTodoList->updateView(); | 1921 | mTodoList->updateView(); |
1914 | mViewManager->currentView()->updateView(); | 1922 | mViewManager->currentView()->updateView(); |
1915 | 1923 | ||
1916 | } | 1924 | } |
1917 | 1925 | ||
1918 | 1926 | ||
1919 | void CalendarView::updateView(const QDate &start, const QDate &end) | 1927 | void CalendarView::updateView(const QDate &start, const QDate &end) |
1920 | { | 1928 | { |
1921 | mTodoList->updateView(); | 1929 | mTodoList->updateView(); |
1922 | mViewManager->updateView(start, end); | 1930 | mViewManager->updateView(start, end); |
1923 | //mDateNavigator->updateView(); | 1931 | //mDateNavigator->updateView(); |
1924 | } | 1932 | } |
1925 | 1933 | ||
1926 | void CalendarView::updateView() | 1934 | void CalendarView::updateView() |
1927 | { | 1935 | { |
1928 | DateList tmpList = mNavigator->selectedDates(); | 1936 | DateList tmpList = mNavigator->selectedDates(); |
1929 | 1937 | ||
1930 | // We assume that the navigator only selects consecutive days. | 1938 | // We assume that the navigator only selects consecutive days. |
1931 | updateView( tmpList.first(), tmpList.last() ); | 1939 | updateView( tmpList.first(), tmpList.last() ); |
1932 | } | 1940 | } |
1933 | 1941 | ||
1934 | void CalendarView::updateUnmanagedViews() | 1942 | void CalendarView::updateUnmanagedViews() |
1935 | { | 1943 | { |
1936 | mDateNavigator->updateDayMatrix(); | 1944 | mDateNavigator->updateDayMatrix(); |
1937 | } | 1945 | } |
1938 | 1946 | ||
1939 | int CalendarView::msgItemDelete() | 1947 | int CalendarView::msgItemDelete() |
1940 | { | 1948 | { |
1941 | return KMessageBox::warningContinueCancel(this, | 1949 | return KMessageBox::warningContinueCancel(this, |
1942 | i18n("This item will be\npermanently deleted."), | 1950 | i18n("This item will be\npermanently deleted."), |
1943 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 1951 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
1944 | } | 1952 | } |
1945 | 1953 | ||
1946 | 1954 | ||
1947 | void CalendarView::edit_cut() | 1955 | void CalendarView::edit_cut() |
1948 | { | 1956 | { |
1949 | Event *anEvent=0; | 1957 | Event *anEvent=0; |
1950 | 1958 | ||
1951 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 1959 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
1952 | 1960 | ||
1953 | if (mViewManager->currentView()->isEventView()) { | 1961 | if (mViewManager->currentView()->isEventView()) { |
1954 | if ( incidence && incidence->type() == "Event" ) { | 1962 | if ( incidence && incidence->type() == "Event" ) { |
1955 | anEvent = static_cast<Event *>(incidence); | 1963 | anEvent = static_cast<Event *>(incidence); |
1956 | } | 1964 | } |
1957 | } | 1965 | } |
1958 | 1966 | ||
1959 | if (!anEvent) { | 1967 | if (!anEvent) { |
1960 | KNotifyClient::beep(); | 1968 | KNotifyClient::beep(); |
1961 | return; | 1969 | return; |
1962 | } | 1970 | } |
1963 | DndFactory factory( mCalendar ); | 1971 | DndFactory factory( mCalendar ); |
1964 | factory.cutEvent(anEvent); | 1972 | factory.cutEvent(anEvent); |
1965 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 1973 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
1966 | } | 1974 | } |
1967 | 1975 | ||
1968 | void CalendarView::edit_copy() | 1976 | void CalendarView::edit_copy() |