summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-15 20:55:49 (UTC)
committer zecke <zecke>2002-04-15 20:55:49 (UTC)
commit943f0de13f6b017e67d0289c7273ddbf496a2cff (patch) (side-by-side diff)
treeed28fa2c3632ce672b31edff10ecf08356d35f64
parente010d922ac415558e5efd35e69e39e45908b5501 (diff)
downloadopie-943f0de13f6b017e67d0289c7273ddbf496a2cff.zip
opie-943f0de13f6b017e67d0289c7273ddbf496a2cff.tar.gz
opie-943f0de13f6b017e67d0289c7273ddbf496a2cff.tar.bz2
journal is in place again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/TODO2
-rw-r--r--core/pim/todo/mainwindow.cpp2
-rw-r--r--core/pim/todo/todoentryimpl.cpp6
-rw-r--r--core/pim/todo/todotable.cpp48
-rw-r--r--core/pim/todo/todotable.h5
5 files changed, 38 insertions, 25 deletions
diff --git a/core/pim/todo/TODO b/core/pim/todo/TODO
index 040f163..7601dd2 100644
--- a/core/pim/todo/TODO
+++ b/core/pim/todo/TODO
@@ -1,2 +1,2 @@
--fix the journal
+-fix the journal (wip )
-fix day wrapping update all DueDateItems
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 883d78c..fc17c5f 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -276,3 +276,3 @@ void TodoWindow::slotNew()
int ret = e.exec();
- qWarning("finished" );
+// qWarning("finished" );
if ( ret == QDialog::Accepted ) {
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp
index f938d61..26a685c 100644
--- a/core/pim/todo/todoentryimpl.cpp
+++ b/core/pim/todo/todoentryimpl.cpp
@@ -49,3 +49,2 @@ NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent,
{
- qWarning("setting category" );
todo.setCategories( task.allCategories() );
@@ -106,3 +105,2 @@ NewTaskDialog::~NewTaskDialog()
{
- qWarning("d'tor" );
// no need to delete child widgets, Qt does it all for us
@@ -120,3 +118,2 @@ ToDoEvent NewTaskDialog::todoEntry()
{
- qWarning("todoEntry()" );
if( checkDate->isChecked() ){
@@ -127,3 +124,2 @@ ToDoEvent NewTaskDialog::todoEntry()
}
- qWarning("todoEntry::category()" );
if ( comboCategory->currentCategory() != -1 ) {
@@ -132,3 +128,2 @@ ToDoEvent NewTaskDialog::todoEntry()
list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ;
- qWarning("saving category");
todo.setCategories( list );
@@ -150,3 +145,2 @@ void NewTaskDialog::accept()
{
- qWarning("accept" );
QString strText = txtTodo->text();
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp
index 401d2c8..96cd860 100644
--- a/core/pim/todo/todotable.cpp
+++ b/core/pim/todo/todotable.cpp
@@ -354,3 +354,3 @@ void TodoTable::replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem )
int row = currentRow();
- updateJournal( todo, ACTION_REPLACE, row );
+ updateJournal( todo, ACTION_REPLACE);
@@ -377,3 +377,3 @@ void TodoTable::removeCurrentEntry()
updateVisible();
- updateJournal( *oldTodo, ACTION_REMOVE, row );
+ updateJournal( *oldTodo, ACTION_REMOVE);
delete oldTodo;
@@ -413,7 +413,7 @@ void TodoTable::load( const QString &fn )
{
- loadFile( fn, false );
- if ( QFile::exists(journalFileName()) ) {
- applyJournal( );
- save( fn );
- }
+ if ( QFile::exists(journalFileName()) ) {
+ applyJournal();
+ QFile::remove(journalFileName() );
+ }
+ loadFile( fn );
// QTable::sortColumn(2,TRUE,TRUE);
@@ -503,4 +503,4 @@ void TodoTable::clear()
it != todoList.end(); ++it ) {
- ToDoEvent *todo = *it;
- updateJournal( todo, ACTION_REMOVE, 0 );
+ ToDoEvent *todo = it.data();
+ updateJournal( *todo, ACTION_REMOVE );
delete todo;
@@ -539,3 +539,3 @@ void TodoTable::slotCheckPriority(int row, int col )
-void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action, int row )
+void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action )
{
@@ -579,3 +579,3 @@ void TodoTable::rowHeightChanged( int row )
-void TodoTable::loadFile( const QString &strFile, bool fromJournal )
+void TodoTable::loadFile( const QString &/*we use the standard*/ )
{
@@ -756,5 +756,23 @@ void TodoTable::applyJournal()
el = el->firstChild();
+ ToDoDB tododb; // allready loaded ;)
+ bool ok;
+ int action;
+ QString dummy;
while( el ){
- qWarning("journal: %s %s", el->attribute("Uid" ).latin1(), el->tagName().latin1() );
- doApply( el );
+ dummy = el->attribute("Action" );
+ action = dummy.toInt(&ok );
+ ToDoEvent ev = xmlToEvent( el );
+ if(ok ){
+ switch( action){
+ case ACTION_ADD:
+ tododb.addEvent(ev );
+ break;
+ case ACTION_REMOVE:
+ tododb.removeEvent( ev );
+ break;
+ case ACTION_REPLACE:
+ tododb.replaceEvent( ev );
+ break;
+ }
+ }
el = el->nextChild();
@@ -762,2 +780,3 @@ void TodoTable::applyJournal()
QFile::remove(journalFileName()+ "_new" );
+ tododb.save();
}
@@ -765,2 +784,3 @@ void TodoTable::applyJournal()
// check Action and decide
+/*
void TodoTable::doApply(XMLElement *el )
@@ -786,2 +806,3 @@ void TodoTable::doApply(XMLElement *el )
}
+*/
namespace {
@@ -865,3 +886,2 @@ static ToDoEvent xmlToEvent( XMLElement *element )
if(ok ) event.setUid( dumInt );
-
return event;
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
index 6917e04..6e371e8 100644
--- a/core/pim/todo/todotable.h
+++ b/core/pim/todo/todotable.h
@@ -153,3 +153,3 @@ private:
inline void insertIntoTable( ToDoEvent *todo, int row );
- void updateJournal( const ToDoEvent &todo, journal_action action, int row = -1);
+ void updateJournal( const ToDoEvent &todo, journal_action action);
void mergeJournal();
@@ -158,4 +158,3 @@ private:
inline void realignTable( int row );
- void loadFile( const QString &strFile, bool fromJournal = false );
- void doApply(XMLElement *el );
+ void loadFile( const QString &strFile);