File indexing completed on 2024-12-15 04:51:47

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "noteshared_export.h"
0009 #include <Akonadi/Item>
0010 #include <QListWidget>
0011 
0012 namespace NoteShared
0013 {
0014 class NOTESHARED_EXPORT NoteListWidget : public QListWidget
0015 {
0016     Q_OBJECT
0017 public:
0018     explicit NoteListWidget(QWidget *parent = nullptr);
0019     ~NoteListWidget() override;
0020 
0021     void setNotes(const Akonadi::Item::List &notes);
0022     void addNotes(const Akonadi::Item::List &notes);
0023     void removeNote(const Akonadi::Item &note);
0024 
0025     [[nodiscard]] Akonadi::Item::Id itemId(QListWidgetItem *item) const;
0026 
0027     [[nodiscard]] Akonadi::Item::Id currentItemId() const;
0028 
0029     [[nodiscard]] Akonadi::Item::List selectedNotes() const;
0030 
0031 private:
0032     void createItem(const Akonadi::Item &note);
0033     enum listViewData { AkonadiId = Qt::UserRole + 1 };
0034 
0035 private:
0036     Akonadi::Item::List mNotes;
0037 };
0038 }