File indexing completed on 2024-09-08 13:30:54
0001 /* 0002 * Copyright (C) 2010-2018 Daniel Nicoletti <dantti12@gmail.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Library General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #include "DebconfBoolean.h" 0021 0022 #include <KGuiItem> 0023 #include <KStandardGuiItem> 0024 0025 using namespace DebconfKde; 0026 0027 DebconfBoolean::DebconfBoolean(const QString &name, QWidget *parent) 0028 : DebconfElement(name, parent) 0029 { 0030 setupUi(this); 0031 0032 const KGuiItem yes = KStandardGuiItem::yes(); 0033 radioButtonYes->setText(yes.text()); 0034 radioButtonYes->setToolTip(yes.toolTip()); 0035 radioButtonYes->setWhatsThis(yes.whatsThis()); 0036 0037 const KGuiItem no = KStandardGuiItem::no(); 0038 radioButtonNo->setText(no.text()); 0039 radioButtonNo->setToolTip(no.toolTip()); 0040 radioButtonNo->setWhatsThis(no.whatsThis()); 0041 } 0042 0043 DebconfBoolean::~DebconfBoolean() 0044 { 0045 } 0046 0047 QString DebconfBoolean::value() const 0048 { 0049 return radioButtonYes->isChecked() ? QLatin1String("true") : QLatin1String("false"); 0050 } 0051 0052 void DebconfBoolean::setBoolean(const QString &extended_description, 0053 const QString &description, 0054 bool default_boolean) 0055 { 0056 extendedDescriptionL->setText(extended_description); 0057 descriptionL->setText(description); 0058 if (default_boolean) 0059 radioButtonYes->setChecked(true); 0060 else 0061 radioButtonNo->setChecked(true); 0062 } 0063 0064 #include "moc_DebconfBoolean.cpp"