-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 7 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 6de7c45..9720146 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -289,99 +289,98 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | |||
289 | verticalCount != mVerticalCount ) { | 289 | verticalCount != mVerticalCount ) { |
290 | uint count = horizontalCount * verticalCount; | 290 | uint count = horizontalCount * verticalCount; |
291 | if ( count == 0 ) { | 291 | if ( count == 0 ) { |
292 | bool ok; | 292 | bool ok; |
293 | fo = mNavigatorView->yourFontHint( size() , &ok ); | 293 | fo = mNavigatorView->yourFontHint( size() , &ok ); |
294 | //mNavigatorView->resize( size() ); | 294 | //mNavigatorView->resize( size() ); |
295 | //if ( ! ok ) | 295 | //if ( ! ok ) |
296 | // return; | 296 | // return; |
297 | int butt = 2; | 297 | int butt = 2; |
298 | horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); | 298 | horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); |
299 | if ( horizontalCount <= 1 ) | 299 | if ( horizontalCount <= 1 ) |
300 | minSize = mNavigatorView->sizeHintTwoButtons( 4 ); | 300 | minSize = mNavigatorView->sizeHintTwoButtons( 4 ); |
301 | else | 301 | else |
302 | minSize = mNavigatorView->sizeHintTwoButtons(); | 302 | minSize = mNavigatorView->sizeHintTwoButtons(); |
303 | verticalCount = size().height() / minSize.height(); | 303 | verticalCount = size().height() / minSize.height(); |
304 | horizontalCount = size().width() / minSize.width(); | 304 | horizontalCount = size().width() / minSize.width(); |
305 | if ( horizontalCount == 0 ) | 305 | if ( horizontalCount == 0 ) |
306 | horizontalCount = 1; | 306 | horizontalCount = 1; |
307 | if ( verticalCount == 0 ) | 307 | if ( verticalCount == 0 ) |
308 | verticalCount = 1; | 308 | verticalCount = 1; |
309 | fontchange = true; | 309 | fontchange = true; |
310 | count = horizontalCount * verticalCount; | 310 | count = horizontalCount * verticalCount; |
311 | } else { | 311 | } else { |
312 | if ( mNavigatorView->fontChanged() ) { | 312 | if ( mNavigatorView->fontChanged() ) { |
313 | fontchange = true; | 313 | fontchange = true; |
314 | fo = KOPrefs::instance()->mDateNavigatorFont; | 314 | fo = KOPrefs::instance()->mDateNavigatorFont; |
315 | mNavigatorView->changeFont( fo ); | 315 | mNavigatorView->changeFont( fo ); |
316 | mNavigatorView->unsetFontChanged(); | 316 | mNavigatorView->unsetFontChanged(); |
317 | } | 317 | } |
318 | } | 318 | } |
319 | 319 | ||
320 | mLastDisplayedDN = horizontalCount*verticalCount-1; | 320 | mLastDisplayedDN = horizontalCount*verticalCount-1; |
321 | bool setBaseD = false; | ||
322 | while ( count > ( mExtraViews.count() + 1 ) ) { | 321 | while ( count > ( mExtraViews.count() + 1 ) ) { |
323 | KDateNavigator *n = new KDateNavigator( this ); | 322 | KDateNavigator *n = new KDateNavigator( this ); |
324 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 323 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
325 | mExtraViews.append( n ); | 324 | mExtraViews.append( n ); |
326 | n->setCalendar( mCalendar ); | 325 | n->setCalendar( mCalendar ); |
327 | setBaseD = true; | ||
328 | connectNavigatorView( n ); | 326 | connectNavigatorView( n ); |
329 | n->show(); | 327 | n->show(); |
330 | } | 328 | } |
331 | int iii = 0; | 329 | int iii = 0; |
332 | while ( iii < ( mExtraViews.count() ) ) { | 330 | while ( iii < ( mExtraViews.count() ) ) { |
333 | if ( iii < count-1 ) | 331 | if ( iii < count-1 ) |
334 | mExtraViews.at( iii )->show(); | 332 | mExtraViews.at( iii )->show(); |
335 | else | 333 | else |
336 | mExtraViews.at( iii )->hide(); | 334 | mExtraViews.at( iii )->hide(); |
337 | ++iii; | 335 | ++iii; |
338 | } | 336 | } |
339 | if ( setBaseD ) | 337 | |
340 | setBaseDates(); | 338 | setBaseDates(); |
341 | if ( fontchange ) { | 339 | if ( fontchange ) { |
342 | //mNavigatorView->changeFont( fo ); | 340 | //mNavigatorView->changeFont( fo ); |
343 | uint i; | 341 | uint i; |
344 | for( i = 0; i < mExtraViews.count(); ++i ) { | 342 | for( i = 0; i < mExtraViews.count(); ++i ) { |
345 | KDateNavigator *view = mExtraViews.at( i ); | 343 | KDateNavigator *view = mExtraViews.at( i ); |
346 | view->changeFont( fo ); | 344 | view->changeFont( fo ); |
347 | } | 345 | } |
348 | } | 346 | } |
349 | mHorizontalCount = horizontalCount; | 347 | mHorizontalCount = horizontalCount; |
350 | mVerticalCount = verticalCount; | 348 | mVerticalCount = verticalCount; |
351 | 349 | ||
352 | } | 350 | } |
353 | //qDebug("COUNT %d ", mExtraViews.count()); | 351 | //qDebug("COUNT %d ", mExtraViews.count()); |
354 | int height = size().height() / verticalCount; | 352 | int height = size().height() / verticalCount; |
355 | int width = size().width() / horizontalCount; | 353 | int width = size().width() / horizontalCount; |
356 | 354 | ||
357 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 355 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
358 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); | 356 | if ( horizontalCount > 1 ) bar->showButtons( true, false ); |
359 | else bar->showButtons( true, true ); | 357 | else bar->showButtons( true, true ); |
360 | 358 | ||
361 | mNavigatorView->setGeometry(0, | 359 | mNavigatorView->setGeometry(0, |
362 | 0, width, height ); | 360 | 0, width, height ); |
363 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 361 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
364 | int x = ( i + 1 ) % horizontalCount; | 362 | int x = ( i + 1 ) % horizontalCount; |
365 | int y = ( i + 1 ) / horizontalCount; | 363 | int y = ( i + 1 ) / horizontalCount; |
366 | 364 | ||
367 | KDateNavigator *view = mExtraViews.at( i ); | 365 | KDateNavigator *view = mExtraViews.at( i ); |
368 | bar = view->navigatorBar(); | 366 | bar = view->navigatorBar(); |
369 | if ( y > 0 ) bar->showButtons( false, false ); | 367 | if ( y > 0 ) bar->showButtons( false, false ); |
370 | else { | 368 | else { |
371 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); | 369 | if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); |
372 | else bar->showButtons( false, false ); | 370 | else bar->showButtons( false, false ); |
373 | } | 371 | } |
374 | view->setGeometry( x * width, | 372 | view->setGeometry( x * width, |
375 | y * height, width, height ); | 373 | y * height, width, height ); |
376 | } | 374 | } |
375 | //updateDayMatrixDates(); | ||
377 | } | 376 | } |
378 | 377 | ||
379 | QSize DateNavigatorContainer::minimumSizeHint() const | 378 | QSize DateNavigatorContainer::minimumSizeHint() const |
380 | { | 379 | { |
381 | return mNavigatorView->minimumSizeHint(); | 380 | return mNavigatorView->minimumSizeHint(); |
382 | } | 381 | } |
383 | 382 | ||
384 | QSize DateNavigatorContainer::sizeHint() const | 383 | QSize DateNavigatorContainer::sizeHint() const |
385 | { | 384 | { |
386 | return mNavigatorView->yourSizeHint(); | 385 | return mNavigatorView->yourSizeHint(); |
387 | } | 386 | } |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 3ee1fa7..366e8b8 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -74,65 +74,65 @@ private: | |||
74 | KODayMatrix * _view; | 74 | KODayMatrix * _view; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | void DynamicTip::maybeTip( const QPoint &pos ) | 77 | void DynamicTip::maybeTip( const QPoint &pos ) |
78 | { | 78 | { |
79 | //calculate which cell of the matrix the mouse is in | 79 | //calculate which cell of the matrix the mouse is in |
80 | QRect sz = matrix->frameRect(); | 80 | QRect sz = matrix->frameRect(); |
81 | int dheight = sz.height()*7 / 42; | 81 | int dheight = sz.height()*7 / 42; |
82 | int dwidth = sz.width() / 7; | 82 | int dwidth = sz.width() / 7; |
83 | int row = pos.y()/dheight; | 83 | int row = pos.y()/dheight; |
84 | int col = pos.x()/dwidth; | 84 | int col = pos.x()/dwidth; |
85 | 85 | ||
86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
87 | 87 | ||
88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
89 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 89 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
90 | 90 | ||
91 | //show holiday names only | 91 | //show holiday names only |
92 | QString str = matrix->getHolidayLabel(col+row*7); | 92 | QString str = matrix->getHolidayLabel(col+row*7); |
93 | if (str.isEmpty()) return; | 93 | if (str.isEmpty()) return; |
94 | tip(rct, str); | 94 | tip(rct, str); |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | // ============================================================================ | 98 | // ============================================================================ |
99 | // K O D A Y M A T R I X | 99 | // K O D A Y M A T R I X |
100 | // ============================================================================ | 100 | // ============================================================================ |
101 | 101 | ||
102 | const int KODayMatrix::NOSELECTION = -1000; | 102 | const int KODayMatrix::NOSELECTION = -1000; |
103 | const int KODayMatrix::NUMDAYS = 42; | 103 | const int KODayMatrix::NUMDAYS = 42; |
104 | 104 | ||
105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) | 105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) |
106 | : QFrame( parent, name ), mCalendar( 0 ) | 106 | : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) |
107 | 107 | ||
108 | #if 0 | 108 | #if 0 |
109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
110 | QFrame(parent, name) | 110 | QFrame(parent, name) |
111 | #endif | 111 | #endif |
112 | { | 112 | { |
113 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); | 113 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); |
114 | mPendingUpdateBeforeRepaint = false; | 114 | mPendingUpdateBeforeRepaint = false; |
115 | mouseDown = false; | 115 | mouseDown = false; |
116 | // initialize dynamic arrays | 116 | // initialize dynamic arrays |
117 | bDays.resize ( NUMDAYS ); | 117 | bDays.resize ( NUMDAYS ); |
118 | days = new QDate[NUMDAYS]; | 118 | days = new QDate[NUMDAYS]; |
119 | daylbls = new QString[NUMDAYS]; | 119 | daylbls = new QString[NUMDAYS]; |
120 | events = new int[NUMDAYS]; | 120 | events = new int[NUMDAYS]; |
121 | mToolTip = new DynamicTip(this); | 121 | mToolTip = new DynamicTip(this); |
122 | 122 | ||
123 | // set default values used for drawing the matrix | 123 | // set default values used for drawing the matrix |
124 | mDefaultBackColor = palette().active().base(); | 124 | mDefaultBackColor = palette().active().base(); |
125 | mDefaultTextColor = palette().active().foreground(); | 125 | mDefaultTextColor = palette().active().foreground(); |
126 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 126 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
127 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 127 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
128 | mSelectedDaysColor = QColor("white"); | 128 | mSelectedDaysColor = QColor("white"); |
129 | mTodayMarginWidth = 2; | 129 | mTodayMarginWidth = 2; |
130 | mSelEnd = mSelStart = NOSELECTION; | 130 | mSelEnd = mSelStart = NOSELECTION; |
131 | 131 | ||
132 | setAcceptDrops(true); | 132 | setAcceptDrops(true); |
133 | //setFont( QFont("Arial", 10) ); | 133 | //setFont( QFont("Arial", 10) ); |
134 | 134 | ||
135 | mUpdateTimer = new QTimer( this ); | 135 | mUpdateTimer = new QTimer( this ); |
136 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 136 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
137 | mRepaintTimer = new QTimer( this ); | 137 | mRepaintTimer = new QTimer( this ); |
138 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 138 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |