File indexing completed on 2024-11-24 04:44:10
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Christian Mollekopf <mollekopf@kolabsys.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kolab_export.h" 0010 0011 #include <QDateTime> 0012 #include <QStringList> 0013 #include <QUrl> 0014 #include <kolabcontainers.h> 0015 0016 class QTimeZone; 0017 0018 namespace Kolab 0019 { 0020 namespace Conversion 0021 { 0022 KOLAB_EXPORT QDateTime toDate(const Kolab::cDateTime &dt); 0023 KOLAB_EXPORT cDateTime fromDate(const QDateTime &dt, bool isAllDay); 0024 QStringList toStringList(const std::vector<std::string> &l); 0025 std::vector<std::string> fromStringList(const QStringList &l); 0026 /** 0027 * Returns a UTC, Floating Time or Timezone 0028 */ 0029 QTimeZone getTimeZone(const std::string &timezone); 0030 QTimeZone getTimeSpec(bool isUtc, const std::string &timezone); 0031 0032 QUrl toMailto(const std::string &email, const std::string &name = std::string()); 0033 std::string fromMailto(const QUrl &mailtoUri, std::string &name); 0034 QPair<std::string, std::string> fromMailto(const std::string &mailto); 0035 0036 inline std::string toStdString(const QString &s) 0037 { 0038 return std::string(s.toUtf8().constData()); 0039 } 0040 0041 inline QString fromStdString(const std::string &s) 0042 { 0043 return QString::fromUtf8(s.c_str()); 0044 } 0045 } 0046 }