kde-playground/kgpg/kgpg.h
Ivailo Monev 61b63feb67 kgpg: implement encryption
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-03-14 15:56:34 +02:00

76 lines
1.8 KiB
C++

/* This file is part of the KDE project
Copyright (C) 2022 Ivailo Monev <xakepa10@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KGPG_H
#define KGPG_H
#include <QResizeEvent>
#include <kmainwindow.h>
#include <gpgme.h>
#include "ui_kgpgwidget.h"
struct KGPGKey
{
QByteArray name;
QByteArray email;
QByteArray comment;
QByteArray uidhash;
QByteArray fpr;
bool disabled;
bool revoked;
bool expired;
bool canencrypt;
bool cansign;
};
class KGPG : public KMainWindow
{
Q_OBJECT
public:
enum KGPGMode {
EncryptMode = 0,
DecryptMode = 1,
SignMode = 2,
VerifyMode = 3
};
explicit KGPG(QWidget *parent = 0);
~KGPG();
void setMode(const KGPGMode mode);
void setSource(const QString &source);
void setError(const char* const error);
void setError(const QString &error);
void start();
private:
void updateKeys(const gpgme_keylist_mode_t gpgmode, const bool secret);
Ui_KGPGWindow m_ui;
KGPGMode m_mode;
bool m_release;
gpgme_ctx_t m_gpgctx;
QList<KGPGKey> m_keys;
};
#endif // KGPG_H