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

0001 /*
0002     SPDX-FileCopyrightText: 2005 Andreas Nicolai <Andreas.Nicolai@gmx.net>
0003     SPDX-FileCopyrightText: 2007-2008 Thomas Baumgart <tbaumgart@kde.org>
0004     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KPAYEEREASSIGNDLG_H
0009 #define KPAYEEREASSIGNDLG_H
0010 
0011 // ----------------------------------------------------------------------------
0012 // QT Includes
0013 
0014 #include <QDialog>
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 // ----------------------------------------------------------------------------
0020 // Project Includes
0021 
0022 /**
0023  *  Implementation of the dialog that lets the user select a payee in order
0024  *  to re-assign transactions (for instance, if payees are deleted).
0025  */
0026 
0027 class MyMoneyPayee;
0028 
0029 class KPayeeReassignDlgPrivate;
0030 class KPayeeReassignDlg : public QDialog
0031 {
0032     Q_OBJECT
0033     Q_DISABLE_COPY(KPayeeReassignDlg)
0034 
0035 public:
0036     /** Change behavior based on type of operation */
0037     enum OperationType {
0038         TypeMerge = 0,
0039         TypeDelete,
0040         TypeCount,
0041     };
0042 
0043     /** Default constructor */
0044     explicit KPayeeReassignDlg(OperationType type, QWidget* parent = nullptr);
0045 
0046     /** Destructor */
0047     ~KPayeeReassignDlg();
0048 
0049     /**
0050       * This function sets up the dialog, lets the user select a payee and returns
0051       * the id of the selected payee in the payeeslist.
0052       *
0053       * @param payeeslist reference to QList of MyMoneyPayee objects to be contained in the list
0054       *
0055       * @return Returns the id of the selected payee in the list or QString() if
0056       *         the dialog was aborted. QString() is also returned if the payeeslist is empty.
0057       */
0058     QString show(const QList<MyMoneyPayee>& payeeslist);
0059 
0060     /**
0061      * Returns true, if the names of the payees to be deleted should be copied
0062      * to the selected payee's match list.
0063      */
0064     bool addToMatchList() const;
0065 
0066 protected:
0067     void accept() override;
0068 
0069 private:
0070     KPayeeReassignDlgPrivate * const d_ptr;
0071     Q_DECLARE_PRIVATE(KPayeeReassignDlg)
0072 };
0073 
0074 #endif // KPAYEEREASSIGNDLG_H