File indexing completed on 2024-04-14 05:43:23

0001 /*
0002     SPDX-FileCopyrightText: 2006 Jimmy Gilles <jimmygilles@gmail.com>
0003     SPDX-FileCopyrightText: 2010, 2013, 2014, 2016 Rolf Eike Beer <kde@opensource.sf-tec.de>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef CONVERT_H
0008 #define CONVERT_H
0009 
0010 #include "kgpgkey.h"
0011 
0012 #include <gpgme.h>
0013 
0014 class QString;
0015 
0016 namespace KgpgCore
0017 {
0018 
0019 namespace Convert
0020 {
0021     QString toString(const KgpgCore::KgpgKeyAlgo algorithm);
0022     QString toString(const gpgme_validity_t ownertrust);
0023     QString toString(const KgpgCore::KgpgKeyTrust trust);
0024     QString toString(const KgpgCore::KgpgSubKeyType type);
0025     KgpgKeyAlgo toAlgo(const uint v);
0026     KgpgKeyAlgo toAlgo(const QString &s);
0027     KgpgKeyTrust toTrust(const QChar &c);
0028     KgpgKeyTrust toTrust(const QString &s);
0029     gpgme_validity_t toOwnerTrust(const QChar &c);
0030     /**
0031      * @brief parse the GnuPG capabilities field
0032      * @param capString the capability string as returned by GnuPG
0033      * @param upper if the uppercase or lowercase version should be parsed
0034      */
0035     KgpgSubKeyType toSubType(const QString &capString, bool upper);
0036     /**
0037      * @brief parse GnuPG date fields
0038      * @param s the input string
0039      * @return the parsed date
0040      * @retval QDateTime() if s was empty or the string was invalid
0041      *
0042      * Both the seconds since epoch UTC as well as ISO 8601 formats are
0043      * supported.
0044      */
0045     QDateTime toDateTime(const QString &s);
0046 }
0047 
0048 } // namespace KgpgCore
0049 
0050 #endif // CONVERT_H