summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
@@ -230,8 +230,9 @@ TodoTable::TodoTable( QWidget *parent, const char *name )
mCat( 0 ),
currFindRow( -2 ),
showDeadl( true)
{
+ setNumRows(0);
mCat.load( categoryFileName() );
setSorting( TRUE );
setSelectionMode( NoSelection );
setColumnStretchable( 2, TRUE );
@@ -245,9 +246,9 @@ TodoTable::TodoTable( QWidget *parent, const char *name )
horizontalHeader()->setLabel( 2, tr( "Description" ) );
setColumnStretchable( 3, FALSE );
setColumnWidth( 3, 20 );
- horizontalHeader()->setLabel( 3, tr( "Deadline" ) );
+ horizontalHeader()->setLabel( 3, tr( "Deadline" ) );
if (showDeadl){
showColumn (3);
}else{
@@ -312,9 +313,9 @@ void TodoTable::slotClicked( int row, int col, int, const QPoint &pos )
ToDoEvent *todo = todoList[static_cast<CheckItem*>(item(row, 0))];
emit showDetails( *todo );
}
break;
- case 3:
+ case 3:
// may as well edit it...
menuTimer->stop();
emit signalEdit();
break;
@@ -437,9 +438,9 @@ void TodoTable::load( const QString &fn )
void TodoTable::updateVisible()
{
if ( !isUpdatesEnabled() )
return;
-
+
if (showDeadl){
showColumn (3);
adjustColumn(3);
}else{
@@ -451,8 +452,11 @@ void TodoTable::updateVisible()
int id = mCat.id( "Todo List", showCat );
for ( int row = 0; row < numRows(); row++ ) {
CheckItem *ci = (CheckItem *)item( row, 0 );
ToDoEvent *t = todoList[ci];
+ if (!t)
+ continue;
+
QArray<int> vlCats = t->categories();
bool hide = false;
if ( !showComp && ci->isChecked() )
hide = true;
@@ -598,9 +602,9 @@ void TodoTable::loadFile( const QString &/*we use the standard*/ )
QValueList<ToDoEvent> vaList = todoDB.rawToDos();
for(QValueList<ToDoEvent>::ConstIterator it = vaList.begin(); it != vaList.end(); ++it ){
ToDoEvent *event = new ToDoEvent( (*it) );
list.append( event );
- }
+ }
vaList.clear();
// qDebug("parsing done=%d", t.elapsed() );
if ( list.count() > 0 ) {
internalAddEntries( list );
@@ -680,9 +684,9 @@ void TodoTable::keyPressEvent( QKeyEvent *e )
// Future: Let us change the dueDate directly...
emit signalEdit();
default:
break;
- }
+ }
} else
QTable::keyPressEvent( e );
}
@@ -757,9 +761,9 @@ int TodoTable::showCategoryId() const
if ( showCat != tr( "Unfiled" ) && showCat != tr( "All" ) )
id = mCat.id( "Todo List", showCat );
return id;
}
-void TodoTable::applyJournal()
+void TodoTable::applyJournal()
{
// we need to hack
QFile file( journalFileName() );
if( file.open(IO_ReadOnly ) ) {
@@ -808,9 +812,9 @@ void TodoTable::slotCheckDay()
QDate date = QDate::currentDate();
if( mDay.daysTo(date )!= 0 ){
setPaintingEnabled( FALSE );
for(int i=0; i < numRows(); i++ ){
- ToDoEvent *t = todoList[static_cast<CheckItem*>(item(i, 0))];
+ ToDoEvent *t = todoList[static_cast<CheckItem*>(item(i, 0))];
static_cast<DueTextItem*>(item(i, 3) )->setToDoEvent( t );
}
setPaintingEnabled( TRUE );
@@ -917,10 +921,10 @@ static ToDoEvent xmlToEvent( XMLElement *element )
event.setSummary( dummy );
// category
dummy = element->attribute("Categories" );
QStringList ids = QStringList::split(";", dummy );
- event.setCategories( ids );
-
+ event.setCategories( ids );
+
//uid
dummy = element->attribute("Uid" );
dumInt = dummy.toInt(&ok );
if(ok ) event.setUid( dumInt );
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
@@ -191,11 +191,8 @@ private:
inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row )
{
- int rows = numRows();
- ++rows;
- setNumRows( rows );
QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A')
+ todo->priority() )
+ Qtopia::buildSortKey( todo->description() );
CheckItem *chk = new CheckItem( this, sortKey );