Skip to content

Commit

Permalink
use QStringView in a correct way
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed May 27, 2022
1 parent cd9173c commit edca614
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ int Folder::slotWipeErrorBlacklist()
return _journal.wipeErrorBlacklist();
}

void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
void Folder::slotWatchedPathChanged(QStringView path, ChangeReason reason)
{
if (!path.startsWith(this->path())) {
qCDebug(lcFolder) << "Changed path is not contained in folder, ignoring:" << path;
Expand All @@ -576,7 +576,7 @@ void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
// own process. Therefore nothing needs to be done here!
#else
// Use the path to figure out whether it was our own change
if (_engine->wasFileTouched(path)) {
if (_engine->wasFileTouched(path.toString())) {
qCDebug(lcFolder) << "Changed path was touched by SyncEngine, ignoring:" << path;
return;
}
Expand All @@ -590,7 +590,7 @@ void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
// an attribute change (pin state) that caused the notification
bool spurious = false;
if (record.isValid()
&& !FileSystem::fileChanged(path, record._fileSize, record._modtime)) {
&& !FileSystem::fileChanged(path.toString(), record._fileSize, record._modtime)) {
spurious = true;

if (auto pinState = _vfs->pinState(relativePath.toString())) {
Expand All @@ -607,7 +607,7 @@ void Folder::slotWatchedPathChanged(const QString &path, ChangeReason reason)
}
warnOnNewExcludedItem(record, relativePath);

emit watchedFileChangedExternally(path);
emit watchedFileChangedExternally(path.toString());

// Also schedule this folder for a sync, but only after some delay:
// The sync will not upload files that were changed too recently.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public slots:
* changes. Needs to check whether this change should trigger a new
* sync run to be scheduled.
*/
void slotWatchedPathChanged(const QString &path, ChangeReason reason);
void slotWatchedPathChanged(QStringView path, ChangeReason reason);

/**
* Mark a virtual file as being requested for download, and start a sync.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/sharemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace OCC {
/**
* When a share is modified, we need to tell the folders so they can adjust overlay icons
*/
static void updateFolder(const AccountPtr &account, const QString &path)
static void updateFolder(const AccountPtr &account, QStringView path)
{
foreach (Folder *f, FolderMan::instance()->map()) {
if (f->accountState()->account() != account)
Expand Down
2 changes: 1 addition & 1 deletion test/testexcludedfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ private slots:
auto csync_is_windows_reserved_word = [](const char *fn) {
QString s = QString::fromLatin1(fn);
extern bool csync_is_windows_reserved_word(const QStringView &filename);
return csync_is_windows_reserved_word(&s);
return csync_is_windows_reserved_word(s);
};

QVERIFY(csync_is_windows_reserved_word("CON"));
Expand Down

0 comments on commit edca614

Please sign in to comment.