File indexing completed on 2024-04-28 04:38:39
0001 /* 0002 SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org> 0003 SPDX-FileCopyrightText: 2009 Niko Sams <niko.sams@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "executeplasmoidplugin.h" 0009 #include "plasmoidexecutionconfig.h" 0010 #include "plasmoidexecutionjob.h" 0011 #include "debug.h" 0012 0013 #include <interfaces/icore.h> 0014 #include <interfaces/iruncontroller.h> 0015 0016 #include <KPluginFactory> 0017 0018 #include <QUrl> 0019 0020 using namespace KDevelop; 0021 0022 K_PLUGIN_FACTORY_WITH_JSON(KDevExecutePlasmoidFactory,"kdevexecuteplasmoid.json", registerPlugin<ExecutePlasmoidPlugin>(); ) 0023 0024 ExecutePlasmoidPlugin::ExecutePlasmoidPlugin(QObject *parent, const QVariantList&) 0025 : KDevelop::IPlugin(QStringLiteral("kdevexecuteplasmoid"), parent) 0026 { 0027 m_configType = new PlasmoidExecutionConfigType(); 0028 m_configType->addLauncher( new PlasmoidLauncher( this ) ); 0029 qCDebug(EXECUTEPLASMOID) << "adding plasmoid launch config"; 0030 core()->runController()->addConfigurationType( m_configType ); 0031 } 0032 0033 ExecutePlasmoidPlugin::~ExecutePlasmoidPlugin() 0034 {} 0035 0036 void ExecutePlasmoidPlugin::unload() 0037 { 0038 core()->runController()->removeConfigurationType( m_configType ); 0039 delete m_configType; 0040 m_configType = nullptr; 0041 } 0042 0043 QUrl ExecutePlasmoidPlugin::executable(ILaunchConfiguration* config, QString& /*error*/) const 0044 { 0045 return QUrl::fromLocalFile(PlasmoidExecutionJob::executable(config)); 0046 } 0047 0048 QStringList ExecutePlasmoidPlugin::arguments(ILaunchConfiguration* config, QString& /*error*/) const 0049 { 0050 return PlasmoidExecutionJob::arguments(config); 0051 } 0052 0053 KJob* ExecutePlasmoidPlugin::dependencyJob(ILaunchConfiguration* config) const 0054 { 0055 return PlasmoidLauncher::calculateDependencies(config); 0056 } 0057 0058 QUrl ExecutePlasmoidPlugin::workingDirectory(ILaunchConfiguration* config) const 0059 { 0060 return QUrl::fromLocalFile(PlasmoidExecutionJob::workingDirectory(config)); 0061 } 0062 0063 QString ExecutePlasmoidPlugin::environmentProfileName(ILaunchConfiguration* /*config*/) const 0064 { 0065 return QString(); 0066 } 0067 0068 QString ExecutePlasmoidPlugin::nativeAppConfigTypeId() const 0069 { 0070 return PlasmoidExecutionConfigType::typeId(); 0071 } 0072 0073 bool ExecutePlasmoidPlugin::useTerminal(ILaunchConfiguration* /*config*/) const 0074 { 0075 return false; 0076 } 0077 0078 QString ExecutePlasmoidPlugin::terminal(ILaunchConfiguration* /*config*/) const 0079 { 0080 return QString(); 0081 } 0082 0083 #include "executeplasmoidplugin.moc" 0084 #include "moc_executeplasmoidplugin.cpp"