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
@@ -369,12 +369,26 @@ void MonthViewItem::paint(QPainter *p)
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 );
@@ -411,9 +425,9 @@ void MonthViewItem::paint(QPainter *p)
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 }
@@ -423,10 +437,9 @@ void MonthViewItem::paint(QPainter *p)
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() );
@@ -616,9 +629,9 @@ void MonthViewCell::setHoliday( const QString &holiday )
616} 629}
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() )
624 return; 637 return;
@@ -880,8 +893,9 @@ void MonthViewCell::repaintfinishUpdateCell()
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}
885void MonthViewCell::finishUpdateCell() 899void MonthViewCell::finishUpdateCell()
886{ 900{
887 901
@@ -1025,17 +1039,16 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
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;
@@ -1336,17 +1349,16 @@ KOMonthView::~KOMonthView()
1336} 1349}
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
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) {
@@ -1368,12 +1380,37 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
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) )
@@ -1383,8 +1420,9 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
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}
1389void KOMonthView::selectInternalWeekNum ( int n ) 1427void KOMonthView::selectInternalWeekNum ( int n )
1390{ 1428{
@@ -1720,9 +1758,10 @@ void KOMonthView::updateView()
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
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 0f3aa54..0bd6b1c 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -166,9 +166,8 @@ class MonthViewCell : public KNoScrollListBox
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 );
@@ -177,9 +176,8 @@ class MonthViewCell : public KNoScrollListBox
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
@@ -195,8 +193,10 @@ class MonthViewCell : public KNoScrollListBox
195 void resizeEvent( QResizeEvent * ); 193 void resizeEvent( QResizeEvent * );
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 * );
202 void selection( QListBoxItem * ); 202 void selection( QListBoxItem * );