add more spacing
[personal-kdebase.git] / workspace / khotkeys / kcm_hotkeys / hotkeys_widget_base.cpp
blob4a36953502ef63bc1cff9f1a1b0593f3c9cbdc5f
1 /*
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 "hotkeys_widget_base.h"
22 #include "action_data/action_data_group.h"
24 #include <KDE/KDebug>
27 HotkeysWidgetBase::HotkeysWidgetBase( QWidget *parent )
28 : HotkeysWidgetIFace(parent)
30 ui.setupUi( this );
31 layout()->setContentsMargins(0,0,0,0);
33 connect(
34 ui.comment, SIGNAL(textChanged()),
35 _changedSignals, SLOT(map()) );
36 _changedSignals->setMapping(ui.enabled, "enabled" );
37 connect(
38 ui.enabled, SIGNAL(stateChanged(int)),
39 _changedSignals, SLOT(map()) );
40 _changedSignals->setMapping(ui.comment, "comment" );
44 HotkeysWidgetBase::~HotkeysWidgetBase()
49 void HotkeysWidgetBase::apply()
51 HotkeysWidgetIFace::apply();
52 emit changed(_data);
56 bool HotkeysWidgetBase::isChanged() const
58 return _data->comment() != ui.comment->toPlainText()
59 || _data->enabled() != ui.enabled->isChecked();
63 void HotkeysWidgetBase::doCopyFromObject()
65 ui.enabled->setChecked( _data->enabled() );
66 if ( _data->parent() && !_data->parent()->enabled() )
68 // The parent is disabled. Don't allow changing the enabled state for
69 // this action because it wouldn't have any effect
70 ui.enabled->setEnabled(false);
71 ui.enabled_comment->setText( i18n( "Parent group is disabled" ) );
73 else
75 ui.enabled->setEnabled(true);
76 ui.enabled_comment->setText( QString() );
78 ui.comment->setText( _data->comment() );
82 void HotkeysWidgetBase::doCopyToObject()
84 _data->set_enabled( ui.enabled->isChecked() );
85 _data->set_comment( ui.comment->toPlainText() );
89 #include "moc_hotkeys_widget_base.cpp"