Changeset View
Changeset View
Standalone View
Standalone View
utils/okteta/oktetaplugin.cpp
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 98 | #ifndef BIG_ENDIAN | |||
---|---|---|---|---|---|
99 | addTool( uiController, new Kasten::StructuresToolViewFactory(), new Kasten::StructuresToolFactory() ); | 99 | addTool( uiController, new Kasten::StructuresToolViewFactory(), new Kasten::StructuresToolFactory() ); | ||
100 | #endif | 100 | #endif | ||
101 | addTool( uiController, new Kasten::BookmarksToolViewFactory, new Kasten::BookmarksToolFactory() ); | 101 | addTool( uiController, new Kasten::BookmarksToolViewFactory, new Kasten::BookmarksToolFactory() ); | ||
102 | 102 | | |||
103 | KDevelop::IDocumentController* documentController = core()->documentController(); | 103 | KDevelop::IDocumentController* documentController = core()->documentController(); | ||
104 | documentController->registerDocumentForMimetype(QStringLiteral("application/octet-stream"), mDocumentFactory); | 104 | documentController->registerDocumentForMimetype(QStringLiteral("application/octet-stream"), mDocumentFactory); | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | ContextMenuExtension OktetaPlugin::contextMenuExtension( Context* context ) | 107 | ContextMenuExtension OktetaPlugin::contextMenuExtension(Context* context, QWidget* parent) | ||
108 | { | 108 | { | ||
109 | OpenWithContext* openWithContext = dynamic_cast<OpenWithContext*>( context ); | 109 | OpenWithContext* openWithContext = dynamic_cast<OpenWithContext*>( context ); | ||
110 | 110 | | |||
111 | if( openWithContext && !openWithContext->mimeType().inherits(QStringLiteral("inode/directory"))) | 111 | if( openWithContext && !openWithContext->mimeType().inherits(QStringLiteral("inode/directory"))) | ||
112 | { | 112 | { | ||
113 | QAction* openAction = new QAction( i18n("Hex Editor"), this ); | 113 | QAction* openAction = new QAction(i18n("Hex Editor"), parent); | ||
114 | openAction->setIcon( QIcon::fromTheme(QStringLiteral("document-open")) ); | 114 | openAction->setIcon( QIcon::fromTheme(QStringLiteral("document-open")) ); | ||
115 | openAction->setData( QVariant::fromValue(openWithContext->urls()) ); | 115 | openAction->setData( QVariant::fromValue(openWithContext->urls()) ); | ||
116 | connect( openAction, &QAction::triggered, this, &OktetaPlugin::onOpenTriggered ); | 116 | connect( openAction, &QAction::triggered, this, &OktetaPlugin::onOpenTriggered ); | ||
117 | 117 | | |||
118 | KDevelop::ContextMenuExtension contextMenuExtension; | 118 | KDevelop::ContextMenuExtension contextMenuExtension; | ||
119 | contextMenuExtension.addAction( KDevelop::ContextMenuExtension::OpenEmbeddedGroup, openAction ); | 119 | contextMenuExtension.addAction( KDevelop::ContextMenuExtension::OpenEmbeddedGroup, openAction ); | ||
120 | return contextMenuExtension; | 120 | return contextMenuExtension; | ||
121 | } | 121 | } | ||
122 | 122 | | |||
123 | return KDevelop::IPlugin::contextMenuExtension( context ); | 123 | return KDevelop::IPlugin::contextMenuExtension(context, parent); | ||
124 | } | 124 | } | ||
125 | 125 | | |||
126 | void OktetaPlugin::onOpenTriggered() | 126 | void OktetaPlugin::onOpenTriggered() | ||
127 | { | 127 | { | ||
128 | QAction* action = qobject_cast<QAction*>(sender()); | 128 | QAction* action = qobject_cast<QAction*>(sender()); | ||
129 | Q_ASSERT(action); | 129 | Q_ASSERT(action); | ||
130 | 130 | | |||
131 | KDevelop::ICore* core = KDevelop::ICore::self(); | 131 | KDevelop::ICore* core = KDevelop::ICore::self(); | ||
Show All 23 Lines |