summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/ui
Unidiff
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
@@ -3,11 +3,12 @@
3 3
4#include <qpe/qcopenvelope_qws.h> 4#include <qpe/qcopenvelope_qws.h>
5 5
6#include "opimresolver.h"
6#include "opimmainwindow.h" 7#include "opimmainwindow.h"
7 8
8OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 9OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
9 const char* name, WFlags flag ) 10 const char* name, WFlags flag )
10 : QMainWindow( parent, name, flag ), m_service( service ), m_fallBack(0l) { 11 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
11 12
12 /* 13 /*
13 * let's generate our QCopChannel 14 * let's generate our QCopChannel
@@ -29,6 +30,9 @@ OPimMainWindow::~OPimMainWindow() {
29QCopChannel* OPimMainWindow::channel() { 30QCopChannel* OPimMainWindow::channel() {
30 return m_channel; 31 return m_channel;
31} 32}
33void OPimMainWindow::doSetDocument( const QString& ) {
34
35}
32void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { 36void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
33 /* 37 /*
34 * create demands to create 38 * create demands to create
@@ -69,3 +73,33 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array )
69 delete m_fallBack; 73 delete m_fallBack;
70 } 74 }
71} 75}
76/* implement the url scripting here */
77void OPimMainWindow::setDocument( const QString& str) {
78 doSetDocument( str );
79}
80/*
81 * we now try to get the array demarshalled
82 * check if the rtti matches this one
83 */
84OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) {
85 if ( service() != rtti )
86 return 0l;
87
88 OPimRecord* record = OPimResolver::self()->record( rtti );
89 QDataStream str(array, IO_ReadOnly );
90 if ( !record || !record->loadFromStream(str) ) {
91 delete record;
92 record = 0l;
93 }
94
95 return record;
96}
97/*
98 * get the rtti for the service
99 */
100int OPimMainWindow::service() {
101 if ( m_rtti == -1 )
102 m_rtti = OPimResolver::self()->serviceId( m_service );
103
104 return m_rtti;
105}
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
@@ -32,6 +32,11 @@ public:
32 32
33 33
34protected slots: 34protected slots:
35 /*
36 * called when a setDocument
37 * couldn't be handled by this window
38 */
39 virtual void doSetDocument( const QString& );
35 /* for syncing */ 40 /* for syncing */
36 virtual void flush() = 0; 41 virtual void flush() = 0;
37 virtual void reload() = 0; 42 virtual void reload() = 0;
@@ -51,28 +56,33 @@ protected slots:
51 /** make a copy of it! */ 56 /** make a copy of it! */
52 virtual void add( const OPimRecord& ) = 0; 57 virtual void add( const OPimRecord& ) = 0;
53 58
54 /* I would love to do this as a template 59
55 * but can't think of a right way
56 * because I need signal and slots -zecke
57 */
58 /*
59 * the only pointer in the whole PIM API :(
60 */
61 virtual OPimRecord* record( int rtti, const QByteArray& ) = 0;
62 QCopChannel* channel(); 60 QCopChannel* channel();
63 61
64private slots: 62private slots:
65 void appMessage( const QCString&, const QByteArray& ); 63 void appMessage( const QCString&, const QByteArray& );
64 void setDocument( const QString& );
66 65
67 66
68private: 67private:
69 class Private; 68 class Private;
70 Private* d; 69 Private* d;
71 70
71 int m_rtti;
72 QCopChannel* m_channel; 72 QCopChannel* m_channel;
73 QString m_service; 73 QString m_service;
74 QCString m_str; 74 QCString m_str;
75 OPimRecord* m_fallBack; 75 OPimRecord* m_fallBack;
76
77 /* I would love to do this as a template
78 * but can't think of a right way
79 * because I need signal and slots -zecke
80 */
81 /*
82 * the only pointer in the whole PIM API :(
83 */
84 virtual OPimRecord* record( int rtti, const QByteArray& ) ;
85 int service();
76}; 86};
77 87
78 88