Commit b6d4fb26 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Port away from deprecated KRun

parent fbd57150
......@@ -17,10 +17,11 @@
#include <KActionCollection>
#include <KFileWidget>
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#include <KLocalizedString>
#include <KMessageBox>
#include <KRecentDirs>
#include <KRun>
#include <KSharedConfig>
#include <KStandardAction>
......@@ -48,6 +49,13 @@ using namespace bt;
namespace kt
{
void openUrl(const QUrl &url)
{
auto job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, nullptr));
job->start();
}
View::View(Core *core, GUI *gui, QWidget *parent)
: QTreeView(parent)
, core(core)
......@@ -525,7 +533,7 @@ void View::previewTorrents()
getSelection(sel);
for (bt::TorrentInterface *tc : qAsConst(sel)) {
if (tc->readyForPreview() && !tc->getStats().multi_file_torrent) {
new KRun(QUrl::fromLocalFile(tc->getStats().output_path), nullptr, true);
openUrl(QUrl::fromLocalFile(tc->getStats().output_path));
}
}
}
......@@ -536,9 +544,9 @@ void View::openDataDir()
getSelection(sel);
for (bt::TorrentInterface *tc : qAsConst(sel)) {
if (tc->getStats().multi_file_torrent)
new KRun(QUrl::fromLocalFile(tc->getStats().output_path), nullptr, true);
openUrl(QUrl::fromLocalFile(tc->getStats().output_path));
else
new KRun(QUrl::fromLocalFile(tc->getDataDir()), nullptr, true);
openUrl(QUrl::fromLocalFile(tc->getDataDir()));
}
}
......@@ -547,7 +555,7 @@ void View::openTorDir()
QList<bt::TorrentInterface *> sel;
getSelection(sel);
for (bt::TorrentInterface *tc : qAsConst(sel)) {
new KRun(QUrl::fromLocalFile(tc->getTorDir()), nullptr, true);
openUrl(QUrl::fromLocalFile(tc->getTorDir()));
}
}
......@@ -719,9 +727,9 @@ void View::onDoubleClicked(const QModelIndex &index)
bt::TorrentInterface *tc = model->torrentFromIndex(index);
if (tc) {
if (tc->getStats().multi_file_torrent)
new KRun(QUrl::fromLocalFile(tc->getStats().output_path), nullptr, true);
openUrl(QUrl::fromLocalFile(tc->getStats().output_path));
else
new KRun(QUrl::fromLocalFile(tc->getDataDir()), nullptr, true);
openUrl(QUrl::fromLocalFile(tc->getDataDir()));
}
}
......
......@@ -8,8 +8,9 @@
#include <QCheckBox>
#include <QDateTime>
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#include <KLocalizedString>
#include <KRun>
#include "availabilitychunkbar.h"
#include "downloadedchunkbar.h"
......@@ -298,7 +299,9 @@ void StatusTab::maxTimeChanged(double v)
void StatusTab::linkActivated(const QString &link)
{
new KRun(QUrl(link), QApplication::activeWindow());
auto job = new KIO::OpenUrlJob(QUrl(link));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->start();
}
}
......@@ -11,8 +11,6 @@
#include <QLocale>
#include <QPalette>
#include <KRun>
#include "feedwidget.h"
#include "feedwidgetmodel.h"
#include "filterlist.h"
......
Supports Markdown
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