Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F34070558
D617.id1649.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
D617.id1649.diff
View Options
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
Details
Attached
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
Attached To
D617: Allow passing flags to Context::deleteKey
Event Timeline
Log In to Comment