-rw-r--r-- | korganizer/calendarview.cpp | 76 |
1 files changed, 56 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3ce123c..ab59d00 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -296,23 +296,27 @@ void CalendarView::init() mLeftFrame = mLeftSplitter; #else - QWidget *mainBox = new QWidget( this ); + //QWidget *mainBox = new QWidget( this ); //QWidget *leftFrame = new QWidget( mainBox ); - QBoxLayout * mainBoxLayout; + //QBoxLayout * mainBoxLayout; if ( KOPrefs::instance()->mVerticalScreen ) { - mainBoxLayout = new QVBoxLayout(mainBox); + //mainBoxLayout = new QVBoxLayout(mainBox); //leftFrameLayout = new QHBoxLayout(leftFrame ); - mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);; - mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); + mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); + mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); + mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; + mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } else { - mainBoxLayout = new QHBoxLayout(mainBox); + //mainBoxLayout = new QHBoxLayout(mainBox); //leftFrameLayout = new QVBoxLayout(leftFrame ); - mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);; + mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); + mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); + mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); } //QBoxLayout * leftFrameLayout; - topLayout->addWidget( mainBox ); - mainBoxLayout->addWidget (mLeftFrame); + topLayout->addWidget( mMainFrame ); + //mainBoxLayout->addWidget (mLeftFrame); mDateNavigator = new DateNavigatorContainer( mLeftFrame, "CalendarView::DateNavigator" ); #if 0 @@ -336,21 +340,21 @@ void CalendarView::init() } #endif mFilterView->hide(); - QWidget *rightBox = new QWidget( mainBox ); - mainBoxLayout->addWidget ( rightBox, 10 ); + QWidget *rightBox = new QWidget( mMainFrame ); + //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->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() ); + //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); + //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); } if ( !KOPrefs::instance()->mShowDateNavigator) @@ -1835,11 +1839,11 @@ void CalendarView::readSettings() } if ( !resetval ){// i.e. sizes.count() == 3 if ( KOPrefs::instance()->mVerticalScreen ) { - if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) - resetval = mDateNavigator->sizeHint().width()+2; + 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 ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) + resetval = mDateNavigator->sizeHint().height()+2; } } if ( resetval ) { @@ -1856,6 +1860,37 @@ void CalendarView::readSettings() sizes << 100; } mLeftFrame->setSizes(sizes); + sizes = config->readIntListEntry("Main Splitter Frame"); + 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; + } + mMainFrame->setSizes(sizes); + if ( dateCount == 5 ) mNavigator->selectWorkWeek(); else if ( dateCount == 7 ) mNavigator->selectWeek(); else mNavigator->selectDates( dateCount ); @@ -1928,7 +1963,8 @@ void CalendarView::writeSettings() QValueList<int> listINT = mLeftFrame->sizes(); config->writeEntry("Left Splitter Frame",listINT); - + listINT = mMainFrame->sizes(); + config->writeEntry("Main Splitter Frame",listINT); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list ;//= config->readListEntry("MainLayout"); |