File indexing completed on 2024-05-12 05:08:04

0001 /*
0002     SPDX-FileCopyrightText: 2004 Thomas Baumgart <ipwizard@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KNEWINVESTMENTWIZARD_H
0008 #define KNEWINVESTMENTWIZARD_H
0009 
0010 // ----------------------------------------------------------------------------
0011 // QT Includes
0012 
0013 #include <QWizard>
0014 
0015 // ----------------------------------------------------------------------------
0016 // KDE Includes
0017 
0018 // ----------------------------------------------------------------------------
0019 // Project Includes
0020 
0021 class MyMoneyAccount;
0022 class MyMoneySecurity;
0023 
0024 /**
0025   * This class contains the implementation of the new investment wizard.
0026   *
0027   * @author Thomas Baumgart
0028   */
0029 
0030 class KNewInvestmentWizardPrivate;
0031 class KNewInvestmentWizard : public QWizard
0032 {
0033     Q_OBJECT
0034 public:
0035     /**
0036       * Use this constructor for the creation of a new investment
0037       */
0038     explicit KNewInvestmentWizard(QWidget *parent = nullptr);
0039 
0040     /**
0041       * Use this constructor for the modification of an existing investment
0042       */
0043     explicit KNewInvestmentWizard(const MyMoneyAccount& acc, QWidget *parent = nullptr);
0044 
0045     /**
0046       * Use this constructor for the modification of an existing security
0047       */
0048     explicit KNewInvestmentWizard(const MyMoneySecurity& sec, QWidget *parent = nullptr);
0049 
0050     ~KNewInvestmentWizard();
0051 
0052     /**
0053      * This method sets the name in the name widget.
0054      */
0055     void setName(const QString& name);
0056 
0057     /**
0058       * Depending on the constructor used, this method either
0059       * creates all necessary objects for the investment or updates
0060       * them.
0061       *
0062       * @param parentId id of parent account for the investment
0063       */
0064     void createObjects(const QString& parentId);
0065 
0066     /**
0067       * Create a new investment in a given @p parent investment account
0068       */
0069     static void newInvestment(const MyMoneyAccount& parent);
0070     static void newInvestment(MyMoneyAccount& account, const MyMoneyAccount& parent);
0071 
0072     static void editInvestment(const MyMoneyAccount& parent);
0073 
0074     MyMoneyAccount account() const;
0075 
0076 protected Q_SLOTS:
0077     void slotCheckForExistingSymbol(const QString&);
0078     void slotHelp();
0079 
0080 private:
0081     Q_DISABLE_COPY(KNewInvestmentWizard)
0082     Q_DECLARE_PRIVATE(KNewInvestmentWizard)
0083     const QScopedPointer<KNewInvestmentWizardPrivate> d_ptr;
0084 };
0085 
0086 #endif