Commit a7ef9e7f authored by David Faure's avatar David Faure
Browse files

Port away from KRun::run* deprecated methods

parent bf22eff1
......@@ -9,7 +9,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(Konqueror)
set(QT_MIN_VERSION "5.9.0")
set(KF5_MIN_VERSION "5.68.0")
set(KF5_MIN_VERSION "5.70.0")
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
......
......@@ -28,9 +28,10 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <KDesktopFile>
#include <KDialogJobUiDelegate>
#include <KPluginFactory>
#include <KActionCollection>
#include <KRun>
#include <KIO/CommandLauncherJob>
#include <KMainWindow>
#include <KParts/Part>
#include <KParts/BrowserExtension>
......@@ -381,7 +382,9 @@ void SearchBarPlugin::menuActionTriggered(QAction *action)
void SearchBarPlugin::selectSearchEngines()
{
KRun::runCommand(QStringLiteral("kcmshell5 webshortcuts"), (m_part ? m_part.data()->widget() : nullptr));
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5 webshortcuts"));
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, m_part ? m_part.data()->widget() : nullptr));
job->start();
}
void SearchBarPlugin::configurationChanged()
......
......@@ -27,7 +27,6 @@
#include <kactionmenu.h>
#include <kservicetypetrader.h>
#include <krun.h>
#include <klocalizedstring.h>
#include <kservice.h>
#include <kconfiggroup.h>
......@@ -36,6 +35,8 @@
#include <kactioncollection.h>
#include <ksharedconfig.h>
#include <KIO/ApplicationLauncherJob>
#include <KIO/JobUiDelegate>
#include <kparts/openurlarguments.h>
#include <kio/job.h>
......@@ -264,7 +265,9 @@ void UAChangerPlugin::slotConfigure()
{
KService::Ptr service = KService::serviceByDesktopName("useragent");
if (service) {
KRun::runCommand(service->exec(), m_part->widget());
KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, m_part->widget()));
job->start();
}
}
......
......@@ -25,6 +25,7 @@
#include "konqhistoryproxymodel.h"
#include "konqhistorysettings.h"
#include <KDialogJobUiDelegate>
#include <QAction>
#include <QApplication>
#include <QClipboard>
......@@ -40,7 +41,8 @@
#include "konqdebug.h"
#include <KLocalizedString>
#include <kmessagebox.h>
#include <krun.h>
#include <KIO/CommandLauncherJob>
KonqHistoryView::KonqHistoryView(QWidget *parent)
: QWidget(parent)
......@@ -180,7 +182,9 @@ void KonqHistoryView::slotClearHistory()
void KonqHistoryView::slotPreferences()
{
// Run the history sidebar settings.
KRun::run(QStringLiteral("kcmshell5 kcmhistory"), QList<QUrl>(), this);
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5 kcmhistory"));
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
}
void KonqHistoryView::slotSortChange(QAction *action)
......
......@@ -74,6 +74,7 @@
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <KIO/ApplicationLauncherJob>
#include <QDesktopServices>
#include <QFile>
......@@ -432,7 +433,7 @@ QString KonqMainWindow::detectNameFilter(QUrl &url)
nameFilter = fileName;
}
} else { // not a local file
KIO::StatJob *job = KIO::stat(url, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
KIO::StatJob *job = KIO::statDetails(url, KIO::StatJob::DestinationSide, KIO::StatBasic, KIO::HideProgressInfo);
// if there's an error stat'ing url, then assume it doesn't exist
nameFilter = !job->exec() ? fileName : QString();
}
......@@ -683,9 +684,14 @@ void KonqMainWindow::openUrl(KonqView *_view, const QUrl &_url,
// Open with no offer means the user clicked on "Open With..." button.
if (!offer && !isExecutable) {
(void) KRun::displayOpenWithDialog(lst, this);
} else if (isExecutable || !KRun::runApplication(*offer, lst, this)) {
} else if (isExecutable) {
setLocationBarURL(oldLocationBarURL); // Revert to previous locationbar URL
(void)new KRun(url, this);
} else {
KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(offer);
job->setUrls(lst);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
}
}
}
......@@ -1538,14 +1544,14 @@ void KonqMainWindow::slotOpenWith()
return;
}
const QList<QUrl> lst{ m_currentView->url() };
const QString serviceName = sender()->objectName();
const KService::List offers = m_currentView->appServiceOffers();
KService::List::ConstIterator it = offers.begin();
const KService::List::ConstIterator end = offers.end();
for (; it != end; ++it) {
if ((*it)->desktopEntryName() == serviceName) {
KRun::runApplication(**it, lst, this);
for (const KService::Ptr &service : offers) {
if (service->desktopEntryName() == serviceName) {
KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service);
job->setUrls({ m_currentView->url() });
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
return;
}
}
......
......@@ -33,9 +33,9 @@
#include <QWebEngineCertificateError>
#include <QWebEngineSettings>
#include <QWebEngineProfile>
#include <KDialogJobUiDelegate>
#include <KMessageBox>
#include <KRun>
#include <KLocalizedString>
#include <KShell>
#include <KAuthorized>
......@@ -46,6 +46,7 @@
#include <KIO/Job>
#include <KIO/AccessManager>
#include <KIO/Scheduler>
#include <KIO/CommandLauncherJob>
#include <KParts/HtmlExtension>
#include <KUserTimestamp>
#include <KPasswdServerClient>
......@@ -144,8 +145,10 @@ void WebEnginePage::download(const QUrl& url, bool newWindow)
QString managerExe;
checkForDownloadManager(view(), managerExe);
if (!managerExe.isEmpty()) {
//kDebug() << "Calling command" << cmd;
KRun::runCommand((managerExe + QLatin1Char(' ') + KShell::quoteArg(url.url())), view());
//qDebug() << "Calling command" << cmd;
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(managerExe, {url.toString()});
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, view()));
job->start();
return;
}
}
......
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