-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 36 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 1 |
2 files changed, 17 insertions, 20 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 27ba9e0..f6f62a4 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -184,82 +184,80 @@ void DateNavigatorContainer::checkUpdateDayMatrixDates() | |||
184 | QFont fo; | 184 | QFont fo; |
185 | if ( horizontalCount != mHorizontalCount || | 185 | if ( horizontalCount != mHorizontalCount || |
186 | verticalCount != mVerticalCount ) { | 186 | verticalCount != mVerticalCount ) { |
187 | uint count = horizontalCount * verticalCount; | 187 | uint count = horizontalCount * verticalCount; |
188 | if ( count == 0 ) { | 188 | if ( count == 0 ) { |
189 | bool ok; | 189 | bool ok; |
190 | fo = mNavigatorView->yourFontHint( size() , &ok ); | 190 | fo = mNavigatorView->yourFontHint( size() , &ok ); |
191 | //mNavigatorView->resize( size() ); | 191 | //mNavigatorView->resize( size() ); |
192 | //if ( ! ok ) | 192 | //if ( ! ok ) |
193 | // return; | 193 | // return; |
194 | int butt = 2; | 194 | int butt = 2; |
195 | horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); | 195 | horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); |
196 | if ( horizontalCount <= 1 ) | 196 | if ( horizontalCount <= 1 ) |
197 | minSize = mNavigatorView->sizeHintTwoButtons( 4 ); | 197 | minSize = mNavigatorView->sizeHintTwoButtons( 4 ); |
198 | else | 198 | else |
199 | minSize = mNavigatorView->sizeHintTwoButtons(); | 199 | minSize = mNavigatorView->sizeHintTwoButtons(); |
200 | verticalCount = size().height() / minSize.height(); | 200 | verticalCount = size().height() / minSize.height(); |
201 | horizontalCount = size().width() / minSize.width(); | 201 | horizontalCount = size().width() / minSize.width(); |
202 | if ( horizontalCount == 0 ) | 202 | if ( horizontalCount == 0 ) |
203 | horizontalCount = 1; | 203 | horizontalCount = 1; |
204 | if ( verticalCount == 0 ) | 204 | if ( verticalCount == 0 ) |
205 | verticalCount = 1; | 205 | verticalCount = 1; |
206 | fontchange = true; | 206 | fontchange = true; |
207 | count = horizontalCount * verticalCount; | 207 | count = horizontalCount * verticalCount; |
208 | } else { | 208 | } |
209 | if ( mNavigatorView->fontChanged() ) { | 209 | |
210 | fontchange = true; | ||
211 | fo = KOPrefs::instance()->mDateNavigatorFont; | ||
212 | mNavigatorView->changeFont( fo ); | ||
213 | mNavigatorView->unsetFontChanged(); | ||
214 | } | ||
215 | } | ||
216 | |||
217 | mLastDisplayedDN = horizontalCount*verticalCount-1; | 210 | mLastDisplayedDN = horizontalCount*verticalCount-1; |
218 | while ( count > ( mExtraViews.count() + 1 ) ) { | 211 | while ( count > ( mExtraViews.count() + 1 ) ) { |
219 | KDateNavigator *n = new KDateNavigator( this ); | 212 | KDateNavigator *n = new KDateNavigator( this ); |
220 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 213 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
221 | mExtraViews.append( n ); | 214 | mExtraViews.append( n ); |
222 | n->setCalendar( mCalendar ); | 215 | n->setCalendar( mCalendar ); |
223 | connectNavigatorView( n ); | 216 | connectNavigatorView( n ); |
224 | // n->show(); | 217 | // n->show(); |
225 | } | 218 | } |
226 | 219 | ||
227 | |||
228 | setBaseDates(); | 220 | setBaseDates(); |
229 | if ( fontchange ) { | ||
230 | //mNavigatorView->changeFont( fo ); | ||
231 | uint i; | ||
232 | for( i = 0; i < mExtraViews.count(); ++i ) { | ||
233 | KDateNavigator *view = mExtraViews.at( i ); | ||
234 | view->changeFont( fo ); | ||
235 | } | ||
236 | } | ||
237 | mHorizontalCount = horizontalCount; | 221 | mHorizontalCount = horizontalCount; |
238 | mVerticalCount = verticalCount; | 222 | mVerticalCount = verticalCount; |
239 | 223 | ||
240 | } | 224 | } |
241 | 225 | if ( !fontchange ) { | |
226 | if ( mNavigatorView->fontChanged() ) { | ||
227 | fontchange = true; | ||
228 | fo = KOPrefs::instance()->mDateNavigatorFont; | ||
229 | mNavigatorView->changeFont( fo ); | ||
230 | mNavigatorView->unsetFontChanged(); | ||
231 | } | ||
232 | } | ||
233 | if ( fontchange ) { | ||
234 | uint i; | ||
235 | for( i = 0; i < mLastDisplayedDN; ++i ) { | ||
236 | KDateNavigator *view = mExtraViews.at( i ); | ||
237 | view->changeFont( fo ); | ||
238 | } | ||
239 | } | ||
242 | int theight = height() / mVerticalCount; | 240 | int theight = height() / mVerticalCount; |
243 | int twidth = width() / mHorizontalCount; | 241 | int twidth = width() / mHorizontalCount; |
244 | 242 | ||
245 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 243 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
246 | if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); | 244 | if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); |
247 | else bar->showButtons( true, true ); | 245 | else bar->showButtons( true, true ); |
248 | 246 | ||
249 | mNavigatorView->setGeometry(0, | 247 | mNavigatorView->setGeometry(0, |
250 | 0, twidth, theight ); | 248 | 0, twidth, theight ); |
251 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 249 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
252 | int x = ( i + 1 ) % mHorizontalCount; | 250 | int x = ( i + 1 ) % mHorizontalCount; |
253 | int y = ( i + 1 ) / mHorizontalCount; | 251 | int y = ( i + 1 ) / mHorizontalCount; |
254 | 252 | ||
255 | KDateNavigator *view = mExtraViews.at( i ); | 253 | KDateNavigator *view = mExtraViews.at( i ); |
256 | bar = view->navigatorBar(); | 254 | bar = view->navigatorBar(); |
257 | if ( y > 0 ) bar->showButtons( false, false ); | 255 | if ( y > 0 ) bar->showButtons( false, false ); |
258 | else { | 256 | else { |
259 | if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); | 257 | if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); |
260 | else bar->showButtons( false, false ); | 258 | else bar->showButtons( false, false ); |
261 | } | 259 | } |
262 | view->setGeometry( x * twidth, | 260 | view->setGeometry( x * twidth, |
263 | y * theight, twidth, theight ); | 261 | y * theight, twidth, theight ); |
264 | } | 262 | } |
265 | int iii = 0; | 263 | int iii = 0; |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 2fca49e..1d09f40 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -40,49 +40,48 @@ | |||
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #include "navigatorbar.h" | 44 | #include "navigatorbar.h" |
45 | 45 | ||
46 | #include "kdatenavigator.h" | 46 | #include "kdatenavigator.h" |
47 | 47 | ||
48 | KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | 48 | KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) |
49 | : QFrame(parent, name), | 49 | : QFrame(parent, name), |
50 | updateTimer(0L) | 50 | updateTimer(0L) |
51 | { | 51 | { |
52 | setFrameStyle(QFrame::NoFrame); | 52 | setFrameStyle(QFrame::NoFrame); |
53 | QDate startDate = QDate::currentDate(); | 53 | QDate startDate = QDate::currentDate(); |
54 | QGridLayout *topLayout = new QGridLayout(this,8,8); | 54 | QGridLayout *topLayout = new QGridLayout(this,8,8); |
55 | 55 | ||
56 | if (! startDate.isValid()) { | 56 | if (! startDate.isValid()) { |
57 | qDebug("KDateNavigator::invalid startdate "); | 57 | qDebug("KDateNavigator::invalid startdate "); |
58 | startDate = QDate::currentDate(); | 58 | startDate = QDate::currentDate(); |
59 | } | 59 | } |
60 | mMonthSignalOffset = 0; | 60 | mMonthSignalOffset = 0; |
61 | mSelectedDates.append(startDate); | 61 | mSelectedDates.append(startDate); |
62 | m_MthYr = startDate; | 62 | m_MthYr = startDate; |
63 | m_bShowWeekNums = true; | 63 | m_bShowWeekNums = true; |
64 | |||
65 | setFont( KOPrefs::instance()->mDateNavigatorFont ); | 64 | setFont( KOPrefs::instance()->mDateNavigatorFont ); |
66 | mNavigatorBar = new NavigatorBar( startDate, this ); | 65 | mNavigatorBar = new NavigatorBar( startDate, this ); |
67 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); | 66 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); |
68 | //mNavigatorBar->resize( 1,1); | 67 | //mNavigatorBar->resize( 1,1); |
69 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); | 68 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); |
70 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); | 69 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); |
71 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); | 70 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); |
72 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); | 71 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); |
73 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); | 72 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); |
74 | 73 | ||
75 | // get the day of the week on the first day | 74 | // get the day of the week on the first day |
76 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 75 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
77 | m_fstDayOfWk = dayone.dayOfWeek(); | 76 | m_fstDayOfWk = dayone.dayOfWeek(); |
78 | 77 | ||
79 | int i; | 78 | int i; |
80 | 79 | ||
81 | // Set up the heading fields. | 80 | // Set up the heading fields. |
82 | for( i = 0; i < 7; i++ ) { | 81 | for( i = 0; i < 7; i++ ) { |
83 | headings[i] = new QLabel("",this); | 82 | headings[i] = new QLabel("",this); |
84 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); | 83 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); |
85 | headings[i]->setAlignment(AlignCenter); | 84 | headings[i]->setAlignment(AlignCenter); |
86 | headings[i]->installEventFilter(this); | 85 | headings[i]->installEventFilter(this); |
87 | 86 | ||
88 | topLayout->addWidget(headings[i],1,i+1); | 87 | topLayout->addWidget(headings[i],1,i+1); |