summaryrefslogtreecommitdiff
path: root/core/launcher/qcopbridge.h
Unidiff
Diffstat (limited to 'core/launcher/qcopbridge.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/qcopbridge.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/core/launcher/qcopbridge.h b/core/launcher/qcopbridge.h
new file mode 100644
index 0000000..114b3ee
--- a/dev/null
+++ b/core/launcher/qcopbridge.h
@@ -0,0 +1,95 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef __qcopbridge_h__
21#define __qcopbridge_h__
22
23#include <qserversocket.h>
24#include <qsocket.h>
25#include <qdir.h>
26#include <qfile.h>
27#include <qbuffer.h>
28
29class QFileInfo;
30class QCopBridgePI;
31class QCopChannel;
32
33class QCopBridge : public QServerSocket
34{
35 Q_OBJECT
36
37public:
38 QCopBridge( Q_UINT16 port, QObject *parent = 0, const char* name = 0 );
39 virtual ~QCopBridge();
40
41 void newConnection( int socket );
42 void closeOpenConnections();
43
44public slots:
45 void connectionClosed( QCopBridgePI *pi );
46 void desktopMessage( const QCString &call, const QByteArray & );
47
48protected:
49 void timerEvent( QTimerEvent * );
50
51private:
52 QCopChannel *desktopChannel;
53 QCopChannel *cardChannel;
54 QList<QCopBridgePI> openConnections;
55 bool sendSync;
56};
57
58
59class QCopBridgePI : public QSocket
60{
61 Q_OBJECT
62
63 enum State { Connected, Wait_USER, Wait_PASS, Ready, Forbidden };
64
65public:
66 QCopBridgePI( int socket, QObject *parent = 0, const char* name = 0 );
67 virtual ~QCopBridgePI();
68
69 void sendDesktopMessage( const QString &msg );
70 void startSync() { sendSync = TRUE; }
71
72signals:
73 void connectionClosed( QCopBridgePI *);
74
75protected slots:
76 void read();
77 void send( const QString& msg );
78 void process( const QString& command );
79 void connectionClosed();
80
81protected:
82 bool checkUser( const QString& user );
83 bool checkPassword( const QString& pw );
84
85 void timerEvent( QTimerEvent *e );
86
87private:
88 State state;
89 Q_UINT16 peerport;
90 QHostAddress peeraddress;
91 bool connected;
92 bool sendSync;
93};
94
95#endif