[rkward] rkward: Provide fallback for menu-button icon, as it seems we can't rely on it being installed.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Feb 11 14:43:30 UTC 2016


Git commit 1bf70b4503acd089f171c0f371da5807e2bee700 by Thomas Friedrichsmeier.
Committed on 11/02/2016 at 14:42.
Pushed by tfry into branch 'master'.

Provide fallback for menu-button icon, as it seems we can't rely on it being installed.

M  +1    -0    rkward/icons/CMakeLists.txt
A  +11   -0    rkward/icons/menu.svg
M  +5    -1    rkward/misc/rkstandardicons.cpp
M  +3    -1    rkward/misc/rkstandardicons.h
M  +2    -1    rkward/misc/rkxmlguipreviewarea.cpp

http://commits.kde.org/rkward/1bf70b4503acd089f171c0f371da5807e2bee700

diff --git a/rkward/icons/CMakeLists.txt b/rkward/icons/CMakeLists.txt
index e4d346a..c7badc3 100644
--- a/rkward/icons/CMakeLists.txt
+++ b/rkward/icons/CMakeLists.txt
@@ -5,6 +5,7 @@ INSTALL(FILES
 	function.png
 	list.png
 	matrix.png
+	menu.svg
 	data-numeric.png
 	data-factor.png
 	data-logical.png
diff --git a/rkward/icons/menu.svg b/rkward/icons/menu.svg
new file mode 100644
index 0000000..efcbc96
--- /dev/null
+++ b/rkward/icons/menu.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<!-- Created using Karbon, part of Calligra: http://www.calligra.org/karbon -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="255.119pt" height="255.119pt">
+<defs/>
+<g id="layer0">
+  <rect id="shape0" transform="translate(35.4331, 53.1497)" fill="#29373a" fill-rule="evenodd" stroke="#000000" stroke-width="1.25000000000" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="2.00000000000" width="198.42554060000pt" height="26.07878533600pt"/>
+  <rect id="shape1" transform="translate(35.4331, 141.733)" fill="#29373a" fill-rule="evenodd" stroke="#000000" stroke-width="1.25000000000" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="2.00000000000" width="198.42554060000pt" height="26.07878533600pt"/>
+  <rect id="shape2" transform="translate(35.7875, 230.315)" fill="#29373a" fill-rule="evenodd" stroke="#000000" stroke-width="1.25000000000" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="2.00000000000" width="198.42554060000pt" height="26.07878533600pt"/>
+ </g>
+</svg>
diff --git a/rkward/misc/rkstandardicons.cpp b/rkward/misc/rkstandardicons.cpp
index 0e1bd4b..52fc3b2 100644
--- a/rkward/misc/rkstandardicons.cpp
+++ b/rkward/misc/rkstandardicons.cpp
@@ -2,7 +2,7 @@
                           rkstandardicons  -  description
                              -------------------
     begin                : Wed Oct 24 2007
-    copyright            : (C) 2007, 2009, 2010, 2011, 2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2007-2016 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -84,6 +84,9 @@ void RKStandardIcons::initIcons () {
 	icons[ActionLock] = KIcon ("object-locked");
 	icons[ActionUnlock] = KIcon ("object-unlocked");
 
+	icons[ActionShowMenu] = QIcon::fromTheme ("application-menu");
+	if (icons[ActionShowMenu].isNull ()) icons[ActionShowMenu] = QIcon (rkward_icon_base + "menu.svg");  // fallback
+
 	// objects
 	icons[ObjectList] = QIcon (rkward_icon_base + "list.png");
 	icons[ObjectFunction] = QIcon (rkward_icon_base + "function.png");
@@ -117,6 +120,7 @@ void RKStandardIcons::initIcons () {
 
 	icons[DocumentPDF] = KIcon ("application-pdf");
 
+	// KF5 TODO: The code below should work allright with QIcon::fromTheme
 /*	This does not work, as the icons are not really Null in this case, but some default icon. Any way to really test this?
 	RK_DO ({
 		for (int i = ActionRunAll; i < Last; ++i) {
diff --git a/rkward/misc/rkstandardicons.h b/rkward/misc/rkstandardicons.h
index b70d30a..49bd4e5 100644
--- a/rkward/misc/rkstandardicons.h
+++ b/rkward/misc/rkstandardicons.h
@@ -2,7 +2,7 @@
                           rkstandardicons  -  description
                              -------------------
     begin                : Wed Oct 24 2007
-    copyright            : (C) 2007, 2009, 2010, 2011, 2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2007-2016 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -84,6 +84,8 @@ public:
 		ActionLock,
 		ActionUnlock,
 
+		ActionShowMenu,
+
 		ObjectList,
 		ObjectFunction,
 		ObjectEnvironment,
diff --git a/rkward/misc/rkxmlguipreviewarea.cpp b/rkward/misc/rkxmlguipreviewarea.cpp
index 2deb55b..aaa45c1 100644
--- a/rkward/misc/rkxmlguipreviewarea.cpp
+++ b/rkward/misc/rkxmlguipreviewarea.cpp
@@ -30,6 +30,7 @@
 #include <klocale.h>
 
 #include "../windows/rkmdiwindow.h"
+#include "rkstandardicons.h"
 
 #include "../debug.h"
 
@@ -38,7 +39,7 @@ RKXMLGUIPreviewArea::RKXMLGUIPreviewArea (QWidget* parent) : KXmlGuiWindow (pare
 
 	menu_button = new QToolButton (this);
 	menu_button->setPopupMode (QToolButton::InstantPopup);
-	menu_button->setIcon (QIcon::fromTheme ("application-menu"));
+	menu_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionShowMenu));
 	menu_button->setMenu (menu = new QMenu ());
 	// KF5 TODO:
 	connect (menu, SIGNAL (aboutToShow()), this, SLOT (prepareMenu()));



More information about the rkward-tracker mailing list