Files
qt5-legatus-legacy/Lts/Plugins/NotificationManagement/Gui/NotificationEdit/nom_edit_gui_plugin.h
T
2026-08-13 18:33:10 +02:00

90 lines
3.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Gui Plugin for NotificationManangement
*
* Created by Mike Lennart Wille, ESZS, 2025-06-17
*/
#pragma once
#include <NotificationManagement/logger.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <OperatorManagement/opm_dtc.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/NotificationManagement/nom_data_plugin_interface.h>
#include <Plugins/NotificationManagement/nom_gui_plugin_interface.h>
namespace LtsNotification
{
class LtsNotification;
}
namespace NotificationManagement
{
class GuiPlugin final
: public QObject
, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:nom.edit")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return QLatin1String("NotificationManagementGuiPlugin"); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Global || partition == IDL::PartitionType::Exercise; }
};
class InterfaceImpl final
: public QObject
, public GuiPluginBase::Interface
, protected NotificationManagement::Interface::Ftc::ReadReceiptReplyHandler
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
~InterfaceImpl();
static const QString s_nomEditGuiPlugin;
QVector<LtsWidgets::PluginData> getActions() override;
QString menuGroup() const override { return tr("Notifications"); }
bool fetchInterfaces() override;
void clearInterfaces() override;
bool availableInPartition(IDL::PartitionType partition) const override { return partition == IDL::PartitionType::Global || partition == IDL::PartitionType::Exercise; }
static const QString s_participantInfoScheme;
protected:
void initNotificationSystem();
void onNotificationChanged(const NotificationManagement::NomNotification &noti, DataModification modType);
void onReadReceiptReply(const Core::FunctionReplyObject &replyObject) override final;
private:
int isDeleted(const NomNotification &data) const;
LtsWidgets::LtsDialog *onShowNotificationManagementDialog(QWidget *parent);
void ack(const NotificationManagement::NomNotification &notification);
void updateUnreadCount();
bool parseContent(const QString &contentString, QMap<QString, QString> &retMap);
bool isMyMessage(const std::vector<NotificationManagement::Address> &recipents);
bool eventFilter(QObject *watched, QEvent *event) override;
void showNotificationList(int notificationId);
QSet<int> m_unreadMessages;
LtsNotification::LtsNotification *m_noti;
QHash<int, NomNotification> m_nomNotifications;
LtsUtils::RequestHelper *m_requestHelper;
std::shared_ptr<NotificationManagement::Interface::Dtc> m_dtc;
std::shared_ptr<NotificationManagement::Interface::Ftc> m_ftc;
std::shared_ptr<OperatorManagement::Interface::Dtc> m_dtcOpm;
std::shared_ptr<NotificationManagement::ForeignGuiInterface> m_nomGuiInterface;
};
} // namespace NotificationManagement