File indexing completed on 2025-01-05 05:18:57
0001 // SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 // Code based on neochat code 0005 0006 #include "systemtray.h" 0007 #include "windowcontroller.h" 0008 #include <KWindowSystem> 0009 0010 SystemTray::SystemTray(QObject *parent) 0011 : KStatusNotifierItem{parent} 0012 { 0013 setCategory(KStatusNotifierItem::ItemCategory::SystemServices); 0014 // FIXME: Fix icon ! 0015 setIconByName(QStringLiteral("org.kde.alpaka")); 0016 connect(this, &KStatusNotifierItem::activateRequested, this, [this] { 0017 KWindowSystem::setCurrentXdgActivationToken(providedToken()); 0018 Q_EMIT toggleWindow(); 0019 }); 0020 0021 connect(&WindowController::instance(), &WindowController::windowChanged, this, [this] { 0022 setAssociatedWindow(WindowController::instance().window()); 0023 }); 0024 } 0025 0026 SystemTray::~SystemTray() = default; 0027 0028 void SystemTray::show() 0029 { 0030 setStatus(Active); 0031 } 0032 0033 void SystemTray::hide() 0034 { 0035 setStatus(Passive); 0036 } 0037 0038 #include "moc_systemtray.cpp"