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

krdc

  • sources
  • kde-4.12
  • kdenetwork
  • krdc
  • config
preferencesdialog.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2007 - 2010 Urs Wolfer <uwolfer @ kde.org>
4 **
5 ** This file is part of KDE.
6 **
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; see the file COPYING. If not, write to
19 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ** Boston, MA 02110-1301, USA.
21 **
22 ****************************************************************************/
23 
24 #include "preferencesdialog.h"
25 
26 #include "hostpreferenceslist.h"
27 #include "ui_general.h"
28 
29 #include <KConfigSkeleton>
30 #include <KDebug>
31 #include <KPluginSelector>
32 #include <KService>
33 #include <KServiceTypeTrader>
34 #include <KPluginInfo>
35 
36 PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton)
37  : KConfigDialog(parent, "preferences", skeleton)
38  , m_settingsChanged(false)
39 {
40  QWidget *generalPage = new QWidget(this);
41  Ui::General generalUi;
42  generalUi.setupUi(generalPage);
43  addPage(generalPage, i18nc("General Config", "General"), "krdc", i18n("General Configuration"));
44 
45  HostPreferencesList *hostPreferencesList = new HostPreferencesList(this,
46  qobject_cast<MainWindow *>(parent),
47  skeleton->config()->group("hostpreferences"));
48  addPage(hostPreferencesList, i18n("Hosts"), "computer", i18n("Host Configuration"));
49 
50  m_pluginSelector = new KPluginSelector();
51  KService::List offers = KServiceTypeTrader::self()->query("KRDC/Plugin");
52  m_pluginSelector->addPlugins(KPluginInfo::fromServices(offers), KPluginSelector::ReadConfigFile,
53  i18n("Plugins"), "Service", KGlobal::config());
54  m_pluginSelector->load();
55  addPage(m_pluginSelector, i18n("Plugins"), "preferences-plugin", i18n("Plugin Configuration"));
56 
57  connect(this, SIGNAL(accepted()), SLOT(saveState()));
58  connect(this, SIGNAL(defaultClicked()), SLOT(loadDefaults()));
59  connect(m_pluginSelector, SIGNAL(changed(bool)), SLOT(settingsChanged()));
60 }
61 
62 void PreferencesDialog::saveState()
63 {
64  //TODO: relaod plugins at runtime?
65  m_pluginSelector->save();
66 }
67 
68 void PreferencesDialog::loadDefaults()
69 {
70  m_pluginSelector->defaults();
71  enableButton(Default, false);
72 }
73 
74 void PreferencesDialog::settingsChanged()
75 {
76  enableButton(Apply, true);
77  enableButton(Default, true);
78 }
79 
80 bool PreferencesDialog::isDefault()
81 {
82  return KConfigDialog::isDefault() && m_pluginSelector->isDefault();
83 }
PreferencesDialog::isDefault
virtual bool isDefault()
Definition: preferencesdialog.cpp:80
hostpreferenceslist.h
QWidget
KConfigSkeleton
KConfigDialog
preferencesdialog.h
HostPreferencesList
Definition: hostpreferenceslist.h:38
PreferencesDialog::PreferencesDialog
PreferencesDialog(QWidget *parent, KConfigSkeleton *config)
Definition: preferencesdialog.cpp:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:54:04 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

krdc

Skip menu "krdc"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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