From 7de846e9f01ce27b622541493e6a02e26e37bf2c Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 07 Feb 2005 13:03:38 +0000 Subject: fixxxx --- (limited to 'korganizer/komonthview.cpp') diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 234375b..7ba0b2f 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -793,8 +793,9 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) { skipResize = false; clPending = true; + mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); mWidStack = new QWidgetStack( this ); - QHBoxLayout* hb = new QHBoxLayout( this ); + QVBoxLayout* hb = new QVBoxLayout( this ); mMonthView = new QWidget( mWidStack ); mWeekView = new QWidget( mWidStack ); #if QT_VERSION >= 0x030000 @@ -804,12 +805,14 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWidStack->addWidget( mMonthView, 1 ); mWidStack->addWidget( mWeekView , 1 ); #endif + hb->addWidget( mNavigatorBar ); hb->addWidget( mWidStack ); mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); mShowWeekView = KOPrefs::instance()->mMonthViewWeek; if ( mShowWeekView ) mWeekStartsMonday = true; updatePossible = false; + //updatePossible = true; mCells.setAutoDelete( true ); mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; mDayLabels.resize( mDaysPerWeek ); @@ -917,6 +920,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWidStack->raiseWidget( mMonthView ); emit incidenceSelected( 0 ); +#ifndef DESKTOP_VERSION + resize( QApplication::desktop()->size() ); + computeLayout(); +#endif } KOMonthView::~KOMonthView() @@ -943,7 +950,6 @@ void KOMonthView::switchView() selectedCell()->deselect(); mShowWeekView = !mShowWeekView; KOPrefs::instance()->mMonthViewWeek = mShowWeekView; - //emit showNavigator( !mShowWeekView ); if ( clPending ) { computeLayout(); updateConfig(); @@ -1260,12 +1266,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()); - if ( skipResize ) { - skipResize = false; - qDebug("skipResize "); - return; - } + //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); computeLayout(); clPending = true; if ( mShowWeekView ) @@ -1286,16 +1287,15 @@ void KOMonthView::computeLayoutWeek() int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); - int wid = size().width();//e - int hei = size().height()-1; + 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() ) return; - lastWid =width(); + lastWid = width(); lastHei = height(); @@ -1306,7 +1306,7 @@ void KOMonthView::computeLayoutWeek() mShowSatSunComp = true; combinedSatSun = true; - qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); + //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; @@ -1387,11 +1387,11 @@ void KOMonthView::computeLayoutWeek() //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; updateDayLabels(); - bool forceUpdate = !updatePossible; + //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("M")); - if ( forceUpdate ) - updateView(); + //if ( forceUpdate ) + // updateView(); } void KOMonthView::computeLayout() { @@ -1413,16 +1413,19 @@ void KOMonthView::computeLayout() int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); - int wid = size().width();//e - int hei = size().height()-1; + int wid = width();//e + int hei = height()-1-mNavigatorBar->height(); - if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) + if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { return; - if ( lastWid == width() && lastHei ==height() ) + } + if ( lastWid == width() && lastHei == height() ){ return; - lastWid =width(); - lastHei = height(); - qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); + } + + lastWid = width(); + lastHei = height(); + //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; @@ -1500,11 +1503,9 @@ void KOMonthView::computeLayout() //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; updateDayLabels(); - bool forceUpdate = !updatePossible; + //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("W")); - if ( forceUpdate ) - updateView(); } void KOMonthView::showContextMenu( Incidence *incidence ) -- cgit v0.9.0.2