author | zautrix <zautrix> | 2005-06-28 09:52:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-28 09:52:05 (UTC) |
commit | c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4 (patch) (unidiff) | |
tree | 432c39b8c65277964b9e62ee98eeeb92e3006ba2 /korganizer | |
parent | 4385e73c51688f0b8b21bfe061c04a6c42e92701 (diff) | |
download | kdepimpi-c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4.zip kdepimpi-c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4.tar.gz kdepimpi-c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4.tar.bz2 |
fixes
-rw-r--r-- | korganizer/komonthview.cpp | 65 | ||||
-rw-r--r-- | korganizer/komonthview.h | 4 |
2 files changed, 54 insertions, 15 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 1c2d6a2..264cf28 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -367,16 +367,30 @@ void MonthViewItem::paint(QPainter *p) | |||
367 | } | 367 | } |
368 | if ( mReply ) { | 368 | if ( mReply ) { |
369 | p->fillRect ( x, y,size,size, Qt::yellow ); | 369 | p->fillRect ( x, y,size,size, Qt::yellow ); |
370 | x += size + 1; | 370 | x += size + 1; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | |||
374 | |||
375 | |||
376 | |||
377 | if ( sel ) p->setPen( Qt::white ); | ||
378 | else p->setPen( palette().color( QPalette::Normal,QColorGroup::Foreground ) ); | ||
379 | |||
380 | #if 0 | ||
381 | p->setPen( palette().color( QPalette::Normal, sel ? \ | ||
382 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | ||
383 | #endif | ||
384 | QColor textColor = p->pen().color(); | ||
385 | |||
386 | |||
373 | if ( mMultiday ) { | 387 | if ( mMultiday ) { |
374 | int yyy = y+(size/2); | 388 | int yyy = y+(size/2); |
375 | int sizeM = size+2; | 389 | int sizeM = size+2; |
376 | p->setBrush( QBrush( p->pen().color() ) ); | 390 | p->setBrush( QBrush( textColor ) ); |
377 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 391 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
378 | if ( mMultiday == 2 || mMultiday == 3 ) { | 392 | if ( mMultiday == 2 || mMultiday == 3 ) { |
379 | QPointArray pa ( 3 ); | 393 | QPointArray pa ( 3 ); |
380 | pa.setPoint (0, x, yyy ); | 394 | pa.setPoint (0, x, yyy ); |
381 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 395 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
382 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 396 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
@@ -409,26 +423,25 @@ void MonthViewItem::paint(QPainter *p) | |||
409 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 423 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
410 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 424 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
411 | x += half+half + 4; | 425 | x += half+half + 4; |
412 | 426 | ||
413 | } else { | 427 | } else { |
414 | int val = td->percentComplete()/20; | 428 | int val = td->percentComplete()/20; |
415 | p->fillRect ( x+1, y-2, val ,size+4,p->pen().color() ); | 429 | p->fillRect ( x+1, y-2, val ,size+4,textColor ); |
416 | p->drawRect ( x, y-2,7,size+4); | 430 | p->drawRect ( x, y-2,7,size+4); |
417 | x += size + 3; | 431 | x += size + 3; |
418 | } | 432 | } |
419 | } | 433 | } |
420 | QFontMetrics fm = p->fontMetrics(); | 434 | QFontMetrics fm = p->fontMetrics(); |
421 | int yPos; | 435 | int yPos; |
422 | int pmheight = size; | 436 | int pmheight = size; |
423 | if( pmheight < fm.height() ) | 437 | if( pmheight < fm.height() ) |
424 | yPos = fm.ascent() + fm.leading()/2; | 438 | yPos = fm.ascent() + fm.leading()/2; |
425 | else | 439 | else |
426 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 440 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
427 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 441 | |
428 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | ||
429 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { | 442 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { |
430 | p->drawText( x, yPos, text() ); | 443 | p->drawText( x, yPos, text() ); |
431 | if ( mIncidence->cancelled() ) { | 444 | if ( mIncidence->cancelled() ) { |
432 | int wid = fm.width( text() ); | 445 | int wid = fm.width( text() ); |
433 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 446 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
434 | } | 447 | } |
@@ -614,13 +627,13 @@ void MonthViewCell::setHoliday( const QString &holiday ) | |||
614 | setHoliday( true ); | 627 | setHoliday( true ); |
615 | } | 628 | } |
616 | } | 629 | } |
617 | 630 | ||
618 | void MonthViewCell::startUpdateCell() | 631 | void MonthViewCell::startUpdateCell() |
619 | { | 632 | { |
620 | 633 | blockSignals( true ); | |
621 | mdayCount = 0; | 634 | mdayCount = 0; |
622 | setFocusPolicy(NoFocus); | 635 | setFocusPolicy(NoFocus); |
623 | if ( !mMonthView->isUpdatePossible() ) | 636 | if ( !mMonthView->isUpdatePossible() ) |
624 | return; | 637 | return; |
625 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 638 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
626 | while ( mitem ) { | 639 | while ( mitem ) { |
@@ -878,12 +891,13 @@ void MonthViewCell::repaintfinishUpdateCell() | |||
878 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 891 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
879 | while ( mitem ) { | 892 | while ( mitem ) { |
880 | mitem->setBlockRepaint( false ); | 893 | mitem->setBlockRepaint( false ); |
881 | updateItem ( mitem ); | 894 | updateItem ( mitem ); |
882 | mitem = (MonthViewItem *)mitem->next(); | 895 | mitem = (MonthViewItem *)mitem->next(); |
883 | } | 896 | } |
897 | blockSignals( false ); | ||
884 | } | 898 | } |
885 | void MonthViewCell::finishUpdateCell() | 899 | void MonthViewCell::finishUpdateCell() |
886 | { | 900 | { |
887 | 901 | ||
888 | 902 | ||
889 | 903 | ||
@@ -1023,21 +1037,20 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) | |||
1023 | return; | 1037 | return; |
1024 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 1038 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
1025 | deselect(); | 1039 | deselect(); |
1026 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); | 1040 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); |
1027 | 1041 | ||
1028 | QString text; | 1042 | QString text; |
1029 | mLabel->setText( text ); | 1043 | //mLabel->setText( text ); |
1030 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 1044 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
1031 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 1045 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
1032 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 1046 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); |
1033 | mLabel->resize( mLabelBigSize ); | 1047 | mLabel->resize( mLabelBigSize ); |
1034 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | ||
1035 | } else { | 1048 | } else { |
1036 | mLabel->resize( mLabelSize ); | 1049 | mLabel->resize( mLabelSize ); |
1037 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 1050 | text = QString::number( mDate.day() ); |
1038 | } | 1051 | } |
1039 | mLabel->setText( text ); | 1052 | mLabel->setText( text ); |
1040 | 1053 | ||
1041 | int size = height() - mLabel->height() - lineWidth()-1; | 1054 | int size = height() - mLabel->height() - lineWidth()-1; |
1042 | //qDebug("LW %d ", lineWidth()); | 1055 | //qDebug("LW %d ", lineWidth()); |
1043 | if ( size > 0 ) | 1056 | if ( size > 0 ) |
@@ -1334,21 +1347,20 @@ KOMonthView::~KOMonthView() | |||
1334 | { | 1347 | { |
1335 | delete mContextMenu; | 1348 | delete mContextMenu; |
1336 | } | 1349 | } |
1337 | 1350 | ||
1338 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) | 1351 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) |
1339 | { | 1352 | { |
1340 | qDebug("11 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | ||
1341 | static Incidence * lastInc = 0; | 1353 | static Incidence * lastInc = 0; |
1342 | static MonthViewCell * lastCell = 0; | 1354 | static MonthViewCell * lastCell = 0; |
1343 | 1355 | ||
1344 | if ( lastInc == inc && lastCell == mc ) | 1356 | if ( lastInc == inc && lastCell == mc ) |
1345 | return; | 1357 | return; |
1346 | lastInc = inc; | 1358 | lastInc = inc; |
1347 | lastCell = mc; | 1359 | lastCell = mc; |
1348 | qDebug("222 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | 1360 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); |
1349 | 1361 | ||
1350 | bool weekview = false; | 1362 | bool weekview = false; |
1351 | int index = 0; | 1363 | int index = 0; |
1352 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1364 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1353 | if ( mCellsW[i] == mc ) { | 1365 | if ( mCellsW[i] == mc ) { |
1354 | weekview = true; | 1366 | weekview = true; |
@@ -1366,27 +1378,53 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int | |||
1366 | break; | 1378 | break; |
1367 | } | 1379 | } |
1368 | } | 1380 | } |
1369 | cells = &mCells; | 1381 | cells = &mCells; |
1370 | } | 1382 | } |
1371 | for (uint i = 0; i < (*cells).count(); ++i) { | 1383 | for (uint i = 0; i < (*cells).count(); ++i) { |
1372 | (*cells)[i]->deHighLight(); | 1384 | (*cells)[i]->deHighLight(); |
1373 | } | 1385 | } |
1374 | if ( ! inc ) | 1386 | if ( ! inc ) |
1375 | return; | 1387 | return; |
1388 | |||
1389 | int count = (*cells).count(); | ||
1390 | bool goLeft = (mday > 1 && index > 0); | ||
1391 | bool goRight = (mday < 3 && mday > 0 && index < count -1); | ||
1392 | for (uint iii = 1; iii < count; ++iii) { | ||
1393 | if ( goLeft ) { | ||
1394 | int left = index - iii; | ||
1395 | if ( left >= 0 ) { | ||
1396 | if ( (*cells)[(uint)left]->doHighLight(inc) ) | ||
1397 | goLeft = false; | ||
1398 | } else | ||
1399 | goLeft = false; | ||
1400 | } | ||
1401 | if ( goRight ) { | ||
1402 | int right = index + iii; | ||
1403 | if ( right < count ) { | ||
1404 | if ( (*cells)[right]->doHighLight(inc) ) | ||
1405 | goRight = false; | ||
1406 | |||
1407 | } else | ||
1408 | goRight = false; | ||
1409 | } | ||
1410 | |||
1411 | } | ||
1412 | #if 0 | ||
1376 | if ( mday > 1 && index > 0 ) | 1413 | if ( mday > 1 && index > 0 ) |
1377 | for (int i = index-1; i >= 0; --i) { | 1414 | for (int i = index-1; i >= 0; --i) { |
1378 | //qDebug("index %d iii %d ", index, i); | 1415 | //qDebug("index %d iii %d ", index, i); |
1379 | if ( (*cells)[(uint)i]->doHighLight(inc) ) | 1416 | if ( (*cells)[(uint)i]->doHighLight(inc) ) |
1380 | break; | 1417 | break; |
1381 | } | 1418 | } |
1382 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) | 1419 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) |
1383 | for (uint i = index+1; i < (*cells).count(); ++i) { | 1420 | for (uint i = index+1; i < (*cells).count(); ++i) { |
1384 | if ( (*cells)[i]->doHighLight(inc) ) | 1421 | if ( (*cells)[i]->doHighLight(inc) ) |
1385 | break; | 1422 | break; |
1386 | } | 1423 | } |
1424 | #endif | ||
1387 | 1425 | ||
1388 | } | 1426 | } |
1389 | void KOMonthView::selectInternalWeekNum ( int n ) | 1427 | void KOMonthView::selectInternalWeekNum ( int n ) |
1390 | { | 1428 | { |
1391 | switchView(); | 1429 | switchView(); |
1392 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 1430 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
@@ -1718,13 +1756,14 @@ void KOMonthView::updateView() | |||
1718 | for( i = 0; i < timeSpan+1; ++i ) { | 1756 | for( i = 0; i < timeSpan+1; ++i ) { |
1719 | (*cells)[i]->finishUpdateCell(); | 1757 | (*cells)[i]->finishUpdateCell(); |
1720 | } | 1758 | } |
1721 | processSelectionChange(); | 1759 | processSelectionChange(); |
1722 | //qApp->processEvents(); | 1760 | //qApp->processEvents(); |
1723 | for( i = 0; i < timeSpan+1; ++i ) { | 1761 | for( i = 0; i < timeSpan+1; ++i ) { |
1724 | (*cells)[i]->repaintfinishUpdateCell(); | 1762 | //(*cells)[i]->repaintfinishUpdateCell(); |
1763 | QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); | ||
1725 | } | 1764 | } |
1726 | setKeyBFocus(); | 1765 | setKeyBFocus(); |
1727 | #else | 1766 | #else |
1728 | // old code | 1767 | // old code |
1729 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1768 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1730 | int i; | 1769 | int i; |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 0f3aa54..0bd6b1c 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -164,24 +164,22 @@ class MonthViewCell : public KNoScrollListBox | |||
164 | void setHoliday( bool ); | 164 | void setHoliday( bool ); |
165 | void setHoliday( const QString & ); | 165 | void setHoliday( const QString & ); |
166 | 166 | ||
167 | void updateCell(); | 167 | void updateCell(); |
168 | void startUpdateCell(); | 168 | void startUpdateCell(); |
169 | void finishUpdateCell(); | 169 | void finishUpdateCell(); |
170 | void repaintfinishUpdateCell(); | ||
171 | int insertEvent(Event *); | 170 | int insertEvent(Event *); |
172 | void insertTodo(Todo *); | 171 | void insertTodo(Todo *); |
173 | 172 | ||
174 | void updateConfig( bool bigFont = false ); | 173 | void updateConfig( bool bigFont = false ); |
175 | 174 | ||
176 | void enableScrollBars( bool ); | 175 | void enableScrollBars( bool ); |
177 | 176 | ||
178 | Incidence *selectedIncidence(); | 177 | Incidence *selectedIncidence(); |
179 | QDate selectedIncidenceDate(); | 178 | QDate selectedIncidenceDate(); |
180 | QPushButton * dateLabel() { return mLabel; } | 179 | QPushButton * dateLabel() { return mLabel; } |
181 | void deHighLight(); | ||
182 | bool doHighLight( Incidence *); | 180 | bool doHighLight( Incidence *); |
183 | void deselect(); | 181 | void deselect(); |
184 | void select(); | 182 | void select(); |
185 | #ifdef DESKTOP_VERSION | 183 | #ifdef DESKTOP_VERSION |
186 | static QToolTipGroup *toolTipGroup(); | 184 | static QToolTipGroup *toolTipGroup(); |
187 | #endif | 185 | #endif |
@@ -193,12 +191,14 @@ class MonthViewCell : public KNoScrollListBox | |||
193 | protected: | 191 | protected: |
194 | QStringList mToolTip; | 192 | QStringList mToolTip; |
195 | void resizeEvent( QResizeEvent * ); | 193 | void resizeEvent( QResizeEvent * ); |
196 | 194 | ||
197 | public slots: | 195 | public slots: |
198 | void showDay(); | 196 | void showDay(); |
197 | void deHighLight(); | ||
198 | void repaintfinishUpdateCell(); | ||
199 | protected slots: | 199 | protected slots: |
200 | void defaultAction( QListBoxItem * ); | 200 | void defaultAction( QListBoxItem * ); |
201 | void contextMenu( QListBoxItem * ); | 201 | void contextMenu( QListBoxItem * ); |
202 | void selection( QListBoxItem * ); | 202 | void selection( QListBoxItem * ); |
203 | void cellClicked( QListBoxItem * ); | 203 | void cellClicked( QListBoxItem * ); |
204 | void newEvent(); | 204 | void newEvent(); |