~ubuntu-branches/ubuntu/trusty/scribus/trusty

« back to all changes in this revision

Viewing changes to scribus/pluginmanager.cpp

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2013-05-16 20:34:07 UTC
  • mfrom: (1.1.13) (32.1.2 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130516203407-ztj7ebsivoo41dih
Tags: 1.4.2.dfsg+r18267-1ubuntu2
Avoid qreal/double type clashes on ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "prefsfile.h"
26
26
#include "scpaths.h"
27
27
#include "commonstrings.h"
 
28
#include "storyeditor.h"
28
29
 
29
30
#ifdef HAVE_DLFCN_H
30
31
#include <dlfcn.h>
354
355
        return true;
355
356
}
356
357
 
 
358
bool PluginManager::setupPluginActions(StoryEditor *sew)
 
359
{
 
360
        Q_CHECK_PTR(sew);
 
361
        ScActionPlugin* plugin = 0;
 
362
 
 
363
        //sew->seMenuMgr->addMenuSeparator("Extras");
 
364
        for (PluginMap::Iterator it = pluginMap.begin(); it != pluginMap.end(); ++it)
 
365
        {
 
366
                if (it.value().plugin->inherits("ScActionPlugin"))
 
367
                {
 
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);
 
371
                        assert(plugin);
 
372
                        ScActionPlugin::ActionInfo ai(plugin->actionInfo());
 
373
                        if (ai.enabledForStoryEditor)
 
374
                        {
 
375
                                ScrAction* action = new ScrAction(ScrAction::ActionDLLSE, ai.icon1, ai.icon2, ai.text, ai.keySequence, sew);
 
376
                                Q_CHECK_PTR(action);
 
377
                                sew->seActions.insert(ai.name, action);
 
378
 
 
379
                                // then enable and connect up the action
 
380
                                sew->seActions[ai.name]->setEnabled(ai.enabledForStoryEditor);
 
381
 
 
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() )
 
387
                                {
 
388
                                        if (!ai.seMenu.isEmpty())
 
389
                                        {
 
390
                                                if ((!ai.subMenuName.isEmpty()) && (!ai.parentMenu.isEmpty()))
 
391
                                                {
 
392
                                                        if (!sew->seMenuMgr->menuExists(ai.seMenu))
 
393
                                                                sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu);
 
394
                                                }
 
395
                                                sew->seMenuMgr->addMenuItem(sew->seActions[ai.name], ai.seMenu);
 
396
                                        }
 
397
                                }
 
398
                                else
 
399
                                {
 
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()))
 
405
                                        {
 
406
                                                if (!sew->seMenuMgr->menuExists(ai.seMenu))
 
407
                                                        sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu);
 
408
                                        }
 
409
                                        sew->seMenuMgr->addMenuItemAfter(sew->seActions[ai.name], ai.seMenu, afterAction);
 
410
                                }
 
411
                        }
 
412
                }
 
413
        }
 
414
        return true;
 
415
}
 
416
 
357
417
void PluginManager::enableOnlyStartupPluginActions(ScribusMainWindow* mw)
358
418
{
359
419
        Q_CHECK_PTR(mw);