• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kleopatra

  • sources
  • kde-4.14
  • kdepim
  • kleopatra
  • crypto
task.h
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  crypto/task.h
3 
4  This file is part of Kleopatra, the KDE keymanager
5  Copyright (c) 2007 Klarälvdalens Datakonsult AB
6 
7  Kleopatra is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  Kleopatra is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  In addition, as a special exception, the copyright holders give
22  permission to link the code of this program with any edition of
23  the Qt library by Trolltech AS, Norway (or with modified versions
24  of Qt that use the same license as Qt), and distribute linked
25  combinations including the two. You must obey the GNU General
26  Public License in all respects for all of the code used other than
27  Qt. If you modify this file, you may extend this exception to
28  your version of the file, but you are not obligated to do so. If
29  you do not wish to do so, delete this exception statement from
30  your version.
31 */
32 
33 #ifndef __KLEOPATRA_CRYPTO_TASK_H__
34 #define __KLEOPATRA_CRYPTO_TASK_H__
35 
36 #include <QObject>
37 #include <QString>
38 
39 #include <utils/pimpl_ptr.h>
40 
41 #include <gpgme++/global.h>
42 
43 #ifndef Q_MOC_RUN
44 #include <boost/shared_ptr.hpp>
45 #endif
46 
47 class QColor;
48 class QIcon;
49 
50 namespace Kleo {
51  class AuditLog;
52 }
53 
54 namespace Kleo {
55 namespace Crypto {
56 
57  class Task : public QObject {
58  Q_OBJECT
59  public:
60  explicit Task( QObject * parent=0 );
61  ~Task();
62 
63  class Result;
64 
65  void setAsciiArmor( bool armor );
66  bool asciiArmor() const;
67 
68  virtual GpgME::Protocol protocol() const = 0;
69 
70  void start();
71 
72  virtual QString label() const = 0;
73 
74  virtual QString tag() const;
75 
76  QString progressLabel() const;
77  unsigned long long processedSize() const;
78  unsigned long long totalSize() const;
79 
80  int id() const;
81 
82 
83  static boost::shared_ptr<Task> makeErrorTask( int code, const QString & details, const QString & label );
84 
85  public Q_SLOTS:
86  virtual void cancel() = 0;
87 
88  Q_SIGNALS:
89 
90 #ifndef Q_MOC_RUN
91 #ifndef DOXYGEN_SHOULD_SKIP_THIS
92 private: // don't tell moc, but those signals are in fact private
93 #endif
94 #endif
95  void progress( const QString & what, int processed, int total );
96  void result( const boost::shared_ptr<const Kleo::Crypto::Task::Result> & );
97  void started();
98 
99  protected:
100  boost::shared_ptr<Result> makeErrorResult( int errCode, const QString& details );
101 
102  void emitResult( const boost::shared_ptr<const Task::Result> & result );
103 
104  protected Q_SLOTS:
105  void setProgress( const QString & msg, int processed, int total );
106 
107  private Q_SLOTS:
108  void emitError( int errCode, const QString& details );
109 
110  private:
111  virtual void doStart() = 0;
112  virtual unsigned long long inputSize() const = 0;
113 
114  private:
115  class Private;
116  kdtools::pimpl_ptr<Private> d;
117  };
118 
119  class Task::Result {
120  const QString m_nonce;
121  public:
122  Result();
123  virtual ~Result();
124 
125  const QString & nonce() const { return m_nonce; }
126 
127  bool hasError() const;
128 
129  enum VisualCode {
130  AllGood,
131  Warning,
132  Danger,
133  NeutralSuccess,
134  NeutralError
135  };
136 
137  virtual QString icon() const;
138  virtual QString overview() const = 0;
139  virtual QString details() const = 0;
140  virtual int errorCode() const = 0;
141  virtual QString errorString() const = 0;
142  virtual VisualCode code() const = 0;
143  virtual AuditLog auditLog() const = 0;
144 
145  protected:
146  static QString iconPath( VisualCode code );
147  QString formatKeyLink( const char * fingerprint, const QString & content ) const;
148  static QString makeOverview( const QString& msg );
149 
150  private:
151  class Private;
152  kdtools::pimpl_ptr<Private> d;
153  };
154 
155 }
156 }
157 
158 #endif /* __KLEOPATRA_CRYPTO_TASK_H__ */
159 
Kleo::Crypto::Task::Result::overview
virtual QString overview() const =0
Kleo::Crypto::Task::Result::code
virtual VisualCode code() const =0
Kleo::Crypto::Task::setAsciiArmor
void setAsciiArmor(bool armor)
Definition: task.cpp:112
Kleo::Crypto::Task::id
int id() const
Definition: task.cpp:128
kdtools::pimpl_ptr< Private >
pimpl_ptr.h
Kleo::Crypto::Task::Result::icon
virtual QString icon() const
Definition: task.cpp:241
Kleo::Crypto::Task::Result::nonce
const QString & nonce() const
Definition: task.h:125
Kleo::Crypto::Task::Result::VisualCode
VisualCode
Definition: task.h:129
Kleo::AuditLog
Definition: auditlog.h:48
Kleo::Crypto::Task::Result::formatKeyLink
QString formatKeyLink(const char *fingerprint, const QString &content) const
Definition: task.cpp:205
Kleo::Crypto::Task::Result::Danger
Definition: task.h:132
Kleo::Crypto::Task::Result::NeutralError
Definition: task.h:134
Kleo::Crypto::Task
Definition: task.h:57
Kleo::Crypto::Task::Result::~Result
virtual ~Result()
Definition: task.cpp:203
Kleo::Crypto::Task::tag
virtual QString tag() const
Definition: task.cpp:143
Kleo::Crypto::Task::cancel
virtual void cancel()=0
boost::shared_ptr
Definition: encryptemailcontroller.h:51
d
#define d
Definition: adduseridcommand.cpp:89
Kleo::Crypto::Task::totalSize
unsigned long long totalSize() const
Definition: task.cpp:138
QObject
Kleo::Crypto::Task::processedSize
unsigned long long processedSize() const
Definition: task.cpp:133
Kleo::Crypto::Task::start
void start()
Definition: task.cpp:160
QString
QColor
Kleo::Crypto::Task::~Task
~Task()
Definition: task.cpp:110
Kleo::Crypto::Task::makeErrorTask
static boost::shared_ptr< Task > makeErrorTask(int code, const QString &details, const QString &label)
Definition: task.cpp:122
Kleo::Crypto::Task::setProgress
void setProgress(const QString &msg, int processed, int total)
Definition: task.cpp:152
Kleo::Crypto::Task::asciiArmor
bool asciiArmor() const
Definition: task.cpp:117
Kleo::Crypto::Task::Result
Definition: task.h:119
Kleo::Crypto::Task::Result::Warning
Definition: task.h:131
Kleo::Crypto::Task::Result::details
virtual QString details() const =0
Kleo::Crypto::Task::progressLabel
QString progressLabel() const
Definition: task.cpp:147
Kleo::Crypto::Task::Result::AllGood
Definition: task.h:130
Kleo::Crypto::Task::Result::hasError
bool hasError() const
Definition: task.cpp:209
Kleo::Crypto::Task::Result::auditLog
virtual AuditLog auditLog() const =0
Kleo::Crypto::Task::Result::NeutralSuccess
Definition: task.h:133
Kleo::Crypto::Task::makeErrorResult
boost::shared_ptr< Result > makeErrorResult(int errCode, const QString &details)
Definition: task.cpp:186
Kleo::Crypto::Task::Result::iconPath
static QString iconPath(VisualCode code)
Definition: task.cpp:224
Kleo::Crypto::Task::label
virtual QString label() const =0
Kleo::Crypto::Task::Result::errorCode
virtual int errorCode() const =0
QObject::parent
QObject * parent() const
Kleo::Crypto::Task::emitResult
void emitResult(const boost::shared_ptr< const Task::Result > &result)
Definition: task.cpp:179
Kleo::Crypto::Task::protocol
virtual GpgME::Protocol protocol() const =0
Kleo::Crypto::Task::Result::errorString
virtual QString errorString() const =0
Kleo::Crypto::Task::Task
Task(QObject *parent=0)
Definition: task.cpp:104
Kleo::Crypto::Task::Result::makeOverview
static QString makeOverview(const QString &msg)
Definition: task.cpp:219
QIcon
Kleo::Crypto::Task::Result::Result
Result()
Definition: task.cpp:202
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kleopatra

Skip menu "kleopatra"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal