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>
27 Active_window_condition::Active_window_condition( KConfigGroup
& cfg_P
, Condition_list_base
* parent_P
)
28 : Condition( cfg_P
, parent_P
)
30 KConfigGroup
windowConfig( cfg_P
.config(), cfg_P
.name() + "Window" );
31 _window
= new Windowdef_list( windowConfig
);
36 void Active_window_condition::init()
38 connect( windows_handler
, SIGNAL( active_window_changed( WId
)),
39 this, SLOT( active_window_changed( WId
)));
42 bool Active_window_condition::match() const
47 void Active_window_condition::set_match()
49 is_match
= window()->match( Window_data( windows_handler
->active_window()));
50 kDebug() << "Active_window_condition::set_match :" << is_match
;
54 void Active_window_condition::cfg_write( KConfigGroup
& cfg_P
) const
56 base::cfg_write( cfg_P
);
57 KConfigGroup
windowConfig( cfg_P
.config(), cfg_P
.name() + "Window" );
58 window()->cfg_write( windowConfig
);
59 cfg_P
.writeEntry( "Type", "ACTIVE_WINDOW" ); // overwrites value set in base::cfg_write()
62 Active_window_condition
* Active_window_condition::copy( Condition_list_base
* parent_P
) const
64 return new Active_window_condition( window()->copy(), parent_P
);
67 const QString
Active_window_condition::description() const
69 return i18n( "Active window: " ) + window()->comment();
72 void Active_window_condition::active_window_changed( WId
)
77 Active_window_condition::~Active_window_condition()
79 disconnect( windows_handler
, NULL
, this, NULL
);
83 } // namespace KHotKeys