author | zautrix <zautrix> | 2005-03-20 10:57:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-20 10:57:02 (UTC) |
commit | 289dd44f4f23d92c45d8f28c867a14a980fd5dde (patch) (unidiff) | |
tree | 0c27baeb80e563e191da2a75ce3b79bfeaeec051 | |
parent | 1ebfa83d28d9eb3f48d8240e65212bbe22defb3c (diff) | |
download | kdepimpi-289dd44f4f23d92c45d8f28c867a14a980fd5dde.zip kdepimpi-289dd44f4f23d92c45d8f28c867a14a980fd5dde.tar.gz kdepimpi-289dd44f4f23d92c45d8f28c867a14a980fd5dde.tar.bz2 |
compile fix
-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 | |||
@@ -1726,407 +1726,397 @@ bool CalendarView::checkFileVersion(QString fn) | |||
1726 | if ( dt <= loadedFileVersion ) | 1726 | if ( dt <= loadedFileVersion ) |
1727 | return true; | 1727 | return true; |
1728 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1728 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1729 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1729 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1730 | i18n("Sync+save")); | 1730 | i18n("Sync+save")); |
1731 | 1731 | ||
1732 | if ( km == KMessageBox::Cancel ) | 1732 | if ( km == KMessageBox::Cancel ) |
1733 | return false; | 1733 | return false; |
1734 | if ( km == KMessageBox::Yes ) | 1734 | if ( km == KMessageBox::Yes ) |
1735 | return true; | 1735 | return true; |
1736 | 1736 | ||
1737 | setSyncDevice("deleteaftersync" ); | 1737 | setSyncDevice("deleteaftersync" ); |
1738 | mSyncManager->mAskForPreferences = true; | 1738 | mSyncManager->mAskForPreferences = true; |
1739 | mSyncManager->mSyncAlgoPrefs = 3; | 1739 | mSyncManager->mSyncAlgoPrefs = 3; |
1740 | mSyncManager->mWriteBackFile = false; | 1740 | mSyncManager->mWriteBackFile = false; |
1741 | mSyncManager->mWriteBackExistingOnly = false; | 1741 | mSyncManager->mWriteBackExistingOnly = false; |
1742 | mSyncManager->mShowSyncSummary = false; | 1742 | mSyncManager->mShowSyncSummary = false; |
1743 | syncCalendar( fn, 3 ); | 1743 | syncCalendar( fn, 3 ); |
1744 | Event * e = getLastSyncEvent(); | 1744 | Event * e = getLastSyncEvent(); |
1745 | mCalendar->deleteEvent ( e ); | 1745 | mCalendar->deleteEvent ( e ); |
1746 | updateView(); | 1746 | updateView(); |
1747 | return true; | 1747 | return true; |
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | bool CalendarView::saveCalendar( QString filename ) | 1750 | bool CalendarView::saveCalendar( QString filename ) |
1751 | { | 1751 | { |
1752 | 1752 | ||
1753 | // Store back all unsaved data into calendar object | 1753 | // Store back all unsaved data into calendar object |
1754 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1754 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1755 | if ( mViewManager->currentView() ) | 1755 | if ( mViewManager->currentView() ) |
1756 | mViewManager->currentView()->flushView(); | 1756 | mViewManager->currentView()->flushView(); |
1757 | 1757 | ||
1758 | 1758 | ||
1759 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1759 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1760 | mStorage->setSaveFormat( new ICalFormat() ); | 1760 | mStorage->setSaveFormat( new ICalFormat() ); |
1761 | mStorage->setFileName( filename ); | 1761 | mStorage->setFileName( filename ); |
1762 | bool success; | 1762 | bool success; |
1763 | success = mStorage->save(); | 1763 | success = mStorage->save(); |
1764 | if ( !success ) { | 1764 | if ( !success ) { |
1765 | return false; | 1765 | return false; |
1766 | } | 1766 | } |
1767 | if ( filename == MainWindow::defaultFileName() ) { | 1767 | if ( filename == MainWindow::defaultFileName() ) { |
1768 | setLoadedFileVersion( lfv ); | 1768 | setLoadedFileVersion( lfv ); |
1769 | watchSavedFile(); | 1769 | watchSavedFile(); |
1770 | } | 1770 | } |
1771 | return true; | 1771 | return true; |
1772 | } | 1772 | } |
1773 | 1773 | ||
1774 | void CalendarView::closeCalendar() | 1774 | void CalendarView::closeCalendar() |
1775 | { | 1775 | { |
1776 | 1776 | ||
1777 | // child windows no longer valid | 1777 | // child windows no longer valid |
1778 | emit closingDown(); | 1778 | emit closingDown(); |
1779 | 1779 | ||
1780 | mCalendar->close(); | 1780 | mCalendar->close(); |
1781 | setModified(false); | 1781 | setModified(false); |
1782 | updateView(); | 1782 | updateView(); |
1783 | } | 1783 | } |
1784 | 1784 | ||
1785 | void CalendarView::archiveCalendar() | 1785 | void CalendarView::archiveCalendar() |
1786 | { | 1786 | { |
1787 | mDialogManager->showArchiveDialog(); | 1787 | mDialogManager->showArchiveDialog(); |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | 1790 | ||
1791 | void CalendarView::readSettings() | 1791 | void CalendarView::readSettings() |
1792 | { | 1792 | { |
1793 | 1793 | ||
1794 | 1794 | ||
1795 | // mViewManager->showAgendaView(); | 1795 | // mViewManager->showAgendaView(); |
1796 | QString str; | 1796 | QString str; |
1797 | //qDebug("CalendarView::readSettings() "); | 1797 | //qDebug("CalendarView::readSettings() "); |
1798 | // read settings from the KConfig, supplying reasonable | 1798 | // read settings from the KConfig, supplying reasonable |
1799 | // defaults where none are to be found | 1799 | // defaults where none are to be found |
1800 | KConfig *config = KOGlobals::config(); | 1800 | KConfig *config = KOGlobals::config(); |
1801 | #ifndef KORG_NOSPLITTER | 1801 | #ifndef KORG_NOSPLITTER |
1802 | config->setGroup("KOrganizer Geometry"); | 1802 | config->setGroup("KOrganizer Geometry"); |
1803 | 1803 | ||
1804 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1804 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1805 | if (sizes.count() != 2) { | 1805 | if (sizes.count() != 2) { |
1806 | sizes << mDateNavigator->minimumSizeHint().width(); | 1806 | sizes << mDateNavigator->minimumSizeHint().width(); |
1807 | sizes << 300; | 1807 | sizes << 300; |
1808 | } | 1808 | } |
1809 | mPanner->setSizes(sizes); | 1809 | mPanner->setSizes(sizes); |
1810 | 1810 | ||
1811 | sizes = config->readIntListEntry("Separator2"); | 1811 | sizes = config->readIntListEntry("Separator2"); |
1812 | if ( ( mResourceView && sizes.count() == 4 ) || | 1812 | if ( ( mResourceView && sizes.count() == 4 ) || |
1813 | ( !mResourceView && sizes.count() == 3 ) ) { | 1813 | ( !mResourceView && sizes.count() == 3 ) ) { |
1814 | mLeftSplitter->setSizes(sizes); | 1814 | mLeftSplitter->setSizes(sizes); |
1815 | } | 1815 | } |
1816 | #endif | 1816 | #endif |
1817 | globalFlagBlockAgenda = 1; | 1817 | globalFlagBlockAgenda = 1; |
1818 | mViewManager->showAgendaView(); | 1818 | mViewManager->showAgendaView(); |
1819 | //mViewManager->readSettings( config ); | 1819 | //mViewManager->readSettings( config ); |
1820 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1820 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1821 | readFilterSettings(config); | 1821 | readFilterSettings(config); |
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 | ||
2037 | if (mFilters.count() == 0) { | 2027 | if (mFilters.count() == 0) { |
2038 | CalFilter *filter = new CalFilter(i18n("Default")); | 2028 | CalFilter *filter = new CalFilter(i18n("Default")); |
2039 | mFilters.append(filter); | 2029 | mFilters.append(filter); |
2040 | } | 2030 | } |
2041 | mFilterView->updateFilters(); | 2031 | mFilterView->updateFilters(); |
2042 | config->setGroup("FilterView"); | 2032 | config->setGroup("FilterView"); |
2043 | 2033 | ||
2044 | mFilterView->blockSignals(true); | 2034 | mFilterView->blockSignals(true); |
2045 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2035 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2046 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2036 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2047 | mFilterView->blockSignals(false); | 2037 | mFilterView->blockSignals(false); |
2048 | // We do it manually to avoid it being done twice by the above calls | 2038 | // We do it manually to avoid it being done twice by the above calls |
2049 | updateFilter(); | 2039 | updateFilter(); |
2050 | } | 2040 | } |
2051 | 2041 | ||
2052 | void CalendarView::writeFilterSettings(KConfig *config) | 2042 | void CalendarView::writeFilterSettings(KConfig *config) |
2053 | { | 2043 | { |
2054 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2044 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2055 | 2045 | ||
2056 | QStringList filterList; | 2046 | QStringList filterList; |
2057 | 2047 | ||
2058 | CalFilter *filter = mFilters.first(); | 2048 | CalFilter *filter = mFilters.first(); |
2059 | while(filter) { | 2049 | while(filter) { |
2060 | // kdDebug() << " fn: " << filter->name() << endl; | 2050 | // kdDebug() << " fn: " << filter->name() << endl; |
2061 | filterList << filter->name(); | 2051 | filterList << filter->name(); |
2062 | config->setGroup("Filter_" + filter->name()); | 2052 | config->setGroup("Filter_" + filter->name()); |
2063 | config->writeEntry("Criteria",filter->criteria()); | 2053 | config->writeEntry("Criteria",filter->criteria()); |
2064 | config->writeEntry("CategoryList",filter->categoryList()); | 2054 | config->writeEntry("CategoryList",filter->categoryList()); |
2065 | filter = mFilters.next(); | 2055 | filter = mFilters.next(); |
2066 | } | 2056 | } |
2067 | config->setGroup("General"); | 2057 | config->setGroup("General"); |
2068 | config->writeEntry("CalendarFilters",filterList); | 2058 | config->writeEntry("CalendarFilters",filterList); |
2069 | 2059 | ||
2070 | config->setGroup("FilterView"); | 2060 | config->setGroup("FilterView"); |
2071 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2061 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2072 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2062 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2073 | } | 2063 | } |
2074 | 2064 | ||
2075 | 2065 | ||
2076 | void CalendarView::goToday() | 2066 | void CalendarView::goToday() |
2077 | { | 2067 | { |
2078 | if ( mViewManager->currentView()->isMonthView() ) | 2068 | if ( mViewManager->currentView()->isMonthView() ) |
2079 | mNavigator->selectTodayMonth(); | 2069 | mNavigator->selectTodayMonth(); |
2080 | else | 2070 | else |
2081 | mNavigator->selectToday(); | 2071 | mNavigator->selectToday(); |
2082 | } | 2072 | } |
2083 | 2073 | ||
2084 | void CalendarView::goNext() | 2074 | void CalendarView::goNext() |
2085 | { | 2075 | { |
2086 | mNavigator->selectNext(); | 2076 | mNavigator->selectNext(); |
2087 | } | 2077 | } |
2088 | 2078 | ||
2089 | void CalendarView::goPrevious() | 2079 | void CalendarView::goPrevious() |
2090 | { | 2080 | { |
2091 | mNavigator->selectPrevious(); | 2081 | mNavigator->selectPrevious(); |
2092 | } | 2082 | } |
2093 | void CalendarView::goNextMonth() | 2083 | void CalendarView::goNextMonth() |
2094 | { | 2084 | { |
2095 | mNavigator->selectNextMonth(); | 2085 | mNavigator->selectNextMonth(); |
2096 | } | 2086 | } |
2097 | 2087 | ||
2098 | void CalendarView::goPreviousMonth() | 2088 | void CalendarView::goPreviousMonth() |
2099 | { | 2089 | { |
2100 | mNavigator->selectPreviousMonth(); | 2090 | mNavigator->selectPreviousMonth(); |
2101 | } | 2091 | } |
2102 | void CalendarView::writeLocale() | 2092 | void CalendarView::writeLocale() |
2103 | { | 2093 | { |
2104 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2094 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2105 | #if 0 | 2095 | #if 0 |
2106 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2096 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2107 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2097 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2108 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2098 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2109 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2099 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2110 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2100 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2111 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2101 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2112 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2102 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2113 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2103 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2114 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2104 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2115 | KOPrefs::instance()->mDaylightsavingStart, | 2105 | KOPrefs::instance()->mDaylightsavingStart, |
2116 | KOPrefs::instance()->mDaylightsavingEnd ); | 2106 | KOPrefs::instance()->mDaylightsavingEnd ); |
2117 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2107 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2118 | #endif | 2108 | #endif |
2119 | } | 2109 | } |
2120 | void CalendarView::updateConfig() | 2110 | void CalendarView::updateConfig() |
2121 | { | 2111 | { |
2122 | writeLocale(); | 2112 | writeLocale(); |
2123 | if ( KOPrefs::instance()->mUseAppColors ) | 2113 | if ( KOPrefs::instance()->mUseAppColors ) |
2124 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2114 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2125 | emit configChanged(); | 2115 | emit configChanged(); |
2126 | mTodoList->updateConfig(); | 2116 | mTodoList->updateConfig(); |
2127 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2117 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2128 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2118 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2129 | // To make the "fill window" configurations work | 2119 | // To make the "fill window" configurations work |
2130 | //mViewManager->raiseCurrentView(); | 2120 | //mViewManager->raiseCurrentView(); |
2131 | } | 2121 | } |
2132 | 2122 | ||