File indexing completed on 2024-12-29 04:46:19
0001 /* 0002 SPDX-FileCopyrightText: 2009 KDAB 0003 SPDX-FileContributor: Frank Osterfeld <frank@kdab.net> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0006 */ 0007 0008 #pragma once 0009 0010 #include "calendarsupport_export.h" 0011 0012 #include <QObject> 0013 0014 #include <Akonadi/Collection> 0015 0016 #include <memory> 0017 0018 class QItemSelection; 0019 class QItemSelectionModel; 0020 0021 namespace CalendarSupport 0022 { 0023 class CollectionSelectionPrivate; 0024 0025 class CALENDARSUPPORT_EXPORT CollectionSelection : public QObject 0026 { 0027 Q_OBJECT 0028 public: 0029 explicit CollectionSelection(QItemSelectionModel *selectionModel, QObject *parent = nullptr); 0030 ~CollectionSelection() override; 0031 0032 QItemSelectionModel *model() const; 0033 [[nodiscard]] Akonadi::Collection::List selectedCollections() const; 0034 [[nodiscard]] QList<Akonadi::Collection::Id> selectedCollectionIds() const; 0035 bool contains(const Akonadi::Collection &c) const; 0036 bool contains(Akonadi::Collection::Id id) const; 0037 0038 [[nodiscard]] bool hasSelection() const; 0039 0040 Q_SIGNALS: 0041 void selectionChanged(const Akonadi::Collection::List &selected, const Akonadi::Collection::List &deselected); 0042 void collectionDeselected(const Akonadi::Collection &); 0043 void collectionSelected(const Akonadi::Collection &); 0044 0045 private: 0046 CALENDARSUPPORT_NO_EXPORT void slotSelectionChanged(const QItemSelection &, const QItemSelection &); 0047 0048 std::unique_ptr<CollectionSelectionPrivate> const d; 0049 }; 0050 }