[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/jsdialog vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 4 14:43:23 UTC 2021


 include/vcl/toolkit/treelistbox.hxx  |    1 +
 vcl/inc/jsdialog/jsdialogbuilder.hxx |    2 ++
 vcl/jsdialog/executor.cxx            |    8 ++++++++
 vcl/jsdialog/jsdialogbuilder.cxx     |   35 +++++++++++++++++++++++++++++++++++
 vcl/source/treelist/svtabbx.cxx      |    2 ++
 vcl/source/window/dialog.cxx         |   10 ++++++++++
 6 files changed, 58 insertions(+)

New commits:
commit 62fcfdfef4790f2569838e5f3ef39ee4e33028b8
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Feb 9 09:38:58 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Mar 4 15:42:55 2021 +0100

    jsdialog: single activation property for treeview
    
    Change-Id: Iaaeab7f14f1a05c38f41c4beb774a0980844fdb3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110621
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111959
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx
index 3cd50dddee65..d11a006d4c1a 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -677,6 +677,7 @@ public:
 
     // Make single click "activate" a row like a double-click normally does
     void            SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
+    bool            GetActivateOnSingleClick() { return mbActivateOnSingleClick; }
 
     // Make mouse over a row "select" a row like a single-click normally does
     void            SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 613d1831bf2b..ab1736f32120 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -115,6 +115,8 @@ void SvTabListBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
 {
     SvTreeListBox::DumpAsPropertyTree(rJsonWriter);
 
+    rJsonWriter.put("singleclickactivate", GetActivateOnSingleClick());
+
     bool bCheckButtons = static_cast<int>(nTreeFlags & SvTreeFlags::CHKBTN);
 
     auto entriesNode = rJsonWriter.startArray("entries");
commit 325d349c04a3b1cd6d17990ac9255cc432a4e24b
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Feb 8 16:58:44 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Mar 4 15:42:33 2021 +0100

    jsdialog: handle standard buttons like help
    
    - dump response bindings
    - execute help callback
    
    Change-Id: Ib0696b4ba74a186a2b80d49f21a1442d1c520821
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110586
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111958
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 462b1cfeb1ef..3a6e338a80c2 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -401,6 +401,8 @@ public:
     virtual void set_primary_text(const OUString& rText) override;
 
     virtual void set_secondary_text(const OUString& rText) override;
+
+    virtual void response(int response) override;
 };
 
 class JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox>
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 8c76e77d8b37..3644dc1bcf9b 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -321,6 +321,14 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
                     pDialog->response(RET_CANCEL);
                     return true;
                 }
+                else if (sAction == "response")
+                {
+                    OString nResponseString
+                        = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+                    int nResponse = std::atoi(nResponseString.getStr());
+                    pDialog->response(nResponse);
+                    return true;
+                }
             }
         }
         else if (sControlType == "radiobutton")
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index da0537893a35..c7c8c3735fd5 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -27,6 +27,23 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <utility>
 
+namespace
+{
+void response_help(vcl::Window* pWindow)
+{
+    ::Dialog* pDialog = dynamic_cast<::Dialog*>(pWindow);
+    if (!pDialog)
+        return;
+
+    vcl::Window* pButtonWindow = pDialog->get_widget_for_response(RET_HELP);
+    ::Button* pButton = dynamic_cast<::Button*>(pButtonWindow);
+    if (!pButton)
+        return;
+
+    pButton->Click();
+}
+}
+
 JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow,
                                        VclPtr<vcl::Window> aContentWindow, std::string sTypeOfJSON)
     : Idle("JSDialog notify")
@@ -748,6 +765,12 @@ void JSDialog::undo_collapse()
 
 void JSDialog::response(int response)
 {
+    if (response == RET_HELP)
+    {
+        response_help(m_xWidget.get());
+        return;
+    }
+
     sendClose();
     SalInstanceDialog::response(response);
 }
@@ -922,6 +945,18 @@ void JSMessageDialog::set_secondary_text(const OUString& rText)
     sendFullUpdate();
 }
 
+void JSMessageDialog::response(int response)
+{
+    if (response == RET_HELP)
+    {
+        response_help(m_xWidget.get());
+        return;
+    }
+
+    sendClose();
+    SalInstanceMessageDialog::response(response);
+}
+
 JSCheckButton::JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox,
                              SalInstanceBuilder* pBuilder, bool bTakeOwnership)
     : JSWidget<SalInstanceCheckButton, ::CheckBox>(pSender, pCheckBox, pBuilder, bTakeOwnership)
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index f354e8a32d85..92db0975c6c1 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1662,6 +1662,16 @@ void Dialog::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
     sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
     nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
     rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
+
+    {
+        auto aResponses = rJsonWriter.startArray("responses");
+        for (auto& rResponse : mpDialogImpl->maResponses)
+        {
+            auto aResponse = rJsonWriter.startStruct();
+            rJsonWriter.put("id", rResponse.first->get_id());
+            rJsonWriter.put("response", rResponse.second);
+        }
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list