Remove dependency on KStatusNotifierItem
We had two implementations of the system tray icon for no particularly good reason
This commit is contained in:
committed by
Tobias Fella
parent
73e6a536db
commit
b7688d4373
@@ -28,7 +28,6 @@ Dependencies:
|
|||||||
'frameworks/qqc2-desktop-style': '@latest-kf6'
|
'frameworks/qqc2-desktop-style': '@latest-kf6'
|
||||||
'frameworks/kio': '@latest-kf6'
|
'frameworks/kio': '@latest-kf6'
|
||||||
'frameworks/kwindowsystem': '@latest-kf6'
|
'frameworks/kwindowsystem': '@latest-kf6'
|
||||||
'frameworks/kstatusnotifieritem': '@latest-kf6'
|
|
||||||
- 'on': ['Linux', 'FreeBSD']
|
- 'on': ['Linux', 'FreeBSD']
|
||||||
'require':
|
'require':
|
||||||
'frameworks/kdbusaddons': '@latest-kf6'
|
'frameworks/kdbusaddons': '@latest-kf6'
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ if(ANDROID)
|
|||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
find_package(Qt6 ${QT_MIN_VERSION} COMPONENTS Widgets)
|
find_package(Qt6 ${QT_MIN_VERSION} COMPONENTS Widgets)
|
||||||
find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS QQC2DesktopStyle KIO WindowSystem StatusNotifierItem)
|
find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS QQC2DesktopStyle KIO WindowSystem)
|
||||||
find_package(KF6SyntaxHighlighting ${KF_MIN_VERSION} REQUIRED)
|
find_package(KF6SyntaxHighlighting ${KF_MIN_VERSION} REQUIRED)
|
||||||
set_package_properties(KF6QQC2DesktopStyle PROPERTIES
|
set_package_properties(KF6QQC2DesktopStyle PROPERTIES
|
||||||
TYPE RUNTIME
|
TYPE RUNTIME
|
||||||
|
|||||||
@@ -171,12 +171,7 @@ ecm_add_app_icon(NEOCHAT_ICON ICONS ${CMAKE_SOURCE_DIR}/128-logo.png)
|
|||||||
target_sources(neochat-app PRIVATE ${NEOCHAT_ICON})
|
target_sources(neochat-app PRIVATE ${NEOCHAT_ICON})
|
||||||
|
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
if (NOT WIN32 AND NOT APPLE)
|
target_sources(neochat PRIVATE trayicon.cpp trayicon.h)
|
||||||
target_sources(neochat PRIVATE trayicon_sni.cpp trayicon_sni.h)
|
|
||||||
target_link_libraries(neochat PRIVATE KF6::StatusNotifierItem)
|
|
||||||
else()
|
|
||||||
target_sources(neochat PRIVATE trayicon.cpp trayicon.h)
|
|
||||||
endif()
|
|
||||||
target_link_libraries(neochat PUBLIC KF6::WindowSystem)
|
target_link_libraries(neochat PUBLIC KF6::WindowSystem)
|
||||||
target_compile_definitions(neochat PUBLIC -DHAVE_WINDOWSYSTEM)
|
target_compile_definitions(neochat PUBLIC -DHAVE_WINDOWSYSTEM)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -29,10 +29,8 @@
|
|||||||
#include "proxycontroller.h"
|
#include "proxycontroller.h"
|
||||||
#include "roommanager.h"
|
#include "roommanager.h"
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
#if !defined(Q_OS_ANDROID)
|
||||||
#include "trayicon.h"
|
#include "trayicon.h"
|
||||||
#elif !defined(Q_OS_ANDROID)
|
|
||||||
#include "trayicon_sni.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_KUNIFIEDPUSH
|
#ifdef HAVE_KUNIFIEDPUSH
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
|
||||||
|
|
||||||
#include "trayicon_sni.h"
|
|
||||||
#include <KWindowSystem>
|
|
||||||
|
|
||||||
#include "windowcontroller.h"
|
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
|
||||||
|
|
||||||
TrayIcon::TrayIcon(QObject *parent)
|
|
||||||
: KStatusNotifierItem(parent)
|
|
||||||
{
|
|
||||||
setCategory(KStatusNotifierItem::ItemCategory::Communications);
|
|
||||||
setIconByName(u"org.kde.neochat.tray"_s);
|
|
||||||
|
|
||||||
connect(&WindowController::instance(), &WindowController::windowChanged, this, [this] {
|
|
||||||
setAssociatedWindow(WindowController::instance().window());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrayIcon::show()
|
|
||||||
{
|
|
||||||
setStatus(Active);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrayIcon::hide()
|
|
||||||
{
|
|
||||||
setStatus(Passive);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_trayicon_sni.cpp"
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <KStatusNotifierItem>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class TrayIcon
|
|
||||||
*
|
|
||||||
* A class inheriting KStatusNotifierItem to provide a tray icon.
|
|
||||||
*
|
|
||||||
* @sa KStatusNotifierItem
|
|
||||||
*/
|
|
||||||
class TrayIcon : public KStatusNotifierItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit TrayIcon(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Show the tray icon.
|
|
||||||
*/
|
|
||||||
void show();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Hide the tray icon.
|
|
||||||
*/
|
|
||||||
void hide();
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user