File indexing completed on 2024-06-16 04:50:40

0001 /*
0002     This file is part of Akonadi
0003 
0004     SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include "akonadiwidgets_export.h"
0012 
0013 // AkonadiCore
0014 #include "akonadi/tag.h"
0015 
0016 #include <QDialog>
0017 
0018 #include <memory>
0019 
0020 class QDialogButtonBox;
0021 namespace Akonadi
0022 {
0023 class TagModel;
0024 class TagSelectionDialogPrivate;
0025 
0026 /**
0027  * A widget that shows a tag selection and provides means to edit that selection.
0028  *
0029  * TODO A standalone dialog version that takes an item and takes care of writing back the changes would be useful.
0030  * @since 4.13
0031  */
0032 class AKONADIWIDGETS_EXPORT TagSelectionDialog : public QDialog
0033 {
0034     Q_OBJECT
0035 public:
0036     explicit TagSelectionDialog(QWidget *parent = nullptr);
0037     TagSelectionDialog(TagModel *model, QWidget *parent = nullptr);
0038     ~TagSelectionDialog() override;
0039 
0040     void setSelection(const Akonadi::Tag::List &tags);
0041     [[nodiscard]] Akonadi::Tag::List selection() const;
0042 
0043     [[nodiscard]] QDialogButtonBox *buttons() const;
0044 
0045 Q_SIGNALS:
0046     void selectionChanged(const Akonadi::Tag::List &tags);
0047 
0048 private:
0049     std::unique_ptr<TagSelectionDialogPrivate> const d;
0050 };
0051 
0052 }