diff options
| author | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-04-30 21:42:55 +0000 |
|---|---|---|
| committer | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-04-30 21:42:55 +0000 |
| commit | 03f92217ee2336adcbf9b1343ea03edac490ade5 (patch) | |
| tree | 54300e6b248f5b341d8de29649d4175edfae5742 /scribus/pluginmanager.cpp | |
| parent | 8f5f4c57942487fafbeced90e981810b20c809b5 (diff) | |
| download | scribus-03f92217ee2336adcbf9b1343ea03edac490ade5.tar.gz scribus-03f92217ee2336adcbf9b1343ea03edac490ade5.tar.xz scribus-03f92217ee2336adcbf9b1343ea03edac490ade5.zip | |
Update hunspell plugin, plugin manager to allow SE to see plugins, scplugin to have SE plugin attributes
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17485 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/pluginmanager.cpp')
| -rw-r--r-- | scribus/pluginmanager.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/scribus/pluginmanager.cpp b/scribus/pluginmanager.cpp index 7c04eae..d1666b1 100644 --- a/scribus/pluginmanager.cpp +++ b/scribus/pluginmanager.cpp @@ -25,6 +25,7 @@ for which a new license (GPL+exception) is in place. #include "prefsfile.h" #include "scpaths.h" #include "commonstrings.h" +#include "storyeditor.h" #ifdef HAVE_DLFCN_H #include <dlfcn.h> @@ -354,6 +355,65 @@ bool PluginManager::setupPluginActions(ScribusMainWindow *mw) return true; } +bool PluginManager::setupPluginActions(StoryEditor *sew) +{ + Q_CHECK_PTR(sew); + ScActionPlugin* plugin = 0; + + //sew->seMenuMgr->addMenuSeparator("Extras"); + for (PluginMap::Iterator it = pluginMap.begin(); it != pluginMap.end(); ++it) + { + if (it.value().plugin->inherits("ScActionPlugin")) + { + //Add in ScrAction based plugin linkage + //Insert DLL Action into Dictionary with values from plugin interface + plugin = dynamic_cast<ScActionPlugin*>(it.value().plugin); + assert(plugin); + ScActionPlugin::ActionInfo ai(plugin->actionInfo()); + if (ai.enabledForStoryEditor) + { + ScrAction* action = new ScrAction(ScrAction::ActionDLLSE, ai.icon1, ai.icon2, ai.text, ai.keySequence, sew); + Q_CHECK_PTR(action); + sew->seActions.insert(ai.name, action); + + // then enable and connect up the action + sew->seActions[ai.name]->setEnabled(ai.enabledForStoryEditor); + + // Connect action's activated signal with the plugin's run method + it.value().enabled = connect( sew->seActions[ai.name], SIGNAL(triggeredData(QWidget*, ScribusDoc*)), + plugin, SLOT(run(QWidget*, ScribusDoc*)) ); + //Get the menu manager to add the DLL's menu item to the right menu, after the chosen existing item + if ( ai.menuAfterName.isEmpty() ) + { + if (!ai.seMenu.isEmpty()) + { + if ((!ai.subMenuName.isEmpty()) && (!ai.parentMenu.isEmpty())) + { + if (!sew->seMenuMgr->menuExists(ai.seMenu)) + sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu); + } + sew->seMenuMgr->addMenuItem(sew->seActions[ai.name], ai.seMenu); + } + } + else + { + QString actionName(ai.seMenu.toLower()+ai.menuAfterName); + ScrAction* afterAction=0; + if (sew->seActions.contains(actionName)) + afterAction=sew->seActions[actionName]; + if ((!ai.subMenuName.isEmpty()) && (!ai.parentMenu.isEmpty())) + { + if (!sew->seMenuMgr->menuExists(ai.seMenu)) + sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu); + } + sew->seMenuMgr->addMenuItemAfter(sew->seActions[ai.name], ai.seMenu, afterAction); + } + } + } + } + return true; +} + void PluginManager::enableOnlyStartupPluginActions(ScribusMainWindow* mw) { Q_CHECK_PTR(mw); |
