summaryrefslogtreecommitdiff
path: root/kde/daemon/handler.h
blob: 516b5175124afe32f78747a4e537660cf60c98a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef HANDLER_H
#define HANDLER_H

#include <qobject.h>
#include <qmap.h>
#include <kio/job.h>
#include <qwidget.h>

#include <dapi/comm.h>

class KABCHandler;
class QSocketNotifier;

class KDapiHandler
    : public QObject
    {
    Q_OBJECT
    public:
        KDapiHandler();
        virtual ~KDapiHandler();
    private slots:
        void processMainSocketData();
        void processSocketData( int sock );
    private:
        struct ConnectionData
            {
            DapiConnection* conn;
            QSocketNotifier* notifier;
            bool screensaver_suspend;
            };
        void setupSocket();
        void closeSocket( ConnectionData& conn );
        void processCommand( ConnectionData& conn );
        void processCommandInit( ConnectionData& conn, int seq );
        void processCommandCapabilities( ConnectionData& conn, int seq );
        void processCommandOpenUrl( ConnectionData& conn, int seq );
        void processCommandExecuteUrl( ConnectionData& conn, int seq );
        void processCommandButtonOrder( ConnectionData& conn, int seq );
        void processCommandRunAsUser( ConnectionData& conn, int seq );
        void processCommandSuspendScreensaving( ConnectionData& conn, int seq );
        void processCommandMailTo( ConnectionData& conn, int seq );
        void processCommandLocalFile( ConnectionData& conn, int seq );
        void processCommandUploadFile( ConnectionData& conn, int seq );
        void processCommandRemoveTemporaryLocalFile( ConnectionData& conn, int seq );
        void processCommandAddressBookList( ConnectionData& conn, int seq );
        void processCommandAddressBookGetName( ConnectionData& conn, int seq );
        void processCommandAddressBookGetEmails( ConnectionData& conn, int seq );
        void processCommandAddressBookFindByName( ConnectionData& conn, int seq );
        void processCommandAddressBookOwner( ConnectionData& conn, int seq );
        void processCommandAddressBookGetVCard30( ConnectionData& conn, int seq );
        void updateScreensaving();
        static QCString makeStartupInfo( const DapiWindowInfo& winfo );
        int mainsocket;
        typedef QValueList< ConnectionData > ConnectionList;
        ConnectionList connections;
        KABCHandler* kabchandler;
    };

class KDapiFakeWidget
    : public QWidget
    {
    Q_OBJECT
    public:
        KDapiFakeWidget( WId window );
        virtual ~KDapiFakeWidget();
    };

class KDapiDownloadJob
    : public QObject
    {
    Q_OBJECT
    public:
        KDapiDownloadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, QWidget* w );
    private slots:
        void done();
    private:
        KIO::FileCopyJob* job;
        DapiConnection* conn;
        int seq;
        QWidget* widget;
    };

class KDapiUploadJob
    : public QObject
    {
    Q_OBJECT
    public:
        KDapiUploadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, bool r, QWidget* w );
    private slots:
        void done();
    private:
        KIO::FileCopyJob* job;
        DapiConnection* conn;
        int seq;
        bool remove_local;
        QWidget* widget;
    };

inline
KDapiDownloadJob::KDapiDownloadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, QWidget* w )
    : job( j ), conn( c ), seq( s ), widget( w )
    {
    }

inline
KDapiUploadJob::KDapiUploadJob( KIO::FileCopyJob* j, DapiConnection* c, int s, bool r, QWidget* w )
    : job( j ), conn( c ), seq( s ), remove_local( r ), widget( w )
    {
    }

#endif