File indexing completed on 2024-05-12 16:42:07

0001 /*
0002     SPDX-FileCopyrightText: 2002-2018 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KFINDTRANSACTIONDLG_H
0008 #define KFINDTRANSACTIONDLG_H
0009 
0010 // ----------------------------------------------------------------------------
0011 // QT Includes
0012 
0013 #include <QDialog>
0014 
0015 // ----------------------------------------------------------------------------
0016 // KDE Includes
0017 
0018 // ----------------------------------------------------------------------------
0019 // Project Includes
0020 
0021 class QTreeWidgetItem;
0022 
0023 namespace Ui {
0024 class KSortOptionDlg;
0025 }
0026 
0027 /**
0028   * @author Thomas Baumgart
0029   */
0030 class KSortOptionDlg : public QDialog
0031 {
0032     Q_OBJECT
0033     Q_DISABLE_COPY(KSortOptionDlg)
0034 
0035 public:
0036     explicit KSortOptionDlg(QWidget *parent = nullptr);
0037     ~KSortOptionDlg();
0038 
0039     void setSortOption(const QString& option, const QString& def);
0040     QString sortOption() const;
0041     void hideDefaultButton();
0042 
0043 private:
0044     Ui::KSortOptionDlg *ui;
0045 };
0046 
0047 class KFindTransactionDlgPrivate;
0048 class KFindTransactionDlg : public QDialog
0049 {
0050     Q_OBJECT
0051     Q_DISABLE_COPY(KFindTransactionDlg)
0052 
0053 public:
0054     /**
0055      @param withEquityAccounts set to false to hide equity accounts in account page
0056     */
0057     explicit KFindTransactionDlg(QWidget *parent = nullptr, bool withEquityAccounts = false);
0058     virtual ~KFindTransactionDlg();
0059 
0060     bool eventFilter(QObject *o, QEvent *e) override;
0061 
0062 protected Q_SLOTS:
0063     virtual void slotReset();
0064     virtual void slotSearch();
0065 
0066     /**
0067       * This slot opens the detailed help page in khelpcenter. The
0068       * anchor for the information is taken from m_helpAnchor.
0069       */
0070     virtual void slotShowHelp();
0071 
0072     void slotRefreshView();
0073 
0074     /**
0075       * This slot selects the current selected transaction/split and emits
0076       * the signal @a transactionSelected(const QString& accountId, const QString& transactionId)
0077       */
0078     void slotSelectTransaction();
0079 
0080     void slotRightSize();
0081 
0082     void slotSortOptions();
0083 
0084 Q_SIGNALS:
0085     void transactionSelected(const QString& accountId, const QString& transactionId);
0086 
0087     /**
0088       * This signal is sent out when a selection has been made. It is
0089       * used to control the state of the Search button.
0090       * The Search button is only active when a selection has been made
0091       * (i.e. notEmpty == true)
0092       */
0093     void selectionNotEmpty(bool);
0094 
0095 protected:
0096     KFindTransactionDlgPrivate * const d_ptr;
0097     KFindTransactionDlg(KFindTransactionDlgPrivate &dd, QWidget *parent, bool withEquityAccounts);
0098 
0099     void resizeEvent(QResizeEvent*) override;
0100     void showEvent(QShowEvent* event) override;
0101 
0102 private:
0103     Q_DECLARE_PRIVATE(KFindTransactionDlg)
0104 };
0105 
0106 #endif