File indexing completed on 2025-01-05 04:58:21

0001 /*
0002   SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Collection>
0010 #include <QModelIndex>
0011 #include <QWidget>
0012 
0013 namespace PimCommon
0014 {
0015 class CheckedCollectionWidget;
0016 class SelectMultiCollectionWidget : public QWidget
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit SelectMultiCollectionWidget(const QString &mimetype, const QList<Akonadi::Collection::Id> &selectedCollection, QWidget *parent = nullptr);
0021     explicit SelectMultiCollectionWidget(const QString &mimetype, QWidget *parent = nullptr);
0022     ~SelectMultiCollectionWidget() override;
0023 
0024     [[nodiscard]] QList<Akonadi::Collection> selectedCollection(const QModelIndex &parent = QModelIndex()) const;
0025 
0026 private:
0027     void slotCollectionsTreeFetched();
0028     void initialize(const QString &mimetype);
0029     void updateStatus(const QModelIndex &parent);
0030     PimCommon::CheckedCollectionWidget *mCheckedCollectionWidget = nullptr;
0031     QList<Akonadi::Collection::Id> mListCollection;
0032 };
0033 }