Plasma5Support

geolocationprovider.h
1/*
2 SPDX-FileCopyrightText: 2009 Aaron Seigo <aseigo@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QHash>
10#include <QObject>
11#include <QTimer>
12
13#include <Plasma5Support/DataEngine>
14
15#include "geolocation_export.h"
16
18
19class GEOLOCATION_EXPORT GeolocationProvider : public QObject
20{
21 Q_OBJECT
22
23public:
24 enum UpdateTrigger {
25 ForcedUpdate = 0,
26 SourceEvent = 1,
27 NetworkConnected = 2,
28 };
29 Q_DECLARE_FLAGS(UpdateTriggers, UpdateTrigger)
30
31 explicit GeolocationProvider(QObject *parent);
33
34 UpdateTriggers updateTriggers() const;
35 int accuracy() const;
36 bool isAvailable() const;
37 bool requestUpdate(UpdateTriggers trigger);
38 bool populateSharedData();
39
41 void updated();
42 void availabilityChanged(GeolocationProvider *provider);
43
44protected:
45 void setAccuracy(int accuracy);
46 void setIsAvailable(bool available);
47 void setUpdateTriggers(UpdateTriggers triggers);
48 virtual void init();
49 virtual void update();
50
51protected Q_SLOTS:
52 void setData(const Plasma5Support::DataEngine::Data &data);
53 void setData(const QString &key, const QVariant &value);
54
55private:
57 EntryAccuracy *m_sharedAccuracies;
59 QTimer m_updateTimer;
60 int m_accuracy;
61 UpdateTriggers m_updateTriggers;
62 bool m_available : 1;
63 bool m_updating : 1;
64};
65
66Q_DECLARE_OPERATORS_FOR_FLAGS(GeolocationProvider::UpdateTriggers)
void update(Part *part, const QByteArray &data, qint64 dataSize)
QCA_EXPORT void init()
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.