diff options
author | Abhishek Patil <abhishek.patil@vcreatelogic.com> | 2010-06-21 15:27:59 +0200 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2010-06-21 17:32:15 +0200 |
commit | abcb9358c26c240c409df15300507a90aef37f48 (patch) | |
tree | 56f03e33746d3c9186b4a8b0f93565d149263c2c /doc/examples/htmleditor/htmleditorplugin.cpp | |
parent | cdbe93285bee1d88518d9b002a908392f9c6bafb (diff) | |
download | qt-creator-abcb9358c26c240c409df15300507a90aef37f48.tar.gz |
Qt Creator Plugin HOWTO documentation first and second cut
Signed-off-by: Abhishek Patil <abhishek.patil@vcreatelogic.com>
Merge-request: 145
Reviewed-by: con <qtc-committer@nokia.com>
Diffstat (limited to 'doc/examples/htmleditor/htmleditorplugin.cpp')
-rw-r--r-- | doc/examples/htmleditor/htmleditorplugin.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/doc/examples/htmleditor/htmleditorplugin.cpp b/doc/examples/htmleditor/htmleditorplugin.cpp new file mode 100644 index 0000000000..657963f345 --- /dev/null +++ b/doc/examples/htmleditor/htmleditorplugin.cpp @@ -0,0 +1,57 @@ +#include "htmleditorplugin.h" +#include "htmleditorfactory.h" +#include <coreplugin/actionmanager/actionmanager.h> +#include <coreplugin/actionmanager/command.h> +#include <coreplugin/coreconstants.h> +#include <coreplugin/mimedatabase.h> +#include <coreplugin/icore.h> +#include <QtPlugin> +#include <QString> +#include <QMessageBox> +#include <QFontDialog> + +HTMLEditorPlugin::HTMLEditorPlugin() +{ + // Do nothing +} + +HTMLEditorPlugin::~HTMLEditorPlugin() +{ + // Do notning +} + +void HTMLEditorPlugin::extensionsInitialized() +{ + // Do nothing +} + +bool HTMLEditorPlugin::initialize(const QStringList& args, QString *errMsg) +{ + Q_UNUSED(args); + + Core::ActionManager* am = Core::ICore::instance()->actionManager(); + Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_EDIT); + QAction* Font = ac->menu()->addAction("Font"); + + // Create a command for "Font". + Core::Command* cmd = am->registerAction(new QAction(this),"HTMLEditorPlugin.Font",QList<int>() << 0); + cmd->action()->setText("Font"); + + Core::ICore* core = Core::ICore::instance(); + Core::MimeDatabase* mdb = core->mimeDatabase(); + + if(!mdb->addMimeTypes("text-html-mimetype.xml", errMsg)) + return false; + + QMessageBox::information(0, "Msg", *errMsg); + + addAutoReleasedObject(new HTMLEditorFactory(this)); + return true; +} + +void HTMLEditorPlugin::shutdown() +{ + // Do nothing +} + +Q_EXPORT_PLUGIN(HTMLEditorPlugin) |