358
bool PluginManager::setupPluginActions(StoryEditor *sew)
361
ScActionPlugin* plugin = 0;
363
//sew->seMenuMgr->addMenuSeparator("Extras");
364
for (PluginMap::Iterator it = pluginMap.begin(); it != pluginMap.end(); ++it)
366
if (it.value().plugin->inherits("ScActionPlugin"))
368
//Add in ScrAction based plugin linkage
369
//Insert DLL Action into Dictionary with values from plugin interface
370
plugin = dynamic_cast<ScActionPlugin*>(it.value().plugin);
372
ScActionPlugin::ActionInfo ai(plugin->actionInfo());
373
if (ai.enabledForStoryEditor)
375
ScrAction* action = new ScrAction(ScrAction::ActionDLLSE, ai.icon1, ai.icon2, ai.text, ai.keySequence, sew);
377
sew->seActions.insert(ai.name, action);
379
// then enable and connect up the action
380
sew->seActions[ai.name]->setEnabled(ai.enabledForStoryEditor);
382
// Connect action's activated signal with the plugin's run method
383
it.value().enabled = connect( sew->seActions[ai.name], SIGNAL(triggeredData(QWidget*, ScribusDoc*)),
384
plugin, SLOT(run(QWidget*, ScribusDoc*)) );
385
//Get the menu manager to add the DLL's menu item to the right menu, after the chosen existing item
386
if ( ai.menuAfterName.isEmpty() )
388
if (!ai.seMenu.isEmpty())
390
if ((!ai.subMenuName.isEmpty()) && (!ai.parentMenu.isEmpty()))
392
if (!sew->seMenuMgr->menuExists(ai.seMenu))
393
sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu);
395
sew->seMenuMgr->addMenuItem(sew->seActions[ai.name], ai.seMenu);
400
QString actionName(ai.seMenu.toLower()+ai.menuAfterName);
401
ScrAction* afterAction=0;
402
if (sew->seActions.contains(actionName))
403
afterAction=sew->seActions[actionName];
404
if ((!ai.subMenuName.isEmpty()) && (!ai.parentMenu.isEmpty()))
406
if (!sew->seMenuMgr->menuExists(ai.seMenu))
407
sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu);
409
sew->seMenuMgr->addMenuItemAfter(sew->seActions[ai.name], ai.seMenu, afterAction);
357
417
void PluginManager::enableOnlyStartupPluginActions(ScribusMainWindow* mw)