A few deprecations eradicated involving QCheckBox.
[kdenetwork.git] / filesharing / advanced / kcm_sambaconf / common.cpp
blobd58178fda356e795ae3f3b3362fb5aeda2d6221f
1 /***************************************************************************
2 common.cpp - description
3 -------------------
4 begin : Tue June 6 2002
5 copyright : (C) 2002 by Jan Schäfer
6 email : janschaefer@users.sourceforge.net
7 ***************************************************************************/
9 /******************************************************************************
10 * *
11 * This file is part of KSambaPlugin. *
12 * *
13 * KSambaPlugin is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 * KSambaPlugin is distributed in the hope that it will be useful, *
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21 * GNU General Public License for more details. *
22 * *
23 * You should have received a copy of the GNU General Public License *
24 * along with KSambaPlugin; if not, write to the Free Software *
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
26 * *
27 ******************************************************************************/
29 #include <qstring.h>
30 #include <kcombobox.h>
31 #include <q3listbox.h>
33 #include "common.h"
35 void setComboToString(QComboBox* combo,const QString & s)
37 int i = /*combo->model()->index(*/combo->findText( s )/*)*/;//model()->findItem(s,Qt::ExactMatch));
38 combo->setCurrentItem(i);
41 bool boolFromText(const QString & value, bool testTrue)
43 QString lower = value.toLower();
45 if (testTrue) {
46 if (lower=="yes" ||
47 lower=="1" ||
48 lower=="true" ||
49 lower=="on")
50 return true;
51 else
52 return false;
53 } else {
54 if (lower=="no" ||
55 lower=="0" ||
56 lower=="false" ||
57 lower=="off")
58 return false;
59 else
60 return true;
64 QString textFromBool(bool value)
66 if (value)
67 return "yes";
68 else
69 return "no";