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

0001 /*
0002     SPDX-FileCopyrightText: 2016 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef NEWSPLITEDITOR_H
0007 #define NEWSPLITEDITOR_H
0008 
0009 // ----------------------------------------------------------------------------
0010 // QT Includes
0011 
0012 #include <QFrame>
0013 #include <QScopedPointer>
0014 class QWidget;
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 // ----------------------------------------------------------------------------
0020 // Project Includes
0021 
0022 #include "mymoneymoney.h"
0023 
0024 class NewSplitEditor : public QFrame
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     /**
0030      * @a accountId is the current account displayed for the transaction
0031      */
0032     explicit NewSplitEditor(QWidget* parent, const QString& accountId = QString());
0033     virtual ~NewSplitEditor();
0034 
0035     /**
0036      * This method returns true if the user pressed the enter button.
0037      * It remains false, in case the user pressed the cancel button.
0038      */
0039     virtual bool accepted() const;
0040 
0041     void setShowValuesInverted(bool inverse);
0042     bool showValuesInverted();
0043 
0044 protected:
0045     void keyPressEvent(QKeyEvent* e) final override;
0046 
0047 public Q_SLOTS:
0048     /**
0049      * This method returns the transaction split id passed
0050      * to setSplitId().
0051      */
0052     QString splitId() const;
0053 
0054     /**
0055      * Returns the id of the selected account in the category widget
0056      */
0057     QString accountId() const;
0058     void setAccountId(const QString& id);
0059 
0060     /**
0061      * Returns the contents of the memo widget
0062      */
0063     QString memo() const;
0064     void setMemo(const QString& memo);
0065 
0066     MyMoneyMoney amount() const;
0067     void setAmount(MyMoneyMoney value);
0068 
0069     QString costCenterId() const;
0070     void setCostCenterId(const QString& id);
0071 
0072     QString number() const;
0073     void setNumber(const QString& id);
0074 
0075 protected Q_SLOTS:
0076     virtual void reject();
0077     virtual void acceptEdit();
0078 
0079 
0080     virtual void numberChanged(const QString& newNumber);
0081     virtual void categoryChanged(const QString& accountId);
0082     virtual void costCenterChanged(int costCenterIndex);
0083     virtual void amountChanged();
0084 
0085 Q_SIGNALS:
0086     void done();
0087     void transactionChanged(const QString&);
0088 
0089 private:
0090     struct Private;
0091     QScopedPointer<Private> d;
0092 };
0093 
0094 #endif // NEWSPLITEDITOR_H
0095