File indexing completed on 2024-12-29 04:44:30
0001 /* 0002 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "sylpheedsettingsutils.h" 0008 0009 bool SylpheedSettingsUtils::readConfig(const QString &key, const KConfigGroup &accountConfig, int &value, bool remove_underscore) 0010 { 0011 QString cleanedKey(key); 0012 if (remove_underscore) { 0013 cleanedKey.remove(QLatin1Char('_')); 0014 } 0015 const QString useKey = QLatin1StringView("set_") + cleanedKey; 0016 if (accountConfig.hasKey(useKey) && (accountConfig.readEntry(useKey, 0) == 1)) { 0017 value = accountConfig.readEntry(key, 0); 0018 return true; 0019 } 0020 return false; 0021 } 0022 0023 bool SylpheedSettingsUtils::readConfig(const QString &key, const KConfigGroup &accountConfig, QString &value, bool remove_underscore) 0024 { 0025 QString cleanedKey(key); 0026 if (remove_underscore) { 0027 cleanedKey.remove(QLatin1Char('_')); 0028 } 0029 const QString useKey = QLatin1StringView("set_") + cleanedKey; 0030 if (accountConfig.hasKey(useKey) && (accountConfig.readEntry(useKey, 0) == 1)) { 0031 value = accountConfig.readEntry(key); 0032 return true; 0033 } 0034 return false; 0035 }