Skip to content

Commit

Permalink
Merge #279 [stable-3.13] Nmc/2244-Activity list changes in main view
Browse files Browse the repository at this point in the history
  • Loading branch information
memurats committed Aug 16, 2024
2 parents a4c44fb + d1ad529 commit 15b61dc
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/gui/nmcgui/nmcsortedactivitylistmodel.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
}
37 changes: 37 additions & 0 deletions src/gui/nmcgui/nmcsortedactivitylistmodel.h
Original file line number Diff line number Diff line change
@@ -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;

};

}
2 changes: 2 additions & 0 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -121,6 +122,7 @@ ownCloudGui::ownCloudGui(Application *parent)
qmlRegisterType<ActivityListModel>("com.nextcloud.desktopclient", 1, 0, "ActivityListModel");
qmlRegisterType<FileActivityListModel>("com.nextcloud.desktopclient", 1, 0, "FileActivityListModel");
qmlRegisterType<SortedActivityListModel>("com.nextcloud.desktopclient", 1, 0, "SortedActivityListModel");
qmlRegisterType<NMCSortedActivityListModel>("com.nextcloud.desktopclient", 1, 0, "NMCSortedActivityListModel");
qmlRegisterType<WheelHandler>("com.nextcloud.desktopclient", 1, 0, "WheelHandler");
qmlRegisterType<CallStateChecker>("com.nextcloud.desktopclient", 1, 0, "CallStateChecker");
qmlRegisterType<Quick::DateFieldBackend>("com.nextcloud.desktopclient", 1, 0, "DateFieldBackend");
Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/ActivityList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ScrollView {
preferredHighlightBegin: 0
preferredHighlightEnd: controlRoot.height

model: NC.SortedActivityListModel {
model: NC.NMCSortedActivityListModel {
id: sortedActivityList
}

Expand Down

0 comments on commit 15b61dc

Please sign in to comment.