summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-13 19:09:09 (UTC)
committer zecke <zecke>2002-10-13 19:09:09 (UTC)
commit0762b201f248b9eaf3a08601b04484bec9a6d9a1 (patch) (unidiff)
tree5f386485a6b3b3e5c6edeeefdd26ef98ff924a34
parent34c1199becdb2f9b0447553e66c85d8f6770558f (diff)
downloadopie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.zip
opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.gz
opie-0762b201f248b9eaf3a08601b04484bec9a6d9a1.tar.bz2
Implement beaming and adding of todos. Use the vCal resource for that
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp48
-rw-r--r--core/pim/todo/mainwindow.h1
-rw-r--r--core/pim/todo/todo.pro2
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
@@ -28,2 +28,4 @@
28 28
29#include <unistd.h>
30
29#include <qmenubar.h> 31#include <qmenubar.h>
@@ -36,2 +38,3 @@
36 38
39#include <qpe/applnk.h>
37#include <qpe/config.h> 40#include <qpe/config.h>
@@ -41,2 +44,3 @@
41 44
45#include <opie/otodoaccessvcal.h>
42 46
@@ -530,10 +534,46 @@ bool MainWindow::showOverDue()const {
530} 534}
531void MainWindow::setDocument( const QString& ) { 535void 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
543static const char *beamfile = "/tmp/opie-todo.vcs";
534void MainWindow::slotBeam() { 544void 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}
558void MainWindow::beamDone( Ir* ir) {
559 delete ir;
560 ::unlink( beamfile );
561}
562void 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}
537void MainWindow::beamDone( Ir* ) {
538
539} 579}
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
@@ -98,2 +98,3 @@ private slots:
98 private: 98 private:
99 void receiveFile( const QString& filename );
99 void connectBase( ViewBase* ); 100 void connectBase( ViewBase* );
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,3 +1,3 @@
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