Commit 0e10a276 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Support for snap urls

BUG: 390298
parent a2550b7c
......@@ -43,13 +43,20 @@ set(DesktopExec "plasma-discover %F")
configure_file(org.kde.discover.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.desktop)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
# URL handler accepts URLs as input but is only used to handle appstream://
# Support appstream:// URI
set(DesktopNoDisplay "true")
set(DesktopMimeType "x-scheme-handler/appstream;")
set(DesktopExec "plasma-discover %U")
configure_file(org.kde.discover.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.urlhandler.desktop)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.urlhandler.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
# support snap:/ URI
set(DesktopNoDisplay "true")
set(DesktopMimeType "x-scheme-handler/snap;")
set(DesktopExec "plasma-discover %U")
configure_file(org.kde.discover.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.snap.urlhandler.desktop)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.snap.urlhandler.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
if(EXISTS "/etc/debian_version")
set(DesktopNoDisplay "true")
set(DesktopMimeType "x-scheme-handler/apt")
......
......@@ -78,7 +78,7 @@ void processArgs(QCommandLineParser* parser, DiscoverObject* mainWindow)
const QUrl url = QUrl::fromUserInput(arg, {}, QUrl::AssumeLocalFile);
if (url.isLocalFile())
mainWindow->openLocalPackage(url);
else if (url.scheme() == QLatin1String("apt"))
else if (url.scheme() == QLatin1String("apt") || url.scheme() == QLatin1String("snap"))
mainWindow->openSearch(url.host());
else
mainWindow->openApplication(url);
......
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