-rw-r--r-- | core/pim/todo/TODO | 2 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/todoentryimpl.cpp | 6 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 48 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 5 |
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 @@ | |||
1 | -fix the journal | 1 | -fix the journal (wip ) |
2 | -fix day wrapping update all DueDateItems | 2 | -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() | |||
276 | int ret = e.exec(); | 276 | int ret = e.exec(); |
277 | qWarning("finished" ); | 277 | // qWarning("finished" ); |
278 | if ( ret == QDialog::Accepted ) { | 278 | 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, | |||
49 | { | 49 | { |
50 | qWarning("setting category" ); | ||
51 | todo.setCategories( task.allCategories() ); | 50 | todo.setCategories( task.allCategories() ); |
@@ -106,3 +105,2 @@ NewTaskDialog::~NewTaskDialog() | |||
106 | { | 105 | { |
107 | qWarning("d'tor" ); | ||
108 | // no need to delete child widgets, Qt does it all for us | 106 | // no need to delete child widgets, Qt does it all for us |
@@ -120,3 +118,2 @@ ToDoEvent NewTaskDialog::todoEntry() | |||
120 | { | 118 | { |
121 | qWarning("todoEntry()" ); | ||
122 | if( checkDate->isChecked() ){ | 119 | if( checkDate->isChecked() ){ |
@@ -127,3 +124,2 @@ ToDoEvent NewTaskDialog::todoEntry() | |||
127 | } | 124 | } |
128 | qWarning("todoEntry::category()" ); | ||
129 | if ( comboCategory->currentCategory() != -1 ) { | 125 | if ( comboCategory->currentCategory() != -1 ) { |
@@ -132,3 +128,2 @@ ToDoEvent NewTaskDialog::todoEntry() | |||
132 | list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ; | 128 | list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ; |
133 | qWarning("saving category"); | ||
134 | todo.setCategories( list ); | 129 | todo.setCategories( list ); |
@@ -150,3 +145,2 @@ void NewTaskDialog::accept() | |||
150 | { | 145 | { |
151 | qWarning("accept" ); | ||
152 | QString strText = txtTodo->text(); | 146 | 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 ) | |||
354 | int row = currentRow(); | 354 | int row = currentRow(); |
355 | updateJournal( todo, ACTION_REPLACE, row ); | 355 | updateJournal( todo, ACTION_REPLACE); |
356 | 356 | ||
@@ -377,3 +377,3 @@ void TodoTable::removeCurrentEntry() | |||
377 | updateVisible(); | 377 | updateVisible(); |
378 | updateJournal( *oldTodo, ACTION_REMOVE, row ); | 378 | updateJournal( *oldTodo, ACTION_REMOVE); |
379 | delete oldTodo; | 379 | delete oldTodo; |
@@ -413,7 +413,7 @@ void TodoTable::load( const QString &fn ) | |||
413 | { | 413 | { |
414 | loadFile( fn, false ); | 414 | if ( QFile::exists(journalFileName()) ) { |
415 | if ( QFile::exists(journalFileName()) ) { | 415 | applyJournal(); |
416 | applyJournal( ); | 416 | QFile::remove(journalFileName() ); |
417 | save( fn ); | 417 | } |
418 | } | 418 | loadFile( fn ); |
419 | // QTable::sortColumn(2,TRUE,TRUE); | 419 | // QTable::sortColumn(2,TRUE,TRUE); |
@@ -503,4 +503,4 @@ void TodoTable::clear() | |||
503 | it != todoList.end(); ++it ) { | 503 | it != todoList.end(); ++it ) { |
504 | ToDoEvent *todo = *it; | 504 | ToDoEvent *todo = it.data(); |
505 | updateJournal( todo, ACTION_REMOVE, 0 ); | 505 | updateJournal( *todo, ACTION_REMOVE ); |
506 | delete todo; | 506 | delete todo; |
@@ -539,3 +539,3 @@ void TodoTable::slotCheckPriority(int row, int col ) | |||
539 | 539 | ||
540 | void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action, int row ) | 540 | void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action ) |
541 | { | 541 | { |
@@ -579,3 +579,3 @@ void TodoTable::rowHeightChanged( int row ) | |||
579 | 579 | ||
580 | void TodoTable::loadFile( const QString &strFile, bool fromJournal ) | 580 | void TodoTable::loadFile( const QString &/*we use the standard*/ ) |
581 | { | 581 | { |
@@ -756,5 +756,23 @@ void TodoTable::applyJournal() | |||
756 | el = el->firstChild(); | 756 | el = el->firstChild(); |
757 | ToDoDB tododb; // allready loaded ;) | ||
758 | bool ok; | ||
759 | int action; | ||
760 | QString dummy; | ||
757 | while( el ){ | 761 | while( el ){ |
758 | qWarning("journal: %s %s", el->attribute("Uid" ).latin1(), el->tagName().latin1() ); | 762 | dummy = el->attribute("Action" ); |
759 | doApply( el ); | 763 | action = dummy.toInt(&ok ); |
764 | ToDoEvent ev = xmlToEvent( el ); | ||
765 | if(ok ){ | ||
766 | switch( action){ | ||
767 | case ACTION_ADD: | ||
768 | tododb.addEvent(ev ); | ||
769 | break; | ||
770 | case ACTION_REMOVE: | ||
771 | tododb.removeEvent( ev ); | ||
772 | break; | ||
773 | case ACTION_REPLACE: | ||
774 | tododb.replaceEvent( ev ); | ||
775 | break; | ||
776 | } | ||
777 | } | ||
760 | el = el->nextChild(); | 778 | el = el->nextChild(); |
@@ -762,2 +780,3 @@ void TodoTable::applyJournal() | |||
762 | QFile::remove(journalFileName()+ "_new" ); | 780 | QFile::remove(journalFileName()+ "_new" ); |
781 | tododb.save(); | ||
763 | } | 782 | } |
@@ -765,2 +784,3 @@ void TodoTable::applyJournal() | |||
765 | // check Action and decide | 784 | // check Action and decide |
785 | /* | ||
766 | void TodoTable::doApply(XMLElement *el ) | 786 | void TodoTable::doApply(XMLElement *el ) |
@@ -786,2 +806,3 @@ void TodoTable::doApply(XMLElement *el ) | |||
786 | } | 806 | } |
807 | */ | ||
787 | namespace { | 808 | namespace { |
@@ -865,3 +886,2 @@ static ToDoEvent xmlToEvent( XMLElement *element ) | |||
865 | if(ok ) event.setUid( dumInt ); | 886 | if(ok ) event.setUid( dumInt ); |
866 | |||
867 | return event; | 887 | 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: | |||
153 | inline void insertIntoTable( ToDoEvent *todo, int row ); | 153 | inline void insertIntoTable( ToDoEvent *todo, int row ); |
154 | void updateJournal( const ToDoEvent &todo, journal_action action, int row = -1); | 154 | void updateJournal( const ToDoEvent &todo, journal_action action); |
155 | void mergeJournal(); | 155 | void mergeJournal(); |
@@ -158,4 +158,3 @@ private: | |||
158 | inline void realignTable( int row ); | 158 | inline void realignTable( int row ); |
159 | void loadFile( const QString &strFile, bool fromJournal = false ); | 159 | void loadFile( const QString &strFile); |
160 | void doApply(XMLElement *el ); | ||
161 | 160 | ||