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