File indexing completed on 2024-06-02 05:26:04

0001 /*
0002   This file is part of Kontact.
0003 
0004   SPDX-FileCopyrightText: 2003 Tobias Koenig <tokoe@kde.org>
0005   SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
0006 
0007   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0008 */
0009 
0010 #pragma once
0011 
0012 #include <Akonadi/Item>
0013 
0014 #include <KontactInterface/Summary>
0015 
0016 #include <KViewStateMaintainer>
0017 
0018 namespace NoteShared
0019 {
0020 class NotesChangeRecorder;
0021 class NotesAkonadiTreeModel;
0022 }
0023 
0024 namespace Akonadi
0025 {
0026 class ETMViewStateSaver;
0027 }
0028 
0029 namespace KontactInterface
0030 {
0031 class Plugin;
0032 }
0033 
0034 class KCheckableProxyModel;
0035 
0036 class QGridLayout;
0037 class QItemSelectionModel;
0038 class QLabel;
0039 
0040 class KNotesSummaryWidget : public KontactInterface::Summary
0041 {
0042     Q_OBJECT
0043 public:
0044     KNotesSummaryWidget(KontactInterface::Plugin *plugin, QWidget *parent);
0045     ~KNotesSummaryWidget() override;
0046 
0047     void updateSummary(bool force = false) override;
0048     QStringList configModules() const override;
0049 
0050 protected:
0051     bool eventFilter(QObject *obj, QEvent *e) override;
0052 
0053 private Q_SLOTS:
0054     void updateFolderList();
0055     void slotSelectNote(const QString &note);
0056     void slotPopupMenu(const QString &);
0057 
0058 private:
0059     void deleteNote(const QString &note);
0060     void displayNotes(const QModelIndex &parent, int &counter);
0061     void createNote(const Akonadi::Item &item, int counter);
0062     QGridLayout *mLayout = nullptr;
0063     KontactInterface::Plugin *mPlugin = nullptr;
0064     QList<QLabel *> mLabels;
0065     NoteShared::NotesChangeRecorder *mNoteRecorder = nullptr;
0066     NoteShared::NotesAkonadiTreeModel *mNoteTreeModel = nullptr;
0067     QItemSelectionModel *mSelectionModel = nullptr;
0068     KCheckableProxyModel *mModelProxy = nullptr;
0069     KViewStateMaintainer<Akonadi::ETMViewStateSaver> *mModelState = nullptr;
0070     bool mInProgress = false;
0071 };