author | zecke <zecke> | 2002-10-13 19:09:09 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-13 19:09:09 (UTC) |
commit | 0762b201f248b9eaf3a08601b04484bec9a6d9a1 (patch) (unidiff) | |
tree | 5f386485a6b3b3e5c6edeeefdd26ef98ff924a34 /core/pim/todo | |
parent | 34c1199becdb2f9b0447553e66c85d8f6770558f (diff) | |
download | opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.zip opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.gz opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.bz2 |
Implement beaming and adding of todos. Use the vCal resource for that
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 48 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 1 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 2 |
3 files changed, 46 insertions, 5 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index c9c43d4..2994915 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -26,6 +26,8 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <unistd.h> | ||
30 | |||
29 | #include <qmenubar.h> | 31 | #include <qmenubar.h> |
30 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
31 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
@@ -34,11 +36,13 @@ | |||
34 | #include <qaction.h> | 36 | #include <qaction.h> |
35 | #include <qtimer.h> | 37 | #include <qtimer.h> |
36 | 38 | ||
39 | #include <qpe/applnk.h> | ||
37 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
38 | #include <qpe/ir.h> | 41 | #include <qpe/ir.h> |
39 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
40 | #include <qpe/qpemessagebox.h> | 43 | #include <qpe/qpemessagebox.h> |
41 | 44 | ||
45 | #include <opie/otodoaccessvcal.h> | ||
42 | 46 | ||
43 | #include "todotemplatemanager.h" | 47 | #include "todotemplatemanager.h" |
44 | #include "templateeditor.h" | 48 | #include "templateeditor.h" |
@@ -528,14 +532,50 @@ void MainWindow::slotShowCompleted( bool show) { | |||
528 | bool MainWindow::showOverDue()const { | 532 | bool MainWindow::showOverDue()const { |
529 | return m_overdue; | 533 | return m_overdue; |
530 | } | 534 | } |
531 | void MainWindow::setDocument( const QString& ) { | 535 | void MainWindow::setDocument( const QString& fi) { |
532 | 536 | DocLnk doc(fi); | |
537 | if (doc.isValid() ) | ||
538 | receiveFile(doc.file() ); | ||
539 | else | ||
540 | receiveFile(fi ); | ||
533 | } | 541 | } |
542 | |||
543 | static const char *beamfile = "/tmp/opie-todo.vcs"; | ||
534 | void MainWindow::slotBeam() { | 544 | void MainWindow::slotBeam() { |
545 | ::unlink( beamfile ); | ||
546 | OTodo todo = event( currentView()->current() ); | ||
547 | OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); | ||
548 | OTodoAccess acc( cal ); | ||
549 | acc.load(); | ||
550 | acc.add( todo ); | ||
551 | acc.save(); | ||
552 | Ir* ir = new Ir(this ); | ||
553 | connect(ir, SIGNAL(done(Ir*) ), | ||
554 | this, SLOT(beamDone(Ir*) ) ); | ||
555 | ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); | ||
556 | |||
557 | } | ||
558 | void MainWindow::beamDone( Ir* ir) { | ||
559 | delete ir; | ||
560 | ::unlink( beamfile ); | ||
561 | } | ||
562 | void MainWindow::receiveFile( const QString& filename ) { | ||
563 | OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); | ||
564 | OTodoAccess acc( cal ); | ||
565 | acc.load(); | ||
566 | OTodoAccess::List list = acc.allRecords(); | ||
567 | |||
568 | QString message = tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); | ||
569 | |||
570 | if ( QMessageBox::information(this, tr("New Tasks"), | ||
571 | message, QMessageBox::Ok, | ||
572 | QMessageBox::Cancel ) == QMessageBox::Ok ) { | ||
573 | OTodoAccess::List::Iterator it; | ||
574 | for ( it = list.begin(); it != list.end(); ++it ) | ||
575 | m_todoMgr.add( (*it) ); | ||
535 | 576 | ||
577 | currentView()->updateView(); | ||
536 | } | 578 | } |
537 | void MainWindow::beamDone( Ir* ) { | ||
538 | |||
539 | } | 579 | } |
540 | 580 | ||
541 | void MainWindow::slotFlush() { | 581 | void MainWindow::slotFlush() { |
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 598c3af..8d0c29f 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h | |||
@@ -96,6 +96,7 @@ private slots: | |||
96 | void closeEvent( QCloseEvent* e ); | 96 | void closeEvent( QCloseEvent* e ); |
97 | 97 | ||
98 | private: | 98 | private: |
99 | void receiveFile( const QString& filename ); | ||
99 | void connectBase( ViewBase* ); | 100 | void connectBase( ViewBase* ); |
100 | void initUI(); | 101 | void initUI(); |
101 | void initActions(); | 102 | void initActions(); |
diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 3ff78f5..f26acee 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro | |||
@@ -1,5 +1,5 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | 4 | ||
5 | HEADERS= smalltodo.h \ | 5 | HEADERS= smalltodo.h \ |