File indexing completed on 2024-06-23 05:14:14

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     uiserver/signencryptfilescommand.h
0003 
0004     This file is part of Kleopatra, the KDE keymanager
0005     SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "assuancommand.h"
0013 
0014 #include <utils/pimpl_ptr.h>
0015 
0016 namespace Kleo
0017 {
0018 
0019 class SignEncryptFilesCommand : public Kleo::AssuanCommandMixin<SignEncryptFilesCommand>
0020 {
0021 public:
0022     SignEncryptFilesCommand();
0023     ~SignEncryptFilesCommand() override;
0024 
0025 protected:
0026     enum Operation {
0027         SignDisallowed = 0,
0028         SignAllowed = 1,
0029         SignSelected = 2,
0030 
0031         SignMask = SignAllowed | SignSelected,
0032 
0033         EncryptDisallowed = 0,
0034         EncryptAllowed = 4,
0035         EncryptSelected = 8,
0036 
0037         EncryptMask = EncryptAllowed | EncryptSelected
0038     };
0039 
0040 private:
0041     virtual unsigned int operation() const
0042     {
0043         return SignSelected | EncryptSelected;
0044     }
0045 
0046 private:
0047     int doStart() override;
0048     void doCanceled() override;
0049 
0050 public:
0051     static const char *staticName()
0052     {
0053         return "SIGN_ENCRYPT_FILES";
0054     }
0055 
0056     class Private;
0057 
0058 private:
0059     kdtools::pimpl_ptr<Private> d;
0060 };
0061 
0062 class EncryptSignFilesCommand : public Kleo::AssuanCommandMixin<EncryptSignFilesCommand, SignEncryptFilesCommand>
0063 {
0064 public:
0065     static const char *staticName()
0066     {
0067         return "ENCRYPT_SIGN_FILES";
0068     }
0069 };
0070 
0071 class EncryptFilesCommand : public Kleo::AssuanCommandMixin<EncryptFilesCommand, SignEncryptFilesCommand>
0072 {
0073 public:
0074     static const char *staticName()
0075     {
0076         return "ENCRYPT_FILES";
0077     }
0078     unsigned int operation() const override
0079     {
0080         return SignAllowed | EncryptSelected;
0081     }
0082 };
0083 
0084 class SignFilesCommand : public Kleo::AssuanCommandMixin<SignFilesCommand, SignEncryptFilesCommand>
0085 {
0086 public:
0087     static const char *staticName()
0088     {
0089         return "SIGN_FILES";
0090     }
0091     unsigned int operation() const override
0092     {
0093         return SignSelected | EncryptAllowed;
0094     }
0095 };
0096 
0097 }