diff --git a/src/gui/tray/SyncStatus.qml b/src/gui/tray/SyncStatus.qml index 799d4d3e0..40c6553c6 100644 --- a/src/gui/tray/SyncStatus.qml +++ b/src/gui/tray/SyncStatus.qml @@ -121,7 +121,7 @@ RowLayout { contentsFont.bold: true bgColor: Style.currentUserHeaderColor - visible: !activityModel.hasManySyncConflicts && + visible: !activityModel.hasSyncConflicts && !syncStatus.syncing && NC.UserModel.currentUser.hasLocalFolder && NC.UserModel.currentUser.isConnected @@ -140,13 +140,13 @@ RowLayout { Style.standardSpacing * 2 Layout.rightMargin: Style.trayHorizontalMargin - text: qsTr("Solve all conflicts") + text: qsTr("Resolve conflicts") textColor: Style.adjustedCurrentUserHeaderColor textColorHovered: Style.currentUserHeaderTextColor contentsFont.bold: true bgColor: Style.currentUserHeaderColor - visible: activityModel.hasManySyncConflicts && + visible: activityModel.hasSyncConflicts && !syncStatus.syncing && NC.UserModel.currentUser.hasLocalFolder && NC.UserModel.currentUser.isConnected diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 507f4da42..8adae711f 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -551,20 +551,15 @@ void ActivityListModel::addEntriesToActivityList(const ActivityList &activityLis } endInsertRows(); - auto conflictsCount = 0; + auto conflictsFound = false; for(const auto &activity : _finalList) { if (activity._syncFileItemStatus == SyncFileItem::Conflict) { - ++conflictsCount; + conflictsFound = true; + break; } } - if (!_hasManySyncConflicts && conflictsCount > 2) { - _hasManySyncConflicts = true; - emit hasManySyncConflictsChanged(); - } else if (_hasManySyncConflicts && conflictsCount <= 2) { - _hasManySyncConflicts = false; - emit hasManySyncConflictsChanged(); - } + setHasSyncConflicts(conflictsFound); } void ActivityListModel::addErrorToActivityList(const Activity &activity) @@ -753,6 +748,14 @@ void ActivityListModel::displaySingleConflictDialog(const Activity &activity) ownCloudGui::raiseDialog(_currentConflictDialog); } +void ActivityListModel::setHasSyncConflicts(bool conflictsFound) +{ + if (_hasSyncConflicts != conflictsFound) { + _hasSyncConflicts = conflictsFound; + emit hasSyncConflictsChanged(); + } +} + void ActivityListModel::slotTriggerAction(const int activityIndex, const int actionIndex) { if (activityIndex < 0 || activityIndex >= _finalList.size()) { @@ -909,9 +912,9 @@ QString ActivityListModel::replyMessageSent(const Activity &activity) const return activity._talkNotificationData.messageSent; } -bool ActivityListModel::hasManySyncConflicts() const +bool ActivityListModel::hasSyncConflicts() const { - return _hasManySyncConflicts; + return _hasSyncConflicts; } ActivityList ActivityListModel::allConflicts() const diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h index b6864d81c..05e76bace 100644 --- a/src/gui/tray/activitylistmodel.h +++ b/src/gui/tray/activitylistmodel.h @@ -42,7 +42,7 @@ class ActivityListModel : public QAbstractListModel Q_OBJECT Q_PROPERTY(quint32 maxActionButtons READ maxActionButtons CONSTANT) Q_PROPERTY(AccountState *accountState READ accountState WRITE setAccountState NOTIFY accountStateChanged) - Q_PROPERTY(bool hasManySyncConflicts READ hasManySyncConflicts NOTIFY hasManySyncConflictsChanged) + Q_PROPERTY(bool hasSyncConflicts READ hasSyncConflicts NOTIFY hasSyncConflictsChanged) Q_PROPERTY(OCC::ActivityList allConflicts READ allConflicts NOTIFY allConflictsChanged) public: @@ -107,7 +107,7 @@ public: [[nodiscard]] QString replyMessageSent(const Activity &activity) const; - [[nodiscard]] bool hasManySyncConflicts() const; + [[nodiscard]] bool hasSyncConflicts() const; [[nodiscard]] OCC::ActivityList allConflicts() const; @@ -132,7 +132,7 @@ public slots: signals: void accountStateChanged(); - void hasManySyncConflictsChanged(); + void hasSyncConflictsChanged(); void allConflictsChanged(); void activityJobStatusCode(int statusCode); @@ -171,6 +171,7 @@ private: void triggerCaseClashAction(Activity activity); void displaySingleConflictDialog(const Activity &activity); + void setHasSyncConflicts(bool conflictsFound); Activity _notificationIgnoredFiles; Activity _dummyFetchingActivities; @@ -200,7 +201,7 @@ private: bool _doneFetching = false; bool _hideOldActivities = true; - bool _hasManySyncConflicts = false; + bool _hasSyncConflicts = false; static constexpr quint32 MaxActionButtons = 3; };