summaryrefslogtreecommitdiff
path: root/libopie
Unidiff
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/opimmainwindow.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libopie/pim/opimmainwindow.cpp b/libopie/pim/opimmainwindow.cpp
index 7e57f3a..d1eec19 100644
--- a/libopie/pim/opimmainwindow.cpp
+++ b/libopie/pim/opimmainwindow.cpp
@@ -1,105 +1,104 @@
1#include <qapplication.h> 1#include <qapplication.h>
2#include <qcopchannel_qws.h> 2#include <qcopchannel_qws.h>
3 3
4#include <qpe/qcopenvelope_qws.h> 4#include <qpe/qcopenvelope_qws.h>
5 5
6#include "opimresolver.h" 6#include "opimresolver.h"
7#include "opimmainwindow.h" 7#include "opimmainwindow.h"
8 8
9OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, 9OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent,
10 const char* name, WFlags flag ) 10 const char* name, WFlags flag )
11 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { 11 : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) {
12 12
13 /* 13 /*
14 * let's generate our QCopChannel 14 * let's generate our QCopChannel
15 */ 15 */
16 m_str = QString("QPE/"+m_service).local8Bit(); 16 m_str = QString("QPE/"+m_service).local8Bit();
17 m_channel= new QCopChannel(m_str, this ); 17 m_channel= new QCopChannel(m_str, this );
18 connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), 18 connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ),
19 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 19 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
20 20
21 /* connect flush and reload */ 21 /* connect flush and reload */
22 connect(qApp, SIGNAL(flush() ), 22 connect(qApp, SIGNAL(flush() ),
23 this, SLOT(flush() ) ); 23 this, SLOT(flush() ) );
24 connect(qApp, SIGNAL(reload() ), 24 connect(qApp, SIGNAL(reload() ),
25 this, SLOT(reload() ) ); 25 this, SLOT(reload() ) );
26} 26}
27OPimMainWindow::~OPimMainWindow() { 27OPimMainWindow::~OPimMainWindow() {
28 delete m_channel; 28 delete m_channel;
29} 29}
30QCopChannel* OPimMainWindow::channel() { 30QCopChannel* OPimMainWindow::channel() {
31 return m_channel; 31 return m_channel;
32} 32}
33void OPimMainWindow::doSetDocument( const QString& ) { 33void OPimMainWindow::doSetDocument( const QString& ) {
34 34
35} 35}
36void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { 36void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
37 /* 37 /*
38 * create demands to create 38 * create demands to create
39 * a new record... 39 * a new record...
40 */ 40 */
41 QDataStream stream(array, IO_ReadOnly); 41 QDataStream stream(array, IO_ReadOnly);
42 if ( cmd == "create()" ) { 42 if ( cmd == "create()" ) {
43 int uid = create(); 43 int uid = create();
44 QCopEnvelope e(m_str, "created(int)" ); 44 QCopEnvelope e(m_str, "created(int)" );
45 e << uid; 45 e << uid;
46 }else if ( cmd == "remove(int)" ) { 46 }else if ( cmd == "remove(int)" ) {
47 int uid; 47 int uid;
48 stream >> uid; 48 stream >> uid;
49 bool rem = remove( uid ); 49 bool rem = remove( uid );
50 QCopEnvelope e(m_str, "removed(bool)" ); 50 QCopEnvelope e(m_str, "removed(bool)" );
51 e << rem; 51 e << rem;
52 }else if ( cmd == "beam(int,int)" ) { 52 }else if ( cmd == "beam(int)" ) {
53 int uid, trans; 53 int uid, trans;
54 stream >> uid; 54 stream >> uid;
55 stream >> trans; 55 beam( uid);
56 beam( uid, trans );
57 }else if ( cmd == "show(int)" ) { 56 }else if ( cmd == "show(int)" ) {
58 int uid; 57 int uid;
59 stream >> uid; 58 stream >> uid;
60 show( uid ); 59 show( uid );
61 }else if ( cmd == "edit(int)" ) { 60 }else if ( cmd == "edit(int)" ) {
62 int uid; 61 int uid;
63 stream >> uid; 62 stream >> uid;
64 edit( uid ); 63 edit( uid );
65 }else if ( cmd == "add(int,QByteArray)" ) { 64 }else if ( cmd == "add(int,QByteArray)" ) {
66 int rtti; 65 int rtti;
67 QByteArray array; 66 QByteArray array;
68 stream >> rtti; 67 stream >> rtti;
69 stream >> array; 68 stream >> array;
70 m_fallBack = record(rtti, array ); 69 m_fallBack = record(rtti, array );
71 if (!m_fallBack) return; 70 if (!m_fallBack) return;
72 add( *m_fallBack ); 71 add( *m_fallBack );
73 delete m_fallBack; 72 delete m_fallBack;
74 } 73 }
75} 74}
76/* implement the url scripting here */ 75/* implement the url scripting here */
77void OPimMainWindow::setDocument( const QString& str) { 76void OPimMainWindow::setDocument( const QString& str) {
78 doSetDocument( str ); 77 doSetDocument( str );
79} 78}
80/* 79/*
81 * we now try to get the array demarshalled 80 * we now try to get the array demarshalled
82 * check if the rtti matches this one 81 * check if the rtti matches this one
83 */ 82 */
84OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) { 83OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) {
85 if ( service() != rtti ) 84 if ( service() != rtti )
86 return 0l; 85 return 0l;
87 86
88 OPimRecord* record = OPimResolver::self()->record( rtti ); 87 OPimRecord* record = OPimResolver::self()->record( rtti );
89 QDataStream str(array, IO_ReadOnly ); 88 QDataStream str(array, IO_ReadOnly );
90 if ( !record || !record->loadFromStream(str) ) { 89 if ( !record || !record->loadFromStream(str) ) {
91 delete record; 90 delete record;
92 record = 0l; 91 record = 0l;
93 } 92 }
94 93
95 return record; 94 return record;
96} 95}
97/* 96/*
98 * get the rtti for the service 97 * get the rtti for the service
99 */ 98 */
100int OPimMainWindow::service() { 99int OPimMainWindow::service() {
101 if ( m_rtti == -1 ) 100 if ( m_rtti == -1 )
102 m_rtti = OPimResolver::self()->serviceId( m_service ); 101 m_rtti = OPimResolver::self()->serviceId( m_service );
103 102
104 return m_rtti; 103 return m_rtti;
105} 104}