summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp68
-rw-r--r--korganizer/komonthview.h1
2 files changed, 44 insertions, 25 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 38cfda7..12233ee 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -755,16 +755,5 @@ void MonthViewCell::finishUpdateCell()
//setMyPalette();
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 );
@@ -896,4 +885,19 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
//qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
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;
//qDebug("LW %d ", lineWidth());
@@ -1449,5 +1453,5 @@ void KOMonthView::updateView()
}
processSelectionChange();
- qApp->processEvents();
+ //qApp->processEvents();
for( i = 0; i < timeSpan+1; ++i ) {
(*cells)[i]->repaintfinishUpdateCell();
@@ -1475,7 +1479,7 @@ 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());
+ //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();
} else
@@ -1486,5 +1490,5 @@ void KOMonthView::slotComputeLayout()
{
mComputeLayoutTimer->stop();
- qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
+ //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
computeLayout();
clPending = true;
@@ -1515,5 +1519,5 @@ void KOMonthView::computeLayoutWeek()
if ( lastWid == width() && lastHei == height() ) {
- qDebug("KOListWeekView::No compute layout needed ");
+ //qDebug("KOListWeekView::No compute layout needed ");
return;
}
@@ -1568,4 +1572,5 @@ void KOMonthView::computeLayoutWeek()
w = colWid;
h = cellHei;
+ int max = 0;
for ( i = 0; i < mCellsW.count(); ++i) {
if ( i > 6 ) {
@@ -1583,5 +1588,6 @@ void KOMonthView::computeLayoutWeek()
if ( i >= 5 ) {
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;
} else {
@@ -1589,9 +1595,12 @@ void KOMonthView::computeLayoutWeek()
++w;
}
- 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 );
+ }
@@ -1601,4 +1610,5 @@ void KOMonthView::computeLayoutWeek()
y += h+dayLabelHei ;
}
+ //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
}
y= dayLabelHei;
@@ -1643,5 +1653,5 @@ void KOMonthView::computeLayout()
}
if ( lastWid == width() && lastHei == height() ){
- qDebug("KOMonthview::No compute layout needed ");
+ //qDebug("KOMonthview::No compute layout needed ");
return;
}
@@ -1649,5 +1659,5 @@ void KOMonthView::computeLayout()
lastWid = width();
lastHei = height();
- qDebug("KOMonthView::computeLayout() MMM ------------------- ");
+ //qDebug("KOMonthView::computeLayout() MMM ------------------- ");
QFontMetrics fm ( mWeekLabels[0]->font() );
int weeklabelwid = fm.width( "888" );
@@ -1685,4 +1695,5 @@ void KOMonthView::computeLayout()
w = colWid;
h = cellHei ;
+ int max = 0;
for ( i = 0; i < mCells.count(); ++i) {
//qDebug("iii %d ", i);
@@ -1696,16 +1707,22 @@ void KOMonthView::computeLayout()
if ( (i)%7 >= daysToShow-1 ) {
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;
if ( x + w/2 > wid ) {
@@ -1713,4 +1730,5 @@ void KOMonthView::computeLayout()
y += h;
}
+ //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
}
y= dayLabelHei;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index b997c1a..a58f6b8 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -160,4 +160,5 @@ class MonthViewCell : public KNoScrollListBox
Incidence *selectedIncidence();
QDate selectedIncidenceDate();
+ QPushButton * dateLabel() { return mLabel; }
void deselect();