[rkward-cvs] SF.net SVN: rkward-code:[4966] trunk/rkward/rkward/plugin

tfry at users.sf.net tfry at users.sf.net
Mon Oct 27 18:43:38 UTC 2014


Revision: 4966
          http://sourceforge.net/p/rkward/code/4966
Author:   tfry
Date:     2014-10-27 18:43:37 +0000 (Mon, 27 Oct 2014)
Log Message:
-----------
Make components inherit the message catalog from the pluginmap.
(Actually makes in-GUI translations work. Help pages not yet expected to work.)

Modified Paths:
--------------
    trunk/rkward/rkward/plugin/rkcomponentmap.cpp
    trunk/rkward/rkward/plugin/rkcomponentmap.h
    trunk/rkward/rkward/plugin/rkstandardcomponent.cpp

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2014-10-27 18:40:59 UTC (rev 4965)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2014-10-27 18:43:37 UTC (rev 4966)
@@ -358,7 +358,7 @@
 	QString prefix = QFileInfo (plugin_map_file_abs).absolutePath() + '/' + xml.getStringAttribute (document_element, "base_prefix", QString::null, DL_INFO);
 	QString cnamespace = xml.getStringAttribute (document_element, "namespace", "rkward", DL_INFO) + "::";
 
-	RKPluginMapFile *pluginmap_file_desc = new RKPluginMapFile (prefix);
+	RKPluginMapFile *pluginmap_file_desc = new RKPluginMapFile (prefix, xml.messageCatalog ());
 	pluginmap_file_desc->id = RKPluginMapFile::parseId (document_element, xml);
 	pluginmapfiles.insert (QFileInfo (plugin_map_file).absoluteFilePath (), pluginmap_file_desc);
 

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.h	2014-10-27 18:40:59 UTC (rev 4965)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.h	2014-10-27 18:43:37 UTC (rev 4966)
@@ -22,22 +22,25 @@
 
 #include "rkcomponentmeta.h"
 
+class RKMessageCatalog;
 class XMLHelper;
 /** very simple helper class to keep track of .pluginmap files */
 class RKPluginMapFile {
 public:
-	RKPluginMapFile (const QString &basedir) { RKPluginMapFile::basedir = basedir; };
+	RKPluginMapFile (const QString &basedir, const RKMessageCatalog *_catalog) { RKPluginMapFile::basedir = basedir; catalog = _catalog; };
 	~RKPluginMapFile () {};
 
 	QString getBaseDir () { return basedir; };
 	QString makeFileName (const QString &filename);
 	QList<RKComponentDependency> getDependencies () { return dependencies; };
 	static QString parseId (const QDomElement &e, XMLHelper &xml);
+	const RKMessageCatalog *messageCatalog () const { return catalog; };
 private:
 friend class RKComponentMap;
 	QString basedir;
 	QString id;
 	QList<RKComponentDependency> dependencies;
+	const RKMessageCatalog *catalog;
 };
 
 /** enum of different types of RKComponent */
@@ -85,6 +88,7 @@
 	void setAccessible (bool accessible) { is_accessible = accessible; };
 /** Returns whether this component is accessible from the menu, somewhere (else it might be in a context) */
 	bool isAccessible () const { return is_accessible; };
+	const RKMessageCatalog *messageCatalog () const { return plugin_map->messageCatalog (); };
 public slots:
 /** Slot called, when the menu-item for this component is selected. Responsible for creating the GUI. */
 	void activated ();

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2014-10-27 18:40:59 UTC (rev 4965)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2014-10-27 18:43:37 UTC (rev 4966)
@@ -31,6 +31,7 @@
 #include <khbox.h>
 
 #include "rkstandardcomponentgui.h"
+#include "rkcomponentmap.h"
 #include "../scriptbackends/qtscriptbackend.h"
 #include "../scriptbackends/simplebackend.h"
 #include "../scriptbackends/rkcomponentscripting.h"
@@ -224,7 +225,7 @@
 XMLHelper* RKStandardComponent::getXmlHelper () {
 	RK_TRACE (PLUGIN);
 
-	if (!xml) xml = new XMLHelper (filename);
+	if (!xml) xml = new XMLHelper (filename, getHandle ()->messageCatalog ());
 	return xml;
 }
 





More information about the rkward-tracker mailing list