-rw-r--r-- | korganizer/komonthview.cpp | 72 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 |
2 files changed, 46 insertions, 27 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 38cfda7..12233ee 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -756,14 +756,3 @@ void MonthViewCell::finishUpdateCell() setMyPalette(); - QString text; - bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; - if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { - text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; - mLabel->resize( mLabelBigSize ); - text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); - } else { - mLabel->resize( mLabelSize ); - text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); - } - - mLabel->setText( text ); + resizeEvent( 0 ); @@ -897,2 +886,17 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) deselect(); + mLabel->setMaximumHeight( height() - lineWidth()*2 ); + + QString text; + mLabel->setText( text ); + bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; + if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { + text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; + mLabel->resize( mLabelBigSize ); + text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); + } else { + mLabel->resize( mLabelSize ); + text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); + } + mLabel->setText( text ); + int size = height() - mLabel->height() - lineWidth()-1; @@ -1450,3 +1454,3 @@ void KOMonthView::updateView() processSelectionChange(); - qApp->processEvents(); + //qApp->processEvents(); for( i = 0; i < timeSpan+1; ++i ) { @@ -1476,5 +1480,5 @@ 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 "); + //qDebug("KOMonthView::isVisible "); slotComputeLayout(); @@ -1487,3 +1491,3 @@ void KOMonthView::slotComputeLayout() mComputeLayoutTimer->stop(); - qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); + //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); computeLayout(); @@ -1516,3 +1520,3 @@ void KOMonthView::computeLayoutWeek() if ( lastWid == width() && lastHei == height() ) { - qDebug("KOListWeekView::No compute layout needed "); + //qDebug("KOListWeekView::No compute layout needed "); return; @@ -1569,2 +1573,3 @@ void KOMonthView::computeLayoutWeek() h = cellHei; + int max = 0; for ( i = 0; i < mCellsW.count(); ++i) { @@ -1584,3 +1589,4 @@ void KOMonthView::computeLayoutWeek() if ( i ==5 ) { - mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); + max = h/2; + mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); x -= w ;y += h/2; @@ -1590,7 +1596,10 @@ void KOMonthView::computeLayoutWeek() } - mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); + max = h-h/2; + mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); y -= h/2; } - } else + } else { + max = h; mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); + } @@ -1602,2 +1611,3 @@ void KOMonthView::computeLayoutWeek() } + //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); } @@ -1644,3 +1654,3 @@ void KOMonthView::computeLayout() if ( lastWid == width() && lastHei == height() ){ - qDebug("KOMonthview::No compute layout needed "); + //qDebug("KOMonthview::No compute layout needed "); return; @@ -1650,3 +1660,3 @@ void KOMonthView::computeLayout() lastHei = height(); - qDebug("KOMonthView::computeLayout() MMM ------------------- "); + //qDebug("KOMonthView::computeLayout() MMM ------------------- "); QFontMetrics fm ( mWeekLabels[0]->font() ); @@ -1686,2 +1696,3 @@ void KOMonthView::computeLayout() h = cellHei ; + int max = 0; for ( i = 0; i < mCells.count(); ++i) { @@ -1697,14 +1708,20 @@ void KOMonthView::computeLayout() if ( (i)%7 == daysToShow-1 ) { - mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); + max = h/2; + mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); x -= w ;y += h/2; } else { - mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); + max = h-h/2; + mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); y -= h/2; } - } else + } else { + max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); + } } - else + else { + max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); + } x += w; @@ -1713,3 +1730,4 @@ void KOMonthView::computeLayout() y += h; - } + } + //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); } diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index b997c1a..a58f6b8 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -161,2 +161,3 @@ class MonthViewCell : public KNoScrollListBox QDate selectedIncidenceDate(); + QPushButton * dateLabel() { return mLabel; } |