author | zautrix <zautrix> | 2005-02-06 20:09:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 20:09:33 (UTC) |
commit | 961fc44f4092c1f981eb3be4284715e6829f885c (patch) (side-by-side diff) | |
tree | 005e999ddbf07af42c7da4f9193874ba0ba3870c | |
parent | 536a16498de6b9c10b3f5b147ca18c5e4421401c (diff) | |
download | kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.zip kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.gz kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/komonthview.cpp | 94 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 |
3 files changed, 44 insertions, 57 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ffb2e1e..70cbf96 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -908,5 +908,12 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); mContextMenu = eventPopup(); - updateConfig(); //useless here + //updateConfig(); //useless here ... + // ... but we need mWidthLongDayLabel computed + QFontMetrics fontmetric(mDayLabels[0]->font()); + mWidthLongDayLabel = 0; + for (int i = 0; i < 7; i++) { + int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); + if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; + } //mWeekLabels[mNumWeeks]->setText( i18n("W")); @@ -1008,5 +1015,4 @@ 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)); @@ -1037,11 +1043,5 @@ void KOMonthView::updateDayLabels() QPtrVector<QLabel> *mDayLabelsT; -#if 0 - if (mShowWeekView ) - mDayLabelsT = &mDayLabelsW; - else - mDayLabelsT = &mDayLabels; -#endif - qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM); + mDayLabelsT = &mDayLabelsW; for (int i = 0; i < 7; i++) { @@ -1264,15 +1264,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 ( ignoreResizeEvent ) { - int diff = e->size().height() - e->oldSize().height(); - if ( diff < 0 ) - diff = diff * (-1); - if ( diff == ignoreResizeEventHeight ) { - qDebug("KOMonthView::resizeEvent ignored "); - --ignoreResizeEvent; - return; - } - ignoreResizeEvent = 0; + //qDebug("KOMonthView::resizeEvent ignored "); + --ignoreResizeEvent; + return; } if ( e->size().width()+ e->size().height() < 240 ) @@ -1287,15 +1281,14 @@ void KOMonthView::resizeEvent(QResizeEvent * e) void KOMonthView::computeLayoutWeek() { - + static int widd = 0; + static int heigg = 0; + if ( widd == width() && heigg == height () ) { + return; + } + widd = width() ; + heigg = height (); int daysToShow; - int tWid = topLevelWidget()->size().width(); - int tHei = topLevelWidget()->size().height(); - int wid = size().width();//e int hei = size().height()-1; - - if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) - return; - if ( wid < hei ) daysToShow = 2; @@ -1304,5 +1297,4 @@ void KOMonthView::computeLayoutWeek() bool combinedSatSun = true; - //qDebug("KOMonthView::computeLayout()------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); @@ -1381,6 +1373,5 @@ void KOMonthView::computeLayoutWeek() 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()); - //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); + mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; updateDayLabels(); @@ -1397,8 +1388,27 @@ void KOMonthView::computeLayout() // threshold between big enough to support the full name and not big // enough. + + int tWid = topLevelWidget()->size().width(); + int tHei = topLevelWidget()->size().height(); + + int wid = size().width();//e + int hei = size().height()-1; + + if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) + return; + + if ( mShowWeekView ){ computeLayoutWeek(); return; } + static int widd = 0; + static int heigg = 0; + if ( widd == width() && heigg == height () ) { + return; + } + widd = width() ; + heigg = height (); + int daysToShow = 7; bool combinedSatSun = false; @@ -1407,13 +1417,4 @@ void KOMonthView::computeLayout() combinedSatSun = true; } - int tWid = topLevelWidget()->size().width(); - int tHei = topLevelWidget()->size().height(); - - int wid = size().width();//e - int hei = size().height()-1; - - if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) - return; - //qDebug("KOMonthView::computeLayout()------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); @@ -1488,6 +1489,4 @@ 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()); mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); @@ -1495,5 +1494,4 @@ void KOMonthView::computeLayout() bool forceUpdate = !updatePossible; updatePossible = true; - //mWeekLabels[mNumWeeks]->setText( i18n("W")); if ( forceUpdate ) updateView(); @@ -1503,12 +1501,5 @@ void KOMonthView::showContextMenu( Incidence *incidence ) { mContextMenu->showIncidencePopup(incidence); - /* - if( incidence && incidence->type() == "Event" ) { - Event *event = static_cast<Event *>(incidence); - mContextMenu->showEventPopup(event); - } else { - kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; - } - */ + } MonthViewCell * KOMonthView::selectedCell( ) @@ -1518,5 +1509,4 @@ MonthViewCell * KOMonthView::selectedCell( ) void KOMonthView::setSelectedCell( MonthViewCell *cell ) { - //qDebug("KOMonthView::setSelectedCell %x ", cell); if ( mSelectedCell && mSelectedCell != cell ) { MonthViewCell * mvc = mSelectedCell; @@ -1525,6 +1515,4 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell ) } else mSelectedCell = cell; - // if ( mSelectedCell ) - // mSelectedCell->select(); if ( !mSelectedCell ) emit incidenceSelected( 0 ); diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d70cda1..9dbe319 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -227,5 +227,5 @@ class KOMonthView: public KOEventView bool isMonthView() { return true; } bool isUpdatePossible() { return updatePossible; } - void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} + void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} MonthViewCell * selectedCell(); @@ -261,5 +261,4 @@ class KOMonthView: public KOEventView private: int ignoreResizeEvent; - int ignoreResizeEventHeight; int currentWeek(); bool clPending; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c35de0a..62d3e7f 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -201,4 +201,6 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) full = mMainView->leftFrame()->isVisible(); } else { + if ( view == mMonthView && mMonthView) + mMonthView->setIgnoreResizeEvent( 1 ); mCurrentView = view; // bool full = fullScreen; @@ -224,6 +226,4 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) if ( mCurrentView == mMonthView ) { if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { - - mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); mMainView->navigatorBar()->show(); hei -= mMainView->navigatorBar()->sizeHint().height(); |