File indexing completed on 2024-05-19 05:14:36

0001 /*
0002     SPDX-FileCopyrightText: 2014 Jonathan Marten <jjm@keelhaul.me.uk>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Tag>
0010 #include <QWidget>
0011 
0012 #include <memory>
0013 
0014 class CategorySelectWidgetPrivate;
0015 
0016 /**
0017  * @short A widget to specify a category (tag) filter.
0018  *
0019  * @since 4.14
0020  * @author Jonathan Marten
0021  **/
0022 
0023 class CategorySelectWidget : public QWidget
0024 {
0025     Q_OBJECT
0026     Q_DECLARE_PRIVATE(CategorySelectWidget)
0027 
0028 public:
0029     /**
0030      * Constructor.
0031      *
0032      * @param parent The parent widget
0033      **/
0034     explicit CategorySelectWidget(QWidget *parent = nullptr);
0035 
0036     /**
0037      * Destructor.
0038      **/
0039     ~CategorySelectWidget() override;
0040 
0041     /**
0042      * Special @c Akonadi::Tag::Id values for filtering.
0043      **/
0044     enum FilterTag {
0045         FilterAll = -2, /**< All items */
0046         FilterUntagged = -3, /**< Untagged items */
0047         FilterGroups = -4 /**< Contact groups */
0048     };
0049 
0050     /**
0051      * Get the current tag filter list.
0052      *
0053      * @return The filter list, as would be sent by @c filterChanged()
0054      *
0055      * @see filterChanged
0056      **/
0057     QList<Akonadi::Tag> filterTags() const;
0058 
0059 Q_SIGNALS:
0060     /**
0061      * The tag filter selection has changed.
0062      *
0063      * @param idList A list of @c Akonadi::Tag::Id's of the tags which
0064      * are to be included in the filter.
0065      *
0066      * @see CategorySelectModel::filterChanged
0067      **/
0068     void filterChanged(const QList<Akonadi::Tag> &tagList);
0069 
0070 private:
0071     std::unique_ptr<CategorySelectWidgetPrivate> const d_ptr;
0072 };