-rw-r--r-- | korganizer/calendarview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9a4e719..6ed6a1c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1729,392 +1729,392 @@ bool CalendarView::checkFileVersion(QString fn) | |||
1729 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1729 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1730 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1730 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1731 | if ( dt <= loadedFileVersion ) | 1731 | if ( dt <= loadedFileVersion ) |
1732 | return true; | 1732 | return true; |
1733 | 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)) , | 1733 | 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)) , |
1734 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1734 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1735 | i18n("Sync+save")); | 1735 | i18n("Sync+save")); |
1736 | 1736 | ||
1737 | if ( km == KMessageBox::Cancel ) | 1737 | if ( km == KMessageBox::Cancel ) |
1738 | return false; | 1738 | return false; |
1739 | if ( km == KMessageBox::Yes ) | 1739 | if ( km == KMessageBox::Yes ) |
1740 | return true; | 1740 | return true; |
1741 | 1741 | ||
1742 | setSyncDevice("deleteaftersync" ); | 1742 | setSyncDevice("deleteaftersync" ); |
1743 | mSyncManager->mAskForPreferences = true; | 1743 | mSyncManager->mAskForPreferences = true; |
1744 | mSyncManager->mSyncAlgoPrefs = 3; | 1744 | mSyncManager->mSyncAlgoPrefs = 3; |
1745 | mSyncManager->mWriteBackFile = false; | 1745 | mSyncManager->mWriteBackFile = false; |
1746 | mSyncManager->mWriteBackExistingOnly = false; | 1746 | mSyncManager->mWriteBackExistingOnly = false; |
1747 | mSyncManager->mShowSyncSummary = false; | 1747 | mSyncManager->mShowSyncSummary = false; |
1748 | syncCalendar( fn, 3 ); | 1748 | syncCalendar( fn, 3 ); |
1749 | Event * e = getLastSyncEvent(); | 1749 | Event * e = getLastSyncEvent(); |
1750 | mCalendar->deleteEvent ( e ); | 1750 | mCalendar->deleteEvent ( e ); |
1751 | updateView(); | 1751 | updateView(); |
1752 | return true; | 1752 | return true; |
1753 | } | 1753 | } |
1754 | 1754 | ||
1755 | bool CalendarView::saveCalendar( QString filename ) | 1755 | bool CalendarView::saveCalendar( QString filename ) |
1756 | { | 1756 | { |
1757 | 1757 | ||
1758 | // Store back all unsaved data into calendar object | 1758 | // Store back all unsaved data into calendar object |
1759 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1759 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1760 | if ( mViewManager->currentView() ) | 1760 | if ( mViewManager->currentView() ) |
1761 | mViewManager->currentView()->flushView(); | 1761 | mViewManager->currentView()->flushView(); |
1762 | 1762 | ||
1763 | 1763 | ||
1764 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1764 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1765 | mStorage->setSaveFormat( new ICalFormat() ); | 1765 | mStorage->setSaveFormat( new ICalFormat() ); |
1766 | mStorage->setFileName( filename ); | 1766 | mStorage->setFileName( filename ); |
1767 | bool success; | 1767 | bool success; |
1768 | success = mStorage->save(); | 1768 | success = mStorage->save(); |
1769 | if ( !success ) { | 1769 | if ( !success ) { |
1770 | return false; | 1770 | return false; |
1771 | } | 1771 | } |
1772 | if ( filename == MainWindow::defaultFileName() ) { | 1772 | if ( filename == MainWindow::defaultFileName() ) { |
1773 | setLoadedFileVersion( lfv ); | 1773 | setLoadedFileVersion( lfv ); |
1774 | watchSavedFile(); | 1774 | watchSavedFile(); |
1775 | } | 1775 | } |
1776 | return true; | 1776 | return true; |
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | void CalendarView::closeCalendar() | 1779 | void CalendarView::closeCalendar() |
1780 | { | 1780 | { |
1781 | 1781 | ||
1782 | // child windows no longer valid | 1782 | // child windows no longer valid |
1783 | emit closingDown(); | 1783 | emit closingDown(); |
1784 | 1784 | ||
1785 | mCalendar->close(); | 1785 | mCalendar->close(); |
1786 | setModified(false); | 1786 | setModified(false); |
1787 | updateView(); | 1787 | updateView(); |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | void CalendarView::archiveCalendar() | 1790 | void CalendarView::archiveCalendar() |
1791 | { | 1791 | { |
1792 | mDialogManager->showArchiveDialog(); | 1792 | mDialogManager->showArchiveDialog(); |
1793 | } | 1793 | } |
1794 | 1794 | ||
1795 | 1795 | ||
1796 | void CalendarView::readSettings() | 1796 | void CalendarView::readSettings() |
1797 | { | 1797 | { |
1798 | 1798 | ||
1799 | 1799 | ||
1800 | // mViewManager->showAgendaView(); | 1800 | // mViewManager->showAgendaView(); |
1801 | QString str; | 1801 | QString str; |
1802 | //qDebug("CalendarView::readSettings() "); | 1802 | //qDebug("CalendarView::readSettings() "); |
1803 | // read settings from the KConfig, supplying reasonable | 1803 | // read settings from the KConfig, supplying reasonable |
1804 | // defaults where none are to be found | 1804 | // defaults where none are to be found |
1805 | KConfig *config = KOGlobals::config(); | 1805 | KConfig *config = KOGlobals::config(); |
1806 | #ifndef KORG_NOSPLITTER | 1806 | #ifndef KORG_NOSPLITTER |
1807 | config->setGroup("KOrganizer Geometry"); | 1807 | config->setGroup("KOrganizer Geometry"); |
1808 | 1808 | ||
1809 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1809 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1810 | if (sizes.count() != 2) { | 1810 | if (sizes.count() != 2) { |
1811 | sizes << mDateNavigator->minimumSizeHint().width(); | 1811 | sizes << mDateNavigator->minimumSizeHint().width(); |
1812 | sizes << 300; | 1812 | sizes << 300; |
1813 | } | 1813 | } |
1814 | mPanner->setSizes(sizes); | 1814 | mPanner->setSizes(sizes); |
1815 | 1815 | ||
1816 | sizes = config->readIntListEntry("Separator2"); | 1816 | sizes = config->readIntListEntry("Separator2"); |
1817 | if ( ( mResourceView && sizes.count() == 4 ) || | 1817 | if ( ( mResourceView && sizes.count() == 4 ) || |
1818 | ( !mResourceView && sizes.count() == 3 ) ) { | 1818 | ( !mResourceView && sizes.count() == 3 ) ) { |
1819 | mLeftSplitter->setSizes(sizes); | 1819 | mLeftSplitter->setSizes(sizes); |
1820 | } | 1820 | } |
1821 | #endif | 1821 | #endif |
1822 | globalFlagBlockAgenda = 1; | 1822 | globalFlagBlockAgenda = 1; |
1823 | mViewManager->showAgendaView(); | 1823 | mViewManager->showAgendaView(); |
1824 | //mViewManager->readSettings( config ); | 1824 | //mViewManager->readSettings( config ); |
1825 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1825 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1826 | readFilterSettings(config); | 1826 | readFilterSettings(config); |
1827 | 1827 | ||
1828 | #ifdef DESKTOP_VERSION | 1828 | #ifdef DESKTOP_VERSION |
1829 | config->setGroup("WidgetLayout"); | 1829 | config->setGroup("WidgetLayout"); |
1830 | QStringList list; | 1830 | QStringList list; |
1831 | list = config->readListEntry("MainLayout"); | 1831 | list = config->readListEntry("MainLayout"); |
1832 | int x,y,w,h; | 1832 | int x,y,w,h; |
1833 | if ( ! list.isEmpty() ) { | 1833 | if ( ! list.isEmpty() ) { |
1834 | x = list[0].toInt(); | 1834 | x = list[0].toInt(); |
1835 | y = list[1].toInt(); | 1835 | y = list[1].toInt(); |
1836 | w = list[2].toInt(); | 1836 | w = list[2].toInt(); |
1837 | h = list[3].toInt(); | 1837 | h = list[3].toInt(); |
1838 | topLevelWidget()->setGeometry(x,y,w,h); | 1838 | topLevelWidget()->setGeometry(x,y,w,h); |
1839 | 1839 | ||
1840 | } else { | 1840 | } else { |
1841 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1841 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1842 | } | 1842 | } |
1843 | list = config->readListEntry("EditEventLayout"); | 1843 | list = config->readListEntry("EditEventLayout"); |
1844 | if ( ! list.isEmpty() ) { | 1844 | if ( ! list.isEmpty() ) { |
1845 | x = list[0].toInt(); | 1845 | x = list[0].toInt(); |
1846 | y = list[1].toInt(); | 1846 | y = list[1].toInt(); |
1847 | w = list[2].toInt(); | 1847 | w = list[2].toInt(); |
1848 | h = list[3].toInt(); | 1848 | h = list[3].toInt(); |
1849 | mEventEditor->setGeometry(x,y,w,h); | 1849 | mEventEditor->setGeometry(x,y,w,h); |
1850 | 1850 | ||
1851 | } | 1851 | } |
1852 | list = config->readListEntry("EditTodoLayout"); | 1852 | list = config->readListEntry("EditTodoLayout"); |
1853 | if ( ! list.isEmpty() ) { | 1853 | if ( ! list.isEmpty() ) { |
1854 | x = list[0].toInt(); | 1854 | x = list[0].toInt(); |
1855 | y = list[1].toInt(); | 1855 | y = list[1].toInt(); |
1856 | w = list[2].toInt(); | 1856 | w = list[2].toInt(); |
1857 | h = list[3].toInt(); | 1857 | h = list[3].toInt(); |
1858 | mTodoEditor->setGeometry(x,y,w,h); | 1858 | mTodoEditor->setGeometry(x,y,w,h); |
1859 | 1859 | ||
1860 | } | 1860 | } |
1861 | list = config->readListEntry("ViewerLayout"); | 1861 | list = config->readListEntry("ViewerLayout"); |
1862 | if ( ! list.isEmpty() ) { | 1862 | if ( ! list.isEmpty() ) { |
1863 | x = list[0].toInt(); | 1863 | x = list[0].toInt(); |
1864 | y = list[1].toInt(); | 1864 | y = list[1].toInt(); |
1865 | w = list[2].toInt(); | 1865 | w = list[2].toInt(); |
1866 | h = list[3].toInt(); | 1866 | h = list[3].toInt(); |
1867 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1867 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1868 | } | 1868 | } |
1869 | #endif | 1869 | #endif |
1870 | config->setGroup( "Views" ); | 1870 | config->setGroup( "Views" ); |
1871 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1871 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1872 | 1872 | ||
1873 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 1873 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
1874 | 1874 | ||
1875 | int resetval = 0; | 1875 | int resetval = 0; |
1876 | int maxVal = 0; | 1876 | int maxVal = 0; |
1877 | if (sizes.count() != 3) { | 1877 | if (sizes.count() != 3) { |
1878 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1878 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1879 | resetval = mDateNavigator->sizeHint().width()+2; | 1879 | resetval = mDateNavigator->sizeHint().width()+2; |
1880 | } else { | 1880 | } else { |
1881 | resetval = mDateNavigator->sizeHint().height()+2; | 1881 | resetval = mDateNavigator->sizeHint().height()+2; |
1882 | } | 1882 | } |
1883 | } | 1883 | } |
1884 | if ( resetval ) { | 1884 | if ( resetval ) { |
1885 | sizes.clear(); | 1885 | sizes.clear(); |
1886 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1886 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1887 | maxVal = QApplication::desktop()->width() -10; | 1887 | maxVal = QApplication::desktop()->width() -10; |
1888 | } else { | 1888 | } else { |
1889 | maxVal = QApplication::desktop()->height()-10; | 1889 | maxVal = QApplication::desktop()->height()-10; |
1890 | } | 1890 | } |
1891 | sizes << resetval; | 1891 | sizes << resetval; |
1892 | if ( maxVal < resetval + resetval) | 1892 | if ( maxVal < resetval + resetval) |
1893 | resetval = maxVal - resetval; | 1893 | resetval = maxVal - resetval; |
1894 | sizes << resetval; | 1894 | sizes << resetval; |
1895 | sizes << 100; | 1895 | sizes << 100; |
1896 | } | 1896 | } |
1897 | mLeftFrame->setSizes(sizes); | 1897 | mLeftFrame->setSizes(sizes); |
1898 | sizes = config->readIntListEntry("Main Splitter Frame"); | 1898 | sizes = config->readIntListEntry("Main Splitter Frame"); |
1899 | resetval = 0; | 1899 | resetval = 0; |
1900 | maxVal = 0; | 1900 | maxVal = 0; |
1901 | if (sizes.count() != 2) { | 1901 | if (sizes.count() != 2) { |
1902 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1902 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1903 | resetval = mDateNavigator->sizeHint().width()+2; | 1903 | resetval = mDateNavigator->sizeHint().width()+2; |
1904 | } else { | 1904 | } else { |
1905 | resetval = mDateNavigator->sizeHint().height()+2; | 1905 | resetval = mDateNavigator->sizeHint().height()+2; |
1906 | } | 1906 | } |
1907 | } | 1907 | } |
1908 | if ( resetval ) { | 1908 | if ( resetval ) { |
1909 | sizes.clear(); | 1909 | sizes.clear(); |
1910 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1910 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1911 | maxVal = QApplication::desktop()->width() -10; | 1911 | maxVal = QApplication::desktop()->width() -10; |
1912 | } else { | 1912 | } else { |
1913 | maxVal = QApplication::desktop()->height()-10; | 1913 | maxVal = QApplication::desktop()->height()-10; |
1914 | } | 1914 | } |
1915 | sizes << resetval; | 1915 | sizes << resetval; |
1916 | if ( maxVal < resetval + resetval) | 1916 | if ( maxVal < resetval + resetval) |
1917 | resetval = maxVal - resetval; | 1917 | resetval = maxVal - resetval; |
1918 | sizes << resetval; | 1918 | sizes << resetval; |
1919 | } | 1919 | } |
1920 | mMainFrame->setSizes(sizes); | 1920 | mMainFrame->setSizes(sizes); |
1921 | |||
1922 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1921 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1923 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1922 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1924 | else mNavigator->selectDates( dateCount ); | 1923 | else mNavigator->selectDates( dateCount ); |
1925 | // mViewManager->readSettings( config ); | 1924 | // mViewManager->readSettings( config ); |
1926 | updateConfig(); | 1925 | updateConfig(); |
1927 | globalFlagBlockAgenda = 2; | 1926 | globalFlagBlockAgenda = 2; |
1928 | mViewManager->readSettings( config ); | 1927 | mViewManager->readSettings( config ); |
1928 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | ||
1929 | } | 1929 | } |
1930 | 1930 | ||
1931 | 1931 | ||
1932 | void CalendarView::writeSettings() | 1932 | void CalendarView::writeSettings() |
1933 | { | 1933 | { |
1934 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1934 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1935 | 1935 | ||
1936 | KConfig *config = KOGlobals::config(); | 1936 | KConfig *config = KOGlobals::config(); |
1937 | 1937 | ||
1938 | mViewManager->writeSettings( config ); | 1938 | mViewManager->writeSettings( config ); |
1939 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1939 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1940 | mDialogManager->writeSettings( config ); | 1940 | mDialogManager->writeSettings( config ); |
1941 | //KOPrefs::instance()->usrWriteConfig(); | 1941 | //KOPrefs::instance()->usrWriteConfig(); |
1942 | KOPrefs::instance()->writeConfig(); | 1942 | KOPrefs::instance()->writeConfig(); |
1943 | 1943 | ||
1944 | writeFilterSettings(config); | 1944 | writeFilterSettings(config); |
1945 | 1945 | ||
1946 | config->setGroup( "Views" ); | 1946 | config->setGroup( "Views" ); |
1947 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1947 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1948 | 1948 | ||
1949 | QValueList<int> listINT = mLeftFrame->sizes(); | 1949 | QValueList<int> listINT = mLeftFrame->sizes(); |
1950 | config->writeEntry("Left Splitter Frame",listINT); | 1950 | config->writeEntry("Left Splitter Frame",listINT); |
1951 | QValueList<int> listINT2 = mMainFrame->sizes(); | 1951 | QValueList<int> listINT2 = mMainFrame->sizes(); |
1952 | config->writeEntry("Main Splitter Frame",listINT2); | 1952 | config->writeEntry("Main Splitter Frame",listINT2); |
1953 | #ifdef DESKTOP_VERSION | 1953 | #ifdef DESKTOP_VERSION |
1954 | config->setGroup("WidgetLayout"); | 1954 | config->setGroup("WidgetLayout"); |
1955 | QStringList list ;//= config->readListEntry("MainLayout"); | 1955 | QStringList list ;//= config->readListEntry("MainLayout"); |
1956 | int x,y,w,h; | 1956 | int x,y,w,h; |
1957 | QWidget* wid; | 1957 | QWidget* wid; |
1958 | wid = topLevelWidget(); | 1958 | wid = topLevelWidget(); |
1959 | x = wid->geometry().x(); | 1959 | x = wid->geometry().x(); |
1960 | y = wid->geometry().y(); | 1960 | y = wid->geometry().y(); |
1961 | w = wid->width(); | 1961 | w = wid->width(); |
1962 | h = wid->height(); | 1962 | h = wid->height(); |
1963 | list.clear(); | 1963 | list.clear(); |
1964 | list << QString::number( x ); | 1964 | list << QString::number( x ); |
1965 | list << QString::number( y ); | 1965 | list << QString::number( y ); |
1966 | list << QString::number( w ); | 1966 | list << QString::number( w ); |
1967 | list << QString::number( h ); | 1967 | list << QString::number( h ); |
1968 | config->writeEntry("MainLayout",list ); | 1968 | config->writeEntry("MainLayout",list ); |
1969 | 1969 | ||
1970 | wid = mEventEditor; | 1970 | wid = mEventEditor; |
1971 | x = wid->geometry().x(); | 1971 | x = wid->geometry().x(); |
1972 | y = wid->geometry().y(); | 1972 | y = wid->geometry().y(); |
1973 | w = wid->width(); | 1973 | w = wid->width(); |
1974 | h = wid->height(); | 1974 | h = wid->height(); |
1975 | list.clear(); | 1975 | list.clear(); |
1976 | list << QString::number( x ); | 1976 | list << QString::number( x ); |
1977 | list << QString::number( y ); | 1977 | list << QString::number( y ); |
1978 | list << QString::number( w ); | 1978 | list << QString::number( w ); |
1979 | list << QString::number( h ); | 1979 | list << QString::number( h ); |
1980 | config->writeEntry("EditEventLayout",list ); | 1980 | config->writeEntry("EditEventLayout",list ); |
1981 | 1981 | ||
1982 | wid = mTodoEditor; | 1982 | wid = mTodoEditor; |
1983 | x = wid->geometry().x(); | 1983 | x = wid->geometry().x(); |
1984 | y = wid->geometry().y(); | 1984 | y = wid->geometry().y(); |
1985 | w = wid->width(); | 1985 | w = wid->width(); |
1986 | h = wid->height(); | 1986 | h = wid->height(); |
1987 | list.clear(); | 1987 | list.clear(); |
1988 | list << QString::number( x ); | 1988 | list << QString::number( x ); |
1989 | list << QString::number( y ); | 1989 | list << QString::number( y ); |
1990 | list << QString::number( w ); | 1990 | list << QString::number( w ); |
1991 | list << QString::number( h ); | 1991 | list << QString::number( h ); |
1992 | config->writeEntry("EditTodoLayout",list ); | 1992 | config->writeEntry("EditTodoLayout",list ); |
1993 | wid = getEventViewerDialog(); | 1993 | wid = getEventViewerDialog(); |
1994 | x = wid->geometry().x(); | 1994 | x = wid->geometry().x(); |
1995 | y = wid->geometry().y(); | 1995 | y = wid->geometry().y(); |
1996 | w = wid->width(); | 1996 | w = wid->width(); |
1997 | h = wid->height(); | 1997 | h = wid->height(); |
1998 | list.clear(); | 1998 | list.clear(); |
1999 | list << QString::number( x ); | 1999 | list << QString::number( x ); |
2000 | list << QString::number( y ); | 2000 | list << QString::number( y ); |
2001 | list << QString::number( w ); | 2001 | list << QString::number( w ); |
2002 | list << QString::number( h ); | 2002 | list << QString::number( h ); |
2003 | config->writeEntry("ViewerLayout",list ); | 2003 | config->writeEntry("ViewerLayout",list ); |
2004 | wid = mDialogManager->getSearchDialog(); | 2004 | wid = mDialogManager->getSearchDialog(); |
2005 | if ( wid ) { | 2005 | if ( wid ) { |
2006 | x = wid->geometry().x(); | 2006 | x = wid->geometry().x(); |
2007 | y = wid->geometry().y(); | 2007 | y = wid->geometry().y(); |
2008 | w = wid->width(); | 2008 | w = wid->width(); |
2009 | h = wid->height(); | 2009 | h = wid->height(); |
2010 | list.clear(); | 2010 | list.clear(); |
2011 | list << QString::number( x ); | 2011 | list << QString::number( x ); |
2012 | list << QString::number( y ); | 2012 | list << QString::number( y ); |
2013 | list << QString::number( w ); | 2013 | list << QString::number( w ); |
2014 | list << QString::number( h ); | 2014 | list << QString::number( h ); |
2015 | config->writeEntry("SearchLayout",list ); | 2015 | config->writeEntry("SearchLayout",list ); |
2016 | } | 2016 | } |
2017 | #endif | 2017 | #endif |
2018 | 2018 | ||
2019 | 2019 | ||
2020 | config->sync(); | 2020 | config->sync(); |
2021 | } | 2021 | } |
2022 | 2022 | ||
2023 | void CalendarView::readFilterSettings(KConfig *config) | 2023 | void CalendarView::readFilterSettings(KConfig *config) |
2024 | { | 2024 | { |
2025 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2025 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2026 | 2026 | ||
2027 | mFilters.clear(); | 2027 | mFilters.clear(); |
2028 | 2028 | ||
2029 | config->setGroup("General"); | 2029 | config->setGroup("General"); |
2030 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2030 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2031 | 2031 | ||
2032 | QStringList::ConstIterator it = filterList.begin(); | 2032 | QStringList::ConstIterator it = filterList.begin(); |
2033 | QStringList::ConstIterator end = filterList.end(); | 2033 | QStringList::ConstIterator end = filterList.end(); |
2034 | while(it != end) { | 2034 | while(it != end) { |
2035 | // kdDebug() << " filter: " << (*it) << endl; | 2035 | // kdDebug() << " filter: " << (*it) << endl; |
2036 | 2036 | ||
2037 | CalFilter *filter; | 2037 | CalFilter *filter; |
2038 | filter = new CalFilter(*it); | 2038 | filter = new CalFilter(*it); |
2039 | config->setGroup("Filter_" + (*it)); | 2039 | config->setGroup("Filter_" + (*it)); |
2040 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2040 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2041 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2041 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2042 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2042 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2043 | mFilters.append(filter); | 2043 | mFilters.append(filter); |
2044 | 2044 | ||
2045 | ++it; | 2045 | ++it; |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | if (mFilters.count() == 0) { | 2048 | if (mFilters.count() == 0) { |
2049 | CalFilter *filter = new CalFilter(i18n("Default")); | 2049 | CalFilter *filter = new CalFilter(i18n("Default")); |
2050 | mFilters.append(filter); | 2050 | mFilters.append(filter); |
2051 | } | 2051 | } |
2052 | mFilterView->updateFilters(); | 2052 | mFilterView->updateFilters(); |
2053 | config->setGroup("FilterView"); | 2053 | config->setGroup("FilterView"); |
2054 | 2054 | ||
2055 | mFilterView->blockSignals(true); | 2055 | mFilterView->blockSignals(true); |
2056 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2056 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2057 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2057 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2058 | mFilterView->blockSignals(false); | 2058 | mFilterView->blockSignals(false); |
2059 | // We do it manually to avoid it being done twice by the above calls | 2059 | // We do it manually to avoid it being done twice by the above calls |
2060 | updateFilter(); | 2060 | updateFilter(); |
2061 | } | 2061 | } |
2062 | 2062 | ||
2063 | void CalendarView::writeFilterSettings(KConfig *config) | 2063 | void CalendarView::writeFilterSettings(KConfig *config) |
2064 | { | 2064 | { |
2065 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2065 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2066 | 2066 | ||
2067 | QStringList filterList; | 2067 | QStringList filterList; |
2068 | 2068 | ||
2069 | CalFilter *filter = mFilters.first(); | 2069 | CalFilter *filter = mFilters.first(); |
2070 | while(filter) { | 2070 | while(filter) { |
2071 | // kdDebug() << " fn: " << filter->name() << endl; | 2071 | // kdDebug() << " fn: " << filter->name() << endl; |
2072 | filterList << filter->name(); | 2072 | filterList << filter->name(); |
2073 | config->setGroup("Filter_" + filter->name()); | 2073 | config->setGroup("Filter_" + filter->name()); |
2074 | config->writeEntry("Criteria",filter->criteria()); | 2074 | config->writeEntry("Criteria",filter->criteria()); |
2075 | config->writeEntry("CategoryList",filter->categoryList()); | 2075 | config->writeEntry("CategoryList",filter->categoryList()); |
2076 | filter = mFilters.next(); | 2076 | filter = mFilters.next(); |
2077 | } | 2077 | } |
2078 | config->setGroup("General"); | 2078 | config->setGroup("General"); |
2079 | config->writeEntry("CalendarFilters",filterList); | 2079 | config->writeEntry("CalendarFilters",filterList); |
2080 | 2080 | ||
2081 | config->setGroup("FilterView"); | 2081 | config->setGroup("FilterView"); |
2082 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2082 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2083 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2083 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2084 | } | 2084 | } |
2085 | 2085 | ||
2086 | 2086 | ||
2087 | void CalendarView::goToday() | 2087 | void CalendarView::goToday() |
2088 | { | 2088 | { |
2089 | if ( mViewManager->currentView()->isMonthView() ) | 2089 | if ( mViewManager->currentView()->isMonthView() ) |
2090 | mNavigator->selectTodayMonth(); | 2090 | mNavigator->selectTodayMonth(); |
2091 | else | 2091 | else |
2092 | mNavigator->selectToday(); | 2092 | mNavigator->selectToday(); |
2093 | } | 2093 | } |
2094 | 2094 | ||
2095 | void CalendarView::goNext() | 2095 | void CalendarView::goNext() |
2096 | { | 2096 | { |
2097 | mNavigator->selectNext(); | 2097 | mNavigator->selectNext(); |
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | void CalendarView::goPrevious() | 2100 | void CalendarView::goPrevious() |
2101 | { | 2101 | { |
2102 | mNavigator->selectPrevious(); | 2102 | mNavigator->selectPrevious(); |
2103 | } | 2103 | } |
2104 | void CalendarView::goNextMonth() | 2104 | void CalendarView::goNextMonth() |
2105 | { | 2105 | { |
2106 | mNavigator->selectNextMonth(); | 2106 | mNavigator->selectNextMonth(); |
2107 | } | 2107 | } |
2108 | 2108 | ||
2109 | void CalendarView::goPreviousMonth() | 2109 | void CalendarView::goPreviousMonth() |
2110 | { | 2110 | { |
2111 | mNavigator->selectPreviousMonth(); | 2111 | mNavigator->selectPreviousMonth(); |
2112 | } | 2112 | } |
2113 | void CalendarView::writeLocale() | 2113 | void CalendarView::writeLocale() |
2114 | { | 2114 | { |
2115 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2115 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2116 | #if 0 | 2116 | #if 0 |
2117 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2117 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2118 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2118 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2119 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2119 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2120 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2120 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |