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 * - @c LAT - the latitude
22 * - @c LON - the longitude
23 * - @c Q - the query string
24 * - @c Z - the zoom level for a Web Mercator map projection
25 *
26 * @see https://en.wikipedia.org/wiki/Geo_URI_scheme
27 * @see https://datatracker.ietf.org/doc/html/rfc5870
28 */
29class KGeoUriHandler
30{
31public:
32 void setCoordinateTemplate(const QString &coordTmpl);
33 void setQueryTemplate(const QString &queryTmpl);
34 void setFallbackUrl(const QString &fallbackUrl);
35
36 QString handleUri(const QUrl &geoUri);
37
38private:
39 QString m_coordTmpl;
40 QString m_queryTmpl;
41 QString m_fallbackUrl;
42};
43
44#endif // KGEOURIHANDLER_H
45

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