diff --git a/src/libsync/capabilities.cpp b/src/libsync/capabilities.cpp index 155048a76ea69..da713b46cfe48 100644 --- a/src/libsync/capabilities.cpp +++ b/src/libsync/capabilities.cpp @@ -221,6 +221,11 @@ bool Capabilities::bulkUpload() const return _capabilities["dav"].toMap()["bulkupload"].toByteArray() >= "1.0"; } +bool Capabilities::filesLockAvailable() const +{ + return _capabilities["files"].toMap()["locking"].toByteArray() >= "1.0"; +} + bool Capabilities::userStatus() const { if (!_capabilities.contains("user_status")) { diff --git a/src/libsync/capabilities.h b/src/libsync/capabilities.h index 6bbb3e0220803..bbc2fd1b60a85 100644 --- a/src/libsync/capabilities.h +++ b/src/libsync/capabilities.h @@ -65,6 +65,7 @@ class OWNCLOUDSYNC_EXPORT Capabilities int shareDefaultPermissions() const; bool chunkingNg() const; bool bulkUpload() const; + bool filesLockAvailable() const; bool userStatus() const; bool userStatusSupportsEmoji() const; QColor serverColor() const; diff --git a/test/testcapabilities.cpp b/test/testcapabilities.cpp index 2088cc7b0b02b..1952d7f3661e5 100644 --- a/test/testcapabilities.cpp +++ b/test/testcapabilities.cpp @@ -257,6 +257,20 @@ private slots: QCOMPARE(bulkuploadAvailable, true); } + + void testFilesLockAvailable_filesLockAvailable_returnTrue() + { + QVariantMap filesMap; + filesMap["locking"] = "1.0"; + + QVariantMap capabilitiesMap; + capabilitiesMap["files"] = filesMap; + + const auto &capabilities = OCC::Capabilities(capabilitiesMap); + const auto filesLockAvailable = capabilities.filesLockAvailable(); + + QCOMPARE(filesLockAvailable, true); + } }; QTEST_GUILESS_MAIN(TestCapabilities)