Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ include(KDEInstallDirs)
include(KDECMakeSettings)
include(ECMMarkNonGuiExecutable)
include(ECMSetupVersion)
include(ECMQmlModule)

#include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMEnableSanitizers)
Expand Down
11 changes: 0 additions & 11 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<file>src/gui/WindowAccountHeader.qml</file>
<file>src/gui/ActivitiesWindow.qml</file>
<file>src/gui/AssistantWindow.qml</file>
<file>src/gui/search/qml/SearchWindow.qml</file>
<file>src/gui/UserStatusWindowStatusRow.qml</file>
<file>src/gui/UserStatusWindowPredefinedStatusRow.qml</file>
<file>src/gui/UserStatusSelectorPage.qml</file>
Expand Down Expand Up @@ -38,16 +37,6 @@
<file>src/gui/tray/ActivityList.qml</file>
<file>src/gui/tray/CurrentAccountHeaderButton.qml</file>
<file>src/gui/tray/TrayWindowHeader.qml</file>
<file>src/gui/search/qml/UnifiedSearchInputContainer.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultFetchMoreTrigger.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultItem.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultItemSkeleton.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultItemSkeletonContainer.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultItemSkeletonGradientRectangle.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultListItem.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultNothingFound.qml</file>
<file>src/gui/search/qml/UnifiedSearchPlaceholderView.qml</file>
<file>src/gui/search/qml/UnifiedSearchResultSectionItem.qml</file>
<file>src/gui/tray/ActivityItemContextMenu.qml</file>
<file>src/gui/tray/ActivityItemActions.qml</file>
<file>src/gui/tray/ActivityItemContent.qml</file>
Expand Down
9 changes: 5 additions & 4 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,10 @@ set(client_SRCS
tray/activitydata.cpp
tray/activitylistmodel.h
tray/activitylistmodel.cpp
search/unifiedsearchresult.h
tray/asyncimageresponse.cpp
search/unifiedsearchresult.cpp
search/unifiedsearchresultslistmodel.h
tray/trayimageprovider.cpp
tray/trayaccountappsmodel.h
tray/trayaccountappsmodel.cpp
search/unifiedsearchresultslistmodel.cpp
tray/usermodel.h
tray/usermodel.cpp
tray/notificationhandler.h
Expand Down Expand Up @@ -292,6 +288,8 @@ IF(BUILD_UPDATER)
)
endif()

add_subdirectory(search)

IF( APPLE )
list(APPEND client_SRCS cocoainitializer_mac.mm)
list(APPEND client_SRCS systray_mac_common.mm)
Expand Down Expand Up @@ -579,6 +577,9 @@ target_link_libraries(nextcloudCore
Qt::QuickWidgets
KF6::Archive
KDAB::kdsingleapplication

nextcloudGuiSearch
nextcloudGuiSearchplugin
)

if(KF6GuiAddons_FOUND)
Expand Down
31 changes: 31 additions & 0 deletions src/gui/search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-2.0-or-later

add_library(nextcloudGuiSearch STATIC)

target_sources(nextcloudGuiSearch
PRIVATE
unifiedsearchresult.h
unifiedsearchresult.cpp
unifiedsearchresultslistmodel.h
unifiedsearchresultslistmodel.cpp
)

ecm_add_qml_module(nextcloudGuiSearch
URI com.nextcloud.desktopclient.search
GENERATE_PLUGIN_SOURCE
QML_FILES
SearchWindow.qml
UnifiedSearchInputContainer.qml
UnifiedSearchResultFetchMoreTrigger.qml
UnifiedSearchResultItem.qml
UnifiedSearchResultItemSkeleton.qml
UnifiedSearchResultItemSkeletonContainer.qml
UnifiedSearchResultItemSkeletonGradientRectangle.qml
UnifiedSearchResultListItem.qml
UnifiedSearchResultNothingFound.qml
UnifiedSearchPlaceholderView.qml
UnifiedSearchResultSectionItem.qml
)

target_link_libraries(nextcloudGuiSearch PRIVATE nextcloudCore)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import QtQuick.Layouts

import Style
import com.nextcloud.desktopclient
import "../.."
import "qrc:/qml/src/gui"

WizardStyledWindow {
id: root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Qt5Compat.GraphicalEffects
import Style

import com.nextcloud.desktopclient
import "../../tray"
import "qrc:/qml/src/gui/tray"

TextField {
id: root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Style
import "../../tray"
import "qrc:/qml/src/gui/tray"

ColumnLayout {
id: root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Style
import "../../tray"
import "qrc:/qml/src/gui/tray"

ColumnLayout {
id: unifiedSearchResultItemFetchMore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import QtQuick.Layouts
import Qt5Compat.GraphicalEffects

import Style
import "../../tray"
import "qrc:/qml/src/gui/tray"

RowLayout {
id: unifiedSearchResultItemDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Style
import "../../tray"
import "qrc:/qml/src/gui/tray"

ColumnLayout {
id: unifiedSearchResultNothingFoundContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import QtQuick.Controls
import QtQuick.Layouts
import Style
import com.nextcloud.desktopclient
import "../../tray"
import "qrc:/qml/src/gui/tray"

EnforcedPlainTextLabel {
required property string section
Expand Down
4 changes: 3 additions & 1 deletion src/gui/systray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,62 +46,64 @@
#define NOTIFICATIONS_IFACE "org.freedesktop.Notifications"
#endif

using namespace Qt::StringLiterals;

namespace OCC {

Q_LOGGING_CATEGORY(lcSystray, "nextcloud.gui.systray")

namespace {
#if defined(Q_OS_MACOS)
constexpr auto macOSWindowDragHandleHeight = 28;

class QuickWindowDragHandle : public QObject
{
public:
explicit QuickWindowDragHandle(QQuickWindow *window)
: QObject(window)
, _window(window)
{
}

protected:
bool eventFilter(QObject *watched, QEvent *event) override
{
if (!_window || event->type() != QEvent::MouseButtonPress) {
return QObject::eventFilter(watched, event);
}

const auto *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() != Qt::LeftButton) {
return QObject::eventFilter(watched, event);
}

const auto windowPosition = _window->mapFromGlobal(mouseEvent->globalPosition().toPoint());
if (windowPosition.y() < 0 || windowPosition.y() > macOSWindowDragHandleHeight) {
return QObject::eventFilter(watched, event);
}

if (_window->startSystemMove()) {
event->accept();
return true;
}

return QObject::eventFilter(watched, event);
}

private:
QPointer<QQuickWindow> _window;
};

void configureMacOSExpandedQuickWindow(QQuickWindow *window)
{
window->setFlag(Qt::ExpandedClientAreaHint, true);
window->setFlag(Qt::NoTitleBarBackgroundHint, true);

auto *dragHandle = new QuickWindowDragHandle(window);
window->installEventFilter(dragHandle);
}
#endif
}

Check warning on line 106 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this empty namespace.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEaW&open=AZ9lWBI1ZWQS3kSMqEaW&pullRequest=10360

Systray *Systray::_instance = nullptr;

Expand Down Expand Up @@ -197,7 +199,7 @@
showActivitiesWindow();
}

void Systray::showTrayPopup(WindowPosition position)

Check warning on line 202 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "position" of type "enum OCC::Systray::WindowPosition" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEaX&open=AZ9lWBI1ZWQS3kSMqEaX&pullRequest=10360
{
if (isOpen()) {
return;
Expand Down Expand Up @@ -238,7 +240,7 @@
showActivitiesWindow();
}

void Systray::showActivitiesWindow(int userIndex)

Check warning on line 243 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "userIndex" of type "int" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEaY&open=AZ9lWBI1ZWQS3kSMqEaY&pullRequest=10360
{
const auto userModel = UserModel::instance();
if (!userModel) {
Expand Down Expand Up @@ -316,7 +318,7 @@
userModel->fetchActivityModel(targetUserId);
}

void Systray::showAssistantWindow(int userIndex)

Check warning on line 321 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "userIndex" of type "int" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEaZ&open=AZ9lWBI1ZWQS3kSMqEaZ&pullRequest=10360
{
const auto userModel = UserModel::instance();
if (!userModel) {
Expand Down Expand Up @@ -391,7 +393,7 @@
window->requestActivate();
}

void Systray::showSearchWindow(int userIndex)

Check warning on line 396 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "userIndex" of type "int" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEaa&open=AZ9lWBI1ZWQS3kSMqEaa&pullRequest=10360
{
const auto userModel = UserModel::instance();
if (!userModel) {
Expand Down Expand Up @@ -428,7 +430,7 @@
return;
}

QQmlComponent searchWindowComponent(trayEngine(), QStringLiteral("qrc:/qml/src/gui/search/qml/SearchWindow.qml"));
QQmlComponent searchWindowComponent(trayEngine(), "com.nextcloud.desktopclient.search"_L1, "SearchWindow"_L1);

Check warning on line 433 in src/gui/systray.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/systray.cpp:433:19 [cppcoreguidelines-init-variables]

variable 'searchWindowComponent' is not initialized

if (searchWindowComponent.isError()) {
qCWarning(lcSystray) << searchWindowComponent.errorString();
Expand Down Expand Up @@ -500,8 +502,8 @@
}

const auto userModelIndex = userModel->index(userIndex);
if (!userModel->isUserConnected(userIndex)
|| !userModel->data(userModelIndex, UserModel::ServerHasUserStatusRole).toBool()) {

Check warning on line 506 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the init-statement to declare "userModelIndex" inside the if statement.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEab&open=AZ9lWBI1ZWQS3kSMqEab&pullRequest=10360
qCDebug(lcSystray) << "Not opening user status window for disconnected or unsupported account:" << userIndex;
return;
}
Expand Down Expand Up @@ -692,7 +694,7 @@
_editFileLocallyLoadingDialog = nullptr;
}

void Systray::createResolveConflictsDialog(const OCC::ActivityList &allConflicts)

Check warning on line 697 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This function should be declared "const".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEac&open=AZ9lWBI1ZWQS3kSMqEac&pullRequest=10360
{
const auto conflictsDialog = std::make_unique<QQmlComponent>(trayEngine(), QStringLiteral("qrc:/qml/src/gui/ResolveConflictsDialog.qml"));
const QVariantMap initialProperties{
Expand All @@ -712,7 +714,7 @@
}
dialog->setParent(QGuiApplication::instance());

auto dialogWindow = qobject_cast<QQuickWindow*>(dialog.release());

Check warning on line 717 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "dialogWindow" of type "class QQuickWindow *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEad&open=AZ9lWBI1ZWQS3kSMqEad&pullRequest=10360
if (!dialogWindow) {
return;
}
Expand All @@ -721,7 +723,7 @@
dialogWindow->requestActivate();
}

void Systray::createGovernanceLabelsDialog(AccountPtr account, const QString &fileName, const QString &fileId)

Check warning on line 726 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This function should be declared "const".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEae&open=AZ9lWBI1ZWQS3kSMqEae&pullRequest=10360

Check warning on line 726 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "account" of type "class QSharedPointer<class OCC::Account>" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEaf&open=AZ9lWBI1ZWQS3kSMqEaf&pullRequest=10360
{
const auto conflictsDialog = std::make_unique<QQmlComponent>(trayEngine(), QStringLiteral("qrc:/qml/src/gui/GovernanceLabelsDialog.qml"));
const QVariantMap initialProperties{
Expand All @@ -743,7 +745,7 @@
}
dialog->setParent(QGuiApplication::instance());

auto dialogWindow = qobject_cast<QQuickWindow*>(dialog.release());

Check warning on line 748 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "dialogWindow" of type "class QQuickWindow *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEag&open=AZ9lWBI1ZWQS3kSMqEag&pullRequest=10360
if (!dialogWindow) {
return;
}
Expand All @@ -752,7 +754,7 @@
dialogWindow->requestActivate();
}

void Systray::createEncryptionTokenDiscoveryDialog()

Check warning on line 757 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this identifier to be shorter or equal to 31 characters.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEah&open=AZ9lWBI1ZWQS3kSMqEah&pullRequest=10360
{
if (_encryptionTokenDiscoveryDialog) {
return;
Expand All @@ -770,7 +772,7 @@
_encryptionTokenDiscoveryDialog = encryptionTokenDiscoveryDialog->createWithInitialProperties(QVariantMap{});
}

void Systray::destroyEncryptionTokenDiscoveryDialog()

Check warning on line 775 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this identifier to be shorter or equal to 31 characters.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEai&open=AZ9lWBI1ZWQS3kSMqEai&pullRequest=10360
{
if (!_encryptionTokenDiscoveryDialog) {
return;
Expand Down Expand Up @@ -924,7 +926,7 @@
createFileActionsDialogWithAccountState(localPath, folder->accountState());
}

void Systray::createFileActionsDialogWithAccountState(const QString &localPath, AccountState *accountState, const QString &fileId, const QString &remoteItemPath)

Check warning on line 929 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this identifier to be shorter or equal to 31 characters.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEaj&open=AZ9lWBI1ZWQS3kSMqEaj&pullRequest=10360

Check warning on line 929 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "accountState" of type "class OCC::AccountState *" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEal&open=AZ9lWBI1ZWQS3kSMqEal&pullRequest=10360

Check warning on line 929 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This function should be declared "const".

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEak&open=AZ9lWBI1ZWQS3kSMqEak&pullRequest=10360
{
if (!_trayEngine) {
qCWarning(lcSystray) << "Could not open file actions dialog for" << localPath << "as no tray engine was available";
Expand All @@ -944,7 +946,7 @@
return;
}

QFileInfo localFile{localPath};

Check warning on line 949 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unmodified variable "localFile" of type "class QFileInfo" should be const-qualified.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEam&open=AZ9lWBI1ZWQS3kSMqEam&pullRequest=10360
const auto shortLocalPath = localFile.fileName();

const QVariantMap initialProperties{
Expand Down Expand Up @@ -1034,9 +1036,9 @@
const auto ptrList = AccountManager::instance()->accounts();
auto result = QList<AccountState *>();
result.reserve(ptrList.size());
std::transform(std::cbegin(ptrList), std::cend(ptrList), std::back_inserter(result), [](const AccountStatePtr &account) {
return account.data();
});

Check warning on line 1041 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace with the version of "std::ranges::transform" that takes a range.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEan&open=AZ9lWBI1ZWQS3kSMqEan&pullRequest=10360
return result;
}();
const auto folders = FolderMan::instance()->map();
Expand Down Expand Up @@ -1507,7 +1509,7 @@
QPoint Systray::calcTrayIconCenter() const
{
const auto geo = geometry();
if(geo.isValid()) {

Check warning on line 1512 in src/gui/systray.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the init-statement to declare "geo" inside the if statement.

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZ9lWBI1ZWQS3kSMqEao&open=AZ9lWBI1ZWQS3kSMqEao&pullRequest=10360
// QSystemTrayIcon::geometry() is broken for ages on most Linux DEs (invalid geometry returned)
// thus we can use this only for Windows and macOS
return geo.center();
Expand Down
Loading