-rw-r--r-- | korganizer/calendarview.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9acbbb1..3ce123c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1822,215 +1822,205 @@ void CalendarView::readSettings() | |||
1822 | config->setGroup( "Views" ); | 1822 | config->setGroup( "Views" ); |
1823 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1823 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1824 | 1824 | ||
1825 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 1825 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
1826 | 1826 | ||
1827 | int resetval = 0; | 1827 | int resetval = 0; |
1828 | int maxVal = 0; | 1828 | int maxVal = 0; |
1829 | if (sizes.count() != 3) { | 1829 | if (sizes.count() != 3) { |
1830 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1830 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1831 | resetval = mDateNavigator->sizeHint().width()+2; | 1831 | resetval = mDateNavigator->sizeHint().width()+2; |
1832 | } else { | 1832 | } else { |
1833 | resetval = mDateNavigator->sizeHint().height()+2; | 1833 | resetval = mDateNavigator->sizeHint().height()+2; |
1834 | } | 1834 | } |
1835 | } | 1835 | } |
1836 | if ( !resetval ){// i.e. sizes.count() == 3 | 1836 | if ( !resetval ){// i.e. sizes.count() == 3 |
1837 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1837 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1838 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | 1838 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) |
1839 | resetval = mDateNavigator->sizeHint().width()+2; | 1839 | resetval = mDateNavigator->sizeHint().width()+2; |
1840 | } else { | 1840 | } else { |
1841 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | 1841 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) |
1842 | resetval = mDateNavigator->sizeHint().height()+2; | 1842 | resetval = mDateNavigator->sizeHint().height()+2; |
1843 | } | 1843 | } |
1844 | } | 1844 | } |
1845 | if ( resetval ) { | 1845 | if ( resetval ) { |
1846 | sizes.clear(); | 1846 | sizes.clear(); |
1847 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1847 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1848 | maxVal = QApplication::desktop()->width() -10; | 1848 | maxVal = QApplication::desktop()->width() -10; |
1849 | } else { | 1849 | } else { |
1850 | maxVal = QApplication::desktop()->height()-10; | 1850 | maxVal = QApplication::desktop()->height()-10; |
1851 | } | 1851 | } |
1852 | sizes << resetval; | 1852 | sizes << resetval; |
1853 | if ( maxVal < resetval + resetval) | 1853 | if ( maxVal < resetval + resetval) |
1854 | resetval = maxVal - resetval; | 1854 | resetval = maxVal - resetval; |
1855 | sizes << resetval; | 1855 | sizes << resetval; |
1856 | sizes << 100; | 1856 | sizes << 100; |
1857 | } | 1857 | } |
1858 | mLeftFrame->setSizes(sizes); | 1858 | mLeftFrame->setSizes(sizes); |
1859 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1859 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1860 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1860 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1861 | else mNavigator->selectDates( dateCount ); | 1861 | else mNavigator->selectDates( dateCount ); |
1862 | // mViewManager->readSettings( config ); | 1862 | // mViewManager->readSettings( config ); |
1863 | updateConfig(); | 1863 | updateConfig(); |
1864 | globalFlagBlockAgenda = 2; | 1864 | globalFlagBlockAgenda = 2; |
1865 | mViewManager->readSettings( config ); | 1865 | mViewManager->readSettings( config ); |
1866 | #ifdef DESKTOP_VERSION | 1866 | #ifdef DESKTOP_VERSION |
1867 | config->setGroup("WidgetLayout"); | 1867 | config->setGroup("WidgetLayout"); |
1868 | QStringList list; | 1868 | QStringList list; |
1869 | list = config->readListEntry("MainLayout"); | 1869 | list = config->readListEntry("MainLayout"); |
1870 | int x,y,w,h; | 1870 | int x,y,w,h; |
1871 | if ( ! list.isEmpty() ) { | 1871 | if ( ! list.isEmpty() ) { |
1872 | x = list[0].toInt(); | 1872 | x = list[0].toInt(); |
1873 | y = list[1].toInt(); | 1873 | y = list[1].toInt(); |
1874 | w = list[2].toInt(); | 1874 | w = list[2].toInt(); |
1875 | h = list[3].toInt(); | 1875 | h = list[3].toInt(); |
1876 | topLevelWidget()->setGeometry(x,y,w,h); | 1876 | topLevelWidget()->setGeometry(x,y,w,h); |
1877 | 1877 | ||
1878 | } else { | 1878 | } else { |
1879 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1879 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1880 | } | 1880 | } |
1881 | list = config->readListEntry("EditEventLayout"); | 1881 | list = config->readListEntry("EditEventLayout"); |
1882 | if ( ! list.isEmpty() ) { | 1882 | if ( ! list.isEmpty() ) { |
1883 | x = list[0].toInt(); | 1883 | x = list[0].toInt(); |
1884 | y = list[1].toInt(); | 1884 | y = list[1].toInt(); |
1885 | w = list[2].toInt(); | 1885 | w = list[2].toInt(); |
1886 | h = list[3].toInt(); | 1886 | h = list[3].toInt(); |
1887 | mEventEditor->setGeometry(x,y,w,h); | 1887 | mEventEditor->setGeometry(x,y,w,h); |
1888 | 1888 | ||
1889 | } | 1889 | } |
1890 | list = config->readListEntry("EditTodoLayout"); | 1890 | list = config->readListEntry("EditTodoLayout"); |
1891 | if ( ! list.isEmpty() ) { | 1891 | if ( ! list.isEmpty() ) { |
1892 | x = list[0].toInt(); | 1892 | x = list[0].toInt(); |
1893 | y = list[1].toInt(); | 1893 | y = list[1].toInt(); |
1894 | w = list[2].toInt(); | 1894 | w = list[2].toInt(); |
1895 | h = list[3].toInt(); | 1895 | h = list[3].toInt(); |
1896 | mTodoEditor->setGeometry(x,y,w,h); | 1896 | mTodoEditor->setGeometry(x,y,w,h); |
1897 | 1897 | ||
1898 | } | 1898 | } |
1899 | list = config->readListEntry("ViewerLayout"); | 1899 | list = config->readListEntry("ViewerLayout"); |
1900 | if ( ! list.isEmpty() ) { | 1900 | if ( ! list.isEmpty() ) { |
1901 | x = list[0].toInt(); | 1901 | x = list[0].toInt(); |
1902 | y = list[1].toInt(); | 1902 | y = list[1].toInt(); |
1903 | w = list[2].toInt(); | 1903 | w = list[2].toInt(); |
1904 | h = list[3].toInt(); | 1904 | h = list[3].toInt(); |
1905 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1905 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1906 | } | 1906 | } |
1907 | #endif | 1907 | #endif |
1908 | 1908 | ||
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | 1911 | ||
1912 | void CalendarView::writeSettings() | 1912 | void CalendarView::writeSettings() |
1913 | { | 1913 | { |
1914 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1914 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1915 | 1915 | ||
1916 | KConfig *config = KOGlobals::config(); | 1916 | KConfig *config = KOGlobals::config(); |
1917 | 1917 | ||
1918 | #ifndef KORG_NOSPLITTER | ||
1919 | config->setGroup("KOrganizer Geometry"); | ||
1920 | |||
1921 | QValueList<int> list = mPanner->sizes(); | ||
1922 | config->writeEntry("Separator1",list); | ||
1923 | |||
1924 | list = mLeftSplitter->sizes(); | ||
1925 | config->writeEntry("Separator2",list); | ||
1926 | #endif | ||
1927 | |||
1928 | mViewManager->writeSettings( config ); | 1918 | mViewManager->writeSettings( config ); |
1929 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1919 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1930 | mDialogManager->writeSettings( config ); | 1920 | mDialogManager->writeSettings( config ); |
1931 | //KOPrefs::instance()->usrWriteConfig(); | 1921 | //KOPrefs::instance()->usrWriteConfig(); |
1932 | KOPrefs::instance()->writeConfig(); | 1922 | KOPrefs::instance()->writeConfig(); |
1933 | 1923 | ||
1934 | writeFilterSettings(config); | 1924 | writeFilterSettings(config); |
1935 | 1925 | ||
1936 | config->setGroup( "Views" ); | 1926 | config->setGroup( "Views" ); |
1937 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1927 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1938 | 1928 | ||
1939 | QValueList<int> list = mLeftFrame->sizes(); | 1929 | QValueList<int> listINT = mLeftFrame->sizes(); |
1940 | config->writeEntry("Left Splitter Frame",list); | 1930 | config->writeEntry("Left Splitter Frame",listINT); |
1941 | 1931 | ||
1942 | #ifdef DESKTOP_VERSION | 1932 | #ifdef DESKTOP_VERSION |
1943 | config->setGroup("WidgetLayout"); | 1933 | config->setGroup("WidgetLayout"); |
1944 | QStringList list ;//= config->readListEntry("MainLayout"); | 1934 | QStringList list ;//= config->readListEntry("MainLayout"); |
1945 | int x,y,w,h; | 1935 | int x,y,w,h; |
1946 | QWidget* wid; | 1936 | QWidget* wid; |
1947 | wid = topLevelWidget(); | 1937 | wid = topLevelWidget(); |
1948 | x = wid->geometry().x(); | 1938 | x = wid->geometry().x(); |
1949 | y = wid->geometry().y(); | 1939 | y = wid->geometry().y(); |
1950 | w = wid->width(); | 1940 | w = wid->width(); |
1951 | h = wid->height(); | 1941 | h = wid->height(); |
1952 | list.clear(); | 1942 | list.clear(); |
1953 | list << QString::number( x ); | 1943 | list << QString::number( x ); |
1954 | list << QString::number( y ); | 1944 | list << QString::number( y ); |
1955 | list << QString::number( w ); | 1945 | list << QString::number( w ); |
1956 | list << QString::number( h ); | 1946 | list << QString::number( h ); |
1957 | config->writeEntry("MainLayout",list ); | 1947 | config->writeEntry("MainLayout",list ); |
1958 | 1948 | ||
1959 | wid = mEventEditor; | 1949 | wid = mEventEditor; |
1960 | x = wid->geometry().x(); | 1950 | x = wid->geometry().x(); |
1961 | y = wid->geometry().y(); | 1951 | y = wid->geometry().y(); |
1962 | w = wid->width(); | 1952 | w = wid->width(); |
1963 | h = wid->height(); | 1953 | h = wid->height(); |
1964 | list.clear(); | 1954 | list.clear(); |
1965 | list << QString::number( x ); | 1955 | list << QString::number( x ); |
1966 | list << QString::number( y ); | 1956 | list << QString::number( y ); |
1967 | list << QString::number( w ); | 1957 | list << QString::number( w ); |
1968 | list << QString::number( h ); | 1958 | list << QString::number( h ); |
1969 | config->writeEntry("EditEventLayout",list ); | 1959 | config->writeEntry("EditEventLayout",list ); |
1970 | 1960 | ||
1971 | wid = mTodoEditor; | 1961 | wid = mTodoEditor; |
1972 | x = wid->geometry().x(); | 1962 | x = wid->geometry().x(); |
1973 | y = wid->geometry().y(); | 1963 | y = wid->geometry().y(); |
1974 | w = wid->width(); | 1964 | w = wid->width(); |
1975 | h = wid->height(); | 1965 | h = wid->height(); |
1976 | list.clear(); | 1966 | list.clear(); |
1977 | list << QString::number( x ); | 1967 | list << QString::number( x ); |
1978 | list << QString::number( y ); | 1968 | list << QString::number( y ); |
1979 | list << QString::number( w ); | 1969 | list << QString::number( w ); |
1980 | list << QString::number( h ); | 1970 | list << QString::number( h ); |
1981 | config->writeEntry("EditTodoLayout",list ); | 1971 | config->writeEntry("EditTodoLayout",list ); |
1982 | wid = getEventViewerDialog(); | 1972 | wid = getEventViewerDialog(); |
1983 | x = wid->geometry().x(); | 1973 | x = wid->geometry().x(); |
1984 | y = wid->geometry().y(); | 1974 | y = wid->geometry().y(); |
1985 | w = wid->width(); | 1975 | w = wid->width(); |
1986 | h = wid->height(); | 1976 | h = wid->height(); |
1987 | list.clear(); | 1977 | list.clear(); |
1988 | list << QString::number( x ); | 1978 | list << QString::number( x ); |
1989 | list << QString::number( y ); | 1979 | list << QString::number( y ); |
1990 | list << QString::number( w ); | 1980 | list << QString::number( w ); |
1991 | list << QString::number( h ); | 1981 | list << QString::number( h ); |
1992 | config->writeEntry("ViewerLayout",list ); | 1982 | config->writeEntry("ViewerLayout",list ); |
1993 | wid = mDialogManager->getSearchDialog(); | 1983 | wid = mDialogManager->getSearchDialog(); |
1994 | if ( wid ) { | 1984 | if ( wid ) { |
1995 | x = wid->geometry().x(); | 1985 | x = wid->geometry().x(); |
1996 | y = wid->geometry().y(); | 1986 | y = wid->geometry().y(); |
1997 | w = wid->width(); | 1987 | w = wid->width(); |
1998 | h = wid->height(); | 1988 | h = wid->height(); |
1999 | list.clear(); | 1989 | list.clear(); |
2000 | list << QString::number( x ); | 1990 | list << QString::number( x ); |
2001 | list << QString::number( y ); | 1991 | list << QString::number( y ); |
2002 | list << QString::number( w ); | 1992 | list << QString::number( w ); |
2003 | list << QString::number( h ); | 1993 | list << QString::number( h ); |
2004 | config->writeEntry("SearchLayout",list ); | 1994 | config->writeEntry("SearchLayout",list ); |
2005 | } | 1995 | } |
2006 | #endif | 1996 | #endif |
2007 | 1997 | ||
2008 | 1998 | ||
2009 | config->sync(); | 1999 | config->sync(); |
2010 | } | 2000 | } |
2011 | 2001 | ||
2012 | void CalendarView::readFilterSettings(KConfig *config) | 2002 | void CalendarView::readFilterSettings(KConfig *config) |
2013 | { | 2003 | { |
2014 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2004 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2015 | 2005 | ||
2016 | mFilters.clear(); | 2006 | mFilters.clear(); |
2017 | 2007 | ||
2018 | config->setGroup("General"); | 2008 | config->setGroup("General"); |
2019 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2009 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2020 | 2010 | ||
2021 | QStringList::ConstIterator it = filterList.begin(); | 2011 | QStringList::ConstIterator it = filterList.begin(); |
2022 | QStringList::ConstIterator end = filterList.end(); | 2012 | QStringList::ConstIterator end = filterList.end(); |
2023 | while(it != end) { | 2013 | while(it != end) { |
2024 | // kdDebug() << " filter: " << (*it) << endl; | 2014 | // kdDebug() << " filter: " << (*it) << endl; |
2025 | 2015 | ||
2026 | CalFilter *filter; | 2016 | CalFilter *filter; |
2027 | filter = new CalFilter(*it); | 2017 | filter = new CalFilter(*it); |
2028 | config->setGroup("Filter_" + (*it)); | 2018 | config->setGroup("Filter_" + (*it)); |
2029 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2019 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2030 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2020 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2031 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2021 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2032 | mFilters.append(filter); | 2022 | mFilters.append(filter); |
2033 | 2023 | ||
2034 | ++it; | 2024 | ++it; |
2035 | } | 2025 | } |
2036 | 2026 | ||