Page MenuHome GnuPG

selectcertificatecommand.cpp
No OneTemporary

selectcertificatecommand.cpp

/* -*- mode: c++; c-basic-offset:4 -*-
core/selectcertificatecommand.cpp
This file is part of KleopatraClient, the Kleopatra interface library
Copyright (c) 2008 Klarälvdalens Datakonsult AB
KleopatraClient is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
KleopatraClient is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "selectcertificatecommand.h"
using namespace KLEOPATRACLIENT_NAMESPACE;
SelectCertificateCommand::SelectCertificateCommand( QObject * p )
: Command( p )
{
setCommand( "SELECT_CERTIFICATE" );
}
SelectCertificateCommand::~SelectCertificateCommand() {}
void SelectCertificateCommand::setMultipleCertificatesAllowed( bool allow ) {
if ( allow )
setOption( "multi", true );
else
unsetOption( "multi" );
}
bool SelectCertificateCommand::multipleCertificatesAllowed() const {
return isOptionSet( "multi" );
}
void SelectCertificateCommand::setOnlySigningCertificatesAllowed( bool allow ) {
if ( allow )
setOption( "sign-only", true );
else
unsetOption( "sign-only" );
}
bool SelectCertificateCommand::onlySigningCertificatesAllowed() const {
return isOptionSet( "sign-only" );
}
void SelectCertificateCommand::setOnlyEncryptionCertificatesAllowed( bool allow ) {
if ( allow )
setOption( "encrypt-only", true );
else
unsetOption( "encrypt-only" );
}
bool SelectCertificateCommand::onlyEncryptionCertificatesAllowed() const {
return isOptionSet( "encrypt-only" );
}
void SelectCertificateCommand::setOnlyOpenPGPCertificatesAllowed( bool allow ) {
if ( allow )
setOption( "openpgp-only", true );
else
unsetOption( "openpgp-only" );
}
bool SelectCertificateCommand::onlyOpenPGPCertificatesAllowed() const {
return isOptionSet( "openpgp-only" );
}
void SelectCertificateCommand::setOnlyX509CertificatesAllowed( bool allow ) {
if ( allow )
setOption( "x509-only", true );
else
unsetOption( "x509-only" );
}
bool SelectCertificateCommand::onlyX509CertificatesAllowed() const {
return isOptionSet( "x509-only" );
}
void SelectCertificateCommand::setOnlySecretKeysAllowed( bool allow ) {
if ( allow )
setOption( "secret-only", true );
else
unsetOption( "secret-only" );
}
bool SelectCertificateCommand::onlySecretKeysAllowed() const {
return isOptionSet( "secret-only" );
}
void SelectCertificateCommand::setSelectedCertificates( const QStringList & certs ) {
qDebug( "SelectCertificateCommand::setSelectedCertificates: not yet implemented!" );
}
QStringList SelectCertificateCommand::selectedCertificates() const {
return QString::fromLatin1( receivedData() ).split( QLatin1Char( '\n' ), QString::SkipEmptyParts );
}
void SelectCertificateCommand::setSelectedCertificate( const QString & cert ) {
setSelectedCertificates( QStringList( cert ) );
}
QString SelectCertificateCommand::selectedCertificate() const {
const QStringList sl = selectedCertificates();
return sl.empty() ? QString() : sl.front() ;
}
#include "moc_selectcertificatecommand.cpp"

File Metadata

Mime Type
text/x-c
Expires
Sun, Jan 18, 10:39 PM (5 h, 48 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fc/d6/dcce44ec0db17b3289561ce98673

Event Timeline