Commit bf37558f authored by Fabian Vogt's avatar Fabian Vogt
Browse files

taskmanager: Use proper QUrls for recent document actions

The resource can either be a URL or an absolute path, the url() method
converts the latter into a proper URL. Without this, a local path might end
up getting parsed (badly) as URL, causing weird behaviour later, like resorting
to kioexec/kio-fuse.

BUG: 457685
parent e9f6ba60
Pipeline #216697 passed with stage
in 2 minutes and 49 seconds
......@@ -367,13 +367,9 @@ QVariantList Backend::recentDocumentActions(const QUrl &launcherUrl, QObject *pa
while (actionCount < 5 && resultIt != results.end()) {
const QString resource = (*resultIt).resource();
const QString mimetype = (*resultIt).mimetype();
const QUrl url = (*resultIt).url();
++resultIt;
QUrl url(resource);
if (url.scheme().isEmpty()) {
url = QUrl::fromLocalFile(resource);
}
if (!url.isValid()) {
continue;
}
......@@ -412,7 +408,7 @@ QVariantList Backend::recentDocumentActions(const QUrl &launcherUrl, QObject *pa
action->setProperty("agent", storageId);
action->setProperty("entryPath", desktopEntryUrl);
action->setProperty("mimeType", mimetype);
action->setData(resource);
action->setData(url);
connect(action, &QAction::triggered, this, &Backend::handleRecentDocumentAction);
actions << QVariant::fromValue<QAction *>(action);
......@@ -468,9 +464,9 @@ void Backend::handleRecentDocumentAction() const
}
const QString desktopPath = action->property("entryPath").toUrl().toLocalFile();
const QString resource = action->data().toString();
const QUrl url = action->data().toUrl();
if (desktopPath.isEmpty() || resource.isEmpty()) {
if (desktopPath.isEmpty() || url.isEmpty()) {
auto query = UsedResources | Agent(agent) | Type::any() | Activity::current() | Url::file();
KAStats::forgetResources(query);
......@@ -505,8 +501,7 @@ void Backend::handleRecentDocumentAction() const
auto *delegate = new KNotificationJobUiDelegate;
delegate->setAutoErrorHandlingEnabled(true);
job->setUiDelegate(delegate);
job->setUrls({QUrl(resource)});
job->setUrls({url});
job->start();
}
......
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