-rw-r--r-- | korganizer/komonthview.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9fd1f68..8ee5bc3 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -981,32 +981,37 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWidthLongDayLabel = 0; for (int i = 0; i < 7; i++) { int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; } //mWeekLabels[mNumWeeks]->setText( i18n("W")); #if 0 if ( mShowWeekView ) mWidStack->raiseWidget( mWeekView ); else mWidStack->raiseWidget( mMonthView ); #endif emit incidenceSelected( 0 ); + + mComputeLayoutTimer = new QTimer( this ); + connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); + + #ifndef DESKTOP_VERSION resize( QApplication::desktop()->size() ); #else resize(640, 480 ); updatePossible = true; #endif computeLayout(); if ( mShowWeekView ) mWidStack->raiseWidget( mWeekView ); else mWidStack->raiseWidget( mMonthView ); } KOMonthView::~KOMonthView() { @@ -1338,61 +1343,75 @@ void KOMonthView::updateView() int i; for( i = 0; i < (*cells).count(); ++i ) { (*cells)[i]->updateCell(); } //qDebug("KOMonthView::updateView() "); processSelectionChange(); // qDebug("---------------------------------------------------------------------+ "); (*cells)[0]->setFocus(); #endif //qDebug("update time %d ", ti.elapsed()); } void KOMonthView::resizeEvent(QResizeEvent * e) { - //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); + qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); + if ( isVisible() ) { + qDebug("KOMonthView::isVisible "); + slotComputeLayout(); + } else + mComputeLayoutTimer->start( 100 ); +} + +void KOMonthView::slotComputeLayout() +{ + mComputeLayoutTimer->stop(); + qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); computeLayout(); clPending = true; if ( mShowWeekView ) mCellsW[0]->setFocus(); else mCells[0]->setFocus(); + } void KOMonthView::computeLayoutWeek() { static int lastWid = 0; static int lastHei = 0; int daysToShow; bool combinedSatSun = false; if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { daysToShow = 6; combinedSatSun = true; } int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); 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() ) { + qDebug("KOListWeekView::No compute layout needed "); return; + } lastWid = width(); lastHei = height(); if ( wid < hei ) daysToShow = 2; else daysToShow = 3; mShowSatSunComp = true; combinedSatSun = true; //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; @@ -1492,38 +1511,39 @@ void KOMonthView::computeLayout() int daysToShow = 7; bool combinedSatSun = false; if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { daysToShow = 6; combinedSatSun = true; } int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); 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() ){ + qDebug("KOMonthview::No compute layout needed "); return; } lastWid = width(); lastHei = height(); - //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); + qDebug("KOMonthView::computeLayout() MMM ------------------- "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; int colWid = wid / daysToShow; int lastCol = wid - ( colWid*6 ); int dayLabelHei = mDayLabels[0]->sizeHint().height(); int cellHei = (hei - dayLabelHei) /6; int colModulo = wid % daysToShow; int rowModulo = (hei- dayLabelHei) % 6; //qDebug("rowmod %d ", rowModulo); int i; int x,y,w,h; x= 0; y= 0; w = colWid; |