author | zautrix <zautrix> | 2005-02-06 13:44:49 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 13:44:49 (UTC) |
commit | 26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f (patch) (side-by-side diff) | |
tree | 34c4f5e6b2d77dc1210822e1539d9516842b5691 /korganizer/komonthview.cpp | |
parent | 118f5aab05c9ace5612d5c4fd69e7c5a59bed67b (diff) | |
download | kdepimpi-26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f.zip kdepimpi-26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f.tar.gz kdepimpi-26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f.tar.bz2 |
many small fixes
-rw-r--r-- | korganizer/komonthview.cpp | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 65accdc..5926abe 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -795,9 +795,11 @@ void MonthViewCell::selection( QListBoxItem *item ) KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) : KOEventView( calendar, parent, name ), mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), - mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) + mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) { - + ignoreResizeEvent = 0; + mShortDayLabelsW = false; + mShortDayLabelsM = false; clPending = true; mWidStack = new QWidgetStack( this ); QHBoxLayout* hb = new QHBoxLayout( this ); @@ -817,7 +819,6 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWeekStartsMonday = true; updatePossible = false; mCells.setAutoDelete( true ); - mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; mDayLabels.resize( mDaysPerWeek ); mDayLabelsW.resize( mDaysPerWeek ); QFont bfont = font(); @@ -906,14 +907,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); mContextMenu = eventPopup(); - // updateConfig(); //useless here + updateConfig(); //useless here //mWeekLabels[mNumWeeks]->setText( i18n("W")); -#if 0 - mWidStack = new QWidgetStack( this ); - mMonthView = new QWidget( mWidStack ); - mWeekView = new QWidget( mWidStack ); -#endif + if ( mShowWeekView ) mWidStack->raiseWidget( mWeekView ); else @@ -1010,15 +1007,12 @@ void KOMonthView::updateConfig() } QFontMetrics fontmetric(mDayLabels[0]->font()); mWidthLongDayLabel = 0; - + qDebug("KOMonthView::updateConfig() "); for (int i = 0; i < 7; i++) { int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; } - bool temp = mShowSatSunComp ; - mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; if ( ! mShowWeekView ) { - if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) computeLayout(); } updateDayLabels(); @@ -1048,30 +1042,30 @@ void KOMonthView::updateDayLabels() else mDayLabelsT = &mDayLabels; #endif - + qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM); mDayLabelsT = &mDayLabelsW; for (int i = 0; i < 7; i++) { if (mWeekStartsMonday) { - bool show = mShortDayLabels; - if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) + bool show = mShortDayLabelsW; + if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) show = true; (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); } else { - if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); - else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); + if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); + else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); } } mDayLabelsT = &mDayLabels; for (int i = 0; i < 7; i++) { if (mWeekStartsMonday) { - bool show = mShortDayLabels; - if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) + bool show = mShortDayLabelsM; + if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) show = true; (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); } else { - if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); - else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); + if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); + else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); } } @@ -1269,6 +1263,14 @@ 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 ( ignoreResizeEvent ) { + qDebug("KOMonthView::resizeEvent ignored "); + --ignoreResizeEvent; + return; + } + if ( e->size().width()+ e->size().height() < 240 ) + return; computeLayout(); clPending = true; if ( mShowWeekView ) @@ -1280,11 +1282,6 @@ void KOMonthView::computeLayoutWeek() { int daysToShow; - bool combinedSatSun = false; - if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { - daysToShow = 6; - combinedSatSun = true; - } int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); @@ -1298,8 +1295,7 @@ void KOMonthView::computeLayoutWeek() daysToShow = 2; else daysToShow = 3; - mShowSatSunComp = true; - combinedSatSun = true; + bool combinedSatSun = true; //qDebug("KOMonthView::computeLayout()------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); @@ -1380,7 +1376,7 @@ void KOMonthView::computeLayoutWeek() 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()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); - mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; + mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; updateDayLabels(); bool forceUpdate = !updatePossible; updatePossible = true; @@ -1400,7 +1396,7 @@ void KOMonthView::computeLayout() } int daysToShow = 7; bool combinedSatSun = false; - if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { + if (KOPrefs::instance()->mMonthViewSatSunTog ) { daysToShow = 6; combinedSatSun = true; } @@ -1487,7 +1483,8 @@ void KOMonthView::computeLayout() mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); - mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; + mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; + qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); updateDayLabels(); bool forceUpdate = !updatePossible; updatePossible = true; |