File indexing completed on 2024-05-12 05:22:24
0001 /* 0002 * This file is part of LibKGAPI library 0003 * 0004 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #pragma once 0010 0011 #include "fetchjob.h" 0012 #include "kgapilatitude_export.h" 0013 #include "latitude.h" 0014 0015 namespace KGAPI2 0016 { 0017 0018 /** 0019 * @brief A job to fetch all past locations from user's account on Google Latitude 0020 * 0021 * @author Daniel Vrátil <dvratil@redhat.com> 0022 * @since 2.0 0023 */ 0024 class KGAPILATITUDE_DEPRECATED_EXPORT LocationFetchHistoryJob : public KGAPI2::FetchJob 0025 { 0026 Q_OBJECT 0027 0028 /** 0029 * @brief Granularity of the results 0030 * 0031 * Specifies how precise the results should be. By default, Latitude::City 0032 * granularity is used. 0033 * 0034 * This property can be modified only when the job is not running. 0035 * 0036 * @see setGranularity, granularity 0037 */ 0038 Q_PROPERTY(Latitude::Granularity granularity READ granularity WRITE setGranularity) 0039 0040 /** 0041 * @brief Maximum number of results to fetch 0042 * 0043 * Specifies up to how many locations should the job fetch. Default value is 0044 * 0, which means that the job will fetch all available locations. 0045 * 0046 * This property can be modified only when the job is not running. 0047 * 0048 * @see setMaxResults, maxResults 0049 */ 0050 Q_PROPERTY(int maxResults READ maxResults WRITE setMaxResults) 0051 0052 /** 0053 * @brief Oldest location to fetch 0054 * 0055 * Specifies timestamp of recording of the oldest location to be fetched. 0056 * 0057 * This property can be modified only when the job is not running. 0058 * 0059 * @see minTimestamp, setMinTimestamp 0060 */ 0061 Q_PROPERTY(qlonglong minTimestamp READ minTimestamp WRITE setMinTimestamp) 0062 0063 /** 0064 * @brief Newest location to fetch 0065 * 0066 * Specifies timestamp of recording of the newest location to be fetched. 0067 * 0068 * This property can be modified only when the job is not running. 0069 * 0070 * @see maxTimestamp, setMaxTimestamp 0071 */ 0072 Q_PROPERTY(qlonglong maxTimestamp READ maxTimestamp WRITE setMaxTimestamp) 0073 0074 public: 0075 /** 0076 * @brief Constructs a job that will fetch all past user's locations from 0077 * Google Latitude service 0078 * 0079 * @param account Account to authenticate the requests 0080 * @param parent 0081 */ 0082 explicit LocationFetchHistoryJob(const AccountPtr &account, QObject *parent = nullptr); 0083 0084 /** 0085 * @brief Destructor 0086 */ 0087 ~LocationFetchHistoryJob() override; 0088 0089 /** 0090 * @brief Returns granularity of the requested locations. 0091 */ 0092 [[nodiscard]] Latitude::Granularity granularity() const; 0093 0094 /** 0095 * @brief Sets granularity of the requested results. By default it's City. 0096 * 0097 * @param granularity 0098 */ 0099 void setGranularity(Latitude::Granularity granularity); 0100 0101 /** 0102 * @brief Returns maximum number of locations the job will fetch 0103 */ 0104 int maxResults() const; 0105 0106 /** 0107 * @brief Sets maximum number of locations to fetch 0108 * 0109 * @param results Maximum number of results or 0 to fetch all locations. 0110 */ 0111 void setMaxResults(int results); 0112 0113 /** 0114 * @brief Returns lower date limit for fetched locations. 0115 */ 0116 [[nodiscard]] qlonglong minTimestamp() const; 0117 0118 /** 0119 * @brief Sets lower date limit for locations to fetch. 0120 * 0121 * @param minTimestamp 0122 */ 0123 void setMinTimestamp(qlonglong minTimestamp); 0124 0125 /** 0126 * @brief Returns upper date limit for fetched locations. 0127 */ 0128 [[nodiscard]] qlonglong maxTimestamp() const; 0129 0130 /** 0131 * @brief Sets upper date limit for locations to fetch. 0132 * 0133 * @param maxTimestamp 0134 */ 0135 void setMaxTimestamp(qlonglong maxTimestamp); 0136 0137 protected: 0138 /** 0139 * @brief KGAPI2::Job::start implementation 0140 */ 0141 void start() override; 0142 0143 /** 0144 * @brief KGAPI2::Job::handleReplyWithItems 0145 * 0146 * @param reply 0147 * @param rawData 0148 */ 0149 ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override; 0150 0151 private: 0152 class Private; 0153 Private *const d; 0154 friend class Private; 0155 }; 0156 0157 } // namespace KGAPI2