Add a Qt-based data class for file provider items

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-09-28 20:45:19 +08:00
parent fec9902a25
commit 57d1dc84aa
No known key found for this signature in database
GPG Key ID: C839200C384636B0
3 changed files with 295 additions and 0 deletions

View File

@ -293,6 +293,8 @@ IF( APPLE )
macOS/fileprovider_mac.mm
macOS/fileproviderdomainmanager.h
macOS/fileproviderdomainmanager_mac.mm
macOS/fileprovideritemmetadata.h
macOS/fileprovideritemmetadata.cpp
macOS/fileprovidersettingscontroller.h
macOS/fileprovidersettingscontroller_mac.mm
macOS/fileprovidersocketcontroller.h

View File

@ -0,0 +1,168 @@
/*
* Copyright (C) 2023 by Claudio Cambra <claudio.cambra@nextcloud.com>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*/
#include "fileprovideritemmetadata.h"
namespace OCC {
namespace Mac {
QString FileProviderItemMetadata::identifier() const
{
return _identifier;
}
QString FileProviderItemMetadata::parentItemIdentifier() const
{
return _parentItemIdentifier;
}
QString FileProviderItemMetadata::filename() const
{
return _filename;
}
QString FileProviderItemMetadata::typeIdentifier() const
{
return _typeIdentifier;
}
QString FileProviderItemMetadata::symlinkTargetPath() const
{
return _symlinkTargetPath;
}
QString FileProviderItemMetadata::uploadingError() const
{
return _uploadingError;
}
QString FileProviderItemMetadata::downloadingError() const
{
return _downloadingError;
}
QString FileProviderItemMetadata::mostRecentEditorName() const
{
return _mostRecentEditorName;
}
QString FileProviderItemMetadata::ownerName() const
{
return _ownerName;
}
QDateTime FileProviderItemMetadata::contentModificationDate() const
{
return _contentModificationDate;
}
QDateTime FileProviderItemMetadata::creationDate() const
{
return _creationDate;
}
QDateTime FileProviderItemMetadata::lastUsedDate() const
{
return _lastUsedDate;
}
QByteArray FileProviderItemMetadata::contentVersion() const
{
return _contentVersion;
}
QByteArray FileProviderItemMetadata::metadataVersion() const
{
return _metadataVersion;
}
QByteArray FileProviderItemMetadata::tagData() const
{
return _tagData;
}
QHash<QString, QByteArray> FileProviderItemMetadata::extendedAttributes() const
{
return _extendedAttributes;
}
int FileProviderItemMetadata::capabilities() const
{
return _capabilities;
}
int FileProviderItemMetadata::fileSystemFlags() const
{
return _fileSystemFlags;
}
unsigned int FileProviderItemMetadata::childItemCount() const
{
return _childItemCount;
}
unsigned int FileProviderItemMetadata::typeOsCode() const
{
return _typeOsCode;
}
unsigned int FileProviderItemMetadata::creatorOsCode() const
{
return _creatorOsCode;
}
unsigned long long FileProviderItemMetadata::documentSize() const
{
return _documentSize;
}
bool FileProviderItemMetadata::mostRecentVersionDownloaded() const
{
return _mostRecentVersionDownloaded;
}
bool FileProviderItemMetadata::uploading() const
{
return _uploading;
}
bool FileProviderItemMetadata::uploaded() const
{
return _uploaded;
}
bool FileProviderItemMetadata::downloading() const
{
return _downloading;
}
bool FileProviderItemMetadata::downloaded() const
{
return _downloaded;
}
bool FileProviderItemMetadata::shared() const
{
return _shared;
}
bool FileProviderItemMetadata::sharedByCurrentUser() const
{
return _sharedByCurrentUser;
}
}
}

View File

@ -0,0 +1,125 @@
/*
* Copyright (C) 2023 by Claudio Cambra <claudio.cambra@nextcloud.com>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*/
#pragma once
#include <QObject>
#include <QDateTime>
namespace OCC {
namespace Mac {
class FileProviderItemMetadata
{
Q_GADGET
Q_PROPERTY(QString identifier READ identifier CONSTANT)
Q_PROPERTY(QString parentItemIdentifier READ parentItemIdentifier CONSTANT)
Q_PROPERTY(QString filename READ filename CONSTANT)
Q_PROPERTY(QString typeIdentifier READ typeIdentifier CONSTANT)
Q_PROPERTY(QString symlinkTargetPath READ symlinkTargetPath CONSTANT)
Q_PROPERTY(QString uploadingError READ uploadingError CONSTANT)
Q_PROPERTY(QString downloadingError READ downloadingError CONSTANT)
Q_PROPERTY(QString mostRecentEditorName READ mostRecentEditorName CONSTANT)
Q_PROPERTY(QString ownerName READ ownerName CONSTANT)
Q_PROPERTY(QDateTime contentModificationDate READ contentModificationDate CONSTANT)
Q_PROPERTY(QDateTime creationDate READ creationDate CONSTANT)
Q_PROPERTY(QDateTime lastUsedDate READ lastUsedDate CONSTANT)
Q_PROPERTY(QByteArray contentVersion READ contentVersion CONSTANT)
Q_PROPERTY(QByteArray metadataVersion READ metadataVersion CONSTANT)
Q_PROPERTY(QByteArray tagData READ tagData CONSTANT)
Q_PROPERTY(QHash<QString, QByteArray> extendedAttributes READ extendedAttributes CONSTANT)
Q_PROPERTY(int capabilities READ capabilities CONSTANT)
Q_PROPERTY(int fileSystemFlags READ fileSystemFlags CONSTANT)
Q_PROPERTY(unsigned int childItemCount READ childItemCount CONSTANT)
Q_PROPERTY(unsigned int typeOsCode READ typeOsCode CONSTANT)
Q_PROPERTY(unsigned int creatorOsCode READ creatorOsCode CONSTANT)
Q_PROPERTY(unsigned long long documentSize READ documentSize CONSTANT)
Q_PROPERTY(bool mostRecentVersionDownloaded READ mostRecentVersionDownloaded CONSTANT)
Q_PROPERTY(bool uploading READ uploading CONSTANT)
Q_PROPERTY(bool uploaded READ uploaded CONSTANT)
Q_PROPERTY(bool downloading READ downloading CONSTANT)
Q_PROPERTY(bool downloaded READ downloaded CONSTANT)
Q_PROPERTY(bool shared READ shared CONSTANT)
Q_PROPERTY(bool sharedByCurrentUser READ sharedByCurrentUser CONSTANT)
public:
QString identifier() const;
QString parentItemIdentifier() const;
QString filename() const;
QString typeIdentifier() const;
QString symlinkTargetPath() const;
QString uploadingError() const;
QString downloadingError() const;
QString mostRecentEditorName() const;
QString ownerName() const;
QDateTime contentModificationDate() const;
QDateTime creationDate() const;
QDateTime lastUsedDate() const;
QByteArray contentVersion() const;
QByteArray metadataVersion() const;
QByteArray tagData() const;
QHash<QString, QByteArray> extendedAttributes() const;
int capabilities() const;
int fileSystemFlags() const;
unsigned int childItemCount() const;
unsigned int typeOsCode() const;
unsigned int creatorOsCode() const;
unsigned long long documentSize() const;
bool mostRecentVersionDownloaded() const;
bool uploading() const;
bool uploaded() const;
bool downloading() const;
bool downloaded() const;
bool shared() const;
bool sharedByCurrentUser() const;
private:
QString _identifier;
QString _parentItemIdentifier;
QString _filename;
QString _typeIdentifier;
QString _symlinkTargetPath;
QString _uploadingError;
QString _downloadingError;
QString _mostRecentEditorName;
QString _ownerName;
QDateTime _contentModificationDate;
QDateTime _creationDate;
QDateTime _lastUsedDate;
QByteArray _contentVersion;
QByteArray _metadataVersion;
QByteArray _tagData;
QHash<QString, QByteArray> _extendedAttributes;
quint64 _favoriteRank = 0;
int _capabilities = 0;
int _fileSystemFlags = 0;
unsigned int _childItemCount = 0;
unsigned int _typeOsCode = 0;
unsigned int _creatorOsCode = 0;
unsigned long long _documentSize = 0;
bool _mostRecentVersionDownloaded = false;
bool _uploading = false;
bool _uploaded = false;
bool _downloading = false;
bool _downloaded = false;
bool _shared = false;
bool _sharedByCurrentUser = false;
bool _trashed = false;
};
}
}