Advance Wayland and KDE package bring-up

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-14 10:51:06 +01:00
parent 51f3c21121
commit cf12defd28
15214 changed files with 20594243 additions and 269 deletions
@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
add_executable(kde-geo-uri-handler
kgeourihandler.cpp
kgeourihandler_p.h
main.cpp
)
ecm_mark_nongui_executable(kde-geo-uri-handler)
target_include_directories(kde-geo-uri-handler PRIVATE "${CMAKE_BINARY_DIR}/src") # for kguiaddons_version.h
target_link_libraries(kde-geo-uri-handler PRIVATE Qt6::Gui)
install(TARGETS kde-geo-uri-handler ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
install(
FILES
google-maps-geo-handler.desktop
openstreetmap-geo-handler.desktop
qwant-maps-geo-handler.desktop
wheelmap-geo-handler.desktop
DESTINATION
${KDE_INSTALL_APPDIR}
)
@@ -0,0 +1,50 @@
[Desktop Entry]
Type=Application
Exec=kde-geo-uri-handler --coordinate-template "https://www.google.com/maps/@<LAT>,<LON>,<Z>z" --query-template "https://www.google.com/maps/search/<Q>" --fallback "https://www.google.com/maps/" %u
Name=Google Maps
Name[ar]=خرائط غوغل
Name[ast]=Google Maps
Name[bg]=Google карти
Name[ca]=Google Maps
Name[ca@valencia]=Google Maps
Name[cs]=Mapy Google
Name[de]=Google Maps
Name[en_GB]=Google Maps
Name[eo]=Guglo-Mapoj
Name[es]=Google Maps
Name[eu]=Google Maps
Name[fi]=Google Maps
Name[fr]=Google Maps
Name[gl]=Google Maps
Name[he]=Google מפות
Name[hi]=गूगल मैप्स
Name[hu]=Google Térképek
Name[ia]=Google Maps (Mappas de Google)
Name[is]=Google Maps
Name[it]=Mappe di Google
Name[ka]=Google Maps
Name[ko]=Google 지도
Name[lt]=„Google“ žemėlapiai
Name[lv]=Google Maps
Name[nl]=Google Maps
Name[nn]=Google Maps
Name[pl]=Mapy Google
Name[pt]=Google Maps
Name[pt_BR]=Google Maps
Name[ro]=Hărți Google
Name[ru]=Карты Google
Name[sa]=गूगल मानचित्रम् (Google Maps)
Name[sk]=Google Maps
Name[sl]=Google Maps
Name[sv]=Google kartor
Name[ta]=கூகுள் மேப்ஸ்
Name[tr]=Google Haritalar
Name[uk]=Карти Google
Name[vi]=Google Bản đồ
Name[x-test]=xxGoogle Mapsxx
Name[zh_CN]=Google Maps
Name[zh_TW]=Google 地圖
Icon=map-globe
MimeType=x-scheme-handler/geo;
Terminal=false
NoDisplay=true
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2022 Florian Edelmann <florian-edelmann@online.de>
SPDX-License-Identifier: CC0-1.0
@@ -0,0 +1,69 @@
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "kgeourihandler_p.h"
#include <QUrl>
#include <QUrlQuery>
void KGeoUriHandler::setCoordinateTemplate(const QString &coordTmpl)
{
m_coordTmpl = coordTmpl;
}
void KGeoUriHandler::setQueryTemplate(const QString &queryTmpl)
{
m_queryTmpl = queryTmpl;
}
void KGeoUriHandler::setFallbackUrl(const QString &fallbackUrl)
{
m_fallbackUrl = fallbackUrl;
}
static bool isValidCoordinate(double c, double limit)
{
return c != 0.0 && c >= -limit && c <= limit;
}
QString KGeoUriHandler::handleUri(const QUrl &geoUri)
{
const auto pathElems = geoUri.path().split(QLatin1Char(';'));
const auto coordElems = pathElems.isEmpty() ? QStringList() : pathElems.at(0).split(QLatin1Char(','));
const auto lat = coordElems.size() < 2 ? 0.0 : coordElems.at(0).toDouble();
const auto lon = coordElems.size() < 2 ? 0.0 : coordElems.at(1).toDouble();
const auto geoQuery = QUrlQuery(geoUri.query());
const auto query = geoQuery.queryItemValue(QStringLiteral("q"));
bool zoomValid = false;
int zoom = geoQuery.queryItemValue(QStringLiteral("z")).toInt(&zoomValid);
if (!zoomValid || zoom < 0 || zoom > 21) {
zoom = 18;
}
// unsupported coordinate reference system
if (!pathElems.isEmpty() && std::any_of(pathElems.begin() + 1, pathElems.end(), [](const auto &elem) {
return elem.startsWith(QLatin1String("crs="), Qt::CaseInsensitive) && !elem.endsWith(QLatin1String("=wgs84"), Qt::CaseInsensitive);
})) {
return m_fallbackUrl;
}
QString tmpl;
if (!query.isEmpty()) {
tmpl = m_queryTmpl;
} else if (isValidCoordinate(lat, 90.0) && isValidCoordinate(lon, 180.0)) {
tmpl = m_coordTmpl;
} else {
return m_fallbackUrl;
}
tmpl.replace(QLatin1String("<LAT>"), QString::number(lat));
tmpl.replace(QLatin1String("<LON>"), QString::number(lon));
tmpl.replace(QLatin1String("<Q>"), query);
tmpl.replace(QLatin1String("<Z>"), QString::number(zoom));
return tmpl;
}
@@ -0,0 +1,44 @@
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef KGEOURIHANDLER_H
#define KGEOURIHANDLER_H
#include <QString>
class QUrl;
/** Fallback handler for geo: URIs by forwarding them to a web service.
*
* This handles three cases of geo: URIs:
* - when containing a query argument, the query URL template is used
* - when containing valid WGS-84 coordinates, the coordinate URL template is used
* - otherwise the fallback URL is returned
*
* URL templates can contain any number of the following placeholders in angle brackets:
* - @c LAT - the latitude
* - @c LON - the longitude
* - @c Q - the query string
* - @c Z - the zoom level for a Web Mercator map projection
*
* @see https://en.wikipedia.org/wiki/Geo_URI_scheme
* @see https://datatracker.ietf.org/doc/html/rfc5870
*/
class KGeoUriHandler
{
public:
void setCoordinateTemplate(const QString &coordTmpl);
void setQueryTemplate(const QString &queryTmpl);
void setFallbackUrl(const QString &fallbackUrl);
QString handleUri(const QUrl &geoUri);
private:
QString m_coordTmpl;
QString m_queryTmpl;
QString m_fallbackUrl;
};
#endif // KGEOURIHANDLER_H
@@ -0,0 +1,49 @@
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "kgeourihandler_p.h"
#include <kguiaddons_version.h>
#include <QCommandLineParser>
#include <QDesktopServices>
#include <QGuiApplication>
#include <QUrl>
int main(int argc, char **argv)
{
QCoreApplication::setApplicationName(QStringLiteral("kde-geo-uri-handler"));
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setApplicationVersion(QStringLiteral(KGUIADDONS_VERSION_STRING));
QGuiApplication app(argc, argv);
QCommandLineParser parser;
QCommandLineOption coordTmplOpt(QStringLiteral("coordinate-template"),
QStringLiteral("URL template for coordinate-based access."),
QStringLiteral("coordinate-template"));
parser.addOption(coordTmplOpt);
QCommandLineOption queryTmplOpt(QStringLiteral("query-template"), QStringLiteral("URL template for query-based access."), QStringLiteral("query-template"));
parser.addOption(queryTmplOpt);
QCommandLineOption fallbackOpt(QStringLiteral("fallback"), QStringLiteral("URL to use in case of errors."), QStringLiteral("fallback-url"));
parser.addOption(fallbackOpt);
parser.addPositionalArgument(QStringLiteral("uri"), QStringLiteral("geo: URI to handle"));
parser.addHelpOption();
parser.addVersionOption();
parser.process(app);
KGeoUriHandler handler;
handler.setCoordinateTemplate(parser.value(coordTmplOpt));
handler.setQueryTemplate(parser.value(queryTmplOpt));
handler.setFallbackUrl(parser.value(fallbackOpt));
const auto args = parser.positionalArguments();
for (const auto &arg : args) {
const auto url = handler.handleUri(QUrl(arg));
QDesktopServices::openUrl(QUrl(url));
}
return 0;
}
@@ -0,0 +1,49 @@
[Desktop Entry]
Type=Application
Exec=kde-geo-uri-handler --coordinate-template "https://www.openstreetmap.org/#map=<Z>/<LAT>/<LON>" --query-template "https://www.openstreetmap.org/search?query=<Q>" --fallback "https://www.openstreetmap.org" %u
Name=OpenStreetMap
Name[ar]=خريطة الشّوارع المفتوحة
Name[ast]=OpenStreetMap
Name[bg]=OpenStreetMap
Name[ca]=OpenStreetMap
Name[ca@valencia]=OpenStreetMap
Name[cs]=OpenStreetMap
Name[de]=OpenStreetMap
Name[en_GB]=OpenStreetMap
Name[eo]=OpenStreetMap
Name[es]=OpenStreetMap
Name[eu]=OpenStreetMap
Name[fi]=OpenStreetMap
Name[fr]=OpenStreetMap
Name[gl]=OpenStreetMap
Name[he]=OpenStreetMap
Name[hi]=ओपनस्ट्रीटमैप
Name[hu]=OpenStreetMap
Name[ia]=OpenStreetMap
Name[is]=OpenStreetMap
Name[it]=OpenStreetMap
Name[ka]=OpenStreetMap
Name[ko]=OpenStreetMap
Name[lt]=OpenStreetMap
Name[lv]=OpenStreetMap
Name[nl]=OpenStreetMap
Name[nn]=OpenStreetMap
Name[pl]=OpenStreetMap
Name[pt]=OpenStreetMap
Name[pt_BR]=OpenStreetMap
Name[ro]=OpenStreetMap
Name[ru]=OpenStreetMap
Name[sa]=वीथिमानचित्रं उद्घाटयन्तु (OpenStreetMap)
Name[sk]=OpenStreetMap
Name[sl]=OpenStreetMap
Name[sv]=OpenStreetMap
Name[tr]=OpenStreetMap
Name[uk]=OpenStreetMap
Name[vi]=OpenStreetMap
Name[x-test]=xxOpenStreetMapxx
Name[zh_CN]=OpenStreetMap
Name[zh_TW]=OpenStreetMap 開放街圖
Icon=map-globe
MimeType=x-scheme-handler/geo;
Terminal=false
NoDisplay=true
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: CC0-1.0
@@ -0,0 +1,49 @@
[Desktop Entry]
Type=Application
Exec=kde-geo-uri-handler --coordinate-template "https://www.qwant.com/maps/#map=<Z>/<LAT>/<LON>" --query-template "https://www.qwant.com/maps/?q=<Q>&client=opensearch" --fallback "https://www.qwant.com/maps/" %u
Name=Qwant Maps
Name[ar]=خرائط كوانت
Name[ast]=Qwant Maps
Name[bg]=Qwant Maps
Name[ca]=Qwant Maps
Name[ca@valencia]=Qwant Maps
Name[cs]=Mapy Qwant
Name[de]=Qwant Maps
Name[en_GB]=Qwant Maps
Name[eo]=Qwant-Mapoj
Name[es]=Qwant Maps
Name[eu]=Qwant Maps
Name[fi]=Qwant Maps
Name[fr]=Qwant Maps
Name[gl]=Qwant Maps
Name[he]=Qwant Maps
Name[hi]=क्वान्ट मैप्स
Name[hu]=Qwant Térképek
Name[ia]=Qwant Maps (Mappas de Qwant)
Name[is]=Qwant Maps
Name[it]=Qwant Maps
Name[ka]=Qwant Maps
Name[ko]=Qwant 지도
Name[lt]=„Qwant“ žemėlapiai
Name[lv]=Qwant Maps
Name[nl]=Qwant Maps
Name[nn]=Qwant Maps
Name[pl]=Mapy Qwant
Name[pt]=Qwant Maps
Name[pt_BR]=Qwant Maps
Name[ro]=Hărți Qwant
Name[ru]=Карты Qwant
Name[sa]=क्वान्ट मानचित्र (Qwant Maps)
Name[sk]=Qwant Maps
Name[sl]=Qwant Maps
Name[sv]=Qwant kartor
Name[tr]=Qwant Haritalar
Name[uk]=Карти Qwant
Name[vi]=Bản đồ Qwant
Name[x-test]=xxQwant Mapsxx
Name[zh_CN]=Qwant Maps
Name[zh_TW]=Qwant 地圖
Icon=map-globe
MimeType=x-scheme-handler/geo;
Terminal=false
NoDisplay=true
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2022 Florian Edelmann <florian-edelmann@online.de>
SPDX-License-Identifier: CC0-1.0
@@ -0,0 +1,49 @@
[Desktop Entry]
Type=Application
Exec=kde-geo-uri-handler --coordinate-template "https://wheelmap.org/?lat=<LAT>&lon=<LON>" --query-template "https://wheelmap.org/search?q=<Q>" --fallback "https://wheelmap.org" %u
Name=wheelmap.org
Name[ar]=wheelmap.org
Name[ast]=wheelmap.org
Name[bg]=wheelmap.org
Name[ca]=wheelmap.org
Name[ca@valencia]=wheelmap.org
Name[cs]=wheelmap.org
Name[de]=wheelmap.org
Name[en_GB]=wheelmap.org
Name[eo]=wheelmap.org
Name[es]=wheelmap.org
Name[eu]=wheelmap.org
Name[fi]=wheelmap.org
Name[fr]=wheelmap.org
Name[gl]=wheelmap.org
Name[he]=wheelmap.org
Name[hi]=व्हीलमैप्स.ऑर्ग
Name[hu]=wheelmap.org
Name[ia]=wheelmap.org
Name[is]=wheelmap.org
Name[it]=wheelmap.org
Name[ka]=wheelmap.org
Name[ko]=wheelmap.org
Name[lt]=wheelmap.org
Name[lv]=wheelmap.org
Name[nl]=wheelmap.org
Name[nn]=wheelmap.org
Name[pl]=wheelmap.org
Name[pt]=wheelmap.org
Name[pt_BR]=wheelmap.org
Name[ro]=wheelmap.org
Name[ru]=wheelmap.org
Name[sa]=wheelmap.org
Name[sk]=wheelmap.org
Name[sl]=wheelmap.org
Name[sv]=wheelmap.org
Name[tr]=wheelmap.org
Name[uk]=wheelmap.org
Name[vi]=wheelmap.org
Name[x-test]=xxwheelmap.orgxx
Name[zh_CN]=wheelmap.org
Name[zh_TW]=wheelmap.org
Icon=map-globe
MimeType=x-scheme-handler/geo;
Terminal=false
NoDisplay=true
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: CC0-1.0