summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/ui
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/ui') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.cpp36
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.h26
2 files changed, 53 insertions, 9 deletions
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp
index 92be2fd..7e57f3a 100644
--- a/libopie2/opiepim/ui/opimmainwindow.cpp
+++ b/libopie2/opiepim/ui/opimmainwindow.cpp
@@ -5,2 +5,3 @@
+#include "opimresolver.h"
#include "opimmainwindow.h"
@@ -9,3 +10,3 @@ OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
const char* name, WFlags flag )
- : QMainWindow( parent, name, flag ), m_service( service ), m_fallBack(0l) {
+ : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
@@ -31,2 +32,5 @@ QCopChannel* OPimMainWindow::channel() {
}
+void OPimMainWindow::doSetDocument( const QString& ) {
+
+}
void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
@@ -71 +75,31 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array )
}
+/* implement the url scripting here */
+void OPimMainWindow::setDocument( const QString& str) {
+ doSetDocument( str );
+}
+/*
+ * we now try to get the array demarshalled
+ * check if the rtti matches this one
+ */
+OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) {
+ if ( service() != rtti )
+ return 0l;
+
+ OPimRecord* record = OPimResolver::self()->record( rtti );
+ QDataStream str(array, IO_ReadOnly );
+ if ( !record || !record->loadFromStream(str) ) {
+ delete record;
+ record = 0l;
+ }
+
+ return record;
+}
+/*
+ * get the rtti for the service
+ */
+int OPimMainWindow::service() {
+ if ( m_rtti == -1 )
+ m_rtti = OPimResolver::self()->serviceId( m_service );
+
+ return m_rtti;
+}
diff --git a/libopie2/opiepim/ui/opimmainwindow.h b/libopie2/opiepim/ui/opimmainwindow.h
index 94100bd..34b8a71 100644
--- a/libopie2/opiepim/ui/opimmainwindow.h
+++ b/libopie2/opiepim/ui/opimmainwindow.h
@@ -34,2 +34,7 @@ public:
protected slots:
+ /*
+ * called when a setDocument
+ * couldn't be handled by this window
+ */
+ virtual void doSetDocument( const QString& );
/* for syncing */
@@ -53,10 +58,3 @@ protected slots:
- /* I would love to do this as a template
- * but can't think of a right way
- * because I need signal and slots -zecke
- */
- /*
- * the only pointer in the whole PIM API :(
- */
- virtual OPimRecord* record( int rtti, const QByteArray& ) = 0;
+
QCopChannel* channel();
@@ -65,2 +63,3 @@ private slots:
void appMessage( const QCString&, const QByteArray& );
+ void setDocument( const QString& );
@@ -71,2 +70,3 @@ private:
+ int m_rtti;
QCopChannel* m_channel;
@@ -75,2 +75,12 @@ private:
OPimRecord* m_fallBack;
+
+ /* I would love to do this as a template
+ * but can't think of a right way
+ * because I need signal and slots -zecke
+ */
+ /*
+ * the only pointer in the whole PIM API :(
+ */
+ virtual OPimRecord* record( int rtti, const QByteArray& ) ;
+ int service();
};