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 /korganizer | |
parent | 536a16498de6b9c10b3f5b147ca18c5e4421401c (diff) | |
download | kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.zip kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.gz kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/komonthview.cpp | 90 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 |
3 files changed, 42 insertions, 55 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ffb2e1e..70cbf96 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -909,3 +909,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 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; + } @@ -1009,3 +1016,2 @@ void KOMonthView::updateConfig() mWidthLongDayLabel = 0; - qDebug("KOMonthView::updateConfig() "); for (int i = 0; i < 7; i++) { @@ -1038,9 +1044,3 @@ 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; @@ -1265,9 +1265,5 @@ 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 "); + //qDebug("KOMonthView::resizeEvent ignored "); --ignoreResizeEvent; @@ -1275,4 +1271,2 @@ void KOMonthView::resizeEvent(QResizeEvent * e) } - ignoreResizeEvent = 0; - } if ( e->size().width()+ e->size().height() < 240 ) @@ -1288,13 +1282,12 @@ 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 ) @@ -1305,3 +1298,2 @@ void KOMonthView::computeLayoutWeek() - //qDebug("KOMonthView::computeLayout()------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); @@ -1382,4 +1374,3 @@ 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()); + mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; @@ -1398,2 +1389,13 @@ void KOMonthView::computeLayout() // 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 ){ @@ -1402,2 +1404,10 @@ void KOMonthView::computeLayout() } + static int widd = 0; + static int heigg = 0; + if ( widd == width() && heigg == height () ) { + return; + } + widd = width() ; + heigg = height (); + int daysToShow = 7; @@ -1408,11 +1418,2 @@ void KOMonthView::computeLayout() } - 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() ); @@ -1489,4 +1490,2 @@ 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 ; @@ -1496,3 +1495,2 @@ void KOMonthView::computeLayout() updatePossible = true; - //mWeekLabels[mNumWeeks]->setText( i18n("W")); if ( forceUpdate ) @@ -1504,10 +1502,3 @@ 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; - } - */ + } @@ -1519,3 +1510,2 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell ) { - //qDebug("KOMonthView::setSelectedCell %x ", cell); if ( mSelectedCell && mSelectedCell != cell ) { @@ -1526,4 +1516,2 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell ) mSelectedCell = cell; - // if ( mSelectedCell ) - // mSelectedCell->select(); if ( !mSelectedCell ) diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d70cda1..9dbe319 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -228,3 +228,3 @@ class KOMonthView: public KOEventView bool isUpdatePossible() { return updatePossible; } - void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} + void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} @@ -262,3 +262,2 @@ class KOMonthView: public KOEventView int ignoreResizeEvent; - int ignoreResizeEventHeight; int currentWeek(); diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c35de0a..62d3e7f 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -202,2 +202,4 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) } else { + if ( view == mMonthView && mMonthView) + mMonthView->setIgnoreResizeEvent( 1 ); mCurrentView = view; @@ -225,4 +227,2 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { - - mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); mMainView->navigatorBar()->show(); |