Changeset View
Changeset View
Standalone View
Standalone View
src/drive/drivessearchquery.cpp
Show All 13 Lines | |||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU Lesser General Public License for more details. | 15 | * GNU Lesser General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library. If not, see <https://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "drivessearchquery.h" | 21 | #include "drivessearchquery.h" | ||
22 | #include "utils.h" | ||||
22 | 23 | | |||
23 | #include <QString> | 24 | #include <QString> | ||
24 | #include <QDateTime> | 25 | #include <QDateTime> | ||
25 | 26 | | |||
26 | using namespace KGAPI2; | 27 | using namespace KGAPI2; | ||
27 | using namespace KGAPI2::Drive; | 28 | using namespace KGAPI2::Drive; | ||
28 | 29 | | |||
29 | 30 | | |||
Show All 17 Lines | |||||
47 | } | 48 | } | ||
48 | 49 | | |||
49 | QString DrivesSearchQuery::valueToString(DrivesSearchQuery::Field field, const QVariant &var) | 50 | QString DrivesSearchQuery::valueToString(DrivesSearchQuery::Field field, const QVariant &var) | ||
50 | { | 51 | { | ||
51 | switch (field) { | 52 | switch (field) { | ||
52 | case Name: | 53 | case Name: | ||
53 | return QStringLiteral("'%1'").arg(var.toString().replace(QLatin1Char('\''), QLatin1String("\\\'"))); | 54 | return QStringLiteral("'%1'").arg(var.toString().replace(QLatin1Char('\''), QLatin1String("\\\'"))); | ||
54 | case Hidden: | 55 | case Hidden: | ||
55 | return (var.toBool() == true ? QStringLiteral("true") : QStringLiteral("false")); | 56 | return Utils::bool2Str(var.toBool()); | ||
56 | case MemberCount: | 57 | case MemberCount: | ||
57 | case OrganizerCount: | 58 | case OrganizerCount: | ||
58 | return var.toString(); | 59 | return var.toString(); | ||
59 | case CreatedDate: | 60 | case CreatedDate: | ||
60 | return QStringLiteral("'%1'").arg(var.toDateTime().toUTC().toString(QStringLiteral("yyyy-MM-ddThh:mm:ss"))); | 61 | return QStringLiteral("'%1'").arg(var.toDateTime().toUTC().toString(QStringLiteral("yyyy-MM-ddThh:mm:ss"))); | ||
61 | } | 62 | } | ||
62 | 63 | | |||
63 | Q_ASSERT(false); | 64 | Q_ASSERT(false); | ||
Show All 27 Lines |