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

kleopatra

  • sources
  • kde-4.12
  • 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 #include <boost/shared_ptr.hpp>
44 
45 class QColor;
46 class QIcon;
47 
48 namespace Kleo {
49  class AuditLog;
50 }
51 
52 namespace Kleo {
53 namespace Crypto {
54 
55  class Task : public QObject {
56  Q_OBJECT
57  public:
58  explicit Task( QObject * parent=0 );
59  ~Task();
60 
61  class Result;
62 
63  void setAsciiArmor( bool armor );
64  bool asciiArmor() const;
65 
66  virtual GpgME::Protocol protocol() const = 0;
67 
68  void start();
69 
70  virtual QString label() const = 0;
71 
72  virtual QString tag() const;
73 
74  QString progressLabel() const;
75  unsigned long long processedSize() const;
76  unsigned long long totalSize() const;
77 
78  int id() const;
79 
80 
81  static boost::shared_ptr<Task> makeErrorTask( int code, const QString & details, const QString & label );
82 
83  public Q_SLOTS:
84  virtual void cancel() = 0;
85 
86  Q_SIGNALS:
87 
88 #ifndef Q_MOC_RUN
89 #ifndef DOXYGEN_SHOULD_SKIP_THIS
90 private: // don't tell moc, but those signals are in fact private
91 #endif
92 #endif
93  void progress( const QString & what, int processed, int total );
94  void result( const boost::shared_ptr<const Kleo::Crypto::Task::Result> & );
95  void started();
96 
97  protected:
98  boost::shared_ptr<Result> makeErrorResult( int errCode, const QString& details );
99 
100  void emitResult( const boost::shared_ptr<const Task::Result> & result );
101 
102  protected Q_SLOTS:
103  void setProgress( const QString & msg, int processed, int total );
104 
105  private Q_SLOTS:
106  void emitError( int errCode, const QString& details );
107 
108  private:
109  virtual void doStart() = 0;
110  virtual unsigned long long inputSize() const = 0;
111 
112  private:
113  class Private;
114  kdtools::pimpl_ptr<Private> d;
115  };
116 
117  class Task::Result {
118  const QString m_nonce;
119  public:
120  Result();
121  virtual ~Result();
122 
123  const QString & nonce() const { return m_nonce; }
124 
125  bool hasError() const;
126 
127  enum VisualCode {
128  AllGood,
129  Warning,
130  Danger,
131  NeutralSuccess,
132  NeutralError
133  };
134 
135  virtual QString icon() const;
136  virtual QString overview() const = 0;
137  virtual QString details() const = 0;
138  virtual int errorCode() const = 0;
139  virtual QString errorString() const = 0;
140  virtual VisualCode code() const = 0;
141  virtual AuditLog auditLog() const = 0;
142 
143  protected:
144  static QString iconPath( VisualCode code );
145  QString formatKeyLink( const char * fingerprint, const QString & content ) const;
146  static QString makeOverview( const QString& msg );
147 
148  private:
149  class Private;
150  kdtools::pimpl_ptr<Private> d;
151  };
152 
153 }
154 }
155 
156 #endif /* __KLEOPATRA_CRYPTO_TASK_H__ */
157 
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:111
Kleo::Crypto::Task::id
int id() const
Definition: task.cpp:127
kdtools::pimpl_ptr< Private >
pimpl_ptr.h
Kleo::Crypto::Task::Result::icon
virtual QString icon() const
Definition: task.cpp:240
Kleo::Crypto::Task::Result::nonce
const QString & nonce() const
Definition: task.h:123
Kleo::Crypto::Task::Result::VisualCode
VisualCode
Definition: task.h:127
Kleo::AuditLog
Definition: auditlog.h:48
Kleo::Crypto::Task::Result::formatKeyLink
QString formatKeyLink(const char *fingerprint, const QString &content) const
Definition: task.cpp:204
Kleo::Crypto::Task::Result::Danger
Definition: task.h:130
Kleo::Crypto::Task::Result::NeutralError
Definition: task.h:132
Kleo::Crypto::Task
Definition: task.h:55
Kleo::Crypto::Task::Result::~Result
virtual ~Result()
Definition: task.cpp:202
Kleo::Crypto::Task::tag
virtual QString tag() const
Definition: task.cpp:142
Kleo::Crypto::Task::cancel
virtual void cancel()=0
boost::shared_ptr
Definition: encryptemailcontroller.h:51
d
#define d
Definition: adduseridcommand.cpp:90
Kleo::Crypto::Task::totalSize
unsigned long long totalSize() const
Definition: task.cpp:137
Kleo::Crypto::Task::processedSize
unsigned long long processedSize() const
Definition: task.cpp:132
Kleo::Crypto::Task::start
void start()
Definition: task.cpp:159
Kleo::Crypto::Task::~Task
~Task()
Definition: task.cpp:109
Kleo::Crypto::Task::makeErrorTask
static boost::shared_ptr< Task > makeErrorTask(int code, const QString &details, const QString &label)
Definition: task.cpp:121
Kleo::Crypto::Task::setProgress
void setProgress(const QString &msg, int processed, int total)
Definition: task.cpp:151
Kleo::Crypto::Task::asciiArmor
bool asciiArmor() const
Definition: task.cpp:116
Kleo::Crypto::Task::Result
Definition: task.h:117
Kleo::Crypto::Task::Result::Warning
Definition: task.h:129
Kleo::Crypto::Task::Result::details
virtual QString details() const =0
Kleo::Crypto::Task::progressLabel
QString progressLabel() const
Definition: task.cpp:146
Kleo::Crypto::Task::Result::AllGood
Definition: task.h:128
Kleo::Crypto::Task::Result::hasError
bool hasError() const
Definition: task.cpp:208
Kleo::Crypto::Task::Result::auditLog
virtual AuditLog auditLog() const =0
Kleo::Crypto::Task::Result::NeutralSuccess
Definition: task.h:131
Kleo::Crypto::Task::makeErrorResult
boost::shared_ptr< Result > makeErrorResult(int errCode, const QString &details)
Definition: task.cpp:185
Kleo::Crypto::Task::Result::iconPath
static QString iconPath(VisualCode code)
Definition: task.cpp:223
Kleo::Crypto::Task::label
virtual QString label() const =0
Kleo::Crypto::Task::Result::errorCode
virtual int errorCode() const =0
Kleo::Crypto::Task::emitResult
void emitResult(const boost::shared_ptr< const Task::Result > &result)
Definition: task.cpp:178
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:103
Kleo::Crypto::Task::Result::makeOverview
static QString makeOverview(const QString &msg)
Definition: task.cpp:218
Kleo::Crypto::Task::Result::Result
Result()
Definition: task.cpp:201
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:42 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

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