-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index d3f4cb4..a28fc3e 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -403,48 +403,49 @@ void TodoWindow::slotDuplicate() { // uid Qtopia::UidGen *uidgen = new Qtopia::UidGen(); uid = uidgen->generate(); delete uidgen; } ev2.setUid( uid ); table->setPaintingEnabled( false ); table->addEntry( ev2 ); table->setPaintingEnabled( true ); mStack->raiseWidget( 1 ); } void TodoWindow::slotShowPopup( const QPoint &p ) { contextMenu->popup( p ); } void TodoWindow::showCompleted( bool s ) { if ( !table->isUpdatesEnabled() ) return; table->setPaintingEnabled( false ); table->setShowCompleted( s ); table->setPaintingEnabled( true ); + mStack->raiseWidget( 1 ); } void TodoWindow::currentEntryChanged( int r, int ) { if ( r != -1 && table->rowHeight( r ) > 0 ) { editAction->setEnabled( TRUE ); deleteAction->setEnabled( TRUE ); duplicateAction->setEnabled( TRUE ); deleteAllAction->setEnabled( TRUE ); } else { editAction->setEnabled( FALSE ); deleteAction->setEnabled( FALSE ); duplicateAction->setEnabled( FALSE ); deleteAllAction->setEnabled( FALSE ); } } void TodoWindow::setCategory( int c ) { if ( c <= 0 ) return; if ( !table->isUpdatesEnabled() ) return; table->setPaintingEnabled( false ); for ( unsigned int i = 1; i < catMenu->count(); i++ ) @@ -524,48 +525,49 @@ void TodoWindow::closeEvent( QCloseEvent *e ) config.setGroup( "View" ); config.writeEntry( "ShowComplete", table->showCompleted() ); config.writeEntry( "Category", table->showCategory() ); /* added 20.01.2k2 by se */ config.writeEntry( "ShowDeadLine", table->showDeadline()); } else { if ( QMessageBox::critical( this, tr("Out of space"), tr("Todo was unable\n" "to save your changes.\n" "Free up some space\n" "and try again.\n" "\nQuit Anyway?"), QMessageBox::Yes|QMessageBox::Escape, QMessageBox::No|QMessageBox::Default) != QMessageBox::No ) e->accept(); else e->ignore(); } } void TodoWindow::slotFind() { // put everything back to view all for searching... + mStack->raiseWidget( 1 ); if ( !catMenu->isItemChecked( 0 ) ) setCategory( 0 ); FindDialog dlg( "Todo List", this ); QObject::connect( &dlg, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), table, SLOT(slotDoFind(const QString&, bool, bool, int)) ); QObject::connect( table, SIGNAL(signalNotFound()), &dlg, SLOT(slotNotFound()) ); QObject::connect( table, SIGNAL(signalWrapAround()), &dlg, SLOT(slotWrapAround()) ); dlg.exec(); if ( table->numSelections() ) table->clearSelection(); table->clearFindRow(); } void TodoWindow::setDocument( const QString &filename ) { if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp index 753c036..dc60cc4 100644 --- a/core/pim/todo/todotable.cpp +++ b/core/pim/todo/todotable.cpp @@ -577,92 +577,93 @@ void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action ) if(todo.hasDate() ) { buf += " DateYear=\""+QString::number( todo.date().year() ) + "\""; buf += " DateMonth=\"" + QString::number( todo.date().month() ) + "\""; buf += " DateDay=\"" + QString::number( todo.date().day() ) + "\""; } buf += "/>\n"; str = buf.utf8(); f.writeBlock( str.data(), str.length() ); f.close(); } void TodoTable::rowHeightChanged( int row ) { if ( enablePainting ) QTable::rowHeightChanged( row ); } void TodoTable::loadFile( const QString &/*we use the standard*/ ) { QList<ToDoEvent> list; ToDoDB todoDB; QValueList<ToDoEvent> vaList = todoDB.rawToDos(); for(QValueList<ToDoEvent>::ConstIterator it = vaList.begin(); it != vaList.end(); ++it ){ - list.append( new ToDoEvent( (*it) ) ); + ToDoEvent *event = new ToDoEvent( (*it) ); + list.append( event ); } vaList.clear(); // qDebug("parsing done=%d", t.elapsed() ); if ( list.count() > 0 ) { internalAddEntries( list ); list.clear(); } // qDebug("loading done: t=%d", t.elapsed() ); } void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) { QString strTodo; strTodo = todo.description().left(40).simplifyWhiteSpace(); if ( row == -1 ) { QMapIterator<CheckItem*, ToDoEvent *> it; for ( it = todoList.begin(); it != todoList.end(); ++it ) { if ( *(*it) == todo ) { row = it.key()->row(); it.key()->setChecked( todo.isCompleted() ); static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); item( row, 2 )->setText( strTodo ); if (showDeadl){ static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); } *(*it) = todo; } } } else { ToDoEvent *t = todoList[static_cast<CheckItem*>(item(row, 0))]; todoList.remove( static_cast<CheckItem*>(item(row, 0)) ); delete t; static_cast<CheckItem*>(item(row, 0))->setChecked( todo.isCompleted() ); static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); item( row, 2 )->setText( strTodo ); if (showDeadl){ static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); } - - todoList.insert( static_cast<CheckItem*>(item(row,0)), new ToDoEvent(todo) ); + ToDoEvent *ev = new ToDoEvent( todo ); + todoList.insert( static_cast<CheckItem*>(item(row,0)), new ToDoEvent(ev) ); } } void TodoTable::journalFreeRemoveEntry( int row ) { CheckItem *chk; chk = static_cast<CheckItem*>(item(row, 0 )); if ( !chk ) return; todoList.remove( chk ); realignTable( row ); } void TodoTable::keyPressEvent( QKeyEvent *e ) { if ( e->key() == Key_Space || e->key() == Key_Return ) { switch ( currentColumn() ) { case 0: { CheckItem *i = static_cast<CheckItem*>(item(currentRow(), currentColumn())); if ( i ) i->toggle(); break; |