summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-28 09:52:05 (UTC)
committer zautrix <zautrix>2005-06-28 09:52:05 (UTC)
commitc26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4 (patch) (unidiff)
tree432c39b8c65277964b9e62ee98eeeb92e3006ba2
parent4385e73c51688f0b8b21bfe061c04a6c42e92701 (diff)
downloadkdepimpi-c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4.zip
kdepimpi-c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4.tar.gz
kdepimpi-c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp65
-rw-r--r--korganizer/komonthview.h4
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
@@ -370,10 +370,24 @@ void MonthViewItem::paint(QPainter *p)
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 );
@@ -412,7 +426,7 @@ void MonthViewItem::paint(QPainter *p)
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 }
@@ -424,8 +438,7 @@ void MonthViewItem::paint(QPainter *p)
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() ) {
@@ -617,7 +630,7 @@ void MonthViewCell::setHoliday( const QString &holiday )
617 630
618void MonthViewCell::startUpdateCell() 631void 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() )
@@ -881,6 +894,7 @@ void MonthViewCell::repaintfinishUpdateCell()
881 updateItem ( mitem ); 894 updateItem ( mitem );
882 mitem = (MonthViewItem *)mitem->next(); 895 mitem = (MonthViewItem *)mitem->next();
883 } 896 }
897 blockSignals( false );
884} 898}
885void MonthViewCell::finishUpdateCell() 899void MonthViewCell::finishUpdateCell()
886{ 900{
@@ -1026,15 +1040,14 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
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
@@ -1337,7 +1350,6 @@ KOMonthView::~KOMonthView()
1337 1350
1338void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) 1351void 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
@@ -1345,7 +1357,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
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;
@@ -1369,10 +1381,35 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
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);
@@ -1384,6 +1421,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
1384 if ( (*cells)[i]->doHighLight(inc) ) 1421 if ( (*cells)[i]->doHighLight(inc) )
1385 break; 1422 break;
1386 } 1423 }
1424#endif
1387 1425
1388} 1426}
1389void KOMonthView::selectInternalWeekNum ( int n ) 1427void KOMonthView::selectInternalWeekNum ( int n )
@@ -1721,7 +1759,8 @@ void KOMonthView::updateView()
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
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 0f3aa54..0bd6b1c 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -167,7 +167,6 @@ class MonthViewCell : public KNoScrollListBox
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
@@ -178,7 +177,6 @@ class MonthViewCell : public KNoScrollListBox
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();
@@ -196,6 +194,8 @@ class MonthViewCell : public KNoScrollListBox
196 194
197public slots: 195public 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 * );