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

KUtils

  • sources
  • kde-4.14
  • kdelibs
  • kutils
  • ksettings
dialog.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2003 Matthias Kretz <kretz@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 
18 */
19 
20 #include "dialog.h"
21 #include "dialog_p.h"
22 
23 #include "dispatcher.h"
24 //#include "componentsdialog_p.h"
25 
26 #include <klocale.h>
27 #include <kservicegroup.h>
28 #include <kdebug.h>
29 #include <kservicetypetrader.h>
30 #include <kconfig.h>
31 #include <kstandarddirs.h>
32 #include <kcomponentdata.h>
33 #include <kiconloader.h>
34 #include <QtCore/QFile>
35 #include <QtGui/QCheckBox>
36 #include <QtCore/QStack>
37 
38 uint qHash(const KCModuleInfo &info)
39 {
40  return qHash(info.fileName());
41 }
42 
43 namespace KSettings
44 {
45 
46 Dialog::Dialog(QWidget *parent)
47  : KCMultiDialog(*new DialogPrivate, new KPageWidget, parent)
48 {
49 }
50 
51 Dialog::Dialog(const QStringList &components, QWidget *parent)
52  : KCMultiDialog(*new DialogPrivate, new KPageWidget, parent)
53 {
54  Q_D(Dialog);
55  d->components = components;
56 }
57 
58 Dialog::~Dialog()
59 {
60 }
61 
62 void Dialog::setAllowComponentSelection(bool selection)
63 {
64  d_func()->staticlistview = !selection;
65 }
66 
67 bool Dialog::allowComponentSelection() const
68 {
69  return !d_func()->staticlistview;
70 }
71 
72 void Dialog::setKCMArguments(const QStringList& arguments)
73 {
74  Q_D(Dialog);
75  d->arguments = arguments;
76 }
77 
78 void Dialog::setComponentBlacklist(const QStringList& blacklist)
79 {
80  Q_D(Dialog);
81  d->componentBlacklist = blacklist;
82 }
83 
84 void Dialog::addPluginInfos(const KPluginInfo::List &plugininfos)
85 {
86  Q_D(Dialog);
87  for (KPluginInfo::List::ConstIterator it = plugininfos.begin();
88  it != plugininfos.end(); ++it ) {
89  d->registeredComponents.append(it->pluginName());
90  if (it->kcmServices().isEmpty()) {
91  // this plugin has no kcm services, still we want to show the disable/enable stuff
92  // so add a dummy kcm
93  KService::Ptr service = it->service();
94  d->kcmInfos << KCModuleInfo(service);
95  continue;
96  }
97  foreach (const KService::Ptr &service, it->kcmServices()) {
98  d->kcmInfos << KCModuleInfo(service);
99  }
100  }
101 
102  // The plugin, when disabled, disables all the KCMs described by kcmServices().
103  // - Normally they are grouped using a .setdlg file so that the group parent can get a
104  // checkbox to enable/disable the plugin.
105  // - If the plugin does not belong to a group and has only one KCM the checkbox can be
106  // used with this KCM.
107  // - If the plugin belongs to a group but there are other modules in the group that do not
108  // belong to this plugin we give a kError and show no checkbox
109  // - If the plugin belongs to multiple groups we give a kError and show no checkbox
110  d->plugininfos = plugininfos;
111 }
112 
113 KPluginInfo::List Dialog::pluginInfos() const
114 {
115  return d_func()->plugininfos;
116 }
117 
118 void Dialog::showEvent(QShowEvent *)
119 {
120  Q_D(Dialog);
121  if (d->firstshow) {
122  setUpdatesEnabled(false);
123  d->kcmInfos += d->instanceServices();
124  if (!d->components.isEmpty()) {
125  d->kcmInfos += d->parentComponentsServices(d->components);
126  }
127  d->createDialogFromServices();
128  d->firstshow = false;
129  setUpdatesEnabled(true);
130  }
131  Dispatcher::syncConfiguration();
132 }
133 
134 DialogPrivate::DialogPrivate()
135  : staticlistview(true), firstshow(true), pluginStateDirty(0)
136 {
137 }
138 
139 QSet<KCModuleInfo> DialogPrivate::instanceServices()
140 {
141  //kDebug(700) ;
142  QString componentName = KGlobal::mainComponent().componentName();
143  registeredComponents.append(componentName);
144  //kDebug(700) << "calling KServiceGroup::childGroup( " << componentName << " )";
145  KServiceGroup::Ptr service = KServiceGroup::childGroup( componentName );
146 
147  QSet<KCModuleInfo> ret;
148 
149  if( service && service->isValid() )
150  {
151  //kDebug(700) << "call was successful";
152  const KServiceGroup::List list = service->entries();
153  for( KServiceGroup::List::ConstIterator it = list.begin();
154  it != list.end(); ++it )
155  {
156  KSycocaEntry::Ptr p = (*it);
157  if( p->isType( KST_KService ) )
158  {
159  //kDebug( 700 ) << "found service";
160  ret << KCModuleInfo(KService::Ptr::staticCast(p));
161  }
162  else
163  kWarning( 700 ) << "KServiceGroup::childGroup returned"
164  " something else than a KService" << endl;
165  }
166  }
167 
168  return ret;
169 }
170 
171 QSet<KCModuleInfo> DialogPrivate::parentComponentsServices(const QStringList &kcdparents)
172 {
173  registeredComponents += kcdparents;
174  QString constraint = kcdparents.join("' in [X-KDE-ParentComponents]) or ('");
175  constraint = "('" + constraint + "' in [X-KDE-ParentComponents])";
176 
177  //kDebug(700) << "constraint = " << constraint;
178  const QList<KService::Ptr> services = KServiceTypeTrader::self()->query("KCModule", constraint);
179  QSet<KCModuleInfo> ret;
180  foreach (const KService::Ptr &service, services) {
181  ret << KCModuleInfo(service);
182  }
183  return ret;
184 }
185 
186 bool DialogPrivate::isPluginForKCMEnabled(const KCModuleInfo *moduleinfo, KPluginInfo &pinfo) const
187 {
188  // if the user of this class requested to hide disabled modules
189  // we check whether it should be enabled or not
190  bool enabled = true;
191  //kDebug(700) << "check whether the '" << moduleinfo->moduleName() << "' KCM should be shown";
192  // for all parent components
193  const QStringList parentComponents = moduleinfo->service()->property(
194  "X-KDE-ParentComponents" ).toStringList();
195  for( QStringList::ConstIterator pcit = parentComponents.begin();
196  pcit != parentComponents.end(); ++pcit )
197  {
198  // if the parentComponent is not registered ignore it
199  if (!registeredComponents.contains(*pcit)) {
200  continue;
201  }
202 
203  // we check if the parent component is a plugin
204  // if not the KCModule must be enabled
205  enabled = true;
206  if (pinfo.pluginName() == *pcit) {
207  // it is a plugin: we check whether the plugin is enabled
208  pinfo.load();
209  enabled = pinfo.isPluginEnabled();
210  //kDebug(700) << "parent " << *pcit << " is " << (enabled ? "enabled" : "disabled");
211  }
212  // if it is enabled we're done for this KCModuleInfo
213  if (enabled) {
214  return true;
215  }
216  }
217  return enabled;
218 }
219 
220 bool DialogPrivate::isPluginImmutable(const KPluginInfo &pinfo) const
221 {
222  return pinfo.property("X-KDE-PluginInfo-Immutable").toBool();
223 }
224 
225 KPageWidgetItem *DialogPrivate::createPageItem(KPageWidgetItem *parentItem,
226  const QString &name, const QString &comment,
227  const QString &iconName, int weight)
228 {
229  Q_Q(Dialog);
230  QWidget * page = new QWidget( q );
231 
232  QCheckBox *checkBox = new QCheckBox(i18n("Enable component"), page);
233  QLabel *iconLabel = new QLabel(page);
234  QLabel *commentLabel = new QLabel(comment, page);
235  commentLabel->setTextFormat(Qt::RichText);
236  QVBoxLayout * layout = new QVBoxLayout(page);
237  layout->addWidget(checkBox);
238  layout->addWidget(iconLabel);
239  layout->addWidget(commentLabel);
240  layout->addStretch();
241  page->setLayout(layout);
242 
243  KPageWidgetItem *item = new KPageWidgetItem(page, name);
244  item->setIcon(KIcon(iconName));
245  iconLabel->setPixmap(item->icon().pixmap(128, 128));
246  item->setProperty("_k_weight", weight);
247  checkBoxForItem.insert(item, checkBox);
248 
249  const KPageWidgetModel *model = qobject_cast<const KPageWidgetModel *>(q->pageWidget()->model());
250  Q_ASSERT(model);
251 
252  if (parentItem) {
253  const QModelIndex parentIndex = model->index(parentItem);
254  const int siblingCount = model->rowCount(parentIndex);
255  int row = 0;
256  for (; row < siblingCount; ++row) {
257  KPageWidgetItem *siblingItem = model->item(parentIndex.child(row, 0));
258  if (siblingItem->property("_k_weight").toInt() > weight) {
259  // the item we found is heavier than the new module
260  q->insertPage(siblingItem, item);
261  break;
262  }
263  }
264  if (row == siblingCount) {
265  // the new module is either the first or the heaviest item
266  q->addSubPage(parentItem, item);
267  }
268  } else {
269  const int siblingCount = model->rowCount();
270  int row = 0;
271  for (; row < siblingCount; ++row) {
272  KPageWidgetItem *siblingItem = model->item(model->index(row, 0));
273  if (siblingItem->property("_k_weight").toInt() > weight) {
274  // the item we found is heavier than the new module
275  q->insertPage(siblingItem, item);
276  break;
277  }
278  }
279  if (row == siblingCount) {
280  // the new module is either the first or the heaviest item
281  q->addPage(item);
282  }
283  }
284 
285  return (item);
286 }
287 
288 void DialogPrivate::parseGroupFile( const QString & filename )
289 {
290  KConfig file( filename, KConfig::SimpleConfig );
291  const QStringList groups = file.groupList();
292  foreach (const QString &group, groups) {
293  if (group.isEmpty()) {
294  continue;
295  }
296  KConfigGroup conf(&file, group);
297 
298  const QString parentId = conf.readEntry("Parent");
299  KPageWidgetItem *parentItem = pageItemForGroupId.value(parentId);
300  KPageWidgetItem *item = createPageItem(parentItem, conf.readEntry("Name"), conf.readEntry("Comment"),
301  conf.readEntry("Icon"), conf.readEntry("Weight", 100));
302  pageItemForGroupId.insert(group, item);
303  }
304 }
305 
306 void DialogPrivate::createDialogFromServices()
307 {
308  Q_Q(Dialog);
309  // read .setdlg files
310  QString setdlgpath = KStandardDirs::locate( "appdata",
311  KGlobal::mainComponent().componentName() + ".setdlg" );
312  const QStringList setdlgaddon = KGlobal::dirs()->findAllResources( "appdata",
313  "ksettingsdialog/*.setdlg" );
314  if (!setdlgpath.isNull()) {
315  parseGroupFile(setdlgpath);
316  }
317  if (setdlgaddon.size() > 0) {
318  for (QStringList::ConstIterator it = setdlgaddon.begin(); it != setdlgaddon.end(); ++it) {
319  parseGroupFile(*it);
320  }
321  }
322 
323  //kDebug(700) << kcmInfos.count();
324  foreach (const KCModuleInfo &info, kcmInfos) {
325  const QStringList parentComponents = info.service()->property("X-KDE-ParentComponents").toStringList();
326  bool blacklisted = false;
327  foreach (const QString &parentComponent, parentComponents) {
328  if (componentBlacklist.contains(parentComponent)) {
329  blacklisted = true;
330  break;
331  }
332  }
333  if (blacklisted) {
334  continue;
335  }
336  const QString parentId = info.service()->property("X-KDE-CfgDlgHierarchy", QVariant::String).toString();
337  KPageWidgetItem *parent = pageItemForGroupId.value(parentId);
338  if (!parent) {
339  // dummy kcm
340  bool foundPlugin = false;
341  foreach (const KPluginInfo &pinfo, plugininfos) {
342  if (pinfo.service() == info.service()) {
343  if (!pinfo.kcmServices().count()) {
344  const KService::Ptr service = info.service();
345  // FIXME get weight from service or plugin info
346  const int weight = 1000;
347  KPageWidgetItem *item = createPageItem(0, service->name(), service->comment(), service->icon(), weight);
348  connectItemCheckBox(item, pinfo, pinfo.isPluginEnabled());
349  foundPlugin = true;
350  break;
351  }
352  }
353  }
354  if (foundPlugin) {
355  continue;
356  }
357  }
358  KPageWidgetItem *item = q->addModule(info, parent, arguments);
359  kDebug(700) << "added KCM '" << info.moduleName() << "'";
360  foreach (KPluginInfo pinfo, plugininfos) {
361  kDebug(700) << pinfo.pluginName();
362  if (pinfo.kcmServices().contains(info.service())) {
363  const bool isEnabled = isPluginForKCMEnabled(&info, pinfo);
364  kDebug(700) << "correct KPluginInfo for this KCM";
365  // this KCM belongs to a plugin
366  if (parent && pinfo.kcmServices().count() >= 1) {
367  item->setEnabled(isEnabled);
368  const KPluginInfo &plugin = pluginForItem.value(parent);
369  if (plugin.isValid()) {
370  if (plugin != pinfo) {
371  kError(700) << "A group contains more than one plugin: '"
372  << plugin.pluginName() << "' and '" << pinfo.pluginName()
373  << "'. Now it won't be possible to enable/disable the plugin."
374  << endl;
375  parent->setCheckable(false);
376  q->disconnect(parent, SIGNAL(toggled(bool)), q, SLOT(_k_updateEnabledState(bool)));
377  }
378  // else everything is fine
379  } else {
380  connectItemCheckBox(parent, pinfo, isEnabled);
381  }
382  } else {
383  pluginForItem.insert(item, pinfo);
384  item->setCheckable(!isPluginImmutable(pinfo));
385  item->setChecked(isEnabled);
386  q->connect(item, SIGNAL(toggled(bool)), q, SLOT(_k_updateEnabledState(bool)));
387  }
388  break;
389  }
390  }
391  }
392  // now that the KCMs are in, check for empty groups and remove them again
393  {
394  const KPageWidgetModel *model = qobject_cast<const KPageWidgetModel *>(q->pageWidget()->model());
395  const QHash<QString, KPageWidgetItem *>::ConstIterator end = pageItemForGroupId.constEnd();
396  QHash<QString, KPageWidgetItem *>::ConstIterator it = pageItemForGroupId.constBegin();
397  for (; it != end; ++it) {
398  const QModelIndex index = model->index(it.value());
399  KPluginInfo pinfo;
400  foreach (const KPluginInfo &p, plugininfos) {
401  if (p.name()==it.key()) {
402  pinfo = p;
403  break;
404  }
405  }
406  bool allowEmpty = false;
407  if (pinfo.isValid()) {
408  allowEmpty = pinfo.property("X-KDE-PluginInfo-AllowEmptySettings").toBool();
409  }
410 
411  if (!index.child(0, 0).isValid()) {
412  // no children, and it's not allowed => remove this item
413  if (!allowEmpty) {
414  q->removePage(it.value());
415  } else {
416  connectItemCheckBox(it.value(), pinfo, pinfo.isPluginEnabled());
417  }
418  }
419  }
420  }
421 
422  // TODO: Don't show the reset button until the issue with the
423  // KPluginSelector::load() method is solved.
424  // Problem:
425  // KCMultiDialog::show() call KCModule::load() to reset all KCMs
426  // (KPluginSelector::load() resets all plugin selections and all plugin
427  // KCMs).
428  // The reset button calls KCModule::load(), too but in this case we want the
429  // KPluginSelector to only reset the current visible plugin KCM and not
430  // touch the plugin selections.
431  // I have no idea how to check that in KPluginSelector::load()...
432  //q->showButton(KDialog::User1, true);
433 
434  QObject::connect(q, SIGNAL(okClicked()), q, SLOT(_k_syncConfiguration()));
435  QObject::connect(q, SIGNAL(applyClicked()), q, SLOT(_k_syncConfiguration()));
436  QObject::connect(q, SIGNAL(configCommitted(QByteArray)), q,
437  SLOT(_k_reparseConfiguration(QByteArray)));
438 }
439 
440 void DialogPrivate::connectItemCheckBox(KPageWidgetItem *item, const KPluginInfo &pinfo, bool isEnabled)
441 {
442  Q_Q(Dialog);
443  QCheckBox *checkBox = checkBoxForItem.value(item);
444  Q_ASSERT(checkBox);
445  pluginForItem.insert(item, pinfo);
446  item->setCheckable(!isPluginImmutable(pinfo));
447  item->setChecked(isEnabled);
448  checkBox->setVisible(!isPluginImmutable(pinfo));
449  checkBox->setChecked(isEnabled);
450  q->connect(item, SIGNAL(toggled(bool)), q, SLOT(_k_updateEnabledState(bool)));
451  q->connect(item, SIGNAL(toggled(bool)), checkBox, SLOT(setChecked(bool)));
452  q->connect(checkBox, SIGNAL(clicked(bool)), item, SLOT(setChecked(bool)));
453 }
454 
455 void DialogPrivate::_k_syncConfiguration()
456 {
457  Q_Q(Dialog);
458  const QHash<KPageWidgetItem *, KPluginInfo>::Iterator endIt = pluginForItem.end();
459  QHash<KPageWidgetItem *, KPluginInfo>::Iterator it = pluginForItem.begin();
460  for (; it != endIt; ++it) {
461  KPageWidgetItem *item = it.key();
462  KPluginInfo pinfo = it.value();
463  pinfo.setPluginEnabled(item->isChecked());
464  pinfo.save();
465  }
466  if (pluginStateDirty > 0) {
467  emit q->pluginSelectionChanged();
468  pluginStateDirty = 0;
469  }
470  Dispatcher::syncConfiguration();
471 }
472 
473 void DialogPrivate::_k_reparseConfiguration(const QByteArray &a)
474 {
475  Dispatcher::reparseConfiguration(a);
476 }
477 
478 /*
479 void DialogPrivate::_k_configureTree()
480 {
481  kDebug( 700 ) ;
482  QObject::connect(subdlg, SIGNAL(okClicked()), q, SLOT(_k_updateTreeList()));
483  QObject::connect(subdlg, SIGNAL(applyClicked()), q, SLOT(_k_updateTreeList()));
484  QObject::connect(subdlg, SIGNAL(okClicked()), q, SIGNAL(pluginSelectionChanged()));
485  QObject::connect(subdlg, SIGNAL(applyClicked()), q, SIGNAL(pluginSelectionChanged()));
486 }
487 */
488 
489 void DialogPrivate::_k_clientChanged()
490 {
491  if (pluginStateDirty > 0) {
492  Q_Q(Dialog);
493  q->enableButton(KDialog::Apply, true);
494  } else {
495  KCMultiDialogPrivate::_k_clientChanged();
496  }
497 }
498 
499 void DialogPrivate::_k_updateEnabledState(bool enabled)
500 {
501  Q_Q(Dialog);
502  KPageWidgetItem *item = qobject_cast<KPageWidgetItem *>(q->sender());
503  if (!item) {
504  kWarning(700) << "invalid sender";
505  return;
506  }
507 
508  // iterate over all child KPageWidgetItem objects and check whether they need to be enabled/disabled
509  const KPageWidgetModel *model = qobject_cast<const KPageWidgetModel *>(q->pageWidget()->model());
510  Q_ASSERT(model);
511  QModelIndex index = model->index(item);
512  if (!index.isValid()) {
513  kWarning(700) << "could not find item in model";
514  return;
515  }
516 
517  const KPluginInfo &pinfo = pluginForItem.value(item);
518  if (!pinfo.isValid()) {
519  kWarning(700) << "could not find KPluginInfo in item";
520  return;
521  }
522  if (pinfo.isPluginEnabled() != enabled) {
523  ++pluginStateDirty;
524  } else {
525  --pluginStateDirty;
526  }
527  if (pluginStateDirty < 2) {
528  _k_clientChanged();
529  }
530 
531  //kDebug(700) ;
532 
533  QModelIndex firstborn = index.child(0, 0);
534  if (firstborn.isValid()) {
535  //kDebug(700) << "iterating over children";
536  // change all children
537  index = firstborn;
538  QStack<QModelIndex> stack;
539  while (index.isValid()) {
540  //kDebug(700) << index;
541  KPageWidgetItem *item = model->item(index);
542  //kDebug(700) << "item->setEnabled(" << enabled << ')';
543  item->setEnabled(enabled);
544  firstborn = index.child(0, 0);
545  if (firstborn.isValid()) {
546  stack.push(index);
547  index = firstborn;
548  } else {
549  index = index.sibling(index.row() + 1, 0);
550  while (!index.isValid() && !stack.isEmpty()) {
551  index = stack.pop();
552  index = index.sibling(index.row() + 1, 0);
553  }
554  }
555  }
556  }
557 }
558 
559 } //namespace
560 
561 #include "dialog.moc"
562 
563 // vim: ts=4
KSettings::Dialog::~Dialog
~Dialog()
Definition: dialog.cpp:58
i18n
QString i18n(const char *text)
KSettings::Dialog::pluginInfos
QList< KPluginInfo > pluginInfos() const
Returns a list of all KPluginInfo objects the dialog uses.
Definition: dialog.cpp:113
kservicegroup.h
QModelIndex
KSharedPtr< KService >
QWidget
KPluginInfo
KSettings::DialogPrivate::pageItemForGroupId
QHash< QString, KPageWidgetItem * > pageItemForGroupId
Definition: dialog_p.h:51
QHash::insert
iterator insert(const Key &key, const T &value)
KSettings::DialogPrivate::_k_reparseConfiguration
void _k_reparseConfiguration(const QByteArray &a)
Definition: dialog.cpp:473
KPluginInfo::property
QVariant property(const QString &key) const
KSettings::DialogPrivate::_k_syncConfiguration
void _k_syncConfiguration()
Definition: dialog.cpp:455
KSettings::DialogPrivate::kcmInfos
QSet< KCModuleInfo > kcmInfos
Definition: dialog_p.h:57
kdebug.h
QHash::key
const Key key(const T &value) const
QStack::pop
T pop()
KSettings::DialogPrivate::_k_clientChanged
virtual void _k_clientChanged()
Definition: dialog.cpp:489
KCModuleLoader::Dialog
shows a dialog with the error report
Definition: kcmoduleloader.h:61
QByteArray
KPageWidgetItem::setChecked
void setChecked(bool checked)
KServiceTypeTrader::self
static KServiceTypeTrader * self()
KPluginInfo::isPluginEnabled
bool isPluginEnabled() const
KPluginInfo::service
KService::Ptr service() const
KStandardDirs::locate
static QString locate(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
QStack::push
void push(const T &t)
kconfig.h
QLabel::setPixmap
void setPixmap(const QPixmap &)
KService::property
QVariant property(const QString &_name, QVariant::Type t) const
KPluginInfo::isValid
bool isValid() const
KGlobal::dirs
KStandardDirs * dirs()
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QWidget::setVisible
virtual void setVisible(bool visible)
kError
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KConfig::SimpleConfig
kiconloader.h
KPageWidgetModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
QStringList::join
QString join(const QString &separator) const
KPageWidgetModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
KService::comment
QString comment() const
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
klocale.h
qHash
uint qHash(const KCModuleInfo &info)
Definition: dialog.cpp:38
KPageWidgetItem::setEnabled
void setEnabled(bool)
KPageWidgetModel
QIcon::pixmap
QPixmap pixmap(const QSize &size, Mode mode, State state) const
KSettings::Dispatcher::syncConfiguration
void syncConfiguration()
When this function is called the KConfig objects of all the registered instances are sync()ed...
Definition: dispatcher.cpp:97
QList::size
int size() const
QString::isNull
bool isNull() const
KPageWidgetItem::setIcon
void setIcon(const KIcon &icon)
KSettings::Dialog::Dialog
Dialog(QWidget *parent=0)
Construct a new Preferences Dialog for the application.
Definition: dialog.cpp:46
kservicetypetrader.h
QModelIndex::isValid
bool isValid() const
KPluginInfo::load
void load(const KConfigGroup &config=KConfigGroup())
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
KPageWidgetItem::icon
KIcon icon
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
QObject::property
QVariant property(const char *name) const
QWidget::setLayout
void setLayout(QLayout *layout)
QHash::constEnd
const_iterator constEnd() const
QVariant::toInt
int toInt(bool *ok) const
QHash
QShowEvent
QWidget::setUpdatesEnabled
void setUpdatesEnabled(bool enable)
KPluginInfo::setPluginEnabled
void setPluginEnabled(bool enabled)
QCheckBox
KSettings::DialogPrivate::componentBlacklist
QStringList componentBlacklist
Definition: dialog_p.h:58
KPluginInfo::kcmServices
QList< KService::Ptr > kcmServices() const
QString::isEmpty
bool isEmpty() const
QModelIndex::row
int row() const
QHash::begin
iterator begin()
KIcon
QLabel::setTextFormat
void setTextFormat(Qt::TextFormat)
QVBoxLayout
KSettings::DialogPrivate::connectItemCheckBox
void connectItemCheckBox(KPageWidgetItem *item, const KPluginInfo &pinfo, bool isEnabled)
Definition: dialog.cpp:440
KPageWidgetItem::isChecked
bool isChecked() const
QSet< KCModuleInfo >
KComponentData::componentName
QString componentName() const
KSettings::DialogPrivate::pluginStateDirty
quint32 pluginStateDirty
Definition: dialog_p.h:64
QString
QList< KPluginInfo >
KCModuleInfo::fileName
QString fileName() const
Definition: kcmoduleinfo.cpp:141
KSettings::DialogPrivate::plugininfos
KPluginInfo::List plugininfos
Definition: dialog_p.h:54
QStringList
KPageWidget
KSettings::DialogPrivate::arguments
QStringList arguments
Definition: dialog_p.h:59
dialog_p.h
QList::end
iterator end()
QHash::value
const T value(const Key &key) const
KPluginInfo::name
QString name() const
KService::icon
QString icon() const
dispatcher.h
KCModuleInfo
A class that provides information about a KCModule.
Definition: kcmoduleinfo.h:47
KSettings::Dispatcher::reparseConfiguration
void reparseConfiguration(const QString &componentName)
Call this function when the configuration belonging to the associated componentData name has changed...
Definition: dispatcher.cpp:81
QList::contains
bool contains(const T &value) const
KPageWidgetModel::item
KPageWidgetItem * item(const QModelIndex &index) const
QModelIndex::child
QModelIndex child(int row, int column) const
KSettings::Dialog::setComponentBlacklist
void setComponentBlacklist(const QStringList &blacklist)
Set the blacklisted component list.
Definition: dialog.cpp:78
KPluginInfo::save
void save(KConfigGroup config=KConfigGroup())
QAbstractButton::setChecked
void setChecked(bool)
KConfigGroup
KSettings::DialogPrivate
Definition: dialog_p.h:44
QHash::constBegin
const_iterator constBegin() const
KServiceTypeTrader::query
KService::List query(const QString &servicetype, const QString &constraint=QString()) const
KConfig
KServiceGroup::childGroup
static Ptr childGroup(const QString &parent)
dialog.h
QVariant::toStringList
QStringList toStringList() const
KSettings::Dialog::allowComponentSelection
bool allowComponentSelection() const
Definition: dialog.cpp:67
QBoxLayout::addStretch
void addStretch(int stretch)
KSettings::Dialog::setKCMArguments
void setKCMArguments(const QStringList &arguments)
Sets the argument list that is given to all the KControlModule's when they are created.
Definition: dialog.cpp:72
QVector::isEmpty
bool isEmpty() const
QModelIndex::sibling
QModelIndex sibling(int row, int column) const
kstandarddirs.h
KSharedPtr< KService >::staticCast
static KSharedPtr< KService > staticCast(const KSharedPtr< U > &o)
KPageWidgetItem
QList< KPluginInfo >::ConstIterator
typedef ConstIterator
KCModuleInfo::service
KService::Ptr service() const
Definition: kcmoduleinfo.cpp:156
KGlobal::mainComponent
const KComponentData & mainComponent()
QVariant::toBool
bool toBool() const
KSettings::DialogPrivate::DialogPrivate
DialogPrivate()
Definition: dialog.cpp:134
kWarning
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KSettings::DialogPrivate::checkBoxForItem
QHash< KPageWidgetItem *, QCheckBox * > checkBoxForItem
Definition: dialog_p.h:53
KSettings::DialogPrivate::pluginForItem
QHash< KPageWidgetItem *, KPluginInfo > pluginForItem
Definition: dialog_p.h:52
KCMultiDialogPrivate::_k_clientChanged
virtual void _k_clientChanged()
Definition: kcmultidialog.cpp:108
QObject::setProperty
bool setProperty(const char *name, const QVariant &value)
KCMultiDialog
A class that offers a KPageDialog containing arbitrary KControl Modules.
Definition: kcmultidialog.h:37
KStandardDirs::findAllResources
QStringList findAllResources(const char *type, const QString &filter=QString(), SearchOptions options=NoSearchOptions) const
QHash::end
iterator end()
KSettings::Dialog::addPluginInfos
void addPluginInfos(const QList< KPluginInfo > &plugininfos)
If you use a Configurable dialog you need to pass KPluginInfo objects that the dialog should configur...
Definition: dialog.cpp:84
kcomponentdata.h
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QLabel
KSettings::DialogPrivate::createPageItem
KPageWidgetItem * createPageItem(KPageWidgetItem *parentItem, const QString &name, const QString &comment, const QString &iconName, int weight)
Definition: dialog.cpp:225
KSettings::Dialog::showEvent
void showEvent(QShowEvent *)
Reimplemented to lazy create the dialog on first show.
Definition: dialog.cpp:118
KSettings::Dialog::setAllowComponentSelection
void setAllowComponentSelection(bool allowSelection)
Tells the dialog whether the entries in the listview are all static or whether it should add checkbox...
Definition: dialog.cpp:62
end
const KShortcut & end()
QVariant::toString
QString toString() const
QList::begin
iterator begin()
KPageWidgetItem::setCheckable
void setCheckable(bool checkable)
KSettings::Dialog
Generic configuration dialog that works over component boundaries.
Definition: dialog.h:73
KCModuleInfo::moduleName
QString moduleName() const
Definition: kcmoduleinfo.cpp:151
QStack
KSettings::DialogPrivate::_k_updateEnabledState
void _k_updateEnabledState(bool)
Definition: dialog.cpp:499
KPluginInfo::pluginName
QString pluginName() const
list
QStringList list(const QString &fileClass)
KSettings::DialogPrivate::registeredComponents
QStringList registeredComponents
Definition: dialog_p.h:56
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KUtils

Skip menu "KUtils"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • 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