-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
18 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
/* | ||
* Copyright 2020 <Alex1701c> <[email protected]> | ||
* | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation; either version 2 of | ||
* the License or (at your option) version 3 or any later version | ||
* accepted by the membership of KDE e.V. (or its successor approved | ||
* by the membership of KDE e.V.), which shall act as a proxy | ||
* defined in Section 14 of version 3 of the license. | ||
* | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "jetbrainsdolphinplugin.h" | ||
|
||
#include <KPluginFactory> | ||
#include <KActionMenu> | ||
#include <KIO/CommandLauncherJob> | ||
#include <KIO/DesktopExecParser> | ||
#include <KPluginFactory> | ||
#include <KService> | ||
#include <KSharedConfig> | ||
#include <KShell> | ||
#include <KService> | ||
#include <QDir> | ||
#include <KIO/CommandLauncherJob> | ||
#include <KIO/DesktopExecParser> | ||
|
||
#include "jetbrains-api/export.h" | ||
|
||
|
@@ -38,9 +38,9 @@ inline bool containsPath(JetbrainsApplication *app, const QString &path) | |
}); | ||
} | ||
|
||
JetBrainsDolphinPlugin::JetBrainsDolphinPlugin(QObject *parent, const QVariantList &/*args*/) | ||
JetBrainsDolphinPlugin::JetBrainsDolphinPlugin(QObject *parent, const QVariantList & /*args*/) | ||
: KAbstractFileItemActionPlugin(parent) | ||
,jetbrainsIcon(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("jetbrainsdolphinplugin/jetbrains.png"))) | ||
, jetbrainsIcon(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("jetbrainsdolphinplugin/jetbrains.png"))) | ||
{ | ||
} | ||
|
||
|
@@ -62,8 +62,7 @@ QList<QAction *> JetBrainsDolphinPlugin::actions(const KFileItemListProperties & | |
|
||
if (QDir(projectPath + "/.idea").exists()) { | ||
// Only now the apps have to be loaded | ||
const auto config = KSharedConfig::openConfig(QStringLiteral("krunnerplugins/jetbrainsrunnerrc")) | ||
->group("Config"); | ||
const auto config = KSharedConfig::openConfig(QStringLiteral("krunnerplugins/jetbrainsrunnerrc"))->group("Config"); | ||
apps = JetbrainsAPI::fetchApplications(config, false, false); | ||
|
||
QList<QAction *> actionList; | ||
|
@@ -80,7 +79,7 @@ QList<QAction *> JetBrainsDolphinPlugin::actions(const KFileItemListProperties & | |
// If the project was not opened in the other ides, add them in submenu | ||
if (actionList.size() != apps.size()) { | ||
auto *menuAction = new KActionMenu(this); | ||
qWarning()<< QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("icons/jetbrains.png")); | ||
qWarning() << QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("icons/jetbrains.png")); | ||
menuAction->setIcon(jetbrainsIcon); | ||
menuAction->setText(QStringLiteral("Jetbrains")); | ||
for (int i = 0; i < apps.count(); ++i) { | ||
|
@@ -108,15 +107,14 @@ void JetBrainsDolphinPlugin::openIDE(JetbrainsApplication *app) | |
KService service(app->desktopFilePath); | ||
KIO::DesktopExecParser p(service, QList<QUrl>{QUrl::fromLocalFile(projectPath)}); | ||
QStringList exec = p.resultingArguments(); | ||
auto job = new KIO::CommandLauncherJob(exec.takeFirst(),exec); | ||
auto job = new KIO::CommandLauncherJob(exec.takeFirst(), exec); | ||
job->start(); | ||
} | ||
|
||
QList<QAction *> JetBrainsDolphinPlugin::getDefaultActions() | ||
{ | ||
// Because the folder has no subfolder called .idea we can be sure that it is not a project | ||
const auto config = KSharedConfig::openConfig(QStringLiteral("krunnerplugins/jetbrainsrunnerrc")) | ||
->group("Config"); | ||
const auto config = KSharedConfig::openConfig(QStringLiteral("krunnerplugins/jetbrainsrunnerrc"))->group("Config"); | ||
apps = JetbrainsAPI::fetchRawApplications(config); | ||
// create default menu | ||
auto *menuAction = new KActionMenu(this); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters