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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 8 10:50:18 UTC 2007


Revision: 1089
          http://svn.sourceforge.net/rkward/?rev=1089&view=rev
Author:   tfry
Date:     2007-01-08 02:50:18 -0800 (Mon, 08 Jan 2007)

Log Message:
-----------
disable help button, if no help available

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

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2007-01-08 10:41:38 UTC (rev 1088)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2007-01-08 10:50:18 UTC (rev 1089)
@@ -86,6 +86,11 @@
 	connect (backend, SIGNAL (haveError ()), this, SLOT (deleteLater ()));
 	if (!backend->initialize (dummy, code, parent_component == 0)) return;
 
+	// check for existance of help file
+	element = xml->getChildElement (doc_element, "help", DL_WARNING);
+	dummy = QFileInfo (filename).dirPath () + '/' + xml->getStringAttribute (element, "file", "::nosuchfile::", DL_INFO);
+	have_help = QFileInfo (dummy).exists ();
+
 	connect (qApp, SIGNAL (aboutToQuit ()), this, SLOT (deleteLater ()));
 
 // construct the GUI

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.h	2007-01-08 10:41:38 UTC (rev 1088)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.h	2007-01-08 10:50:18 UTC (rev 1089)
@@ -65,6 +65,7 @@
 /** return the filename of the xml file */
 	QString getFilename () { return filename; };
 	RKComponentHandle *getHandle () { return handle; };
+	bool haveHelp () { return have_help; };
 public slots:
 /** this gets called by the script-backend, when it's done. Might enable the
 	submit button or destruct the plugin. */
@@ -83,6 +84,7 @@
 /** The property holding the generated code. Note that this member is tightly controlled by the ScriptBackend */
 	RKComponentPropertyCode *code;
 	QString filename;
+	bool have_help;	// TODO: replace by filename, once we use the help more
 	ScriptBackend *backend;
 	RKStandardComponentGUI *gui;
 	RKComponentHandle *handle;

Modified: trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-01-08 10:41:38 UTC (rev 1088)
+++ trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-01-08 10:50:18 UTC (rev 1089)
@@ -103,6 +103,7 @@
 	vbox->addStretch (1);
 	
 	help_button = new QPushButton (i18n ("Help"), upper_widget);
+	help_button->setEnabled (component->haveHelp ());
 	connect (help_button, SIGNAL (clicked ()), this, SLOT (help ()));
 	vbox->addWidget (help_button);
 	


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