Marble

OwncloudSyncBackend.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2013 Utku Aydın <[email protected]>
4 //
5 
6 #ifndef OWNCLOUDSYNCBACKEND_H
7 #define OWNCLOUDSYNCBACKEND_H
8 
9 #include <QObject>
10 #include <QVector>
11 #include <QNetworkReply>
12 
13 class QUrl;
14 class QDir;
15 
16 namespace Marble {
17 
18 class CloudSyncManager;
19 class RouteItem;
20 
21 class OwncloudSyncBackend : public QObject
22 {
23  Q_OBJECT
24 
25 public:
26  explicit OwncloudSyncBackend( CloudSyncManager* cloudSyncManager );
27  ~OwncloudSyncBackend() override;
28 
29  /**
30  * Generates an endpoint URL by appending endpoint name to API URL
31  * @param endpoint Endpoint name which will be appended to API URL
32  * @return QUrl which can be used for interactions with API
33  */
34  QUrl endpointUrl( const QString &endpoint ) const;
35 
36  /**
37  * Generates an endpoint URL by appending endpoint name and parameter to API URL
38  * @param endpoint Endpoint name which will be appended to API URL
39  * @param parameter Parameter which will be appended to API URL right after endpoint
40  * @return QUrl which can be used for interactions with API
41  */
42  QUrl endpointUrl( const QString &endpoint, const QString &parameter ) const;
43 
44  /**
45  * Removes route with given timestamp from cache
46  * @param cacheDir Local synchronization cache directory
47  * @param timestamp Timestamp of the route which will be deleted
48  */
49  void removeFromCache( const QDir &cacheDir, const QString &timestamp );
50 
51  void uploadRoute( const QString &timestamp );
52  void downloadRouteList();
53  void downloadRoute( const QString &timestamp );
54  void deleteRoute( const QString &timestamp );
55  QPixmap createPreview( const QString &timestamp ) const;
56  QString routeName( const QString &timestamp ) const;
57 
58 public Q_SLOTS:
59  void cancelUpload();
60 
61 private Q_SLOTS:
62  void checkAuthReply();
63  void checkAuthError(QNetworkReply::NetworkError error);
64  void prepareRouteList();
65  void saveDownloadedRoute();
66  void validateSettings();
67 
68 Q_SIGNALS:
69  void routeListDownloaded( const QVector<RouteItem> &routeList );
70  void routeDownloaded();
71  void routeDeleted();
72  void routeUploadProgress( qint64 sent, qint64 total );
73  void routeDownloadProgress( qint64 received, qint64 total );
74  void routeListDownloadProgress( qint64 received, qint64 total );
75  void removedFromCache( const QString &timestamp );
76 
77 private:
78  class Private;
79  Private *d;
80 };
81 
82 }
83 
84 #endif // OWNCLOUDSYNCBACKEND_H
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
Binds a QML item to a specific geodetic location in screen coordinates.
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Oct 4 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.