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.h"
22 #include "conditions/conditions.h"
24 #include <KDE/KConfigGroup>
30 SimpleActionData::SimpleActionData(
31 ActionDataGroup
* parent_P
,
32 const QString
& name_P
,
33 const QString
& comment_P
,
40 new Condition_list( "", this ),
46 SimpleActionData::SimpleActionData( KConfigGroup
& cfg_P
, ActionDataGroup
* parent_P
)
47 : ActionData( cfg_P
, parent_P
)
51 void SimpleActionData::cfg_write( KConfigGroup
& cfg_P
) const
53 base::cfg_write( cfg_P
);
54 cfg_P
.writeEntry( "Type", "SIMPLE_ACTION_DATA" );
58 void SimpleActionData::set_action( Action
* action_P
)
60 ActionList
* tmp
= new ActionList( "Simple_action_data" );
61 tmp
->append( action_P
);
66 void SimpleActionData::set_trigger( Trigger
* trigger_P
)
68 Trigger_list
* tmp
= new Trigger_list( "Simple_action" );
69 tmp
->append( trigger_P
);
74 const Action
* SimpleActionData::action() const
76 if( actions() == 0 || actions()->isEmpty() )
78 return actions()->first();
82 Action
* SimpleActionData::action()
84 if( actions() == 0 || actions()->isEmpty() )
86 return actions()->first();
90 const Trigger
* SimpleActionData::trigger() const
92 if( triggers() == 0 || triggers()->isEmpty() )
94 return triggers()->first();
98 Trigger
* SimpleActionData::trigger()
100 if( triggers() == 0 || triggers()->isEmpty() )
102 return triggers()->first();
105 } // namespace KHotKeys