Skip to content

Commit

Permalink
activity list changes
Browse files Browse the repository at this point in the history
  • Loading branch information
memurats committed Aug 12, 2024
1 parent 66c355a commit 6947f0b
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,6 @@ convert.exe
*-w10startmenu.png
*state-*.png
theme.qrc

# Ignore specific folders
shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)

set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

set(NMC_RCC_FILE "nmctheme_v1.rcc")
configure_file(${CMAKE_SOURCE_DIR}/${NMC_RCC_FILE} "${BIN_OUTPUT_DIRECTORY}/${NMC_RCC_FILE}" COPYONLY)

include(${CMAKE_SOURCE_DIR}/NEXTCLOUD.cmake)

# CfAPI Shell Extensions
Expand Down Expand Up @@ -303,6 +306,7 @@ configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
configure_file(sync-exclude.lst bin/${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
install(FILES nmctheme_v1.rcc DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
elseif(BUILD_CLIENT)
install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
Expand Down
Binary file added nmctheme_v1.rcc
Binary file not shown.
8 changes: 8 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 QuickW
find_package(KF5Archive REQUIRED)
find_package(KF5GuiAddons)

#NMC change, its needed to find the ui file in a different location than the header file
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui")

if(QUICK_COMPILER)
find_package(Qt5QuickCompiler)
set_package_properties(Qt5QuickCompiler PROPERTIES
Expand Down Expand Up @@ -261,6 +264,10 @@ set(client_SRCS
wizard/linklabel.cpp
)

file(GLOB NMC_FILES "nmcgui/*")
set(NMC_SRCS ${NMC_FILES})
list(APPEND client_SRCS ${NMC_SRCS})

if (Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
list(APPEND client_SRCS
wizard/webviewpage.h
Expand Down Expand Up @@ -623,6 +630,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES ${VISUAL_ELEMENTS} DESTINATION bin/visualelements)
install(FILES "${theme_dir}/${APPLICATION_EXECUTABLE}.VisualElementsManifest.xml" DESTINATION bin)
install(FILES ${client_I18N} DESTINATION i18n)
install(FILES ${CMAKE_SOURCE_DIR}/nmctheme_v1.rcc DESTINATION bin)
endif()

# we may not add MACOSX_BUNDLE here, if not building one
Expand Down
12 changes: 12 additions & 0 deletions src/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ int main(int argc, char **argv)
#ifdef Q_OS_WIN
SetDllDirectory(L"");
#endif

bool resourceLoaded = false;
const QString currentPath = QDir::currentPath();
if(Utility::isMac())
{
resourceLoaded = QResource::registerResource(QDir::toNativeSeparators("/Applications/MagentaCLOUD.app/Contents/Resources/nmctheme_v1.rcc"));
}
else if(Utility::isWindows() || !resourceLoaded)
{
resourceLoaded = QResource::registerResource(QDir::toNativeSeparators(currentPath + "/nmctheme_v1.rcc"));
}

Q_INIT_RESOURCE(resources);
Q_INIT_RESOURCE(theme);

Expand Down
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 6947f0b

Please sign in to comment.