not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / khotkeys / libkhotkeysprivate / conditions / conditions_list.cpp
blobfcdb75039bd31eb5b193b24c2916a7a96981171a
1 /*
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.
20 #include "conditions/conditions.h"
21 #include "action_data/action_data.h"
23 #include <KDE/KConfigGroup>
25 namespace KHotKeys {
27 Condition_list::Condition_list( KConfigGroup& cfg_P, ActionDataBase* data_P )
28 : Condition_list_base( cfg_P, NULL ), data( data_P )
30 _comment = cfg_P.readEntry( "Comment" );
33 void Condition_list::cfg_write( KConfigGroup& cfg_P ) const
35 base::cfg_write( cfg_P );
36 cfg_P.writeEntry( "Comment", comment());
39 Condition_list* Condition_list::copy( ActionDataBase* data_P ) const
41 Condition_list* ret = new Condition_list( comment(), data_P );
42 for( Iterator it( *this );
43 it;
44 ++it )
45 ret->append( it.current()->copy( ret ));
46 return ret;
50 bool Condition_list::match() const
52 if( count() == 0 ) // no conditions to match => ok
53 return true;
54 for( Iterator it( *this );
55 it;
56 ++it )
57 if( it.current()->match()) // OR
58 return true;
59 return false;
62 void Condition_list::updated() const
64 if( !khotkeys_active())
65 return;
66 data->update_triggers();
67 // base::updated(); no need to, doesn't have parent
70 // CHECKME tohle je drobet hack, jeste to zvazit
71 void Condition_list::set_data( ActionDataBase* data_P )
73 Q_ASSERT( data == NULL || data == data_P );
74 data = data_P;
77 const QString Condition_list::description() const
79 Q_ASSERT( false );
80 return QString();
83 Condition_list* Condition_list::copy( Condition_list_base* ) const
85 Q_ASSERT( false );
86 return NULL;
89 } // namespace KHotKeys