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"
22
#include "conditions/active_window_condition.h"
23
#include "conditions/existing_window_condition.h"
24
#include "conditions/conditions_visitor.h"
26
#include <KDE/KConfigGroup>
31
Condition::Condition( Condition_list_base* parent )
42
Condition::Condition( KConfigGroup&, Condition_list_base* parent )
53
Condition::~Condition()
55
if( _parent ) _parent->removeAll( this );
59
void Condition::cfg_write( KConfigGroup& cfg_P ) const
61
cfg_P.writeEntry( "Type", "ERROR" );
65
Condition* Condition::create_cfg_read( KConfigGroup& cfg_P, Condition_list_base* parent_P )
67
QString type = cfg_P.readEntry( "Type" );
68
if( type == "ACTIVE_WINDOW" )
69
return new Active_window_condition( cfg_P, parent_P );
70
if( type == "EXISTING_WINDOW" )
71
return new Existing_window_condition( cfg_P, parent_P );
73
return new Not_condition( cfg_P, parent_P );
75
return new And_condition( cfg_P, parent_P );
77
return new Or_condition( cfg_P, parent_P );
78
kWarning() << "Unknown Condition type read from cfg file\n";
83
const Condition_list_base* Condition::parent() const
89
Condition_list_base* Condition::parent()
95
void Condition::reparent(Condition_list_base *parent)
97
if (_parent == parent) return;
99
if (_parent) _parent->removeAll(this);
101
if (_parent) _parent->append(this);
105
void Condition::updated() const
107
if (!khotkeys_active() || !_parent)
116
void Condition::visit( ConditionsVisitor *visitor )
118
visitor->visitCondition( this );
122
} // namespace KHotKeys