File indexing completed on 2024-05-19 16:16:43
0001 /* 0002 SPDX-FileCopyrightText: 2015 Thomas Baumgart <tbaumgart@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef NEWTRANSACTIONEDITOR_H 0007 #define NEWTRANSACTIONEDITOR_H 0008 0009 // ---------------------------------------------------------------------------- 0010 // QT Includes 0011 0012 #include <QFrame> 0013 class QWidget; 0014 0015 // ---------------------------------------------------------------------------- 0016 // Project Includes 0017 0018 #include "mymoneymoney.h" 0019 0020 class NewTransactionEditor : public QFrame 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 explicit NewTransactionEditor(QWidget* parent = 0, const QString& accountId = QString()); 0026 virtual ~NewTransactionEditor(); 0027 0028 /** 0029 * This method returns true if the user pressed the enter button. 0030 * It remains false, in case the user pressed the cancel button. 0031 */ 0032 virtual bool accepted() const; 0033 0034 /** 0035 * Returns the currently entered amount 0036 */ 0037 MyMoneyMoney transactionAmount() const; 0038 0039 /** 0040 */ 0041 void loadTransaction(const QString& id); 0042 void saveTransaction(); 0043 0044 /** 0045 * Reimplemented to suppress some events in certain conditions 0046 */ 0047 bool eventFilter(QObject* o, QEvent* e) override; 0048 0049 protected: 0050 virtual void keyPressEvent(QKeyEvent* e) override; 0051 0052 protected Q_SLOTS: 0053 virtual void reject(); 0054 virtual void acceptEdit(); 0055 0056 virtual void editSplits(); 0057 0058 virtual void numberChanged(const QString& newNumber); 0059 virtual void categoryChanged(const QString& accountId); 0060 virtual void costCenterChanged(int costCenterIndex); 0061 virtual void postdateChanged(const QDate& date); 0062 0063 void valueChanged(); 0064 0065 Q_SIGNALS: 0066 void done(); 0067 void transactionChanged(const QString&); 0068 0069 private: 0070 class Private; 0071 QScopedPointer<Private> const d; 0072 static QDate m_lastPostDateUsed; 0073 }; 0074 0075 #endif // NEWTRANSACTIONEDITOR_H 0076