/usr/include/kconfigdialog.h is in kdelibs5-dev 4:4.14.2-5+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | /*
* This file is part of the KDE libraries
* Copyright (C) 2003 Benjamin C Meyer (ben+kdelibs at meyerhome dot net)
* Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KCONFIGDIALOG_H
#define KCONFIGDIALOG_H
#include <kpagedialog.h>
class KConfig;
class KCoreConfigSkeleton;
class KConfigSkeleton;
class KConfigDialogManager;
/**
* \short Standard %KDE configuration dialog class
*
* The KConfigDialog class provides an easy and uniform means of displaying
* a settings dialog using KPageDialog, KConfigDialogManager and a
* KConfigSkeleton derived settings class.
*
* KConfigDialog handles the enabling and disabling of buttons, creation
* of the dialog, and deletion of the widgets. Because of
* KConfigDialogManager, this class also manages: restoring
* the settings, reseting them to the default values, and saving them. This
* requires that the names of the widgets corresponding to configuration entries
* have to have the same name plus an additional "kcfg_" prefix. For example the
* widget named "kcfg_MyOption" would be associated with the configuration entry
* "MyOption".
*
* Here is an example usage of KConfigDialog:
*
* \code
* void KCoolApp::showSettings(){
* if(KConfigDialog::showDialog("settings"))
* return;
* KConfigDialog *dialog = new KConfigDialog(this, "settings", MySettings::self());
* dialog->setFaceType(KPageDialog::List);
* dialog->addPage(new General(0, "General"), i18n("General") );
* dialog->addPage(new Appearance(0, "Style"), i18n("Appearance") );
* connect(dialog, SIGNAL(settingsChanged(const QString&)), mainWidget, SLOT(loadSettings()));
* connect(dialog, SIGNAL(settingsChanged(const QString&)), this, SLOT(loadSettings()));
* dialog->show();
* }
* \endcode
*
* Other than the above code, each class that has settings in the dialog should
* have a loadSettings() type slot to read settings and perform any
* necessary changes.
*
* For dialog appearance options (like buttons, default button, ...) please see
* @see KPageDialog
*
* @see KConfigSkeleton
* @author Waldo Bastian <bastian@kde.org>
*/
class KDEUI_EXPORT KConfigDialog : public KPageDialog {
Q_OBJECT
Q_SIGNALS:
/**
* A widget in the dialog was modified.
*/
void widgetModified();
/**
* One or more of the settings have been permanently changed such as if
* the user clicked on the Apply or Ok button.
* @param dialogName the name of the dialog.
*/
void settingsChanged(const QString& dialogName);
public:
/**
* @param parent - The parent of this object. Even though the class
* deletes itself the parent should be set so the dialog can be centered
* with the application on the screen.
*
* @param name - The name of this object. The name is used in determining if
* there can be more than one dialog at a time. Use names such as:
* "Font Settings" or "Color Settings" and not just "Settings" in
* applications where there is more than one dialog.
*
* @param config - Config object containing settings.
*/
KConfigDialog( QWidget *parent, const QString& name,
KConfigSkeleton *config );
/**
* @since 4.8.1
*
* @param parent - The parent of this object. Even though the class
* deletes itself the parent should be set so the dialog can be centered
* with the application on the screen.
*
* @param name - The name of this object. The name is used in determining if
* there can be more than one dialog at a time. Use names such as:
* "Font Settings" or "Color Settings" and not just "Settings" in
* applications where there is more than one dialog.
*
* @param config - Config object containing settings.
*/
KConfigDialog( QWidget *parent, const QString& name,
KCoreConfigSkeleton *config );
/**
* Deconstructor, removes name from the list of open dialogs.
* Deletes private class.
* @see exists()
*/
~KConfigDialog();
/**
* Adds page to the dialog and to KConfigDialogManager. When an
* application is done adding pages show() should be called to
* display the dialog.
* @param page - Pointer to the page that is to be added to the dialog.
* This object is reparented.
* @param itemName - Name of the page.
* @param pixmapName - Name of the icon that should be used, if needed, when
* displaying the page. The string may either be the name of a themed
* icon (e.g. "document-save"), which the internal icon loader will be
* used to retrieve, or an absolute path to the pixmap on disk.
* @param header - Header text use in the list modes. Ignored in Tabbed
* mode. If empty, the itemName text is used when needed.
* @param manage - Whether KConfigDialogManager should manage the page or not.
* @returns The KPageWidgetItem associated with the page.
*/
KPageWidgetItem* addPage( QWidget *page, const QString &itemName,
const QString &pixmapName=QString(),
const QString &header=QString(),
bool manage=true );
/**
* Adds page to the dialog that is managed by a custom KConfigDialogManager.
* This is useful for dialogs that contain settings spread over more than
* one configuration file and thus have/need more than one KConfigSkeleton.
* When an application is done adding pages show() should be called to
* display the dialog.
* @param page - Pointer to the page that is to be added to the dialog.
* This object is reparented.
* @param config - Config object containing corresponding settings.
* @param itemName - Name of the page.
* @param pixmapName - Name of the icon that should be used, if needed, when
* displaying the page. The string may either be the name of a themed
* icon (e.g. "document-save"), which the internal icon loader will be
* used to retrieve, or an absolute path to the pixmap on disk.
* @param header - Header text use in the list modes. Ignored in Tabbed
* mode. If empty, the itemName text is used when needed.
* @returns The KPageWidgetItem associated with the page.
*/
KPageWidgetItem* addPage( QWidget *page, KConfigSkeleton *config,
const QString &itemName,
const QString &pixmapName=QString(),
const QString &header=QString() );
/**
* See if a dialog with the name 'name' already exists.
* @see showDialog()
* @param name - Dialog name to look for.
* @return Pointer to widget or NULL if it does not exist.
*/
static KConfigDialog* exists( const QString& name );
/**
* Attempts to show the dialog with the name 'name'.
* @see exists()
* @param name - The name of the dialog to show.
* @return True if the dialog 'name' exists and was shown.
*/
static bool showDialog( const QString& name );
protected Q_SLOTS:
/**
* Update the settings from the dialog.
* Virtual function for custom additions.
*
* Example use: User clicks Ok or Apply button in a configure dialog.
*/
virtual void updateSettings();
/**
* Update the dialog based on the settings.
* Virtual function for custom additions.
*
* Example use: Initialisation of dialog.
* Example use: User clicks Reset button in a configure dialog.
*/
virtual void updateWidgets();
/**
* Update the dialog based on the default settings.
* Virtual function for custom additions.
*
* Example use: User clicks Defaults button in a configure dialog.
*/
virtual void updateWidgetsDefault();
/**
* Updates the Apply and Default buttons.
* Connect to this slot if you implement you own hasChanged()
* or isDefault() methods for widgets not managed by KConfig.
* @since 4.3
*/
void updateButtons();
/**
* Some setting was changed. Emit the signal with the dialogs name.
* Connect to this slot if there are widgets not managed by KConfig.
* @since 4.3
*/
void settingsChangedSlot();
protected:
/**
* Returns whether the current state of the dialog is
* different from the current configuration.
* Virtual function for custom additions.
*/
virtual bool hasChanged();
/**
* Returns whether the current state of the dialog is
* the same as the default configuration.
*/
virtual bool isDefault();
/**
* @internal
*/
virtual void showEvent(QShowEvent *e);
private Q_SLOTS:
/**
* Slot which cleans up the KConfigDialogManager of the page.
* */
void onPageRemoved(KPageWidgetItem* item);
private:
class KConfigDialogPrivate;
friend class KConfigDialogPrivate;
KConfigDialogPrivate *const d;
Q_PRIVATE_SLOT( d, void _k_updateButtons() )
Q_PRIVATE_SLOT( d, void _k_settingsChangedSlot() )
Q_DISABLE_COPY(KConfigDialog)
};
#endif //KCONFIGDIALOG_H
|