summaryrefslogtreecommitdiffstats
path: root/kdialogd3/kdialogd.h
blob: 05ad19afe61c4d1d055a2309e5d66bc525bf390b (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
146
147
148
149
#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 TQTimer;
#else
#include <kdedmodule.h>
#endif
class KDialogBase;
class KConfig;

class KDialogDFileDialog : public KFileDialog
{
    Q_OBJECT
  TQ_OBJECT

    public:

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

    public slots:

    void accept();
    void slotOk();

    signals:

    void ok(const TQStringList &items);

    private:

    bool    itsConfirmOw;
    TQString &itsAppName;
};

class KDialogDDirSelectDialog : public KDirSelectDialog
{
    Q_OBJECT
  TQ_OBJECT

    public:

    KDialogDDirSelectDialog(TQString &an, const TQString &startDir = TQString(),
                            bool localOnly = false,
                            TQWidget *parent = 0L,
                            const char *name = 0, bool modal = false);
    virtual ~KDialogDDirSelectDialog();

    public slots:

    void slotOk();

    signals:

    void ok(const TQStringList &items);

    private:

    TQString &itsAppName;
};

class KDialogDClient : public TQObject
{
    Q_OBJECT
  TQ_OBJECT

    public:

    KDialogDClient(int sock, const TQString &an, TQObject *parent);
    virtual ~KDialogDClient();

    public slots:

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

    signals:

    void error(KDialogDClient *);

    private:

    void cancel();
    bool readData(TQCString &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(TQString &str);
    bool writeString(const TQString &str);
    void initDialog(const TQString &caption, KDialogBase *d, unsigned int xid);

    private:

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

class KDialogD : public TQObject
{
    Q_OBJECT
  TQ_OBJECT

    public:

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

    public slots:

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

    static KConfig * config() { return theirConfig; }

    private:

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

    static KConfig *theirConfig;
};

#ifndef KDIALOGD_APP
class KDialogDKDED : public KDEDModule
{
    public:

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

#endif