Define basic FileProviderDomainSyncStatus private implementation

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-01-09 23:30:27 +08:00
parent 7a9a17a2f3
commit 62c85de35b
No known key found for this signature in database
GPG key ID: C839200C384636B0
3 changed files with 65 additions and 21 deletions

View file

@ -1,20 +0,0 @@
/*
* Copyright (C) 2024 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 "fileproviderdomainsyncstatus.h"
namespace OCC::Mac
{
} // OCC::Mac

View file

@ -12,13 +12,23 @@
* for more details.
*/
#include <QObject>
#pragma once
namespace OCC::Mac
{
class FileProviderDomainSyncStatus
class FileProviderDomainSyncStatus : public QObject
{
Q_OBJECT
public:
explicit FileProviderDomainSyncStatus(const QString &domainIdentifier, QObject *parent = nullptr);
private:
class MacImplementation;
std::unique_ptr<MacImplementation> d;
};
} // OCC::Mac

View file

@ -0,0 +1,54 @@
/*
* Copyright (C) 2024 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 "fileproviderdomainsyncstatus.h"
#include <QLoggingCategory>
#include "gui/macOS/fileproviderutils.h"
#import <FileProvider/FileProvider.h>
namespace OCC::Mac
{
Q_LOGGING_CATEGORY(lcMacFileProviderDomainSyncStatus, "nextcloud.gui.macfileproviderdomainsyncstatus", QtInfoMsg)
class FileProviderDomainSyncStatus::MacImplementation
{
public:
explicit MacImplementation(const QString &domainIdentifier)
{
_domain = FileProviderUtils::domainForIdentifier(domainIdentifier);
_manager = [NSFileProviderManager managerForDomain:_domain];
if (_manager == nil) {
qCWarning(lcMacFileProviderDomainSyncStatus) << "Could not get manager for domain" << domainIdentifier;
}
}
~MacImplementation() = default;
private:
NSFileProviderDomain *_domain;
NSFileProviderManager *_manager;
};
FileProviderDomainSyncStatus::FileProviderDomainSyncStatus(const QString &domainIdentifier, QObject *parent)
: QObject(parent)
, d(std::make_unique<MacImplementation>(domainIdentifier))
{
}
} // OCC::Mac