2 Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
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 as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "global_settings_widget.h"
23 #include <KDesktopFile>
25 #include <KStandardDirs>
28 GlobalSettingsWidget::GlobalSettingsWidget( QWidget
*parent
)
29 : HotkeysWidgetIFace( parent
)
32 layout()->setContentsMargins(0,0,0,0);
34 QString path
= KGlobal::dirs()->findResource( "services", "kded/khotkeys.desktop");
35 if ( KDesktopFile::isDesktopFile(path
) )
37 _config
= KSharedConfig::openConfig(
44 ui
.enabled
, SIGNAL(stateChanged(int)),
45 _changedSignals
, SLOT(map()) );
46 _changedSignals
->setMapping(ui
.enabled
, "enabled" );
50 GlobalSettingsWidget::~GlobalSettingsWidget()
55 void GlobalSettingsWidget::doCopyFromObject()
59 KConfigGroup
file(_config
, "Desktop Entry");
60 ui
.enabled
->setChecked(file
.readEntry("X-KDE-Kded-autoload", false));
65 void GlobalSettingsWidget::doCopyToObject()
70 KConfigGroup
file(_config
, "Desktop Entry");
71 file
.writeEntry("X-KDE-Kded-autoload", ui
.enabled
->checkState()==Qt::Checked
);
77 bool GlobalSettingsWidget::isChanged() const
81 KConfigGroup
file(_config
, "Desktop Entry");
82 bool enabled
= file
.readEntry("X-KDE-Kded-autoload", false);
84 if ( enabled
&& ( ui
.enabled
->checkState() != Qt::Checked
) )
89 if ( !enabled
&& ( ui
.enabled
->checkState() != Qt::Unchecked
) )
98 #include "moc_global_settings_widget.cpp"