-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 | |||
@@ -337,33 +337,33 @@ void CalendarView::init() | |||
337 | #endif | 337 | #endif |
338 | mFilterView->hide(); | 338 | mFilterView->hide(); |
339 | QWidget *rightBox = new QWidget( mainBox ); | 339 | QWidget *rightBox = new QWidget( mainBox ); |
340 | mainBoxLayout->addWidget ( rightBox, 10 ); | 340 | mainBoxLayout->addWidget ( rightBox, 10 ); |
341 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 341 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
342 | mRightFrame = new QWidgetStack( rightBox ); | 342 | mRightFrame = new QWidgetStack( rightBox ); |
343 | rightLayout->addWidget( mRightFrame, 10 ); | 343 | rightLayout->addWidget( mRightFrame, 10 ); |
344 | 344 | ||
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 & ) ), |
362 | SLOT( showDates( const KCal::DateList & ) ) ); | 362 | SLOT( showDates( const KCal::DateList & ) ) ); |
363 | 363 | ||
364 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 364 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
365 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 365 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
366 | 366 | ||
367 | 367 | ||
368 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 368 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
369 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 369 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
@@ -1812,24 +1812,60 @@ void CalendarView::readSettings() | |||
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 | |||
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 ); |
1828 | updateConfig(); | 1864 | updateConfig(); |
1829 | globalFlagBlockAgenda = 2; | 1865 | globalFlagBlockAgenda = 2; |
1830 | mViewManager->readSettings( config ); | 1866 | mViewManager->readSettings( config ); |
1831 | #ifdef DESKTOP_VERSION | 1867 | #ifdef DESKTOP_VERSION |
1832 | config->setGroup("WidgetLayout"); | 1868 | config->setGroup("WidgetLayout"); |
1833 | QStringList list; | 1869 | QStringList list; |
1834 | list = config->readListEntry("MainLayout"); | 1870 | list = config->readListEntry("MainLayout"); |
1835 | int x,y,w,h; | 1871 | int x,y,w,h; |
@@ -1892,24 +1928,27 @@ void CalendarView::writeSettings() | |||
1892 | 1928 | ||
1893 | mViewManager->writeSettings( config ); | 1929 | mViewManager->writeSettings( config ); |
1894 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1930 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1895 | mDialogManager->writeSettings( config ); | 1931 | mDialogManager->writeSettings( config ); |
1896 | //KOPrefs::instance()->usrWriteConfig(); | 1932 | //KOPrefs::instance()->usrWriteConfig(); |
1897 | KOPrefs::instance()->writeConfig(); | 1933 | KOPrefs::instance()->writeConfig(); |
1898 | 1934 | ||
1899 | writeFilterSettings(config); | 1935 | writeFilterSettings(config); |
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; |
1908 | QWidget* wid; | 1947 | QWidget* wid; |
1909 | wid = topLevelWidget(); | 1948 | wid = topLevelWidget(); |
1910 | x = wid->geometry().x(); | 1949 | x = wid->geometry().x(); |
1911 | y = wid->geometry().y(); | 1950 | y = wid->geometry().y(); |
1912 | w = wid->width(); | 1951 | w = wid->width(); |
1913 | h = wid->height(); | 1952 | h = wid->height(); |
1914 | list.clear(); | 1953 | list.clear(); |
1915 | list << QString::number( x ); | 1954 | list << QString::number( x ); |
@@ -3705,32 +3744,29 @@ QWidget *CalendarView::leftFrame() | |||
3705 | DateNavigator *CalendarView::dateNavigator() | 3744 | DateNavigator *CalendarView::dateNavigator() |
3706 | { | 3745 | { |
3707 | return mNavigator; | 3746 | return mNavigator; |
3708 | } | 3747 | } |
3709 | 3748 | ||
3710 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3749 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3711 | { | 3750 | { |
3712 | return mDateNavigator->navigatorView(); | 3751 | return mDateNavigator->navigatorView(); |
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); |
3729 | } | 3765 | } |
3730 | 3766 | ||
3731 | void CalendarView::showView(KOrg::BaseView *view) | 3767 | void CalendarView::showView(KOrg::BaseView *view) |
3732 | { | 3768 | { |
3733 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3769 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3734 | } | 3770 | } |
3735 | 3771 | ||
3736 | Incidence *CalendarView::currentSelection() | 3772 | Incidence *CalendarView::currentSelection() |