| 101 | } |
| 102 | |
| 103 | QAction* ExternalScriptItem::action() |
| 104 | { |
| 105 | ///TODO: this is quite ugly, or is it? if someone knows how to do it better, please refactor |
| 106 | if (!m_action) { |
| 107 | static int actionCount = 0; |
| 108 | m_action = new QAction(QStringLiteral("executeScript%1").arg(actionCount), ExternalScriptPlugin::self()); |
| 109 | m_action->setData(QVariant::fromValue<ExternalScriptItem*>(this)); |
| 110 | ExternalScriptPlugin::self()->connect( |
| 111 | m_action, &QAction::triggered, |
| 112 | ExternalScriptPlugin::self(), &ExternalScriptPlugin::executeScriptFromActionData |
| 113 | ); |
| 114 | m_action->setShortcut(QKeySequence()); |
| 115 | // action needs to be added to a widget before it can work... |
| 116 | KDevelop::ICore::self()->uiController()->activeMainWindow()->addAction(m_action); |
| 117 | } |
| 118 | |
| 119 | Q_ASSERT(m_action); |
| 120 | return m_action; |
| 121 | } |
| 122 | |
| 123 | bool ExternalScriptItem::showOutput() const |
| 124 | { |
no test coverage detected