| 64 | |
| 65 | |
| 66 | KJob* ExecutePlugin::dependencyJob( KDevelop::ILaunchConfiguration* cfg ) const |
| 67 | { |
| 68 | const QVariantList deps = KDevelop::stringToQVariant( cfg->config().readEntry( dependencyEntry, QString() ) ).toList(); |
| 69 | QString depAction = cfg->config().readEntry( dependencyActionEntry, "Nothing" ); |
| 70 | if( depAction != QLatin1String("Nothing") && !deps.isEmpty() ) |
| 71 | { |
| 72 | KDevelop::ProjectModel* model = KDevelop::ICore::self()->projectController()->projectModel(); |
| 73 | QList<KDevelop::ProjectBaseItem*> items; |
| 74 | for (const QVariant& dep : deps) { |
| 75 | KDevelop::ProjectBaseItem* item = model->itemFromIndex( model->pathToIndex( dep.toStringList() ) ); |
| 76 | if( item ) |
| 77 | { |
| 78 | items << item; |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | const QString messageText = i18n("Couldn't resolve the dependency: %1", dep.toString()); |
| 83 | auto* message = new Sublime::Message(messageText, Sublime::Message::Error); |
| 84 | ICore::self()->uiController()->postMessage(message); |
| 85 | } |
| 86 | } |
| 87 | auto* job = new KDevelop::BuilderJob(); |
| 88 | if( depAction == QLatin1String("Build") ) |
| 89 | { |
| 90 | job->addItems( KDevelop::BuilderJob::Build, items ); |
| 91 | } else if( depAction == QLatin1String("Install") ) |
| 92 | { |
| 93 | job->addItems( KDevelop::BuilderJob::Install, items ); |
| 94 | } |
| 95 | job->updateJobName(); |
| 96 | return job; |
| 97 | } |
| 98 | return nullptr; |
| 99 | } |
| 100 | |
| 101 | |
| 102 | QString ExecutePlugin::environmentProfileName(KDevelop::ILaunchConfiguration* cfg) const |
no test coverage detected