summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp26
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
@@ -991,12 +991,17 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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
@@ -1348,19 +1353,31 @@ 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 ");
+ 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;
@@ -1375,14 +1392,16 @@ void KOMonthView::computeLayoutWeek()
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;
@@ -1502,18 +1521,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 ");
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 );