[Libreoffice-commits] core.git: cui/uiconfig vcl/inc vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 16 07:36:41 UTC 2020


 cui/uiconfig/ui/spellingdialog.ui |    2 +-
 vcl/inc/bitmaps.hlst              |    2 ++
 vcl/source/window/builder.cxx     |   18 ++++++++++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit baa55eca0b653d4f661c08f5b6593caa3b186e89
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jun 15 20:03:47 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jun 16 09:36:05 2020 +0200

    support gtk-copy and gtk-paste stock ids
    
    Change-Id: I0d9dc30c62bdfb5976c86bc5a08d5f030eb216e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96394
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/uiconfig/ui/spellingdialog.ui b/cui/uiconfig/ui/spellingdialog.ui
index 6e437a1145b2..7673d262e21c 100644
--- a/cui/uiconfig/ui/spellingdialog.ui
+++ b/cui/uiconfig/ui/spellingdialog.ui
@@ -272,7 +272,7 @@
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="spellingdialog|paste">Paste</property>
                         <property name="use_underline">True</property>
-                        <property name="icon_name">cmd/sc_paste.png</property>
+                        <property name="stock_id">gtk-paste</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
diff --git a/vcl/inc/bitmaps.hlst b/vcl/inc/bitmaps.hlst
index 5ce994a0c384..68f23533eae0 100644
--- a/vcl/inc/bitmaps.hlst
+++ b/vcl/inc/bitmaps.hlst
@@ -138,6 +138,8 @@
 #define IMG_INFO    "dbaccess/res/exinfo.png"
 #define IMG_ADD     "extensions/res/scanner/plus.png"
 #define IMG_REMOVE  "extensions/res/scanner/minus.png"
+#define IMG_COPY    "cmd/sc_copy.png"
+#define IMG_PASTE   "cmd/sc_paste.png"
 
 #define RID_BMP_TREENODE_COLLAPSED  "res/plus.png"
 #define RID_BMP_TREENODE_EXPANDED   "res/minus.png"
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index ff1f4ca9fe64..368b771068f3 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -95,6 +95,10 @@ namespace
             return IMG_ADD;
         else if (sType == "gtk-remove")
             return IMG_REMOVE;
+        else if (sType == "gtk-copy")
+            return IMG_COPY;
+        else if (sType == "gtk-paste")
+            return IMG_PASTE;
         return OUString();
     }
 
@@ -1048,6 +1052,18 @@ namespace
         return sIconName;
     }
 
+    OUString extractStockId(VclBuilder::stringmap &rMap)
+    {
+        OUString sIconName;
+        VclBuilder::stringmap::iterator aFind = rMap.find(OString("stock-id"));
+        if (aFind != rMap.end())
+        {
+            sIconName = aFind->second;
+            rMap.erase(aFind);
+        }
+        return sIconName;
+    }
+
     OUString getStockText(const OUString &rType)
     {
         if (rType == "gtk-ok")
@@ -2216,6 +2232,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
                 pToolBox->SetQuickHelpText(nItemId, sTooltip);
 
             OUString sIconName(extractIconName(rMap));
+            if (sIconName.isEmpty())
+                sIconName = mapStockToImageResource(extractStockId(rMap));
             if (!sIconName.isEmpty())
                 pToolBox->SetItemImage(nItemId, FixedImage::loadThemeImage(sIconName));
 


More information about the Libreoffice-commits mailing list