Commit 1be2fb7e authored by David Faure's avatar David Faure
Browse files

KOrganizer: port from KRun::runCommand to KIO::CommandLauncherJob

Summary: Requires KF5 master, let me know if I should wait until landing

Test Plan:
Enabled Scheduling toolbar to start kaddressbook;
Went to the configuration dialog, custom pages, a button starts Qt designer.

Reviewers: mlaurent, winterz

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D28846
parent 3924472a
......@@ -87,9 +87,10 @@
#include <PimCommonAkonadi/CollectionAclPage>
#include <PimCommonAkonadi/ImapAclAttribute>
#include <KDialogJobUiDelegate>
#include <KMessageBox>
#include <KNotification>
#include <KRun>
#include <KIO/CommandLauncherJob>
#include <QApplication>
#include <QClipboard>
......@@ -1756,7 +1757,10 @@ void CalendarView::schedule(KCalendarCore::iTIPMethod method, const Akonadi::Ite
void CalendarView::openAddressbook()
{
KRun::runCommand(QStringLiteral("kaddressbook"), topLevelWidget());
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kaddressbook"), {}, this);
job->setDesktopName(QStringLiteral("org.kde.kaddressbook"));
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
}
bool CalendarView::isReadOnly() const
......
......@@ -24,12 +24,12 @@
#include <KAboutData>
#include "korganizer_debug.h"
#include <KDialogJobUiDelegate>
#include <KDirWatch>
#include <QFileDialog>
#include <KMessageBox>
#include <KRun>
#include <KIO/CommandLauncherJob>
#include <KShell>
#include <QStandardPaths>
#include <KIO/DeleteJob>
#include <KIO/FileCopyJob>
#include <KIO/MkdirJob>
......@@ -41,6 +41,7 @@
#include <QHeaderView>
#include <QLabel>
#include <QPushButton>
#include <QStandardPaths>
#include <QTreeWidget>
#include <QUiLoader>
#include <QWhatsThis>
......@@ -440,8 +441,6 @@ void KCMDesignerFields::itemClicked(QTreeWidgetItem *item)
void KCMDesignerFields::startDesigner()
{
QString cmdLine = QStringLiteral("designer");
// check if path exists and create one if not.
QString cepPath = localUiDir();
if (!QDir(cepPath).exists()) {
......@@ -451,16 +450,19 @@ void KCMDesignerFields::startDesigner()
// finally jump there
QDir::setCurrent(QLatin1String(cepPath.toLocal8Bit()));
QStringList args;
QTreeWidgetItem *item = nullptr;
if (mPageView->selectedItems().size() == 1) {
item = mPageView->selectedItems().first();
}
if (item) {
PageItem *pageItem = static_cast<PageItem *>(item->parent() ? item->parent() : item);
cmdLine += QLatin1Char(' ') + KShell::quoteArg(pageItem->path());
args.append(pageItem->path());
}
KRun::runCommand(cmdLine, topLevelWidget());
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("designer"), args, this);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
}
void KCMDesignerFields::showWhatsThis(const QString &href)
......
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