author | zecke <zecke> | 2002-10-16 18:24:48 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-16 18:24:48 (UTC) |
commit | 9047650faad7e64e0a36553dfe04dc7ad084f095 (patch) (unidiff) | |
tree | b79a65f224b329d6dcc559d8b72d564ccce4a3c8 /x11/libqpe-x11/qt/qcopchannel_qws.cpp | |
parent | 1a305f211913ce4a4d73ed0b36a0be535c0e03ec (diff) | |
download | opie-9047650faad7e64e0a36553dfe04dc7ad084f095.zip opie-9047650faad7e64e0a36553dfe04dc7ad084f095.tar.gz opie-9047650faad7e64e0a36553dfe04dc7ad084f095.tar.bz2 |
More IPC integtration
OCOPClient::self() added so we keep
the connections low
Diffstat (limited to 'x11/libqpe-x11/qt/qcopchannel_qws.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | x11/libqpe-x11/qt/qcopchannel_qws.cpp | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/x11/libqpe-x11/qt/qcopchannel_qws.cpp b/x11/libqpe-x11/qt/qcopchannel_qws.cpp index c315d66..e90f056 100644 --- a/x11/libqpe-x11/qt/qcopchannel_qws.cpp +++ b/x11/libqpe-x11/qt/qcopchannel_qws.cpp | |||
@@ -4,17 +4,29 @@ | |||
4 | #include <qcopchannel_qws.h> | 4 | #include <qcopchannel_qws.h> |
5 | 5 | ||
6 | QList<QCopChannel>* QCopChannel::m_list = 0; | ||
7 | |||
6 | QCopChannel::QCopChannel( const QCString& channel, QObject* parent, | 8 | QCopChannel::QCopChannel( const QCString& channel, QObject* parent, |
7 | const char* name ) | 9 | const char* name ) |
8 | : QObject( parent, name ),m_chan(channel) { | 10 | : QObject( parent, name ),m_chan(channel) { |
9 | init(); | 11 | init(); |
12 | if (!m_list ) { | ||
13 | m_list = new QList<QCopChannel>; | ||
14 | } | ||
15 | m_list->append(this); | ||
16 | } | ||
17 | void QCopChannel::receive( const QCString& msg, const QByteArray& ar ) { | ||
18 | emit received( msg, ar ); | ||
10 | } | 19 | } |
11 | QCopChannel::~QCopChannel() { | 20 | QCopChannel::~QCopChannel() { |
12 | m_client->delChannel( m_chan ); | 21 | m_list->remove(this); |
13 | delete m_client; | 22 | if (m_list->count() == 0 ) { |
23 | delete m_list; | ||
24 | m_list = 0; | ||
25 | } | ||
26 | OCOPClient::self()->delChannel( m_chan ); | ||
14 | } | 27 | } |
15 | void QCopChannel::init() { | 28 | void QCopChannel::init() { |
16 | m_client = new OCOPClient(QString::null, this ); | 29 | OCOPClient::self()->addChannel( m_chan ); |
17 | m_client->addChannel(m_chan ); | 30 | connect(OCOPClient::self(), 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&) ) ); | 31 | this, SLOT(rev(const QCString&, const QCString&, const QByteArray&) ) ); |
20 | } | 32 | } |
@@ -22,20 +34,25 @@ QCString QCopChannel::channel()const { | |||
22 | return m_chan; | 34 | return m_chan; |
23 | } | 35 | } |
24 | bool QCopChannel::isRegistered( const QCString& chan) { | 36 | bool QCopChannel::isRegistered( const QCString& chan) {; |
25 | OCOPClient client; | 37 | return OCOPClient::self()->isRegistered( chan ); |
26 | return client.isRegistered( chan ); | ||
27 | } | 38 | } |
28 | bool QCopChannel::send( const QCString& chan, const QCString& msg ) { | 39 | bool QCopChannel::send( const QCString& chan, const QCString& msg ) { |
29 | QByteArray ar(0); | 40 | QByteArray ar; |
30 | return sendLocally(chan, msg, ar ); | 41 | return send(chan, msg, ar ); |
31 | } | 42 | } |
32 | bool QCopChannel::send( const QCString& chan, const QCString& msg, | 43 | bool QCopChannel::send( const QCString& chan, const QCString& msg, |
33 | const QByteArray& ar ) { | 44 | const QByteArray& ar ) { |
34 | return sendLocally( chan, msg, ar ); | 45 | OCOPClient::self()->send( chan, msg, ar ); |
46 | return true; | ||
35 | } | 47 | } |
36 | bool QCopChannel::sendLocally( const QCString& chan, const QCString& msg, | 48 | bool QCopChannel::sendLocally( const QCString& chann, const QCString& msg, |
37 | const QByteArray& ar ) { | 49 | const QByteArray& ar ) { |
38 | OCOPClient client; | 50 | if (!m_list ) |
39 | client.send( chan, msg, ar ); | 51 | return true; |
52 | QCopChannel* chan; | ||
53 | for ( chan = m_list->first(); chan; chan = m_list->next() ) { | ||
54 | if ( chan->channel() == chann ) | ||
55 | chan->receive( msg, ar ); | ||
56 | } | ||
40 | 57 | ||
41 | return true; | 58 | return true; |