summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/ui
authorzecke <zecke>2002-12-10 17:01:18 (UTC)
committer zecke <zecke>2002-12-10 17:01:18 (UTC)
commit4ecbf7407c19b59fc136c334f9386c53db453930 (patch) (side-by-side diff)
tree1cba438e2533f7109af169b0b77988cec6664192 /libopie2/opiepim/ui
parent36375df6ff103e52455823f7afd64c4f4ae7fcb8 (diff)
downloadopie-4ecbf7407c19b59fc136c334f9386c53db453930.zip
opie-4ecbf7407c19b59fc136c334f9386c53db453930.tar.gz
opie-4ecbf7407c19b59fc136c334f9386c53db453930.tar.bz2
get in sync with HEAD again
-OPimBase was added to be used as a default struct inside OPimResolver and to work with DSOs -TodoListXML backend now uses mmap and madvise to load data -OContact added/changed rtti -OTodo added changed rtti OPimAccess* added stuff necessary for the Resolver and a 'state'/'hint' on how to load data OPimResolver which resolves uid + services to Records, rtti to QCOPChannels loads arbitary Service backends ( will work with DSOs soon ) -OPimMainWindow added some setDocument scripting possibility and internal marshalling and demarshalling of Records -OPimRecord added loadDataFromm and saveDataTo for marshalling purposes much more :)
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 @@
#include <qpe/qcopenvelope_qws.h>
+#include "opimresolver.h"
#include "opimmainwindow.h"
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) {
/*
* let's generate our QCopChannel
@@ -29,6 +30,9 @@ OPimMainWindow::~OPimMainWindow() {
QCopChannel* OPimMainWindow::channel() {
return m_channel;
}
+void OPimMainWindow::doSetDocument( const QString& ) {
+
+}
void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
/*
* create demands to create
@@ -69,3 +73,33 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array )
delete m_fallBack;
}
}
+/* 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
@@ -32,6 +32,11 @@ public:
protected slots:
+ /*
+ * called when a setDocument
+ * couldn't be handled by this window
+ */
+ virtual void doSetDocument( const QString& );
/* for syncing */
virtual void flush() = 0;
virtual void reload() = 0;
@@ -51,28 +56,33 @@ protected slots:
/** make a copy of it! */
virtual void add( const OPimRecord& ) = 0;
- /* 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();
private slots:
void appMessage( const QCString&, const QByteArray& );
+ void setDocument( const QString& );
private:
class Private;
Private* d;
+ int m_rtti;
QCopChannel* m_channel;
QString m_service;
QCString m_str;
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();
};