uui/source/iahndl-authentication.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 5130d240be13b62fe76769754d138fbe3e0e1581
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Sep 3 08:45:50 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Sep 3 11:28:13 2024 +0200

    cool#9956 uui lok: avoid showing the password dialog for now
    
    Select some HTML content on a password-protected webpage that has
    images, copy, paste into Writer when it's in LOK mode -> hang.
    
    What seems to happen is that the HTML content itself is on the
    clipboard, but not resources referred by that content, like images.
    Which means our code in SwHTMLParser::InsertImage() will at the end call
    into ucb/ code to get the HTTP image, which will call into uui/ code to
    ask for the password. This has multiple problems: 1) the popup dialog is
    not async (and not trivial to convert to async) and the dialog hints
    that the password can be saved, but LOK document edit sessions always
    start from a clean profile, so that's not working. The non-async dialog
    even results in a hang in practice.
    
    Fix the problem by not showing the password dialog in the LOK case at
    all: it's better to have an image placeholder in the paste result than
    hanging your entire document edit session.
    
    Non-password-protected images continue to work, unless
    HostFilter::isForbidden() rejects the URL.
    
    Change-Id: I1e55ab7adecd9c90ba38a97bcdc52b2b01f7ff2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172781
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/uui/source/iahndl-authentication.cxx 
b/uui/source/iahndl-authentication.cxx
index 8a2ae199c2fd..fb3d6ce31120 100644
--- a/uui/source/iahndl-authentication.cxx
+++ b/uui/source/iahndl-authentication.cxx
@@ -38,6 +38,7 @@
 #include <vcl/abstdlg.hxx>
 #include <vcl/svapp.hxx>
 #include <sal/log.hxx>
+#include <comphelper/lok.hxx>
 
 #include "authfallbackdlg.hxx"
 #include <strings.hrc>
@@ -108,8 +109,17 @@ executeLoginDialog(
     if ( bCanUseSysCreds )
         aDialog.SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() );
 
-    rInfo.SetResult(aDialog.run() == RET_OK ? DialogMask::ButtonsOk :
-                                              DialogMask::ButtonsCancel);
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // Avoid the password dialog popup in the LOK case: it's not async and 
the "remember
+        // password" checkbox would not work.
+        rInfo.SetResult(DialogMask::ButtonsCancel);
+    }
+    else
+    {
+        rInfo.SetResult(aDialog.run() == RET_OK ? DialogMask::ButtonsOk :
+                DialogMask::ButtonsCancel);
+    }
     rInfo.SetUserName(aDialog.GetName());
     rInfo.SetPassword(aDialog.GetPassword());
     rInfo.SetAccount(aDialog.GetAccount());

Reply via email to