File indexing completed on 2024-05-12 16:43:43

0001 /*
0002     SPDX-FileCopyrightText: 2000-2002 Michael Edwardes <mte@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2005 Thomas Baumgart <ipwizard@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2000-2002 Javier Campos Morales <javi_c@users.sourceforge.net>
0005     SPDX-FileCopyrightText: 2000-2002 Felix Rodriguez <frodriguez@users.sourceforge.net>
0006     SPDX-FileCopyrightText: 2000-2002 John C <thetacoturtle@users.sourceforge.net>
0007     SPDX-FileCopyrightText: 2000-2002 Kevin Tambascio <ktambascio@users.sourceforge.net>
0008     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 
0012 #ifndef KCATEGORIESVIEW_H
0013 #define KCATEGORIESVIEW_H
0014 
0015 // ----------------------------------------------------------------------------
0016 // QT Includes
0017 
0018 // ----------------------------------------------------------------------------
0019 // KDE Includes
0020 
0021 // ----------------------------------------------------------------------------
0022 // Project Includes
0023 
0024 #include "kmymoneyaccountsviewbase.h"
0025 
0026 class MyMoneyMoney;
0027 class MyMoneyAccount;
0028 
0029 /**
0030   * @brief  This class contains the implementation of the categories view.
0031   * @author Michael Edwardes, Thomas Baumgart
0032   *
0033   * While named "categories view", this view actually displays all accounts
0034   * that are children of the global "Income" and "Expense" accounts. Even though
0035   * categories are internally just accounts as well, the distinction between
0036   * categories and accounts in the user interface is done for better
0037   * usability and clarity.
0038   *
0039   * The main functionality in the categories view is actually implemented
0040   * in the KMyMoneyAccountTreeView. Signals from user actions are connect to
0041   * other signals/slots in KCategoriesView and relayed to KMyMoneyView.
0042   * A typical example is the selectObject() signal that eventually results
0043   * in enabling/disabling the user actions for the categories view.
0044   *
0045   * For the categories view three user actions are important (all created in
0046   * kmymoney.cpp): category_new, category_edit and category_delete. They are
0047   * accessible from either the main menu or the context menu.
0048   */
0049 class KCategoriesViewPrivate;
0050 class KCategoriesView : public KMyMoneyAccountsViewBase
0051 {
0052     Q_OBJECT
0053 
0054 public:
0055     explicit KCategoriesView(QWidget *parent = nullptr);
0056     ~KCategoriesView();
0057 
0058     void executeCustomAction(eView::Action action) override;
0059     void refresh();
0060     void updateActions(const MyMoneyObject& obj);
0061 
0062 public Q_SLOTS:
0063     void slotProfitChanged(const MyMoneyMoney &);
0064     void slotShowCategoriesMenu(const MyMoneyAccount& acc);
0065 
0066     void slotSelectByObject(const MyMoneyObject& obj, eView::Intent intent) override;
0067     void slotSelectByVariant(const QVariantList& variant, eView::Intent intent) override;
0068 
0069 protected:
0070     void showEvent(QShowEvent * event) override;
0071 
0072 protected Q_SLOTS:
0073     void slotUnusedIncomeExpenseAccountHidden();
0074 
0075 private:
0076     Q_DECLARE_PRIVATE(KCategoriesView)
0077 
0078 private Q_SLOTS:
0079     void slotNewCategory();
0080     void slotEditCategory();
0081     void slotDeleteCategory();
0082 };
0083 
0084 #endif