summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoviewitem.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoviewitem.cpp42
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
@@ -1,115 +1,119 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
30KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) 34KOTodoViewItem::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
36KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) 40KOTodoViewItem::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
42QString KOTodoViewItem::key(int column,bool) const 46QString KOTodoViewItem::key(int column,bool) const
43{ 47{
44 if ( column == 0 ) 48 if ( column == 0 )
45 return text(0).lower(); 49 return text(0).lower();
46 if ( column == 1 ) { 50 if ( column == 1 ) {
47 if ( mTodo->isCompleted() ) { 51 if ( mTodo->isCompleted() ) {
48 return "6"+QString::number(mTodo->priority())+text(0).lower(); 52 return "6"+QString::number(mTodo->priority())+text(0).lower();
49 } 53 }
50 return QString::number(mTodo->priority())+text(0).lower(); 54 return QString::number(mTodo->priority())+text(0).lower();
51 } 55 }
52 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 56 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
53 if (it == mKeyMap.end()) { 57 if (it == mKeyMap.end()) {
54 return text(column).lower(); 58 return text(column).lower();
55 } else { 59 } else {
56 if ( column == 2 ) { 60 if ( column == 2 ) {
57 return *it+text(0).lower(); 61 return *it+text(0).lower();
58 } 62 }
59 return *it; 63 return *it;
60 } 64 }
61} 65}
62 66
63void KOTodoViewItem:: setup() 67void KOTodoViewItem:: setup()
64{ 68{
65 69
66 int h = 20; 70 int h = 20;
67 if ( listView () ) { 71 if ( listView () ) {
68 QFontMetrics fm ( listView ()->font () ); 72 QFontMetrics fm ( listView ()->font () );
69 h = fm.height(); 73 h = fm.height();
70 } 74 }
71 setHeight( h ); 75 setHeight( h );
72 76
73} 77}
74void KOTodoViewItem::setSortKey(int column,const QString &key) 78void KOTodoViewItem::setSortKey(int column,const QString &key)
75{ 79{
76 mKeyMap.insert(column,key); 80 mKeyMap.insert(column,key);
77} 81}
78 82
79#if QT_VERSION >= 0x030000 83#if QT_VERSION >= 0x030000
80void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, 84void 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
88void KOTodoViewItem::construct() 92void KOTodoViewItem::construct()
89{ 93{
90 // qDebug("KOTodoViewItem::construct() "); 94 // qDebug("KOTodoViewItem::construct() ");
91 m_init = true; 95 m_init = true;
92 QString keyd = "=="; 96 QString keyd = "==";
93 QString keyt = "=="; 97 QString keyt = "==";
94 QString skeyd = "=="; 98 QString skeyd = "==";
95 QString skeyt = "=="; 99 QString skeyt = "==";
96 100
97 setOn(mTodo->isCompleted()); 101 setOn(mTodo->isCompleted());
98 setText(0,mTodo->summary()); 102 setText(0,mTodo->summary());
99 setText(1,QString::number(mTodo->priority())); 103 setText(1,QString::number(mTodo->priority()));
100 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 104 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
101 if (mTodo->percentComplete()<100) { 105 if (mTodo->percentComplete()<100) {
102 setSortKey(2,QString::number(mTodo->percentComplete())); 106 setSortKey(2,QString::number(mTodo->percentComplete()));
103 } 107 }
104 else { 108 else {
105 setSortKey(2,"999"); 109 setSortKey(2,"999");
106 } 110 }
107 if (mTodo->hasDueDate()) { 111 if (mTodo->hasDueDate()) {
108 setText(3, mTodo->dtDueDateStr()); 112 setText(3, mTodo->dtDueDateStr());
109 QDate d = mTodo->dtDue().date(); 113 QDate d = mTodo->dtDue().date();
110 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 114 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
111 // setSortKey(3,keyd); 115 // setSortKey(3,keyd);
112 if (mTodo->doesFloat()) { 116 if (mTodo->doesFloat()) {
113 setText(4,""); 117 setText(4,"");
114 } 118 }
115 else { 119 else {
@@ -287,137 +291,137 @@ void KOTodoViewItem::stateChange(bool state)
287 if (mTodo->hasStartDate()) { 291 if (mTodo->hasStartDate()) {
288 QString skeyt = "=="; 292 QString skeyt = "==";
289 QString skeyd = "=="; 293 QString skeyd = "==";
290 setText(5, mTodo->dtStartDateStr()); 294 setText(5, mTodo->dtStartDateStr());
291 QDate d = mTodo->dtStart().date(); 295 QDate d = mTodo->dtStart().date();
292 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 296 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
293 297
294 if (mTodo->doesFloat()) { 298 if (mTodo->doesFloat()) {
295 setText(6,""); 299 setText(6,"");
296 } 300 }
297 else { 301 else {
298 setText(6,mTodo->dtStartTimeStr()); 302 setText(6,mTodo->dtStartTimeStr());
299 QTime t = mTodo->dtStart().time(); 303 QTime t = mTodo->dtStart().time();
300 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 304 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
301 305
302 } 306 }
303 setSortKey(5,skeyd); 307 setSortKey(5,skeyd);
304 setSortKey(6,skeyt); 308 setSortKey(6,skeyt);
305 } 309 }
306 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 310 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
307 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 311 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
308 312
309 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 313 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
310 if (mTodo->percentComplete()<100) { 314 if (mTodo->percentComplete()<100) {
311 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 315 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
312 else setSortKey(2,QString::number(mTodo->percentComplete())); 316 else setSortKey(2,QString::number(mTodo->percentComplete()));
313 } 317 }
314 else { 318 else {
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);
333 setMyPixmap(); 337 setMyPixmap();
334 mTodoView->setTodoModified( mTodo ); 338 mTodoView->setTodoModified( mTodo );
335} 339}
336 340
337bool KOTodoViewItem::isAlternate() 341bool KOTodoViewItem::isAlternate()
338{ 342{
339#if 0 343#if 0
340 //if ( m_known ) return m_odd; 344 //if ( m_known ) return m_odd;
341 //qDebug("test "); 345 //qDebug("test ");
342 KOTodoViewItem *item = static_cast<KOTodoViewItem *>(itemAbove()); 346 KOTodoViewItem *item = static_cast<KOTodoViewItem *>(itemAbove());
343 if ( item ) { 347 if ( item ) {
344 m_known = item->m_known; 348 m_known = item->m_known;
345 if ( m_known ) { 349 if ( m_known ) {
346 m_odd = !item->m_odd ; 350 m_odd = !item->m_odd ;
347 return m_odd; 351 return m_odd;
348 } 352 }
349 } else { 353 } else {
350 item = static_cast<KOTodoViewItem *>(itemBelow()); 354 item = static_cast<KOTodoViewItem *>(itemBelow());
351 if ( item ) { 355 if ( item ) {
352 m_known = item->m_known; 356 m_known = item->m_known;
353 if ( m_known ) { 357 if ( m_known ) {
354 m_odd = !item->m_odd ; 358 m_odd = !item->m_odd ;
355 return m_odd; 359 return m_odd;
356 } 360 }
357 } 361 }
358 } 362 }
359 KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 363 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
360 item = static_cast<KOTodoViewItem *>(lv->firstChild()); 364 item = static_cast<KOTodoViewItem *>(lv->firstChild());
361 bool previous = true; 365 bool previous = true;
362 qDebug("WHILE "); 366 qDebug("WHILE ");
363 while ( item ) { 367 while ( item ) {
364 item->m_odd = !previous; 368 item->m_odd = !previous;
365 item->m_known = true; 369 item->m_known = true;
366 previous = !previous; 370 previous = !previous;
367 item = static_cast<KOTodoViewItem *>(item->itemBelow()); 371 item = static_cast<KOTodoViewItem *>(item->itemBelow());
368 } 372 }
369 return m_odd; 373 return m_odd;
370 374
371#else 375#else
372 376
373 //KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 377 //KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
374 //if (lv && lv->alternateBackground().isValid()) 378 //if (lv && lv->alternateBackground().isValid())
375 { 379 {
376 KOTodoViewItem *above = static_cast<KOTodoViewItem *>(itemAbove()); 380 KOTodoViewItem *above = static_cast<KOTodoViewItem *>(itemAbove());
377 m_known = above ? above->m_known : true; 381 m_known = above ? above->m_known : true;
378 if (m_known) 382 if (m_known)
379 { 383 {
380 m_odd = above ? !above->m_odd : false; 384 m_odd = above ? !above->m_odd : false;
381 } 385 }
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());
396 item = static_cast<KOTodoViewItem *>(lv->firstChild()); 400 item = static_cast<KOTodoViewItem *>(lv->firstChild());
397 } 401 }
398 402
399 while(item) 403 while(item)
400 { 404 {
401 item->m_odd = previous = !previous; 405 item->m_odd = previous = !previous;
402 item->m_known = true; 406 item->m_known = true;
403 item = static_cast<KOTodoViewItem *>(item->nextSibling()); 407 item = static_cast<KOTodoViewItem *>(item->nextSibling());
404 } 408 }
405 } 409 }
406 return m_odd; 410 return m_odd;
407 } 411 }
408 return false; 412 return false;
409#endif 413#endif
410} 414}
411 415
412void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 416void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
413{ 417{
414 QColorGroup _cg = cg; 418 QColorGroup _cg = cg;
415 QColorGroup::ColorRole role; 419 QColorGroup::ColorRole role;
416 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning()) 420 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning())
417 role = QColorGroup::Text; 421 role = QColorGroup::Text;
418 else 422 else
419 role = QColorGroup::Base; 423 role = QColorGroup::Base;
420 //#ifndef KORG_NOLVALTERNATION 424 //#ifndef KORG_NOLVALTERNATION
421 if (isAlternate()) 425 if (isAlternate())
422 _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); 426 _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
423 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; 427 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
@@ -447,133 +451,133 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
447 int odue = mTodo->hasDueSubTodo( openMode ); 451 int odue = mTodo->hasDueSubTodo( openMode );
448 if (odue == 2) { 452 if (odue == 2) {
449 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 453 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
450 setColor = true; 454 setColor = true;
451 } else if ( odue == 1 ) { 455 } else if ( odue == 1 ) {
452 colorToSet = KOPrefs::instance()->mTodoDueTodayColor; 456 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
453 setColor = true; 457 setColor = true;
454 } 458 }
455 } 459 }
456 460
457 461
458 if ( setColor ) { 462 if ( setColor ) {
459 _cg.setColor(role,colorToSet ); 463 _cg.setColor(role,colorToSet );
460 if ( role == QColorGroup::Base) { 464 if ( role == QColorGroup::Base) {
461 int rgb = colorToSet.red(); 465 int rgb = colorToSet.red();
462 rgb += colorToSet.blue()/2; 466 rgb += colorToSet.blue()/2;
463 rgb += colorToSet.green(); 467 rgb += colorToSet.green();
464 if ( rgb < 200 ) 468 if ( rgb < 200 )
465 _cg.setColor(QColorGroup::Text,Qt::white ); 469 _cg.setColor(QColorGroup::Text,Qt::white );
466 } 470 }
467 } 471 }
468 //#endif 472 //#endif
469 if ( column > 0 ){ 473 if ( column > 0 ){
470 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { 474 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
471 p->save(); 475 p->save();
472 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); 476 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
473 477
474 p->fillRect( 0, 0, width, height(), _cg.base() ); // background 478 p->fillRect( 0, 0, width, height(), _cg.base() ); // background
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
490 int align = alignment; 494 int align = alignment;
491 495
492 if ( !p ) 496 if ( !p )
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 ) {
507 BoxSize = 14; 511 BoxSize = 14;
508 boxOffset = -1; 512 boxOffset = -1;
509 xOffset = 1; 513 xOffset = 1;
510 // marg = 0; 514 // marg = 0;
511 } 515 }
512 if ( height() < BoxSize ) { 516 if ( height() < BoxSize ) {
513 boxOffset = boxOffset - ((BoxSize - height())/2) ; 517 boxOffset = boxOffset - ((BoxSize - height())/2) ;
514 // qDebug("boxOffset %d height %d", boxOffset, height() ); 518 // qDebug("boxOffset %d height %d", boxOffset, height() );
515 BoxSize = height(); 519 BoxSize = height();
516 520
517 } 521 }
518 //bool winStyle = lv->style() == WindowsStyle; 522 //bool winStyle = lv->style() == WindowsStyle;
519 523
520 int lineStart = 5; 524 int lineStart = 5;
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;
530 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); 534 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) );
531 if ( myType == CheckBox ) { 535 if ( myType == CheckBox ) {
532 if ( isEnabled() ) 536 if ( isEnabled() )
533 p->setPen( QPen( _cg.text(), 1 ) ); 537 p->setPen( QPen( _cg.text(), 1 ) );
534 else 538 else
535 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); 539 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) );
536 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); 540 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 );
537 lineStart = x+marg; 541 lineStart = x+marg;
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++ ) {
547 a.setPoint( 2*i, xx, yy ); 551 a.setPoint( 2*i, xx, yy );
548 a.setPoint( 2*i+1, xx, yy+2 ); 552 a.setPoint( 2*i+1, xx, yy+2 );
549 // qDebug(" "); 553 // qDebug(" ");
550 xx++; yy++; 554 xx++; yy++;
551 } 555 }
552 yy -= 2; 556 yy -= 2;
553 for ( i=3; i<7; i++ ) { 557 for ( i=3; i<7; 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 }
563 r += BoxSize + 4; 567 r += BoxSize + 4;
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;
575 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); 579 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 );
576 580
577 } 581 }
578 582
579} 583}