diff options
author | Jaume Pujantell <jaume.pujantell@collabora.com> | 2023-05-10 23:19:04 +0200 |
---|---|---|
committer | Ashod Nakashian <ash@collabora.com> | 2023-05-23 04:21:52 +0200 |
commit | 88db520407ed5786466513c9486ebb633ce140df (patch) | |
tree | 9bd150c967db63f763cf8f6a48ae49b17f6c7ec4 | |
parent | put floating frames under managed links control (diff) | |
download | core-88db520407ed5786466513c9486ebb633ce140df.tar.gz core-88db520407ed5786466513c9486ebb633ce140df.zip |
notify async password change
Change-Id: I2d16c9804e65f093239e810d466de35286b28dee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151789
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ash@collabora.com>
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 8 | ||||
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 9 |
3 files changed, 18 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 0094b94de559..7e1110089e52 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -907,6 +907,12 @@ typedef enum * "file:///tmp/hello-world.pdf" */ LOK_CALLBACK_EXPORT_FILE = 59, + + /** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. + */ + LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 62 } LibreOfficeKitCallbackType; @@ -1055,6 +1061,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_MEDIA_SHAPE"; case LOK_CALLBACK_EXPORT_FILE: return "LOK_CALLBACK_EXPORT_FILE"; + case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: + return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index ce5b059a9006..c12067a483e1 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1487,6 +1487,7 @@ callback (gpointer pData) case LOK_CALLBACK_FONTS_MISSING: case LOK_CALLBACK_MEDIA_SHAPE: case LOK_CALLBACK_EXPORT_FILE: + case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: { // TODO: Implement me break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 799d8fbd3168..71eeafc6ff6f 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -38,6 +38,8 @@ #include <osl/diagnose.h> #include <osl/file.hxx> #include <comphelper/lok.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <tools/json_writer.hxx> #include <memory> @@ -70,6 +72,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> #include <vcl/abstdlg.hxx> +#include <sfx2/viewsh.hxx> #include <documentfontsdialog.hxx> #include <dinfdlg.hrc> @@ -789,6 +792,12 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); + tools::JsonWriter payloadJson; + payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); + payloadJson.put("isToModify", false); + pShell->GetViewShell()->libreOfficeKitViewCallback( + LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, + payloadJson.extractAsOString().getStr()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce(); |