Changeset View
Changeset View
Standalone View
Standalone View
plugins/docker/dockerplugin.cpp
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | |||||
89 | { | 89 | { | ||
90 | const bool isDocker = qobject_cast<DockerRuntime*>(newRuntime); | 90 | const bool isDocker = qobject_cast<DockerRuntime*>(newRuntime); | ||
91 | 91 | | |||
92 | for(auto action: actionCollection()->actions()) { | 92 | for(auto action: actionCollection()->actions()) { | ||
93 | action->setEnabled(isDocker); | 93 | action->setEnabled(isDocker); | ||
94 | } | 94 | } | ||
95 | } | 95 | } | ||
96 | 96 | | |||
97 | KDevelop::ContextMenuExtension DockerPlugin::contextMenuExtension(KDevelop::Context* context) | 97 | KDevelop::ContextMenuExtension DockerPlugin::contextMenuExtension(KDevelop::Context* context, QWidget* parent) | ||
98 | { | 98 | { | ||
99 | QList<QUrl> urls; | 99 | QList<QUrl> urls; | ||
100 | 100 | | |||
101 | if ( context->type() == KDevelop::Context::FileContext ) { | 101 | if ( context->type() == KDevelop::Context::FileContext ) { | ||
102 | KDevelop::FileContext* filectx = static_cast<KDevelop::FileContext*>(context); | 102 | KDevelop::FileContext* filectx = static_cast<KDevelop::FileContext*>(context); | ||
103 | urls = filectx->urls(); | 103 | urls = filectx->urls(); | ||
104 | } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { | 104 | } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { | ||
105 | KDevelop::ProjectItemContext* projctx = static_cast<KDevelop::ProjectItemContext*>(context); | 105 | KDevelop::ProjectItemContext* projctx = static_cast<KDevelop::ProjectItemContext*>(context); | ||
Show All 12 Lines | 113 | for(auto it = urls.begin(); it != urls.end(); ) { | |||
118 | } | 118 | } | ||
119 | } | 119 | } | ||
120 | 120 | | |||
121 | if ( !urls.isEmpty() ) { | 121 | if ( !urls.isEmpty() ) { | ||
122 | KDevelop::ContextMenuExtension ext; | 122 | KDevelop::ContextMenuExtension ext; | ||
123 | foreach(const QUrl &url, urls) { | 123 | foreach(const QUrl &url, urls) { | ||
124 | const KDevelop::Path file(url); | 124 | const KDevelop::Path file(url); | ||
125 | 125 | | |||
126 | auto action = new QAction(QIcon::fromTheme("text-dockerfile"), i18n("docker build '%1'", file.path()), this); | 126 | auto action = new QAction(QIcon::fromTheme("text-dockerfile"), i18n("docker build '%1'", file.path()), parent); | ||
127 | connect(action, &QAction::triggered, this, [this, file]() { | 127 | connect(action, &QAction::triggered, this, [this, file]() { | ||
128 | const auto dir = file.parent(); | 128 | const auto dir = file.parent(); | ||
129 | const QString name = QInputDialog::getText( | 129 | const QString name = QInputDialog::getText( | ||
130 | ICore::self()->uiController()->activeMainWindow(), i18n("Choose tag name..."), | 130 | ICore::self()->uiController()->activeMainWindow(), i18n("Choose tag name..."), | ||
131 | i18n("Tag name for '%1'", file.path()), | 131 | i18n("Tag name for '%1'", file.path()), | ||
132 | QLineEdit::Normal, dir.lastPathSegment() | 132 | QLineEdit::Normal, dir.lastPathSegment() | ||
133 | ); | 133 | ); | ||
134 | 134 | | |||
Show All 9 Lines | |||||
144 | process->start(); | 144 | process->start(); | ||
145 | }); | 145 | }); | ||
146 | ext.addAction(KDevelop::ContextMenuExtension::RunGroup, action); | 146 | ext.addAction(KDevelop::ContextMenuExtension::RunGroup, action); | ||
147 | } | 147 | } | ||
148 | 148 | | |||
149 | return ext; | 149 | return ext; | ||
150 | } | 150 | } | ||
151 | 151 | | |||
152 | return KDevelop::IPlugin::contextMenuExtension( context ); | 152 | return KDevelop::IPlugin::contextMenuExtension(context, parent); | ||
153 | } | 153 | } | ||
154 | 154 | | |||
155 | int DockerPlugin::configPages() const | 155 | int DockerPlugin::configPages() const | ||
156 | { | 156 | { | ||
157 | return 1; | 157 | return 1; | ||
158 | } | 158 | } | ||
159 | 159 | | |||
160 | KDevelop::ConfigPage* DockerPlugin::configPage(int number, QWidget* parent) | 160 | KDevelop::ConfigPage* DockerPlugin::configPage(int number, QWidget* parent) | ||
161 | { | 161 | { | ||
162 | if (number == 0) { | 162 | if (number == 0) { | ||
163 | return new DockerPreferences(this, m_settings.data(), parent); | 163 | return new DockerPreferences(this, m_settings.data(), parent); | ||
164 | } | 164 | } | ||
165 | return nullptr; | 165 | return nullptr; | ||
166 | } | 166 | } | ||
167 | 167 | | |||
168 | #include "dockerplugin.moc" | 168 | #include "dockerplugin.moc" |