kinit: mimic KFileItem::run() when starting a service for remote URL

KRun did not do that, it is done now tho and (essentially) instead of
starting the service for inode/vnd.kde.service.http (which there is no
registered service for, that MIME type is made up for the sake of KIO)
the service for the target URL (e.g. http://192.168.1.100:12216) will be
started (which since that is http service would be most likely web browser)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-29 04:00:02 +03:00
parent 16f1dbd84e
commit 192a7ee9bc

View file

@ -445,6 +445,11 @@ bool KLauncherAdaptor::start_service_by_url(const QString &url, const QStringLis
} else {
urlmimetype = kioudsentry.stringValue(KIO::UDSEntry::UDS_MIME_TYPE);
}
const QString kiotargeturl = kioudsentry.stringValue(KIO::UDSEntry::UDS_TARGET_URL);
// unless the target URL is the same have to run that (see KFileItem::run)
if (!kiotargeturl.isEmpty() && url != kiotargeturl) {
return start_service_by_url(kiotargeturl, envs, window, temp);
}
if (urlmimetype.isEmpty()) {
// NOTE: scheme handlers are not valid MIME type but are used as such (e.g. in .desktop
// files) despite the fact that none of the scheme handlers actually has a entry in the