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
@@ -754,18 +754,7 @@ void MonthViewCell::finishUpdateCell()
sort();
//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 );
}
@@ -895,6 +884,21 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
return;
//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());
if ( size > 0 )
@@ -1448,7 +1452,7 @@ void KOMonthView::updateView()
(*cells)[i]->finishUpdateCell();
}
processSelectionChange();
- qApp->processEvents();
+ //qApp->processEvents();
for( i = 0; i < timeSpan+1; ++i ) {
(*cells)[i]->repaintfinishUpdateCell();
}
@@ -1474,9 +1478,9 @@ 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
mComputeLayoutTimer->start( 100 );
@@ -1485,7 +1489,7 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
void KOMonthView::slotComputeLayout()
{
mComputeLayoutTimer->stop();
- qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
+ //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
computeLayout();
clPending = true;
if ( mShowWeekView )
@@ -1514,7 +1518,7 @@ void KOMonthView::computeLayoutWeek()
return;
if ( lastWid == width() && lastHei == height() ) {
- qDebug("KOListWeekView::No compute layout needed ");
+ //qDebug("KOListWeekView::No compute layout needed ");
return;
}
lastWid = width();
@@ -1567,6 +1571,7 @@ void KOMonthView::computeLayoutWeek()
y= dayLabelHei;
w = colWid;
h = cellHei;
+ int max = 0;
for ( i = 0; i < mCellsW.count(); ++i) {
if ( i > 6 ) {
mCellsW[i]->hide();
@@ -1582,17 +1587,21 @@ 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 {
if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
++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 );
+ }
x += w;
@@ -1600,6 +1609,7 @@ void KOMonthView::computeLayoutWeek()
x = 0;
y += h+dayLabelHei ;
}
+ //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
}
y= dayLabelHei;
h = cellHei ;
@@ -1642,13 +1652,13 @@ void KOMonthView::computeLayout()
return;
}
if ( lastWid == width() && lastHei == height() ){
- qDebug("KOMonthview::No compute layout needed ");
+ //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;
@@ -1684,6 +1694,7 @@ void KOMonthView::computeLayout()
y= dayLabelHei;
w = colWid;
h = cellHei ;
+ int max = 0;
for ( i = 0; i < mCells.count(); ++i) {
//qDebug("iii %d ", i);
w = colWid;
@@ -1695,23 +1706,30 @@ void KOMonthView::computeLayout()
if ( combinedSatSun ) {
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 ) {
x = 0;
y += h;
}
+ //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
}
y= dayLabelHei;
h = cellHei ;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index b997c1a..a58f6b8 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -159,6 +159,7 @@ class MonthViewCell : public KNoScrollListBox
Incidence *selectedIncidence();
QDate selectedIncidenceDate();
+ QPushButton * dateLabel() { return mLabel; }
void deselect();
void select();