Diffstat (limited to 'korganizer/kotodoviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 519bb16..c21816d 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -19,7 +19,11 @@ | |||
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | #include <qapp.h> | 22 | #include <qapplication.h> |
23 | #include <QDesktopWidget> | ||
24 | //Added by qt3to4: | ||
25 | #include <Q3PointArray> | ||
26 | #include <QPixmap> | ||
23 | #include <kglobal.h> | 27 | #include <kglobal.h> |
24 | 28 | ||
25 | #include <kiconloader.h> | 29 | #include <kiconloader.h> |
@@ -27,14 +31,14 @@ | |||
27 | #include "kotodoview.h" | 31 | #include "kotodoview.h" |
28 | #include "koprefs.h" | 32 | #include "koprefs.h" |
29 | 33 | ||
30 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) | 34 | KOTodoViewItem::KOTodoViewItem( Q3ListView *parent, Todo *todo, KOTodoView *kotodo) |
31 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 35 | : Q3CheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
32 | { | 36 | { |
33 | construct(); | 37 | construct(); |
34 | } | 38 | } |
35 | 39 | ||
36 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) | 40 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) |
37 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 41 | : Q3CheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
38 | { | 42 | { |
39 | construct(); | 43 | construct(); |
40 | } | 44 | } |
@@ -80,7 +84,7 @@ void KOTodoViewItem::setSortKey(int column,const QString &key) | |||
80 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 84 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
81 | int y,int h) | 85 | int y,int h) |
82 | { | 86 | { |
83 | QListViewItem::paintBranches(p,cg,w,y,h); | 87 | Q3ListViewItem::paintBranches(p,cg,w,y,h); |
84 | } | 88 | } |
85 | #else | 89 | #else |
86 | #endif | 90 | #endif |
@@ -316,7 +320,7 @@ void KOTodoViewItem::stateChange(bool state) | |||
316 | else setSortKey(2,QString::number(99)); | 320 | else setSortKey(2,QString::number(99)); |
317 | } | 321 | } |
318 | if ( state ) { | 322 | if ( state ) { |
319 | QListViewItem * myChild = firstChild(); | 323 | Q3ListViewItem * myChild = firstChild(); |
320 | KOTodoViewItem *item; | 324 | KOTodoViewItem *item; |
321 | while( myChild ) { | 325 | while( myChild ) { |
322 | //qDebug("stateCH "); | 326 | //qDebug("stateCH "); |
@@ -325,7 +329,7 @@ void KOTodoViewItem::stateChange(bool state) | |||
325 | myChild = myChild->nextSibling(); | 329 | myChild = myChild->nextSibling(); |
326 | } | 330 | } |
327 | } else { | 331 | } else { |
328 | QListViewItem * myChild = parent(); | 332 | Q3ListViewItem * myChild = parent(); |
329 | if ( myChild ) | 333 | if ( myChild ) |
330 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 334 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
331 | } | 335 | } |
@@ -383,12 +387,12 @@ bool KOTodoViewItem::isAlternate() | |||
383 | { | 387 | { |
384 | KOTodoViewItem *item; | 388 | KOTodoViewItem *item; |
385 | bool previous = true; | 389 | bool previous = true; |
386 | if (QListViewItem::parent()) | 390 | if (Q3ListViewItem::parent()) |
387 | { | 391 | { |
388 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); | 392 | item = static_cast<KOTodoViewItem *>(Q3ListViewItem::parent()); |
389 | if (item) | 393 | if (item) |
390 | previous = item->m_odd; | 394 | previous = item->m_odd; |
391 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 395 | item = static_cast<KOTodoViewItem *>(Q3ListViewItem::parent()->firstChild()); |
392 | } | 396 | } |
393 | else | 397 | else |
394 | { | 398 | { |
@@ -476,13 +480,13 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
476 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 480 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
477 | QColor fc = KOPrefs::instance()->mHighlightColor; | 481 | QColor fc = KOPrefs::instance()->mHighlightColor; |
478 | if ( mTodo->percentComplete() == 100 ) | 482 | if ( mTodo->percentComplete() == 100 ) |
479 | fc = darkGreen; | 483 | fc = Qt::darkGreen; |
480 | p->drawRect( 2, 2, width-4, height()-4); | 484 | p->drawRect( 2, 2, width-4, height()-4); |
481 | p->fillRect( 3, 3, progress, height()-6, | 485 | p->fillRect( 3, 3, progress, height()-6, |
482 | fc ); | 486 | fc ); |
483 | p->restore(); | 487 | p->restore(); |
484 | } else { | 488 | } else { |
485 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 489 | Q3CheckListItem::paintCell(p, _cg, column, width, alignment); |
486 | } | 490 | } |
487 | return; | 491 | return; |
488 | } | 492 | } |
@@ -494,12 +498,12 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
494 | 498 | ||
495 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 499 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
496 | 500 | ||
497 | QListView *lv = listView(); | 501 | Q3ListView *lv = listView(); |
498 | if ( !lv ) | 502 | if ( !lv ) |
499 | return; | 503 | return; |
500 | int marg = 2;//lv->itemMargin(); | 504 | int marg = 2;//lv->itemMargin(); |
501 | int r = 0; | 505 | int r = 0; |
502 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 506 | Q3CheckListItem::Type myType = Q3CheckListItem::CheckBox; |
503 | int BoxSize = 20; | 507 | int BoxSize = 20; |
504 | int boxOffset = 2; | 508 | int boxOffset = 2; |
505 | int xOffset = 2; | 509 | int xOffset = 2; |
@@ -522,7 +526,7 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
522 | if ( !pixmap( 0 ) ) | 526 | if ( !pixmap( 0 ) ) |
523 | r += BoxSize + 4; | 527 | r += BoxSize + 4; |
524 | } else { | 528 | } else { |
525 | ASSERT( lv ); //### | 529 | Q_ASSERT( lv ); //### |
526 | //QFontMetrics fm( lv->font() ); | 530 | //QFontMetrics fm( lv->font() ); |
527 | //int d = fm.height(); | 531 | //int d = fm.height(); |
528 | int x = 0; | 532 | int x = 0; |
@@ -539,7 +543,7 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
539 | x++; | 543 | x++; |
540 | y++; | 544 | y++; |
541 | if ( isOn() ) { | 545 | if ( isOn() ) { |
542 | QPointArray a( 7*2 ); | 546 | Q3PointArray a( 7*2 ); |
543 | int i, xx, yy; | 547 | int i, xx, yy; |
544 | xx = x+xOffset+marg+(boxOffset/2); | 548 | xx = x+xOffset+marg+(boxOffset/2); |
545 | yy = y+5+boxOffset; | 549 | yy = y+5+boxOffset; |
@@ -555,7 +559,7 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
555 | a.setPoint( 2*i+1, xx, yy+2 ); | 559 | a.setPoint( 2*i+1, xx, yy+2 ); |
556 | xx++; yy--; | 560 | xx++; yy--; |
557 | } | 561 | } |
558 | p->setPen( darkGreen ); | 562 | p->setPen( Qt::darkGreen ); |
559 | p->drawLineSegments( a ); | 563 | p->drawLineSegments( a ); |
560 | } | 564 | } |
561 | //////////////////////// | 565 | //////////////////////// |
@@ -565,9 +569,9 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
565 | 569 | ||
566 | p->translate( r, 0 ); | 570 | p->translate( r, 0 ); |
567 | p->setPen( QPen( _cg.text() ) ); | 571 | p->setPen( QPen( _cg.text() ) ); |
568 | QListViewItem::paintCell( p, _cg, column, width - r, align ); | 572 | Q3ListViewItem::paintCell( p, _cg, column, width - r, align ); |
569 | if ( mTodo->cancelled () ) { | 573 | if ( mTodo->cancelled () ) { |
570 | p->setPen( black ); | 574 | p->setPen( Qt::black ); |
571 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); | 575 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); |
572 | int wid = br.width() +lineStart; | 576 | int wid = br.width() +lineStart; |
573 | if ( wid > width-3 ) | 577 | if ( wid > width-3 ) |