File indexing completed on 2024-09-08 10:50:17
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 0012 namespace KHotKeys 0013 { 0014 Or_condition::Or_condition(KConfigGroup &cfg_P, Condition_list_base *parent_P) 0015 : Condition_list_base(cfg_P, parent_P) 0016 { 0017 } 0018 0019 Or_condition::Or_condition(Condition_list_base *parent_P) 0020 : Condition_list_base(parent_P) 0021 { 0022 } 0023 0024 bool Or_condition::match() const 0025 { 0026 if (count() == 0) // empty => ok 0027 return true; 0028 for (ConstIterator it(begin()); it != end(); ++it) 0029 if ((*it)->match()) // OR 0030 return true; 0031 return false; 0032 } 0033 0034 void Or_condition::cfg_write(KConfigGroup &cfg_P) const 0035 { 0036 base::cfg_write(cfg_P); 0037 cfg_P.writeEntry("Type", "OR"); // overwrites value set in base::cfg_write() 0038 } 0039 0040 Or_condition *Or_condition::copy() const 0041 { 0042 Or_condition *ret = new Or_condition(); 0043 for (ConstIterator it(begin()); it != end(); ++it) 0044 ret->append((*it)->copy()); 0045 return ret; 0046 } 0047 0048 const QString Or_condition::description() const 0049 { 0050 return i18nc("Or_condition", "Or"); 0051 } 0052 0053 } // namespace KHotKeys