1 /***************************************************************************
2                           kreportsview.h  -  description
3                              -------------------
4     begin                : Sat Mar 27 2004
5     copyright            : (C) 2000-2004 by Michael Edwardes
6     email                : mte@users.sourceforge.net
7                            Javier Campos Morales <javi_c@users.sourceforge.net>
8                            Felix Rodriguez <frodriguez@users.sourceforge.net>
9                            John C <thetacoturtle@users.sourceforge.net>
10                            Thomas Baumgart <ipwizard@users.sourceforge.net>
11                            Kevin Tambascio <ktambascio@users.sourceforge.net>
12                            Ace Jones <ace.jones@hotpop.com>
13                            (C) 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
14  ***************************************************************************/
15 
16 /***************************************************************************
17  *                                                                         *
18  *   This program is free software; you can redistribute it and/or modify  *
19  *   it under the terms of the GNU General Public License as published by  *
20  *   the Free Software Foundation; either version 2 of the License, or     *
21  *   (at your option) any later version.                                   *
22  *                                                                         *
23  ***************************************************************************/
24 #ifndef KREPORTSVIEW_H
25 #define KREPORTSVIEW_H
26 
27 #include <config-kmymoney.h>
28 
29 // ----------------------------------------------------------------------------
30 // QT Includes
31 
32 // ----------------------------------------------------------------------------
33 // KDE Includes
34 
35 // ----------------------------------------------------------------------------
36 // Project Includes
37 
38 #include "kmymoneyviewbase.h"
39 
40 #ifdef _CHECK_MEMORY
41 #include "mymoneyutils.h"
42 #endif
43 
44 #include "mymoneyreport.h"
45 
46 namespace reports { class KReportChartView; }
47 namespace reports { class ReportTable; }
48 
49 class QTreeWidget;
50 class QTreeWidgetItem;
51 class QListWidget;
52 class MyQWebEnginePage;
53 class TocItemGroup;
54 class ReportControl;
55 class ReportGroup;
56 
57 #ifdef ENABLE_WEBENGINE
58 class QWebEngineView;
59 #else
60 class KWebView;
61 #endif
62 
63 /**
64   * Displays a page where reports can be placed.
65   *
66   * @author Ace Jones
67   *
68   * @short A view for reports.
69 **/
70 class KReportsViewPrivate;
71 class KReportsView : public KMyMoneyViewBase
72 {
73   Q_OBJECT
74 
75 public:
76   /**
77     * Standard constructor.
78     *
79     * @param parent The QWidget this is used in.
80     * @param name The QT name.
81     *
82     * @return An object of type KReportsView
83     *
84     * @see ~KReportsView
85     */
86   explicit KReportsView(QWidget *parent = nullptr);
87   ~KReportsView() override;
88 
89   void executeCustomAction(eView::Action action) override;
90   void refresh();
91   void updateActions(const MyMoneyObject &obj);
92 
93 Q_SIGNALS:
94   /**
95     * This signal is emitted whenever a report is selected
96     */
97   void reportSelected(const MyMoneyReport&);
98 
99   /**
100     * This signal is emitted whenever a transaction is selected
101     */
102   void transactionSelected(const QString&, const QString&);
103 
104   void switchViewRequested(View view);
105 
106 protected:
107   /**
108     * Overridden so we can reload the view if necessary.
109     *
110     * @return Nothing.
111     */
112   void showEvent(QShowEvent * event) override;
113 
114 public Q_SLOTS:
115   void slotOpenUrl(const QUrl &url);
116 
117   void slotPrintView();
118   void slotCopyView();
119   void slotSaveView();
120   void slotConfigure();
121   void slotDuplicate();
122   void slotToggleChart();
123   void slotItemDoubleClicked(QTreeWidgetItem* item, int);
124   void slotOpenReport(const QString&);
125   void slotOpenReport(const MyMoneyReport&);
126   void slotCloseCurrent();
127   void slotClose(int index);
128   void slotCloseAll();
129   void slotDelete();
130   void slotListContextMenu(const QPoint &);
131   void slotOpenFromList();
132   void slotPrintFromList();
133   void slotConfigureFromList();
134   void slotNewFromList();
135   void slotDeleteFromList();
136 
137   void slotSelectByObject(const MyMoneyObject& obj, eView::Intent intent) override;
138 
139 private:
140   Q_DECLARE_PRIVATE(KReportsView)
141 
142 private Q_SLOTS:
143   /**
144     * This slot creates a transaction report for the selected account
145     * and opens it in the reports view.
146     */
147   void slotReportAccountTransactions();
148 };
149 
150 #endif
151