summaryrefslogtreecommitdiffstats
path: root/kdialogd3/kdialogd.h
blob: 7e50580a185f0cb8bf0a822fbb3331c2dac46acb (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef __KDIALOGD_H__
#define __KDIALOGD_H__

#include <kfile.h>
#include <kfiledialog.h>
#include <kfiledialog.h>
#include <kdirselectdialog.h>
#include "common.h"
#include "config.h"

#ifdef KDIALOGD_APP
class QTimer;
#else
#include <kdedmodule.h>
#endif
class KDialogBase;
class KConfig;

class KDialogDFileDialog : public KFileDialog
{
    Q_OBJECT

    public:

    KDialogDFileDialog(QString &an, Operation op, const QString& startDir, const QString& filter,
                       bool confirmOw);
    virtual ~KDialogDFileDialog();

    public slots:

    void accept();
    void slotOk();

    signals:

    void ok(const QStringList &items);

    private:

    bool    itsConfirmOw;
    QString &itsAppName;
};

class KDialogDDirSelectDialog : public KDirSelectDialog
{
    Q_OBJECT

    public:

    KDialogDDirSelectDialog(QString &an, const QString &startDir = QString::null,
                            bool localOnly = false,
                            QWidget *parent = 0L,
                            const char *name = 0, bool modal = false);
    virtual ~KDialogDDirSelectDialog();

    public slots:

    void slotOk();

    signals:

    void ok(const QStringList &items);

    private:

    QString &itsAppName;
};

class KDialogDClient : public QObject
{
    Q_OBJECT

    public:

    KDialogDClient(int sock, const QString &an, QObject *parent);
    virtual ~KDialogDClient();

    public slots:

    void read();
    void close();
    void ok(const QStringList &items);
    void finished();

    signals:

    void error(KDialogDClient *);

    private:

    void cancel();
    bool readData(QCString &buffer, int size);
    bool readData(char *buffer, int size)        { return readBlock(itsFd, buffer, size); }
    bool writeData(const char *buffer, int size) { return writeBlock(itsFd, buffer, size); }
    bool readString(QString &str);
    bool writeString(const QString &str);
    void initDialog(const QString &caption, KDialogBase *d, unsigned int xid);

    private:

    int          itsFd;
    KDialogBase  *itsDlg;
    bool         itsAccepted;
    QString      itsAppName;
};

class KDialogD : public QObject
{
    Q_OBJECT

    public:

    KDialogD(QObject *parent=0L);
    virtual ~KDialogD();

    public slots:

    void newConnection();
    void deleteConnection(KDialogDClient *client);
    void timeout();

    static KConfig * config() { return theirConfig; }

    private:

#ifdef KDIALOGD_APP
    QTimer *itsTimer;
    int    itsTimeoutVal;
#endif
    int    itsFd,
           itsNumConnections;

    static KConfig *theirConfig;
};

#ifndef KDIALOGD_APP
class KDialogDKDED : public KDEDModule
{
    public:

    KDialogDKDED(const QCString &obj);
};
#endif

#endif