From fcd5a863495b5a0c1cea3a9bcedc8af656af98ef Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 11 Oct 2023 14:22:06 +0200 Subject: [PATCH 1/4] signals/slots need to have fully qualified arguments Signed-off-by: Matthieu Gallien --- src/gui/accountmanager.cpp | 2 +- src/gui/accountmanager.h | 2 +- src/gui/filedetails/sharemodel.cpp | 2 +- src/gui/filedetails/sharemodel.h | 2 +- src/libsync/owncloudpropagator.h | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index ce981e11a6eab..91dfb33dab5ff 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -490,7 +490,7 @@ AccountState *AccountManager::addAccount(const AccountPtr &newAccount) return newAccountState; } -void AccountManager::deleteAccount(AccountState *account) +void AccountManager::deleteAccount(OCC::AccountState *account) { const auto it = std::find(_accounts.begin(), _accounts.end(), account); if (it == _accounts.end()) { diff --git a/src/gui/accountmanager.h b/src/gui/accountmanager.h index da5f3464a7106..626800f9b97e0 100644 --- a/src/gui/accountmanager.h +++ b/src/gui/accountmanager.h @@ -101,7 +101,7 @@ public slots: void save(bool saveCredentials = true); /// Delete the AccountState - void deleteAccount(AccountState *account); + void deleteAccount(OCC::AccountState *account); /// Remove all accounts void shutdown(); diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 5d6f635b8d872..418f5353d47e9 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -945,7 +945,7 @@ void ShareModel::toggleShareNoteToRecipientFromQml(const QVariant &share, const toggleShareNoteToRecipient(ptr, enable); } -void ShareModel::changePermissionModeFromQml(const QVariant &share, const SharePermissionsMode permissionMode) +void ShareModel::changePermissionModeFromQml(const QVariant &share, const OCC::ShareModel::SharePermissionsMode permissionMode) { const auto sharePtr = share.value(); if (sharePtr.isNull() || _sharePermissionsChangeInProgress) { diff --git a/src/gui/filedetails/sharemodel.h b/src/gui/filedetails/sharemodel.h index e3e44c963e1aa..735d207c9f082 100644 --- a/src/gui/filedetails/sharemodel.h +++ b/src/gui/filedetails/sharemodel.h @@ -173,7 +173,7 @@ public slots: void toggleShareExpirationDateFromQml(const QVariant &share, const bool enable) const; void toggleShareNoteToRecipient(const OCC::SharePtr &share, const bool enable) const; void toggleShareNoteToRecipientFromQml(const QVariant &share, const bool enable) const; - void changePermissionModeFromQml(const QVariant &share, const SharePermissionsMode permissionMode); + void changePermissionModeFromQml(const QVariant &share, const OCC::ShareModel::SharePermissionsMode permissionMode); void setLinkShareLabel(const QSharedPointer &linkShare, const QString &label) const; void setLinkShareLabelFromQml(const QVariant &linkShare, const QString &label) const; diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index 1b2398c0443c8..46f0ea4e5ec2e 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -644,7 +644,7 @@ private slots: signals: void newItem(const OCC::SyncFileItemPtr &); - void itemCompleted(const SyncFileItemPtr &item, OCC::ErrorCategory category); + void itemCompleted(const OCC::SyncFileItemPtr &item, OCC::ErrorCategory category); void progress(const OCC::SyncFileItem &, qint64 bytes); void finished(OCC::SyncFileItem::Status status); @@ -725,7 +725,7 @@ class CleanupPollsJob : public QObject void start(); signals: void finished(); - void aborted(const QString &error, const ErrorCategory errorCategory); + void aborted(const QString &error, const OCC::ErrorCategory errorCategory); private slots: void slotPollFinished(); }; From a1e6c562ea2f9cec58e04a44e8c8eb21efa4ce47 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 11 Oct 2023 14:22:42 +0200 Subject: [PATCH 2/4] remove duplicated signals overriding the same signal in base class Signed-off-by: Matthieu Gallien --- src/gui/sharemanager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/sharemanager.h b/src/gui/sharemanager.h index 0ba738ded6a5d..f7e33d16f0593 100644 --- a/src/gui/sharemanager.h +++ b/src/gui/sharemanager.h @@ -310,7 +310,6 @@ public slots: void noteSet(); void nameSet(); void labelSet(); - void hideDownloadSet(); private slots: void slotNoteSet(const QJsonDocument &, const QVariant &value); From a46bc8e8b0d3ec2c44b3b2648acfce72f1400c30 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 11 Oct 2023 14:23:27 +0200 Subject: [PATCH 3/4] fix mising emit keyword in two places when emitting a signal Signed-off-by: Matthieu Gallien --- src/libsync/networkjobs.cpp | 2 +- src/libsync/syncengine.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 8c4a9d21ae203..3c784675feb61 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -836,7 +836,7 @@ bool AvatarJob::finished() } } } - emit(avatarPixmap(avImage)); + emit avatarPixmap(avImage); return true; } #endif diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index d76c11edaaeab..eeb2e6989043d 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -919,7 +919,7 @@ void SyncEngine::slotDiscoveryFinished() void SyncEngine::slotCleanPollsJobAborted(const QString &error, const ErrorCategory errorCategory) { - syncError(error, errorCategory); + emit syncError(error, errorCategory); finalize(false); } From 8b0d6dc32275c081860abdf64d5ec47a54ec7b1c Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 11 Oct 2023 14:24:22 +0200 Subject: [PATCH 4/4] avoid for loops detaching the container when uneeded Signed-off-by: Matthieu Gallien --- src/libsync/syncengine.cpp | 2 +- test/testsecurefiledrop.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index eeb2e6989043d..07befe1844c93 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -811,7 +811,7 @@ void SyncEngine::slotDiscoveryFinished() } if (_discoveryPhase->_hasDownloadRemovedItems && _discoveryPhase->_hasUploadErrorItems) { - for (const auto &item : _syncItems) { + for (const auto &item : qAsConst(_syncItems)) { if (item->_instruction == CSYNC_INSTRUCTION_ERROR && item->_direction == SyncFileItem::Up) { item->_instruction = CSYNC_INSTRUCTION_IGNORE; } diff --git a/test/testsecurefiledrop.cpp b/test/testsecurefiledrop.cpp index d0b7020f939a2..96d71da2d9ec3 100644 --- a/test/testsecurefiledrop.cpp +++ b/test/testsecurefiledrop.cpp @@ -142,7 +142,8 @@ private slots: bool isAnyFileDropFileMissing = false; - for (const auto &key : metadata->fileDrop().keys()) { + const auto allKeys = metadata->fileDrop().keys(); + for (const auto &key : allKeys) { if (std::find_if(metadata->files().constBegin(), metadata->files().constEnd(), [&key](const EncryptedFile &encryptedFile) { return encryptedFile.encryptedFilename == key; }) == metadata->files().constEnd()) {