include/LibreOfficeKit/LibreOfficeKitEnums.h |    8 ++++++++
 libreofficekit/source/gtk/lokdocview.cxx     |    1 +
 sfx2/source/dialog/dinfdlg.cxx               |    9 +++++++++
 3 files changed, 18 insertions(+)

New commits:
commit 88db520407ed5786466513c9486ebb633ce140df
Author:     Jaume Pujantell <jaume.pujant...@collabora.com>
AuthorDate: Wed May 10 23:19:04 2023 +0200
Commit:     Ashod Nakashian <a...@collabora.com>
CommitDate: Tue May 23 04:21:52 2023 +0200

    notify async password change
    
    Change-Id: I2d16c9804e65f093239e810d466de35286b28dee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151789
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Ashod Nakashian <a...@collabora.com>

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();

Reply via email to