summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-21 14:46:33 (UTC)
committer zautrix <zautrix>2005-03-21 14:46:33 (UTC)
commit86c420a68008e4430bd769ebdecdfa430ba552f5 (patch) (unidiff)
tree76a1e6485169f5601c82754dc9d8971702b5c1b1 /korganizer
parent6e5a0c6cff04fff115e63b62537c5274dc7a5564 (diff)
downloadkdepimpi-86c420a68008e4430bd769ebdecdfa430ba552f5.zip
kdepimpi-86c420a68008e4430bd769ebdecdfa430ba552f5.tar.gz
kdepimpi-86c420a68008e4430bd769ebdecdfa430ba552f5.tar.bz2
init fix
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 96ced08..90b36ac 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1730,310 +1730,310 @@ bool CalendarView::checkFileVersion(QString fn)
1730 if ( dt <= loadedFileVersion ) 1730 if ( dt <= loadedFileVersion )
1731 return true; 1731 return true;
1732 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)) , 1732 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 i18n("KO/Pi Warning"),i18n("Overwrite"), 1733 i18n("KO/Pi Warning"),i18n("Overwrite"),
1734 i18n("Sync+save")); 1734 i18n("Sync+save"));
1735 1735
1736 if ( km == KMessageBox::Cancel ) 1736 if ( km == KMessageBox::Cancel )
1737 return false; 1737 return false;
1738 if ( km == KMessageBox::Yes ) 1738 if ( km == KMessageBox::Yes )
1739 return true; 1739 return true;
1740 1740
1741 setSyncDevice("deleteaftersync" ); 1741 setSyncDevice("deleteaftersync" );
1742 mSyncManager->mAskForPreferences = true; 1742 mSyncManager->mAskForPreferences = true;
1743 mSyncManager->mSyncAlgoPrefs = 3; 1743 mSyncManager->mSyncAlgoPrefs = 3;
1744 mSyncManager->mWriteBackFile = false; 1744 mSyncManager->mWriteBackFile = false;
1745 mSyncManager->mWriteBackExistingOnly = false; 1745 mSyncManager->mWriteBackExistingOnly = false;
1746 mSyncManager->mShowSyncSummary = false; 1746 mSyncManager->mShowSyncSummary = false;
1747 syncCalendar( fn, 3 ); 1747 syncCalendar( fn, 3 );
1748 Event * e = getLastSyncEvent(); 1748 Event * e = getLastSyncEvent();
1749 mCalendar->deleteEvent ( e ); 1749 mCalendar->deleteEvent ( e );
1750 updateView(); 1750 updateView();
1751 return true; 1751 return true;
1752} 1752}
1753 1753
1754bool CalendarView::saveCalendar( QString filename ) 1754bool CalendarView::saveCalendar( QString filename )
1755{ 1755{
1756 1756
1757 // Store back all unsaved data into calendar object 1757 // Store back all unsaved data into calendar object
1758 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1758 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1759 if ( mViewManager->currentView() ) 1759 if ( mViewManager->currentView() )
1760 mViewManager->currentView()->flushView(); 1760 mViewManager->currentView()->flushView();
1761 1761
1762 1762
1763 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1763 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1764 mStorage->setSaveFormat( new ICalFormat() ); 1764 mStorage->setSaveFormat( new ICalFormat() );
1765 mStorage->setFileName( filename ); 1765 mStorage->setFileName( filename );
1766 bool success; 1766 bool success;
1767 success = mStorage->save(); 1767 success = mStorage->save();
1768 if ( !success ) { 1768 if ( !success ) {
1769 return false; 1769 return false;
1770 } 1770 }
1771 if ( filename == MainWindow::defaultFileName() ) { 1771 if ( filename == MainWindow::defaultFileName() ) {
1772 setLoadedFileVersion( lfv ); 1772 setLoadedFileVersion( lfv );
1773 watchSavedFile(); 1773 watchSavedFile();
1774 } 1774 }
1775 return true; 1775 return true;
1776} 1776}
1777 1777
1778void CalendarView::closeCalendar() 1778void CalendarView::closeCalendar()
1779{ 1779{
1780 1780
1781 // child windows no longer valid 1781 // child windows no longer valid
1782 emit closingDown(); 1782 emit closingDown();
1783 1783
1784 mCalendar->close(); 1784 mCalendar->close();
1785 setModified(false); 1785 setModified(false);
1786 updateView(); 1786 updateView();
1787} 1787}
1788 1788
1789void CalendarView::archiveCalendar() 1789void CalendarView::archiveCalendar()
1790{ 1790{
1791 mDialogManager->showArchiveDialog(); 1791 mDialogManager->showArchiveDialog();
1792} 1792}
1793 1793
1794 1794
1795void CalendarView::readSettings() 1795void CalendarView::readSettings()
1796{ 1796{
1797 1797
1798 1798
1799 // mViewManager->showAgendaView(); 1799 // mViewManager->showAgendaView();
1800 QString str; 1800 QString str;
1801 //qDebug("CalendarView::readSettings() "); 1801 //qDebug("CalendarView::readSettings() ");
1802 // read settings from the KConfig, supplying reasonable 1802 // read settings from the KConfig, supplying reasonable
1803 // defaults where none are to be found 1803 // defaults where none are to be found
1804 KConfig *config = KOGlobals::config(); 1804 KConfig *config = KOGlobals::config();
1805#ifndef KORG_NOSPLITTER 1805#ifndef KORG_NOSPLITTER
1806 config->setGroup("KOrganizer Geometry"); 1806 config->setGroup("KOrganizer Geometry");
1807 1807
1808 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1808 QValueList<int> sizes = config->readIntListEntry("Separator1");
1809 if (sizes.count() != 2) { 1809 if (sizes.count() != 2) {
1810 sizes << mDateNavigator->minimumSizeHint().width(); 1810 sizes << mDateNavigator->minimumSizeHint().width();
1811 sizes << 300; 1811 sizes << 300;
1812 } 1812 }
1813 mPanner->setSizes(sizes); 1813 mPanner->setSizes(sizes);
1814 1814
1815 sizes = config->readIntListEntry("Separator2"); 1815 sizes = config->readIntListEntry("Separator2");
1816 if ( ( mResourceView && sizes.count() == 4 ) || 1816 if ( ( mResourceView && sizes.count() == 4 ) ||
1817 ( !mResourceView && sizes.count() == 3 ) ) { 1817 ( !mResourceView && sizes.count() == 3 ) ) {
1818 mLeftSplitter->setSizes(sizes); 1818 mLeftSplitter->setSizes(sizes);
1819 } 1819 }
1820#endif 1820#endif
1821 globalFlagBlockAgenda = 1; 1821 globalFlagBlockAgenda = 1;
1822 mViewManager->showAgendaView(); 1822 mViewManager->showAgendaView();
1823 //mViewManager->readSettings( config ); 1823 //mViewManager->readSettings( config );
1824 mTodoList->restoreLayout(config,QString("Todo Layout")); 1824 mTodoList->restoreLayout(config,QString("Todo Layout"));
1825 readFilterSettings(config); 1825 readFilterSettings(config);
1826
1827#ifdef DESKTOP_VERSION
1828 config->setGroup("WidgetLayout");
1829 QStringList list;
1830 list = config->readListEntry("MainLayout");
1831 int x,y,w,h;
1832 if ( ! list.isEmpty() ) {
1833 x = list[0].toInt();
1834 y = list[1].toInt();
1835 w = list[2].toInt();
1836 h = list[3].toInt();
1837 topLevelWidget()->setGeometry(x,y,w,h);
1838
1839 } else {
1840 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1841 }
1842 list = config->readListEntry("EditEventLayout");
1843 if ( ! list.isEmpty() ) {
1844 x = list[0].toInt();
1845 y = list[1].toInt();
1846 w = list[2].toInt();
1847 h = list[3].toInt();
1848 mEventEditor->setGeometry(x,y,w,h);
1849
1850 }
1851 list = config->readListEntry("EditTodoLayout");
1852 if ( ! list.isEmpty() ) {
1853 x = list[0].toInt();
1854 y = list[1].toInt();
1855 w = list[2].toInt();
1856 h = list[3].toInt();
1857 mTodoEditor->setGeometry(x,y,w,h);
1858
1859 }
1860 list = config->readListEntry("ViewerLayout");
1861 if ( ! list.isEmpty() ) {
1862 x = list[0].toInt();
1863 y = list[1].toInt();
1864 w = list[2].toInt();
1865 h = list[3].toInt();
1866 getEventViewerDialog()->setGeometry(x,y,w,h);
1867 }
1868#endif
1826 config->setGroup( "Views" ); 1869 config->setGroup( "Views" );
1827 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1870 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1828 1871
1829 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 1872 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
1830 1873
1831 int resetval = 0; 1874 int resetval = 0;
1832 int maxVal = 0; 1875 int maxVal = 0;
1833 if (sizes.count() != 3) { 1876 if (sizes.count() != 3) {
1834 if ( KOPrefs::instance()->mVerticalScreen ) { 1877 if ( KOPrefs::instance()->mVerticalScreen ) {
1835 resetval = mDateNavigator->sizeHint().width()+2; 1878 resetval = mDateNavigator->sizeHint().width()+2;
1836 } else { 1879 } else {
1837 resetval = mDateNavigator->sizeHint().height()+2; 1880 resetval = mDateNavigator->sizeHint().height()+2;
1838 } 1881 }
1839 } 1882 }
1840 if ( !resetval ){// i.e. sizes.count() == 3 1883 if ( !resetval ){// i.e. sizes.count() == 3
1841 if ( KOPrefs::instance()->mVerticalScreen ) { 1884 if ( KOPrefs::instance()->mVerticalScreen ) {
1842 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) 1885 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1843 resetval = mDateNavigator->sizeHint().width()+2; 1886 resetval = mDateNavigator->sizeHint().width()+2;
1844 } else { 1887 } else {
1845 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) 1888 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1846 resetval = mDateNavigator->sizeHint().height()+2; 1889 resetval = mDateNavigator->sizeHint().height()+2;
1847 } 1890 }
1848 } 1891 }
1849 if ( resetval ) { 1892 if ( resetval ) {
1850 sizes.clear(); 1893 sizes.clear();
1851 if ( KOPrefs::instance()->mVerticalScreen ) { 1894 if ( KOPrefs::instance()->mVerticalScreen ) {
1852 maxVal = QApplication::desktop()->width() -10; 1895 maxVal = QApplication::desktop()->width() -10;
1853 } else { 1896 } else {
1854 maxVal = QApplication::desktop()->height()-10; 1897 maxVal = QApplication::desktop()->height()-10;
1855 } 1898 }
1856 sizes << resetval; 1899 sizes << resetval;
1857 if ( maxVal < resetval + resetval) 1900 if ( maxVal < resetval + resetval)
1858 resetval = maxVal - resetval; 1901 resetval = maxVal - resetval;
1859 sizes << resetval; 1902 sizes << resetval;
1860 sizes << 100; 1903 sizes << 100;
1861 } 1904 }
1862 mLeftFrame->setSizes(sizes); 1905 mLeftFrame->setSizes(sizes);
1863 sizes = config->readIntListEntry("Main Splitter Frame"); 1906 sizes = config->readIntListEntry("Main Splitter Frame");
1864 if (sizes.count() != 2) { 1907 if (sizes.count() != 2) {
1865 if ( !KOPrefs::instance()->mVerticalScreen ) { 1908 if ( !KOPrefs::instance()->mVerticalScreen ) {
1866 resetval = mDateNavigator->sizeHint().width()+2; 1909 resetval = mDateNavigator->sizeHint().width()+2;
1867 } else { 1910 } else {
1868 resetval = mDateNavigator->sizeHint().height()+2; 1911 resetval = mDateNavigator->sizeHint().height()+2;
1869 } 1912 }
1870 } 1913 }
1871 if ( !resetval ){// i.e. sizes.count() == 3 1914 if ( !resetval ){// i.e. sizes.count() == 3
1872 if ( !KOPrefs::instance()->mVerticalScreen ) { 1915 if ( !KOPrefs::instance()->mVerticalScreen ) {
1873 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) 1916 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1874 resetval = mDateNavigator->sizeHint().width()+2; 1917 resetval = mDateNavigator->sizeHint().width()+2;
1875 } else { 1918 } else {
1876 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) 1919 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1877 resetval = mDateNavigator->sizeHint().height()+2; 1920 resetval = mDateNavigator->sizeHint().height()+2;
1878 } 1921 }
1879 } 1922 }
1880 if ( resetval ) { 1923 if ( resetval ) {
1881 sizes.clear(); 1924 sizes.clear();
1882 if ( !KOPrefs::instance()->mVerticalScreen ) { 1925 if ( !KOPrefs::instance()->mVerticalScreen ) {
1883 maxVal = QApplication::desktop()->width() -10; 1926 maxVal = QApplication::desktop()->width() -10;
1884 } else { 1927 } else {
1885 maxVal = QApplication::desktop()->height()-10; 1928 maxVal = QApplication::desktop()->height()-10;
1886 } 1929 }
1887 sizes << resetval; 1930 sizes << resetval;
1888 if ( maxVal < resetval + resetval) 1931 if ( maxVal < resetval + resetval)
1889 resetval = maxVal - resetval; 1932 resetval = maxVal - resetval;
1890 sizes << resetval; 1933 sizes << resetval;
1891 } 1934 }
1892 mMainFrame->setSizes(sizes); 1935 mMainFrame->setSizes(sizes);
1893 1936
1894 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1937 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1895 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1938 else if ( dateCount == 7 ) mNavigator->selectWeek();
1896 else mNavigator->selectDates( dateCount ); 1939 else mNavigator->selectDates( dateCount );
1897 // mViewManager->readSettings( config ); 1940 // mViewManager->readSettings( config );
1898 updateConfig(); 1941 updateConfig();
1899 globalFlagBlockAgenda = 2; 1942 globalFlagBlockAgenda = 2;
1900 mViewManager->readSettings( config ); 1943 mViewManager->readSettings( config );
1901#ifdef DESKTOP_VERSION
1902 config->setGroup("WidgetLayout");
1903 QStringList list;
1904 list = config->readListEntry("MainLayout");
1905 int x,y,w,h;
1906 if ( ! list.isEmpty() ) {
1907 x = list[0].toInt();
1908 y = list[1].toInt();
1909 w = list[2].toInt();
1910 h = list[3].toInt();
1911 topLevelWidget()->setGeometry(x,y,w,h);
1912
1913 } else {
1914 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1915 }
1916 list = config->readListEntry("EditEventLayout");
1917 if ( ! list.isEmpty() ) {
1918 x = list[0].toInt();
1919 y = list[1].toInt();
1920 w = list[2].toInt();
1921 h = list[3].toInt();
1922 mEventEditor->setGeometry(x,y,w,h);
1923
1924 }
1925 list = config->readListEntry("EditTodoLayout");
1926 if ( ! list.isEmpty() ) {
1927 x = list[0].toInt();
1928 y = list[1].toInt();
1929 w = list[2].toInt();
1930 h = list[3].toInt();
1931 mTodoEditor->setGeometry(x,y,w,h);
1932
1933 }
1934 list = config->readListEntry("ViewerLayout");
1935 if ( ! list.isEmpty() ) {
1936 x = list[0].toInt();
1937 y = list[1].toInt();
1938 w = list[2].toInt();
1939 h = list[3].toInt();
1940 getEventViewerDialog()->setGeometry(x,y,w,h);
1941 }
1942#endif
1943
1944} 1944}
1945 1945
1946 1946
1947void CalendarView::writeSettings() 1947void CalendarView::writeSettings()
1948{ 1948{
1949 // kdDebug() << "CalendarView::writeSettings" << endl; 1949 // kdDebug() << "CalendarView::writeSettings" << endl;
1950 1950
1951 KConfig *config = KOGlobals::config(); 1951 KConfig *config = KOGlobals::config();
1952 1952
1953 mViewManager->writeSettings( config ); 1953 mViewManager->writeSettings( config );
1954 mTodoList->saveLayout(config,QString("Todo Layout")); 1954 mTodoList->saveLayout(config,QString("Todo Layout"));
1955 mDialogManager->writeSettings( config ); 1955 mDialogManager->writeSettings( config );
1956 //KOPrefs::instance()->usrWriteConfig(); 1956 //KOPrefs::instance()->usrWriteConfig();
1957 KOPrefs::instance()->writeConfig(); 1957 KOPrefs::instance()->writeConfig();
1958 1958
1959 writeFilterSettings(config); 1959 writeFilterSettings(config);
1960 1960
1961 config->setGroup( "Views" ); 1961 config->setGroup( "Views" );
1962 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1962 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1963 1963
1964 QValueList<int> listINT = mLeftFrame->sizes(); 1964 QValueList<int> listINT = mLeftFrame->sizes();
1965 config->writeEntry("Left Splitter Frame",listINT); 1965 config->writeEntry("Left Splitter Frame",listINT);
1966 QValueList<int> listINT2 = mMainFrame->sizes(); 1966 QValueList<int> listINT2 = mMainFrame->sizes();
1967 config->writeEntry("Main Splitter Frame",listINT2); 1967 config->writeEntry("Main Splitter Frame",listINT2);
1968#ifdef DESKTOP_VERSION 1968#ifdef DESKTOP_VERSION
1969 config->setGroup("WidgetLayout"); 1969 config->setGroup("WidgetLayout");
1970 QStringList list ;//= config->readListEntry("MainLayout"); 1970 QStringList list ;//= config->readListEntry("MainLayout");
1971 int x,y,w,h; 1971 int x,y,w,h;
1972 QWidget* wid; 1972 QWidget* wid;
1973 wid = topLevelWidget(); 1973 wid = topLevelWidget();
1974 x = wid->geometry().x(); 1974 x = wid->geometry().x();
1975 y = wid->geometry().y(); 1975 y = wid->geometry().y();
1976 w = wid->width(); 1976 w = wid->width();
1977 h = wid->height(); 1977 h = wid->height();
1978 list.clear(); 1978 list.clear();
1979 list << QString::number( x ); 1979 list << QString::number( x );
1980 list << QString::number( y ); 1980 list << QString::number( y );
1981 list << QString::number( w ); 1981 list << QString::number( w );
1982 list << QString::number( h ); 1982 list << QString::number( h );
1983 config->writeEntry("MainLayout",list ); 1983 config->writeEntry("MainLayout",list );
1984 1984
1985 wid = mEventEditor; 1985 wid = mEventEditor;
1986 x = wid->geometry().x(); 1986 x = wid->geometry().x();
1987 y = wid->geometry().y(); 1987 y = wid->geometry().y();
1988 w = wid->width(); 1988 w = wid->width();
1989 h = wid->height(); 1989 h = wid->height();
1990 list.clear(); 1990 list.clear();
1991 list << QString::number( x ); 1991 list << QString::number( x );
1992 list << QString::number( y ); 1992 list << QString::number( y );
1993 list << QString::number( w ); 1993 list << QString::number( w );
1994 list << QString::number( h ); 1994 list << QString::number( h );
1995 config->writeEntry("EditEventLayout",list ); 1995 config->writeEntry("EditEventLayout",list );
1996 1996
1997 wid = mTodoEditor; 1997 wid = mTodoEditor;
1998 x = wid->geometry().x(); 1998 x = wid->geometry().x();
1999 y = wid->geometry().y(); 1999 y = wid->geometry().y();
2000 w = wid->width(); 2000 w = wid->width();
2001 h = wid->height(); 2001 h = wid->height();
2002 list.clear(); 2002 list.clear();
2003 list << QString::number( x ); 2003 list << QString::number( x );
2004 list << QString::number( y ); 2004 list << QString::number( y );
2005 list << QString::number( w ); 2005 list << QString::number( w );
2006 list << QString::number( h ); 2006 list << QString::number( h );
2007 config->writeEntry("EditTodoLayout",list ); 2007 config->writeEntry("EditTodoLayout",list );
2008 wid = getEventViewerDialog(); 2008 wid = getEventViewerDialog();
2009 x = wid->geometry().x(); 2009 x = wid->geometry().x();
2010 y = wid->geometry().y(); 2010 y = wid->geometry().y();
2011 w = wid->width(); 2011 w = wid->width();
2012 h = wid->height(); 2012 h = wid->height();
2013 list.clear(); 2013 list.clear();
2014 list << QString::number( x ); 2014 list << QString::number( x );
2015 list << QString::number( y ); 2015 list << QString::number( y );
2016 list << QString::number( w ); 2016 list << QString::number( w );
2017 list << QString::number( h ); 2017 list << QString::number( h );
2018 config->writeEntry("ViewerLayout",list ); 2018 config->writeEntry("ViewerLayout",list );
2019 wid = mDialogManager->getSearchDialog(); 2019 wid = mDialogManager->getSearchDialog();
2020 if ( wid ) { 2020 if ( wid ) {
2021 x = wid->geometry().x(); 2021 x = wid->geometry().x();
2022 y = wid->geometry().y(); 2022 y = wid->geometry().y();
2023 w = wid->width(); 2023 w = wid->width();
2024 h = wid->height(); 2024 h = wid->height();
2025 list.clear(); 2025 list.clear();
2026 list << QString::number( x ); 2026 list << QString::number( x );
2027 list << QString::number( y ); 2027 list << QString::number( y );
2028 list << QString::number( w ); 2028 list << QString::number( w );
2029 list << QString::number( h ); 2029 list << QString::number( h );
2030 config->writeEntry("SearchLayout",list ); 2030 config->writeEntry("SearchLayout",list );
2031 } 2031 }
2032#endif 2032#endif
2033 2033
2034 2034
2035 config->sync(); 2035 config->sync();
2036} 2036}
2037 2037
2038void CalendarView::readFilterSettings(KConfig *config) 2038void CalendarView::readFilterSettings(KConfig *config)
2039{ 2039{