add more spacing
[personal-kdebase.git] / workspace / khotkeys / libkhotkeysprivate / conditions / conditions_list_base.cpp
blob02c1d6e0cf5c9cb6a7495b92484d4da7af25f4ef
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 Condition_list_base::Condition_list_base( KConfigGroup& cfg_P, Condition_list_base* parent_P )
27 : Condition( parent_P )
29 int cnt = cfg_P.readEntry( "ConditionsCount", 0 );
30 for( int i = 0;
31 i < cnt;
32 ++i )
34 KConfigGroup conditionConfig( cfg_P.config(), cfg_P.name() + QString::number( i ) );
35 (void) Condition::create_cfg_read( conditionConfig, this );
39 Condition_list_base::~Condition_list_base()
41 while( !isEmpty())
43 Condition* c = getFirst();
44 remove( c );
45 delete c;
49 void Condition_list_base::cfg_write( KConfigGroup& cfg_P ) const
51 int i = 0;
52 for( Iterator it( *this );
53 it;
54 ++it, ++i )
56 KConfigGroup conditionConfig( cfg_P.config(), cfg_P.name() + QString::number( i ) );
57 it.current()->cfg_write( conditionConfig );
59 cfg_P.writeEntry( "ConditionsCount", i );
62 bool Condition_list_base::accepts_children() const
64 return true;
68 } // namespace KHotKeys