File indexing completed on 2024-12-01 07:26:15
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Alexander Stippich <a.stippich@gmx.net> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "batchmodeoption.h" 0008 0009 #include <ksanecore_debug.h> 0010 0011 namespace KSaneCore 0012 { 0013 0014 BatchModeOption::BatchModeOption() 0015 { 0016 m_optionType = Option::TypeBool; 0017 } 0018 0019 Option::OptionState BatchModeOption::state() const 0020 { 0021 return Option::StateActive; 0022 } 0023 0024 QString BatchModeOption::name() const 0025 { 0026 return BatchModeOptionName; 0027 } 0028 0029 QString BatchModeOption::title() const 0030 { 0031 return i18n("Batch mode with time delay"); 0032 } 0033 0034 QString BatchModeOption::description() const 0035 { 0036 return i18n("Enables batch mode scanning. Continues scanning after a delay until canceled."); 0037 } 0038 0039 bool BatchModeOption::setValue(const QVariant &value) 0040 { 0041 const bool toggled = value.toBool(); 0042 0043 if (m_checked != toggled) { 0044 m_checked = toggled; 0045 Q_EMIT valueChanged(m_checked); 0046 } 0047 return true; 0048 } 0049 0050 QVariant BatchModeOption::value() const 0051 { 0052 return m_checked; 0053 } 0054 0055 QString BatchModeOption::valueAsString() const 0056 { 0057 if (state() == Option::StateHidden) { 0058 return QString(); 0059 } 0060 if (m_checked) { 0061 return QStringLiteral("true"); 0062 } else { 0063 return QStringLiteral("false"); 0064 } 0065 } 0066 0067 } // NameSpace KSaneCore 0068 0069 #include "moc_batchmodeoption.cpp"