File indexing completed on 2024-06-23 05:13:43

0001 /*  commands/importpaperkeycommand.h
0002 
0003     This file is part of Kleopatra, the KDE keymanager
0004     SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik
0005     SPDX-FileContributor: Intevation GmbH
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include <commands/gnupgprocesscommand.h>
0013 
0014 #include <QString>
0015 #include <QTemporaryDir>
0016 
0017 class QWidget;
0018 
0019 namespace GpgME
0020 {
0021 class Error;
0022 class Key;
0023 } // namespace GpgME
0024 
0025 namespace Kleo
0026 {
0027 namespace Commands
0028 {
0029 
0030 class ImportPaperKeyCommand : public GnuPGProcessCommand
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     explicit ImportPaperKeyCommand(const GpgME::Key &key);
0036 
0037     static Restrictions restrictions()
0038     {
0039         return OnlyOneKey | MustBeOpenPGP;
0040     }
0041 
0042     void postSuccessHook(QWidget *parentWidget) override;
0043 
0044     QString successMessage(const QStringList &args) const override;
0045 
0046 private Q_SLOTS:
0047     void exportResult(const GpgME::Error &err, const QByteArray &data);
0048 
0049 private:
0050     QStringList arguments() const override;
0051 
0052     void doStart() override;
0053 
0054     QString errorCaption() const override;
0055 
0056     QString crashExitMessage(const QStringList &) const override;
0057     QString errorExitMessage(const QStringList &) const override;
0058 
0059     QTemporaryDir mTmpDir;
0060     QString mFileName;
0061 };
0062 
0063 }
0064 }