Page MenuHome GnuPG

D617.id1649.diff
No OneTemporary

D617.id1649.diff

Index: src/context.h
===================================================================
--- src/context.h
+++ src/context.h
@@ -249,7 +249,16 @@
// Key Deletion
//
+ enum class DeletionFlags : unsigned int {
+ // Keep in line with one's GPGME_DELETE_* flags
+ DeleteUseDefaults = 0,
+ DeleteAllowSecret = (1 << 0),
+ DeleteForce = (1 << 1),
+
+ };
+
GpgME::Error deleteKey(const Key &key, bool allowSecretKeyDeletion = false);
+ GpgME::Error deleteKey(const Key &key, DeletionFlags flags);
GpgME::Error startKeyDeletion(const Key &key, bool allowSecretKeyDeletion = false);
//
@@ -663,6 +672,10 @@
std::underlying_type_t<Context::CreationFlags>(rh));
}
+inline Context::DeletionFlags operator|(Context::DeletionFlags lhs, Context::DeletionFlags rhs)
+{
+ return static_cast<Context::DeletionFlags>(static_cast<char>(lhs) | static_cast<char>(rhs));
+}
} // namespace GpgME
#endif // __GPGMEPP_CONTEXT_H__
Index: src/context.cpp
===================================================================
--- src/context.cpp
+++ src/context.cpp
@@ -759,9 +759,14 @@
}
Error Context::deleteKey(const Key &key, bool allowSecretKeyDeletion)
+{
+ return deleteKey(key, allowSecretKeyDeletion ? DeletionFlags::DeleteAllowSecret : DeletionFlags::DeleteUseDefaults);
+}
+
+Error Context::deleteKey(const Key &key, DeletionFlags flags)
{
d->lastop = Private::Delete;
- return Error(d->lasterr = gpgme_op_delete(d->ctx, key.impl(), int(allowSecretKeyDeletion)));
+ return Error(d->lasterr = gpgme_op_delete_ext(d->ctx, key.impl(), (int) flags));
}
Error Context::startKeyDeletion(const Key &key, bool allowSecretKeyDeletion)

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 30, 10:26 PM (5 h, 19 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
3c/79/9ab61ec831354ec59a2682fe6c88

Event Timeline