File indexing completed on 2025-07-13 04:38:03

0001 /*
0002     SPDX-FileCopyrightText: 2019 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef BUDGETSMODEL_H
0007 #define BUDGETSMODEL_H
0008 
0009 // ----------------------------------------------------------------------------
0010 // QT Includes
0011 
0012 // ----------------------------------------------------------------------------
0013 // KDE Includes
0014 
0015 // ----------------------------------------------------------------------------
0016 // Project Includes
0017 
0018 #include "mymoneymodel.h"
0019 #include "mymoneyenums.h"
0020 #include "kmm_mymoney_export.h"
0021 
0022 #include "mymoneybudget.h"
0023 
0024 class QUndoStack;
0025 /**
0026   */
0027 class KMM_MYMONEY_EXPORT BudgetsModel : public MyMoneyModel<MyMoneyBudget>
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     enum Columns {
0033         Name,
0034         Year,
0035     };
0036 
0037     explicit BudgetsModel(QObject* parent = nullptr, QUndoStack* undoStack = nullptr);
0038     ~BudgetsModel();
0039 
0040     static const int ID_SIZE = 6;
0041 
0042     void setFiscalYearStart(int month, int day);
0043 
0044     int columnCount(const QModelIndex& parent = QModelIndex()) const final override;
0045     QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const final override;
0046     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const final override;
0047 
0048     Qt::ItemFlags flags(const QModelIndex &index) const override;
0049     bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) final override;
0050 
0051 public Q_SLOTS:
0052 
0053 private:
0054     struct Private;
0055     QScopedPointer<Private> d;
0056 };
0057 
0058 #endif // BUDGETSMODEL_H
0059