author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/kotodoviewitem.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
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 | |||
@@ -18,24 +18,28 @@ | |||
18 | */ | 18 | */ |
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> |
26 | #include "kotodoviewitem.h" | 30 | #include "kotodoviewitem.h" |
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 | } |
41 | 45 | ||
@@ -79,9 +83,9 @@ void KOTodoViewItem::setSortKey(int column,const QString &key) | |||
79 | #if QT_VERSION >= 0x030000 | 83 | #if QT_VERSION >= 0x030000 |
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 |
87 | 91 | ||
@@ -315,18 +319,18 @@ void KOTodoViewItem::stateChange(bool state) | |||
315 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 319 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
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 "); |
323 | item = static_cast<KOTodoViewItem*>(myChild); | 327 | item = static_cast<KOTodoViewItem*>(myChild); |
324 | item->stateChange(state); | 328 | item->stateChange(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 | } |
332 | mTodoView->modified(true); | 336 | mTodoView->modified(true); |
@@ -382,14 +386,14 @@ bool KOTodoViewItem::isAlternate() | |||
382 | else | 386 | else |
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 | { |
395 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 399 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
@@ -475,15 +479,15 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
475 | // p->setPen(Qt::black ); //border | 479 | // p->setPen(Qt::black ); //border |
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 | } |
489 | 493 | ||
@@ -493,14 +497,14 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
493 | return; | 497 | return; |
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; |
506 | if (qApp->desktop()->width() < 300 ) { | 510 | if (qApp->desktop()->width() < 300 ) { |
@@ -521,9 +525,9 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
521 | if ( myType == Controller ) { | 525 | if ( myType == Controller ) { |
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; |
529 | int y = (height() - BoxSize) / 2; | 533 | int y = (height() - BoxSize) / 2; |
@@ -538,9 +542,9 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
538 | ///////////////////// | 542 | ///////////////////// |
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; |
546 | for ( i=0; i<3; i++ ) { | 550 | for ( i=0; i<3; i++ ) { |
@@ -554,9 +558,9 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
554 | a.setPoint( 2*i, xx, yy ); | 558 | a.setPoint( 2*i, xx, yy ); |
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 | //////////////////////// |
562 | } | 566 | } |
@@ -564,11 +568,11 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
564 | } | 568 | } |
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 ) |
574 | wid = width-3; | 578 | wid = width-3; |