mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
feat(quota): add quota-available-bytes and quota-used-bytes to PROPFIND properties request.
DiscoveryPhase: add quota used and available properties to RemoteInfo and LocalInfo structs. Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
fbfe869871
commit
16e85e73e3
@ -1280,6 +1280,8 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
|
||||
item->_size = localEntry.size;
|
||||
item->_modtime = localEntry.modtime;
|
||||
item->_type = localEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile;
|
||||
item->_quotaUsed = localEntry.isDirectory ? localEntry.quotaUsed : 0;
|
||||
item->_quotaAvailable = localEntry.isDirectory ? localEntry.quotaAailable : 0;
|
||||
_childModified = true;
|
||||
} else if (dbEntry._modtime > 0 && (localEntry.modtime <= 0 || localEntry.modtime >= 0xFFFFFFFF) && dbEntry._fileSize == localEntry.size) {
|
||||
item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
|
||||
@ -1288,6 +1290,8 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
|
||||
item->_modtime = dbEntry._modtime;
|
||||
item->_previousModtime = dbEntry._modtime;
|
||||
item->_type = localEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile;
|
||||
item->_quotaUsed = localEntry.isDirectory ? localEntry.quotaUsed : 0;
|
||||
item->_quotaAvailable = localEntry.isDirectory ? localEntry.quotaAailable : 0;
|
||||
qCDebug(lcDisco) << "CSYNC_INSTRUCTION_SYNC: File" << item->_file << "if (dbEntry._modtime > 0 && localEntry.modtime <= 0)"
|
||||
<< "dbEntry._modtime:" << dbEntry._modtime
|
||||
<< "localEntry.modtime:" << localEntry.modtime;
|
||||
|
||||
@ -409,6 +409,8 @@ void DiscoverySingleDirectoryJob::start()
|
||||
<< "getlastmodified"
|
||||
<< "getcontentlength"
|
||||
<< "getetag"
|
||||
<< "quota-available-bytes"
|
||||
<< "quota-used-bytes"
|
||||
<< "http://owncloud.org/ns:size"
|
||||
<< "http://owncloud.org/ns:id"
|
||||
<< "http://owncloud.org/ns:fileid"
|
||||
@ -581,6 +583,14 @@ static void propertyMapToRemoteInfo(const QMap<QString, QString> &map, RemotePer
|
||||
if (result.isDirectory && map.contains("size")) {
|
||||
result.sizeOfFolder = map.value("size").toInt();
|
||||
}
|
||||
|
||||
if (result.isDirectory && map.contains("quota-used-bytes")) {
|
||||
result.quotaUsed = map.value("quota-used-bytes").toLongLong();
|
||||
}
|
||||
|
||||
if (result.isDirectory && map.contains("quota-available-bytes")) {
|
||||
result.quotaAvailable = map.value("quota-available-bytes").toLongLong();
|
||||
}
|
||||
}
|
||||
|
||||
void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(const QString &file, const QMap<QString, QString> &map)
|
||||
@ -615,11 +625,23 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(const QString &fi
|
||||
if (map.contains("size")) {
|
||||
_size = map.value("size").toInt();
|
||||
}
|
||||
if (map.contains("quota-used-bytes")) {
|
||||
_quotaUsed = map.value("quota-used-bytes").toLongLong();
|
||||
}
|
||||
if (map.contains("quota-available-bytes")) {
|
||||
_quotaAvailable = map.value("quota-available-bytes").toLongLong();
|
||||
}
|
||||
} else {
|
||||
RemoteInfo result;
|
||||
int slash = file.lastIndexOf('/');
|
||||
result.name = file.mid(slash + 1);
|
||||
result.size = -1;
|
||||
if (map.contains("quota-used-bytes")) {
|
||||
result.quotaUsed = map.value("quota-used-bytes").toInt();
|
||||
}
|
||||
if (map.contains("quota-available-bytes")) {
|
||||
result.quotaAvailable = map.value("quota-available-bytes").toInt();
|
||||
}
|
||||
propertyMapToRemoteInfo(map,
|
||||
_account->serverHasMountRootProperty() ? RemotePermissions::MountedPermissionAlgorithm::UseMountRootProperty : RemotePermissions::MountedPermissionAlgorithm::WildGuessMountedSubProperty,
|
||||
result);
|
||||
|
||||
@ -83,6 +83,9 @@ struct RemoteInfo
|
||||
|
||||
bool isLivePhoto = false;
|
||||
QString livePhotoFile;
|
||||
|
||||
int64_t quotaUsed = 0;
|
||||
int64_t quotaAvailable = 0;
|
||||
};
|
||||
|
||||
struct LocalInfo
|
||||
@ -101,6 +104,8 @@ struct LocalInfo
|
||||
bool isMetadataMissing = false;
|
||||
bool isPermissionsInvalid = false;
|
||||
[[nodiscard]] bool isValid() const { return !name.isNull(); }
|
||||
int64_t quotaUsed = 0;
|
||||
int64_t quotaAailable = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -206,6 +211,9 @@ private:
|
||||
// store top level E2EE folder paths as they are used later when discovering nested folders
|
||||
QSet<QString> _topLevelE2eeFolderPaths;
|
||||
|
||||
int64_t _quotaUsed = 0;
|
||||
int64_t _quotaAvailable = 0;
|
||||
|
||||
public:
|
||||
QByteArray _dataFingerprint;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user