summaryrefslogtreecommitdiffstats
path: root/tqt3integration/module/module.h
blob: 80bc4a3463ebcbe7ff45b9c587fb097b63bb4d19 (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
150
151
152
153
154
 /*
 *  This file is part of the Trinity Desktop Environment
 *
 *  Original file taken from the OpenSUSE kdebase builds
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef _INTEGRATION_MODULE_H_
#define _INTEGRATION_MODULE_H_

#include <kcolordialog.h>
#include <kdedmodule.h>
#include <kdirselectdialog.h>
#include <kfiledialog.h>
#include <kfontdialog.h>
#include <kdialogbase.h>

class DCOPClientTransaction;

namespace KDEIntegration
{

class Module
    : public KDEDModule
    {
    Q_OBJECT
    public:
        Module( const QCString& obj );
        // DCOP
        virtual bool process(const QCString &fun, const QByteArray &data,
            QCString &replyType, QByteArray &replyData);
        virtual QCStringList functions();
        virtual QCStringList interfaces();
    private slots:
        void dialogDone( int result );
    private:
        struct JobData
            {
            DCOPClientTransaction* transaction;
            enum
                {
                GetOpenFileNames,
                GetSaveFileName,
                GetExistingDirectory,
                GetColor,
                GetFont,
                MessageBox1,
                MessageBox2
                } type;
            };
        QMap< void*, JobData > jobs;
#include "module_functions.h"
    };

class KFileDialog
    : public ::KFileDialog
    {
    Q_OBJECT
    public:
        KFileDialog(const QString& startDir, const QString& filter,
            QWidget *parent, const char *name, bool modal)
            : ::KFileDialog( startDir, filter, parent, name, modal )
            {}
    signals:
        void dialogDone( int result );
    protected:
        virtual void done( int r ) { ::KFileDialog::done( r ); emit dialogDone( r ); }
    };


class KDirSelectDialog
    : public ::KDirSelectDialog
    {
    Q_OBJECT
    public:
        KDirSelectDialog(const QString& startDir, bool localOnly,
            QWidget *parent, const char *name, bool modal)
            : ::KDirSelectDialog( startDir, localOnly, parent, name, modal )
            {}
    signals:
        void dialogDone( int result );
    protected:
        virtual void done( int r ) { ::KDirSelectDialog::done( r ); emit dialogDone( r ); }
    };


class KColorDialog
    : public ::KColorDialog
    {
    Q_OBJECT
    public:
        KColorDialog( QWidget *parent, const char *name, bool modal )
            : ::KColorDialog( parent, name, modal )
            {}
    signals:
        void dialogDone( int result );
    protected:
        virtual void done( int r ) { ::KColorDialog::done( r ); emit dialogDone( r ); } // hmm?
    };

class KFontDialog
    : public ::KFontDialog
    {
    Q_OBJECT
    public:
        KFontDialog( QWidget *parent, const char *name, bool onlyFixed, bool modal,
            const QStringList &fontlist = QStringList(), bool makeFrame = true,
            bool diff = false, QButton::ToggleState *sizeIsRelativeState = 0L )
            : ::KFontDialog( parent, name, onlyFixed, modal, fontlist, makeFrame, diff, sizeIsRelativeState )
            {}
    signals:
        void dialogDone( int result );
    protected:
        virtual void done( int r ) { ::KFontDialog::done( r ); emit dialogDone( r ); }
    };

class KDialogBase
    : public ::KDialogBase
    {
    Q_OBJECT
    public:
        KDialogBase( const QString &caption, int buttonMask=Yes|No|Cancel,
		 ButtonCode defaultButton=Yes, ButtonCode escapeButton=Cancel,
		 QWidget *parent=0, const char *name=0,
		 bool modal=true, bool separator=false,
		 const KGuiItem &yes = KStdGuiItem::yes(), // i18n("&Yes")
		 const KGuiItem &no = KStdGuiItem::no(), // i18n("&No"),
		 const KGuiItem &cancel = KStdGuiItem::cancel()) // i18n("&Cancel")
                 : ::KDialogBase( caption, buttonMask, defaultButton, escapeButton, parent, name, modal, separator,
                     yes, no, cancel )
                {}
    signals:
        void dialogDone( int result );
    protected:
        virtual void done( int r ) { ::KDialogBase::done( r ); emit dialogDone( r ); }
    };

    
} // namespace

#endif