File indexing completed on 2024-11-24 04:49:36

0001 /*
0002     kleo/enum.h
0003 
0004     This file is part of libkleopatra, the KDE keymanagement library
0005     SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "kleo_export.h"
0013 
0014 #include <QStringList>
0015 
0016 class QString;
0017 
0018 namespace GpgME
0019 {
0020 class Key;
0021 class UserID;
0022 }
0023 
0024 namespace Kleo
0025 {
0026 
0027 enum CryptoMessageFormat {
0028     // clang-format off
0029     InlineOpenPGPFormat = 1,
0030     OpenPGPMIMEFormat   = 2,
0031     SMIMEFormat         = 4,
0032     SMIMEOpaqueFormat   = 8,
0033     AnyOpenPGP          = InlineOpenPGPFormat | OpenPGPMIMEFormat,
0034     AnySMIME            = SMIMEOpaqueFormat | SMIMEFormat,
0035     AutoFormat          = AnyOpenPGP | AnySMIME
0036     // clang-format on
0037 };
0038 
0039 KLEO_EXPORT QString cryptoMessageFormatToLabel(CryptoMessageFormat f);
0040 
0041 KLEO_EXPORT const char *cryptoMessageFormatToString(CryptoMessageFormat f);
0042 KLEO_EXPORT QStringList cryptoMessageFormatsToStringList(unsigned int f);
0043 KLEO_EXPORT CryptoMessageFormat stringToCryptoMessageFormat(const QString &s);
0044 KLEO_EXPORT unsigned int stringListToCryptoMessageFormats(const QStringList &sl);
0045 
0046 enum Action { Conflict, DoIt, DontDoIt, Ask, AskOpportunistic, Impossible };
0047 
0048 enum EncryptionPreference {
0049     // clang-format off
0050     UnknownPreference       = 0,
0051     NeverEncrypt            = 1,
0052     AlwaysEncrypt           = 2,
0053     AlwaysEncryptIfPossible = 3,
0054     AlwaysAskForEncryption  = 4,
0055     AskWheneverPossible     = 5,
0056     MaxEncryptionPreference = AskWheneverPossible
0057     // clang-format on
0058 };
0059 
0060 KLEO_EXPORT QString encryptionPreferenceToLabel(EncryptionPreference pref);
0061 KLEO_EXPORT const char *encryptionPreferenceToString(EncryptionPreference pref);
0062 KLEO_EXPORT EncryptionPreference stringToEncryptionPreference(const QString &str);
0063 
0064 enum SigningPreference {
0065     // clang-format off
0066     UnknownSigningPreference   = 0,
0067     NeverSign                  = 1,
0068     AlwaysSign                 = 2,
0069     AlwaysSignIfPossible       = 3,
0070     AlwaysAskForSigning        = 4,
0071     AskSigningWheneverPossible = 5,
0072     MaxSigningPreference       = AskSigningWheneverPossible
0073     // clang-format on
0074 };
0075 
0076 KLEO_EXPORT QString signingPreferenceToLabel(SigningPreference pref);
0077 KLEO_EXPORT const char *signingPreferenceToString(SigningPreference pref);
0078 KLEO_EXPORT SigningPreference stringToSigningPreference(const QString &str);
0079 
0080 enum TrustLevel { Level0, Level1, Level2, Level3, Level4 };
0081 
0082 KLEO_EXPORT TrustLevel trustLevel(const GpgME::Key &key);
0083 KLEO_EXPORT TrustLevel trustLevel(const GpgME::UserID &uid);
0084 
0085 }