Skip to content

Commit

Permalink
Merge pull request #4736 from nextcloud/bugfix/refactor-activity-list…
Browse files Browse the repository at this point in the history
…-model

Refactor ActivityListModel population mechanisms
  • Loading branch information
claucambra authored Sep 13, 2022
2 parents 20c5f8e + 1a5fa50 commit b91dad9
Show file tree
Hide file tree
Showing 6 changed files with 419 additions and 302 deletions.
2 changes: 1 addition & 1 deletion src/gui/fileactivitylistmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FileActivityListModel : public ActivityListModel
public slots:
void load(AccountState *accountState, const int objectId);

protected:
protected slots:
void startFetchJob() override;

private:
Expand Down
10 changes: 10 additions & 0 deletions src/gui/tray/activitydata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ bool operator<(const Activity &rhs, const Activity &lhs)
return rhs._dateTime > lhs._dateTime;
}

bool operator>(const Activity &rhs, const Activity &lhs)
{
return rhs._dateTime < lhs._dateTime;
}

bool operator==(const Activity &rhs, const Activity &lhs)
{
return (rhs._type == lhs._type && rhs._id == lhs._id && rhs._accName == lhs._accName);
}

bool operator!=(const Activity &rhs, const Activity &lhs)
{
return !(rhs == lhs);
}

Activity::Identifier Activity::ident() const
{
return Identifier(_id, _accName);
Expand Down
3 changes: 3 additions & 0 deletions src/gui/tray/activitydata.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ class Activity
};

bool operator==(const Activity &rhs, const Activity &lhs);
bool operator!=(const Activity &rhs, const Activity &lhs);
bool operator<(const Activity &rhs, const Activity &lhs);
bool operator>(const Activity &rhs, const Activity &lhs);

/* ==================================================================== */
/**
Expand All @@ -170,6 +172,7 @@ bool operator<(const Activity &rhs, const Activity &lhs);
using ActivityList = QList<Activity>;
}

Q_DECLARE_METATYPE(OCC::Activity)
Q_DECLARE_METATYPE(OCC::Activity::Type)
Q_DECLARE_METATYPE(OCC::ActivityLink)
Q_DECLARE_METATYPE(OCC::PreviewData)
Expand Down
Loading

0 comments on commit b91dad9

Please sign in to comment.