Kgapi

locationfetchhistoryjob.h
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#pragma once
10
11#include "fetchjob.h"
12#include "kgapilatitude_export.h"
13#include "latitude.h"
14
15namespace KGAPI2
16{
17
18/**
19 * @brief A job to fetch all past locations from user's account on Google Latitude
20 *
21 * @author Daniel Vrátil <dvratil@redhat.com>
22 * @since 2.0
23 */
24class KGAPILATITUDE_DEPRECATED_EXPORT LocationFetchHistoryJob : public KGAPI2::FetchJob
25{
26 Q_OBJECT
27
28 /**
29 * @brief Granularity of the results
30 *
31 * Specifies how precise the results should be. By default, Latitude::City
32 * granularity is used.
33 *
34 * This property can be modified only when the job is not running.
35 *
36 * @see setGranularity, granularity
37 */
38 Q_PROPERTY(Latitude::Granularity granularity READ granularity WRITE setGranularity)
39
40 /**
41 * @brief Maximum number of results to fetch
42 *
43 * Specifies up to how many locations should the job fetch. Default value is
44 * 0, which means that the job will fetch all available locations.
45 *
46 * This property can be modified only when the job is not running.
47 *
48 * @see setMaxResults, maxResults
49 */
50 Q_PROPERTY(int maxResults READ maxResults WRITE setMaxResults)
51
52 /**
53 * @brief Oldest location to fetch
54 *
55 * Specifies timestamp of recording of the oldest location to be fetched.
56 *
57 * This property can be modified only when the job is not running.
58 *
59 * @see minTimestamp, setMinTimestamp
60 */
61 Q_PROPERTY(qlonglong minTimestamp READ minTimestamp WRITE setMinTimestamp)
62
63 /**
64 * @brief Newest location to fetch
65 *
66 * Specifies timestamp of recording of the newest location to be fetched.
67 *
68 * This property can be modified only when the job is not running.
69 *
70 * @see maxTimestamp, setMaxTimestamp
71 */
72 Q_PROPERTY(qlonglong maxTimestamp READ maxTimestamp WRITE setMaxTimestamp)
73
74public:
75 /**
76 * @brief Constructs a job that will fetch all past user's locations from
77 * Google Latitude service
78 *
79 * @param account Account to authenticate the requests
80 * @param parent
81 */
82 explicit LocationFetchHistoryJob(const AccountPtr &account, QObject *parent = nullptr);
83
84 /**
85 * @brief Destructor
86 */
87 ~LocationFetchHistoryJob() override;
88
89 /**
90 * @brief Returns granularity of the requested locations.
91 */
92 [[nodiscard]] Latitude::Granularity granularity() const;
93
94 /**
95 * @brief Sets granularity of the requested results. By default it's City.
96 *
97 * @param granularity
98 */
99 void setGranularity(Latitude::Granularity granularity);
100
101 /**
102 * @brief Returns maximum number of locations the job will fetch
103 */
104 int maxResults() const;
105
106 /**
107 * @brief Sets maximum number of locations to fetch
108 *
109 * @param results Maximum number of results or 0 to fetch all locations.
110 */
111 void setMaxResults(int results);
112
113 /**
114 * @brief Returns lower date limit for fetched locations.
115 */
116 [[nodiscard]] qlonglong minTimestamp() const;
117
118 /**
119 * @brief Sets lower date limit for locations to fetch.
120 *
121 * @param minTimestamp
122 */
123 void setMinTimestamp(qlonglong minTimestamp);
124
125 /**
126 * @brief Returns upper date limit for fetched locations.
127 */
128 [[nodiscard]] qlonglong maxTimestamp() const;
129
130 /**
131 * @brief Sets upper date limit for locations to fetch.
132 *
133 * @param maxTimestamp
134 */
135 void setMaxTimestamp(qlonglong maxTimestamp);
136
137protected:
138 /**
139 * @brief KGAPI2::Job::start implementation
140 */
141 void start() override;
142
143 /**
144 * @brief KGAPI2::Job::handleReplyWithItems
145 *
146 * @param reply
147 * @param rawData
148 */
149 ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
150
151private:
152 class Private;
153 Private *const d;
154 friend class Private;
155};
156
157} // namespace KGAPI2
Abstract superclass for all jobs that fetch resources from Google.
Definition fetchjob.h:25
A Helper QObject.
Definition latitude.h:20
A job to fetch all past locations from user's account on Google Latitude.
Q_SCRIPTABLE Q_NOREPLY void start()
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.