1
/* Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
2
Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
Version 2 as published by the Free Software Foundation;
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#include "windows_helper/window_selection_list.h"
28
Windowdef_list::Windowdef_list( const QString& comment_P )
29
: QList< Windowdef* >(), _comment( comment_P )
34
Windowdef_list::Windowdef_list( KConfigGroup& cfg_P )
35
: QList< Windowdef* >()
37
_comment = cfg_P.readEntry( "Comment" );
38
int cnt = cfg_P.readEntry( "WindowsCount", 0 );
43
KConfigGroup windowGroup( cfg_P.config(), cfg_P.name() + QString::number( i ));
44
Windowdef* window = Windowdef::create_cfg_read( windowGroup );
51
Windowdef_list::~Windowdef_list()
57
const QString& Windowdef_list::comment() const
63
void Windowdef_list::cfg_write( KConfigGroup& cfg_P ) const
66
for( ConstIterator it(begin());
70
KConfigGroup itGroup( cfg_P.config(), cfg_P.name() + QString::number( i ) );
71
(*it)->cfg_write( itGroup );
73
cfg_P.writeEntry( "WindowsCount", i );
74
cfg_P.writeEntry( "Comment", comment());
78
Windowdef_list* Windowdef_list::copy() const
80
Windowdef_list* ret = new Windowdef_list(comment());
81
for( ConstIterator it(constBegin());
85
kDebug() << "Duplicating " << (*it)->comment();
86
ret->append( (*it)->copy());
92
bool Windowdef_list::match( const Window_data& window_P ) const
94
if( count() == 0 ) // CHECKME no windows to match => ok
96
for( ConstIterator it(begin());
99
if( (*it)->match( window_P ))
105
void Windowdef_list::set_comment(const QString &comment)
111
} // namespace KHotKeys