Diffstat (limited to 'korganizer/kdatenavigator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kdatenavigator.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index b097dc1..92a0ac2 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -95,48 +95,88 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) if(!m_bShowWeekNums) { weeknos[i]->hide(); } weeknos[i]->installEventFilter(this); topLayout->addWidget(weeknos[i],i+2,0); } daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); daymatrix->setLineWidth(1); connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), SIGNAL( datesSelected( const KCal::DateList & ) ) ); connect( daymatrix, SIGNAL( eventDropped( Event * ) ), SIGNAL( eventDropped( Event * ) ) ); topLayout->addMultiCellWidget(daymatrix,2,7,1,7); // read settings from configuration file. updateConfig(); enableRollover(FollowMonth); mySizeHint = sizeHint(); + mFontChanged = false; +} +void KDateNavigator::changeFont ( QFont fo ) +{ + setFont( fo ); + mNavigatorBar->resetFont( fo ); +} +QFont KDateNavigator::yourFontHint( QSize si , bool *b) +{ + QFont fo = KOPrefs::instance()->mDateNavigatorFont; + *b = false; + int fontPoint = fo.pointSize(); + while ( fontPoint > 5 ) { + --fontPoint; + fo.setPointSize( fontPoint ); + setFont( fo ); + mFontChanged = true; + mNavigatorBar->resetFont( fo ); + QSize sh = sizeHint(); + //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); + if ( si.width() > sh.width() && si.height() > sh.height()) { + *b = true; + //qDebug("fooooooooooooooooooooooouuuuund "); + break; + } + } + //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); + return fo; +} +QSize KDateNavigator::sizeHint() const +{ + QFontMetrics fm ( font() ); + QSize day = daymatrix->sizeHint(); + QSize nav = mNavigatorBar->sizeHint(); + int wid = fm.width( "30") + day.width()+3; + int hei = fm.height() +day.height()+nav.height()+2; + if ( wid < nav.width() ) + wid = nav.width() ; + //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); + return QSize ( wid, hei ); } void KDateNavigator::slotMonthSelected( int m ) { if ( m_MthYr.month() <= mMonthSignalOffset) m += 12; int mo = m - mMonthSignalOffset; emit monthSelected( m - mMonthSignalOffset ); } void KDateNavigator::setCalendar( Calendar *cal ) { daymatrix->setCalendar( cal ); } void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true { m_MthYr = date; updateDates(); updateView(); KCal::DateList dates; dates.append( date ); mNavigatorBar->selectDates( dates ); |