File indexing completed on 2024-05-12 05:06:10

0001 /*
0002     SPDX-FileCopyrightText: 2011-2012 Alessandro Russo <axela74@yahoo.it>
0003     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-FileCopyrightText: 2022 Thomas Baumgart <tbaumgart@kde.org>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KTAGREASSIGNDLG_H
0009 #define KTAGREASSIGNDLG_H
0010 
0011 #include "kmm_base_dialogs_export.h"
0012 
0013 // ----------------------------------------------------------------------------
0014 // QT Includes
0015 
0016 #include <QDialog>
0017 
0018 // ----------------------------------------------------------------------------
0019 // KDE Includes
0020 
0021 // ----------------------------------------------------------------------------
0022 // Project Includes
0023 
0024 namespace Ui {
0025 class KTagReassignDlg;
0026 }
0027 
0028 /**
0029  *  Implementation of the dialog that lets the user select a tag in order
0030  *  to re-assign transactions (for instance, if tags are deleted).
0031  */
0032 class QSortFilterProxyModel;
0033 class KMM_BASE_DIALOGS_EXPORT KTagReassignDlg : public QDialog
0034 {
0035     Q_OBJECT
0036     Q_DISABLE_COPY(KTagReassignDlg)
0037 
0038 public:
0039     explicit KTagReassignDlg(QWidget* parent = nullptr);
0040     ~KTagReassignDlg();
0041 
0042     /**
0043      * This function sets up the dialog, lets the user select a tag and returns
0044      * the id of the selected tag in the tagslist.
0045      *
0046      * @param tagslist reference to QList of tag ids that are not available
0047      *                 for re-assignment
0048      *
0049      * @return Returns the id of the selected tag in the list or QString() if
0050      *         the dialog was aborted.
0051      */
0052     void setupFilter(const QList<QString>& tagslist);
0053 
0054     /**
0055      * Returns the id that shall be used as replacement or empty
0056      * if the tag is to be deleted completely from the data.
0057      *
0058      * @returns The id of a tag or empty string when deletion is requested.
0059      */
0060     QString reassignTo() const;
0061 
0062 private:
0063     Ui::KTagReassignDlg *ui;
0064     QSortFilterProxyModel* model;
0065 };
0066 
0067 #endif // KTAGREASSIGNDLG_H