File indexing completed on 2024-05-12 05:06:06

0001 /*
0002     SPDX-FileCopyrightText: 2020 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef AMOUNTEDITCURRENCYHELPER_H
0007 #define AMOUNTEDITCURRENCYHELPER_H
0008 
0009 #include "kmm_base_dialogs_export.h"
0010 
0011 // ----------------------------------------------------------------------------
0012 // QT Includes
0013 
0014 #include <QObject>
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 // ----------------------------------------------------------------------------
0020 // Project Includes
0021 
0022 class KMyMoneyAccountCombo;
0023 class MultiCurrencyEdit;
0024 class MyMoneySecurity;
0025 class AmountEditCurrencyHelperPrivate;
0026 
0027 #ifdef Q_OS_WIN
0028 #undef KMM_WIDGETS_EXPORT
0029 #define KMM_WIDGETS_EXPORT
0030 #endif
0031 
0032 /**
0033  * @author Thomas Baumgart
0034  */
0035 class KMM_BASE_DIALOGS_EXPORT AmountEditCurrencyHelper : public QObject
0036 {
0037     Q_OBJECT
0038     Q_DISABLE_COPY(AmountEditCurrencyHelper)
0039 
0040 public:
0041     /**
0042      * Creates a AmountEditCurrencyHelper object
0043      *
0044      * @param category pointer to KMyMoneyAccountCombo object
0045      * @param amount pointer to AmountEdit object
0046      */
0047     explicit AmountEditCurrencyHelper(KMyMoneyAccountCombo* category, MultiCurrencyEdit* amount, const QString& commodityId);
0048 
0049     ~AmountEditCurrencyHelper();
0050 
0051     void setCommodity(const QString& commodityId);
0052 
0053 public Q_SLOTS:
0054     void categoryChanged(const QString& id);
0055 
0056 Q_SIGNALS:
0057     /**
0058      * This signal is emitted when the @a commodity to be
0059      * used for the shares has changed.
0060      */
0061     void commodityChanged(const MyMoneySecurity& commodity);
0062 
0063 private:
0064     AmountEditCurrencyHelperPrivate * const d_ptr;
0065     Q_DECLARE_PRIVATE(AmountEditCurrencyHelper)
0066 };
0067 
0068 #endif