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 "simple_action_data_widget.h"
22
#include "actions/command_url_action_widget.h"
23
#include "actions/dbus_action_widget.h"
24
#include "actions/menuentry_action_widget.h"
25
#include "actions/keyboard_input_action_widget.h"
26
#include "triggers/shortcut_trigger_widget.h"
27
#include "triggers/window_trigger_widget.h"
28
#include "triggers/gesture_trigger_widget.h"
33
SimpleActionDataWidget::SimpleActionDataWidget( QWidget *parent )
34
: HotkeysWidgetBase( parent )
40
SimpleActionDataWidget::~SimpleActionDataWidget()
42
delete currentTrigger;
47
bool SimpleActionDataWidget::isChanged() const
49
return ( currentTrigger && currentTrigger->isChanged() )
50
|| ( currentAction && currentAction->isChanged() )
55
void SimpleActionDataWidget::doCopyFromObject()
57
Base::doCopyFromObject();
61
currentTrigger->copyFromObject();
66
currentAction->copyFromObject();
72
void SimpleActionDataWidget::doCopyToObject()
74
Base::doCopyToObject();
78
currentTrigger->copyToObject();
83
currentAction->copyToObject();
88
void SimpleActionDataWidget::setActionData( KHotKeys::SimpleActionData* pData )
92
// Now go and work on the trigger
93
delete currentTrigger; currentTrigger = NULL;
95
if ( KHotKeys::Trigger *trg = data()->trigger() )
97
switch ( trg->type() )
99
case KHotKeys::Trigger::ShortcutTriggerType:
101
currentTrigger = new ShortcutTriggerWidget( static_cast<KHotKeys::ShortcutTrigger*>(trg) );
104
case KHotKeys::Trigger::WindowTriggerType:
106
currentTrigger = new WindowTriggerWidget( static_cast<KHotKeys::WindowTrigger*>(trg) );
109
case KHotKeys::Trigger::GestureTriggerType:
111
currentTrigger = new GestureTriggerWidget( static_cast<KHotKeys::GestureTrigger*>(trg) );
115
kDebug() << "Unknown trigger type";
122
currentTrigger, SIGNAL(changed(bool)),
123
this, SLOT(slotChanged() ));
124
extend(currentTrigger, i18n("Trigger"));
127
// Now go and work on the action
128
delete currentAction; currentAction = NULL;
130
if ( KHotKeys::Action *act = data()->action() )
132
switch ( act->type() )
134
case KHotKeys::Action::MenuEntryActionType:
135
currentAction = new MenuentryActionWidget( static_cast<KHotKeys::MenuEntryAction*>(act) );
138
case KHotKeys::Action::DBusActionType:
139
currentAction = new DbusActionWidget( static_cast<KHotKeys::DBusAction*>(act) );
142
case KHotKeys::Action::CommandUrlActionType:
143
currentAction = new CommandUrlActionWidget( static_cast<KHotKeys::CommandUrlAction*>(act) );
146
case KHotKeys::Action::KeyboardInputActionType:
147
currentAction = new KeyboardInputActionWidget( static_cast<KHotKeys::KeyboardInputAction*>(act) );
151
kDebug() << "Unknown action type";
158
currentAction, SIGNAL(changed(bool)),
159
this, SLOT(slotChanged() ));
160
extend(currentAction, i18n("Action"));
163
Base::copyFromObject();
168
#include "moc_simple_action_data_widget.cpp"