Adapt examples.

This commit is contained in:
con
2010-07-15 20:28:53 +02:00
parent 2e56fe23af
commit 023d863f93
18 changed files with 180 additions and 168 deletions

View File

@@ -2,11 +2,16 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/icore.h>
#include <QKeySequence>
#include <coreplugin/icontext.h>
#include <QtPlugin>
#include <QKeySequence>
#include <QStringList>
#include <QMessageBox>
#include <QAction>
#include <QMenu>
#include <QtPlugin>
DoNothingPlugin::DoNothingPlugin()
{
@@ -31,18 +36,21 @@ bool DoNothingPlugin::initialize(const QStringList& args, QString *errMsg)
// Fetch the action manager
Core::ActionManager* am = Core::ICore::instance()->actionManager();
// Create a command for "About DoNothing".
Core::Command* cmd = am->registerAction(new QAction(tr("About DoNothing"),this),"DoNothingPlugin.AboutDoNothing",
QList<int>() <<Core::Constants::C_GLOBAL_ID);
// Create a command for "DoNothing".
QAction *action = new QAction(tr("DoNothing"),this);
Core::Command* cmd = am->registerAction(action,
QLatin1String("DoNothingPlugin.DoNothing"),
Core::Context(Core::Constants::C_GLOBAL));
// Add the "DoNothing" action to the tools menu
am->actionContainer(Core::Constants::M_TOOLS)->addAction(cmd);
// Add the command to Help menu
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd);
return true;
}
void DoNothingPlugin::shutdown()
ExtensionSystem::IPlugin::ShutdownFlag DoNothingPlugin::shutdown()
{
// Do nothing
return SynchronousShutdown;
}
Q_EXPORT_PLUGIN(DoNothingPlugin)