File indexing completed on 2024-12-01 13:34:28
0001 /* 0002 SPDX-FileCopyrightText: 1999-2001 Lubos Lunak <l.lunak@kde.org> 0003 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #include "conditions.h" 0009 0010 #include <KConfigGroup> 0011 #include <QDebug> 0012 0013 namespace KHotKeys 0014 { 0015 And_condition::And_condition(KConfigGroup &cfg_P, Condition_list_base *parent_P) 0016 : Condition_list_base(cfg_P, parent_P) 0017 { 0018 } 0019 0020 And_condition::And_condition(Condition_list_base *parent_P) 0021 : Condition_list_base(parent_P) 0022 { 0023 } 0024 0025 void And_condition::cfg_write(KConfigGroup &cfg_P) const 0026 { 0027 qDebug() << description() << " with " << count() << " children"; 0028 ; 0029 base::cfg_write(cfg_P); 0030 cfg_P.writeEntry("Type", "AND"); // overwrites value set in base::cfg_write() 0031 } 0032 0033 And_condition *And_condition::copy() const 0034 { 0035 And_condition *ret = new And_condition(); 0036 for (ConstIterator it = begin(); it != end(); ++it) { 0037 ret->append((*it)->copy()); 0038 } 0039 return ret; 0040 } 0041 0042 const QString And_condition::description() const 0043 { 0044 return i18nc("And_condition", "And"); 0045 } 0046 0047 bool And_condition::match() const 0048 { 0049 for (ConstIterator it = begin(); it != end(); ++it) { 0050 if (!(*it)->match()) { 0051 return false; 0052 } 0053 } 0054 return true; // all true (or empty) 0055 } 0056 0057 } // namespace KHotKeys