summaryrefslogtreecommitdiff
path: root/x11
authorzecke <zecke>2002-10-16 01:05:42 (UTC)
committer zecke <zecke>2002-10-16 01:05:42 (UTC)
commit3e973543b77631d053a9616b5540966dbe51ab47 (patch) (side-by-side diff)
tree8b47c7015ec9706b2dc794ce0cf382d50f47b680 /x11
parent65ef0e86a879332cbf8b1575886d3c36c7d2d9bd (diff)
downloadopie-3e973543b77631d053a9616b5540966dbe51ab47.zip
opie-3e973543b77631d053a9616b5540966dbe51ab47.tar.gz
opie-3e973543b77631d053a9616b5540966dbe51ab47.tar.bz2
Make it link
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 @@
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <qfile.h>
#include <qtimer.h>
#include "../common/ocoppacket.h"
#include "ocopclient.h"
OCOPClient::OCOPClient( const QString& path, QObject* obj )
: QObject( obj )
{
init(QFile::encodeName(path) );
}
OCOPClient::~OCOPClient() {
close( m_socket );
}
-void OCOPClient::init( const QCString& str ) {
+void OCOPClient::init( const QCString& ) {
struct sockaddr_un unix_adr;
if ( (m_socket = socket(PF_UNIX, SOCK_STREAM, 0) ) < 0 ) {
qWarning("could not socket");
QTimer::singleShot(400, this,SLOT(init() ) );
return;
}
memset(&unix_adr, 0, sizeof(unix_adr ) );
unix_adr.sun_family = AF_UNIX;
sprintf(unix_adr.sun_path,"%s/.opie.cop", getenv("HOME") );
int length = sizeof(unix_adr.sun_family) + strlen(unix_adr.sun_path);
if ( ::connect(m_socket, (struct sockaddr*)&unix_adr, length ) < 0 ) {
qWarning("could not connect %d", errno );
close( m_socket );
QTimer::singleShot(400, this, SLOT(init() ) );
return;
}
m_notify = new QSocketNotifier(m_socket, QSocketNotifier::Read, this );
connect( m_notify, SIGNAL(activated(int) ),
this, SLOT(newData() ) );
}
/**
* new data
* read the header check magic number
* and maybe read body
*/
void OCOPClient::newData() {
OCOPPacket pack = packet();
if ( pack.channel().isEmpty() )
return;
switch( pack.type() ) {
case OCOPPacket::Register:
case OCOPPacket::Unregister:
case OCOPPacket::Method:
case OCOPPacket::RegisterChannel:
case OCOPPacket::UnregisterChannel:
case OCOPPacket::Return:
case OCOPPacket::Signal:
/* is Registered should be handled sync */
- case OCOPPacket::isRegistered:
+ case OCOPPacket::IsRegistered:
break;
/* emit the signal */
case OCOPPacket::Call:
emit called( pack.channel(), pack.header(), pack.content() );
break;
}
}
-OCOPPacket OCOPClient::packet() {
+OCOPPacket OCOPClient::packet() const{
QCString chan;
QCString func;
QByteArray ar;
OCOPHead head;
memset(&head, 0, sizeof(head) );
read(m_socket, &head, sizeof(head) );
if ( head.magic == 47 ) {
read(m_socket, chan.data(), head.chlen );
read(m_socket, func.data(), head.funclen );
read(m_socket, ar.data(), head.datalen );
}
- OCOPPacket pack(head.type, chan, func, data );
+ OCOPPacket pack(head.type, chan, func, ar );
return pack;
}
/*
* we've blocking IO here on these sockets
* so we send and go on read
* this will be blocked
*/
-bool OCOPClient::isRegistered( const QCString& chan ) {
+bool OCOPClient::isRegistered( const QCString& chan ) const{
/* should I disconnect the socket notfier? */
OCOPPacket packe(OCOPPacket::IsRegistered, chan );
OCOPHead head = packe.head();
write(m_socket, &head, sizeof(head) );
/* block */
OCOPPacket pack = packet();
/* connect here again */
if ( pack.channel() == chan ) {
QCString func = pack.header();
if (func[0] == 1 )
- return;
+ return true;
}
return false;
};
void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) {
OCOPPacket pack(OCOPPacket::Call, chan, fu, arr );
call( pack );
}
-void OCOPClient::addChannel(const QCString& channet) {
+void OCOPClient::addChannel(const QCString& channel) {
OCOPPacket pack(OCOPPacket::RegisterChannel, channel );
call( pack );
}
void OCOPClient::delChannel(const QCString& chan ) {
- OCOPPacket pack(OCOPPacket::UnregisterChannel, channel );
+ OCOPPacket pack(OCOPPacket::UnregisterChannel, chan );
call( pack );
}
-void OCOPPacket::call( const OCOPPacket& pack ) {
+void OCOPClient::call( const OCOPPacket& pack ) {
OCOPHead head = pack.head();
write(m_socket, &head, sizeof(head) );
write(m_socket, pack.channel().data(), pack.channel().size() );
write(m_socket, pack.header().data(), pack.header().size() );
write(m_socket, pack.content().data(), pack.content().size() );
}
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 @@
#ifndef OPIE_OCOP_CLIENT_H
#define OPIE_OCOP_CLIENT_H
#include <qobject.h>
#include <qcstring.h>
#include <qmap.h>
#include <qsignal.h>
#include <qstring.h>
#include <qsocketnotifier.h>
/**
* This is the OCOP client
* It currently only supports
* asking if a Channel is registered,
* calling and receiving calls
*/
class OCOPPacket;
class OCOPClient : public QObject{
Q_OBJECT
public:
/**
* Occasionally I decide to start a Server from here
*/
OCOPClient(const QString& pathToServer = QString::null, QObject* obj = 0l);
~OCOPClient();
bool isRegistered( const QCString& )const;
void send( const QCString& chan, const QCString&, const QByteArray& msg );
/**
* add a channel and does connect to a signal
* callback is the object
* slot is the SLOT()
*/
void addChannel( const QCString& channel );
void delChannel( const QCString& channel );
/* make it singleton? */
//static OCOPClient* self();
/* no direct signals due the design */
signals:
void called(const QCString&, const QCString&, const QByteArray& );
private slots:
void init(const QCString& pa);
void newData();
private:
- OCOPPacket packet();
+ OCOPPacket packet()const;
void call( const OCOPPacket& );
QSocketNotifier* m_notify;
int m_socket;
private slots:
};
#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 @@
TEMPLATE = lib
CONFIG += qt warn_on release
HEADERS = ../../library/calendar.h \
../../library/global.h \
../../library/resource.h \
../../library/xmlreader.h \
../../library/mimetype.h \
../../library/menubutton.h \
../../library/network.h \
../../library/networkinterface.h \
../../library/filemanager.h \
../../library/qdawg.h \
../../library/datebookmonth.h \
../../library/fileselector.h \
../../library/fileselector_p.h \
../../library/imageedit.h \
../../library/qcopenvelope_qws.h \
../../library/qpestyle.h \
../../library/qpedialog.h \
../../library/lightstyle.h \
../../library/config.h \
../../library/applnk.h \
../../library/sound.h \
../../library/tzselect.h \
../../library/qmath.h \
../../library/datebookdb.h \
../../library/alarmserver.h \
../../library/process.h \
../../library/password.h \
../../library/timestring.h \
../../library/power.h \
../../library/storage.h \
../../library/qpemessagebox.h \
../../library/timeconversion.h \
../../library/qpedebug.h \
../../library/qpemenubar.h \
../../library/qpetoolbar.h \
../../library/backend/categories.h \
../../library/stringutil.h \
../../library/backend/palmtoprecord.h \
../../library/backend/task.h \
../../library/backend/event.h \
../../library/backend/contact.h\
../../library/categorymenu.h \
../../library/categoryedit_p.h \
../../library/categoryselect.h \
../../library/categorywidget.h \
../../library/ir.h \
../../library/backend/vobject_p.h \
../../library/findwidget_p.h \
../../library/finddialog.h \
../../library/lnkproperties.h \
../../library/windowdecorationinterface.h \
../../library/textcodecinterface.h \
../../library/imagecodecinterface.h \
+ qt/qcopchannel_qws.h \
qpe/qpeapplication.h \
- qpe/fontmanager.h
+ qpe/fontmanager.h \
+ ../ipc/client/ocopclient.h \
+ ../ipc/common/ocoppacket.h
+
SOURCES = ../../library/calendar.cpp \
../../library/global.cpp \
../../library/xmlreader.cpp \
../../library/mimetype.cpp \
../../library/menubutton.cpp \
../../library/network.cpp \
../../library/networkinterface.cpp \
../../library/filemanager.cpp \
../../library/qdawg.cpp \
../../library/datebookmonth.cpp \
../../library/fileselector.cpp \
../../library/imageedit.cpp \
../../library/resource.cpp \
../../library/qcopenvelope_qws.cpp \
../../library/qpestyle.cpp \
../../library/qpedialog.cpp \
../../library/lightstyle.cpp \
../../library/config.cpp \
../../library/applnk.cpp \
../../library/sound.cpp \
../../library/tzselect.cpp \
../../library/qmath.c \
../../library/datebookdb.cpp \
../../library/alarmserver.cpp \
../../library/password.cpp \
../../library/process.cpp \
../../library/process_unix.cpp \
../../library/timestring.cpp \
../../library/power.cpp \
../../library/storage.cpp \
../../library/qpemessagebox.cpp \
../../library/backend/timeconversion.cpp \
../../library/qpedebug.cpp \
../../library/qpemenubar.cpp \
../../library/qpetoolbar.cpp \
../../library/backend/categories.cpp \
../../library/backend/stringutil.cpp \
../../library/backend/palmtoprecord.cpp \
../../library/backend/task.cpp \
../../library/backend/event.cpp \
../../library/backend/contact.cpp \
../../library/categorymenu.cpp \
../../library/categoryedit_p.cpp \
../../library/categoryselect.cpp \
../../library/categorywidget.cpp \
../../library/ir.cpp \
../../library/backend/vcc_yacc.cpp \
../../library/backend/vobject.cpp \
../../library/findwidget_p.cpp \
../../library/finddialog.cpp \
- ../../library/lnkproperties.cpp
+ ../../library/lnkproperties.cpp \
+ qt/qcopchannel_qws.cpp \
+ qpe/qpeapplication.cpp \
+ ../ipc/client/ocopclient.cpp \
+ ../ipc/common/ocoppacket.cpp
# Qt 3 compatibility
-qt2:HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h
-qt2:SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp
+HEADERS += ../../library/quuid.h \
+ ../../library/qcom.h \
+ ../../library/qlibrary.h \
+ ../../library/qlibrary_p.h
+
+SOURCES += ../../library/quuid.cpp \
+ ../../library/qlibrary.cpp \
+ ../../library/qlibrary_unix.cpp
+
INCLUDEPATH += $(OPIEDIR)/include backend
LIBS += -ldl -lcrypt -lm
+
INTERFACES = ../../library/passwordbase_p.ui \
../../library/categoryeditbase_p.ui \
../../library/findwidgetbase_p.ui \
../../library/lnkpropertiesbase_p.ui
+
TARGET = qpe-x11
DESTDIR = $(QTDIR)/lib$(PROJMAK)
# This is set by configure$(OPIEDIR).
VERSION = 1.5.0.1
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 @@
-#include "../ipc/client/ocopclient.h"
+#include "../../ipc/client/ocopclient.h"
#include <qcopchannel_qws.h>
QCopChannel::QCopChannel( const QCString& channel, QObject* parent,
const char* name )
: QObject( parent, name ),m_chan(channel) {
init();
}
QCopChannel::~QCopChannel() {
m_client->delChannel( m_chan );
delete m_client;
}
void QCopChannel::init() {
m_client = new OCOPClient(QString::null, this );
m_client->addChannel(m_chan );
connect(m_client, SIGNAL(called(const QCString&, const QCString&, const QByteArray& ) ),
this, SLOT(rev(const QCString&, const QCString&, const QByteArray&) ) );
}
QCString QCopChannel::channel()const {
return m_chan;
}
bool QCopChannel::isRegistered( const QCString& chan) {
OCOPClient client;
return client.isRegistered( chan );
}
bool QCopChannel::send( const QCString& chan, const QCString& msg ) {
QByteArray ar(0);
- return return sendLocally(chan, msg, ar );
+ return sendLocally(chan, msg, ar );
}
-bool QCString::send( const QCString& chan, const QCString& msg,
+bool QCopChannel::send( const QCString& chan, const QCString& msg,
const QByteArray& ar ) {
return sendLocally( chan, msg, ar );
}
bool QCopChannel::sendLocally( const QCString& chan, const QCString& msg,
const QByteArray& ar ) {
OCOPClient client;
client.send( chan, msg, ar );
return true;
}
void QCopChannel::rev( const QCString& chan, const QCString& msg, const QByteArray& ar ) {
if (chan == m_chan )
- emit received(chan, msg, ar );
+ emit received(msg, ar );
}