File indexing completed on 2024-04-28 08:31:14

0001 /*
0002     SPDX-FileCopyrightText: 2009 Peter Penz <peter.penz@gmx.at>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef KEDIT_TAGS_DIALOG_H
0008 #define KEDIT_TAGS_DIALOG_H
0009 
0010 #include <QDialog>
0011 #include <QHash>
0012 
0013 class QLineEdit;
0014 class KJob;
0015 class QTreeWidget;
0016 class QTreeWidgetItem;
0017 class QPushButton;
0018 class QTimer;
0019 
0020 /**
0021  * @brief Dialog to edit a list of Baloo tags.
0022  *
0023  * It is possible for the user to add existing tags,
0024  * create new tags or to remove tags.
0025  *
0026  * @see KMetaDataConfigurationDialog
0027  */
0028 class KEditTagsDialog : public QDialog
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     explicit KEditTagsDialog(const QStringList &tags, QWidget *parent = nullptr);
0034 
0035     ~KEditTagsDialog() override;
0036 
0037     QStringList tags() const;
0038 
0039 private Q_SLOTS:
0040     void slotTextEdited(const QString &text);
0041     void slotAcceptedButtonClicked();
0042 
0043     void slotItemActivated(const QTreeWidgetItem *item, int column);
0044 
0045 private:
0046     void loadTagWidget();
0047     void modifyTagWidget(const QString &tag);
0048 
0049 private:
0050     QHash<QString, QTreeWidgetItem *> m_allTagTreeItems;
0051     QStringList m_tags;
0052     QStringList m_allTags;
0053     QString m_newTag;
0054 
0055     QTreeWidget *m_tagTree = nullptr;
0056     QLineEdit *m_newTagEdit = nullptr;
0057 };
0058 
0059 #endif