-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 @@ -333,41 +333,41 @@ void CalendarView::init() } else { leftFrameLayout->addWidget(mTodoList,2 ); leftFrameLayout->addWidget(mFilterView ); } #endif mFilterView->hide(); QWidget *rightBox = new QWidget( mainBox ); mainBoxLayout->addWidget ( rightBox, 10 ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 10 ); //mLeftFrame = (QWidget *)leftFrame; if ( KOPrefs::instance()->mVerticalScreen ) { mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); - //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); + mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); } else { mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); - //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); + mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); } if ( !KOPrefs::instance()->mShowDateNavigator) - mLeftFrame->toggle(); + mDateNavigator->hide(); //qDebug("Calendarview Size %d %d ", width(), height()); #endif connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( showDates( const KCal::DateList & ) ) ); connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), mNavigator, SLOT( selectWeek( const QDate & ) ) ); connect( mDateNavigator, SIGNAL( goPrevYear() ), mNavigator, SLOT( selectPreviousYear() ) ); connect( mDateNavigator, SIGNAL( goNextYear() ), @@ -1808,32 +1808,68 @@ void CalendarView::readSettings() } mPanner->setSizes(sizes); sizes = config->readIntListEntry("Separator2"); if ( ( mResourceView && sizes.count() == 4 ) || ( !mResourceView && sizes.count() == 3 ) ) { mLeftSplitter->setSizes(sizes); } #endif globalFlagBlockAgenda = 1; mViewManager->showAgendaView(); //mViewManager->readSettings( config ); mTodoList->restoreLayout(config,QString("Todo Layout")); readFilterSettings(config); config->setGroup( "Views" ); int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); + + QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); + + int resetval = 0; + int maxVal = 0; + if (sizes.count() != 3) { + if ( KOPrefs::instance()->mVerticalScreen ) { + resetval = mDateNavigator->sizeHint().width()+2; + } else { + resetval = mDateNavigator->sizeHint().height()+2; + } + } + if ( !resetval ){// i.e. sizes.count() == 3 + if ( KOPrefs::instance()->mVerticalScreen ) { + if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) + resetval = mDateNavigator->sizeHint().width()+2; + } else { + if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) + resetval = mDateNavigator->sizeHint().height()+2; + } + } + if ( resetval ) { + sizes.clear(); + if ( KOPrefs::instance()->mVerticalScreen ) { + maxVal = QApplication::desktop()->width() -10; + } else { + maxVal = QApplication::desktop()->height()-10; + } + sizes << resetval; + if ( maxVal < resetval + resetval) + resetval = maxVal - resetval; + sizes << resetval; + sizes << 100; + } + mLeftFrame->setSizes(sizes); + qDebug("sizes count %d ", sizes.count()); if ( dateCount == 5 ) mNavigator->selectWorkWeek(); else if ( dateCount == 7 ) mNavigator->selectWeek(); else mNavigator->selectDates( dateCount ); // mViewManager->readSettings( config ); updateConfig(); globalFlagBlockAgenda = 2; mViewManager->readSettings( config ); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list; list = config->readListEntry("MainLayout"); int x,y,w,h; if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); @@ -1888,32 +1924,35 @@ void CalendarView::writeSettings() list = mLeftSplitter->sizes(); config->writeEntry("Separator2",list); #endif mViewManager->writeSettings( config ); mTodoList->saveLayout(config,QString("Todo Layout")); mDialogManager->writeSettings( config ); //KOPrefs::instance()->usrWriteConfig(); KOPrefs::instance()->writeConfig(); writeFilterSettings(config); config->setGroup( "Views" ); config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); + QValueList<int> list = mLeftFrame->sizes(); + config->writeEntry("Left Splitter Frame",list); + #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list ;//= config->readListEntry("MainLayout"); int x,y,w,h; QWidget* wid; wid = topLevelWidget(); x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("MainLayout",list ); @@ -3701,40 +3740,37 @@ QWidget *CalendarView::leftFrame() { return ( QWidget *)mLeftFrame; } DateNavigator *CalendarView::dateNavigator() { return mNavigator; } KDateNavigator* CalendarView::dateNavigatorWidget() { return mDateNavigator->navigatorView(); } void CalendarView::toggleDateNavigatorWidget() { KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; - mLeftFrame->toggle(); - // FIXME mShowDateNavigator is not the toggle state of mLeftFrame -#if 0 + if (!KOPrefs::instance()->mShowDateNavigator ) mDateNavigator->hide(); else mDateNavigator->show(); -#endif } void CalendarView::addView(KOrg::BaseView *view) { mViewManager->addView(view); } void CalendarView::showView(KOrg::BaseView *view) { mViewManager->showView(view, mLeftFrame->isVisible()); } Incidence *CalendarView::currentSelection() { return mViewManager->currentSelection(); } void CalendarView::toggleAllDaySize() |