Commit 4793f94d authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Port away from deprecated KRun

parent 2378d3b4
......@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <QShortcut>
// KF
#include <kio_version.h>
#include <KActionCollection>
#include <KActionCategory>
#include <KFileItem>
......@@ -43,11 +44,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <KLocalizedString>
#include <KOpenWithDialog>
#include <KPropertiesDialog>
#include <KRun>
#include <KXMLGUIClient>
#include <KUrlMimeData>
#include <KFileItemListProperties>
#include <KIO/OpenFileManagerWindowJob>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/ApplicationLauncherJob>
#include <KIO/JobUiDelegate>
#else
#include <KRun>
#endif
// Local
#include "dialogguard.h"
......@@ -400,6 +406,16 @@ void FileOpsContextManagerItem::openWith(QAction* action)
bool ok;
int idx = action->data().toInt(&ok);
GV_RETURN_IF_FAIL(ok);
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
if (idx != -1) {
service = mServiceList.at(idx);
}
// If service is null, ApplicationLauncherJob will invoke the open-with dialog
auto *job = new KIO::ApplicationLauncherJob(service);
job->setUrls(list);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, mGroup));
job->start();
#else
if (idx == -1) {
// Other Application...
DialogGuard<KOpenWithDialog> dlg(list, mGroup);
......@@ -420,6 +436,7 @@ void FileOpsContextManagerItem::openWith(QAction* action)
Q_ASSERT(service);
KRun::runService(*service, list, mGroup);
#endif
}
void FileOpsContextManagerItem::openContainingFolder()
......
......@@ -28,14 +28,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <QStandardPaths>
// KF
#include <kio_version.h>
#include <KIO/DeleteJob>
#include <KMessageBox>
#include <KProtocolInfo>
#include <KRun>
#include <KService>
#include <KStandardGuiItem>
#include <Solid/Device>
#include <KLocalizedString>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
#include <KIO/ApplicationLauncherJob>
#include <KIO/JobUiDelegate>
#else
#include <KRun>
#endif
// Local
#include "gwenview_importer_debug.h"
......@@ -165,7 +171,14 @@ public:
if (!service) {
qCCritical(GWENVIEW_IMPORTER_LOG) << "Could not find gwenview";
} else {
#if KIO_VERSION >= QT_VERSION_CHECK(5, 71, 0)
auto *job = new KIO::ApplicationLauncherJob(service);
job->setUrls({mThumbnailPage->destinationUrl()});
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
job->start();
#else
KRun::runService(*service, {mThumbnailPage->destinationUrl()}, nullptr /* window */);
#endif
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment