1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KGEOURIHANDLER_H
7#define KGEOURIHANDLER_H
8
9#include <QString>
10
11class QUrl;
12
13/*! Fallback handler for geo: URIs by forwarding them to a web service.
14 *
15 * This handles three cases of geo: URIs:
16 * - when containing a query argument, the query URL template is used
17 * - when containing valid WGS-84 coordinates, the coordinate URL template is used
18 * - otherwise the fallback URL is returned
19 *
20 * URL templates can contain any number of the following placeholders in angle brackets:
21 * - LAT - the latitude
22 * - LON - the longitude
23 * - Q - the query string
24 * - Z - the zoom level for a Web Mercator map projection
25 *
26 * \sa https://en.wikipedia.org/wiki/Geo_URI_scheme
27 * \sa https://datatracker.ietf.org/doc/html/rfc5870
28 *
29 * \internal
30 */
31class KGeoUriHandler
32{
33public:
34 void setCoordinateTemplate(const QString &coordTmpl);
35 void setQueryTemplate(const QString &queryTmpl);
36 void setFallbackUrl(const QString &fallbackUrl);
37
38 QString handleUri(const QUrl &geoUri);
39
40private:
41 QString m_coordTmpl;
42 QString m_queryTmpl;
43 QString m_fallbackUrl;
44};
45
46#endif // KGEOURIHANDLER_H
47

source code of kguiaddons/src/geo-scheme-handler/kgeourihandler_p.h