Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014 ownCloud GmbH
Expand Down Expand Up @@ -126,6 +126,8 @@
this, &FolderMan::slotForwardFolderSyncStateChange);
disconnect(f, &Folder::syncPausedChanged,
this, &FolderMan::slotFolderSyncPaused);
disconnect(f, &Folder::canSyncChanged,
this, &FolderMan::slotFolderCanSyncChanged);
disconnect(&f->syncEngine().syncFileStatusTracker(), &SyncFileStatusTracker::fileStatusChanged,
_socketApi.data(), &SocketApi::broadcastStatusPushMessage);
disconnect(f, &Folder::watchedFileChangedExternally,
Expand Down Expand Up @@ -659,12 +661,12 @@

void FolderMan::slotFolderCanSyncChanged()
{
auto *f = qobject_cast<Folder *>(sender());
ASSERT(f);
if (f->canSync()) {
_socketApi->slotRegisterPath(f->alias());
auto folder = qobject_cast<Folder *>(sender());
ASSERT(folder);
if (folder->canSync()) {
_socketApi->slotRegisterPath(folder->alias());
} else {
_socketApi->slotUnregisterPath(f->alias());
_socketApi->slotUnregisterPath(folder->alias());
}
}

Expand Down
12 changes: 8 additions & 4 deletions src/gui/socketapi/socketapi.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2013 ownCloud GmbH
Expand Down Expand Up @@ -459,12 +459,16 @@

void SocketApi::slotUnregisterPath(const QString &alias)
{
if (!_registeredAliases.contains(alias))
if (!_registeredAliases.contains(alias)) {
return;
}

Folder *f = FolderMan::instance()->folder(alias);
if (f)
broadcastMessage(buildMessage(QLatin1String("UNREGISTER_PATH"), removeTrailingSlash(f->path()), QString()), true);
auto folder = FolderMan::instance()->folder(alias);
if (folder) {
broadcastMessage(buildMessage(QLatin1String("UNREGISTER_PATH"),
removeTrailingSlash(folder->path()),
QString()));
}

_registeredAliases.remove(alias);
}
Expand Down
1 change: 1 addition & 0 deletions test/testfolderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* any purpose.
*/

#include <qglobal.h>

Check failure on line 11 in test/testfolderman.cpp

View workflow job for this annotation

GitHub Actions / build

test/testfolderman.cpp:11:10 [clang-diagnostic-error]

'qglobal.h' file not found
#include <QTemporaryDir>
#include <QtTest>

Expand All @@ -19,6 +19,7 @@
#include "accountstate.h"
#include <accountmanager.h>
#include "configfile.h"
#include "socketapi/socketapi.h"
#include "syncenginetestutils.h"
#include "testhelper.h"

Expand Down
Loading