-rw-r--r-- | korganizer/komonthview.cpp | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 234375b..7ba0b2f 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -794,6 +794,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) skipResize = false; clPending = true; + mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); mWidStack = new QWidgetStack( this ); - QHBoxLayout* hb = new QHBoxLayout( this ); + QVBoxLayout* hb = new QVBoxLayout( this ); mMonthView = new QWidget( mWidStack ); mWeekView = new QWidget( mWidStack ); @@ -805,4 +806,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWidStack->addWidget( mWeekView , 1 ); #endif + hb->addWidget( mNavigatorBar ); hb->addWidget( mWidStack ); mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); @@ -811,4 +813,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWeekStartsMonday = true; updatePossible = false; + //updatePossible = true; mCells.setAutoDelete( true ); mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; @@ -918,4 +921,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) emit incidenceSelected( 0 ); +#ifndef DESKTOP_VERSION + resize( QApplication::desktop()->size() ); + computeLayout(); +#endif } @@ -944,5 +951,4 @@ void KOMonthView::switchView() mShowWeekView = !mShowWeekView; KOPrefs::instance()->mMonthViewWeek = mShowWeekView; - //emit showNavigator( !mShowWeekView ); if ( clPending ) { computeLayout(); @@ -1261,10 +1267,5 @@ void KOMonthView::updateView() void KOMonthView::resizeEvent(QResizeEvent * e) { - qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); - if ( skipResize ) { - skipResize = false; - qDebug("skipResize "); - return; - } + //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); computeLayout(); clPending = true; @@ -1287,14 +1288,13 @@ void KOMonthView::computeLayoutWeek() int tHei = topLevelWidget()->size().height(); - int wid = size().width();//e - int hei = size().height()-1; + int wid = width();//e + int hei = height()-1-mNavigatorBar->height(); if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) return; - - if ( lastWid == width() && lastHei ==height() ) + if ( lastWid == width() && lastHei == height() ) return; - lastWid =width(); + lastWid = width(); lastHei = height(); @@ -1307,5 +1307,5 @@ void KOMonthView::computeLayoutWeek() combinedSatSun = true; - qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); + //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); @@ -1388,9 +1388,9 @@ void KOMonthView::computeLayoutWeek() mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; updateDayLabels(); - bool forceUpdate = !updatePossible; + //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("M")); - if ( forceUpdate ) - updateView(); + //if ( forceUpdate ) + // updateView(); } void KOMonthView::computeLayout() @@ -1414,14 +1414,17 @@ void KOMonthView::computeLayout() int tHei = topLevelWidget()->size().height(); - int wid = size().width();//e - int hei = size().height()-1; + int wid = width();//e + int hei = height()-1-mNavigatorBar->height(); - if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) + if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { return; - if ( lastWid == width() && lastHei ==height() ) + } + if ( lastWid == width() && lastHei == height() ){ return; - lastWid =width(); - lastHei = height(); - qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); + } + + lastWid = width(); + lastHei = height(); + //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); @@ -1501,9 +1504,7 @@ void KOMonthView::computeLayout() mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; updateDayLabels(); - bool forceUpdate = !updatePossible; + //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("W")); - if ( forceUpdate ) - updateView(); } |