File indexing completed on 2024-05-12 05:12:47

0001 /*
0002     SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QWidget>
0010 #include <akonadi/private/protocol_p.h>
0011 
0012 class QModelIndex;
0013 class NotificationModel;
0014 class NotificationFilterModel;
0015 class QTreeView;
0016 class QStandardItem;
0017 class QStandardItemModel;
0018 class QSplitter;
0019 namespace KPIM
0020 {
0021 class KCheckComboBox;
0022 }
0023 
0024 class NotificationMonitor : public QWidget
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit NotificationMonitor(QWidget *parent);
0029     ~NotificationMonitor() override;
0030 
0031 private Q_SLOTS:
0032     void contextMenu(const QPoint &pos);
0033 
0034 private:
0035     void onNotificationSelected(const QModelIndex &index);
0036 
0037     void populateItemNtfTree(QStandardItemModel *model, const Akonadi::Protocol::ItemChangeNotification &ntf);
0038     void populateCollectionNtfTree(QStandardItemModel *mddel, const Akonadi::Protocol::CollectionChangeNotification &ntf);
0039     void populateTagNtfTree(QStandardItemModel *model, const Akonadi::Protocol::TagChangeNotification &ntf);
0040     void populateRelationNtfTree(QStandardItemModel *model, const Akonadi::Protocol::RelationChangeNotification &ntf);
0041     void populateSubscriptionNtfTree(QStandardItemModel *model, const Akonadi::Protocol::SubscriptionChangeNotification &ntf);
0042 
0043     void populateItemTree(QStandardItem *parent, const Akonadi::Protocol::FetchItemsResponse &item);
0044     void populateCollectionTree(QStandardItem *parent, const Akonadi::Protocol::FetchCollectionsResponse &collection);
0045     void populateTagTree(QStandardItem *parent, const Akonadi::Protocol::FetchTagsResponse &tag);
0046     void populateAttributesTree(QStandardItem *parent, const Akonadi::Protocol::Attributes &attributes);
0047     QStandardItem *populateAncestorTree(QStandardItem *parent, const Akonadi::Protocol::Ancestor &ancestor);
0048 
0049     void populateNtfModel(const QModelIndex &index);
0050     void saveToFile();
0051 
0052     NotificationModel *m_model = nullptr;
0053     QSplitter *m_splitter = nullptr;
0054     QTreeView *m_treeView = nullptr;
0055     QTreeView *m_ntfView = nullptr;
0056     KPIM::KCheckComboBox *mTypeFilterCombo = nullptr;
0057     NotificationFilterModel *m_filterModel = nullptr;
0058 };