summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3908dbb..47cd488 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1898,193 +1898,196 @@ void CalendarView::writeSettings()
1898 wid = getEventViewerDialog(); 1898 wid = getEventViewerDialog();
1899 x = wid->geometry().x(); 1899 x = wid->geometry().x();
1900 y = wid->geometry().y(); 1900 y = wid->geometry().y();
1901 w = wid->width(); 1901 w = wid->width();
1902 h = wid->height(); 1902 h = wid->height();
1903 list.clear(); 1903 list.clear();
1904 list << QString::number( x ); 1904 list << QString::number( x );
1905 list << QString::number( y ); 1905 list << QString::number( y );
1906 list << QString::number( w ); 1906 list << QString::number( w );
1907 list << QString::number( h ); 1907 list << QString::number( h );
1908 config->writeEntry("ViewerLayout",list ); 1908 config->writeEntry("ViewerLayout",list );
1909 wid = mDialogManager->getSearchDialog(); 1909 wid = mDialogManager->getSearchDialog();
1910 if ( wid ) { 1910 if ( wid ) {
1911 x = wid->geometry().x(); 1911 x = wid->geometry().x();
1912 y = wid->geometry().y(); 1912 y = wid->geometry().y();
1913 w = wid->width(); 1913 w = wid->width();
1914 h = wid->height(); 1914 h = wid->height();
1915 list.clear(); 1915 list.clear();
1916 list << QString::number( x ); 1916 list << QString::number( x );
1917 list << QString::number( y ); 1917 list << QString::number( y );
1918 list << QString::number( w ); 1918 list << QString::number( w );
1919 list << QString::number( h ); 1919 list << QString::number( h );
1920 config->writeEntry("SearchLayout",list ); 1920 config->writeEntry("SearchLayout",list );
1921 } 1921 }
1922#endif 1922#endif
1923 1923
1924 1924
1925 config->sync(); 1925 config->sync();
1926} 1926}
1927 1927
1928void CalendarView::readFilterSettings(KConfig *config) 1928void CalendarView::readFilterSettings(KConfig *config)
1929{ 1929{
1930 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1930 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1931 1931
1932 mFilters.clear(); 1932 mFilters.clear();
1933 1933
1934 config->setGroup("General"); 1934 config->setGroup("General");
1935 QStringList filterList = config->readListEntry("CalendarFilters"); 1935 QStringList filterList = config->readListEntry("CalendarFilters");
1936 1936
1937 QStringList::ConstIterator it = filterList.begin(); 1937 QStringList::ConstIterator it = filterList.begin();
1938 QStringList::ConstIterator end = filterList.end(); 1938 QStringList::ConstIterator end = filterList.end();
1939 while(it != end) { 1939 while(it != end) {
1940 // kdDebug() << " filter: " << (*it) << endl; 1940 // kdDebug() << " filter: " << (*it) << endl;
1941 1941
1942 CalFilter *filter; 1942 CalFilter *filter;
1943 filter = new CalFilter(*it); 1943 filter = new CalFilter(*it);
1944 config->setGroup("Filter_" + (*it)); 1944 config->setGroup("Filter_" + (*it));
1945 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1945 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1946 filter->setCriteria(config->readNumEntry("Criteria",0)); 1946 filter->setCriteria(config->readNumEntry("Criteria",0));
1947 filter->setCategoryList(config->readListEntry("CategoryList")); 1947 filter->setCategoryList(config->readListEntry("CategoryList"));
1948 mFilters.append(filter); 1948 mFilters.append(filter);
1949 1949
1950 ++it; 1950 ++it;
1951 } 1951 }
1952 1952
1953 if (mFilters.count() == 0) { 1953 if (mFilters.count() == 0) {
1954 CalFilter *filter = new CalFilter(i18n("Default")); 1954 CalFilter *filter = new CalFilter(i18n("Default"));
1955 mFilters.append(filter); 1955 mFilters.append(filter);
1956 } 1956 }
1957 mFilterView->updateFilters(); 1957 mFilterView->updateFilters();
1958 config->setGroup("FilterView"); 1958 config->setGroup("FilterView");
1959 1959
1960 mFilterView->blockSignals(true); 1960 mFilterView->blockSignals(true);
1961 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1961 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1962 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1962 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1963 mFilterView->blockSignals(false); 1963 mFilterView->blockSignals(false);
1964 // We do it manually to avoid it being done twice by the above calls 1964 // We do it manually to avoid it being done twice by the above calls
1965 updateFilter(); 1965 updateFilter();
1966} 1966}
1967 1967
1968void CalendarView::writeFilterSettings(KConfig *config) 1968void CalendarView::writeFilterSettings(KConfig *config)
1969{ 1969{
1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1971 1971
1972 QStringList filterList; 1972 QStringList filterList;
1973 1973
1974 CalFilter *filter = mFilters.first(); 1974 CalFilter *filter = mFilters.first();
1975 while(filter) { 1975 while(filter) {
1976 // kdDebug() << " fn: " << filter->name() << endl; 1976 // kdDebug() << " fn: " << filter->name() << endl;
1977 filterList << filter->name(); 1977 filterList << filter->name();
1978 config->setGroup("Filter_" + filter->name()); 1978 config->setGroup("Filter_" + filter->name());
1979 config->writeEntry("Criteria",filter->criteria()); 1979 config->writeEntry("Criteria",filter->criteria());
1980 config->writeEntry("CategoryList",filter->categoryList()); 1980 config->writeEntry("CategoryList",filter->categoryList());
1981 filter = mFilters.next(); 1981 filter = mFilters.next();
1982 } 1982 }
1983 config->setGroup("General"); 1983 config->setGroup("General");
1984 config->writeEntry("CalendarFilters",filterList); 1984 config->writeEntry("CalendarFilters",filterList);
1985 1985
1986 config->setGroup("FilterView"); 1986 config->setGroup("FilterView");
1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1989} 1989}
1990 1990
1991 1991
1992void CalendarView::goToday() 1992void CalendarView::goToday()
1993{ 1993{
1994 mNavigator->selectToday(); 1994 if ( mViewManager->currentView()->isMonthView() )
1995 mNavigator->selectTodayMonth();
1996 else
1997 mNavigator->selectToday();
1995} 1998}
1996 1999
1997void CalendarView::goNext() 2000void CalendarView::goNext()
1998{ 2001{
1999 mNavigator->selectNext(); 2002 mNavigator->selectNext();
2000} 2003}
2001 2004
2002void CalendarView::goPrevious() 2005void CalendarView::goPrevious()
2003{ 2006{
2004 mNavigator->selectPrevious(); 2007 mNavigator->selectPrevious();
2005} 2008}
2006void CalendarView::goNextMonth() 2009void CalendarView::goNextMonth()
2007{ 2010{
2008 mNavigator->selectNextMonth(); 2011 mNavigator->selectNextMonth();
2009} 2012}
2010 2013
2011void CalendarView::goPreviousMonth() 2014void CalendarView::goPreviousMonth()
2012{ 2015{
2013 mNavigator->selectPreviousMonth(); 2016 mNavigator->selectPreviousMonth();
2014} 2017}
2015void CalendarView::writeLocale() 2018void CalendarView::writeLocale()
2016{ 2019{
2017 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2020 //KPimGlobalPrefs::instance()->setGlobalConfig();
2018#if 0 2021#if 0
2019 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2022 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2020 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2023 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2021 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2024 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2022 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2025 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2023 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2026 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2024 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2027 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2025 dummy = KOPrefs::instance()->mUserDateFormatShort; 2028 dummy = KOPrefs::instance()->mUserDateFormatShort;
2026 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2029 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2027 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2030 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2028 KOPrefs::instance()->mDaylightsavingStart, 2031 KOPrefs::instance()->mDaylightsavingStart,
2029 KOPrefs::instance()->mDaylightsavingEnd ); 2032 KOPrefs::instance()->mDaylightsavingEnd );
2030 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2033 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2031#endif 2034#endif
2032} 2035}
2033void CalendarView::updateConfig() 2036void CalendarView::updateConfig()
2034{ 2037{
2035 writeLocale(); 2038 writeLocale();
2036 if ( KOPrefs::instance()->mUseAppColors ) 2039 if ( KOPrefs::instance()->mUseAppColors )
2037 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2040 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2038 emit configChanged(); 2041 emit configChanged();
2039 mTodoList->updateConfig(); 2042 mTodoList->updateConfig();
2040 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2043 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2041 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2044 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2042 // To make the "fill window" configurations work 2045 // To make the "fill window" configurations work
2043 //mViewManager->raiseCurrentView(); 2046 //mViewManager->raiseCurrentView();
2044} 2047}
2045 2048
2046 2049
2047void CalendarView::eventChanged(Event *event) 2050void CalendarView::eventChanged(Event *event)
2048{ 2051{
2049 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2052 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2050 //updateUnmanagedViews(); 2053 //updateUnmanagedViews();
2051} 2054}
2052 2055
2053void CalendarView::eventAdded(Event *event) 2056void CalendarView::eventAdded(Event *event)
2054{ 2057{
2055 changeEventDisplay(event,KOGlobals::EVENTADDED); 2058 changeEventDisplay(event,KOGlobals::EVENTADDED);
2056} 2059}
2057 2060
2058void CalendarView::eventToBeDeleted(Event *) 2061void CalendarView::eventToBeDeleted(Event *)
2059{ 2062{
2060 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2063 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2061} 2064}
2062 2065
2063void CalendarView::eventDeleted() 2066void CalendarView::eventDeleted()
2064{ 2067{
2065 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2068 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2066} 2069}
2067void CalendarView::changeTodoDisplay(Todo *which, int action) 2070void CalendarView::changeTodoDisplay(Todo *which, int action)
2068{ 2071{
2069 changeIncidenceDisplay((Incidence *)which, action); 2072 changeIncidenceDisplay((Incidence *)which, action);
2070 mDateNavigator->updateView(); //LR 2073 mDateNavigator->updateView(); //LR
2071 //mDialogManager->updateSearchDialog(); 2074 //mDialogManager->updateSearchDialog();
2072 2075
2073 if (which) { 2076 if (which) {
2074 mViewManager->updateWNview(); 2077 mViewManager->updateWNview();
2075 //mTodoList->updateView(); 2078 //mTodoList->updateView();
2076 } 2079 }
2077 2080
2078} 2081}
2079 2082
2080void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2083void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2081{ 2084{
2082 updateUnmanagedViews(); 2085 updateUnmanagedViews();
2083 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2086 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2084 if ( action == KOGlobals::EVENTDELETED ) { //delete 2087 if ( action == KOGlobals::EVENTDELETED ) { //delete
2085 mCalendar->checkAlarmForIncidence( 0, true ); 2088 mCalendar->checkAlarmForIncidence( 0, true );
2086 if ( mEventViewerDialog ) 2089 if ( mEventViewerDialog )
2087 mEventViewerDialog->hide(); 2090 mEventViewerDialog->hide();
2088 } 2091 }
2089 else 2092 else
2090 mCalendar->checkAlarmForIncidence( which , false ); 2093 mCalendar->checkAlarmForIncidence( which , false );