Commit 60f5ac4f authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Make KeyParameters copyable and movable

GnuPG-bug-id: 5832
parent 8a35d159
......@@ -42,16 +42,14 @@ namespace
class KeyParameters::Private
{
friend class ::Kleo::KeyParameters;
KeyParameters *const q;
Protocol protocol;
QString keyType;
QMap<QString, QStringList> parameters;
public:
explicit Private(KeyParameters *qq, Protocol proto)
: q(qq)
, protocol(proto)
explicit Private(Protocol proto)
: protocol(proto)
{
}
......@@ -67,14 +65,27 @@ public:
};
KeyParameters::KeyParameters(Protocol protocol)
: d(new Private(this, protocol))
: d{new Private{protocol}}
{
}
KeyParameters::~KeyParameters()
KeyParameters::~KeyParameters() = default;
KeyParameters::KeyParameters(const KeyParameters &other)
: d{new Private{*other.d}}
{
}
KeyParameters &KeyParameters::operator=(const KeyParameters &other)
{
*d = *other.d;
return *this;
}
KeyParameters::KeyParameters(KeyParameters &&other) = default;
KeyParameters &KeyParameters::operator=(KeyParameters &&other) = default;
void KeyParameters::setKeyType(Subkey::PubkeyAlgo type)
{
d->keyType = QString::fromLatin1(Subkey::publicKeyAlgorithmAsString(type));
......
......@@ -32,6 +32,12 @@ public:
explicit KeyParameters(Protocol protocol);
~KeyParameters();
KeyParameters(const KeyParameters &other);
KeyParameters &operator=(const KeyParameters &other);
KeyParameters(KeyParameters &&other);
KeyParameters &operator=(KeyParameters &&other);
void setKeyType(GpgME::Subkey::PubkeyAlgo type);
void setKeyType(const QString &cardKeyRef);
void setKeyLength(unsigned int length);
......@@ -56,7 +62,7 @@ public:
private:
class Private;
const std::unique_ptr<Private> d;
std::unique_ptr<Private> d;
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment