Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Cambra <claudio.cambra@nextcloud.com>2022-10-01 11:37:02 +0300
committerClaudio Cambra <claudio.cambra@nextcloud.com>2022-10-31 20:06:08 +0300
commit0ca927843fb8900591468ee0a2b4f350556e0b14 (patch)
treedd324b31736d81df489327d4a591c610ee322a59
parent685a0362fca890507bd69bfa896b6adc12f6f673 (diff)
Add early return checks for setter methods
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
-rw-r--r--src/gui/fileactivitylistmodel.cpp4
-rw-r--r--src/gui/filedetails/shareemodel.cpp18
-rw-r--r--src/gui/filedetails/shareemodel.h2
-rw-r--r--src/gui/filedetails/sharemodel.cpp8
4 files changed, 30 insertions, 2 deletions
diff --git a/src/gui/fileactivitylistmodel.cpp b/src/gui/fileactivitylistmodel.cpp
index 2dde4924f..2f0c83d49 100644
--- a/src/gui/fileactivitylistmodel.cpp
+++ b/src/gui/fileactivitylistmodel.cpp
@@ -34,6 +34,10 @@ QString FileActivityListModel::localPath() const
void FileActivityListModel::setLocalPath(const QString &localPath)
{
+ if(localPath == _localPath) {
+ return;
+ }
+
_localPath = localPath;
Q_EMIT localPathChanged();
diff --git a/src/gui/filedetails/shareemodel.cpp b/src/gui/filedetails/shareemodel.cpp
index ddc9d7ac8..c4be699a7 100644
--- a/src/gui/filedetails/shareemodel.cpp
+++ b/src/gui/filedetails/shareemodel.cpp
@@ -82,11 +82,15 @@ QVariant ShareeModel::data(const QModelIndex &index, const int role) const
AccountState *ShareeModel::accountState() const
{
- return _accountState.data();
+ return _accountState;
}
void ShareeModel::setAccountState(AccountState *accountState)
{
+ if (accountState == _accountState) {
+ return;
+ }
+
_accountState = accountState;
Q_EMIT accountStateChanged();
}
@@ -98,6 +102,10 @@ bool ShareeModel::shareItemIsFolder() const
void ShareeModel::setShareItemIsFolder(const bool shareItemIsFolder)
{
+ if (shareItemIsFolder == _shareItemIsFolder) {
+ return;
+ }
+
_shareItemIsFolder = shareItemIsFolder;
Q_EMIT shareItemIsFolderChanged();
}
@@ -109,6 +117,10 @@ QString ShareeModel::searchString() const
void ShareeModel::setSearchString(const QString &searchString)
{
+ if (searchString == _searchString) {
+ return;
+ }
+
_searchString = searchString;
Q_EMIT searchStringChanged();
@@ -127,6 +139,10 @@ ShareeModel::LookupMode ShareeModel::lookupMode() const
void ShareeModel::setLookupMode(const ShareeModel::LookupMode lookupMode)
{
+ if (lookupMode == _lookupMode) {
+ return;
+ }
+
_lookupMode = lookupMode;
Q_EMIT lookupModeChanged();
}
diff --git a/src/gui/filedetails/shareemodel.h b/src/gui/filedetails/shareemodel.h
index 8029ee765..b09624ced 100644
--- a/src/gui/filedetails/shareemodel.h
+++ b/src/gui/filedetails/shareemodel.h
@@ -87,7 +87,7 @@ private:
QTimer _userStoppedTypingTimer;
- AccountStatePtr _accountState;
+ AccountState *_accountState;
QString _searchString;
bool _shareItemIsFolder = false;
bool _fetchOngoing = false;
diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp
index 07294fc93..cb511f038 100644
--- a/src/gui/filedetails/sharemodel.cpp
+++ b/src/gui/filedetails/sharemodel.cpp
@@ -899,6 +899,10 @@ QString ShareModel::localPath() const
void ShareModel::setLocalPath(const QString &localPath)
{
+ if (localPath == _localPath) {
+ return;
+ }
+
_localPath = localPath;
Q_EMIT localPathChanged();
updateData();
@@ -911,6 +915,10 @@ AccountState *ShareModel::accountState() const
void ShareModel::setAccountState(AccountState *accountState)
{
+ if (accountState == _accountState) {
+ return;
+ }
+
_accountState = accountState;
// Change the server and account-related properties