File indexing completed on 2024-05-12 16:44:08

0001 /*
0002     SPDX-FileCopyrightText: 2006-2018 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef STDTRANSACTION_H
0008 #define STDTRANSACTION_H
0009 
0010 // ----------------------------------------------------------------------------
0011 // QT Includes
0012 
0013 // ----------------------------------------------------------------------------
0014 // KDE Includes
0015 
0016 // ----------------------------------------------------------------------------
0017 // Project Includes
0018 
0019 #include "transaction.h"
0020 
0021 namespace KMyMoneyRegister
0022 {
0023 class StdTransactionPrivate;
0024 class StdTransaction : public Transaction
0025 {
0026     Q_DISABLE_COPY(StdTransaction)
0027 
0028 public:
0029     explicit StdTransaction(Register* getParent, const MyMoneyTransaction& transaction, const MyMoneySplit& split, int uniqueId);
0030     ~StdTransaction() override;
0031 
0032     virtual const char* className() override;
0033 
0034     bool formCellText(QString& txt, Qt::Alignment& align, int row, int col, QPainter* painter = 0) override;
0035     void registerCellText(QString& txt, Qt::Alignment& align, int row, int col, QPainter* painter = 0) override;
0036 
0037     int registerColWidth(int col, const QFontMetrics& cellFontMetrics) override;
0038     void setupForm(KMyMoneyTransactionForm::TransactionForm* form) override;
0039     void loadTab(KMyMoneyTransactionForm::TransactionForm* form) override;
0040 
0041     int numColsForm() const override;
0042 
0043     void arrangeWidgetsInForm(QMap<QString, QWidget*>& editWidgets) override;
0044     void arrangeWidgetsInRegister(QMap<QString, QWidget*>& editWidgets) override;
0045     void tabOrderInForm(QWidgetList& tabOrderWidgets) const override;
0046     void tabOrderInRegister(QWidgetList& tabOrderWidgets) const override;
0047     eWidgets::eRegister::Action actionType() const override;
0048 
0049     int numRowsRegister(bool expanded) const override;
0050 
0051     /**
0052     * Provided for internal reasons. No API change. See RegisterItem::numRowsRegister()
0053     */
0054     int numRowsRegister() const override;
0055 
0056     TransactionEditor* createEditor(TransactionEditorContainer* regForm, const KMyMoneyRegister::SelectedTransactions& list, const QDate& lastPostDate) override;
0057 
0058     /**
0059     * Return information if @a row should be shown (@a true )
0060     * or hidden (@a false ) in the form. Default is true.
0061     */
0062     virtual bool showRowInForm(int row) const override;
0063 
0064     /**
0065     * Control visibility of @a row in the transaction form.
0066     * Only row 0 has an effect, others return @a true.
0067     */
0068     virtual void setShowRowInForm(int row, bool show) override;
0069 
0070 protected:
0071     Q_DECLARE_PRIVATE(StdTransaction)
0072     void setupFormHeader(const QString& id);
0073 };
0074 } // namespace
0075 
0076 #endif