summaryrefslogtreecommitdiffabout
path: root/korganizer/kdatenavigator.cpp
Unidiff
Diffstat (limited to 'korganizer/kdatenavigator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kdatenavigator.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 5aa1c9b..6697602 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -124,53 +124,51 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
124void KDateNavigator::changeFont ( QFont fo ) 124void KDateNavigator::changeFont ( QFont fo )
125{ 125{
126 setFont( fo ); 126 setFont( fo );
127 mNavigatorBar->resetFont( fo ); 127 mNavigatorBar->resetFont( fo );
128} 128}
129QFont KDateNavigator::yourFontHint( QSize si , bool *b) 129QFont KDateNavigator::yourFontHint( QSize si , bool *b)
130{ 130{
131 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 131 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
132 *b = false; 132 *b = false;
133 int fontPoint = fo.pointSize(); 133 int fontPoint = fo.pointSize();
134 while ( fontPoint > 5 ) { 134 while ( fontPoint > 5 ) {
135 --fontPoint; 135 --fontPoint;
136 fo.setPointSize( fontPoint ); 136 fo.setPointSize( fontPoint );
137 setFont( fo ); 137 setFont( fo );
138 mFontChanged = true; 138 mFontChanged = true;
139 mNavigatorBar->resetFont( fo ); 139 mNavigatorBar->resetFont( fo );
140 QSize sh = sizeHintTwoButtons( 2 ); 140 QSize sh = sizeHintTwoButtons( 2 );
141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
142 if ( si.width() > sh.width() && si.height() > sh.height()) { 142 if ( si.width() > sh.width() && si.height() > sh.height()) {
143 if ( si.width() / sh.width() == 1 ) { 143 if ( si.width() / sh.width() == 1 ) {
144 if ( si.width() < sizeHintTwoButtons( 4 ).width()) 144 if ( si.width() < sizeHintTwoButtons( 4 ).width())
145 continue; 145 continue;
146 } 146 }
147 *b = true; 147 *b = true;
148 //qDebug("fooooooooooooooooooooooouuuuund ");
149 break; 148 break;
150 } 149 }
151 } 150 }
152 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
153 return fo; 151 return fo;
154} 152}
155QSize KDateNavigator::sizeHint() const 153QSize KDateNavigator::sizeHint() const
156{ 154{
157 QFontMetrics fm ( font() ); 155 QFontMetrics fm ( font() );
158 QSize day = daymatrix->sizeHint(); 156 QSize day = daymatrix->sizeHint();
159 QSize nav = mNavigatorBar->sizeHint(); 157 QSize nav = mNavigatorBar->sizeHint();
160 int wid = fm.width( "30") + day.width()+3; 158 int wid = fm.width( "30") + day.width()+3;
161 int hei = fm.height() +day.height()+nav.height()+2; 159 int hei = fm.height() +day.height()+nav.height()+2;
162 if ( wid < nav.width() ) 160 if ( wid < nav.width() )
163 wid = nav.width() ; 161 wid = nav.width() ;
164 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 162 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
165 return QSize ( wid, hei ); 163 return QSize ( wid, hei );
166} 164}
167QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const 165QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
168{ 166{
169 QFontMetrics fm ( font() ); 167 QFontMetrics fm ( font() );
170 QSize day = daymatrix->sizeHint(); 168 QSize day = daymatrix->sizeHint();
171 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); 169 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
172 int wid = fm.width( "30") + day.width()+3; 170 int wid = fm.width( "30") + day.width()+3;
173 int hei = fm.height() +day.height()+nav.height()+2; 171 int hei = fm.height() +day.height()+nav.height()+2;
174 if ( wid < nav.width() ) 172 if ( wid < nav.width() )
175 wid = nav.width() ; 173 wid = nav.width() ;
176 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 174 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
@@ -347,49 +345,49 @@ void KDateNavigator::updateView()
347} 345}
348 346
349void KDateNavigator::updateConfig() 347void KDateNavigator::updateConfig()
350{ 348{
351 int day; 349 int day;
352 for(int i=0; i<7; i++) { 350 for(int i=0; i<7; i++) {
353 // take the first letter of the day name to be the abbreviation 351 // take the first letter of the day name to be the abbreviation
354 if (KGlobal::locale()->weekStartsMonday()) { 352 if (KGlobal::locale()->weekStartsMonday()) {
355 day = i+1; 353 day = i+1;
356 } else { 354 } else {
357 if (i==0) day = 7; 355 if (i==0) day = 7;
358 else day = i; 356 else day = i;
359 } 357 }
360 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 358 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
361 true ); 359 true );
362 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 360 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
363 headings[i]->setText( dayName ); 361 headings[i]->setText( dayName );
364 } 362 }
365 updateDates(); 363 updateDates();
366 updateView(); 364 updateView();
367} 365}
368 366
369void KDateNavigator::setShowWeekNums(bool enabled) 367void KDateNavigator::setShowWeekNums(bool enabled)
370{ 368{
371 qDebug("KDateNavigator::setShowWeekNums***************************** "); 369
372 m_bShowWeekNums = enabled; 370 m_bShowWeekNums = enabled;
373 for(int i=0; i<6; i++) { 371 for(int i=0; i<6; i++) {
374 if(enabled) 372 if(enabled)
375 weeknos[i]->show(); 373 weeknos[i]->show();
376 else 374 else
377 weeknos[i]->hide(); 375 weeknos[i]->hide();
378 } 376 }
379 resize(size()); 377 resize(size());
380} 378}
381 379
382void KDateNavigator::selectDates(const DateList& dateList) 380void KDateNavigator::selectDates(const DateList& dateList)
383{ 381{
384 382
385 if (dateList.count() > 0) { 383 if (dateList.count() > 0) {
386 mNavigatorBar->selectDates( dateList ); 384 mNavigatorBar->selectDates( dateList );
387 mSelectedDates = dateList; 385 mSelectedDates = dateList;
388 386
389 // set our record of the month and year that this datetbl is 387 // set our record of the month and year that this datetbl is
390 // displaying. 388 // displaying.
391 m_MthYr = mSelectedDates.first(); 389 m_MthYr = mSelectedDates.first();
392 390
393 391
394 // set our record of the first day of the week of the current 392 // set our record of the first day of the week of the current
395 // month. This needs to be done before calling dayToIndex, since it 393 // month. This needs to be done before calling dayToIndex, since it