File indexing completed on 2024-05-05 17:34:14

0001 /* SPDX-FileCopyrightText: 1999-2001 Lubos Lunak <l.lunak@kde.org>
0002    SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz>
0003 
0004    SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #include "window_selection_rules.h"
0008 
0009 #include <QDebug>
0010 
0011 namespace KHotKeys
0012 {
0013 Windowdef::Windowdef(const QString &comment_P)
0014     : _comment(comment_P)
0015 {
0016 }
0017 
0018 Windowdef::Windowdef(KConfigGroup &cfg_P)
0019 {
0020     _comment = cfg_P.readEntry("Comment");
0021 }
0022 
0023 Windowdef::~Windowdef()
0024 {
0025 }
0026 
0027 void Windowdef::cfg_write(KConfigGroup &cfg_P) const
0028 {
0029     cfg_P.writeEntry("Type", "ERROR");
0030     cfg_P.writeEntry("Comment", comment());
0031 }
0032 
0033 const QString &Windowdef::comment() const
0034 {
0035     return _comment;
0036 }
0037 
0038 Windowdef *Windowdef::create_cfg_read(KConfigGroup &cfg_P)
0039 {
0040     QString type = cfg_P.readEntry("Type");
0041     if (type == "SIMPLE")
0042         return new Windowdef_simple(cfg_P);
0043     qWarning() << "Unknown Windowdef type read from cfg file\n";
0044     return nullptr;
0045 }
0046 
0047 void Windowdef::set_comment(const QString &comment)
0048 {
0049     _comment = comment;
0050 }
0051 
0052 } // namespace KHotKeys