-rw-r--r-- | korganizer/calendarview.cpp | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 00285a5..29c530b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -345,17 +345,17 @@ void CalendarView::init() | |||
345 | //mLeftFrame = (QWidget *)leftFrame; | 345 | //mLeftFrame = (QWidget *)leftFrame; |
346 | if ( KOPrefs::instance()->mVerticalScreen ) { | 346 | if ( KOPrefs::instance()->mVerticalScreen ) { |
347 | mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 347 | mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
348 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 348 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
349 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 349 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
350 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 350 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
351 | } else { | 351 | } else { |
352 | mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 352 | mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
353 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 353 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
354 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 354 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
355 | } | 355 | } |
356 | if ( !KOPrefs::instance()->mShowDateNavigator) | 356 | if ( !KOPrefs::instance()->mShowDateNavigator) |
357 | mLeftFrame->toggle(); | 357 | mDateNavigator->hide(); |
358 | //qDebug("Calendarview Size %d %d ", width(), height()); | 358 | //qDebug("Calendarview Size %d %d ", width(), height()); |
359 | #endif | 359 | #endif |
360 | 360 | ||
361 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 361 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
@@ -1820,8 +1820,44 @@ void CalendarView::readSettings() | |||
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 | |||
1825 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | ||
1826 | |||
1827 | int resetval = 0; | ||
1828 | int maxVal = 0; | ||
1829 | if (sizes.count() != 3) { | ||
1830 | if ( KOPrefs::instance()->mVerticalScreen ) { | ||
1831 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1832 | } else { | ||
1833 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1834 | } | ||
1835 | } | ||
1836 | if ( !resetval ){// i.e. sizes.count() == 3 | ||
1837 | if ( KOPrefs::instance()->mVerticalScreen ) { | ||
1838 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | ||
1839 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1840 | } else { | ||
1841 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | ||
1842 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1843 | } | ||
1844 | } | ||
1845 | if ( resetval ) { | ||
1846 | sizes.clear(); | ||
1847 | if ( KOPrefs::instance()->mVerticalScreen ) { | ||
1848 | maxVal = QApplication::desktop()->width() -10; | ||
1849 | } else { | ||
1850 | maxVal = QApplication::desktop()->height()-10; | ||
1851 | } | ||
1852 | sizes << resetval; | ||
1853 | if ( maxVal < resetval + resetval) | ||
1854 | resetval = maxVal - resetval; | ||
1855 | sizes << resetval; | ||
1856 | sizes << 100; | ||
1857 | } | ||
1858 | mLeftFrame->setSizes(sizes); | ||
1859 | qDebug("sizes count %d ", sizes.count()); | ||
1824 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1860 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1825 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1861 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1826 | else mNavigator->selectDates( dateCount ); | 1862 | else mNavigator->selectDates( dateCount ); |
1827 | // mViewManager->readSettings( config ); | 1863 | // mViewManager->readSettings( config ); |
@@ -1900,8 +1936,11 @@ void CalendarView::writeSettings() | |||
1900 | 1936 | ||
1901 | config->setGroup( "Views" ); | 1937 | config->setGroup( "Views" ); |
1902 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1938 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1903 | 1939 | ||
1940 | QValueList<int> list = mLeftFrame->sizes(); | ||
1941 | config->writeEntry("Left Splitter Frame",list); | ||
1942 | |||
1904 | #ifdef DESKTOP_VERSION | 1943 | #ifdef DESKTOP_VERSION |
1905 | config->setGroup("WidgetLayout"); | 1944 | config->setGroup("WidgetLayout"); |
1906 | QStringList list ;//= config->readListEntry("MainLayout"); | 1945 | QStringList list ;//= config->readListEntry("MainLayout"); |
1907 | int x,y,w,h; | 1946 | int x,y,w,h; |
@@ -3713,16 +3752,13 @@ KDateNavigator* CalendarView::dateNavigatorWidget() | |||
3713 | } | 3752 | } |
3714 | void CalendarView::toggleDateNavigatorWidget() | 3753 | void CalendarView::toggleDateNavigatorWidget() |
3715 | { | 3754 | { |
3716 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3755 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3717 | mLeftFrame->toggle(); | 3756 | |
3718 | // FIXME mShowDateNavigator is not the toggle state of mLeftFrame | ||
3719 | #if 0 | ||
3720 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3757 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3721 | mDateNavigator->hide(); | 3758 | mDateNavigator->hide(); |
3722 | else | 3759 | else |
3723 | mDateNavigator->show(); | 3760 | mDateNavigator->show(); |
3724 | #endif | ||
3725 | } | 3761 | } |
3726 | void CalendarView::addView(KOrg::BaseView *view) | 3762 | void CalendarView::addView(KOrg::BaseView *view) |
3727 | { | 3763 | { |
3728 | mViewManager->addView(view); | 3764 | mViewManager->addView(view); |