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

New commits:
commit 5ec8b322107480075e6edae2711e87ca59ed5eef
Author:     Jaume Pujantell <[email protected]>
AuthorDate: Wed May 10 23:19:04 2023 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Thu Jun 8 21:55:25 2023 +0200

    notify async password change
    
    Change-Id: I2d16c9804e65f093239e810d466de35286b28dee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152653
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

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 3067229b96eb..85b9e50fc941 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,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