File indexing completed on 2024-06-16 04:46:40
0001 /* 0002 SPDX-FileCopyrightText: 2000-2004 Michael Edwardes <mte@users.sourceforge.net> 0003 SPDX-FileCopyrightText: 2000-2004 Javier Campos Morales <javi_c@users.sourceforge.net> 0004 SPDX-FileCopyrightText: 2000-2004 Felix Rodriguez <frodriguez@users.sourceforge.net> 0005 SPDX-FileCopyrightText: 2000-2004 John C <thetacoturtle@users.sourceforge.net> 0006 SPDX-FileCopyrightText: 2000-2004 Thomas Baumgart <ipwizard@users.sourceforge.net> 0007 SPDX-FileCopyrightText: 2000-2004 Kevin Tambascio <ktambascio@users.sourceforge.net> 0008 SPDX-FileCopyrightText: 2000-2004 Ace Jones <ace.jones@hotpop.com> 0009 SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0010 SPDX-FileCopyrightText: 2021 Dawid Wróbel <me@dawidwrobel.com> 0011 SPDX-License-Identifier: GPL-2.0-or-later 0012 */ 0013 #ifndef KREPORTSVIEW_H 0014 #define KREPORTSVIEW_H 0015 0016 #include <config-kmymoney.h> 0017 0018 // ---------------------------------------------------------------------------- 0019 // QT Includes 0020 0021 // ---------------------------------------------------------------------------- 0022 // KDE Includes 0023 0024 // ---------------------------------------------------------------------------- 0025 // Project Includes 0026 0027 #include "kmymoneyviewbase.h" 0028 0029 #ifdef _CHECK_MEMORY 0030 #include "mymoneyutils.h" 0031 #endif 0032 0033 #include "mymoneyreport.h" 0034 0035 namespace reports { 0036 class KReportChartView; 0037 } 0038 namespace reports { 0039 class ReportTable; 0040 } 0041 0042 class QTreeWidget; 0043 class QTreeWidgetItem; 0044 class QListWidget; 0045 class TocItemGroup; 0046 class ReportControl; 0047 class ReportGroup; 0048 class SelectedObjects; 0049 0050 class KMMTextBrowser; 0051 0052 /** 0053 * Displays a page where reports can be placed. 0054 * 0055 * @author Ace Jones 0056 * 0057 * @short A view for reports. 0058 **/ 0059 class KReportsViewPrivate; 0060 class KReportsView : public KMyMoneyViewBase 0061 { 0062 Q_OBJECT 0063 0064 typedef enum { 0065 NoConfigureOption, 0066 LoadReportOnCancel, 0067 } ConfigureOption; 0068 0069 public: 0070 typedef enum { 0071 OpenImmediately, 0072 OpenAfterConfiguration, 0073 } OpenOption; 0074 0075 /** 0076 * Standard constructor. 0077 * 0078 * @param parent The QWidget this is used in. 0079 * @param name The QT name. 0080 * 0081 * @return An object of type KReportsView 0082 * 0083 * @see ~KReportsView 0084 */ 0085 explicit KReportsView(QWidget *parent = nullptr); 0086 ~KReportsView() override; 0087 0088 void executeCustomAction(eView::Action action) override; 0089 void executeAction(eMenu::Action action, const SelectedObjects& selections) override; 0090 0091 void refresh(); 0092 0093 bool hasClosableView() const override; 0094 void closeCurrentView() override; 0095 0096 Q_SIGNALS: 0097 /** 0098 * This signal is emitted whenever a report is selected 0099 */ 0100 void reportSelected(const MyMoneyReport&); 0101 0102 /** 0103 * This signal is emitted whenever a transaction is selected 0104 */ 0105 void transactionSelected(const QString&, const QString&); 0106 0107 void switchViewRequested(View view); 0108 0109 protected: 0110 /** 0111 * Overridden so we can reload the view if necessary. 0112 * 0113 * @return Nothing. 0114 */ 0115 void showEvent(QShowEvent * event) override; 0116 0117 /** 0118 * Overridden so we can handle closing the search filter on ESC 0119 */ 0120 bool eventFilter(QObject* watched, QEvent* event) override; 0121 0122 public Q_SLOTS: 0123 void slotOpenUrl(const QUrl &url); 0124 0125 void slotPrintView(); 0126 void slotPrintPreviewView(); 0127 void slotExportView(); 0128 void slotConfigure(); 0129 void slotDuplicate(); 0130 void slotToggleChart(); 0131 void slotItemDoubleClicked(QTreeWidgetItem* item, int column); 0132 void slotOpenReport(const QString&); 0133 void slotOpenReport(const MyMoneyReport&); 0134 void slotCloseCurrent(); 0135 void slotClose(int index); 0136 void slotCloseAll(); 0137 void slotDelete(); 0138 void slotListContextMenu(const QPoint &); 0139 void slotOpenFromList(); 0140 void slotPrintFromList(); 0141 void slotConfigureFromList(); 0142 void slotNewFromList(); 0143 void slotDeleteFromList(); 0144 0145 void updateActions(const SelectedObjects& selections) override; 0146 0147 private: 0148 Q_DECLARE_PRIVATE(KReportsView) 0149 0150 /** 0151 * internal handling of slotItemDoubleClicked 0152 */ 0153 void doItemDoubleClicked(QTreeWidgetItem* item, int column, OpenOption openOption); 0154 0155 void doConfigure(ConfigureOption configureOption); 0156 0157 private Q_SLOTS: 0158 /** 0159 * This slot creates a transaction report for the selected account 0160 * and opens it in the reports view. 0161 */ 0162 void slotReportAccountTransactions(); 0163 }; 0164 0165 #endif