• 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
  • utils
archivedefinition.h
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  utils/archivedefinition.h
3 
4  This file is part of Kleopatra, the KDE keymanager
5  Copyright (c) 2009 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_UTILS_ARCHIVEDEFINITION_H__
34 #define __KLEOPATRA_UTILS_ARCHIVEDEFINITION_H__
35 
36 #include <QString>
37 #include <QStringList>
38 #include <QMetaType>
39 
40 #include <gpgme++/global.h> // GpgME::Protocol
41 
42 #include <vector>
43 
44 class QDir;
45 
46 namespace boost {
47  template <typename T> class shared_ptr;
48 }
49 
50 namespace Kleo {
51  class Input;
52  class Output;
53 }
54 
55 namespace Kleo {
56 
57  class ArchiveDefinition {
58  protected:
59  ArchiveDefinition( const QString & id, const QString & label );
60  public:
61  virtual ~ArchiveDefinition();
62 
63  enum ArgumentPassingMethod {
64  CommandLine,
65  NewlineSeparatedInputFile,
66  NullSeparatedInputFile,
67 
68  NumArgumentPassingMethods
69  };
70 
71  QString id() const { return m_id; }
72  QString label() const { return m_label; }
73 
74  const QStringList & extensions( GpgME::Protocol p ) const { checkProtocol(p); return m_extensions[p]; }
75 
76  boost::shared_ptr<Input> createInputFromPackCommand( GpgME::Protocol p, const QStringList & files ) const;
77  ArgumentPassingMethod packCommandArgumentPassingMethod( GpgME::Protocol p ) const { checkProtocol(p); return m_packCommandMethod[p]; }
78 
79  boost::shared_ptr<Output> createOutputFromUnpackCommand( GpgME::Protocol p, const QString & file, const QDir & wd ) const;
80  // unpack-command must use CommandLine ArgumentPassingMethod
81 
82  static QString installPath();
83  static void setInstallPath( const QString & ip );
84 
85  static std::vector< boost::shared_ptr<ArchiveDefinition> > getArchiveDefinitions();
86  static std::vector< boost::shared_ptr<ArchiveDefinition> > getArchiveDefinitions( QStringList & errors );
87 
88  protected:
89  void setPackCommandArgumentPassingMethod( GpgME::Protocol p, ArgumentPassingMethod method ) { checkProtocol(p); m_packCommandMethod[p] = method; }
90  void setExtensions( GpgME::Protocol p, const QStringList & extensions ) { checkProtocol(p); m_extensions[p] = extensions; }
91 
92  void checkProtocol( GpgME::Protocol p ) const;
93 
94  private:
95  virtual QString doGetPackCommand( GpgME::Protocol p ) const = 0;
96  virtual QString doGetUnpackCommand( GpgME::Protocol p ) const = 0;
97  virtual QStringList doGetPackArguments( GpgME::Protocol p, const QStringList & files ) const = 0;
98  virtual QStringList doGetUnpackArguments( GpgME::Protocol p, const QString & file ) const = 0;
99  private:
100  const QString m_id;
101  const QString m_label;
102  /*const*/ QStringList m_extensions[2];
103  ArgumentPassingMethod m_packCommandMethod[2];
104  // m_unpackCommandMethod[2] <- must always be CommandLine
105  };
106 
107 }
108 
109 Q_DECLARE_METATYPE( boost::shared_ptr<Kleo::ArchiveDefinition> )
110 
111 
112 #endif /* __KLEOPATRA_UTILS_ARCHIVEDEFINITION_H__ */
113 
Kleo::ArchiveDefinition::ArgumentPassingMethod
ArgumentPassingMethod
Definition: archivedefinition.h:63
Kleo::ArchiveDefinition::checkProtocol
void checkProtocol(GpgME::Protocol p) const
Definition: archivedefinition.cpp:379
Kleo::ArchiveDefinition::NullSeparatedInputFile
Definition: archivedefinition.h:66
Kleo::ArchiveDefinition::packCommandArgumentPassingMethod
ArgumentPassingMethod packCommandArgumentPassingMethod(GpgME::Protocol p) const
Definition: archivedefinition.h:77
Kleo::ArchiveDefinition::label
QString label() const
Definition: archivedefinition.h:72
Kleo::ArchiveDefinition::NumArgumentPassingMethods
Definition: archivedefinition.h:68
Kleo::ArchiveDefinition::~ArchiveDefinition
virtual ~ArchiveDefinition()
Definition: archivedefinition.cpp:305
Kleo::ArchiveDefinition::extensions
const QStringList & extensions(GpgME::Protocol p) const
Definition: archivedefinition.h:74
boost::shared_ptr
Definition: encryptemailcontroller.h:51
Kleo::ArchiveDefinition::ArchiveDefinition
ArchiveDefinition(const QString &id, const QString &label)
Definition: archivedefinition.cpp:298
Kleo::ArchiveDefinition::CommandLine
Definition: archivedefinition.h:64
Kleo::ArchiveDefinition::createOutputFromUnpackCommand
boost::shared_ptr< Output > createOutputFromUnpackCommand(GpgME::Protocol p, const QString &file, const QDir &wd) const
Definition: archivedefinition.cpp:345
Kleo::ArchiveDefinition::installPath
static QString installPath()
Definition: archivedefinition.cpp:68
Kleo::ArchiveDefinition::id
QString id() const
Definition: archivedefinition.h:71
Kleo::ArchiveDefinition::setPackCommandArgumentPassingMethod
void setPackCommandArgumentPassingMethod(GpgME::Protocol p, ArgumentPassingMethod method)
Definition: archivedefinition.h:89
Kleo::ArchiveDefinition::setInstallPath
static void setInstallPath(const QString &ip)
Definition: archivedefinition.cpp:78
Kleo::ArchiveDefinition::createInputFromPackCommand
boost::shared_ptr< Input > createInputFromPackCommand(GpgME::Protocol p, const QStringList &files) const
Definition: archivedefinition.cpp:316
Kleo::ArchiveDefinition::setExtensions
void setExtensions(GpgME::Protocol p, const QStringList &extensions)
Definition: archivedefinition.h:90
Kleo::ArchiveDefinition::NewlineSeparatedInputFile
Definition: archivedefinition.h:65
Kleo::ArchiveDefinition
Definition: archivedefinition.h:57
Kleo::ArchiveDefinition::getArchiveDefinitions
static std::vector< boost::shared_ptr< ArchiveDefinition > > getArchiveDefinitions()
Definition: archivedefinition.cpp:354
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:40 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