author | zautrix <zautrix> | 2005-03-29 12:14:44 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-29 12:14:44 (UTC) |
commit | 894717798a8d129f4b991a2fe856d2f1e8e9624a (patch) (side-by-side diff) | |
tree | fd28b6e3855d0f684bc9f341e60a0c1d0d50cd56 | |
parent | 4af444fb7071d37c966f002f4971d209971679c9 (diff) | |
download | kdepimpi-894717798a8d129f4b991a2fe856d2f1e8e9624a.zip kdepimpi-894717798a8d129f4b991a2fe856d2f1e8e9624a.tar.gz kdepimpi-894717798a8d129f4b991a2fe856d2f1e8e9624a.tar.bz2 |
fix
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index edeebdf..27ba9e0 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp @@ -33,193 +33,193 @@ #include <kcalendarsystem.h> #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; } DateNavigatorContainer::~DateNavigatorContainer() { } void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) { connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), SIGNAL( datesSelected( const KCal::DateList & ) ) ); #if 0 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); #endif connect( v, SIGNAL( weekClicked( const QDate & ) ), SIGNAL( weekClicked( const QDate & ) ) ); connect( v, SIGNAL( showMonth( const QDate & ) ), SIGNAL( showMonth( const QDate & ) ) ); connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); } void DateNavigatorContainer::slotgoNextYear() { jumpMonth( 12 ); emit goNextYear(); } void DateNavigatorContainer::slotgoPrevYear() { jumpMonth( -12 ); emit goPrevYear(); } void DateNavigatorContainer::slotgoPrevMonth() { jumpMonth( -1 ); emit goPrevMonth(); } void DateNavigatorContainer::slotgoNextMonth() { jumpMonth( 1 ); emit goNextMonth(); } void DateNavigatorContainer::jumpMonth( int month ) { QDate baseDate = mNavigatorView->baseDate(); computeMonthSelected( baseDate.month() + month, false ); } void DateNavigatorContainer::slotMonthSelected( int month ) { computeMonthSelected( month, true ); } void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) { //qDebug("slotMonthSelected %d ", month); QDate baseDate = mNavigatorView->baseDate(); if ( baseDate.month() == month ) return; //qDebug("month %d %d ",baseDate.month(),month); QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); date = date.addDays( -(baseDate.month()-month ) *30 ); - QDate newBase = QDate ( date.year(), date.month() , baseDate.day() ); + QDate newBase = QDate ( date.year(), date.month() ,1 ); //qDebug("NEW BASE %s", newBase.toString().latin1()); mNavigatorView->setBaseDate( newBase ); QDate last = lastAvailableDate(); QDate first = firstAvailableDate(); QDate selFirst = mFirstSelectedDate; QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); if ( selFirst >= first && selLast <= last ) { setBaseDates(); if ( forceEmit ) updateDayMatrixDates(); } else { setBaseDates(); if ( forceEmit ) updateDayMatrixDates(); if ( forceEmit ) emit monthSelected( month ); } } void DateNavigatorContainer::setCalendar( Calendar *cal ) { mCalendar = cal; mNavigatorView->setCalendar( cal ); for( uint i = 0; i < mLastDisplayedDN; ++i ) { KDateNavigator *n = mExtraViews.at( i ); n->setCalendar( cal ); } } void DateNavigatorContainer::checkUpdateDayMatrixDates() { //qDebug("KODNC: wid %d hei %d ", width(), height()); mUpdateTimer->stop(); //return; if ( width() < 3 || height() < 3 ) return; static int lastWid = 0; static int lastHei = 0; if ( lastWid == width() && height() == lastHei ) { qDebug("KODNC: No layout computing needed. "); } else { lastWid = width(); lastHei = height(); QSize minSize = mNavigatorView->yourSizeHint(); int verticalCount = size().height() / minSize.height(); int horizontalCount = size().width() / minSize.width(); //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); bool fontchange = false; if ( horizontalCount == 1) horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); QFont fo; if ( horizontalCount != mHorizontalCount || verticalCount != mVerticalCount ) { uint count = horizontalCount * verticalCount; if ( count == 0 ) { bool ok; fo = mNavigatorView->yourFontHint( size() , &ok ); //mNavigatorView->resize( size() ); //if ( ! ok ) // return; int butt = 2; horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); if ( horizontalCount <= 1 ) minSize = mNavigatorView->sizeHintTwoButtons( 4 ); else minSize = mNavigatorView->sizeHintTwoButtons(); verticalCount = size().height() / minSize.height(); horizontalCount = size().width() / minSize.width(); if ( horizontalCount == 0 ) horizontalCount = 1; if ( verticalCount == 0 ) verticalCount = 1; fontchange = true; count = horizontalCount * verticalCount; } else { if ( mNavigatorView->fontChanged() ) { fontchange = true; fo = KOPrefs::instance()->mDateNavigatorFont; mNavigatorView->changeFont( fo ); mNavigatorView->unsetFontChanged(); } } 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(); } |