From: Michael Schuster Date: Fri, 17 Jan 2020 19:26:48 +0000 (+0100) Subject: Add grey hint Activity entry if limit is reached X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~413^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=de74057cc8bc0b71238c4c41705c4a7e3c4cea1b;p=nextcloud-desktop.git Add grey hint Activity entry if limit is reached Signed-off-by: Michael Schuster --- diff --git a/src/gui/tray/ActivityListModel.cpp b/src/gui/tray/ActivityListModel.cpp index 8be9c174d..a9b2efc64 100644 --- a/src/gui/tray/ActivityListModel.cpp +++ b/src/gui/tray/ActivityListModel.cpp @@ -50,6 +50,7 @@ QHash ActivityListModel::roleNames() const roles[ActionRole] = "type"; roles[ActionIconRole] = "icon"; roles[ActionTextRole] = "subject"; + roles[ActionTextColorRole] = "activityTextTitleColor"; roles[ObjectTypeRole] = "objectType"; roles[PointInTimeRole] = "dateTime"; return roles; @@ -170,6 +171,8 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const } case ActionTextRole: return a._subject; + case ActionTextColorRole: + return a._id == -1 ? QLatin1String("#808080") : QLatin1String("#222"); // FIXME: This is a temporary workaround for _showMoreActivitiesAvailableEntry case MessageRole: if (a._message.isEmpty()) { return QString("No description available."); @@ -185,7 +188,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const case AccountRole: return a._accName; case PointInTimeRole: - return QString("%1 - %2").arg(Utility::timeAgoInWords(a._dateTime.toLocalTime()), a._dateTime.toLocalTime().toString(Qt::DefaultLocaleShortDate)); + return a._id == -1 ? "" : QString("%1 - %2").arg(Utility::timeAgoInWords(a._dateTime.toLocalTime()), a._dateTime.toLocalTime().toString(Qt::DefaultLocaleShortDate)); case AccountConnectedRole: return (ast && ast->isConnected()); default: @@ -279,6 +282,7 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st if(_totalActivitiesFetched == _maxActivities || a._dateTime < oldestDate) { + _showMoreActivitiesAvailableEntry = true; _doneFetching = true; break; } @@ -410,6 +414,22 @@ void ActivityListModel::combineActivityLists() if (_activityLists.count() > 0) { std::sort(_activityLists.begin(), _activityLists.end()); resultList.append(_activityLists); + + if(_showMoreActivitiesAvailableEntry) { + Activity a; + a._type = Activity::ActivityType; + a._accName = _accountState->account()->displayName(); + a._id = -1; + a._subject = tr("For more activities please open the Activity app."); + a._dateTime = QDateTime::currentDateTime(); + + AccountApp *app = _accountState->findApp(QLatin1String("activity")); + if(app) { + a._link = app->url(); + } + + resultList.append(a); + } } beginResetModel(); @@ -444,6 +464,7 @@ void ActivityListModel::slotRefreshActivity() _doneFetching = false; _currentItem = 0; _totalActivitiesFetched = 0; + _showMoreActivitiesAvailableEntry = false; if (canFetchActivities()) { startFetchJob(); @@ -461,5 +482,6 @@ void ActivityListModel::slotRemoveAccount() _doneFetching = false; _currentItem = 0; _totalActivitiesFetched = 0; + _showMoreActivitiesAvailableEntry = false; } } diff --git a/src/gui/tray/ActivityListModel.h b/src/gui/tray/ActivityListModel.h index 96b0785ee..1c8ae6ee2 100644 --- a/src/gui/tray/ActivityListModel.h +++ b/src/gui/tray/ActivityListModel.h @@ -45,6 +45,7 @@ public: ObjectTypeRole, ActionsLinksRole, ActionTextRole, + ActionTextColorRole, ActionRole, MessageRole, DisplayPathRole, @@ -106,6 +107,7 @@ private: int _totalActivitiesFetched = 0; int _maxActivities = 100; int _maxActivitiesDays = 30; + bool _showMoreActivitiesAvailableEntry = false; }; } diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 9fd16c82f..5a040c970 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -528,6 +528,7 @@ Window { width: 240 + ((path === "") ? activityItem.height : 0) + ((link === "") ? activityItem.height : 0) - 8 elide: Text.ElideRight font.pixelSize: 12 + color: activityTextTitleColor } Text {