From 5923cffa19ea2a58ce479bdbcc0fdaca38f1849a Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 1 Mar 2023 14:31:21 +0100 Subject: [PATCH] Clean up declarations in activitylistmodel header, remove unused methods Signed-off-by: Claudio Cambra --- src/gui/tray/activitylistmodel.cpp | 10 ---------- src/gui/tray/activitylistmodel.h | 24 +++++++++--------------- test/activitylistmodeltestutils.cpp | 4 ++-- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 6b6b4569cc8b4..b65709e445705 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -425,16 +425,6 @@ void ActivityListModel::startFetchJob() job->start(); } -void ActivityListModel::setFinalList(const ActivityList &finalList) -{ - _finalList = finalList; -} - -const ActivityList &ActivityListModel::finalList() const -{ - return _finalList; -} - int ActivityListModel::currentItem() const { return _currentItem; diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h index 1674502014286..016e6fe3885a0 100644 --- a/src/gui/tray/activitylistmodel.h +++ b/src/gui/tray/activitylistmodel.h @@ -85,15 +85,12 @@ class ActivityListModel : public QAbstractListModel Q_ENUM(DataRole) explicit ActivityListModel(QObject *parent = nullptr); - - explicit ActivityListModel(AccountState *accountState, - QObject *parent = nullptr); + explicit ActivityListModel(AccountState *accountState, QObject *parent = nullptr); [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; [[nodiscard]] bool canFetchMore(const QModelIndex &) const override; - void fetchMore(const QModelIndex &) override; ActivityList activityList() { return _finalList; } ActivityList errorsList() { return _notificationErrorsLists; } @@ -110,6 +107,8 @@ class ActivityListModel : public QAbstractListModel [[nodiscard]] QString replyMessageSent(const Activity &activity) const; public slots: + void fetchMore(const QModelIndex &) override; + void slotRefreshActivity(); void slotRefreshActivityInitial(); void slotRemoveAccount(); @@ -136,23 +135,23 @@ public slots: protected: [[nodiscard]] QHash roleNames() const override; - [[nodiscard]] bool currentlyFetching() const; - [[nodiscard]] const ActivityList &finalList() const; // added for unit tests - protected slots: void activitiesReceived(const QJsonDocument &json, int statusCode); void setAndRefreshCurrentlyFetching(bool value); void setDoneFetching(bool value); void setHideOldActivities(bool value); void setDisplayActions(bool value); - void setFinalList(const OCC::ActivityList &finalList); // added for unit tests virtual void startFetchJob(); private slots: void addEntriesToActivityList(const OCC::ActivityList &activityList); + void ingestActivities(const QJsonArray &activities); + void appendMoreActivitiesAvailableEntry(); + void insertOrRemoveDummyFetchingActivity(); + void triggerCaseClashAction(OCC::Activity activity); private: static QVariantList convertLinksToMenuEntries(const Activity &activity); @@ -161,11 +160,6 @@ private slots: [[nodiscard]] bool canFetchActivities() const; - void ingestActivities(const QJsonArray &activities); - void appendMoreActivitiesAvailableEntry(); - void insertOrRemoveDummyFetchingActivity(); - void triggerCaseClashAction(Activity activity); - Activity _notificationIgnoredFiles; Activity _dummyFetchingActivities; @@ -181,8 +175,8 @@ private slots: bool _displayActions = true; int _currentItem = 0; - int _maxActivities = 100; - int _maxActivitiesDays = 30; + static constexpr int _maxActivities = 100; + static constexpr int _maxActivitiesDays = 30; bool _showMoreActivitiesAvailableEntry = false; QPointer _currentConflictDialog; diff --git a/test/activitylistmodeltestutils.cpp b/test/activitylistmodeltestutils.cpp index 7f93dcf52ec15..f035f446fcac5 100644 --- a/test/activitylistmodeltestutils.cpp +++ b/test/activitylistmodeltestutils.cpp @@ -432,7 +432,7 @@ void TestingALM::startFetchJob() void TestingALM::slotProcessReceivedActivities() { - auto finalListCopy = finalList(); + auto finalListCopy = _finalList; for (int i = _numRowsPrev; i < rowCount(); ++i) { const auto modelIndex = index(i, 0); auto activity = finalListCopy.at(modelIndex.row()); @@ -453,7 +453,7 @@ void TestingALM::slotProcessReceivedActivities() qDebug() << activity._subject << activity._subjectDisplay; } - setFinalList(finalListCopy); + _finalList = finalListCopy; setAndRefreshCurrentlyFetching(false); emit activitiesProcessed();