[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 2 commits - include/vcl svx/source vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 28 08:12:55 UTC 2021


 include/vcl/jsdialog/executor.hxx |    2 ++
 include/vcl/weld.hxx              |    2 ++
 svx/source/tbxctrls/tbcontrl.cxx  |    6 +++++-
 vcl/jsdialog/executor.cxx         |   12 ++++++++++++
 vcl/jsdialog/jsdialogbuilder.cxx  |    8 ++++++--
 5 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 111ad7f47e4512b2d9efeda058f601bd4b61a861
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 21 17:21:11 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jun 28 10:12:33 2021 +0200

    Don't steal focus from popup in online
    
    To avoid closing the popup when it is first time activated.
    
    Change-Id: I23abd691ecc271b46f1bfba041f247208200ba7e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117595
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 445e557bb57e..8f8055352695 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -3849,7 +3849,11 @@ ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl, weld::Win
 IMPL_LINK(ColorListBox, ToggleHdl, weld::ToggleButton&, rButton, void)
 {
     if (rButton.get_active())
-        getColorWindow()->GrabFocus();
+    {
+        ColorWindow* pColorWindow = getColorWindow();
+        if (pColorWindow && !comphelper::LibreOfficeKit::isActive())
+            pColorWindow->GrabFocus();
+    }
 }
 
 ColorListBox::~ColorListBox()
commit 653c2ff3e76e8f83d39d6e0f034aa7834ac7a7c1
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Jun 17 11:50:26 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jun 28 10:12:19 2021 +0200

    jsdialog: handle popover close
    
    Change-Id: I8b5afe7438c57cfe0553475131bed1e3c4921f46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117373
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 713afaff9082..46455e985735 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -54,6 +54,8 @@ public:
     {
         rSpinButton.signal_value_changed();
     }
+
+    static void trigger_closed(weld::Popover& rPopover) { rPopover.signal_closed(); }
 };
 
 namespace jsdialog
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index c3d335db3f7f..70d91ee6ca96 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2257,6 +2257,8 @@ public:
 
 class VCL_DLLPUBLIC Popover : virtual public Container
 {
+    friend class ::LOKTrigger;
+
 private:
     Link<weld::Popover&, void> m_aCloseHdl;
 
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 9cce1546c77f..28148b0f1578 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -402,6 +402,18 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
                 }
             }
         }
+        else if (sControlType == "popover")
+        {
+            auto pPopover = dynamic_cast<weld::Popover*>(pWidget);
+            if (pPopover)
+            {
+                if (sAction == "close")
+                {
+                    LOKTrigger::trigger_closed(*pPopover);
+                    return true;
+                }
+            }
+        }
         else if (sControlType == "radiobutton")
         {
             auto pRadioButton = dynamic_cast<weld::RadioButton*>(pWidget);
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 5fb8ea82539e..3dbbe8160976 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -909,7 +909,7 @@ std::unique_ptr<weld::MenuButton> JSInstanceBuilder::weld_menu_button(const OStr
 std::unique_ptr<weld::Popover> JSInstanceBuilder::weld_popover(const OString& id)
 {
     DockingWindow* pDockingWindow = m_xBuilder->get<DockingWindow>(id);
-    std::unique_ptr<weld::Popover> pRet(
+    std::unique_ptr<weld::Popover> pWeldWidget(
         pDockingWindow ? new JSPopover(this, pDockingWindow, this, false) : nullptr);
     if (pDockingWindow)
     {
@@ -927,7 +927,11 @@ std::unique_ptr<weld::Popover> JSInstanceBuilder::weld_popover(const OString& id
             initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());
         }
     }
-    return pRet;
+
+    if (pWeldWidget)
+        RememberWidget("__POPOVER__", pWeldWidget.get());
+
+    return pWeldWidget;
 }
 
 weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,


More information about the Libreoffice-commits mailing list