summaryrefslogtreecommitdiff
path: root/core/pim
Unidiff
Diffstat (limited to 'core/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/todotable.cpp22
-rw-r--r--core/pim/todo/todotable.h3
2 files changed, 13 insertions, 12 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
@@ -231,6 +231,7 @@ TodoTable::TodoTable( QWidget *parent, const char *name )
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 );
@@ -246,7 +247,7 @@ TodoTable::TodoTable( QWidget *parent, const char *name )
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);
@@ -313,7 +314,7 @@ void TodoTable::slotClicked( int row, int col, int, const QPoint &pos )
313 emit showDetails( *todo ); 314 emit showDetails( *todo );
314 } 315 }
315 break; 316 break;
316 case 3: 317 case 3:
317 // may as well edit it... 318 // may as well edit it...
318 menuTimer->stop(); 319 menuTimer->stop();
319 emit signalEdit(); 320 emit signalEdit();
@@ -438,7 +439,7 @@ void 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);
@@ -452,6 +453,9 @@ void TodoTable::updateVisible()
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() )
@@ -599,7 +603,7 @@ void TodoTable::loadFile( const QString &/*we use the standard*/ )
599 for(QValueList<ToDoEvent>::ConstIterator it = vaList.begin(); it != vaList.end(); ++it ){ 603 for(QValueList<ToDoEvent>::ConstIterator it = vaList.begin(); it != vaList.end(); ++it ){
600 ToDoEvent *event = new ToDoEvent( (*it) ); 604 ToDoEvent *event = new ToDoEvent( (*it) );
601 list.append( event ); 605 list.append( event );
602 } 606 }
603 vaList.clear(); 607 vaList.clear();
604 // qDebug("parsing done=%d", t.elapsed() ); 608 // qDebug("parsing done=%d", t.elapsed() );
605 if ( list.count() > 0 ) { 609 if ( list.count() > 0 ) {
@@ -681,7 +685,7 @@ void TodoTable::keyPressEvent( QKeyEvent *e )
681 emit signalEdit(); 685 emit signalEdit();
682 default: 686 default:
683 break; 687 break;
684 } 688 }
685 } else 689 } else
686 QTable::keyPressEvent( e ); 690 QTable::keyPressEvent( e );
687} 691}
@@ -758,7 +762,7 @@ int TodoTable::showCategoryId() const
758 id = mCat.id( "Todo List", showCat ); 762 id = mCat.id( "Todo List", showCat );
759 return id; 763 return id;
760} 764}
761void TodoTable::applyJournal() 765void TodoTable::applyJournal()
762{ 766{
763 // we need to hack 767 // we need to hack
764 QFile file( journalFileName() ); 768 QFile file( journalFileName() );
@@ -809,7 +813,7 @@ void TodoTable::slotCheckDay()
809 if( mDay.daysTo(date )!= 0 ){ 813 if( mDay.daysTo(date )!= 0 ){
810 setPaintingEnabled( FALSE ); 814 setPaintingEnabled( FALSE );
811 for(int i=0; i < numRows(); i++ ){ 815 for(int i=0; i < numRows(); i++ ){
812 ToDoEvent *t = todoList[static_cast<CheckItem*>(item(i, 0))]; 816 ToDoEvent *t = todoList[static_cast<CheckItem*>(item(i, 0))];
813 static_cast<DueTextItem*>(item(i, 3) )->setToDoEvent( t ); 817 static_cast<DueTextItem*>(item(i, 3) )->setToDoEvent( t );
814 818
815 } 819 }
@@ -918,8 +922,8 @@ static ToDoEvent xmlToEvent( XMLElement *element )
918 // category 922 // category
919 dummy = element->attribute("Categories" ); 923 dummy = element->attribute("Categories" );
920 QStringList ids = QStringList::split(";", dummy ); 924 QStringList ids = QStringList::split(";", dummy );
921 event.setCategories( ids ); 925 event.setCategories( ids );
922 926
923 //uid 927 //uid
924 dummy = element->attribute("Uid" ); 928 dummy = element->attribute("Uid" );
925 dumInt = dummy.toInt(&ok ); 929 dumInt = dummy.toInt(&ok );
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
index 7539df1..387dddb 100644
--- a/core/pim/todo/todotable.h
+++ b/core/pim/todo/todotable.h
@@ -192,9 +192,6 @@ private:
192 192
193inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) 193inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row )
194{ 194{
195 int rows = numRows();
196 ++rows;
197 setNumRows( rows );
198 QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A') 195 QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A')
199 + todo->priority() ) 196 + todo->priority() )
200 + Qtopia::buildSortKey( todo->description() ); 197 + Qtopia::buildSortKey( todo->description() );