not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / khotkeys / libkhotkeysprivate / conditions / or_condition.cpp
blob9bf37ff0e1c964603c19d6a7ca910f91b38ac492
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.h"
22 #include <KDE/KConfigGroup>
24 namespace KHotKeys {
26 Or_condition::Or_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P )
27 : Condition_list_base( cfg_P, parent_P )
29 // CHECKME kontrola poctu ?
32 bool Or_condition::match() const
34 if( count() == 0 ) // empty => ok
35 return true;
36 for( Iterator it( *this );
37 it;
38 ++it )
39 if( it.current()->match()) // OR
40 return true;
41 return false;
44 void Or_condition::cfg_write( KConfigGroup& cfg_P ) const
46 base::cfg_write( cfg_P );
47 cfg_P.writeEntry( "Type", "OR" ); // overwrites value set in base::cfg_write()
50 Or_condition* Or_condition::copy( Condition_list_base* parent_P ) const
52 Or_condition* ret = new Or_condition( parent_P );
53 for( Iterator it( *this );
54 it;
55 ++it )
56 ret->append( (*it)->copy( ret ));
57 return ret;
60 const QString Or_condition::description() const
62 return i18nc( "Or_condition", "Or" );
65 } // namespace KHotKeys