Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Small improvements in Folder. #7880

Merged
merged 4 commits into from
Feb 18, 2025
Merged
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
23 changes: 14 additions & 9 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/gui/folder.cpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on src/gui/folder.cpp

File src/gui/folder.cpp does not conform to Custom style guidelines. (lines 1551)
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
Expand All @@ -13,7 +13,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "common/syncjournaldb.h"

Check failure on line 16 in src/gui/folder.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/folder.cpp:16:10 [clang-diagnostic-error]

'common/syncjournaldb.h' file not found
#include "config.h"

#include "account.h"
Expand Down Expand Up @@ -670,7 +670,7 @@
}
}
if (spurious) {
qCInfo(lcFolder) << "Ignoring spurious notification for file" << relativePath;
qCDebug(lcFolder) << "Ignoring spurious notification for file" << relativePath;
return; // probably a spurious notification
}
}
Expand Down Expand Up @@ -1521,32 +1521,37 @@
void Folder::warnOnNewExcludedItem(const SyncJournalFileRecord &record, const QStringView &path)
{
// Never warn for items in the database
if (record.isValid())
if (record.isValid()) {
return;
}

// Don't warn for items that no longer exist.
// Note: This assumes we're getting file watcher notifications
// for folders only on creation and deletion - if we got a notification
// on content change that would create spurious warnings.
const auto fullPath = QString{_canonicalLocalPath + path};
QFileInfo fi(fullPath);
if (!FileSystem::fileExists(fullPath))
if (!FileSystem::fileExists(fullPath)) {
return;
}

bool ok = false;
auto blacklist = _journal.getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
if (!ok)
const auto selectiveSyncList = _journal.getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
if (!ok) {
return;
if (!blacklist.contains(path + "/"))
}
if (!selectiveSyncList.contains(path + "/")) {
return;
}

QFileInfo excludeItemFileInfo(fullPath);
const auto excludeItemFilePath = excludeItemFileInfo.filePath();
const auto message = FileSystem::isDir(fullPath)
? tr("The folder %1 was created but was excluded from synchronization previously. "
"Data inside it will not be synchronized.")
.arg(fi.filePath())
.arg(excludeItemFilePath)
: tr("The file %1 was created but was excluded from synchronization previously. "
"It will not be synchronized.")
.arg(fi.filePath());
.arg(excludeItemFilePath);

Logger::instance()->postGuiLog(Theme::instance()->appNameGUI(), message);
}
Expand Down
Loading