diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-01-26 15:35:42 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-01-27 08:26:19 +0000 |
commit | 23a0ee3c01c3588472e1c19605909d6b9401253c (patch) | |
tree | bd455470684500e310c1801fdde6fe2f528f93f9 /include | |
parent | f8151c9ced1a2fdce6273fbbce2656bea25cf754 (diff) |
libreofficekit: password interaction optional and off by default
Add setOptionalFeatures() function that clients must call during
initialization, and enum LibreOfficeKitOptionalFeatures.
Change-Id: I73035193c87033052921c3aad94fdc057fe81111
Reviewed-on: https://gerrit.libreoffice.org/21809
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 4 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 10 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 26 |
3 files changed, 40 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 5a20ec5e47a1..ee9ac1aca646 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -15,6 +15,7 @@ #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY // the unstable API needs C99's bool #include <stdbool.h> +#include <stdint.h> #endif #include <LibreOfficeKit/LibreOfficeKitTypes.h> @@ -65,6 +66,9 @@ struct _LibreOfficeKitClass /// @see lok::Office::getFilterTypes(). char* (*getFilterTypes) (LibreOfficeKit* pThis); + /// @see lok::Office::setOptionalFeatures(). + void (*setOptionalFeatures)(LibreOfficeKit* pThis, uint64_t features); + /// @see lok::Office::setDocumentPassword(). void (*setDocumentPassword) (LibreOfficeKit* pThis, char const* pURL, diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 57066c69c18c..31328914e239 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -462,6 +462,16 @@ public: } /** + * Set bitmask of optional features supported by the client. + * + * @see LibreOfficeKitOptionalFeatures + */ + void setOptionalFeatures(uint64_t features) + { + return mpThis->pClass->setOptionalFeatures(mpThis, features); + } + + /** * Set password required for loading or editing a document. * * Loading the document is blocked until the password is provided. diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 395b2b761891..b615bd94f9d1 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -40,6 +40,32 @@ typedef enum } LibreOfficeKitTileMode; +/** Optional features of LibreOfficeKit, in particular callbacks that block + * LibreOfficeKit until the corresponding reply is received, which would + * deadlock if the client does not support the feature. + * + * @see lok::Office::setOptionalFeatures(). + */ +typedef enum +{ + /** + * Handle LOK_CALLBACK_DOCUMENT_PASSWORD by prompting the user + * for a password. + * + * @see lok::Office::setDocumentPassword(). + */ + LOK_FEATURE_DOCUMENT_PASSWORD = (1ULL << 0), + + /** + * Handle LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY by prompting the user + * for a password. + * + * @see lok::Office::setDocumentPassword(). + */ + LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY = (1ULL << 1), +} +LibreOfficeKitOptionalFeatures; + typedef enum { /** |