summaryrefslogtreecommitdiff
path: root/core/pim/todo/todotable.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/todotable.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/todotable.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp
index 779b28c..15f733b 100644
--- a/core/pim/todo/todotable.cpp
+++ b/core/pim/todo/todotable.cpp
@@ -210,48 +210,49 @@ void DueTextItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bo
210 if( m_hasDate && !m_completed ){ 210 if( m_hasDate && !m_completed ){
211 if( m_off < 0 ){ 211 if( m_off < 0 ){
212 cg2.setColor(QColorGroup::Text, QColor(red ) ); 212 cg2.setColor(QColorGroup::Text, QColor(red ) );
213 }else if( m_off == 0 ){ 213 }else if( m_off == 0 ){
214 cg2.setColor(QColorGroup::Text, QColor(yellow) ); // orange isn't predefined 214 cg2.setColor(QColorGroup::Text, QColor(yellow) ); // orange isn't predefined
215 }else if( m_off > 0){ 215 }else if( m_off > 0){
216 cg2.setColor(QColorGroup::Text, QColor(green ) ); 216 cg2.setColor(QColorGroup::Text, QColor(green ) );
217 } 217 }
218 } 218 }
219 QTableItem::paint(p, cg2, cr, selected ); 219 QTableItem::paint(p, cg2, cr, selected );
220 cg2.setColor(QColorGroup::Text, text ); 220 cg2.setColor(QColorGroup::Text, text );
221} 221}
222TodoTable::TodoTable( QWidget *parent, const char *name ) 222TodoTable::TodoTable( QWidget *parent, const char *name )
223// #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR 223// #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR
224// : QTable( 0, 3, parent, name, TRUE ), 224// : QTable( 0, 3, parent, name, TRUE ),
225// #else 225// #else
226 : QTable( 0, 4, parent, name ), 226 : QTable( 0, 4, parent, name ),
227// #endif 227// #endif
228 showComp( true ), 228 showComp( true ),
229 enablePainting( true ), 229 enablePainting( true ),
230 mCat( 0 ), 230 mCat( 0 ),
231 currFindRow( -2 ), 231 currFindRow( -2 ),
232 showDeadl( true) 232 showDeadl( true)
233{ 233{
234 setNumRows(0);
234 mCat.load( categoryFileName() ); 235 mCat.load( categoryFileName() );
235 setSorting( TRUE ); 236 setSorting( TRUE );
236 setSelectionMode( NoSelection ); 237 setSelectionMode( NoSelection );
237 setColumnStretchable( 2, TRUE ); 238 setColumnStretchable( 2, TRUE );
238 setColumnWidth( 0, 20 ); 239 setColumnWidth( 0, 20 );
239 setColumnWidth( 1, 35 ); 240 setColumnWidth( 1, 35 );
240 241
241 setLeftMargin( 0 ); 242 setLeftMargin( 0 );
242 verticalHeader()->hide(); 243 verticalHeader()->hide();
243 horizontalHeader()->setLabel( 0, tr( "C." ) ); 244 horizontalHeader()->setLabel( 0, tr( "C." ) );
244 horizontalHeader()->setLabel( 1, tr( "Prior." ) ); 245 horizontalHeader()->setLabel( 1, tr( "Prior." ) );
245 horizontalHeader()->setLabel( 2, tr( "Description" ) ); 246 horizontalHeader()->setLabel( 2, tr( "Description" ) );
246 247
247 setColumnStretchable( 3, FALSE ); 248 setColumnStretchable( 3, FALSE );
248 setColumnWidth( 3, 20 ); 249 setColumnWidth( 3, 20 );
249 horizontalHeader()->setLabel( 3, tr( "Deadline" ) ); 250 horizontalHeader()->setLabel( 3, tr( "Deadline" ) );
250 251
251 if (showDeadl){ 252 if (showDeadl){
252 showColumn (3); 253 showColumn (3);
253 }else{ 254 }else{
254 hideColumn (3); 255 hideColumn (3);
255 } 256 }
256 257
257 connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ), 258 connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ),
@@ -431,48 +432,51 @@ void TodoTable::load( const QString &fn )
431// QTable::sortColumn(1,TRUE,TRUE); 432// QTable::sortColumn(1,TRUE,TRUE);
432 QTable::sortColumn(0,TRUE,TRUE); 433 QTable::sortColumn(0,TRUE,TRUE);
433 setCurrentCell( 0, 2 ); 434 setCurrentCell( 0, 2 );
434 setSorting(true ); 435 setSorting(true );
435 mDayTimer->start( 60 * 1000 ); // gone in 60 seconds? 436 mDayTimer->start( 60 * 1000 ); // gone in 60 seconds?
436} 437}
437void TodoTable::updateVisible() 438void TodoTable::updateVisible()
438{ 439{
439 if ( !isUpdatesEnabled() ) 440 if ( !isUpdatesEnabled() )
440 return; 441 return;
441 442
442 if (showDeadl){ 443 if (showDeadl){
443 showColumn (3); 444 showColumn (3);
444 adjustColumn(3); 445 adjustColumn(3);
445 }else{ 446 }else{
446 hideColumn (3); 447 hideColumn (3);
447 adjustColumn(2); 448 adjustColumn(2);
448 } 449 }
449 450
450 int visible = 0; 451 int visible = 0;
451 int id = mCat.id( "Todo List", showCat ); 452 int id = mCat.id( "Todo List", showCat );
452 for ( int row = 0; row < numRows(); row++ ) { 453 for ( int row = 0; row < numRows(); row++ ) {
453 CheckItem *ci = (CheckItem *)item( row, 0 ); 454 CheckItem *ci = (CheckItem *)item( row, 0 );
454 ToDoEvent *t = todoList[ci]; 455 ToDoEvent *t = todoList[ci];
456 if (!t)
457 continue;
458
455 QArray<int> vlCats = t->categories(); 459 QArray<int> vlCats = t->categories();
456 bool hide = false; 460 bool hide = false;
457 if ( !showComp && ci->isChecked() ) 461 if ( !showComp && ci->isChecked() )
458 hide = true; 462 hide = true;
459 if ( !showCat.isEmpty() ) { 463 if ( !showCat.isEmpty() ) {
460 if ( showCat == tr( "Unfiled" ) ) { 464 if ( showCat == tr( "Unfiled" ) ) {
461 if ( vlCats.count() > 0 ) 465 if ( vlCats.count() > 0 )
462 hide = true; 466 hide = true;
463 } else { 467 } else {
464 // do some comparing, we have to reverse our idea here... which idea? - zecke 468 // do some comparing, we have to reverse our idea here... which idea? - zecke
465 if ( !hide ) { 469 if ( !hide ) {
466 hide = true; 470 hide = true;
467 for ( uint it = 0; it < vlCats.count(); ++it ) { 471 for ( uint it = 0; it < vlCats.count(); ++it ) {
468 if ( vlCats[it] == id ) { 472 if ( vlCats[it] == id ) {
469 hide = false; 473 hide = false;
470 break; 474 break;
471 } 475 }
472 } 476 }
473 } 477 }
474 } 478 }
475 } 479 }
476 if ( hide ) { 480 if ( hide ) {
477 if ( currentRow() == row ) 481 if ( currentRow() == row )
478 setCurrentCell( -1, 0 ); 482 setCurrentCell( -1, 0 );