Commit 188b73e7 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Show OpenUrlJob errors as inline message

Avoids an ugly message box when opening a file fails or is forbidden.
parent 1035f182
Pipeline #107218 passed with stage
in 5 minutes and 4 seconds
......@@ -656,8 +656,9 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item)
}
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(item.targetUrl());
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoWarningHandlingEnabled, this));
job->setShowOpenOrExecuteDialog(true);
connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished);
job->start();
}
......@@ -829,6 +830,13 @@ void DolphinViewContainer::slotSortHiddenLastChanged(bool hiddenLast)
}
}
void DolphinViewContainer::slotOpenUrlFinished(KJob *job)
{
if (job->error() && job->error() != KIO::ERR_USER_CANCELED) {
showErrorMessage(job->errorString());
}
}
bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
{
return url.scheme().contains(QLatin1String("search"));
......
......@@ -364,6 +364,8 @@ private Q_SLOTS:
void slotHiddenFilesShownChanged(bool showHiddenFiles);
void slotSortHiddenLastChanged(bool hiddenLast);
void slotOpenUrlFinished(KJob* job);
private:
/**
* @return True if the URL protocol is a search URL (e. g. baloosearch:// or filenamesearch://).
......
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