[rkward-cvs] SF.net SVN: rkward:[2474] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed May 13 11:08:11 UTC 2009


Revision: 2474
          http://rkward.svn.sourceforge.net/rkward/?rev=2474&view=rev
Author:   tfry
Date:     2009-05-13 11:08:11 +0000 (Wed, 13 May 2009)

Log Message:
-----------
do not add run again-links for plugins that dont work without a context

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

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2009-05-13 11:06:17 UTC (rev 2473)
+++ trunk/rkward/ChangeLog	2009-05-13 11:08:11 UTC (rev 2474)
@@ -1,6 +1,6 @@
 - Adjust some icons
 - Add "Run again" link for plugin generated output		TODO: revisit plugins without header
-- Fixed: All objects in .Globalenv would be revisited if a single object was added / removed		TODO: backport? (r2466)
+- Fixed: All objects in .Globalenv would be revisited if a single object was added / removed		TODO: backport? (r2466, 2473)
 - Fixed: Screen device in rkward was not seen as interactive by R	TODO: backport (r2462)
 
 --- Version 0.5.0d - May-10-2009

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2009-05-13 11:06:17 UTC (rev 2473)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2009-05-13 11:08:11 UTC (rev 2474)
@@ -354,6 +354,7 @@
 	RK_TRACE (PLUGIN);
 
 	if (handle->isPlugin ()) {
+		handle->setAccessible (true);
 		actionCollection ()->addAction (id, handle, SLOT (activated()))->setText (handle->getLabel ());
 	}
 }
@@ -372,6 +373,7 @@
 	RKComponentHandle::plugin_map = pluginmap;
 
 	attributes = 0;
+	is_accessible = false;
 }
 
 RKComponentHandle::~RKComponentHandle () {

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.h	2009-05-13 11:06:17 UTC (rev 2473)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.h	2009-05-13 11:08:11 UTC (rev 2474)
@@ -68,6 +68,9 @@
 	QString getAttributeLabel (const QString &attribute_id);
 	bool hasAttribute (const QString &attribute_id);
 	void addAttribute (const QString &id, const QString &value, const QString &label);
+	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; };
 public slots:
 /** Slot called, when the menu-item for this component is selected. Responsible for creating the GUI. */
 	void activated ();
@@ -82,6 +85,8 @@
 	typedef QPair<QString, QString> AttributeValue;
 	typedef QMap<QString, AttributeValue> AttributeMap;
 	AttributeMap *attributes;
+private:
+	bool is_accessible;
 };
 
 #include <qmap.h>

Modified: trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2009-05-13 11:06:17 UTC (rev 2473)
+++ trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2009-05-13 11:08:11 UTC (rev 2474)
@@ -2,7 +2,7 @@
                           rkstandardcomponentgui  -  description
                              -------------------
     begin                : Sun Mar 19 2006
-    copyright            : (C) 2006, 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -158,8 +158,12 @@
 	RKGlobals::rInterface ()->issueCommand (new RCommand (command, RCommand::Plugin | RCommand::DirectToOutput | RCommand::ObjectListUpdate));
 
 	// re-run link
-	command = "\n.rk.rerun.plugin.link(plugin=\"" + RKComponentMap::getComponentId (component->getHandle ()) + "\", settings=\"" + component->serializeState () + "\", label=\"" + i18n ("Run again") + "\")\n";
-	// horizontal line
+	command.clear ();
+	RKComponentHandle *handle = component->getHandle ();
+	if (handle->isAccessible ()) {
+		command.append ("\n.rk.rerun.plugin.link(plugin=\"" + RKComponentMap::getComponentId (handle) + "\", settings=\"" + component->serializeState () + "\", label=\"" + i18n ("Run again") + "\")\n");
+	}
+	// separator line
 	command.append (".rk.make.hr()\n");
 	RKGlobals::rInterface ()->issueCommand (new RCommand (command, RCommand::Plugin | RCommand::DirectToOutput | RCommand::ObjectListUpdate));
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list