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

0001 /*
0002     SPDX-FileCopyrightText: 2019-2021 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef INVESTTRANSACTIONEDITOR_H
0007 #define INVESTTRANSACTIONEDITOR_H
0008 
0009 // ----------------------------------------------------------------------------
0010 // QT Includes
0011 
0012 #include <QObject>
0013 class QWidget;
0014 
0015 // ----------------------------------------------------------------------------
0016 // Project Includes
0017 
0018 #include "tabordereditor.h"
0019 #include "transactioneditorbase.h"
0020 
0021 class MyMoneyMoney;
0022 
0023 class InvestTransactionEditor : public TransactionEditorBase, TabOrderEditorInterface
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit InvestTransactionEditor(QWidget* parent = 0, const QString& accountId = QString());
0029     virtual ~InvestTransactionEditor();
0030 
0031     /**
0032      */
0033     void loadTransaction(const QModelIndex& index) override;
0034     QStringList saveTransaction(const QStringList& selectedJournalEntries) override;
0035 
0036     /**
0037      * Reimplemented to suppress some events in certain conditions
0038      */
0039     bool eventFilter(QObject* o, QEvent* e) override;
0040 
0041     /**
0042      * Returns the transaction amount
0043      */
0044     MyMoneyMoney totalAmount() const;
0045 
0046     // Implement TabOrderEditorInterface methods
0047     void setupUi(QWidget* parent) override;
0048     void storeTabOrder(const QStringList& tabOrder) override;
0049 
0050 protected:
0051     bool isTransactionDataValid() const override;
0052 
0053 public Q_SLOTS:
0054     void slotSettingsChanged() override;
0055 
0056 protected Q_SLOTS:
0057     void activityChanged (int index);
0058 
0059     void updateWidgets();
0060     void updateTotalAmount();
0061 
0062 private:
0063     class Private;
0064     QScopedPointer<Private> const d;
0065 };
0066 
0067 #endif // INVESTTRANSACTIONEDITOR_H
0068