1 /***************************************************************************
2                          knewinvestmentwizard  -  description
3                             -------------------
4    begin                : Sat Dec 4 2004
5    copyright            : (C) 2004 by Thomas Baumgart
6    email                : Thomas Baumgart <ipwizard@users.sourceforge.net>
7                           (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
8 ***************************************************************************/
9 
10 /***************************************************************************
11  *                                                                         *
12  *   This program is free software; you can redistribute it and/or modify  *
13  *   it under the terms of the GNU General Public License as published by  *
14  *   the Free Software Foundation; either version 2 of the License, or     *
15  *   (at your option) any later version.                                   *
16  *                                                                         *
17  ***************************************************************************/
18 
19 #ifndef KNEWINVESTMENTWIZARD_H
20 #define KNEWINVESTMENTWIZARD_H
21 
22 // ----------------------------------------------------------------------------
23 // QT Includes
24 
25 #include <QWizard>
26 
27 // ----------------------------------------------------------------------------
28 // KDE Includes
29 
30 // ----------------------------------------------------------------------------
31 // Project Includes
32 
33 class MyMoneyAccount;
34 class MyMoneySecurity;
35 
36 /**
37   * This class contains the implementation of the new investment wizard.
38   *
39   * @author Thomas Baumgart
40   */
41 
42 class KNewInvestmentWizardPrivate;
43 class KNewInvestmentWizard : public QWizard
44 {
45   Q_OBJECT
46 public:
47   /**
48     * Use this constructor for the creation of a new investment
49     */
50   explicit KNewInvestmentWizard(QWidget *parent = nullptr);
51 
52   /**
53     * Use this constructor for the modification of an existing investment
54     */
55   explicit KNewInvestmentWizard(const MyMoneyAccount& acc, QWidget *parent = nullptr);
56 
57   /**
58     * Use this constructor for the modification of an existing security
59     */
60   explicit KNewInvestmentWizard(const MyMoneySecurity& sec, QWidget *parent = nullptr);
61 
62   ~KNewInvestmentWizard();
63 
64   /**
65    * This method sets the name in the name widget.
66    */
67   void setName(const QString& name);
68 
69   /**
70     * Depending on the constructor used, this method either
71     * creates all necessary objects for the investment or updates
72     * them.
73     *
74     * @param parentId id of parent account for the investment
75     */
76   void createObjects(const QString& parentId);
77 
78   /**
79     * Create a new investment in a given @p parent investment account
80     */
81   static void newInvestment(const MyMoneyAccount& parent);
82   static void newInvestment(MyMoneyAccount& account, const MyMoneyAccount& parent);
83 
84   static void editInvestment(const MyMoneyAccount& parent);
85 
86   MyMoneyAccount account() const;
87 
88 protected Q_SLOTS:
89   void slotCheckForExistingSymbol(const QString&);
90   void slotHelp();
91 
92 private:
93   Q_DISABLE_COPY(KNewInvestmentWizard)
94   Q_DECLARE_PRIVATE(KNewInvestmentWizard)
95   const QScopedPointer<KNewInvestmentWizardPrivate> d_ptr;
96 };
97 
98 #endif
99