summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-13 19:09:09 (UTC)
committer zecke <zecke>2002-10-13 19:09:09 (UTC)
commit0762b201f248b9eaf3a08601b04484bec9a6d9a1 (patch) (side-by-side diff)
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) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp52
-rw-r--r--core/pim/todo/mainwindow.h1
-rw-r--r--core/pim/todo/todo.pro2
3 files changed, 48 insertions, 7 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 @@
+#include <unistd.h>
+
#include <qmenubar.h>
@@ -36,2 +38,3 @@
+#include <qpe/applnk.h>
#include <qpe/config.h>
@@ -41,2 +44,3 @@
+#include <opie/otodoaccessvcal.h>
@@ -530,10 +534,46 @@ bool MainWindow::showOverDue()const {
}
-void MainWindow::setDocument( const QString& ) {
-
+void MainWindow::setDocument( const QString& fi) {
+ DocLnk doc(fi);
+ if (doc.isValid() )
+ receiveFile(doc.file() );
+ else
+ receiveFile(fi );
}
-void MainWindow::slotBeam() {
-
-}
-void MainWindow::beamDone( Ir* ) {
+static const char *beamfile = "/tmp/opie-todo.vcs";
+void MainWindow::slotBeam() {
+ ::unlink( beamfile );
+ OTodo todo = event( currentView()->current() );
+ OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
+ OTodoAccess acc( cal );
+ acc.load();
+ acc.add( todo );
+ acc.save();
+ Ir* ir = new Ir(this );
+ connect(ir, SIGNAL(done(Ir*) ),
+ this, SLOT(beamDone(Ir*) ) );
+ ir->send( beamfile, todo.summary(), "text/x-vCalendar" );
+
+}
+void MainWindow::beamDone( Ir* ir) {
+ delete ir;
+ ::unlink( beamfile );
+}
+void MainWindow::receiveFile( const QString& filename ) {
+ OTodoAccessVCal* cal = new OTodoAccessVCal(filename );
+ OTodoAccess acc( cal );
+ acc.load();
+ OTodoAccess::List list = acc.allRecords();
+
+ QString message = tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
+
+ if ( QMessageBox::information(this, tr("New Tasks"),
+ message, QMessageBox::Ok,
+ QMessageBox::Cancel ) == QMessageBox::Ok ) {
+ OTodoAccess::List::Iterator it;
+ for ( it = list.begin(); it != list.end(); ++it )
+ m_todoMgr.add( (*it) );
+
+ currentView()->updateView();
+ }
}
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:
private:
+ void receiveFile( const QString& filename );
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 @@
TEMPLATE = app
-CONFIG = qt warn_on debug
+CONFIG = qt warn_on release
DESTDIR = $(OPIEDIR)/bin