knotify: stub KCM

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-25 08:48:04 +03:00
parent 47b083fbf2
commit c36ca89159
5 changed files with 178 additions and 0 deletions

View file

@ -1,6 +1,7 @@
project(knotify) project(knotify)
add_subdirectory(sounds) add_subdirectory(sounds)
add_subdirectory(kcm)
install( install(
FILES kde.notifyrc FILES kde.notifyrc

View file

@ -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}
)

View file

@ -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

View file

@ -0,0 +1,85 @@
/* This file is part of the KDE project
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
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 <kdebug.h>
#include <klocale.h>
#include <kaboutdata.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>
K_PLUGIN_FACTORY(KCMNotificationFactory, registerPlugin<KCMNotification>();)
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("<h1>Notifications Configuration</h1> 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 <email>xakepa10@gmail.com</email>")
);
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"

View file

@ -0,0 +1,53 @@
/* This file is part of the KDE project
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
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 <QGridLayout>
#include <QLabel>
#include <kcmodule.h>
#include <kcombobox.h>
#include <knotificationconfigwidget.h>
/**
* 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