diff --git a/knotify/CMakeLists.txt b/knotify/CMakeLists.txt index cc3a37a7..7146430a 100644 --- a/knotify/CMakeLists.txt +++ b/knotify/CMakeLists.txt @@ -1,6 +1,7 @@ project(knotify) add_subdirectory(sounds) +add_subdirectory(kcm) install( FILES kde.notifyrc diff --git a/knotify/kcm/CMakeLists.txt b/knotify/kcm/CMakeLists.txt new file mode 100644 index 00000000..c379262a --- /dev/null +++ b/knotify/kcm/CMakeLists.txt @@ -0,0 +1,22 @@ +########### next target ############### + +set(knotificationconfig_SRCS + knotificationconfig.cpp +) + +kde4_add_plugin(kcm_knotificationconfig ${knotificationconfig_SRCS}) + +target_link_libraries(kcm_knotificationconfig + KDE4::kdeui + KDE4::kcmutils +) + +install( + TARGETS kcm_knotificationconfig + DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} +) + +install( + FILES kcm_knotificationconfig.desktop + DESTINATION ${KDE4_SERVICES_INSTALL_DIR} +) diff --git a/knotify/kcm/kcm_knotificationconfig.desktop b/knotify/kcm/kcm_knotificationconfig.desktop new file mode 100644 index 00000000..4b028613 --- /dev/null +++ b/knotify/kcm/kcm_knotificationconfig.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Exec=kcmshell4 knotificationconfig +Icon=preferences-desktop-notification +Type=Service + +X-KDE-ServiceTypes=KCModule +X-KDE-Library=kcm_knotificationconfig +X-KDE-ParentApp=kcontrol +X-KDE-System-Settings-Parent-Category=application-and-system-notifications +X-KDE-System-Settings-Parent-Category-V2=application-and-system-notifications +X-KDE-Weight=50 +X-DocPath=kcontrol/knotificationconfig/index.html +Categories=Qt;KDE;X-KDE-settings-sound; + +Name=Notifications Configuration +Comment=System Notification Configuration +X-KDE-Keywords=System sounds,Audio,Sound,Notify,Alerts,Notification,popups diff --git a/knotify/kcm/knotificationconfig.cpp b/knotify/kcm/knotificationconfig.cpp new file mode 100644 index 00000000..3781a1d5 --- /dev/null +++ b/knotify/kcm/knotificationconfig.cpp @@ -0,0 +1,85 @@ +/* This file is part of the KDE project + Copyright (C) 2023 Ivailo Monev + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2, as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "knotificationconfig.h" + +#include +#include +#include +#include +#include + +K_PLUGIN_FACTORY(KCMNotificationFactory, registerPlugin();) +K_EXPORT_PLUGIN(KCMNotificationFactory("kcmknotificationconfig", "kcm_knotificationconfig")) + +KCMNotification::KCMNotification(QWidget *parent, const QVariantList &args) + : KCModule(KCMNotificationFactory::componentData(), parent), + m_layout(nullptr), + m_notificationslabel(nullptr), + m_notificationsbox(nullptr), + m_notificationswidget(nullptr) +{ + Q_UNUSED(args); + + setButtons(KCModule::Default | KCModule::Apply); + setQuickHelp(i18n("

Notifications Configuration

This module allows you to change KDE notification options.")); + + KAboutData *about = new KAboutData( + I18N_NOOP("kcmkgreeter"), 0, + ki18n("KDE Notifications Configuration Module"), + 0, KLocalizedString(), KAboutData::License_GPL, + ki18n("Copyright 2023, Ivailo Monev xakepa10@gmail.com") + ); + about->addAuthor(ki18n("Ivailo Monev"), KLocalizedString(), "xakepa10@gmail.com"); + setAboutData(about); + + m_layout = new QGridLayout(this); + setLayout(m_layout); + + m_notificationslabel = new QLabel(this); + m_notificationslabel->setText(i18n("Event source:")); + m_layout->addWidget(m_notificationslabel, 0, 0); + m_notificationsbox = new KComboBox(this); + m_layout->addWidget(m_notificationsbox, 0, 1); + + m_notificationswidget = new KNotificationConfigWidget(QString(), this); +} + +KCMNotification::~KCMNotification() +{ +} + +void KCMNotification::load() +{ + // TODO: + emit changed(false); +} + +void KCMNotification::save() +{ + // TODO: + emit changed(false); +} + +void KCMNotification::defaults() +{ + // TODO: + emit changed(true); +} + +#include "moc_knotificationconfig.cpp" diff --git a/knotify/kcm/knotificationconfig.h b/knotify/kcm/knotificationconfig.h new file mode 100644 index 00000000..93732bc0 --- /dev/null +++ b/knotify/kcm/knotificationconfig.h @@ -0,0 +1,53 @@ +/* This file is part of the KDE project + Copyright (C) 2023 Ivailo Monev + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2, as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KNOTIFICATIONCONFIG_H +#define KNOTIFICATIONCONFIG_H + +#include +#include +#include +#include +#include + +/** + * Control KDE free space notifier + * + * @author Ivailo Monev (xakepa10@gmail.com) + */ +class KCMNotification : public KCModule +{ + Q_OBJECT +public: + KCMNotification(QWidget *parent, const QVariantList &args); + ~KCMNotification(); + + // KCModule reimplementations +public Q_SLOTS: + void load() final; + void save() final; + void defaults() final; + +private: + QGridLayout* m_layout; + QLabel* m_notificationslabel; + KComboBox* m_notificationsbox; + KNotificationConfigWidget* m_notificationswidget; +}; + +#endif // KNOTIFICATIONCONFIG_H