2015-07-16 22:49:12 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2016-10-25 12:00:07 +03:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2015-07-16 22:49:12 +03:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CAPABILITIES_H
|
|
|
|
#define CAPABILITIES_H
|
|
|
|
|
|
|
|
#include "owncloudlib.h"
|
|
|
|
|
|
|
|
#include <QVariantMap>
|
2015-10-02 11:58:29 +03:00
|
|
|
#include <QStringList>
|
2020-01-18 17:07:51 +03:00
|
|
|
#include <QMimeDatabase>
|
2015-07-16 22:49:12 +03:00
|
|
|
|
|
|
|
namespace OCC {
|
|
|
|
|
2020-01-18 17:07:51 +03:00
|
|
|
class DirectEditor;
|
|
|
|
|
2015-07-16 22:49:12 +03:00
|
|
|
/**
|
2015-10-05 06:20:09 +03:00
|
|
|
* @brief The Capabilities class represents the capabilities of an ownCloud
|
2015-07-16 22:49:12 +03:00
|
|
|
* server
|
|
|
|
* @ingroup libsync
|
|
|
|
*/
|
2015-07-30 12:04:49 +03:00
|
|
|
class OWNCLOUDSYNC_EXPORT Capabilities
|
|
|
|
{
|
2015-07-16 22:49:12 +03:00
|
|
|
public:
|
2015-07-29 13:05:00 +03:00
|
|
|
Capabilities(const QVariantMap &capabilities);
|
2015-07-16 22:49:12 +03:00
|
|
|
|
2015-10-06 10:07:45 +03:00
|
|
|
bool shareAPI() const;
|
|
|
|
bool sharePublicLink() const;
|
2015-08-20 14:39:44 +03:00
|
|
|
bool sharePublicLinkAllowUpload() const;
|
2017-06-15 16:38:22 +03:00
|
|
|
bool sharePublicLinkSupportsUploadOnly() const;
|
2015-10-06 10:07:45 +03:00
|
|
|
bool sharePublicLinkEnforcePassword() const;
|
|
|
|
bool sharePublicLinkEnforceExpireDate() const;
|
|
|
|
int sharePublicLinkExpireDateDays() const;
|
2017-04-21 15:08:00 +03:00
|
|
|
bool sharePublicLinkMultiple() const;
|
2015-10-06 10:07:45 +03:00
|
|
|
bool shareResharing() const;
|
2016-10-21 17:42:27 +03:00
|
|
|
bool chunkingNg() const;
|
2015-10-15 10:54:01 +03:00
|
|
|
|
2016-12-21 17:08:45 +03:00
|
|
|
/// disable parallel upload in chunking
|
|
|
|
bool chunkingParallelUploadDisabled() const;
|
|
|
|
|
2017-09-15 15:24:34 +03:00
|
|
|
/// Whether the "privatelink" DAV property is available
|
|
|
|
bool privateLinkPropertyAvailable() const;
|
|
|
|
|
2016-03-09 19:19:36 +03:00
|
|
|
/// returns true if the capabilities report notifications
|
|
|
|
bool notificationsAvailable() const;
|
|
|
|
|
2017-09-03 14:33:50 +03:00
|
|
|
/// returns true if the server supports client side encryption
|
2020-06-17 14:31:30 +03:00
|
|
|
bool clientSideEncryptionAvailable() const;
|
2017-09-03 14:33:50 +03:00
|
|
|
|
2016-03-09 19:19:36 +03:00
|
|
|
/// returns true if the capabilities are loaded already.
|
|
|
|
bool isValid() const;
|
|
|
|
|
2018-11-19 16:13:51 +03:00
|
|
|
/// return true if the activity app is enabled
|
|
|
|
bool hasActivities() const;
|
|
|
|
|
2016-04-12 11:12:35 +03:00
|
|
|
/**
|
|
|
|
* Returns the checksum types the server understands.
|
|
|
|
*
|
|
|
|
* When the client uses one of these checksumming algorithms in
|
|
|
|
* the OC-Checksum header of a file upload, the server will use
|
|
|
|
* it to validate that data was transmitted correctly.
|
|
|
|
*
|
|
|
|
* Path: checksums/supportedTypes
|
|
|
|
* Default: []
|
|
|
|
* Possible entries: "Adler32", "MD5", "SHA1"
|
|
|
|
*/
|
2015-10-14 16:03:40 +03:00
|
|
|
QList<QByteArray> supportedChecksumTypes() const;
|
2015-07-16 22:49:12 +03:00
|
|
|
|
2016-04-12 11:12:35 +03:00
|
|
|
/**
|
|
|
|
* The checksum algorithm that the server recommends for file uploads.
|
|
|
|
* This is just a preference, any algorithm listed in supportedTypes may be used.
|
|
|
|
*
|
|
|
|
* Path: checksums/preferredUploadType
|
|
|
|
* Default: empty, meaning "no preference"
|
|
|
|
* Possible values: empty or any of the supportedTypes
|
|
|
|
*/
|
|
|
|
QByteArray preferredUploadChecksumType() const;
|
2015-10-15 10:54:01 +03:00
|
|
|
|
2016-04-26 14:10:53 +03:00
|
|
|
/**
|
|
|
|
* Helper that returns the preferredUploadChecksumType() if set, or one
|
|
|
|
* of the supportedChecksumTypes() if it isn't. May return an empty
|
|
|
|
* QByteArray if no checksum types are supported.
|
|
|
|
*/
|
|
|
|
QByteArray uploadChecksumType() const;
|
|
|
|
|
2017-01-13 16:44:45 +03:00
|
|
|
/**
|
|
|
|
* List of HTTP error codes should be guaranteed to eventually reset
|
|
|
|
* failing chunked uploads.
|
|
|
|
*
|
|
|
|
* The resetting works by tracking UploadInfo::errorCount.
|
|
|
|
*
|
|
|
|
* Note that other error codes than the ones listed here may reset the
|
|
|
|
* upload as well.
|
|
|
|
*
|
|
|
|
* Motivation: See #5344. They should always be reset on 412 (possibly
|
|
|
|
* checksum error), but broken servers may also require resets on
|
|
|
|
* unusual error codes such as 503.
|
|
|
|
*
|
|
|
|
* Path: dav/httpErrorCodesThatResetFailingChunkedUploads
|
|
|
|
* Default: []
|
|
|
|
* Example: [503, 500]
|
|
|
|
*/
|
|
|
|
QList<int> httpErrorCodesThatResetFailingChunkedUploads() const;
|
|
|
|
|
2017-10-13 15:56:40 +03:00
|
|
|
/**
|
|
|
|
* Regex that, if contained in a filename, will result in it not being uploaded.
|
|
|
|
*
|
|
|
|
* For servers older than 8.1.0 it defaults to [\\:?*"<>|]
|
|
|
|
* For servers >= that version, it defaults to the empty regex (the server
|
|
|
|
* will indicate invalid characters through an upload error)
|
|
|
|
*
|
|
|
|
* Note that it just needs to be contained. The regex [ab] is contained in "car".
|
|
|
|
*/
|
|
|
|
QString invalidFilenameRegex() const;
|
|
|
|
|
2017-12-02 13:40:43 +03:00
|
|
|
/**
|
|
|
|
* Whether conflict files should remain local (default) or should be uploaded.
|
|
|
|
*/
|
|
|
|
bool uploadConflictFiles() const;
|
|
|
|
|
2020-01-18 17:07:51 +03:00
|
|
|
// Direct Editing
|
|
|
|
void addDirectEditor(DirectEditor* directEditor);
|
|
|
|
DirectEditor* getDirectEditorForMimetype(const QMimeType &mimeType);
|
|
|
|
DirectEditor* getDirectEditorForOptionalMimetype(const QMimeType &mimeType);
|
|
|
|
|
2015-07-16 22:49:12 +03:00
|
|
|
private:
|
|
|
|
QVariantMap _capabilities;
|
2020-01-18 17:07:51 +03:00
|
|
|
|
|
|
|
QList<DirectEditor*> _directEditors;
|
2015-07-16 22:49:12 +03:00
|
|
|
};
|
2020-01-18 17:07:51 +03:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
class OWNCLOUDSYNC_EXPORT DirectEditor : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DirectEditor(const QString &id, const QString &name, QObject* parent = 0);
|
|
|
|
|
|
|
|
void addMimetype(const QByteArray &mimeType);
|
|
|
|
void addOptionalMimetype(const QByteArray &mimeType);
|
|
|
|
|
|
|
|
bool hasMimetype(const QMimeType &mimeType);
|
|
|
|
bool hasOptionalMimetype(const QMimeType &mimeType);
|
|
|
|
|
|
|
|
QString id() const;
|
|
|
|
QString name() const;
|
|
|
|
|
|
|
|
QList<QByteArray> mimeTypes() const;
|
|
|
|
QList<QByteArray> optionalMimeTypes() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString _id;
|
|
|
|
QString _name;
|
|
|
|
|
|
|
|
QList<QByteArray> _mimeTypes;
|
|
|
|
QList<QByteArray> _optionalMimeTypes;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------*/
|
|
|
|
|
2015-07-16 22:49:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif //CAPABILITIES_H
|