summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-25 13:47:53 (UTC)
committer zautrix <zautrix>2005-03-25 13:47:53 (UTC)
commit5a0130ffdbf03fa5b881f856b41d081e91e1958b (patch) (side-by-side diff)
treec71ac939789927dd9c77f2c6e88b910008db7f9b
parente3b935f4e24086117213662e670ab26cb2ad8822 (diff)
downloadkdepimpi-5a0130ffdbf03fa5b881f856b41d081e91e1958b.zip
kdepimpi-5a0130ffdbf03fa5b881f856b41d081e91e1958b.tar.gz
kdepimpi-5a0130ffdbf03fa5b881f856b41d081e91e1958b.tar.bz2
layout fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp72
-rw-r--r--korganizer/komonthview.h1
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
@@ -751,24 +751,13 @@ void MonthViewCell::finishUpdateCell()
QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
}
#endif
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 );
}
void MonthViewCell::updateCell()
{
//qDebug("MonthViewCell::updateCell() ");
@@ -892,12 +881,27 @@ void MonthViewCell::select()
void MonthViewCell::resizeEvent ( QResizeEvent * e )
{
if ( !mMonthView->isUpdatePossible() )
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 )
verticalScrollBar()->setMaximumHeight( size );
size = width() - mLabel->width() -lineWidth()-1;
if ( size > 0 )
@@ -1445,13 +1449,13 @@ void KOMonthView::updateView()
}
for( i = 0; i < timeSpan+1; ++i ) {
(*cells)[i]->finishUpdateCell();
}
processSelectionChange();
- qApp->processEvents();
+ //qApp->processEvents();
for( i = 0; i < timeSpan+1; ++i ) {
(*cells)[i]->repaintfinishUpdateCell();
}
(*cells)[0]->setFocus();
@@ -1471,24 +1475,24 @@ void KOMonthView::updateView()
//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 ");
+ //qDebug("KOMonthView::isVisible ");
slotComputeLayout();
} else
mComputeLayoutTimer->start( 100 );
}
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 )
mCellsW[0]->setFocus();
else
mCells[0]->setFocus();
@@ -1511,13 +1515,13 @@ void KOMonthView::computeLayoutWeek()
int hei = height()-1-mNavigatorBar->height();
if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
return;
if ( lastWid == width() && lastHei == height() ) {
- qDebug("KOListWeekView::No compute layout needed ");
+ //qDebug("KOListWeekView::No compute layout needed ");
return;
}
lastWid = width();
lastHei = height();
@@ -1564,12 +1568,13 @@ void KOMonthView::computeLayoutWeek()
x += w;
}
x= 0;
y= dayLabelHei;
w = colWid;
h = cellHei;
+ int max = 0;
for ( i = 0; i < mCellsW.count(); ++i) {
if ( i > 6 ) {
mCellsW[i]->hide();
continue;
}
@@ -1579,30 +1584,35 @@ void KOMonthView::computeLayoutWeek()
}
if ( i == (daysToShow-1-rowModulo)*7)
++h;
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;
if ( x + w/2 > wid ) {
x = 0;
y += h+dayLabelHei ;
}
+ //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
}
y= dayLabelHei;
h = cellHei ;
mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
// qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
@@ -1639,19 +1649,19 @@ void KOMonthView::computeLayout()
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 ");
+ //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 );
@@ -1681,40 +1691,48 @@ void KOMonthView::computeLayout()
x += w;
}
x= 0;
y= dayLabelHei;
w = colWid;
h = cellHei ;
+ int max = 0;
for ( i = 0; i < mCells.count(); ++i) {
//qDebug("iii %d ", i);
w = colWid;
if ( ((i) % 7) >= 7-colModulo ) {
++w;
}
if ( i == (6-rowModulo)*7)
++h;
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 ;
for ( i = 0; i < 6; i++) {
if ( i == (6-rowModulo))
++h;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index b997c1a..a58f6b8 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -156,12 +156,13 @@ class MonthViewCell : public KNoScrollListBox
void updateConfig( bool bigFont = false );
void enableScrollBars( bool );
Incidence *selectedIncidence();
QDate selectedIncidenceDate();
+ QPushButton * dateLabel() { return mLabel; }
void deselect();
void select();
#ifdef DESKTOP_VERSION
static QToolTipGroup *toolTipGroup();