File indexing completed on 2024-05-19 05:08:16

0001 /*
0002     SPDX-FileCopyrightText: 2021 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef KENTERSCHEDULEDLG_H
0007 #define KENTERSCHEDULEDLG_H
0008 
0009 // ----------------------------------------------------------------------------
0010 // QT Includes
0011 
0012 #include <QDialog>
0013 class QDate;
0014 
0015 // ----------------------------------------------------------------------------
0016 // KDE Includes
0017 
0018 // ----------------------------------------------------------------------------
0019 // Project Includes
0020 
0021 class MyMoneySchedule;
0022 class MyMoneyAccount;
0023 class MyMoneyTransaction;
0024 
0025 namespace Ui {
0026 class KEnterScheduleDlg;
0027 }
0028 
0029 namespace eDialogs {
0030 enum class ScheduleResultCode;
0031 }
0032 
0033 /**
0034  * @author Thomas Baumgart
0035  */
0036 
0037 class KEnterScheduleDlgPrivate;
0038 class KEnterScheduleDlg : public QDialog
0039 {
0040     Q_OBJECT
0041     Q_DISABLE_COPY(KEnterScheduleDlg)
0042 
0043 public:
0044     explicit KEnterScheduleDlg(QWidget* parent, const MyMoneySchedule& schedule);
0045     ~KEnterScheduleDlg();
0046 
0047     /**
0048      * Returns the transaction that is about to be entered into the journal
0049      */
0050     MyMoneyTransaction transaction();
0051 
0052     /**
0053      * Show (or hide) the extended dialog keys for 'Skip' and 'Ignore'
0054      * depending on the value of the parameter @a visible which defaults
0055      * to @a true.
0056      */
0057     void setShowExtendedKeys(bool visible = true);
0058 
0059     /**
0060      * Return the extended result code. Usage of the returned
0061      * value only makes sense, once the dialog has been executed.
0062      * Before execution it returns @a Cancel.
0063      */
0064     eDialogs::ScheduleResultCode resultCode() const;
0065 
0066 protected:
0067     /**
0068      * This method returns the adjusts @a _date according to
0069      * the setting of the schedule's weekend option.
0070      */
0071     QDate date(const QDate& _date) const;
0072 
0073 public Q_SLOTS:
0074     int exec() override;
0075 
0076 private:
0077     KEnterScheduleDlgPrivate* const d_ptr;
0078     Q_DECLARE_PRIVATE(KEnterScheduleDlg)
0079 };
0080 
0081 #endif