include/LibreOfficeKit/LibreOfficeKitEnums.h | 10 +++++++++- libreofficekit/source/gtk/lokdocview.cxx | 1 + sfx2/source/dialog/dinfdlg.cxx | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit bbf5f97967fb3cde25829e1c428ace31d7d5b8c7 Author: Jaume Pujantell <jaume.pujant...@collabora.com> AuthorDate: Wed May 10 23:19:04 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Jun 9 09:50:10 2023 +0200 notify async password change Change-Id: I2d16c9804e65f093239e810d466de35286b28dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151651 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index d6e46e96aee1..d2a03c8ce9b6 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -960,7 +960,13 @@ typedef enum /** * Informs the LibreOfficeKit client that the color palettes have changed. */ - LOK_CALLBACK_COLOR_PALETTES = 65 + LOK_CALLBACK_COLOR_PALETTES = 65, + + /** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. + */ + LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66 } LibreOfficeKitCallbackType; @@ -1121,6 +1127,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED"; case LOK_CALLBACK_COLOR_PALETTES: return "LOK_CALLBACK_COLOR_PALETTES"; + 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 305ac5a477d2..7245c8e2096f 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1492,6 +1492,7 @@ callback (gpointer pData) case LOK_CALLBACK_A11Y_CARET_CHANGED: case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: + 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 7d97ab8b3ba8..f702c2ec10c1 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -39,6 +39,8 @@ #include <osl/diagnose.h> #include <osl/file.hxx> #include <comphelper/lok.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <tools/json_writer.hxx> #include <memory> @@ -71,6 +73,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> #include <vcl/abstdlg.hxx> +#include <sfx2/viewsh.hxx> #include <documentfontsdialog.hxx> #include <dinfdlg.hrc> @@ -792,6 +795,11 @@ 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.finishAndGetAsOString()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce();