summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -17,37 +17,41 @@
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+#include <unistd.h>
+
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qtoolbar.h>
#include <qpopupmenu.h>
#include <qwidgetstack.h>
#include <qaction.h>
#include <qtimer.h>
+#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/ir.h>
#include <qpe/resource.h>
#include <qpe/qpemessagebox.h>
+#include <opie/otodoaccessvcal.h>
#include "todotemplatemanager.h"
#include "templateeditor.h"
#include "todoentryimpl.h"
#include "tableview.h"
#include "textviewshow.h"
#include "todoeditor.h"
#include "mainwindow.h"
using namespace Todo;
@@ -519,32 +523,68 @@ void MainWindow::setCategory( int c) {
}
void MainWindow::slotShowDeadLine( bool dead) {
m_deadline = dead;
currentView()->setShowDeadline( dead );
}
void MainWindow::slotShowCompleted( bool show) {
m_completed = show;
currentView()->setShowCompleted( m_completed );
}
bool MainWindow::showOverDue()const {
return m_overdue;
}
-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();
+ }
}
void MainWindow::slotFlush() {
m_syncing = FALSE;
m_todoMgr.save();
}
void MainWindow::slotShowDetails() {
slotShow( currentView()->current() );
}
/*
* populate the Categories
* Menu
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
@@ -87,24 +87,25 @@ namespace Todo {
void updateTodo( const OTodo& );
void populateTemplates();
Editor* currentEditor();
private slots:
void populateCategories();
void slotReload();
void slotFlush();
protected:
void closeEvent( QCloseEvent* e );
private:
+ void receiveFile( const QString& filename );
void connectBase( ViewBase* );
void initUI();
void initActions();
void initConfig();
void initViews();
void initEditor();
void initShow();
void initTemplate();
void raiseCurrentView();
ViewBase* currentView();
ViewBase* m_curView;
Editor* m_curEdit;
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,14 +1,14 @@
TEMPLATE = app
-CONFIG = qt warn_on debug
+CONFIG = qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = smalltodo.h \
todomanager.h \
mainwindow.h \
todoview.h \
todoentryimpl.h \
tableview.h \
tableitems.h \
todotemplatemanager.h \
todoeditor.h \
todoshow.h \