mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-05-09 14:34:07 +02:00
Vfs: Send SyncFileStatusTracker data to vfs plugins
This commit is contained in:
parent
31394f14b5
commit
e2eea24a03
src
@ -21,6 +21,7 @@
|
||||
|
||||
#include "ocsynclib.h"
|
||||
#include "result.h"
|
||||
#include "syncfilestatus.h"
|
||||
|
||||
typedef struct csync_file_stat_s csync_file_stat_t;
|
||||
|
||||
@ -153,6 +154,15 @@ public:
|
||||
*/
|
||||
virtual bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) = 0;
|
||||
|
||||
public slots:
|
||||
/** Update in-sync state based on SyncFileStatusTracker signal.
|
||||
*
|
||||
* For some vfs plugins the icons aren't based on SocketAPI but rather on data shared
|
||||
* via the vfs plugin. The connection to SyncFileStatusTracker allows both to be based
|
||||
* on the same data.
|
||||
*/
|
||||
virtual void fileStatusChanged(const QString &systemFileName, SyncFileStatus fileStatus) = 0;
|
||||
|
||||
signals:
|
||||
/// Emitted when a user-initiated hydration starts
|
||||
void beginHydrating();
|
||||
@ -187,6 +197,9 @@ public:
|
||||
|
||||
bool isDehydratedPlaceholder(const QString &) override { return false; }
|
||||
bool statTypeVirtualFile(csync_file_stat_t *, void *) override { return false; }
|
||||
|
||||
public slots:
|
||||
void fileStatusChanged(const QString &, SyncFileStatus) override {}
|
||||
};
|
||||
|
||||
/// Check whether the plugin for the mode is available.
|
||||
|
@ -481,8 +481,11 @@ void Folder::startVfs()
|
||||
vfsParams.providerName = Theme::instance()->appNameGUI();
|
||||
vfsParams.providerVersion = Theme::instance()->version();
|
||||
|
||||
connect(_vfs.data(), &OCC::Vfs::beginHydrating, this, &Folder::slotHydrationStarts);
|
||||
connect(_vfs.data(), &OCC::Vfs::doneHydrating, this, &Folder::slotHydrationDone);
|
||||
connect(_vfs.data(), &Vfs::beginHydrating, this, &Folder::slotHydrationStarts);
|
||||
connect(_vfs.data(), &Vfs::doneHydrating, this, &Folder::slotHydrationDone);
|
||||
|
||||
connect(&_engine->syncFileStatusTracker(), &SyncFileStatusTracker::fileStatusChanged,
|
||||
_vfs.data(), &Vfs::fileStatusChanged);
|
||||
|
||||
_vfs->registerFolder(vfsParams); // Do this always?
|
||||
_vfs->start(vfsParams);
|
||||
@ -637,6 +640,9 @@ void Folder::setSupportsVirtualFiles(bool enabled)
|
||||
_vfs->stop();
|
||||
_vfs->unregisterFolder();
|
||||
|
||||
disconnect(_vfs.data(), 0, this, 0);
|
||||
disconnect(&_engine->syncFileStatusTracker(), 0, _vfs.data(), 0);
|
||||
|
||||
_vfs.reset(createVfsFromPlugin(newMode).release());
|
||||
|
||||
_definition.virtualFilesMode = newMode;
|
||||
|
@ -46,6 +46,9 @@ public:
|
||||
|
||||
bool isDehydratedPlaceholder(const QString &filePath) override;
|
||||
bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) override;
|
||||
|
||||
public slots:
|
||||
void fileStatusChanged(const QString &, SyncFileStatus) override {}
|
||||
};
|
||||
|
||||
class SuffixVfsPluginFactory : public QObject, public DefaultPluginFactory<VfsSuffix>
|
||||
|
Loading…
Reference in New Issue
Block a user