Qt < 4.5 had a bug in the layout of QAbstractScrollArea's scrollbars,
[kdelibs.git] / kutils / kcmultidialog.h
bloba3dccc1e9d4f462416088b07109f071b13a03415
1 /*
2 Copyright (c) 2000 Matthias Elter <elter@kde.org>
3 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
4 Copyright (c) 2003,2006 Matthias Kretz <kretz@kde.org>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
23 #ifndef KCMULTIDIALOG_H
24 #define KCMULTIDIALOG_H
26 #include <kcmoduleinfo.h>
27 #include <kpagedialog.h>
29 class KCMultiDialogPrivate;
31 /**
32 * @short A class that offers a KPageDialog containing arbitrary
33 * KControl Modules.
35 * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org>
37 class KUTILS_EXPORT KCMultiDialog : public KPageDialog
39 Q_OBJECT
40 Q_DECLARE_PRIVATE(KCMultiDialog)
42 public:
43 /**
44 * Constructs a new KCMultiDialog
46 * @param parent The parent widget
47 **/
48 KCMultiDialog( QWidget *parent = 0 );
51 /**
52 * Destructor
53 **/
54 virtual ~KCMultiDialog();
56 /**
57 * Add a module.
59 * The module is added according to its KCModuleInfo::weight(). The weight determines where in the list
60 * the module will appear. Lighter modules on top, heavier modules at the bottom.
62 * @param module Specify the name of the module that is to be added
63 * to the list of modules the dialog will show.
65 * @param args The arguments that should be given to the KCModule when it is created
67 * @returns The @see KPageWidgetItem associated with the new dialog page.
68 **/
69 KPageWidgetItem* addModule( const QString& module, const QStringList&
70 args = QStringList() );
72 /**
73 * Add a module.
75 * The module is added according to its KCModuleInfo::weight(). The weight determines where in the list
76 * the module will appear. Lighter modules on top, heavier modules at the bottom.
78 * @param moduleinfo Pass a KCModuleInfo object which will be
79 * used for creating the module. It will be added
80 * to the list of modules the dialog will show.
82 * @param parent The @see KPageWidgetItem that should appear as parents
83 * in the tree view or a 0 pointer if there is no parent.
85 * @param args The arguments that should be given to the KCModule when it is created
86 **/
87 KPageWidgetItem* addModule( const KCModuleInfo& moduleinfo, KPageWidgetItem *parent = 0,
88 const QStringList& args = QStringList() );
90 /**
91 * Removes all modules from the dialog.
93 void clear();
95 Q_SIGNALS:
96 /**
97 * Emitted after all KCModules have been told to save their configuration.
99 * The applyClicked and okClicked signals are emitted before the
100 * configuration is saved.
102 void configCommitted();
105 * Emitted after the KCModules have been told to save their configuration.
106 * It is emitted once for every instance the KCMs that were changed belong
107 * to.
109 * You can make use of this if you have more than one component in your
110 * application. componentName tells you the instance that has to reload its
111 * configuration.
113 * The applyClicked and okClicked signals are emitted before the
114 * configuration is saved.
116 * @param componentName The name of the instance that needs to reload its
117 * configuration.
119 void configCommitted( const QByteArray & componentName );
121 protected:
123 * This constructor can be used by subclasses to provide a custom KPageWidget.
125 KCMultiDialog(KPageWidget *pageWidget, QWidget *parent, Qt::WFlags flags = 0);
126 KCMultiDialog(KCMultiDialogPrivate &dd, KPageWidget *pageWidget, QWidget *parent, Qt::WFlags flags = 0);
128 protected Q_SLOTS:
130 * This slot is called when the user presses the "Default" Button.
131 * You can reimplement it if needed.
133 * @note Make sure you call the original implementation.
135 void slotDefaultClicked();
138 * This slot is called when the user presses the "Reset" Button.
139 * You can reimplement it if needed.
141 * @note Make sure you call the original implementation.
143 void slotUser1Clicked();
146 * This slot is called when the user presses the "Apply" Button.
147 * You can reimplement it if needed.
149 * @note Make sure you call the original implementation.
151 void slotApplyClicked();
154 * This slot is called when the user presses the "OK" Button.
155 * You can reimplement it if needed.
157 * @note Make sure you call the original implementation.
159 void slotOkClicked();
162 * This slot is called when the user presses the "Help" Button.
163 * It reads the X-DocPath field of the currently selected KControl
164 * module's .desktop file to find the path to the documentation,
165 * which it then attempts to load.
167 * You can reimplement this slot if needed.
169 * @note Make sure you call the original implementation.
171 void slotHelpClicked();
173 private:
174 Q_PRIVATE_SLOT(d_func(), void _k_slotCurrentPageChanged(KPageWidgetItem *))
175 Q_PRIVATE_SLOT(d_func(), void _k_clientChanged())
176 Q_PRIVATE_SLOT(d_func(), void _k_dialogClosed())
179 #endif