2 Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
3 Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
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.
22 #include <KDE/KConfigGroup>
26 Trigger_list::Trigger_list( KConfigGroup
& cfg_P
, ActionData
* data_P
)
29 _comment
= cfg_P
.readEntry( "Comment" );
30 int cnt
= cfg_P
.readEntry( "TriggersCount", 0 );
35 KConfigGroup
triggerConfig( cfg_P
.config(), cfg_P
.name() + QString::number( i
));
36 Trigger
* trigger
= Trigger::create_cfg_read( triggerConfig
, data_P
);
44 Trigger_list::Trigger_list( const QString
& comment_P
)
45 : QList
< Trigger
* >(), _comment( comment_P
)
50 Trigger_list::~Trigger_list()
58 void Trigger_list::aboutToBeErased()
60 QListIterator
<Trigger
*> it(*this);
63 it
.next()->aboutToBeErased();
68 void Trigger_list::cfg_write( KConfigGroup
& cfg_P
) const
70 cfg_P
.writeEntry( "Comment", comment());
72 for( Trigger_list::ConstIterator it
= begin();
76 KConfigGroup
triggerConfig( cfg_P
.config(), cfg_P
.name() + QString::number( i
++ ));
77 (*it
)->cfg_write( triggerConfig
);
79 cfg_P
.writeEntry( "TriggersCount", i
);
83 const QString
Trigger_list::comment() const
89 Trigger_list
* Trigger_list::copy( ActionData
* data_P
) const
91 Trigger_list
* ret
= new Trigger_list( comment());
92 for( Trigger_list::ConstIterator it
= begin();
96 ret
->append( (*it
)->copy( data_P
));
101 void Trigger_list::activate( bool activate_P
)
103 for( Trigger_list::Iterator it
= begin();
107 ( *it
)->activate( activate_P
);
111 } // namespace KHotKeys