From 4ecbf7407c19b59fc136c334f9386c53db453930 Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 10 Dec 2002 17:01:18 +0000 Subject: 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 :) --- (limited to 'libopie/pim/opimmainwindow.cpp') diff --git a/libopie/pim/opimmainwindow.cpp b/libopie/pim/opimmainwindow.cpp index 92be2fd..7e57f3a 100644 --- a/libopie/pim/opimmainwindow.cpp +++ b/libopie/pim/opimmainwindow.cpp @@ -3,11 +3,12 @@ #include +#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; +} -- cgit v0.9.0.2