Changeset View
Changeset View
Standalone View
Standalone View
plugins/flatpak/flatpakplugin.cpp
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Line(s) | 129 | { | |||
---|---|---|---|---|---|
143 | const auto doc = FlatpakRuntime::config(url); | 143 | const auto doc = FlatpakRuntime::config(url); | ||
144 | const QString sdkName = doc[QLatin1String("sdk")].toString(); | 144 | const QString sdkName = doc[QLatin1String("sdk")].toString(); | ||
145 | const QString runtimeVersion = doc[QLatin1String("runtime-version")].toString(); | 145 | const QString runtimeVersion = doc[QLatin1String("runtime-version")].toString(); | ||
146 | supportedArchesProcess.start("flatpak", {"info", "-r", sdkName + "//" + runtimeVersion }); | 146 | supportedArchesProcess.start("flatpak", {"info", "-r", sdkName + "//" + runtimeVersion }); | ||
147 | supportedArchesProcess.waitForFinished(); | 147 | supportedArchesProcess.waitForFinished(); | ||
148 | return ret; | 148 | return ret; | ||
149 | } | 149 | } | ||
150 | 150 | | |||
151 | KDevelop::ContextMenuExtension FlatpakPlugin::contextMenuExtension(KDevelop::Context* context) | 151 | KDevelop::ContextMenuExtension FlatpakPlugin::contextMenuExtension(KDevelop::Context* context, QWidget* parent) | ||
152 | { | 152 | { | ||
153 | QList<QUrl> urls; | 153 | QList<QUrl> urls; | ||
154 | 154 | | |||
155 | if ( context->type() == KDevelop::Context::FileContext ) { | 155 | if ( context->type() == KDevelop::Context::FileContext ) { | ||
156 | KDevelop::FileContext* filectx = static_cast<KDevelop::FileContext*>(context); | 156 | KDevelop::FileContext* filectx = static_cast<KDevelop::FileContext*>(context); | ||
157 | urls = filectx->urls(); | 157 | urls = filectx->urls(); | ||
158 | } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { | 158 | } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { | ||
159 | KDevelop::ProjectItemContext* projctx = static_cast<KDevelop::ProjectItemContext*>(context); | 159 | KDevelop::ProjectItemContext* projctx = static_cast<KDevelop::ProjectItemContext*>(context); | ||
Show All 14 Lines | |||||
174 | } | 174 | } | ||
175 | 175 | | |||
176 | if ( !urls.isEmpty() ) { | 176 | if ( !urls.isEmpty() ) { | ||
177 | KDevelop::ContextMenuExtension ext; | 177 | KDevelop::ContextMenuExtension ext; | ||
178 | foreach(const QUrl &url, urls) { | 178 | foreach(const QUrl &url, urls) { | ||
179 | const KDevelop::Path file(url); | 179 | const KDevelop::Path file(url); | ||
180 | 180 | | |||
181 | foreach(const QString &arch, availableArches(file)) { | 181 | foreach(const QString &arch, availableArches(file)) { | ||
182 | auto action = new QAction(i18n("Build flatpak %1 for %2", file.lastPathSegment(), arch), this); | 182 | auto action = new QAction(i18n("Build flatpak %1 for %2", file.lastPathSegment(), arch), parent); | ||
183 | connect(action, &QAction::triggered, this, [this, file, arch]() { | 183 | connect(action, &QAction::triggered, this, [this, file, arch]() { | ||
184 | createRuntime(file, arch); | 184 | createRuntime(file, arch); | ||
185 | }); | 185 | }); | ||
186 | ext.addAction(KDevelop::ContextMenuExtension::RunGroup, action); | 186 | ext.addAction(KDevelop::ContextMenuExtension::RunGroup, action); | ||
187 | } | 187 | } | ||
188 | } | 188 | } | ||
189 | 189 | | |||
190 | return ext; | 190 | return ext; | ||
191 | } | 191 | } | ||
192 | 192 | | |||
193 | return KDevelop::IPlugin::contextMenuExtension( context ); | 193 | return KDevelop::IPlugin::contextMenuExtension(context, parent); | ||
194 | } | 194 | } | ||
195 | 195 | | |||
196 | void FlatpakPlugin::executeOnRemoteDevice() | 196 | void FlatpakPlugin::executeOnRemoteDevice() | ||
197 | { | 197 | { | ||
198 | const auto runtime = qobject_cast<FlatpakRuntime*>(ICore::self()->runtimeController()->currentRuntime()); | 198 | const auto runtime = qobject_cast<FlatpakRuntime*>(ICore::self()->runtimeController()->currentRuntime()); | ||
199 | Q_ASSERT(runtime); | 199 | Q_ASSERT(runtime); | ||
200 | 200 | | |||
201 | KConfigGroup group(KSharedConfig::openConfig(), "Flatpak"); | 201 | KConfigGroup group(KSharedConfig::openConfig(), "Flatpak"); | ||
Show All 20 Lines |