Commit f16f6f01 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Support apt://pkgname uri scheme

BUG: 388159
parent 1cc4a38d
......@@ -46,5 +46,13 @@ 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} )
if(EXISTS "/etc/debian_version")
set(DesktopNoDisplay "true")
set(DesktopMimeType "x-scheme-handler/apt")
set(DesktopExec "plasma-discover %U")
configure_file(org.kde.discover.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.apt.urlhandler.desktop)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.discover.apt.urlhandler.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
endif()
install(FILES plasmadiscoverui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/plasmadiscover)
install( FILES org.kde.discover.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
......@@ -76,6 +76,7 @@ class DiscoverMainWindow : public QObject
void configureShortcuts();
Q_SIGNALS:
void openSearch(const QString &search);
void openApplicationInternal(AbstractResource* app);
void openUrl(const QUrl& url);
void listMimeInternal(const QString& mime);
......
......@@ -78,6 +78,8 @@ void processArgs(QCommandLineParser* parser, DiscoverMainWindow* mainWindow)
const QUrl url = QUrl::fromUserInput(arg, {}, QUrl::AssumeLocalFile);
if (url.isLocalFile())
mainWindow->openLocalPackage(url);
else if (url.scheme() == QLatin1String("apt"))
mainWindow->openSearch(url.host());
else
mainWindow->openApplication(url);
}
......
......@@ -103,6 +103,11 @@ Kirigami.ApplicationWindow
Navigation.openCategory(cat, "")
}
onOpenSearch: {
Navigation.clearStack()
Navigation.openApplicationList({search: search})
}
onPreventedClose: showPassiveNotification(i18n("Could not close the application, there are tasks that need to be done."), 3000)
onUnableToFind: {
showPassiveNotification(i18n("Unable to find resource: %1", resid));
......
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