diff --git a/src/gui/nmcgui/nmcsortedactivitylistmodel.cpp b/src/gui/nmcgui/nmcsortedactivitylistmodel.cpp new file mode 100644 index 0000000000000..4ba4420d01316 --- /dev/null +++ b/src/gui/nmcgui/nmcsortedactivitylistmodel.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "nmcsortedactivitylistmodel.h" + + +namespace OCC { + +NMCSortedActivityListModel::NMCSortedActivityListModel(QObject *parent) + : SortedActivityListModel(parent) +{ + sort(0, Qt::DescendingOrder); +} + +bool NMCSortedActivityListModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const +{ + Q_UNUSED(sourceParent) + return sourceRow < _maxEntries ? true : false; +} +} diff --git a/src/gui/nmcgui/nmcsortedactivitylistmodel.h b/src/gui/nmcgui/nmcsortedactivitylistmodel.h new file mode 100644 index 0000000000000..80a5a61605c0e --- /dev/null +++ b/src/gui/nmcgui/nmcsortedactivitylistmodel.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#pragma once + +#include "tray/sortedactivitylistmodel.h" + +namespace OCC { + +class NMCSortedActivityListModel : public SortedActivityListModel +{ + Q_OBJECT + +public: + explicit NMCSortedActivityListModel(QObject *parent = nullptr); + ~NMCSortedActivityListModel() = default; + +protected: + bool filterAcceptsRow(int sourceRow,const QModelIndex &sourceParent) const override; + +private: + int _maxEntries = 30; + +}; + +} diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index c14b5125a0861..ea230b3a51ea4 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -40,6 +40,7 @@ #include "tray/sortedactivitylistmodel.h" #include "tray/syncstatussummary.h" #include "tray/unifiedsearchresultslistmodel.h" +#include "nmcgui/nmcsortedactivitylistmodel.h" #ifdef WITH_LIBCLOUDPROVIDERS #include "cloudproviders/cloudprovidermanager.h" @@ -121,6 +122,7 @@ ownCloudGui::ownCloudGui(Application *parent) qmlRegisterType("com.nextcloud.desktopclient", 1, 0, "ActivityListModel"); qmlRegisterType("com.nextcloud.desktopclient", 1, 0, "FileActivityListModel"); qmlRegisterType("com.nextcloud.desktopclient", 1, 0, "SortedActivityListModel"); + qmlRegisterType("com.nextcloud.desktopclient", 1, 0, "NMCSortedActivityListModel"); qmlRegisterType("com.nextcloud.desktopclient", 1, 0, "WheelHandler"); qmlRegisterType("com.nextcloud.desktopclient", 1, 0, "CallStateChecker"); qmlRegisterType("com.nextcloud.desktopclient", 1, 0, "DateFieldBackend"); diff --git a/src/gui/tray/ActivityList.qml b/src/gui/tray/ActivityList.qml index 939fc0a28392f..d70aaea14f39d 100644 --- a/src/gui/tray/ActivityList.qml +++ b/src/gui/tray/ActivityList.qml @@ -77,7 +77,7 @@ ScrollView { preferredHighlightBegin: 0 preferredHighlightEnd: controlRoot.height - model: NC.SortedActivityListModel { + model: NC.NMCSortedActivityListModel { id: sortedActivityList }