File indexing completed on 2024-05-12 05:06: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 #include "kmm_base_dialogs_export.h"
0012 
0013 // ----------------------------------------------------------------------------
0014 // QT Includes
0015 
0016 #include <QDialog>
0017 
0018 // ----------------------------------------------------------------------------
0019 // KDE Includes
0020 
0021 // ----------------------------------------------------------------------------
0022 // Project Includes
0023 
0024 /**
0025  *  Implementation of the dialog that lets the user select a payee in order
0026  *  to re-assign transactions (for instance, if payees are deleted).
0027  */
0028 
0029 class MyMoneyPayee;
0030 
0031 class KPayeeReassignDlgPrivate;
0032 class KMM_BASE_DIALOGS_EXPORT KPayeeReassignDlg : public QDialog
0033 {
0034     Q_OBJECT
0035     Q_DISABLE_COPY(KPayeeReassignDlg)
0036 
0037 public:
0038     /** Change behavior based on type of operation */
0039     enum OperationType {
0040         TypeMerge = 0,
0041         TypeDelete,
0042         TypeCount,
0043     };
0044 
0045     /** Default constructor */
0046     explicit KPayeeReassignDlg(OperationType type, QWidget* parent = nullptr);
0047 
0048     /** Destructor */
0049     ~KPayeeReassignDlg();
0050 
0051     /**
0052       * This function sets up the dialog, lets the user select a payee and returns
0053       * the id of the selected payee in the payeeslist.
0054       *
0055       * @param payeeslist reference to QList of MyMoneyPayee objects to be contained in the list
0056       *
0057       * @return Returns the id of the selected payee in the list or QString() if
0058       *         the dialog was aborted. QString() is also returned if the payeeslist is empty.
0059       */
0060     QString show(const QList<MyMoneyPayee>& payeeslist);
0061 
0062     /**
0063      * Returns true, if the names of the payees to be deleted should be copied
0064      * to the selected payee's match list.
0065      */
0066     bool addToMatchList() const;
0067 
0068 protected:
0069     void accept() override;
0070 
0071 private:
0072     KPayeeReassignDlgPrivate * const d_ptr;
0073     Q_DECLARE_PRIVATE(KPayeeReassignDlg)
0074 };
0075 
0076 #endif // KPAYEEREASSIGNDLG_H