summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 0015bd6..1e83236 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1788,547 +1788,547 @@ void CalendarView::closeCalendar()
1788 emit closingDown(); 1788 emit closingDown();
1789 1789
1790 mCalendar->close(); 1790 mCalendar->close();
1791 setModified(false); 1791 setModified(false);
1792 updateView(); 1792 updateView();
1793} 1793}
1794 1794
1795void CalendarView::archiveCalendar() 1795void CalendarView::archiveCalendar()
1796{ 1796{
1797 mDialogManager->showArchiveDialog(); 1797 mDialogManager->showArchiveDialog();
1798} 1798}
1799 1799
1800 1800
1801void CalendarView::readSettings() 1801void CalendarView::readSettings()
1802{ 1802{
1803 1803
1804 1804
1805 // mViewManager->showAgendaView(); 1805 // mViewManager->showAgendaView();
1806 QString str; 1806 QString str;
1807 //qDebug("CalendarView::readSettings() "); 1807 //qDebug("CalendarView::readSettings() ");
1808 // read settings from the KConfig, supplying reasonable 1808 // read settings from the KConfig, supplying reasonable
1809 // defaults where none are to be found 1809 // defaults where none are to be found
1810 KConfig *config = KOGlobals::config(); 1810 KConfig *config = KOGlobals::config();
1811#ifndef KORG_NOSPLITTER 1811#ifndef KORG_NOSPLITTER
1812 config->setGroup("KOrganizer Geometry"); 1812 config->setGroup("KOrganizer Geometry");
1813 1813
1814 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1814 QValueList<int> sizes = config->readIntListEntry("Separator1");
1815 if (sizes.count() != 2) { 1815 if (sizes.count() != 2) {
1816 sizes << mDateNavigator->minimumSizeHint().width(); 1816 sizes << mDateNavigator->minimumSizeHint().width();
1817 sizes << 300; 1817 sizes << 300;
1818 } 1818 }
1819 mPanner->setSizes(sizes); 1819 mPanner->setSizes(sizes);
1820 1820
1821 sizes = config->readIntListEntry("Separator2"); 1821 sizes = config->readIntListEntry("Separator2");
1822 if ( ( mResourceView && sizes.count() == 4 ) || 1822 if ( ( mResourceView && sizes.count() == 4 ) ||
1823 ( !mResourceView && sizes.count() == 3 ) ) { 1823 ( !mResourceView && sizes.count() == 3 ) ) {
1824 mLeftSplitter->setSizes(sizes); 1824 mLeftSplitter->setSizes(sizes);
1825 } 1825 }
1826#endif 1826#endif
1827 globalFlagBlockAgenda = 1; 1827 globalFlagBlockAgenda = 1;
1828 mViewManager->showAgendaView(); 1828 mViewManager->showAgendaView();
1829 //mViewManager->readSettings( config ); 1829 //mViewManager->readSettings( config );
1830 mTodoList->restoreLayout(config,QString("Todo Layout")); 1830 mTodoList->restoreLayout(config,QString("Todo Layout"));
1831 readFilterSettings(config); 1831 readFilterSettings(config);
1832 1832
1833#ifdef DESKTOP_VERSION 1833#ifdef DESKTOP_VERSION
1834 config->setGroup("WidgetLayout"); 1834 config->setGroup("WidgetLayout");
1835 QStringList list; 1835 QStringList list;
1836 list = config->readListEntry("MainLayout"); 1836 list = config->readListEntry("MainLayout");
1837 int x,y,w,h; 1837 int x,y,w,h;
1838 if ( ! list.isEmpty() ) { 1838 if ( ! list.isEmpty() ) {
1839 x = list[0].toInt(); 1839 x = list[0].toInt();
1840 y = list[1].toInt(); 1840 y = list[1].toInt();
1841 w = list[2].toInt(); 1841 w = list[2].toInt();
1842 h = list[3].toInt(); 1842 h = list[3].toInt();
1843 topLevelWidget()->setGeometry(x,y,w,h); 1843 topLevelWidget()->setGeometry(x,y,w,h);
1844 1844
1845 } else { 1845 } else {
1846 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1846 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1847 } 1847 }
1848 list = config->readListEntry("EditEventLayout"); 1848 list = config->readListEntry("EditEventLayout");
1849 if ( ! list.isEmpty() ) { 1849 if ( ! list.isEmpty() ) {
1850 x = list[0].toInt(); 1850 x = list[0].toInt();
1851 y = list[1].toInt(); 1851 y = list[1].toInt();
1852 w = list[2].toInt(); 1852 w = list[2].toInt();
1853 h = list[3].toInt(); 1853 h = list[3].toInt();
1854 mEventEditor->setGeometry(x,y,w,h); 1854 mEventEditor->setGeometry(x,y,w,h);
1855 1855
1856 } 1856 }
1857 list = config->readListEntry("EditTodoLayout"); 1857 list = config->readListEntry("EditTodoLayout");
1858 if ( ! list.isEmpty() ) { 1858 if ( ! list.isEmpty() ) {
1859 x = list[0].toInt(); 1859 x = list[0].toInt();
1860 y = list[1].toInt(); 1860 y = list[1].toInt();
1861 w = list[2].toInt(); 1861 w = list[2].toInt();
1862 h = list[3].toInt(); 1862 h = list[3].toInt();
1863 mTodoEditor->setGeometry(x,y,w,h); 1863 mTodoEditor->setGeometry(x,y,w,h);
1864 1864
1865 } 1865 }
1866 list = config->readListEntry("ViewerLayout"); 1866 list = config->readListEntry("ViewerLayout");
1867 if ( ! list.isEmpty() ) { 1867 if ( ! list.isEmpty() ) {
1868 x = list[0].toInt(); 1868 x = list[0].toInt();
1869 y = list[1].toInt(); 1869 y = list[1].toInt();
1870 w = list[2].toInt(); 1870 w = list[2].toInt();
1871 h = list[3].toInt(); 1871 h = list[3].toInt();
1872 getEventViewerDialog()->setGeometry(x,y,w,h); 1872 getEventViewerDialog()->setGeometry(x,y,w,h);
1873 } 1873 }
1874#endif 1874#endif
1875 config->setGroup( "Views" ); 1875 config->setGroup( "Views" );
1876 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1876 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1877 1877
1878 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 1878 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
1879 1879
1880 int resetval = 0; 1880 int resetval = 0;
1881 int maxVal = 0; 1881 int maxVal = 0;
1882 if (sizes.count() != 3) { 1882 if (sizes.count() != 3) {
1883 if ( KOPrefs::instance()->mVerticalScreen ) { 1883 if ( KOPrefs::instance()->mVerticalScreen ) {
1884 resetval = mDateNavigator->sizeHint().width()+2; 1884 resetval = mDateNavigator->sizeHint().width()+2;
1885 } else { 1885 } else {
1886 resetval = mDateNavigator->sizeHint().height()+2; 1886 resetval = mDateNavigator->sizeHint().height()+2;
1887 } 1887 }
1888 } 1888 }
1889 if ( resetval ) { 1889 if ( resetval ) {
1890 sizes.clear(); 1890 sizes.clear();
1891 if ( KOPrefs::instance()->mVerticalScreen ) { 1891 if ( KOPrefs::instance()->mVerticalScreen ) {
1892 maxVal = QApplication::desktop()->width() -10; 1892 maxVal = QApplication::desktop()->width() -10;
1893 } else { 1893 } else {
1894 maxVal = QApplication::desktop()->height()-10; 1894 maxVal = QApplication::desktop()->height()-10;
1895 } 1895 }
1896 sizes << resetval; 1896 sizes << resetval;
1897 if ( maxVal < resetval + resetval) 1897 if ( maxVal < resetval + resetval)
1898 resetval = maxVal - resetval; 1898 resetval = maxVal - resetval;
1899 sizes << resetval; 1899 sizes << resetval;
1900 sizes << 100; 1900 sizes << 100;
1901 } 1901 }
1902 mLeftFrame->setSizes(sizes); 1902 mLeftFrame->setSizes(sizes);
1903 sizes = config->readIntListEntry("Main Splitter Frame"); 1903 sizes = config->readIntListEntry("Main Splitter Frame");
1904 resetval = 0; 1904 resetval = 0;
1905 maxVal = 0; 1905 maxVal = 0;
1906 if (sizes.count() != 2) { 1906 if (sizes.count() != 2) {
1907 if ( !KOPrefs::instance()->mVerticalScreen ) { 1907 if ( !KOPrefs::instance()->mVerticalScreen ) {
1908 resetval = mDateNavigator->sizeHint().width()+2; 1908 resetval = mDateNavigator->sizeHint().width()+2;
1909 } else { 1909 } else {
1910 resetval = mDateNavigator->sizeHint().height()+2; 1910 resetval = mDateNavigator->sizeHint().height()+2;
1911 } 1911 }
1912 } 1912 }
1913 if ( resetval ) { 1913 if ( resetval ) {
1914 sizes.clear(); 1914 sizes.clear();
1915 if ( !KOPrefs::instance()->mVerticalScreen ) { 1915 if ( !KOPrefs::instance()->mVerticalScreen ) {
1916 maxVal = QApplication::desktop()->width() -10; 1916 maxVal = QApplication::desktop()->width() -10;
1917 } else { 1917 } else {
1918 maxVal = QApplication::desktop()->height()-10; 1918 maxVal = QApplication::desktop()->height()-10;
1919 } 1919 }
1920 sizes << resetval; 1920 sizes << resetval;
1921 if ( maxVal < resetval + resetval) 1921 if ( maxVal < resetval + resetval)
1922 resetval = maxVal - resetval; 1922 resetval = maxVal - resetval;
1923 sizes << resetval; 1923 sizes << resetval;
1924 } 1924 }
1925 mMainFrame->setSizes(sizes); 1925 mMainFrame->setSizes(sizes);
1926 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1926 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1927 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1927 else if ( dateCount == 7 ) mNavigator->selectWeek();
1928 else mNavigator->selectDates( dateCount ); 1928 else mNavigator->selectDates( dateCount );
1929 // mViewManager->readSettings( config ); 1929 // mViewManager->readSettings( config );
1930 updateConfig(); 1930 updateConfig();
1931 globalFlagBlockAgenda = 2; 1931 globalFlagBlockAgenda = 2;
1932 mViewManager->readSettings( config ); 1932 mViewManager->readSettings( config );
1933 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 1933 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
1934} 1934}
1935 1935
1936 1936
1937void CalendarView::writeSettings() 1937void CalendarView::writeSettings()
1938{ 1938{
1939 // kdDebug() << "CalendarView::writeSettings" << endl; 1939 // kdDebug() << "CalendarView::writeSettings" << endl;
1940 1940
1941 KConfig *config = KOGlobals::config(); 1941 KConfig *config = KOGlobals::config();
1942 1942
1943 mViewManager->writeSettings( config ); 1943 mViewManager->writeSettings( config );
1944 mTodoList->saveLayout(config,QString("Todo Layout")); 1944 mTodoList->saveLayout(config,QString("Todo Layout"));
1945 mDialogManager->writeSettings( config ); 1945 mDialogManager->writeSettings( config );
1946 //KOPrefs::instance()->usrWriteConfig(); 1946 //KOPrefs::instance()->usrWriteConfig();
1947 KOPrefs::instance()->writeConfig(); 1947 KOPrefs::instance()->writeConfig();
1948 1948
1949 writeFilterSettings(config); 1949 writeFilterSettings(config);
1950 1950
1951 config->setGroup( "Views" ); 1951 config->setGroup( "Views" );
1952 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1952 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1953 1953
1954 QValueList<int> listINT = mLeftFrame->sizes(); 1954 QValueList<int> listINT = mLeftFrame->sizes();
1955 config->writeEntry("Left Splitter Frame",listINT); 1955 config->writeEntry("Left Splitter Frame",listINT);
1956 QValueList<int> listINT2 = mMainFrame->sizes(); 1956 QValueList<int> listINT2 = mMainFrame->sizes();
1957 config->writeEntry("Main Splitter Frame",listINT2); 1957 config->writeEntry("Main Splitter Frame",listINT2);
1958#ifdef DESKTOP_VERSION 1958#ifdef DESKTOP_VERSION
1959 config->setGroup("WidgetLayout"); 1959 config->setGroup("WidgetLayout");
1960 QStringList list ;//= config->readListEntry("MainLayout"); 1960 QStringList list ;//= config->readListEntry("MainLayout");
1961 int x,y,w,h; 1961 int x,y,w,h;
1962 QWidget* wid; 1962 QWidget* wid;
1963 wid = topLevelWidget(); 1963 wid = topLevelWidget();
1964 x = wid->geometry().x(); 1964 x = wid->geometry().x();
1965 y = wid->geometry().y(); 1965 y = wid->geometry().y();
1966 w = wid->width(); 1966 w = wid->width();
1967 h = wid->height(); 1967 h = wid->height();
1968 list.clear(); 1968 list.clear();
1969 list << QString::number( x ); 1969 list << QString::number( x );
1970 list << QString::number( y ); 1970 list << QString::number( y );
1971 list << QString::number( w ); 1971 list << QString::number( w );
1972 list << QString::number( h ); 1972 list << QString::number( h );
1973 config->writeEntry("MainLayout",list ); 1973 config->writeEntry("MainLayout",list );
1974 1974
1975 wid = mEventEditor; 1975 wid = mEventEditor;
1976 x = wid->geometry().x(); 1976 x = wid->geometry().x();
1977 y = wid->geometry().y(); 1977 y = wid->geometry().y();
1978 w = wid->width(); 1978 w = wid->width();
1979 h = wid->height(); 1979 h = wid->height();
1980 list.clear(); 1980 list.clear();
1981 list << QString::number( x ); 1981 list << QString::number( x );
1982 list << QString::number( y ); 1982 list << QString::number( y );
1983 list << QString::number( w ); 1983 list << QString::number( w );
1984 list << QString::number( h ); 1984 list << QString::number( h );
1985 config->writeEntry("EditEventLayout",list ); 1985 config->writeEntry("EditEventLayout",list );
1986 1986
1987 wid = mTodoEditor; 1987 wid = mTodoEditor;
1988 x = wid->geometry().x(); 1988 x = wid->geometry().x();
1989 y = wid->geometry().y(); 1989 y = wid->geometry().y();
1990 w = wid->width(); 1990 w = wid->width();
1991 h = wid->height(); 1991 h = wid->height();
1992 list.clear(); 1992 list.clear();
1993 list << QString::number( x ); 1993 list << QString::number( x );
1994 list << QString::number( y ); 1994 list << QString::number( y );
1995 list << QString::number( w ); 1995 list << QString::number( w );
1996 list << QString::number( h ); 1996 list << QString::number( h );
1997 config->writeEntry("EditTodoLayout",list ); 1997 config->writeEntry("EditTodoLayout",list );
1998 wid = getEventViewerDialog(); 1998 wid = getEventViewerDialog();
1999 x = wid->geometry().x(); 1999 x = wid->geometry().x();
2000 y = wid->geometry().y(); 2000 y = wid->geometry().y();
2001 w = wid->width(); 2001 w = wid->width();
2002 h = wid->height(); 2002 h = wid->height();
2003 list.clear(); 2003 list.clear();
2004 list << QString::number( x ); 2004 list << QString::number( x );
2005 list << QString::number( y ); 2005 list << QString::number( y );
2006 list << QString::number( w ); 2006 list << QString::number( w );
2007 list << QString::number( h ); 2007 list << QString::number( h );
2008 config->writeEntry("ViewerLayout",list ); 2008 config->writeEntry("ViewerLayout",list );
2009 wid = mDialogManager->getSearchDialog(); 2009 wid = mDialogManager->getSearchDialog();
2010 if ( wid ) { 2010 if ( wid ) {
2011 x = wid->geometry().x(); 2011 x = wid->geometry().x();
2012 y = wid->geometry().y(); 2012 y = wid->geometry().y();
2013 w = wid->width(); 2013 w = wid->width();
2014 h = wid->height(); 2014 h = wid->height();
2015 list.clear(); 2015 list.clear();
2016 list << QString::number( x ); 2016 list << QString::number( x );
2017 list << QString::number( y ); 2017 list << QString::number( y );
2018 list << QString::number( w ); 2018 list << QString::number( w );
2019 list << QString::number( h ); 2019 list << QString::number( h );
2020 config->writeEntry("SearchLayout",list ); 2020 config->writeEntry("SearchLayout",list );
2021 } 2021 }
2022#endif 2022#endif
2023 2023
2024 2024
2025 config->sync(); 2025 config->sync();
2026} 2026}
2027 2027
2028void CalendarView::readFilterSettings(KConfig *config) 2028void CalendarView::readFilterSettings(KConfig *config)
2029{ 2029{
2030 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2030 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2031 2031
2032 mFilters.clear(); 2032 mFilters.clear();
2033 2033
2034 config->setGroup("General"); 2034 config->setGroup("General");
2035 QStringList filterList = config->readListEntry("CalendarFilters"); 2035 QStringList filterList = config->readListEntry("CalendarFilters");
2036 2036
2037 QStringList::ConstIterator it = filterList.begin(); 2037 QStringList::ConstIterator it = filterList.begin();
2038 QStringList::ConstIterator end = filterList.end(); 2038 QStringList::ConstIterator end = filterList.end();
2039 while(it != end) { 2039 while(it != end) {
2040 // kdDebug() << " filter: " << (*it) << endl; 2040 // kdDebug() << " filter: " << (*it) << endl;
2041 2041
2042 CalFilter *filter; 2042 CalFilter *filter;
2043 filter = new CalFilter(*it); 2043 filter = new CalFilter(*it);
2044 config->setGroup("Filter_" + (*it)); 2044 config->setGroup("Filter_" + (*it).utf8());
2045 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2045 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2046 filter->setCriteria(config->readNumEntry("Criteria",0)); 2046 filter->setCriteria(config->readNumEntry("Criteria",0));
2047 filter->setCategoryList(config->readListEntry("CategoryList")); 2047 filter->setCategoryList(config->readListEntry("CategoryList"));
2048 mFilters.append(filter); 2048 mFilters.append(filter);
2049 2049
2050 ++it; 2050 ++it;
2051 } 2051 }
2052 2052
2053 if (mFilters.count() == 0) { 2053 if (mFilters.count() == 0) {
2054 CalFilter *filter = new CalFilter(i18n("Default")); 2054 CalFilter *filter = new CalFilter(i18n("Default"));
2055 mFilters.append(filter); 2055 mFilters.append(filter);
2056 } 2056 }
2057 mFilterView->updateFilters(); 2057 mFilterView->updateFilters();
2058 config->setGroup("FilterView"); 2058 config->setGroup("FilterView");
2059 2059
2060 mFilterView->blockSignals(true); 2060 mFilterView->blockSignals(true);
2061 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2061 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2062 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2062 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2063 mFilterView->blockSignals(false); 2063 mFilterView->blockSignals(false);
2064 // We do it manually to avoid it being done twice by the above calls 2064 // We do it manually to avoid it being done twice by the above calls
2065 updateFilter(); 2065 updateFilter();
2066} 2066}
2067 2067
2068void CalendarView::writeFilterSettings(KConfig *config) 2068void CalendarView::writeFilterSettings(KConfig *config)
2069{ 2069{
2070 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2070 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2071 2071
2072 QStringList filterList; 2072 QStringList filterList;
2073 2073
2074 CalFilter *filter = mFilters.first(); 2074 CalFilter *filter = mFilters.first();
2075 while(filter) { 2075 while(filter) {
2076 // kdDebug() << " fn: " << filter->name() << endl; 2076 // kdDebug() << " fn: " << filter->name() << endl;
2077 filterList << filter->name(); 2077 filterList << filter->name();
2078 config->setGroup("Filter_" + filter->name()); 2078 config->setGroup("Filter_" + filter->name().utf8());
2079 config->writeEntry("Criteria",filter->criteria()); 2079 config->writeEntry("Criteria",filter->criteria());
2080 config->writeEntry("CategoryList",filter->categoryList()); 2080 config->writeEntry("CategoryList",filter->categoryList());
2081 filter = mFilters.next(); 2081 filter = mFilters.next();
2082 } 2082 }
2083 config->setGroup("General"); 2083 config->setGroup("General");
2084 config->writeEntry("CalendarFilters",filterList); 2084 config->writeEntry("CalendarFilters",filterList);
2085 2085
2086 config->setGroup("FilterView"); 2086 config->setGroup("FilterView");
2087 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2087 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2088 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2088 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2089} 2089}
2090 2090
2091 2091
2092void CalendarView::goToday() 2092void CalendarView::goToday()
2093{ 2093{
2094 if ( mViewManager->currentView()->isMonthView() ) 2094 if ( mViewManager->currentView()->isMonthView() )
2095 mNavigator->selectTodayMonth(); 2095 mNavigator->selectTodayMonth();
2096 else 2096 else
2097 mNavigator->selectToday(); 2097 mNavigator->selectToday();
2098} 2098}
2099 2099
2100void CalendarView::goNext() 2100void CalendarView::goNext()
2101{ 2101{
2102 mNavigator->selectNext(); 2102 mNavigator->selectNext();
2103} 2103}
2104 2104
2105void CalendarView::goPrevious() 2105void CalendarView::goPrevious()
2106{ 2106{
2107 mNavigator->selectPrevious(); 2107 mNavigator->selectPrevious();
2108} 2108}
2109void CalendarView::goNextMonth() 2109void CalendarView::goNextMonth()
2110{ 2110{
2111 mNavigator->selectNextMonth(); 2111 mNavigator->selectNextMonth();
2112} 2112}
2113 2113
2114void CalendarView::goPreviousMonth() 2114void CalendarView::goPreviousMonth()
2115{ 2115{
2116 mNavigator->selectPreviousMonth(); 2116 mNavigator->selectPreviousMonth();
2117} 2117}
2118void CalendarView::writeLocale() 2118void CalendarView::writeLocale()
2119{ 2119{
2120 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2120 //KPimGlobalPrefs::instance()->setGlobalConfig();
2121#if 0 2121#if 0
2122 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2122 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2123 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2123 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2124 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2124 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2125 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2125 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2126 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2126 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2127 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2127 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2128 dummy = KOPrefs::instance()->mUserDateFormatShort; 2128 dummy = KOPrefs::instance()->mUserDateFormatShort;
2129 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2129 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2130 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2130 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2131 KOPrefs::instance()->mDaylightsavingStart, 2131 KOPrefs::instance()->mDaylightsavingStart,
2132 KOPrefs::instance()->mDaylightsavingEnd ); 2132 KOPrefs::instance()->mDaylightsavingEnd );
2133 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2133 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2134#endif 2134#endif
2135} 2135}
2136void CalendarView::updateConfig() 2136void CalendarView::updateConfig()
2137{ 2137{
2138 writeLocale(); 2138 writeLocale();
2139 if ( KOPrefs::instance()->mUseAppColors ) 2139 if ( KOPrefs::instance()->mUseAppColors )
2140 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2140 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2141 emit configChanged(); 2141 emit configChanged();
2142 mTodoList->updateConfig(); 2142 mTodoList->updateConfig();
2143 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2143 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2144 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2144 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2145 // To make the "fill window" configurations work 2145 // To make the "fill window" configurations work
2146 //mViewManager->raiseCurrentView(); 2146 //mViewManager->raiseCurrentView();
2147} 2147}
2148 2148
2149 2149
2150void CalendarView::eventChanged(Event *event) 2150void CalendarView::eventChanged(Event *event)
2151{ 2151{
2152 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2152 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2153 //updateUnmanagedViews(); 2153 //updateUnmanagedViews();
2154} 2154}
2155 2155
2156void CalendarView::eventAdded(Event *event) 2156void CalendarView::eventAdded(Event *event)
2157{ 2157{
2158 changeEventDisplay(event,KOGlobals::EVENTADDED); 2158 changeEventDisplay(event,KOGlobals::EVENTADDED);
2159} 2159}
2160 2160
2161void CalendarView::eventToBeDeleted(Event *) 2161void CalendarView::eventToBeDeleted(Event *)
2162{ 2162{
2163 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2163 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2164} 2164}
2165 2165
2166void CalendarView::eventDeleted() 2166void CalendarView::eventDeleted()
2167{ 2167{
2168 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2168 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2169} 2169}
2170void CalendarView::changeTodoDisplay(Todo *which, int action) 2170void CalendarView::changeTodoDisplay(Todo *which, int action)
2171{ 2171{
2172 changeIncidenceDisplay((Incidence *)which, action); 2172 changeIncidenceDisplay((Incidence *)which, action);
2173 mDateNavigator->updateView(); //LR 2173 mDateNavigator->updateView(); //LR
2174 //mDialogManager->updateSearchDialog(); 2174 //mDialogManager->updateSearchDialog();
2175 2175
2176 if (which) { 2176 if (which) {
2177 mViewManager->updateWNview(); 2177 mViewManager->updateWNview();
2178 //mTodoList->updateView(); 2178 //mTodoList->updateView();
2179 } 2179 }
2180 2180
2181} 2181}
2182 2182
2183void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2183void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2184{ 2184{
2185 updateUnmanagedViews(); 2185 updateUnmanagedViews();
2186 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2186 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2187 if ( action == KOGlobals::EVENTDELETED ) { //delete 2187 if ( action == KOGlobals::EVENTDELETED ) { //delete
2188 mCalendar->checkAlarmForIncidence( 0, true ); 2188 mCalendar->checkAlarmForIncidence( 0, true );
2189 if ( mEventViewerDialog ) 2189 if ( mEventViewerDialog )
2190 mEventViewerDialog->hide(); 2190 mEventViewerDialog->hide();
2191 } 2191 }
2192 else 2192 else
2193 mCalendar->checkAlarmForIncidence( which , false ); 2193 mCalendar->checkAlarmForIncidence( which , false );
2194} 2194}
2195 2195
2196// most of the changeEventDisplays() right now just call the view's 2196// most of the changeEventDisplays() right now just call the view's
2197// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2197// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2198void CalendarView::changeEventDisplay(Event *which, int action) 2198void CalendarView::changeEventDisplay(Event *which, int action)
2199{ 2199{
2200 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2200 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2201 changeIncidenceDisplay((Incidence *)which, action); 2201 changeIncidenceDisplay((Incidence *)which, action);
2202 mDateNavigator->updateView(); 2202 mDateNavigator->updateView();
2203 //mDialogManager->updateSearchDialog(); 2203 //mDialogManager->updateSearchDialog();
2204 2204
2205 if (which) { 2205 if (which) {
2206 // If there is an event view visible update the display 2206 // If there is an event view visible update the display
2207 mViewManager->currentView()->changeEventDisplay(which,action); 2207 mViewManager->currentView()->changeEventDisplay(which,action);
2208 // TODO: check, if update needed 2208 // TODO: check, if update needed
2209 // if (which->getTodoStatus()) { 2209 // if (which->getTodoStatus()) {
2210 mTodoList->updateView(); 2210 mTodoList->updateView();
2211 // } 2211 // }
2212 } else { 2212 } else {
2213 mViewManager->currentView()->updateView(); 2213 mViewManager->currentView()->updateView();
2214 } 2214 }
2215} 2215}
2216 2216
2217 2217
2218void CalendarView::updateTodoViews() 2218void CalendarView::updateTodoViews()
2219{ 2219{
2220 mTodoList->updateView(); 2220 mTodoList->updateView();
2221 mViewManager->currentView()->updateView(); 2221 mViewManager->currentView()->updateView();
2222 2222
2223} 2223}
2224 2224
2225 2225
2226void CalendarView::updateView(const QDate &start, const QDate &end) 2226void CalendarView::updateView(const QDate &start, const QDate &end)
2227{ 2227{
2228 mTodoList->updateView(); 2228 mTodoList->updateView();
2229 mViewManager->updateView(start, end); 2229 mViewManager->updateView(start, end);
2230 //mDateNavigator->updateView(); 2230 //mDateNavigator->updateView();
2231} 2231}
2232 2232
2233void CalendarView::updateView() 2233void CalendarView::updateView()
2234{ 2234{
2235 DateList tmpList = mNavigator->selectedDates(); 2235 DateList tmpList = mNavigator->selectedDates();
2236 2236
2237 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2237 if ( KOPrefs::instance()->mHideNonStartedTodos )
2238 mTodoList->updateView(); 2238 mTodoList->updateView();
2239 // We assume that the navigator only selects consecutive days. 2239 // We assume that the navigator only selects consecutive days.
2240 updateView( tmpList.first(), tmpList.last() ); 2240 updateView( tmpList.first(), tmpList.last() );
2241} 2241}
2242 2242
2243void CalendarView::updateUnmanagedViews() 2243void CalendarView::updateUnmanagedViews()
2244{ 2244{
2245 mDateNavigator->updateDayMatrix(); 2245 mDateNavigator->updateDayMatrix();
2246} 2246}
2247 2247
2248int CalendarView::msgItemDelete(const QString name) 2248int CalendarView::msgItemDelete(const QString name)
2249{ 2249{
2250 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2250 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2251 i18n("This item will be\npermanently deleted."), 2251 i18n("This item will be\npermanently deleted."),
2252 i18n("KO/Pi Confirmation"),i18n("Delete")); 2252 i18n("KO/Pi Confirmation"),i18n("Delete"));
2253} 2253}
2254 2254
2255 2255
2256void CalendarView::edit_cut() 2256void CalendarView::edit_cut()
2257{ 2257{
2258 Event *anEvent=0; 2258 Event *anEvent=0;
2259 2259
2260 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2260 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2261 2261
2262 if (mViewManager->currentView()->isEventView()) { 2262 if (mViewManager->currentView()->isEventView()) {
2263 if ( incidence && incidence->type() == "Event" ) { 2263 if ( incidence && incidence->type() == "Event" ) {
2264 anEvent = static_cast<Event *>(incidence); 2264 anEvent = static_cast<Event *>(incidence);
2265 } 2265 }
2266 } 2266 }
2267 2267
2268 if (!anEvent) { 2268 if (!anEvent) {
2269 KNotifyClient::beep(); 2269 KNotifyClient::beep();
2270 return; 2270 return;
2271 } 2271 }
2272 DndFactory factory( mCalendar ); 2272 DndFactory factory( mCalendar );
2273 factory.cutIncidence(anEvent); 2273 factory.cutIncidence(anEvent);
2274 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2274 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2275} 2275}
2276 2276
2277void CalendarView::edit_copy() 2277void CalendarView::edit_copy()
2278{ 2278{
2279 Event *anEvent=0; 2279 Event *anEvent=0;
2280 2280
2281 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2281 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2282 2282
2283 if (mViewManager->currentView()->isEventView()) { 2283 if (mViewManager->currentView()->isEventView()) {
2284 if ( incidence && incidence->type() == "Event" ) { 2284 if ( incidence && incidence->type() == "Event" ) {
2285 anEvent = static_cast<Event *>(incidence); 2285 anEvent = static_cast<Event *>(incidence);
2286 } 2286 }
2287 } 2287 }
2288 2288
2289 if (!anEvent) { 2289 if (!anEvent) {
2290 KNotifyClient::beep(); 2290 KNotifyClient::beep();
2291 return; 2291 return;
2292 } 2292 }
2293 DndFactory factory( mCalendar ); 2293 DndFactory factory( mCalendar );
2294 factory.copyIncidence(anEvent); 2294 factory.copyIncidence(anEvent);
2295} 2295}
2296 2296
2297void CalendarView::edit_paste() 2297void CalendarView::edit_paste()
2298{ 2298{
2299 QDate date = mNavigator->selectedDates().first(); 2299 QDate date = mNavigator->selectedDates().first();
2300 2300
2301 DndFactory factory( mCalendar ); 2301 DndFactory factory( mCalendar );
2302 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2302 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2303 2303
2304 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2304 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2305} 2305}
2306 2306
2307void CalendarView::edit_options() 2307void CalendarView::edit_options()
2308{ 2308{
2309 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2309 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2310 emit save(); 2310 emit save();
2311 emit saveStopTimer(); 2311 emit saveStopTimer();
2312 mDialogManager->showOptionsDialog(); 2312 mDialogManager->showOptionsDialog();
2313 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2313 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2314 emit saveStopTimer(); 2314 emit saveStopTimer();
2315 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2315 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2316 i18n("Timezone settings"),i18n("Reload"))) { 2316 i18n("Timezone settings"),i18n("Reload"))) {
2317 qDebug("KO: TZ reload cancelled "); 2317 qDebug("KO: TZ reload cancelled ");
2318 return; 2318 return;
2319 } 2319 }
2320 qDebug("KO: Timezone change "); 2320 qDebug("KO: Timezone change ");
2321 openCalendar( MainWindow::defaultFileName() ); 2321 openCalendar( MainWindow::defaultFileName() );
2322 setModified(true); 2322 setModified(true);
2323 } 2323 }
2324 else 2324 else
2325 qDebug("KO: No tz change "); 2325 qDebug("KO: No tz change ");
2326 2326
2327} 2327}
2328 2328
2329 2329
2330void CalendarView::slotSelectPickerDate( QDate d) 2330void CalendarView::slotSelectPickerDate( QDate d)
2331{ 2331{
2332 mDateFrame->hide(); 2332 mDateFrame->hide();
2333 if ( mDatePickerMode == 1 ) { 2333 if ( mDatePickerMode == 1 ) {
2334 mNavigator->slotDaySelect( d ); 2334 mNavigator->slotDaySelect( d );