Blame lang/qt/src/job.h

Packit d7e8d0
/*
Packit d7e8d0
    job.h
Packit d7e8d0
Packit d7e8d0
    This file is part of qgpgme, the Qt API binding for gpgme
Packit d7e8d0
    Copyright (c) 2004 Klarälvdalens Datakonsult AB
Packit d7e8d0
    Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Packit d7e8d0
    Software engineering by Intevation GmbH
Packit d7e8d0
Packit d7e8d0
    QGpgME is free software; you can redistribute it and/or
Packit d7e8d0
    modify it under the terms of the GNU General Public License as
Packit d7e8d0
    published by the Free Software Foundation; either version 2 of the
Packit d7e8d0
    License, or (at your option) any later version.
Packit d7e8d0
Packit d7e8d0
    QGpgME is distributed in the hope that it will be useful,
Packit d7e8d0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit d7e8d0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit d7e8d0
    General Public License for more details.
Packit d7e8d0
Packit d7e8d0
    You should have received a copy of the GNU General Public License
Packit d7e8d0
    along with this program; if not, write to the Free Software
Packit d7e8d0
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit d7e8d0
Packit d7e8d0
    In addition, as a special exception, the copyright holders give
Packit d7e8d0
    permission to link the code of this program with any edition of
Packit d7e8d0
    the Qt library by Trolltech AS, Norway (or with modified versions
Packit d7e8d0
    of Qt that use the same license as Qt), and distribute linked
Packit d7e8d0
    combinations including the two.  You must obey the GNU General
Packit d7e8d0
    Public License in all respects for all of the code used other than
Packit d7e8d0
    Qt.  If you modify this file, you may extend this exception to
Packit d7e8d0
    your version of the file, but you are not obligated to do so.  If
Packit d7e8d0
    you do not wish to do so, delete this exception statement from
Packit d7e8d0
    your version.
Packit d7e8d0
*/
Packit d7e8d0
Packit d7e8d0
#ifndef __KLEO_JOB_H__
Packit d7e8d0
#define __KLEO_JOB_H__
Packit d7e8d0
Packit d7e8d0
#include "qgpgme_export.h"
Packit d7e8d0
Packit d7e8d0
#include <QObject>
Packit d7e8d0
#include <QString>
Packit d7e8d0
#include <QMap>
Packit d7e8d0
Packit d7e8d0
#ifdef BUILDING_QGPGME
Packit d7e8d0
# include "error.h"
Packit d7e8d0
#else
Packit d7e8d0
# include <gpgme++/error.h>
Packit d7e8d0
#endif
Packit d7e8d0
Packit d7e8d0
class QWidget;
Packit d7e8d0
Packit d7e8d0
namespace QGpgME
Packit d7e8d0
{
Packit d7e8d0
Packit d7e8d0
/**
Packit d7e8d0
   @short An abstract base class for asynchronous crypto operations
Packit d7e8d0
Packit d7e8d0
   During the operation, you might receive progress updates through
Packit d7e8d0
   the progress() signal as they arrive, but an implementation is
Packit d7e8d0
   free to not send progress information. You should show a busy
Packit d7e8d0
   progressbar until the first progress() signal is received.
Packit d7e8d0
Packit d7e8d0
   The done() signal is emitted _before_ the result() signals of
Packit d7e8d0
   subclasses and should be used to hide and/or reset progress bars,
Packit d7e8d0
   not to learn of the end of the operation. Use the result()
Packit d7e8d0
   signals for that.
Packit d7e8d0
Packit d7e8d0
   To cancel the operation, simply call slotCancel(). The result()
Packit d7e8d0
   signal of subclasses will still be emitted, though, and will
Packit d7e8d0
   carry the information that the operation was canceled.
Packit d7e8d0
*/
Packit d7e8d0
class QGPGME_EXPORT Job : public QObject
Packit d7e8d0
{
Packit d7e8d0
    Q_OBJECT
Packit d7e8d0
protected:
Packit d7e8d0
    explicit Job(QObject *parent);
Packit d7e8d0
public:
Packit d7e8d0
    ~Job();
Packit d7e8d0
Packit d7e8d0
    virtual QString auditLogAsHtml() const;
Packit d7e8d0
    virtual GpgME::Error auditLogError() const;
Packit d7e8d0
    bool isAuditLogSupported() const;
Packit d7e8d0
Packit d7e8d0
    /** Get the underlying context to set some additional options for a job.
Packit d7e8d0
     *
Packit d7e8d0
     * This is intended to provide more flexibility on configuring jobs before
Packit d7e8d0
     * they are started.
Packit d7e8d0
     * The context is still owned by the thread, do not delete it.
Packit d7e8d0
     *
Packit d7e8d0
     * This is a static method that takes the job as argument.
Packit d7e8d0
     *
Packit d7e8d0
     * This function may not be called for running jobs.
Packit d7e8d0
     *
Packit d7e8d0
     * @returns the context used by the job job or null.
Packit d7e8d0
     */
Packit d7e8d0
    static GpgME::Context *context(Job *job);
Packit d7e8d0
Packit d7e8d0
public Q_SLOTS:
Packit d7e8d0
    virtual void slotCancel() = 0;
Packit d7e8d0
Packit d7e8d0
Q_SIGNALS:
Packit d7e8d0
    void progress(const QString &what, int current, int total);
Packit d7e8d0
    void done();
Packit d7e8d0
};
Packit d7e8d0
Packit d7e8d0
extern QMap <Job *, GpgME::Context *> g_context_map;
Packit d7e8d0
}
Packit d7e8d0
Packit d7e8d0
#endif // __KLEO_JOB_H__