Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 6709811..f3afa5f 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -24,6 +24,9 @@ | |||
24 | #include "todoentryimpl.h" | 24 | #include "todoentryimpl.h" |
25 | #include "todotable.h" | 25 | #include "todotable.h" |
26 | 26 | ||
27 | #include <opie/tododb.h> | ||
28 | #include <opie/todovcalresource.h> | ||
29 | |||
27 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
29 | #include <qpe/finddialog.h> | 32 | #include <qpe/finddialog.h> |
@@ -32,7 +35,7 @@ | |||
32 | #include <qpe/qpemenubar.h> | 35 | #include <qpe/qpemenubar.h> |
33 | #include <qpe/qpemessagebox.h> | 36 | #include <qpe/qpemessagebox.h> |
34 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
35 | #include <qpe/task.h> | 38 | //#include <qpe/task.h> |
36 | #include <qpe/qpetoolbar.h> | 39 | #include <qpe/qpetoolbar.h> |
37 | 40 | ||
38 | #include <qaction.h> | 41 | #include <qaction.h> |
@@ -215,17 +218,17 @@ void TodoWindow::slotNew() | |||
215 | id = ids[0]; | 218 | id = ids[0]; |
216 | NewTaskDialog e( id, this, 0, TRUE ); | 219 | NewTaskDialog e( id, this, 0, TRUE ); |
217 | 220 | ||
218 | Task todo; | 221 | ToDoEvent todo; |
219 | 222 | ||
220 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 223 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
221 | e.showMaximized(); | 224 | e.showMaximized(); |
222 | #endif | 225 | #endif |
223 | int ret = e.exec(); | 226 | int ret = e.exec(); |
224 | 227 | qWarning("finished" ); | |
225 | if ( ret == QDialog::Accepted ) { | 228 | if ( ret == QDialog::Accepted ) { |
226 | table->setPaintingEnabled( false ); | 229 | table->setPaintingEnabled( false ); |
227 | todo = e.todoEntry(); | 230 | todo = e.todoEntry(); |
228 | todo.assignUid(); | 231 | //todo.assignUid(); |
229 | table->addEntry( todo ); | 232 | table->addEntry( todo ); |
230 | table->setPaintingEnabled( true ); | 233 | table->setPaintingEnabled( true ); |
231 | findAction->setEnabled( TRUE ); | 234 | findAction->setEnabled( TRUE ); |
@@ -275,7 +278,7 @@ void TodoWindow::slotEdit() | |||
275 | return; | 278 | return; |
276 | } | 279 | } |
277 | 280 | ||
278 | Task todo = table->currentEntry(); | 281 | ToDoEvent todo = table->currentEntry(); |
279 | 282 | ||
280 | NewTaskDialog e( todo, this, 0, TRUE ); | 283 | NewTaskDialog e( todo, this, 0, TRUE ); |
281 | e.setCaption( tr( "Edit Task" ) ); | 284 | e.setCaption( tr( "Edit Task" ) ); |
@@ -349,8 +352,7 @@ void TodoWindow::populateCategories() | |||
349 | completedAction->addTo( catMenu ); | 352 | completedAction->addTo( catMenu ); |
350 | completedAction->setOn( table->showCompleted() ); | 353 | completedAction->setOn( table->showCompleted() ); |
351 | 354 | ||
352 | int id, | 355 | int id, rememberId; |
353 | rememberId; | ||
354 | id = 1; | 356 | id = 1; |
355 | catMenu->insertItem( tr( "All Categories" ), id++ ); | 357 | catMenu->insertItem( tr( "All Categories" ), id++ ); |
356 | // catMenu->insertSeparator(); | 358 | // catMenu->insertSeparator(); |
@@ -443,8 +445,9 @@ void TodoWindow::setDocument( const QString &filename ) | |||
443 | { | 445 | { |
444 | if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; | 446 | if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; |
445 | 447 | ||
446 | QValueList<Task> tl = Task::readVCalendar( filename ); | 448 | ToDoDB todoDB(filename, new ToDoVCalResource() ); |
447 | for( QValueList<Task>::Iterator it = tl.begin(); it != tl.end(); ++it ) { | 449 | QValueList<ToDoEvent> tl = todoDB.rawToDos(); |
450 | for( QValueList<ToDoEvent>::Iterator it = tl.begin(); it != tl.end(); ++it ) { | ||
448 | table->addEntry( *it ); | 451 | table->addEntry( *it ); |
449 | } | 452 | } |
450 | } | 453 | } |
@@ -454,9 +457,11 @@ static const char * beamfile = "/tmp/obex/todo.vcs"; | |||
454 | void TodoWindow::slotBeam() | 457 | void TodoWindow::slotBeam() |
455 | { | 458 | { |
456 | unlink( beamfile ); // delete if exists | 459 | unlink( beamfile ); // delete if exists |
457 | Task c = table->currentEntry(); | 460 | ToDoEvent c = table->currentEntry(); |
458 | mkdir("/tmp/obex/", 0755); | 461 | mkdir("/tmp/obex/", 0755); |
459 | Task::writeVCalendar( beamfile, c ); | 462 | ToDoDB todoDB( beamfile, new ToDoVCalResource() ); |
463 | todoDB.addEvent( c ); | ||
464 | todoDB.save(); | ||
460 | Ir *ir = new Ir( this ); | 465 | Ir *ir = new Ir( this ); |
461 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 466 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
462 | QString description = c.description(); | 467 | QString description = c.description(); |