1 /*
2   This file is part of Kontact.
3 
4   SPDX-FileCopyrightText: 2003 Tobias Koenig <tokoe@kde.org>
5   SPDX-FileCopyrightText: 2014-2021 Laurent Montel <montel@kde.org>
6 
7   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
8 */
9 
10 #pragma once
11 
12 #include <Akonadi/Item>
13 
14 #include <KontactInterface/Summary>
15 
16 #include <KViewStateMaintainer>
17 
18 namespace NoteShared
19 {
20 class NotesChangeRecorder;
21 class NotesAkonadiTreeModel;
22 }
23 
24 namespace Akonadi
25 {
26 class ETMViewStateSaver;
27 }
28 
29 namespace KontactInterface
30 {
31 class Plugin;
32 }
33 
34 class KCheckableProxyModel;
35 
36 class QGridLayout;
37 class QItemSelectionModel;
38 class QLabel;
39 
40 class KNotesSummaryWidget : public KontactInterface::Summary
41 {
42     Q_OBJECT
43 public:
44     KNotesSummaryWidget(KontactInterface::Plugin *plugin, QWidget *parent);
45     ~KNotesSummaryWidget() override;
46 
47     void updateSummary(bool force = false) override;
48     QStringList configModules() const override;
49 
50 protected:
51     bool eventFilter(QObject *obj, QEvent *e) override;
52 
53 private Q_SLOTS:
54     void updateFolderList();
55     void slotSelectNote(const QString &note);
56     void slotPopupMenu(const QString &);
57 
58 private:
59     void deleteNote(const QString &note);
60     void displayNotes(const QModelIndex &parent, int &counter);
61     void createNote(const Akonadi::Item &item, int counter);
62     QPixmap mDefaultPixmap;
63     QGridLayout *mLayout = nullptr;
64     KontactInterface::Plugin *mPlugin = nullptr;
65     QList<QLabel *> mLabels;
66     QPixmap mPixmap;
67     NoteShared::NotesChangeRecorder *mNoteRecorder = nullptr;
68     NoteShared::NotesAkonadiTreeModel *mNoteTreeModel = nullptr;
69     QItemSelectionModel *mSelectionModel = nullptr;
70     KCheckableProxyModel *mModelProxy = nullptr;
71     KViewStateMaintainer<Akonadi::ETMViewStateSaver> *mModelState = nullptr;
72     bool mInProgress = false;
73 };
74 
75