• 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
  • libkleopatraclient
  • core
libkleopatraclient/core/selectcertificatecommand.cpp
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  core/selectcertificatecommand.cpp
3 
4  This file is part of KleopatraClient, the Kleopatra interface library
5  Copyright (c) 2008 Klarälvdalens Datakonsult AB
6 
7  KleopatraClient is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Library 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  KleopatraClient 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  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library 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 
22 #include "selectcertificatecommand.h"
23 
24 using namespace KLEOPATRACLIENT_NAMESPACE;
25 
26 SelectCertificateCommand::SelectCertificateCommand( QObject * p )
27  : Command( p )
28 {
29  setCommand( "SELECT_CERTIFICATE" );
30 }
31 
32 SelectCertificateCommand::~SelectCertificateCommand() {}
33 
34 void SelectCertificateCommand::setMultipleCertificatesAllowed( bool allow ) {
35  if ( allow )
36  setOption( "multi", true );
37  else
38  unsetOption( "multi" );
39 }
40 
41 bool SelectCertificateCommand::multipleCertificatesAllowed() const {
42  return isOptionSet( "multi" );
43 }
44 
45 
46 void SelectCertificateCommand::setOnlySigningCertificatesAllowed( bool allow ) {
47  if ( allow )
48  setOption( "sign-only", true );
49  else
50  unsetOption( "sign-only" );
51 }
52 
53 bool SelectCertificateCommand::onlySigningCertificatesAllowed() const {
54  return isOptionSet( "sign-only" );
55 }
56 
57 
58 void SelectCertificateCommand::setOnlyEncryptionCertificatesAllowed( bool allow ) {
59  if ( allow )
60  setOption( "encrypt-only", true );
61  else
62  unsetOption( "encrypt-only" );
63 }
64 
65 bool SelectCertificateCommand::onlyEncryptionCertificatesAllowed() const {
66  return isOptionSet( "encrypt-only" );
67 }
68 
69 
70 void SelectCertificateCommand::setOnlyOpenPGPCertificatesAllowed( bool allow ) {
71  if ( allow )
72  setOption( "openpgp-only", true );
73  else
74  unsetOption( "openpgp-only" );
75 }
76 
77 bool SelectCertificateCommand::onlyOpenPGPCertificatesAllowed() const {
78  return isOptionSet( "openpgp-only" );
79 }
80 
81 
82 void SelectCertificateCommand::setOnlyX509CertificatesAllowed( bool allow ) {
83  if ( allow )
84  setOption( "x509-only", true );
85  else
86  unsetOption( "x509-only" );
87 }
88 
89 bool SelectCertificateCommand::onlyX509CertificatesAllowed() const {
90  return isOptionSet( "x509-only" );
91 }
92 
93 
94 void SelectCertificateCommand::setOnlySecretKeysAllowed( bool allow ) {
95  if ( allow )
96  setOption( "secret-only", true );
97  else
98  unsetOption( "secret-only" );
99 }
100 
101 bool SelectCertificateCommand::onlySecretKeysAllowed() const {
102  return isOptionSet( "secret-only" );
103 }
104 
105 void SelectCertificateCommand::setSelectedCertificates( const QStringList & certs ) {
106  QByteArray data;
107  Q_FOREACH( const QString & s, certs )
108  if ( s.isEmpty() )
109  qWarning( "SelectCertificateCommand::setSelectedCertificates: empty certificate!" );
110  else
111  data += s.toUtf8() += '\n';
112  setInquireData( "SELECTED_CERTIFICATES", data );
113 }
114 
115 QStringList SelectCertificateCommand::selectedCertificates() const {
116  const QByteArray data = receivedData();
117  return QString::fromLatin1( data.data(), data.size() ).split( QLatin1Char( '\n' ), QString::SkipEmptyParts );
118 }
119 
120 void SelectCertificateCommand::setSelectedCertificate( const QString & cert ) {
121  setSelectedCertificates( QStringList( cert ) );
122 }
123 
124 QString SelectCertificateCommand::selectedCertificate() const {
125  const QStringList sl = selectedCertificates();
126  return sl.empty() ? QString() : sl.front() ;
127 }
128 
129 #include "moc_selectcertificatecommand.cpp"
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setSelectedCertificates
void setSelectedCertificates(const QStringList &certs)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:105
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::SelectCertificateCommand
SelectCertificateCommand(QObject *parent=0)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:26
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::onlyX509CertificatesAllowed
bool onlyX509CertificatesAllowed() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:89
KLEOPATRACLIENT_NAMESPACE::Command::receivedData
QByteArray receivedData() const
Definition: libkleopatraclient/core/command.cpp:325
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setOnlyOpenPGPCertificatesAllowed
void setOnlyOpenPGPCertificatesAllowed(bool allow)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:70
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::multipleCertificatesAllowed
bool multipleCertificatesAllowed() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:41
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::onlySigningCertificatesAllowed
bool onlySigningCertificatesAllowed() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:53
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::onlyEncryptionCertificatesAllowed
bool onlyEncryptionCertificatesAllowed() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:65
KLEOPATRACLIENT_NAMESPACE::Command::setCommand
void setCommand(const char *command)
Definition: libkleopatraclient/core/command.cpp:331
KLEOPATRACLIENT_NAMESPACE::Command::setInquireData
void setInquireData(const char *what, const QByteArray &data)
Definition: libkleopatraclient/core/command.cpp:299
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setMultipleCertificatesAllowed
void setMultipleCertificatesAllowed(bool allow)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:34
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::onlyOpenPGPCertificatesAllowed
bool onlyOpenPGPCertificatesAllowed() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:77
KLEOPATRACLIENT_NAMESPACE::Command::isOptionSet
bool isOptionSet(const char *name) const
Definition: libkleopatraclient/core/command.cpp:239
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::selectedCertificates
QStringList selectedCertificates() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:115
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::~SelectCertificateCommand
~SelectCertificateCommand()
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:32
selectcertificatecommand.h
KLEOPATRACLIENT_NAMESPACE::Command::setOption
void setOption(const char *name, bool critical=true)
Definition: libkleopatraclient/core/command.cpp:215
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setSelectedCertificate
void setSelectedCertificate(const QString &cert)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:120
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::onlySecretKeysAllowed
bool onlySecretKeysAllowed() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:101
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setOnlySecretKeysAllowed
void setOnlySecretKeysAllowed(bool allow)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:94
KLEOPATRACLIENT_NAMESPACE::Command::unsetOption
void unsetOption(const char *name)
Definition: libkleopatraclient/core/command.cpp:232
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setOnlyX509CertificatesAllowed
void setOnlyX509CertificatesAllowed(bool allow)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:82
KLEOPATRACLIENT_NAMESPACE::Command
Definition: libkleopatraclient/core/command.h:36
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::selectedCertificate
QString selectedCertificate() const
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:124
KLEOPATRACLIENT_NAMESPACE
#define KLEOPATRACLIENT_NAMESPACE
Definition: kleopatraclient_export.h:61
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setOnlySigningCertificatesAllowed
void setOnlySigningCertificatesAllowed(bool allow)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:46
KLEOPATRACLIENT_NAMESPACE::SelectCertificateCommand::setOnlyEncryptionCertificatesAllowed
void setOnlyEncryptionCertificatesAllowed(bool allow)
Definition: libkleopatraclient/core/selectcertificatecommand.cpp:58
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