implement more feedback

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2023-05-04 16:23:50 +02:00 committed by Matthieu Gallien
parent fa135a4228
commit 8d52d4e4cc
3 changed files with 22 additions and 18 deletions

View file

@ -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

View file

@ -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

View file

@ -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;
};