summaryrefslogtreecommitdiff
path: root/x11
Unidiff
Diffstat (limited to 'x11') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/ipc/client/ocopclient.cpp18
-rw-r--r--x11/ipc/client/ocopclient.h2
-rw-r--r--x11/libqpe-x11/libqpe-x11.pro25
-rw-r--r--x11/libqpe-x11/qt/qcopchannel_qws.cpp8
4 files changed, 35 insertions, 18 deletions
diff --git a/x11/ipc/client/ocopclient.cpp b/x11/ipc/client/ocopclient.cpp
index 1c25271..43e426c 100644
--- a/x11/ipc/client/ocopclient.cpp
+++ b/x11/ipc/client/ocopclient.cpp
@@ -1,129 +1,129 @@
1#include <errno.h> 1#include <errno.h>
2#include <stdlib.h> 2#include <stdlib.h>
3#include <stdio.h> 3#include <stdio.h>
4#include <unistd.h> 4#include <unistd.h>
5#include <sys/socket.h> 5#include <sys/socket.h>
6#include <sys/un.h> 6#include <sys/un.h>
7 7
8 8
9#include <qfile.h> 9#include <qfile.h>
10#include <qtimer.h> 10#include <qtimer.h>
11 11
12#include "../common/ocoppacket.h" 12#include "../common/ocoppacket.h"
13 13
14#include "ocopclient.h" 14#include "ocopclient.h"
15 15
16OCOPClient::OCOPClient( const QString& path, QObject* obj ) 16OCOPClient::OCOPClient( const QString& path, QObject* obj )
17 : QObject( obj ) 17 : QObject( obj )
18{ 18{
19 init(QFile::encodeName(path) ); 19 init(QFile::encodeName(path) );
20} 20}
21OCOPClient::~OCOPClient() { 21OCOPClient::~OCOPClient() {
22 close( m_socket ); 22 close( m_socket );
23} 23}
24void OCOPClient::init( const QCString& str ) { 24void OCOPClient::init( const QCString& ) {
25 struct sockaddr_un unix_adr; 25 struct sockaddr_un unix_adr;
26 if ( (m_socket = socket(PF_UNIX, SOCK_STREAM, 0) ) < 0 ) { 26 if ( (m_socket = socket(PF_UNIX, SOCK_STREAM, 0) ) < 0 ) {
27 qWarning("could not socket"); 27 qWarning("could not socket");
28 QTimer::singleShot(400, this,SLOT(init() ) ); 28 QTimer::singleShot(400, this,SLOT(init() ) );
29 return; 29 return;
30 } 30 }
31 memset(&unix_adr, 0, sizeof(unix_adr ) ); 31 memset(&unix_adr, 0, sizeof(unix_adr ) );
32 unix_adr.sun_family = AF_UNIX; 32 unix_adr.sun_family = AF_UNIX;
33 sprintf(unix_adr.sun_path,"%s/.opie.cop", getenv("HOME") ); 33 sprintf(unix_adr.sun_path,"%s/.opie.cop", getenv("HOME") );
34 int length = sizeof(unix_adr.sun_family) + strlen(unix_adr.sun_path); 34 int length = sizeof(unix_adr.sun_family) + strlen(unix_adr.sun_path);
35 35
36 if ( ::connect(m_socket, (struct sockaddr*)&unix_adr, length ) < 0 ) { 36 if ( ::connect(m_socket, (struct sockaddr*)&unix_adr, length ) < 0 ) {
37 qWarning("could not connect %d", errno ); 37 qWarning("could not connect %d", errno );
38 close( m_socket ); 38 close( m_socket );
39 QTimer::singleShot(400, this, SLOT(init() ) ); 39 QTimer::singleShot(400, this, SLOT(init() ) );
40 return; 40 return;
41 } 41 }
42 m_notify = new QSocketNotifier(m_socket, QSocketNotifier::Read, this ); 42 m_notify = new QSocketNotifier(m_socket, QSocketNotifier::Read, this );
43 connect( m_notify, SIGNAL(activated(int) ), 43 connect( m_notify, SIGNAL(activated(int) ),
44 this, SLOT(newData() ) ); 44 this, SLOT(newData() ) );
45} 45}
46/** 46/**
47 * new data 47 * new data
48 * read the header check magic number 48 * read the header check magic number
49 * and maybe read body 49 * and maybe read body
50 */ 50 */
51void OCOPClient::newData() { 51void OCOPClient::newData() {
52 OCOPPacket pack = packet(); 52 OCOPPacket pack = packet();
53 if ( pack.channel().isEmpty() ) 53 if ( pack.channel().isEmpty() )
54 return; 54 return;
55 55
56 switch( pack.type() ) { 56 switch( pack.type() ) {
57 case OCOPPacket::Register: 57 case OCOPPacket::Register:
58 case OCOPPacket::Unregister: 58 case OCOPPacket::Unregister:
59 case OCOPPacket::Method: 59 case OCOPPacket::Method:
60 case OCOPPacket::RegisterChannel: 60 case OCOPPacket::RegisterChannel:
61 case OCOPPacket::UnregisterChannel: 61 case OCOPPacket::UnregisterChannel:
62 case OCOPPacket::Return: 62 case OCOPPacket::Return:
63 case OCOPPacket::Signal: 63 case OCOPPacket::Signal:
64 /* is Registered should be handled sync */ 64 /* is Registered should be handled sync */
65 case OCOPPacket::isRegistered: 65 case OCOPPacket::IsRegistered:
66 break; 66 break;
67 /* emit the signal */ 67 /* emit the signal */
68 case OCOPPacket::Call: 68 case OCOPPacket::Call:
69 emit called( pack.channel(), pack.header(), pack.content() ); 69 emit called( pack.channel(), pack.header(), pack.content() );
70 break; 70 break;
71 } 71 }
72} 72}
73OCOPPacket OCOPClient::packet() { 73OCOPPacket OCOPClient::packet() const{
74 QCString chan; 74 QCString chan;
75 QCString func; 75 QCString func;
76 QByteArray ar; 76 QByteArray ar;
77 OCOPHead head; 77 OCOPHead head;
78 memset(&head, 0, sizeof(head) ); 78 memset(&head, 0, sizeof(head) );
79 read(m_socket, &head, sizeof(head) ); 79 read(m_socket, &head, sizeof(head) );
80 if ( head.magic == 47 ) { 80 if ( head.magic == 47 ) {
81 read(m_socket, chan.data(), head.chlen ); 81 read(m_socket, chan.data(), head.chlen );
82 read(m_socket, func.data(), head.funclen ); 82 read(m_socket, func.data(), head.funclen );
83 read(m_socket, ar.data(), head.datalen ); 83 read(m_socket, ar.data(), head.datalen );
84 } 84 }
85 OCOPPacket pack(head.type, chan, func, data ); 85 OCOPPacket pack(head.type, chan, func, ar );
86 return pack; 86 return pack;
87} 87}
88/* 88/*
89 * we've blocking IO here on these sockets 89 * we've blocking IO here on these sockets
90 * so we send and go on read 90 * so we send and go on read
91 * this will be blocked 91 * this will be blocked
92 */ 92 */
93bool OCOPClient::isRegistered( const QCString& chan ) { 93bool OCOPClient::isRegistered( const QCString& chan ) const{
94 /* should I disconnect the socket notfier? */ 94 /* should I disconnect the socket notfier? */
95 OCOPPacket packe(OCOPPacket::IsRegistered, chan ); 95 OCOPPacket packe(OCOPPacket::IsRegistered, chan );
96 OCOPHead head = packe.head(); 96 OCOPHead head = packe.head();
97 write(m_socket, &head, sizeof(head) ); 97 write(m_socket, &head, sizeof(head) );
98 98
99 /* block */ 99 /* block */
100 OCOPPacket pack = packet(); 100 OCOPPacket pack = packet();
101 101
102 /* connect here again */ 102 /* connect here again */
103 if ( pack.channel() == chan ) { 103 if ( pack.channel() == chan ) {
104 QCString func = pack.header(); 104 QCString func = pack.header();
105 if (func[0] == 1 ) 105 if (func[0] == 1 )
106 return; 106 return true;
107 } 107 }
108 108
109 return false; 109 return false;
110}; 110};
111void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) { 111void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) {
112 OCOPPacket pack(OCOPPacket::Call, chan, fu, arr ); 112 OCOPPacket pack(OCOPPacket::Call, chan, fu, arr );
113 call( pack ); 113 call( pack );
114} 114}
115void OCOPClient::addChannel(const QCString& channet) { 115void OCOPClient::addChannel(const QCString& channel) {
116 OCOPPacket pack(OCOPPacket::RegisterChannel, channel ); 116 OCOPPacket pack(OCOPPacket::RegisterChannel, channel );
117 call( pack ); 117 call( pack );
118} 118}
119void OCOPClient::delChannel(const QCString& chan ) { 119void OCOPClient::delChannel(const QCString& chan ) {
120 OCOPPacket pack(OCOPPacket::UnregisterChannel, channel ); 120 OCOPPacket pack(OCOPPacket::UnregisterChannel, chan );
121 call( pack ); 121 call( pack );
122} 122}
123void OCOPPacket::call( const OCOPPacket& pack ) { 123void OCOPClient::call( const OCOPPacket& pack ) {
124 OCOPHead head = pack.head(); 124 OCOPHead head = pack.head();
125 write(m_socket, &head, sizeof(head) ); 125 write(m_socket, &head, sizeof(head) );
126 write(m_socket, pack.channel().data(), pack.channel().size() ); 126 write(m_socket, pack.channel().data(), pack.channel().size() );
127 write(m_socket, pack.header().data(), pack.header().size() ); 127 write(m_socket, pack.header().data(), pack.header().size() );
128 write(m_socket, pack.content().data(), pack.content().size() ); 128 write(m_socket, pack.content().data(), pack.content().size() );
129} 129}
diff --git a/x11/ipc/client/ocopclient.h b/x11/ipc/client/ocopclient.h
index db04d37..e9544b9 100644
--- a/x11/ipc/client/ocopclient.h
+++ b/x11/ipc/client/ocopclient.h
@@ -1,59 +1,59 @@
1#ifndef OPIE_OCOP_CLIENT_H 1#ifndef OPIE_OCOP_CLIENT_H
2#define OPIE_OCOP_CLIENT_H 2#define OPIE_OCOP_CLIENT_H
3 3
4 4
5#include <qobject.h> 5#include <qobject.h>
6#include <qcstring.h> 6#include <qcstring.h>
7#include <qmap.h> 7#include <qmap.h>
8#include <qsignal.h> 8#include <qsignal.h>
9#include <qstring.h> 9#include <qstring.h>
10#include <qsocketnotifier.h> 10#include <qsocketnotifier.h>
11 11
12 12
13/** 13/**
14 * This is the OCOP client 14 * This is the OCOP client
15 * It currently only supports 15 * It currently only supports
16 * asking if a Channel is registered, 16 * asking if a Channel is registered,
17 * calling and receiving calls 17 * calling and receiving calls
18 */ 18 */
19class OCOPPacket; 19class OCOPPacket;
20class OCOPClient : public QObject{ 20class OCOPClient : public QObject{
21 Q_OBJECT 21 Q_OBJECT
22public: 22public:
23 23
24 /** 24 /**
25 * Occasionally I decide to start a Server from here 25 * Occasionally I decide to start a Server from here
26 */ 26 */
27 OCOPClient(const QString& pathToServer = QString::null, QObject* obj = 0l); 27 OCOPClient(const QString& pathToServer = QString::null, QObject* obj = 0l);
28 ~OCOPClient(); 28 ~OCOPClient();
29 29
30 bool isRegistered( const QCString& )const; 30 bool isRegistered( const QCString& )const;
31 void send( const QCString& chan, const QCString&, const QByteArray& msg ); 31 void send( const QCString& chan, const QCString&, const QByteArray& msg );
32 32
33 /** 33 /**
34 * add a channel and does connect to a signal 34 * add a channel and does connect to a signal
35 * callback is the object 35 * callback is the object
36 * slot is the SLOT() 36 * slot is the SLOT()
37 */ 37 */
38 void addChannel( const QCString& channel ); 38 void addChannel( const QCString& channel );
39 void delChannel( const QCString& channel ); 39 void delChannel( const QCString& channel );
40 40
41 /* make it singleton? */ 41 /* make it singleton? */
42 //static OCOPClient* self(); 42 //static OCOPClient* self();
43/* no direct signals due the design */ 43/* no direct signals due the design */
44signals: 44signals:
45 void called(const QCString&, const QCString&, const QByteArray& ); 45 void called(const QCString&, const QCString&, const QByteArray& );
46private slots: 46private slots:
47 void init(const QCString& pa); 47 void init(const QCString& pa);
48 void newData(); 48 void newData();
49private: 49private:
50 OCOPPacket packet(); 50 OCOPPacket packet()const;
51 void call( const OCOPPacket& ); 51 void call( const OCOPPacket& );
52 52
53 QSocketNotifier* m_notify; 53 QSocketNotifier* m_notify;
54 int m_socket; 54 int m_socket;
55private slots: 55private slots:
56 56
57}; 57};
58 58
59#endif 59#endif
diff --git a/x11/libqpe-x11/libqpe-x11.pro b/x11/libqpe-x11/libqpe-x11.pro
index 1d30f90..64c05fa 100644
--- a/x11/libqpe-x11/libqpe-x11.pro
+++ b/x11/libqpe-x11/libqpe-x11.pro
@@ -1,124 +1,141 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 HEADERS= ../../library/calendar.h \ 3 HEADERS= ../../library/calendar.h \
4 ../../library/global.h \ 4 ../../library/global.h \
5 ../../library/resource.h \ 5 ../../library/resource.h \
6 ../../library/xmlreader.h \ 6 ../../library/xmlreader.h \
7 ../../library/mimetype.h \ 7 ../../library/mimetype.h \
8 ../../library/menubutton.h \ 8 ../../library/menubutton.h \
9 ../../library/network.h \ 9 ../../library/network.h \
10 ../../library/networkinterface.h \ 10 ../../library/networkinterface.h \
11 ../../library/filemanager.h \ 11 ../../library/filemanager.h \
12 ../../library/qdawg.h \ 12 ../../library/qdawg.h \
13 ../../library/datebookmonth.h \ 13 ../../library/datebookmonth.h \
14 ../../library/fileselector.h \ 14 ../../library/fileselector.h \
15 ../../library/fileselector_p.h \ 15 ../../library/fileselector_p.h \
16 ../../library/imageedit.h \ 16 ../../library/imageedit.h \
17 ../../library/qcopenvelope_qws.h \ 17 ../../library/qcopenvelope_qws.h \
18 ../../library/qpestyle.h \ 18 ../../library/qpestyle.h \
19 ../../library/qpedialog.h \ 19 ../../library/qpedialog.h \
20 ../../library/lightstyle.h \ 20 ../../library/lightstyle.h \
21 ../../library/config.h \ 21 ../../library/config.h \
22 ../../library/applnk.h \ 22 ../../library/applnk.h \
23 ../../library/sound.h \ 23 ../../library/sound.h \
24 ../../library/tzselect.h \ 24 ../../library/tzselect.h \
25 ../../library/qmath.h \ 25 ../../library/qmath.h \
26 ../../library/datebookdb.h \ 26 ../../library/datebookdb.h \
27 ../../library/alarmserver.h \ 27 ../../library/alarmserver.h \
28 ../../library/process.h \ 28 ../../library/process.h \
29 ../../library/password.h \ 29 ../../library/password.h \
30 ../../library/timestring.h \ 30 ../../library/timestring.h \
31 ../../library/power.h \ 31 ../../library/power.h \
32 ../../library/storage.h \ 32 ../../library/storage.h \
33 ../../library/qpemessagebox.h \ 33 ../../library/qpemessagebox.h \
34 ../../library/timeconversion.h \ 34 ../../library/timeconversion.h \
35 ../../library/qpedebug.h \ 35 ../../library/qpedebug.h \
36 ../../library/qpemenubar.h \ 36 ../../library/qpemenubar.h \
37 ../../library/qpetoolbar.h \ 37 ../../library/qpetoolbar.h \
38 ../../library/backend/categories.h \ 38 ../../library/backend/categories.h \
39 ../../library/stringutil.h \ 39 ../../library/stringutil.h \
40 ../../library/backend/palmtoprecord.h \ 40 ../../library/backend/palmtoprecord.h \
41 ../../library/backend/task.h \ 41 ../../library/backend/task.h \
42 ../../library/backend/event.h \ 42 ../../library/backend/event.h \
43 ../../library/backend/contact.h\ 43 ../../library/backend/contact.h\
44 ../../library/categorymenu.h \ 44 ../../library/categorymenu.h \
45 ../../library/categoryedit_p.h \ 45 ../../library/categoryedit_p.h \
46 ../../library/categoryselect.h \ 46 ../../library/categoryselect.h \
47 ../../library/categorywidget.h \ 47 ../../library/categorywidget.h \
48 ../../library/ir.h \ 48 ../../library/ir.h \
49 ../../library/backend/vobject_p.h \ 49 ../../library/backend/vobject_p.h \
50 ../../library/findwidget_p.h \ 50 ../../library/findwidget_p.h \
51 ../../library/finddialog.h \ 51 ../../library/finddialog.h \
52 ../../library/lnkproperties.h \ 52 ../../library/lnkproperties.h \
53 ../../library/windowdecorationinterface.h \ 53 ../../library/windowdecorationinterface.h \
54 ../../library/textcodecinterface.h \ 54 ../../library/textcodecinterface.h \
55 ../../library/imagecodecinterface.h \ 55 ../../library/imagecodecinterface.h \
56 qt/qcopchannel_qws.h \
56 qpe/qpeapplication.h \ 57 qpe/qpeapplication.h \
57 qpe/fontmanager.h 58 qpe/fontmanager.h \
59 ../ipc/client/ocopclient.h \
60 ../ipc/common/ocoppacket.h
61
58 62
59 SOURCES= ../../library/calendar.cpp \ 63 SOURCES= ../../library/calendar.cpp \
60 ../../library/global.cpp \ 64 ../../library/global.cpp \
61 ../../library/xmlreader.cpp \ 65 ../../library/xmlreader.cpp \
62 ../../library/mimetype.cpp \ 66 ../../library/mimetype.cpp \
63 ../../library/menubutton.cpp \ 67 ../../library/menubutton.cpp \
64 ../../library/network.cpp \ 68 ../../library/network.cpp \
65 ../../library/networkinterface.cpp \ 69 ../../library/networkinterface.cpp \
66 ../../library/filemanager.cpp \ 70 ../../library/filemanager.cpp \
67 ../../library/qdawg.cpp \ 71 ../../library/qdawg.cpp \
68 ../../library/datebookmonth.cpp \ 72 ../../library/datebookmonth.cpp \
69 ../../library/fileselector.cpp \ 73 ../../library/fileselector.cpp \
70 ../../library/imageedit.cpp \ 74 ../../library/imageedit.cpp \
71 ../../library/resource.cpp \ 75 ../../library/resource.cpp \
72 ../../library/qcopenvelope_qws.cpp \ 76 ../../library/qcopenvelope_qws.cpp \
73 ../../library/qpestyle.cpp \ 77 ../../library/qpestyle.cpp \
74 ../../library/qpedialog.cpp \ 78 ../../library/qpedialog.cpp \
75 ../../library/lightstyle.cpp \ 79 ../../library/lightstyle.cpp \
76 ../../library/config.cpp \ 80 ../../library/config.cpp \
77 ../../library/applnk.cpp \ 81 ../../library/applnk.cpp \
78 ../../library/sound.cpp \ 82 ../../library/sound.cpp \
79 ../../library/tzselect.cpp \ 83 ../../library/tzselect.cpp \
80 ../../library/qmath.c \ 84 ../../library/qmath.c \
81 ../../library/datebookdb.cpp \ 85 ../../library/datebookdb.cpp \
82 ../../library/alarmserver.cpp \ 86 ../../library/alarmserver.cpp \
83 ../../library/password.cpp \ 87 ../../library/password.cpp \
84 ../../library/process.cpp \ 88 ../../library/process.cpp \
85 ../../library/process_unix.cpp \ 89 ../../library/process_unix.cpp \
86 ../../library/timestring.cpp \ 90 ../../library/timestring.cpp \
87 ../../library/power.cpp \ 91 ../../library/power.cpp \
88 ../../library/storage.cpp \ 92 ../../library/storage.cpp \
89 ../../library/qpemessagebox.cpp \ 93 ../../library/qpemessagebox.cpp \
90 ../../library/backend/timeconversion.cpp \ 94 ../../library/backend/timeconversion.cpp \
91 ../../library/qpedebug.cpp \ 95 ../../library/qpedebug.cpp \
92 ../../library/qpemenubar.cpp \ 96 ../../library/qpemenubar.cpp \
93 ../../library/qpetoolbar.cpp \ 97 ../../library/qpetoolbar.cpp \
94 ../../library/backend/categories.cpp \ 98 ../../library/backend/categories.cpp \
95 ../../library/backend/stringutil.cpp \ 99 ../../library/backend/stringutil.cpp \
96 ../../library/backend/palmtoprecord.cpp \ 100 ../../library/backend/palmtoprecord.cpp \
97 ../../library/backend/task.cpp \ 101 ../../library/backend/task.cpp \
98 ../../library/backend/event.cpp \ 102 ../../library/backend/event.cpp \
99 ../../library/backend/contact.cpp \ 103 ../../library/backend/contact.cpp \
100 ../../library/categorymenu.cpp \ 104 ../../library/categorymenu.cpp \
101 ../../library/categoryedit_p.cpp \ 105 ../../library/categoryedit_p.cpp \
102 ../../library/categoryselect.cpp \ 106 ../../library/categoryselect.cpp \
103 ../../library/categorywidget.cpp \ 107 ../../library/categorywidget.cpp \
104 ../../library/ir.cpp \ 108 ../../library/ir.cpp \
105 ../../library/backend/vcc_yacc.cpp \ 109 ../../library/backend/vcc_yacc.cpp \
106 ../../library/backend/vobject.cpp \ 110 ../../library/backend/vobject.cpp \
107 ../../library/findwidget_p.cpp \ 111 ../../library/findwidget_p.cpp \
108 ../../library/finddialog.cpp \ 112 ../../library/finddialog.cpp \
109 ../../library/lnkproperties.cpp 113 ../../library/lnkproperties.cpp \
114 qt/qcopchannel_qws.cpp \
115 qpe/qpeapplication.cpp \
116 ../ipc/client/ocopclient.cpp \
117 ../ipc/common/ocoppacket.cpp
110 118
111# Qt 3 compatibility 119# Qt 3 compatibility
112qt2:HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h 120HEADERS += ../../library/quuid.h \
113qt2:SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp 121 ../../library/qcom.h \
122 ../../library/qlibrary.h \
123 ../../library/qlibrary_p.h
124
125SOURCES += ../../library/quuid.cpp \
126 ../../library/qlibrary.cpp \
127 ../../library/qlibrary_unix.cpp
128
114INCLUDEPATH += $(OPIEDIR)/include backend 129INCLUDEPATH += $(OPIEDIR)/include backend
115 LIBS += -ldl -lcrypt -lm 130 LIBS += -ldl -lcrypt -lm
131
116INTERFACES = ../../library/passwordbase_p.ui \ 132INTERFACES = ../../library/passwordbase_p.ui \
117 ../../library/categoryeditbase_p.ui \ 133 ../../library/categoryeditbase_p.ui \
118 ../../library/findwidgetbase_p.ui \ 134 ../../library/findwidgetbase_p.ui \
119 ../../library/lnkpropertiesbase_p.ui 135 ../../library/lnkpropertiesbase_p.ui
136
120 TARGET = qpe-x11 137 TARGET = qpe-x11
121 DESTDIR = $(QTDIR)/lib$(PROJMAK) 138 DESTDIR = $(QTDIR)/lib$(PROJMAK)
122# This is set by configure$(OPIEDIR). 139# This is set by configure$(OPIEDIR).
123 VERSION = 1.5.0.1 140 VERSION = 1.5.0.1
124 141
diff --git a/x11/libqpe-x11/qt/qcopchannel_qws.cpp b/x11/libqpe-x11/qt/qcopchannel_qws.cpp
index efbef3f..c315d66 100644
--- a/x11/libqpe-x11/qt/qcopchannel_qws.cpp
+++ b/x11/libqpe-x11/qt/qcopchannel_qws.cpp
@@ -1,46 +1,46 @@
1 1
2#include "../ipc/client/ocopclient.h" 2#include "../../ipc/client/ocopclient.h"
3 3
4#include <qcopchannel_qws.h> 4#include <qcopchannel_qws.h>
5 5
6QCopChannel::QCopChannel( const QCString& channel, QObject* parent, 6QCopChannel::QCopChannel( const QCString& channel, QObject* parent,
7 const char* name ) 7 const char* name )
8 : QObject( parent, name ),m_chan(channel) { 8 : QObject( parent, name ),m_chan(channel) {
9 init(); 9 init();
10} 10}
11QCopChannel::~QCopChannel() { 11QCopChannel::~QCopChannel() {
12 m_client->delChannel( m_chan ); 12 m_client->delChannel( m_chan );
13 delete m_client; 13 delete m_client;
14} 14}
15void QCopChannel::init() { 15void QCopChannel::init() {
16 m_client = new OCOPClient(QString::null, this ); 16 m_client = new OCOPClient(QString::null, this );
17 m_client->addChannel(m_chan ); 17 m_client->addChannel(m_chan );
18 connect(m_client, SIGNAL(called(const QCString&, const QCString&, const QByteArray& ) ), 18 connect(m_client, SIGNAL(called(const QCString&, const QCString&, const QByteArray& ) ),
19 this, SLOT(rev(const QCString&, const QCString&, const QByteArray&) ) ); 19 this, SLOT(rev(const QCString&, const QCString&, const QByteArray&) ) );
20} 20}
21QCString QCopChannel::channel()const { 21QCString QCopChannel::channel()const {
22 return m_chan; 22 return m_chan;
23} 23}
24bool QCopChannel::isRegistered( const QCString& chan) { 24bool QCopChannel::isRegistered( const QCString& chan) {
25 OCOPClient client; 25 OCOPClient client;
26 return client.isRegistered( chan ); 26 return client.isRegistered( chan );
27} 27}
28bool QCopChannel::send( const QCString& chan, const QCString& msg ) { 28bool QCopChannel::send( const QCString& chan, const QCString& msg ) {
29 QByteArray ar(0); 29 QByteArray ar(0);
30 return return sendLocally(chan, msg, ar ); 30 return sendLocally(chan, msg, ar );
31} 31}
32bool QCString::send( const QCString& chan, const QCString& msg, 32bool QCopChannel::send( const QCString& chan, const QCString& msg,
33 const QByteArray& ar ) { 33 const QByteArray& ar ) {
34 return sendLocally( chan, msg, ar ); 34 return sendLocally( chan, msg, ar );
35} 35}
36bool QCopChannel::sendLocally( const QCString& chan, const QCString& msg, 36bool QCopChannel::sendLocally( const QCString& chan, const QCString& msg,
37 const QByteArray& ar ) { 37 const QByteArray& ar ) {
38 OCOPClient client; 38 OCOPClient client;
39 client.send( chan, msg, ar ); 39 client.send( chan, msg, ar );
40 40
41 return true; 41 return true;
42} 42}
43void QCopChannel::rev( const QCString& chan, const QCString& msg, const QByteArray& ar ) { 43void QCopChannel::rev( const QCString& chan, const QCString& msg, const QByteArray& ar ) {
44 if (chan == m_chan ) 44 if (chan == m_chan )
45 emit received(chan, msg, ar ); 45 emit received(msg, ar );
46} 46}