-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 40 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.h | 2 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 3 |
4 files changed, 32 insertions, 15 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9a4e719..6ed6a1c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1913,24 +1913,24 @@ void CalendarView::readSettings() maxVal = QApplication::desktop()->height()-10; } sizes << resetval; if ( maxVal < resetval + resetval) resetval = maxVal - resetval; sizes << resetval; } mMainFrame->setSizes(sizes); - if ( dateCount == 5 ) mNavigator->selectWorkWeek(); else if ( dateCount == 7 ) mNavigator->selectWeek(); else mNavigator->selectDates( dateCount ); // mViewManager->readSettings( config ); updateConfig(); globalFlagBlockAgenda = 2; mViewManager->readSettings( config ); + QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); } void CalendarView::writeSettings() { // kdDebug() << "CalendarView::writeSettings" << endl; KConfig *config = KOGlobals::config(); diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 2290c53..11dc592 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp @@ -35,20 +35,21 @@ #include "datenavigatorcontainer.h" #include "koprefs.h" DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, const char *name ) : QWidget( parent, name ), mCalendar( 0 ), mHorizontalCount( 1 ), mVerticalCount( 1 ) { + mResizeEnabled = false; mExtraViews.setAutoDelete( true ); mNavigatorView = new KDateNavigator( this, name ); - + mNavigatorView->hide(); connectNavigatorView( mNavigatorView ); //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); mLastDisplayedDN = 0; mUpdateTimer; mUpdateTimer = new QTimer( this ); connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); mFirstSelectedDate = QDate::currentDate(); mSelectedDateCount = 1; @@ -213,27 +214,20 @@ void DateNavigatorContainer::checkUpdateDayMatrixDates() mLastDisplayedDN = horizontalCount*verticalCount-1; while ( count > ( mExtraViews.count() + 1 ) ) { KDateNavigator *n = new KDateNavigator( this ); n->setMonthSignalOffset ( mExtraViews.count()+1 ); mExtraViews.append( n ); n->setCalendar( mCalendar ); connectNavigatorView( n ); - n->show(); - } - int iii = 0; - while ( iii < ( mExtraViews.count() ) ) { - if ( iii < count-1 ) - mExtraViews.at( iii )->show(); - else - mExtraViews.at( iii )->hide(); - ++iii; + // n->show(); } + setBaseDates(); if ( fontchange ) { //mNavigatorView->changeFont( fo ); uint i; for( i = 0; i < mExtraViews.count(); ++i ) { KDateNavigator *view = mExtraViews.at( i ); view->changeFont( fo ); } @@ -261,16 +255,26 @@ void DateNavigatorContainer::checkUpdateDayMatrixDates() if ( y > 0 ) bar->showButtons( false, false ); else { if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); else bar->showButtons( false, false ); } view->setGeometry( x * twidth, y * theight, twidth, theight ); } + int iii = 0; + int ccc = mHorizontalCount * mVerticalCount; + mNavigatorView->show(); + while ( iii < ( mExtraViews.count() ) ) { + if ( iii < ccc-1 ) + mExtraViews.at( iii )->show(); + else + mExtraViews.at( iii )->hide(); + ++iii; + } } QDate last = lastAvailableDate(); QDate first = firstAvailableDate(); QDate selFirst = mFirstSelectedDate; QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); if ( selFirst >= first && selLast <= last ) { @@ -388,24 +392,34 @@ void DateNavigatorContainer::setBaseDates() QDate baseDate = mNavigatorView->baseDate(); bool doRepaint = true; for( uint i = 0; i < mLastDisplayedDN; ++i ) { KDateNavigator *n = mExtraViews.at( i ); baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); n->setBaseDate( baseDate, doRepaint ); } } - +void DateNavigatorContainer::setResizeEnabled() +{ + mResizeEnabled = true; + //qDebug("DateNavigatorContainer::setResizeEnabled "); + checkUpdateDayMatrixDates(); +} void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) { - + //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height()); //qDebug("COUNT %d ", mExtraViews.count()); - + if ( ! mResizeEnabled ) { + //qDebug("NOT ResizeEnabled"); + return; + } + else mUpdateTimer->start( 250 ); + //updateDayMatrixDates(); } QSize DateNavigatorContainer::minimumSizeHint() const { return mNavigatorView->minimumSizeHint(); } diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h index d2f397d..ac9745d 100644 --- a/korganizer/datenavigatorcontainer.h +++ b/korganizer/datenavigatorcontainer.h @@ -58,16 +58,17 @@ class DateNavigatorContainer: public QWidget void updateDayMatrixDates(); void checkUpdateDayMatrixDates(); void updateToday(); void slotMonthSelected( int month ); void slotgoNextMonth(); void slotgoPrevMonth(); void slotgoNextYear(); void slotgoPrevYear(); + void setResizeEnabled(); signals: void datesSelected( const KCal::DateList & ); void incidenceDropped( Incidence *, const QDate & ); void incidenceDroppedMove( Incidence *, const QDate & ); void weekClicked( const QDate &); void goPrevious(); @@ -84,16 +85,17 @@ class DateNavigatorContainer: public QWidget void computeMonthSelected( int month , bool forceEmit ); void jumpMonth( int month ); void resizeEvent( QResizeEvent * ); void setBaseDates(); void connectNavigatorView( KDateNavigator *v ); private: + bool mResizeEnabled; QTimer* mUpdateTimer; int mLastDisplayedDN; QDate mFirstSelectedDate; int mSelectedDateCount; KDateNavigator *mNavigatorView; KCal::Calendar *mCalendar; diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 0cb767f..5eccfd6 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -114,17 +114,17 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) topLayout->addMultiCellWidget(daymatrix,2,7,1,7); // read settings from configuration file. updateConfig(); enableRollover(FollowMonth); mySizeHint = sizeHintTwoButtons(); myFullSizeHint = sizeHintTwoButtons( 4 ); mFontChanged = false; - resize ( 3,3 ); + //resize ( 3,3 ); } void KDateNavigator::changeFont ( QFont fo ) { setFont( fo ); mNavigatorBar->resetFont( fo ); } QFont KDateNavigator::yourFontHint( QSize si , bool *b) @@ -366,16 +366,17 @@ void KDateNavigator::updateConfig() headings[i]->setText( dayName ); } updateDates(); updateView(); } void KDateNavigator::setShowWeekNums(bool enabled) { + qDebug("KDateNavigator::setShowWeekNums***************************** "); m_bShowWeekNums = enabled; for(int i=0; i<6; i++) { if(enabled) weeknos[i]->show(); else weeknos[i]->hide(); } resize(size()); |