22 #include "tdeconfigdialog.h"
24 #include <tdeconfigskeleton.h>
25 #include <tdeconfigdialogmanager.h>
27 #include <kiconloader.h>
34 TQAsciiDict<TDEConfigDialog> TDEConfigDialog::openDialogs;
37 class TDEConfigDialog::TDEConfigDialogPrivate
41 : shown(false), type(t), manager(0) { }
46 TQMap<TQWidget *, TDEConfigDialogManager *> managerForPage;
55 KDialogBase( dialogType, (WFlags)TQt::WStyle_DialogBorder,
56 parent, name, modal, i18n(
"Configure"), dialogButtons, defaultButton ),
57 d(new TDEConfigDialogPrivate(dialogType))
60 openDialogs.insert(name,
this);
62 TQCString genericName;
63 genericName.sprintf(
"SettingsDialog-%p",
this);
64 openDialogs.insert(genericName,
this);
75 setupManagerConnections(d->manager);
82 openDialogs.remove(name());
87 const TQString &itemName,
88 const TQString &pixmapName,
89 const TQString &header,
92 addPageInternal(page, itemName, pixmapName, header);
94 d->manager->addWidget(page);
99 const TQString &itemName,
100 const TQString &pixmapName,
101 const TQString &header)
103 addPageInternal(page, itemName, pixmapName, header);
105 setupManagerConnections(d->managerForPage[page]);
108 void TDEConfigDialog::addPageInternal(TQWidget *page,
109 const TQString &itemName,
110 const TQString &pixmapName,
111 const TQString &header)
115 kdDebug(240) <<
"TDEConfigDialog::addPage: can not add a page after the dialog has been shown.";
123 TQVBox *frame =
addVBoxPage(itemName, header, SmallIcon(pixmapName, 32));
124 frame->setSpacing( 0 );
125 frame->setMargin( 0 );
126 page->reparent(((TQWidget*)frame), 0, TQPoint());
132 page->reparent(
this, 0, TQPoint());
140 TQVBoxLayout *topLayout =
new TQVBoxLayout( main, 0, 0 );
141 page->reparent(((TQWidget*)main), 0, TQPoint());
142 topLayout->addWidget( page );
147 kdDebug(240) <<
"TDEConfigDialog::addpage: unknown type.";
163 return openDialogs.find(name);
171 return (dialog != NULL);
176 static bool only_once =
false;
177 if (only_once)
return;
180 TQMap<TQWidget *, TDEConfigDialogManager *>::iterator it;
182 bool has_changed = d->manager->hasChanged() ||
hasChanged();
183 for (it = d->managerForPage.begin();
184 it != d->managerForPage.end() && !has_changed;
187 has_changed |= (*it)->hasChanged();
192 bool is_default = d->manager->isDefault() &&
isDefault();
193 for (it = d->managerForPage.begin();
194 it != d->managerForPage.end() && is_default;
197 is_default &= (*it)->isDefault();
216 TQMap<TQWidget *, TDEConfigDialogManager *>::iterator it;
219 d->manager->updateWidgets();
220 for (it = d->managerForPage.begin(); it != d->managerForPage.end(); ++it)
221 (*it)->updateWidgets();
223 bool has_changed = d->manager->hasChanged() ||
hasChanged();
224 for (it = d->managerForPage.begin();
225 it != d->managerForPage.end() && !has_changed;
228 has_changed |= (*it)->hasChanged();
233 bool is_default = d->manager->isDefault() &&
isDefault();
234 for (it = d->managerForPage.begin();
235 it != d->managerForPage.end() && is_default;
238 is_default &= (*it)->isDefault();
259 #include "tdeconfigdialog.moc"
A dialog base class with standard buttons and predefined layouts.
void enableButton(ButtonCode id, bool state)
Enable or disable (gray out) a general action button.
TQVBox * addVBoxPage(const TQString &itemName, const TQString &header=TQString::null, const TQPixmap &pixmap=TQPixmap())
Add a page to the dialog when the class is used in TreeList, IconList or Tabbed mode.
void setMainWidget(TQWidget *widget)
Sets the main user definable widget.
void applyClicked()
The Apply button was pressed.
TQFrame * plainPage()
Retrieve the empty page when the predefined layout is used in Plain mode.
void defaultClicked()
The Default button was pressed.
@ Default
Show Default button.
@ Apply
Show Apply button.
void okClicked()
The OK button was pressed.
Standard KDE configuration dialog class.
virtual bool hasChanged()
Returns whether the current state of the dialog is different from the current configutation.
void addPage(TQWidget *page, const TQString &itemName, const TQString &pixmapName, const TQString &header=TQString::null, bool manage=true)
Adds page to the dialog and to TDEConfigDialogManager.
virtual bool isDefault()
Returns whether the current state of the dialog is the same as the default configuration.
void updateButtons()
Updates the Apply and Default buttons.
void settingsChangedSlot()
Some setting was changed.
virtual void show()
Show the dialog.
~TDEConfigDialog()
Deconstructor, removes name from the list of open dialogs.
static bool showDialog(const char *name)
Attempts to show the dialog with the name 'name'.
virtual void updateWidgetsDefault()
Update the dialog based on the default settings.
TDEConfigDialog(TQWidget *parent, const char *name, TDEConfigSkeleton *config, DialogType dialogType=IconList, int dialogButtons=Default|Ok|Apply|Cancel|Help, ButtonCode defaultButton=Ok, bool modal=false)
static TDEConfigDialog * exists(const char *name)
See if a dialog with the name 'name' already exists.
void settingsChanged()
One or more of the settings have been permanently changed such as if the user clicked on the Apply or...
virtual void updateWidgets()
Update the dialog based on the settings.
void widgetModified()
A widget in the dialog was modified.
virtual void updateSettings()
Update the settings from the dialog.
kdbgstream kdDebug(int area=0)