1 #ifndef __libquark_gdrive_GDriveFilesystem_hxx 2 #define __libquark_gdrive_GDriveFilesystem_hxx 6 #include <QNetworkAccessManager> 7 #include <QNetworkReply> 8 #include <QScopedPointer> 10 #include <QStringList> 30 QObject *parent = NULL);
38 bool createFolder(
const QString &title,
const QString &folderId = QString());
41 bool statFile(
const QString &fileId);
43 bool listFiles(
const QString &folderId = QString(),
44 const QString &fileQuery = QString(),
45 int maxResults = 100);
103 void handleError(QNetworkReply::NetworkError error);
104 void handleJsonReply();
105 void handleTransferProgress(qint64 bytesTransferred, qint64 bytesTotal);
106 void handleDownloadFinished();
110 enum RequestType { REQ_NONE = 0, REQ_CREATE_FOLDER, REQ_CREATE, REQ_DELETE,
111 REQ_STAT, REQ_LIST, REQ_UPLOAD, REQ_DOWNLOAD };
113 QHttpMultiPart *buildMultiPartForUpload(
const GDriveFile &file);
114 bool parseFileMetadata(
const QJsonObject &
object,
GDriveFile &file);
115 bool parseFileList(
const QJsonObject &
object, QList<GDriveFile> &files);
116 qint64 parseTime(
const QString &value);
118 QNetworkAccessManager *_networkAccess;
120 QScopedPointer<QFile> _localFile;
121 QString _currentFileId;
122 RequestType _requestType;
123 QNetworkReply *_networkReply;
129 #endif // __libquark_gdrive_GDriveFilesystem_hxx
Definition: GDriveFilesystem.h++:23
void fileTransferProgress(qint64 bytesTransferred, qint64 bytesTotal)
void fileUploaded(const QString &localPath, quark::gdrive::GDriveFile file)
bool deleteFile(const QString &fileId)
static const QString READ_ONLY_FILE_ACCESS_SCOPE
Allows read-only access to file metadata and file content.
Definition: GDriveFilesystem.h++:67
bool listFiles(const QString &folderId=QString(), const QString &fileQuery=QString(), int maxResults=100)
GDriveFilesystem(QNetworkAccessManager *networkAccess, QObject *parent=NULL)
void fileInfoAvailable(quark::gdrive::GDriveFile file)
bool downloadFile(const GDriveFile &file, const QString &localPath)
static const QString READ_ONLY_FILE_METADATA_ACCESS_SCOPE
Allows read-only access to file metadata, but does not allow any access to read or download file cont...
Definition: GDriveFilesystem.h++:72
bool uploadFile(const QString &localPath, const GDriveFile &file)
Definition: GDriveFile.h++:16
bool isRequestInProgress() const
bool createFolder(const QString &title, const QString &folderId=QString())
Definition: BarChartView.h++:6
bool createFile(const QString &localPath, const GDriveFile &file)
static const QString APP_DATA_FOLDER_ACCESS_SCOPE
Allows access to the Application Data folder.
Definition: GDriveFilesystem.h++:80
static const QString APP_INSTALLATION_SCOPE
Special scope used to let users approve installation of an app.
Definition: GDriveFilesystem.h++:76
A representation of an OAuth2 access token.
Definition: OAuth2AccessToken.h++:17
void folderCreated(const QString &id)
void fileDownloaded(const QString &id, const QString &localPath)
bool statFile(const QString &fileId)
static const QString FOLDER_MIME_TYPE
The mime type for a folder.
Definition: GDriveFilesystem.h++:85
static const QString FULL_ACCESS_SCOPE
Full, permissive scope to access all of a user's files.
Definition: GDriveFilesystem.h++:58
void setAccessToken(const oauth2::OAuth2AccessToken &token)
static const QString PER_FILE_ACCESS_SCOPE
Per-file access to files created or opened by the app.
Definition: GDriveFilesystem.h++:53
static const QString READ_ONLY_APP_LIST_SCOPE
Allows apps read-only access to the list of Drive apps a user has installed.
Definition: GDriveFilesystem.h++:63
virtual ~GDriveFilesystem()
void fileListAvailable(QList< quark::gdrive::GDriveFile > files)
void fileCreated(quark::gdrive::GDriveFile file)
void fileDeleted(const QString &id)