summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/datenavigatorcontainer.cpp13
-rw-r--r--korganizer/kdatenavigator.cpp11
-rw-r--r--korganizer/kdatenavigator.h6
-rw-r--r--korganizer/kodaymatrix.cpp7
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--korganizer/navigatorbar.cpp4
-rw-r--r--korganizer/navigatorbar.h2
8 files changed, 32 insertions, 14 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 90b36ac..8100e25 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -293,48 +293,49 @@ void CalendarView::init()
293 293
294 mRightFrame = new QWidgetStack( rightBox ); 294 mRightFrame = new QWidgetStack( rightBox );
295 rightLayout->addWidget( mRightFrame, 1 ); 295 rightLayout->addWidget( mRightFrame, 1 );
296 296
297 mLeftFrame = mLeftSplitter; 297 mLeftFrame = mLeftSplitter;
298#else 298#else
299 //QWidget *mainBox = new QWidget( this ); 299 //QWidget *mainBox = new QWidget( this );
300 //QWidget *leftFrame = new QWidget( mainBox ); 300 //QWidget *leftFrame = new QWidget( mainBox );
301 //QBoxLayout * mainBoxLayout; 301 //QBoxLayout * mainBoxLayout;
302 if ( KOPrefs::instance()->mVerticalScreen ) { 302 if ( KOPrefs::instance()->mVerticalScreen ) {
303 //mainBoxLayout = new QVBoxLayout(mainBox); 303 //mainBoxLayout = new QVBoxLayout(mainBox);
304 //leftFrameLayout = new QHBoxLayout(leftFrame ); 304 //leftFrameLayout = new QHBoxLayout(leftFrame );
305 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 305 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
306 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 306 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
307 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 307 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
308 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 308 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
309 } else { 309 } else {
310 //mainBoxLayout = new QHBoxLayout(mainBox); 310 //mainBoxLayout = new QHBoxLayout(mainBox);
311 //leftFrameLayout = new QVBoxLayout(leftFrame ); 311 //leftFrameLayout = new QVBoxLayout(leftFrame );
312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
316 } 316 }
317 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
317 //QBoxLayout * leftFrameLayout; 318 //QBoxLayout * leftFrameLayout;
318 topLayout->addWidget( mMainFrame ); 319 topLayout->addWidget( mMainFrame );
319 //mainBoxLayout->addWidget (mLeftFrame); 320 //mainBoxLayout->addWidget (mLeftFrame);
320 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 321 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
321 "CalendarView::DateNavigator" ); 322 "CalendarView::DateNavigator" );
322#if 0 323#if 0
323 // FIXME 324 // FIXME
324 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 325 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
325 "CalendarView::DateNavigator", QDate::currentDate()); 326 "CalendarView::DateNavigator", QDate::currentDate());
326#endif 327#endif
327 // mDateNavigator->blockSignals( true ); 328 // mDateNavigator->blockSignals( true );
328 //leftFrameLayout->addWidget( mDateNavigator ); 329 //leftFrameLayout->addWidget( mDateNavigator );
329 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 330 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
330 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 331 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
331 mTodoList->setNavigator( mNavigator ); 332 mTodoList->setNavigator( mNavigator );
332#if 0 333#if 0
333 if ( QApplication::desktop()->width() < 480 ) { 334 if ( QApplication::desktop()->width() < 480 ) {
334 leftFrameLayout->addWidget(mFilterView); 335 leftFrameLayout->addWidget(mFilterView);
335 leftFrameLayout->addWidget(mTodoList, 2 ); 336 leftFrameLayout->addWidget(mTodoList, 2 );
336 337
337 } else { 338 } else {
338 leftFrameLayout->addWidget(mTodoList,2 ); 339 leftFrameLayout->addWidget(mTodoList,2 );
339 leftFrameLayout->addWidget(mFilterView ); 340 leftFrameLayout->addWidget(mFilterView );
340 } 341 }
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index b147427..ab0dd50 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -24,48 +24,49 @@
24*/ 24*/
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 39 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 42{
43 mExtraViews.setAutoDelete( true ); 43 mExtraViews.setAutoDelete( true );
44 44
45 mNavigatorView = new KDateNavigator( this, name ); 45 mNavigatorView = new KDateNavigator( this, name );
46 46
47 connectNavigatorView( mNavigatorView ); 47 connectNavigatorView( mNavigatorView );
48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
48} 49}
49 50
50DateNavigatorContainer::~DateNavigatorContainer() 51DateNavigatorContainer::~DateNavigatorContainer()
51{ 52{
52} 53}
53 54
54void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 55void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
55{ 56{
56 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 57 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
57 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 58 SIGNAL( datesSelected( const KCal::DateList & ) ) );
58#if 0 59#if 0
59 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 60 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
60 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 61 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
61 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 62 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
62 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 63 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
63#endif 64#endif
64 connect( v, SIGNAL( weekClicked( const QDate & ) ), 65 connect( v, SIGNAL( weekClicked( const QDate & ) ),
65 SIGNAL( weekClicked( const QDate & ) ) ); 66 SIGNAL( weekClicked( const QDate & ) ) );
66 67
67 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 68 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
68 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 69 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
69 70
70 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 71 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
71 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 72 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
@@ -154,104 +155,112 @@ void DateNavigatorContainer::setBaseDates()
154 n->setBaseDate( baseDate, doRepaint ); 155 n->setBaseDate( baseDate, doRepaint );
155 doRepaint = true; 156 doRepaint = true;
156 } 157 }
157} 158}
158 159
159void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) 160void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
160{ 161{
161#if 0 162#if 0
162 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 163 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
163 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 164 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
164 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; 165 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
165 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; 166 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
166 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; 167 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
167#endif 168#endif
168 //QSize minSize = mNavigatorView->sizeHintTwoButtons(); 169 //QSize minSize = mNavigatorView->sizeHintTwoButtons();
169 QSize minSize = mNavigatorView->yourSizeHint(); 170 QSize minSize = mNavigatorView->yourSizeHint();
170 171
171// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; 172// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
172 173
173 int verticalCount = size().height() / minSize.height(); 174 int verticalCount = size().height() / minSize.height();
174 int horizontalCount = size().width() / minSize.width(); 175 int horizontalCount = size().width() / minSize.width();
175 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 176 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
176 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 177 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
177 bool fontchange = false; 178 bool fontchange = false;
179 if ( horizontalCount == 1)
180 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
178 QFont fo; 181 QFont fo;
179 if ( horizontalCount != mHorizontalCount || 182 if ( horizontalCount != mHorizontalCount ||
180 verticalCount != mVerticalCount ) { 183 verticalCount != mVerticalCount ) {
181 uint count = horizontalCount * verticalCount; 184 uint count = horizontalCount * verticalCount;
182 if ( count == 0 ) { 185 if ( count == 0 ) {
183 bool ok; 186 bool ok;
184 fo = mNavigatorView->yourFontHint( size() , &ok); 187 fo = mNavigatorView->yourFontHint( size() , &ok );
185 //mNavigatorView->resize( size() ); 188 //mNavigatorView->resize( size() );
186 //if ( ! ok ) 189 //if ( ! ok )
187 // return; 190 // return;
188 minSize = mNavigatorView->sizeHintTwoButtons(); 191 int butt = 2;
192 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
193 if ( horizontalCount <= 1 )
194 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
195 else
196 minSize = mNavigatorView->sizeHintTwoButtons();
189 verticalCount = size().height() / minSize.height(); 197 verticalCount = size().height() / minSize.height();
190 horizontalCount = size().width() / minSize.width(); 198 horizontalCount = size().width() / minSize.width();
191 if ( horizontalCount == 0 ) 199 if ( horizontalCount == 0 )
192 horizontalCount = 1; 200 horizontalCount = 1;
193 if ( verticalCount == 0 ) 201 if ( verticalCount == 0 )
194 verticalCount = 1; 202 verticalCount = 1;
195 fontchange = true; 203 fontchange = true;
196 count = horizontalCount * verticalCount; 204 count = horizontalCount * verticalCount;
197 } else { 205 } else {
198 if ( mNavigatorView->fontChanged() ) { 206 if ( mNavigatorView->fontChanged() ) {
199 fontchange = true; 207 fontchange = true;
200 fo = KOPrefs::instance()->mDateNavigatorFont; 208 fo = KOPrefs::instance()->mDateNavigatorFont;
201 mNavigatorView->changeFont( fo ); 209 mNavigatorView->changeFont( fo );
202 mNavigatorView->unsetFontChanged(); 210 mNavigatorView->unsetFontChanged();
203 } 211 }
204 } 212 }
205 213
206 while ( count > ( mExtraViews.count() + 1 ) ) { 214 while ( count > ( mExtraViews.count() + 1 ) ) {
207 KDateNavigator *n = new KDateNavigator( this ); 215 KDateNavigator *n = new KDateNavigator( this );
208 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 216 n->setMonthSignalOffset ( mExtraViews.count()+1 );
209 mExtraViews.append( n ); 217 mExtraViews.append( n );
210 n->setCalendar( mCalendar ); 218 n->setCalendar( mCalendar );
211 setBaseDates(); 219 setBaseDates();
212 connectNavigatorView( n ); 220 connectNavigatorView( n );
213 n->show(); 221 n->show();
214 } 222 }
215 int iii = 0; 223 int iii = 0;
216 while ( iii < ( mExtraViews.count() ) ) { 224 while ( iii < ( mExtraViews.count() ) ) {
217 if ( iii < count-1 ) 225 if ( iii < count-1 )
218 mExtraViews.at( iii )->show(); 226 mExtraViews.at( iii )->show();
219 else 227 else
220 mExtraViews.at( iii )->hide(); 228 mExtraViews.at( iii )->hide();
221 ++iii; 229 ++iii;
222 } 230 }
223 if ( fontchange ) { 231 if ( fontchange ) {
224 //mNavigatorView->changeFont( fo ); 232 //mNavigatorView->changeFont( fo );
225 uint i; 233 uint i;
226 for( i = 0; i < mExtraViews.count(); ++i ) { 234 for( i = 0; i < mExtraViews.count(); ++i ) {
227 KDateNavigator *view = mExtraViews.at( i ); 235 KDateNavigator *view = mExtraViews.at( i );
228 view->changeFont( fo ); 236 view->changeFont( fo );
229 } 237 }
230 } 238 }
231 mHorizontalCount = horizontalCount; 239 mHorizontalCount = horizontalCount;
232 mVerticalCount = verticalCount; 240 mVerticalCount = verticalCount;
233 } 241 }
242 //qDebug("COUNT %d ", mExtraViews.count());
234 int height = size().height() / verticalCount; 243 int height = size().height() / verticalCount;
235 int width = size().width() / horizontalCount; 244 int width = size().width() / horizontalCount;
236 245
237 NavigatorBar *bar = mNavigatorView->navigatorBar(); 246 NavigatorBar *bar = mNavigatorView->navigatorBar();
238 if ( horizontalCount > 1 ) bar->showButtons( true, false ); 247 if ( horizontalCount > 1 ) bar->showButtons( true, false );
239 else bar->showButtons( true, true ); 248 else bar->showButtons( true, true );
240 249
241 mNavigatorView->setGeometry(0, 250 mNavigatorView->setGeometry(0,
242 0, width, height ); 251 0, width, height );
243 for( uint i = 0; i < mExtraViews.count(); ++i ) { 252 for( uint i = 0; i < mExtraViews.count(); ++i ) {
244 int x = ( i + 1 ) % horizontalCount; 253 int x = ( i + 1 ) % horizontalCount;
245 int y = ( i + 1 ) / horizontalCount; 254 int y = ( i + 1 ) / horizontalCount;
246 255
247 KDateNavigator *view = mExtraViews.at( i ); 256 KDateNavigator *view = mExtraViews.at( i );
248 bar = view->navigatorBar(); 257 bar = view->navigatorBar();
249 if ( y > 0 ) bar->showButtons( false, false ); 258 if ( y > 0 ) bar->showButtons( false, false );
250 else { 259 else {
251 if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); 260 if ( x + 1 == horizontalCount ) bar->showButtons( false, true );
252 else bar->showButtons( false, false ); 261 else bar->showButtons( false, false );
253 } 262 }
254 view->setGeometry( x * width, 263 view->setGeometry( x * width,
255 y * height, width, height ); 264 y * height, width, height );
256 } 265 }
257} 266}
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index fe83e09..231095f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -95,94 +95,99 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
95 if(!m_bShowWeekNums) { 95 if(!m_bShowWeekNums) {
96 weeknos[i]->hide(); 96 weeknos[i]->hide();
97 } 97 }
98 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
99 99
100 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
101 } 101 }
102 102
103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
105 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
106 106
107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
108 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
109 109
110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
111 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
112 112
113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
114 114
115 // read settings from configuration file. 115 // read settings from configuration file.
116 updateConfig(); 116 updateConfig();
117 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
118 mySizeHint = sizeHintTwoButtons(); 118 mySizeHint = sizeHintTwoButtons();
119 myFullSizeHint = sizeHintTwoButtons( 4 );
119 mFontChanged = false; 120 mFontChanged = false;
120} 121}
121void KDateNavigator::changeFont ( QFont fo ) 122void KDateNavigator::changeFont ( QFont fo )
122{ 123{
123 setFont( fo ); 124 setFont( fo );
124 mNavigatorBar->resetFont( fo ); 125 mNavigatorBar->resetFont( fo );
125} 126}
126QFont KDateNavigator::yourFontHint( QSize si , bool *b) 127QFont KDateNavigator::yourFontHint( QSize si , bool *b)
127{ 128{
128 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 129 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
129 *b = false; 130 *b = false;
130 int fontPoint = fo.pointSize(); 131 int fontPoint = fo.pointSize();
131 while ( fontPoint > 5 ) { 132 while ( fontPoint > 5 ) {
132 --fontPoint; 133 --fontPoint;
133 fo.setPointSize( fontPoint ); 134 fo.setPointSize( fontPoint );
134 setFont( fo ); 135 setFont( fo );
135 mFontChanged = true; 136 mFontChanged = true;
136 mNavigatorBar->resetFont( fo ); 137 mNavigatorBar->resetFont( fo );
137 QSize sh = sizeHintTwoButtons(); 138 QSize sh = sizeHintTwoButtons( 2 );
138 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 139 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
139 if ( si.width() > sh.width() && si.height() > sh.height()) { 140 if ( si.width() > sh.width() && si.height() > sh.height()) {
141 if ( si.width() / sh.width() == 1 ) {
142 if ( si.width() < sizeHintTwoButtons( 4 ).width())
143 continue;
144 }
140 *b = true; 145 *b = true;
141 //qDebug("fooooooooooooooooooooooouuuuund "); 146 //qDebug("fooooooooooooooooooooooouuuuund ");
142 break; 147 break;
143 } 148 }
144 } 149 }
145 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); 150 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
146 return fo; 151 return fo;
147} 152}
148QSize KDateNavigator::sizeHint() const 153QSize KDateNavigator::sizeHint() const
149{ 154{
150 QFontMetrics fm ( font() ); 155 QFontMetrics fm ( font() );
151 QSize day = daymatrix->sizeHint(); 156 QSize day = daymatrix->sizeHint();
152 QSize nav = mNavigatorBar->sizeHint(); 157 QSize nav = mNavigatorBar->sizeHint();
153 int wid = fm.width( "30") + day.width()+3; 158 int wid = fm.width( "30") + day.width()+3;
154 int hei = fm.height() +day.height()+nav.height()+2; 159 int hei = fm.height() +day.height()+nav.height()+2;
155 if ( wid < nav.width() ) 160 if ( wid < nav.width() )
156 wid = nav.width() ; 161 wid = nav.width() ;
157 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 162 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
158 return QSize ( wid, hei ); 163 return QSize ( wid, hei );
159} 164}
160QSize KDateNavigator::sizeHintTwoButtons() const 165QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
161{ 166{
162 QFontMetrics fm ( font() ); 167 QFontMetrics fm ( font() );
163 QSize day = daymatrix->sizeHint(); 168 QSize day = daymatrix->sizeHint();
164 QSize nav = mNavigatorBar->sizeHintTwoButtons(); 169 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
165 int wid = fm.width( "30") + day.width()+3; 170 int wid = fm.width( "30") + day.width()+3;
166 int hei = fm.height() +day.height()+nav.height()+2; 171 int hei = fm.height() +day.height()+nav.height()+2;
167 if ( wid < nav.width() ) 172 if ( wid < nav.width() )
168 wid = nav.width() ; 173 wid = nav.width() ;
169 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 174 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
170 return QSize ( wid, hei ); 175 return QSize ( wid, hei );
171} 176}
172void KDateNavigator::slotMonthSelected( int m ) 177void KDateNavigator::slotMonthSelected( int m )
173{ 178{
174 if ( m_MthYr.month() <= mMonthSignalOffset) 179 if ( m_MthYr.month() <= mMonthSignalOffset)
175 m += 12; 180 m += 12;
176 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); 181 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset);
177 emit monthSelected( m - mMonthSignalOffset ); 182 emit monthSelected( m - mMonthSignalOffset );
178 183
179} 184}
180void KDateNavigator::setCalendar( Calendar *cal ) 185void KDateNavigator::setCalendar( Calendar *cal )
181{ 186{
182 daymatrix->setCalendar( cal ); 187 daymatrix->setCalendar( cal );
183} 188}
184 189
185void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true 190void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true
186{ 191{
187 m_MthYr = date; 192 m_MthYr = date;
188 193
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 77b9b7c..10bc1be 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -43,55 +43,56 @@ class KDateNavigator: public QFrame
43 Q_OBJECT 43 Q_OBJECT
44 public: 44 public:
45 KDateNavigator( QWidget *parent = 0,const char *name = 0 ); 45 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 ~KDateNavigator(); 46 ~KDateNavigator();
47 47
48 /** The DateNavigator automatically checks for 48 /** The DateNavigator automatically checks for
49 * the passage of midnight. If rollover type is 49 * the passage of midnight. If rollover type is
50 * set to None, no signals are emitted and no 50 * set to None, no signals are emitted and no
51 * processing is done. With rollover set to 51 * processing is done. With rollover set to
52 * FollowDay, the day highlighter changes at 52 * FollowDay, the day highlighter changes at
53 * midnight and dayPassed() is emitted. 53 * midnight and dayPassed() is emitted.
54 * With FollowMonth, it has the same effect 54 * With FollowMonth, it has the same effect
55 * as FollowDay but also adjusts the month that is 55 * as FollowDay but also adjusts the month that is
56 * visible and emits monthPassed() when the month changes. 56 * visible and emits monthPassed() when the month changes.
57 */ 57 */
58 enum RolloverType { None, FollowDay, FollowMonth } ; 58 enum RolloverType { None, FollowDay, FollowMonth } ;
59 void enableRollover( RolloverType ); 59 void enableRollover( RolloverType );
60 60
61 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * ); 62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & , bool doRepaint = true ); 63 void setBaseDate( const QDate & , bool doRepaint = true );
64 KCal::DateList selectedDates() const { return mSelectedDates; } 64 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; } 65 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} 66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;}
67 QSize yourSizeHint() { return mySizeHint; } 67 QSize yourSizeHint()const { return mySizeHint; };
68 QSize yourFullSizeHint() const { return myFullSizeHint;};
68 QFont yourFontHint( QSize , bool * b); 69 QFont yourFontHint( QSize , bool * b);
69 bool fontChanged() {return mFontChanged; } 70 bool fontChanged() {return mFontChanged; }
70 void unsetFontChanged() { mFontChanged = false; } 71 void unsetFontChanged() { mFontChanged = false; }
71 KODayMatrix *dayMatrix() { return daymatrix ;} 72 KODayMatrix *dayMatrix() { return daymatrix ;}
72 QSize sizeHint() const; 73 QSize sizeHint() const;
73 QSize sizeHintTwoButtons() const; 74 QSize sizeHintTwoButtons( int butnum = 2 ) const;
74 void changeFont ( QFont fo ); 75 void changeFont ( QFont fo );
75 public slots: 76 public slots:
76 void selectDates( const KCal::DateList & ); 77 void selectDates( const KCal::DateList & );
77 void updateView(); 78 void updateView();
78 void updateConfig(); 79 void updateConfig();
79 void updateDayMatrix(); 80 void updateDayMatrix();
80 81
81 signals: 82 signals:
82 void datesSelected( const KCal::DateList & ); 83 void datesSelected( const KCal::DateList & );
83 void eventDropped( Event * ); 84 void eventDropped( Event * );
84 void weekClicked( const QDate &); 85 void weekClicked( const QDate &);
85 86
86 void goPrevious(); 87 void goPrevious();
87 void goNext(); 88 void goNext();
88 89
89 void goNextMonth(); 90 void goNextMonth();
90 void goPrevMonth(); 91 void goPrevMonth();
91 void goNextYear(); 92 void goNextYear();
92 void goPrevYear(); 93 void goPrevYear();
93 void monthSelected( int ); 94 void monthSelected( int );
94 95
95 // Signals emitted at midnight carrying the new date. 96 // Signals emitted at midnight carrying the new date.
96 void dayPassed( QDate ); 97 void dayPassed( QDate );
97 void monthPassed( QDate ); 98 void monthPassed( QDate );
@@ -102,48 +103,49 @@ class KDateNavigator: public QFrame
102 * Called regularly to see if we need to update the view 103 * Called regularly to see if we need to update the view
103 * wrt. the today box and the month box. Only important 104 * wrt. the today box and the month box. Only important
104 * if you leave KOrganizer idle for long periods of time. 105 * if you leave KOrganizer idle for long periods of time.
105 * 106 *
106 * Until we have a reliable way of setting QTimers to go 107 * Until we have a reliable way of setting QTimers to go
107 * off at a particular wall-clock time, we need this, 108 * off at a particular wall-clock time, we need this,
108 * which calls passedMidnight() at the right moments. 109 * which calls passedMidnight() at the right moments.
109 */ 110 */
110 void possiblyPastMidnight(); 111 void possiblyPastMidnight();
111 112
112 /** handles updating the view when midnight has come by due to idle time. 113 /** handles updating the view when midnight has come by due to idle time.
113 * 114 *
114 */ 115 */
115 void passedMidnight(); 116 void passedMidnight();
116 void slotMonthSelected( int m ); 117 void slotMonthSelected( int m );
117 protected: 118 protected:
118 void updateDates(); 119 void updateDates();
119 120
120 void wheelEvent (QWheelEvent *); 121 void wheelEvent (QWheelEvent *);
121 122
122 bool eventFilter (QObject *,QEvent *); 123 bool eventFilter (QObject *,QEvent *);
123 124
124 private: 125 private:
125 QSize mySizeHint; 126 QSize mySizeHint;
127 QSize myFullSizeHint;
126 bool mFontChanged; 128 bool mFontChanged;
127 int mMonthSignalOffset; 129 int mMonthSignalOffset;
128 NavigatorBar *mNavigatorBar; 130 NavigatorBar *mNavigatorBar;
129 131
130 QFrame *headingSep; 132 QFrame *headingSep;
131 QFrame *weeknumSep; 133 QFrame *weeknumSep;
132 QLabel *headings[7]; 134 QLabel *headings[7];
133 QLabel *weeknos[7]; 135 QLabel *weeknos[7];
134 KODayMatrix *daymatrix; 136 KODayMatrix *daymatrix;
135 137
136 KCal::DateList mSelectedDates; 138 KCal::DateList mSelectedDates;
137 QDate m_MthYr; 139 QDate m_MthYr;
138 int m_fstDayOfWk; 140 int m_fstDayOfWk;
139 bool m_bShowWeekNums; 141 bool m_bShowWeekNums;
140 142
141 int dayNum(int row, int col); 143 int dayNum(int row, int col);
142 int dayToIndex(int dayNum); 144 int dayToIndex(int dayNum);
143 145
144 Calendar *mCalendar; 146 Calendar *mCalendar;
145 KCalendarSystem *mCalendarSystem; 147 KCalendarSystem *mCalendarSystem;
146 148
147 const QString *curHeaders; 149 const QString *curHeaders;
148 150
149 /** used to update the day view periodically, in particular every 151 /** used to update the day view periodically, in particular every
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 120bc89..a2e0ae0 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -393,49 +393,50 @@ void KODayMatrix::updateView(QDate actdate)
393 if (mSelStart != NOSELECTION) { 393 if (mSelStart != NOSELECTION) {
394 int tmp = actdate.daysTo(startdate); 394 int tmp = actdate.daysTo(startdate);
395 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 395 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
396 // shift selection if new one would be visible at least partly ! 396 // shift selection if new one would be visible at least partly !
397 397
398 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 398 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
399 // nested if is required for next X display pushed from a different month - correction required 399 // nested if is required for next X display pushed from a different month - correction required
400 // otherwise, for month forward and backward, it must be avoided 400 // otherwise, for month forward and backward, it must be avoided
401 if( mSelStart > NUMDAYS || mSelStart < 0 ) 401 if( mSelStart > NUMDAYS || mSelStart < 0 )
402 mSelStart = mSelStart + tmp; 402 mSelStart = mSelStart + tmp;
403 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 403 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
404 mSelEnd = mSelEnd + tmp; 404 mSelEnd = mSelEnd + tmp;
405 } 405 }
406 } 406 }
407 startdate = actdate; 407 startdate = actdate;
408 mDayChanged = true; 408 mDayChanged = true;
409 recalculateToday(); 409 recalculateToday();
410 } 410 }
411 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 411 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
412 if ( !isVisible() ) { 412 if ( !isVisible() ) {
413 mPendingUpdateBeforeRepaint = true; 413 mPendingUpdateBeforeRepaint = true;
414 } else { 414 } else {
415#ifdef DESKTOP_VERSION 415#ifdef DESKTOP_VERSION
416 //mRepaintTimer->start( 100 ); 416 //mRepaintTimer->start( 100 );
417 mUpdateTimer->start( 100 ); 417 //updateViewTimed();
418 mUpdateTimer->start( 20 );
418#else 419#else
419 mRepaintTimer->start( 350 ); 420 mRepaintTimer->start( 350 );
420 mUpdateTimer->start( 1200 ); 421 mUpdateTimer->start( 1200 );
421#endif 422#endif
422 } 423 }
423} 424}
424void KODayMatrix::updateEvents() 425void KODayMatrix::updateEvents()
425{ 426{
426 if ( !mCalendar ) return; 427 if ( !mCalendar ) return;
427 428
428 for( int i = 0; i < NUMDAYS; i++ ) { 429 for( int i = 0; i < NUMDAYS; i++ ) {
429 // if events are set for the day then remember to draw it bold 430 // if events are set for the day then remember to draw it bold
430 QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); 431 QPtrList<Event> eventlist = mCalendar->events( days[ i ] );
431 int numEvents = eventlist.count(); 432 int numEvents = eventlist.count();
432 Event *event; 433 Event *event;
433 for( event = eventlist.first(); event != 0;event=eventlist.next()) { 434 for( event = eventlist.first(); event != 0;event=eventlist.next()) {
434 ushort recurType = event->doesRecur(); 435 ushort recurType = event->doesRecur();
435 436
436 if ( ( recurType == Recurrence::rDaily && 437 if ( ( recurType == Recurrence::rDaily &&
437 !KOPrefs::instance()->mDailyRecur ) || 438 !KOPrefs::instance()->mDailyRecur ) ||
438 ( recurType == Recurrence::rWeekly && 439 ( recurType == Recurrence::rWeekly &&
439 !KOPrefs::instance()->mWeeklyRecur ) ) { 440 !KOPrefs::instance()->mWeeklyRecur ) ) {
440 numEvents--; 441 numEvents--;
441 } 442 }
@@ -822,50 +823,50 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
822 if (actcol == mDefaultTextColor) { 823 if (actcol == mDefaultTextColor) {
823 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); 824 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor);
824 } else { 825 } else {
825 mTodayPen.setColor(mHolidayColorShaded); 826 mTodayPen.setColor(mHolidayColorShaded);
826 } 827 }
827 } 828 }
828 //draw gray rectangle for today if in selection 829 //draw gray rectangle for today if in selection
829 if (i >= mSelStartT && i <= mSelEndT) { 830 if (i >= mSelStartT && i <= mSelEndT) {
830 QColor grey("grey"); 831 QColor grey("grey");
831 mTodayPen.setColor(grey); 832 mTodayPen.setColor(grey);
832 } 833 }
833 p.setPen(mTodayPen); 834 p.setPen(mTodayPen);
834 835
835 836
836 int addCol = 0; 837 int addCol = 0;
837 int addRow = 0; 838 int addRow = 0;
838 if (rowModulo) { 839 if (rowModulo) {
839 if ( row >= 6 - rowModulo ) 840 if ( row >= 6 - rowModulo )
840 addRow = row - 5 + rowModulo; 841 addRow = row - 5 + rowModulo;
841 } 842 }
842 if ( colModulo ) { 843 if ( colModulo ) {
843 if ( col >= 7 - colModulo ) 844 if ( col >= 7 - colModulo )
844 addCol = col - 6 + colModulo-1; 845 addCol = col - 6 + colModulo-1;
845 } 846 }
846 if ( col == 0 ) 847
847 addCol = 1; 848 addCol += 1;
848 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); 849 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1);
849 p.setPen(tmppen); 850 p.setPen(tmppen);
850 } 851 }
851 852
852 // if any events are on that day then draw it using a bold font 853 // if any events are on that day then draw it using a bold font
853 if (events[i] > 0) { 854 if (events[i] > 0) {
854 QFont myFont = font(); 855 QFont myFont = font();
855 myFont.setBold(true); 856 myFont.setBold(true);
856 p.setFont(myFont); 857 p.setFont(myFont);
857 } 858 }
858 859
859 // if it is a holiday then use the default holiday color 860 // if it is a holiday then use the default holiday color
860 if (!mHolidays[i].isNull()) { 861 if (!mHolidays[i].isNull()) {
861 if ( bDays.testBit(i) ) { 862 if ( bDays.testBit(i) ) {
862 p.setPen(Qt::green); 863 p.setPen(Qt::green);
863 } else { 864 } else {
864 if (actcol == mDefaultTextColor) { 865 if (actcol == mDefaultTextColor) {
865 p.setPen(KOPrefs::instance()->mHolidayColor); 866 p.setPen(KOPrefs::instance()->mHolidayColor);
866 } else { 867 } else {
867 p.setPen(mHolidayColorShaded); 868 p.setPen(mHolidayColorShaded);
868 } 869 }
869 } 870 }
870 } 871 }
871 872
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 76982b4..9fd1f68 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -284,49 +284,49 @@ void MonthViewItem::paint(QPainter *p)
284 int half = size/2; 284 int half = size/2;
285 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 285 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
286 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 286 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
287 x += half+half + 4; 287 x += half+half + 4;
288 288
289 } else { 289 } else {
290 int val = td->percentComplete()/20; 290 int val = td->percentComplete()/20;
291 p->fillRect ( x+1, y-1, val ,size+2,Qt::black ); 291 p->fillRect ( x+1, y-1, val ,size+2,Qt::black );
292 p->drawRect ( x, y-1,7,size+2); 292 p->drawRect ( x, y-1,7,size+2);
293 x += size + 3; 293 x += size + 3;
294 } 294 }
295 } 295 }
296 QFontMetrics fm = p->fontMetrics(); 296 QFontMetrics fm = p->fontMetrics();
297 int yPos; 297 int yPos;
298 int pmheight = size; 298 int pmheight = size;
299 if( pmheight < fm.height() ) 299 if( pmheight < fm.height() )
300 yPos = fm.ascent() + fm.leading()/2; 300 yPos = fm.ascent() + fm.leading()/2;
301 else 301 else
302 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 302 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
303 p->setPen( palette().color( QPalette::Normal, sel ? \ 303 p->setPen( palette().color( QPalette::Normal, sel ? \
304 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 304 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
305 p->drawText( x, yPos, text() ); 305 p->drawText( x, yPos, text() );
306 if ( mIncidence->cancelled() ) { 306 if ( mIncidence->cancelled() ) {
307 int wid = fm.width( text() ); 307 int wid = fm.width( text() );
308 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 308 p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 );
309 } 309 }
310 310
311} 311}
312 312
313int MonthViewItem::height(const QListBox *lb) const 313int MonthViewItem::height(const QListBox *lb) const
314{ 314{
315 if ( lb ) 315 if ( lb )
316 return lb->fontMetrics().lineSpacing()+1; 316 return lb->fontMetrics().lineSpacing()+1;
317 return 10; 317 return 10;
318} 318}
319 319
320int MonthViewItem::width(const QListBox *lb) const 320int MonthViewItem::width(const QListBox *lb) const
321{ 321{
322 int size = PIXMAP_SIZE; 322 int size = PIXMAP_SIZE;
323 if ( QApplication::desktop()->width() < 300 ) 323 if ( QApplication::desktop()->width() < 300 )
324 size = 3; 324 size = 3;
325 int x = 1; 325 int x = 1;
326 if ( KOPrefs::instance()->mMonthShowIcons ) { 326 if ( KOPrefs::instance()->mMonthShowIcons ) {
327 if ( mInfo ) { 327 if ( mInfo ) {
328 x += size + 1; 328 x += size + 1;
329 } 329 }
330 if( mRecur ) { 330 if( mRecur ) {
331 x += size+1; 331 x += size+1;
332 } 332 }
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 1b4ee52..06f5ef8 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -154,51 +154,51 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
154 154
155} 155}
156 156
157NavigatorBar::~NavigatorBar() 157NavigatorBar::~NavigatorBar()
158{ 158{
159} 159}
160QSize NavigatorBar::sizeHint() const 160QSize NavigatorBar::sizeHint() const
161{ 161{
162 int wid = mCurrentMinWid ; 162 int wid = mCurrentMinWid ;
163 if ( mPrevYear->isVisible() ) 163 if ( mPrevYear->isVisible() )
164 wid += mCurrentButtonMinWid; 164 wid += mCurrentButtonMinWid;
165 if ( mPrevMonth->isVisible() ) 165 if ( mPrevMonth->isVisible() )
166 wid += mCurrentButtonMinWid; 166 wid += mCurrentButtonMinWid;
167 if ( mPrevWeek->isVisible() ) 167 if ( mPrevWeek->isVisible() )
168 wid += mCurrentButtonMinWid; 168 wid += mCurrentButtonMinWid;
169 if ( mNextMonth->isVisible() ) 169 if ( mNextMonth->isVisible() )
170 wid += mCurrentButtonMinWid; 170 wid += mCurrentButtonMinWid;
171 if ( mNextWeek->isVisible() ) 171 if ( mNextWeek->isVisible() )
172 wid += mCurrentButtonMinWid; 172 wid += mCurrentButtonMinWid;
173 if ( mNextYear->isVisible() ) 173 if ( mNextYear->isVisible() )
174 wid += mCurrentButtonMinWid; 174 wid += mCurrentButtonMinWid;
175 //qDebug("ret %d %d ", wid, mCurrentHei); 175 //qDebug("ret %d %d ", wid, mCurrentHei);
176 return QSize ( wid, mCurrentHei ); 176 return QSize ( wid, mCurrentHei );
177} 177}
178QSize NavigatorBar::sizeHintTwoButtons() const 178QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const
179{ 179{
180 return QSize ( mCurrentMinWid + 2 * mCurrentButtonMinWid , mCurrentHei ); 180 return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei );
181} 181}
182void NavigatorBar::resetFont ( QFont fo ) 182void NavigatorBar::resetFont ( QFont fo )
183{ 183{
184 184
185 QFont tfont = fo; 185 QFont tfont = fo;
186 if ( QApplication::desktop()->width() >= 480 ) 186 if ( QApplication::desktop()->width() >= 480 )
187 tfont.setPointSize(tfont.pointSize()+2); 187 tfont.setPointSize(tfont.pointSize()+2);
188 tfont.setBold(true); 188 tfont.setBold(true);
189 189
190 mSelectMonth->setFont( tfont ); 190 mSelectMonth->setFont( tfont );
191 // Set minimum width to width of widest month name label 191 // Set minimum width to width of widest month name label
192 int i; 192 int i;
193 int maxwidth = 0; 193 int maxwidth = 0;
194 QFontMetrics fm ( mSelectMonth->font() ); 194 QFontMetrics fm ( mSelectMonth->font() );
195 int width = fm.width("September '00" ); 195 int width = fm.width("September '00" );
196 maxwidth = width+2; 196 maxwidth = width+2;
197 int size = fm.height()+2; 197 int size = fm.height()+2;
198 if ( QApplication::desktop()->width() >= 480 ) { 198 if ( QApplication::desktop()->width() >= 480 ) {
199 size += 6; 199 size += 6;
200 maxwidth+= 6; 200 maxwidth+= 6;
201 } 201 }
202 mSelectMonth->setMinimumWidth( maxwidth ); 202 mSelectMonth->setMinimumWidth( maxwidth );
203 mSelectMonth->setFixedHeight( size ); 203 mSelectMonth->setFixedHeight( size );
204 mPrevYear->setFixedHeight( size ); 204 mPrevYear->setFixedHeight( size );
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index bf6d173..9ccef14 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -20,49 +20,49 @@
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef NAVIGATORBAR_H 24#ifndef NAVIGATORBAR_H
25#define NAVIGATORBAR_H 25#define NAVIGATORBAR_H
26 26
27#include <libkcal/incidencebase.h> 27#include <libkcal/incidencebase.h>
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30 30
31class QPushButton; 31class QPushButton;
32class QFrame; 32class QFrame;
33class QLabel; 33class QLabel;
34 34
35class NavigatorBar: public QWidget 35class NavigatorBar: public QWidget
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); 39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
40 ~NavigatorBar(); 40 ~NavigatorBar();
41 void showButtons( bool left, bool right ); 41 void showButtons( bool left, bool right );
42 void resetFont ( QFont fo ); 42 void resetFont ( QFont fo );
43 QSize sizeHint() const; 43 QSize sizeHint() const;
44 QSize sizeHintTwoButtons() const; 44 QSize sizeHintTwoButtons( int butNum = 2 ) const;
45 45
46 public slots: 46 public slots:
47 void selectDates( const KCal::DateList & ); 47 void selectDates( const KCal::DateList & );
48 void selectMonth(); 48 void selectMonth();
49 49
50 signals: 50 signals:
51 void goNextMonth(); 51 void goNextMonth();
52 void goPrevMonth(); 52 void goPrevMonth();
53 void goNextWeek(); 53 void goNextWeek();
54 void goPrevWeek(); 54 void goPrevWeek();
55 void goNextYear(); 55 void goNextYear();
56 void goPrevYear(); 56 void goPrevYear();
57 void monthSelected( int ); 57 void monthSelected( int );
58 58
59 private: 59 private:
60 int mCurrentHei; 60 int mCurrentHei;
61 int mCurrentMinWid; 61 int mCurrentMinWid;
62 int mCurrentButtonMinWid; 62 int mCurrentButtonMinWid;
63 QFrame *mCtrlFrame; 63 QFrame *mCtrlFrame;
64 64
65 QPushButton *mPrevYear; 65 QPushButton *mPrevYear;
66 QPushButton *mPrevMonth; 66 QPushButton *mPrevMonth;
67 QPushButton *mNextMonth; 67 QPushButton *mNextMonth;
68 QPushButton *mPrevWeek; 68 QPushButton *mPrevWeek;