• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | List of all members
KConfigDialog Class Reference

#include <kconfigdialog.h>

Inheritance diagram for KConfigDialog:
Inheritance graph
[legend]

Signals

void settingsChanged (const QString &dialogName)
 
void widgetModified ()
 
- Signals inherited from KPageDialog
void currentPageChanged (KPageWidgetItem *current, KPageWidgetItem *before)
 
void pageRemoved (KPageWidgetItem *page)
 
- Signals inherited from KDialog
void aboutToShowDetails ()
 
void applyClicked ()
 
void buttonClicked (KDialog::ButtonCode button)
 
void cancelClicked ()
 
void closeClicked ()
 
void defaultClicked ()
 
void finished ()
 
void helpClicked ()
 
void hidden ()
 
void layoutHintChanged ()
 
void noClicked ()
 
void okClicked ()
 
void resetClicked ()
 
void tryClicked ()
 
void user1Clicked ()
 
void user2Clicked ()
 
void user3Clicked ()
 
void yesClicked ()
 

Public Member Functions

 KConfigDialog (QWidget *parent, const QString &name, KConfigSkeleton *config)
 
 KConfigDialog (QWidget *parent, const QString &name, KCoreConfigSkeleton *config)
 
 ~KConfigDialog ()
 
KPageWidgetItem * addPage (QWidget *page, const QString &itemName, const QString &pixmapName=QString(), const QString &header=QString(), bool manage=true)
 
KPageWidgetItem * addPage (QWidget *page, KConfigSkeleton *config, const QString &itemName, const QString &pixmapName=QString(), const QString &header=QString())
 
- Public Member Functions inherited from KPageDialog
 KPageDialog (QWidget *parent=0, Qt::WindowFlags flags=0)
 
 ~KPageDialog ()
 
KPageWidgetItem * addPage (QWidget *widget, const QString &name)
 
void addPage (KPageWidgetItem *item)
 
KPageWidgetItem * addSubPage (KPageWidgetItem *parent, QWidget *widget, const QString &name)
 
void addSubPage (KPageWidgetItem *parent, KPageWidgetItem *item)
 
KPageWidgetItem * currentPage () const
 
KPageWidgetItem * insertPage (KPageWidgetItem *before, QWidget *widget, const QString &name)
 
void insertPage (KPageWidgetItem *before, KPageWidgetItem *item)
 
void removePage (KPageWidgetItem *item)
 
void setCurrentPage (KPageWidgetItem *item)
 
void setFaceType (FaceType faceType)
 
- Public Member Functions inherited from KDialog
 KDialog (QWidget *parent=0, Qt::WindowFlags flags=0)
 
 ~KDialog ()
 
KPushButton * button (ButtonCode id) const
 
KIcon buttonIcon (ButtonCode id) const
 
QString buttonText (ButtonCode id) const
 
QString buttonToolTip (ButtonCode id) const
 
QString buttonWhatsThis (ButtonCode id) const
 
ButtonCode defaultButton () const
 
QString helpLinkText () const
 
void incrementInitialSize (const QSize &size)
 
bool isButtonEnabled (ButtonCode id) const
 
QWidget * mainWidget ()
 
virtual QSize minimumSizeHint () const
 
void restoreDialogSize (const KConfigGroup &config)
 
void saveDialogSize (KConfigGroup &config, KConfigGroup::WriteConfigFlags options=KConfigGroup::Normal) const
 
void setButtonFocus (ButtonCode id)
 
void setButtonGuiItem (ButtonCode id, const KGuiItem &item)
 
void setButtonIcon (ButtonCode id, const KIcon &icon)
 
void setButtonMenu (ButtonCode id, QMenu *menu, ButtonPopupMode popupmode=InstantPopup)
 
void setButtons (ButtonCodes buttonMask)
 
void setButtonsOrientation (Qt::Orientation orientation)
 
void setButtonText (ButtonCode id, const QString &text)
 
void setButtonToolTip (ButtonCode id, const QString &text)
 
void setButtonWhatsThis (ButtonCode id, const QString &text)
 
void setDefaultButton (ButtonCode id)
 
void setEscapeButton (ButtonCode id)
 
void setInitialSize (const QSize &size)
 
void setMainWidget (QWidget *widget)
 
void showButton (ButtonCode id, bool state)
 
void showButtonSeparator (bool state)
 
virtual QSize sizeHint () const
 

Static Public Member Functions

static KConfigDialog * exists (const QString &name)
 
static bool showDialog (const QString &name)
 
- Static Public Member Functions inherited from KDialog
static bool avoidArea (QWidget *widget, const QRect &area, int screen=-1)
 
static void centerOnScreen (QWidget *widget, int screen=-1)
 
static int groupSpacingHint ()
 
static QString makeStandardCaption (const QString &userCaption, QWidget *window=0, CaptionFlags flags=HIGCompliantCaption)
 
static int marginHint ()
 
static void resizeLayout (QWidget *widget, int margin, int spacing)
 
static void resizeLayout (QLayout *lay, int margin, int spacing)
 
static void setAllowEmbeddingInGraphicsView (bool allowEmbedding)
 
static int spacingHint ()
 

Protected Slots

void settingsChangedSlot ()
 
void updateButtons ()
 
virtual void updateSettings ()
 
virtual void updateWidgets ()
 
virtual void updateWidgetsDefault ()
 
- Protected Slots inherited from KDialog
virtual void slotButtonClicked (int button)
 
void updateGeometry ()
 

Protected Member Functions

virtual bool hasChanged ()
 
virtual bool isDefault ()
 
virtual void showEvent (QShowEvent *e)
 
- Protected Member Functions inherited from KPageDialog
 KPageDialog (KPageWidget *widget, QWidget *parent, Qt::WindowFlags flags=0)
 
 KPageDialog (KPageDialogPrivate &dd, KPageWidget *widget, QWidget *parent, Qt::WindowFlags flags=0)
 
KPageWidget * pageWidget ()
 
const KPageWidget * pageWidget () const
 
void setPageWidget (KPageWidget *widget)
 
- Protected Member Functions inherited from KDialog
 KDialog (KDialogPrivate &dd, QWidget *parent, Qt::WindowFlags flags=0)
 
virtual void closeEvent (QCloseEvent *e)
 
virtual void hideEvent (QHideEvent *)
 
virtual void keyPressEvent (QKeyEvent *)
 

Additional Inherited Members

- Public Types inherited from KPageDialog
enum  FaceType {
  Auto = KPageView::Auto, Plain = KPageView::Plain, List = KPageView::List, Tree = KPageView::Tree,
  Tabbed = KPageView::Tabbed
}
 
- Public Types inherited from KDialog
enum  ButtonCode {
  None = 0x00000000, Help = 0x00000001, Default = 0x00000002, Ok = 0x00000004,
  Apply = 0x00000008, Try = 0x00000010, Cancel = 0x00000020, Close = 0x00000040,
  No = 0x00000080, Yes = 0x00000100, Reset = 0x00000200, Details = 0x00000400,
  User1 = 0x00001000, User2 = 0x00002000, User3 = 0x00004000, NoDefault = 0x00008000
}
 
enum  ButtonPopupMode { InstantPopup = 0, DelayedPopup = 1 }
 
enum  CaptionFlag { NoCaptionFlags = 0, AppNameCaption = 1, ModifiedCaption = 2, HIGCompliantCaption = AppNameCaption }
 
- Public Slots inherited from KDialog
void delayedDestruct ()
 
void enableButton (ButtonCode id, bool state)
 
void enableButtonApply (bool state)
 
void enableButtonCancel (bool state)
 
void enableButtonOk (bool state)
 
void enableLinkedHelp (bool state)
 
bool isDetailsWidgetVisible () const
 
virtual void setCaption (const QString &caption)
 
virtual void setCaption (const QString &caption, bool modified)
 
void setDetailsWidget (QWidget *detailsWidget)
 
void setDetailsWidgetVisible (bool visible)
 
void setHelp (const QString &anchor, const QString &appname=QString())
 
void setHelpLinkText (const QString &text)
 
virtual void setPlainCaption (const QString &caption)
 
- Protected Attributes inherited from KDialog
KDialogPrivate *const d_ptr
 

Detailed Description

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:

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();
}

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 also
KPageDialog
KConfigSkeleton
Author
Waldo Bastian basti.nosp@m.an@k.nosp@m.de.or.nosp@m.g

Definition at line 73 of file kconfigdialog.h.

Constructor & Destructor Documentation

KConfigDialog::KConfigDialog ( QWidget *  parent,
const QString &  name,
KConfigSkeleton *  config 
)
Parameters
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.
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.
config- Config object containing settings.

Definition at line 94 of file kconfigdialog.cpp.

KConfigDialog::KConfigDialog ( QWidget *  parent,
const QString &  name,
KCoreConfigSkeleton *  config 
)
Since
4.8.1
Parameters
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.
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.
config- Config object containing settings.

Definition at line 101 of file kconfigdialog.cpp.

KConfigDialog::~KConfigDialog ( )

Deconstructor, removes name from the list of open dialogs.

Deletes private class.

See also
exists()

Definition at line 108 of file kconfigdialog.cpp.

Member Function Documentation

KPageWidgetItem * KConfigDialog::addPage ( QWidget *  page,
const QString &  itemName,
const QString &  pixmapName = QString(),
const QString &  header = QString(),
bool  manage = true 
)

Adds page to the dialog and to KConfigDialogManager.

When an application is done adding pages show() should be called to display the dialog.

Parameters
page- Pointer to the page that is to be added to the dialog. This object is reparented.
itemName- Name of the page.
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.
header- Header text use in the list modes. Ignored in Tabbed mode. If empty, the itemName text is used when needed.
manage- Whether KConfigDialogManager should manage the page or not.
Returns
The KPageWidgetItem associated with the page.

Definition at line 114 of file kconfigdialog.cpp.

KPageWidgetItem * KConfigDialog::addPage ( QWidget *  page,
KConfigSkeleton *  config,
const QString &  itemName,
const QString &  pixmapName = QString(),
const QString &  header = QString() 
)

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.

Parameters
page- Pointer to the page that is to be added to the dialog. This object is reparented.
config- Config object containing corresponding settings.
itemName- Name of the page.
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.
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.

Definition at line 138 of file kconfigdialog.cpp.

KConfigDialog * KConfigDialog::exists ( const QString &  name)
static

See if a dialog with the name 'name' already exists.

See also
showDialog()
Parameters
name- Dialog name to look for.
Returns
Pointer to widget or NULL if it does not exist.

Definition at line 209 of file kconfigdialog.cpp.

bool KConfigDialog::hasChanged ( )
protectedvirtual

Returns whether the current state of the dialog is different from the current configuration.

Virtual function for custom additions.

Definition at line 311 of file kconfigdialog.cpp.

bool KConfigDialog::isDefault ( )
protectedvirtual

Returns whether the current state of the dialog is the same as the default configuration.

Definition at line 316 of file kconfigdialog.cpp.

void KConfigDialog::settingsChanged ( const QString &  dialogName)
signal

One or more of the settings have been permanently changed such as if the user clicked on the Apply or Ok button.

Parameters
dialogNamethe name of the dialog.
void KConfigDialog::settingsChangedSlot ( )
protectedslot

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

Definition at line 326 of file kconfigdialog.cpp.

bool KConfigDialog::showDialog ( const QString &  name)
static

Attempts to show the dialog with the name 'name'.

See also
exists()
Parameters
name- The name of the dialog to show.
Returns
True if the dialog 'name' exists and was shown.

Definition at line 217 of file kconfigdialog.cpp.

void KConfigDialog::showEvent ( QShowEvent *  e)
protectedvirtual

Definition at line 264 of file kconfigdialog.cpp.

void KConfigDialog::updateButtons ( )
protectedslot

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

Definition at line 321 of file kconfigdialog.cpp.

void KConfigDialog::updateSettings ( )
protectedvirtualslot

Update the settings from the dialog.

Virtual function for custom additions.

Example use: User clicks Ok or Apply button in a configure dialog.

Definition at line 299 of file kconfigdialog.cpp.

void KConfigDialog::updateWidgets ( )
protectedvirtualslot

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.

Definition at line 303 of file kconfigdialog.cpp.

void KConfigDialog::updateWidgetsDefault ( )
protectedvirtualslot

Update the dialog based on the default settings.

Virtual function for custom additions.

Example use: User clicks Defaults button in a configure dialog.

Definition at line 307 of file kconfigdialog.cpp.

void KConfigDialog::widgetModified ( )
signal

A widget in the dialog was modified.


The documentation for this class was generated from the following files:
  • kconfigdialog.h
  • kconfigdialog.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal