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
path: root/src
diff options
context:
space:
mode:
authorClaudio Cambra <claudio.cambra@gmail.com>2022-02-01 19:01:51 +0300
committerGitHub <noreply@github.com>2022-02-01 19:01:51 +0300
commita2524763c87e7d41db56b721408ed77c01affb38 (patch)
treea8f001bdf9ce79bf100138ed91f3a6fe54aeabac /src
parent7a1eae45d3adb9c4bf2bcd3e1a6f76e4a36db50e (diff)
parentfddd9dd884378ea78ab823548439773a0f98cd7a (diff)
Merge branch 'master' into bugfix/account-menu-scroll
Diffstat (limited to 'src')
-rw-r--r--src/gui/tray/activitylistmodel.cpp22
-rw-r--r--src/gui/tray/activitylistmodel.h4
2 files changed, 10 insertions, 16 deletions
diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp
index eacf36fd8..8120612a5 100644
--- a/src/gui/tray/activitylistmodel.cpp
+++ b/src/gui/tray/activitylistmodel.cpp
@@ -269,8 +269,12 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
return QVariant();
}
-int ActivityListModel::rowCount(const QModelIndex &) const
+int ActivityListModel::rowCount(const QModelIndex &parent) const
{
+ if(parent.isValid()) {
+ return 0;
+ }
+
return _finalList.count();
}
@@ -342,7 +346,6 @@ void ActivityListModel::activitiesReceived(const QJsonDocument &json, int status
a._icon = json.value(QStringLiteral("icon")).toString();
auto richSubjectData = json.value(QStringLiteral("subject_rich")).toArray();
- Q_ASSERT(richSubjectData.size() > 1);
if(richSubjectData.size() > 1) {
a._subjectRich = richSubjectData[0].toString();
@@ -621,14 +624,8 @@ void ActivityListModel::combineActivityLists()
}
beginResetModel();
- _finalList.clear();
+ _finalList = resultList;
endResetModel();
-
- if (resultList.count() > 0) {
- beginInsertRows(QModelIndex(), 0, resultList.count() - 1);
- _finalList = resultList;
- endInsertRows();
- }
}
bool ActivityListModel::canFetchActivities() const
@@ -638,11 +635,8 @@ bool ActivityListModel::canFetchActivities() const
void ActivityListModel::fetchMore(const QModelIndex &)
{
- if (canFetchActivities()) {
+ if (canFetchActivities() && !_currentlyFetching) {
startFetchJob();
- } else {
- _doneFetching = true;
- combineActivityLists();
}
}
@@ -672,4 +666,6 @@ void ActivityListModel::slotRemoveAccount()
_totalActivitiesFetched = 0;
_showMoreActivitiesAvailableEntry = false;
}
+
}
+
diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h
index 07385e768..66de2e498 100644
--- a/src/gui/tray/activitylistmodel.h
+++ b/src/gui/tray/activitylistmodel.h
@@ -44,7 +44,6 @@ class ActivityListModel : public QAbstractListModel
public:
enum DataRole {
ActionIconRole = Qt::UserRole + 1,
- UserIconRole,
AccountRole,
ObjectTypeRole,
ActionsLinksRole,
@@ -59,7 +58,6 @@ public:
LinkRole,
PointInTimeRole,
AccountConnectedRole,
- SyncFileStatusRole,
DisplayActions,
ShareableRole,
};
@@ -90,6 +88,7 @@ public:
Q_INVOKABLE void triggerAction(int activityIndex, int actionIndex);
AccountState *accountState() const;
+ void setAccountState(AccountState *state);
public slots:
void slotRefreshActivity();
@@ -103,7 +102,6 @@ protected:
void activitiesReceived(const QJsonDocument &json, int statusCode);
QHash<int, QByteArray> roleNames() const override;
- void setAccountState(AccountState *state);
void setCurrentlyFetching(bool value);
bool currentlyFetching() const;
void setDoneFetching(bool value);