File indexing completed on 2024-05-19 05:08:21

0001 /*
0002     SPDX-FileCopyrightText: 2012 Alessandro Russo <axela74@yahoo.it>
0003     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-FileCopyrightText: 2020 Thomas Baugart <tbaumgart@kde.org>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KTAGSVIEW_H
0009 #define KTAGSVIEW_H
0010 
0011 // ----------------------------------------------------------------------------
0012 // QT Includes
0013 
0014 class QItemSelection;
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 class KPageWidgetItem;
0020 
0021 // ----------------------------------------------------------------------------
0022 // Project Includes
0023 
0024 #include "kmymoneyviewbase.h"
0025 
0026 class MyMoneyTag;
0027 class SelectedObjects;
0028 
0029 template <typename T> class QList;
0030 
0031 /**
0032   * @author Alessandro Russo
0033   */
0034 
0035 class KTagsViewPrivate;
0036 class KTagsView : public KMyMoneyViewBase
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041     explicit KTagsView(QWidget *parent = nullptr);
0042     ~KTagsView() override;
0043 
0044 public Q_SLOTS:
0045     void slotSelectTag(const QString& tagId);
0046     void slotHelp();
0047     void slotSettingsChanged() override;
0048 
0049     void updateActions(const SelectedObjects& selections) override;
0050 
0051 protected:
0052     void showEvent(QShowEvent* event) override;
0053     void aboutToShow() override;
0054     void aboutToHide() override;
0055 
0056 protected Q_SLOTS:
0057     /**
0058      * This slot is called whenever the selection in m_tagsList has been changed.
0059      */
0060     void slotTagSelectionChanged (const QItemSelection& selected, const QItemSelection& deselected);
0061 
0062     /**
0063      * This slot is called whenever the selection in the ledger has been changed.
0064      */
0065     void slotTransactionSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
0066 
0067     /**
0068       * This slot marks the current selected tag as modified (dirty).
0069       */
0070     void slotTagDataChanged();
0071 
0072     /**
0073       * This slot is called when the name of a tag is changed inside
0074       * the tag list view and only a single tag is selected.
0075       */
0076     void slotRenameSingleTag(const QModelIndex& idx, const QVariant& value);
0077 
0078     /**
0079       * Updates the tag data in m_tag from the information in the
0080       * tag information widget.
0081       */
0082     void slotUpdateTag();
0083 
0084 private:
0085     Q_DISABLE_COPY(KTagsView)
0086     Q_DECLARE_PRIVATE(KTagsView)
0087 
0088 private Q_SLOTS:
0089     void slotNewTag();
0090     void slotRenameTag();
0091     void slotDeleteTag();
0092 
0093     void slotModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
0094 };
0095 
0096 #endif