Skip to content

Commit

Permalink
Clean up declarations in activitylistmodel header, remove unused methods
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Mar 1, 2023
1 parent 50a8f9b commit ed56fd1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
10 changes: 0 additions & 10 deletions src/gui/tray/activitylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 9 additions & 15 deletions src/gui/tray/activitylistmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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();
Expand All @@ -136,23 +135,23 @@ public slots:

protected:
[[nodiscard]] QHash<int, QByteArray> 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);
Expand All @@ -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;

Expand All @@ -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<ConflictDialog> _currentConflictDialog;
Expand Down
5 changes: 2 additions & 3 deletions test/activitylistmodeltestutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -450,10 +450,9 @@ void TestingALM::slotProcessReceivedActivities()
}

finalListCopy[modelIndex.row()] = activity;
qDebug() << activity._subject << activity._subjectDisplay;
}

setFinalList(finalListCopy);
_finalList = finalListCopy;

setAndRefreshCurrentlyFetching(false);
emit activitiesProcessed();
Expand Down

0 comments on commit ed56fd1

Please sign in to comment.