File indexing completed on 2024-05-05 04:45:04

0001 /*
0002  * Copyright (C) 2003-2005  Justin Karneges <justin@affinix.com>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
0017  *
0018  */
0019 
0020 #pragma once
0021 
0022 #include "gpgaction.h"
0023 #include "gpgop.h"
0024 #include "gpgproc_p.h"
0025 #include <QObject>
0026 
0027 namespace gpgQCAPlugin {
0028 
0029 class GpgOp::Private : public QObject
0030 {
0031     Q_OBJECT
0032 public:
0033     QCA::Synchronizer   sync;
0034     GpgOp              *q;
0035     GpgAction          *act;
0036     QString             bin;
0037     GpgOp::Type         op;
0038     GpgAction::Output   output;
0039     QByteArray          result;
0040     QString             diagnosticText;
0041     QList<GpgOp::Event> eventList;
0042     bool                waiting;
0043 
0044     bool    opt_ascii, opt_noagent, opt_alwaystrust;
0045     QString opt_pubfile, opt_secfile;
0046 
0047 #ifdef GPG_PROFILE
0048     QTime timer;
0049 #endif
0050 
0051     Private(GpgOp *_q);
0052     ~Private() override;
0053     void reset(ResetMode mode);
0054     void make_act(GpgOp::Type _op);
0055     void eventReady(const GpgOp::Event &e);
0056     void eventReady(GpgOp::Event::Type type);
0057     void eventReady(GpgOp::Event::Type type, int written);
0058     void eventReady(GpgOp::Event::Type type, const QString &keyId);
0059 
0060 public Q_SLOTS:
0061     void act_readyRead();
0062     void act_bytesWritten(int bytes);
0063     void act_needPassphrase(const QString &keyId);
0064     void act_needCard();
0065     void act_readyReadDiagnosticText();
0066     void act_finished();
0067 };
0068 
0069 } // namespace gpgQCAPlugin