Blame lang/qt/src/keyformailboxjob.h

Packit d7e8d0
/*
Packit d7e8d0
    keyformailboxjob.h
Packit d7e8d0
Packit d7e8d0
    This file is part of qgpgme, the Qt API binding for gpgme
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
#ifndef __KLEO_KEYFORMAILBOX_H__
Packit d7e8d0
#define __KLEO_KEYFORMAILBOX_H__
Packit d7e8d0
Packit d7e8d0
#include <QString>
Packit d7e8d0
Packit d7e8d0
#include "job.h"
Packit d7e8d0
Packit d7e8d0
#ifdef BUILDING_QGPGME
Packit d7e8d0
# include "key.h"
Packit d7e8d0
#else
Packit d7e8d0
# include <gpgme++/key.h>
Packit d7e8d0
#endif
Packit d7e8d0
Packit d7e8d0
namespace GpgME
Packit d7e8d0
{
Packit d7e8d0
class Error;
Packit d7e8d0
class KeyListResult;
Packit d7e8d0
}
Packit d7e8d0
Packit d7e8d0
namespace QGpgME
Packit d7e8d0
{
Packit d7e8d0
Packit d7e8d0
/**
Packit d7e8d0
   @short Get the best key to use for a Mailbox
Packit d7e8d0
Packit d7e8d0
   To use the keyformailboxjob, first obtain an instance from the
Packit d7e8d0
   CryptoBackend and either exec it or start and
Packit d7e8d0
   conncet the result() signals to a suitable slot.
Packit d7e8d0
   The job will be automatically deleted in which
Packit d7e8d0
   case the KeylistJob instance will have schedules it's own
Packit d7e8d0
   destruction with a call to QObject::deleteLater().
Packit d7e8d0
Packit d7e8d0
   The best key is defined as the key with a UID that has an
Packit d7e8d0
   E-Mail that matches the mailbox provided. If multiple
Packit d7e8d0
   keys are found the one with the highest validity is returned.
Packit d7e8d0
Packit d7e8d0
   After result() is emitted, the
Packit d7e8d0
   KeyListJob will schedule it's own destruction by calling
Packit d7e8d0
   QObject::deleteLater().
Packit d7e8d0
*/
Packit d7e8d0
class QGPGME_EXPORT KeyForMailboxJob: public Job
Packit d7e8d0
{
Packit d7e8d0
    Q_OBJECT
Packit d7e8d0
protected:
Packit d7e8d0
    explicit KeyForMailboxJob(QObject *parent);
Packit d7e8d0
Packit d7e8d0
public:
Packit d7e8d0
    ~KeyForMailboxJob();
Packit d7e8d0
Packit d7e8d0
    /**
Packit d7e8d0
      Starts the operation. \a mailbox is the mailbox to
Packit d7e8d0
      look for.
Packit d7e8d0
Packit d7e8d0
      The result is the same as for the LocateKeysJob.
Packit d7e8d0
Packit d7e8d0
      If \a canEncrypt is true, only keys that have a subkey for encryption
Packit d7e8d0
      usage are returned. Use this if you need to select a
Packit d7e8d0
      key for signing.
Packit d7e8d0
    */
Packit d7e8d0
    virtual GpgME::Error start(const QString &mailbox, bool canEncrypt = true) = 0;
Packit d7e8d0
Packit d7e8d0
    virtual GpgME::KeyListResult exec(const QString &mailbox, bool canEncrypt, GpgME::Key &key, GpgME::UserID &uid) = 0;
Packit d7e8d0
Packit d7e8d0
Q_SIGNALS:
Packit d7e8d0
    /** The result. \a Key is the key found or a Null key.
Packit d7e8d0
     *
Packit d7e8d0
     * The userid is the uid where the mailbox matches.
Packit d7e8d0
     *
Packit d7e8d0
     * The auditlog params are always null / empty.
Packit d7e8d0
     */
Packit d7e8d0
    void result(const GpgME::KeyListResult &result, const GpgME::Key &key, const GpgME::UserID &uid, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
Packit d7e8d0
};
Packit d7e8d0
Packit d7e8d0
}
Packit d7e8d0
#endif