File indexing completed on 2024-05-12 16:42:05
0001 /* 0002 SPDX-FileCopyrightText: 2007-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 KEDITSCHEDULEDLG_H 0008 #define KEDITSCHEDULEDLG_H 0009 0010 // ---------------------------------------------------------------------------- 0011 // QT Includes 0012 0013 #include <QDialog> 0014 0015 // ---------------------------------------------------------------------------- 0016 // KDE Includes 0017 0018 // ---------------------------------------------------------------------------- 0019 // Project Includes 0020 0021 class MyMoneySchedule; 0022 class MyMoneyAccount; 0023 class MyMoneyTransaction; 0024 class TransactionEditor; 0025 0026 namespace eMyMoney { 0027 namespace Schedule { 0028 enum class Occurrence; 0029 } 0030 } 0031 0032 /** 0033 * @author Thomas Baumgart 0034 */ 0035 0036 class KEditScheduleDlgPrivate; 0037 class KEditScheduleDlg : public QDialog 0038 { 0039 Q_OBJECT 0040 Q_DISABLE_COPY(KEditScheduleDlg) 0041 0042 public: 0043 explicit KEditScheduleDlg(const MyMoneySchedule& schedule, QWidget *parent = nullptr); 0044 ~KEditScheduleDlg(); 0045 0046 TransactionEditor* startEdit(); 0047 0048 /** 0049 * Returns the edited schedule. 0050 * 0051 * @return MyMoneySchedule The schedule details. 0052 **/ 0053 const MyMoneySchedule& schedule(); 0054 0055 static void newSchedule(const MyMoneyTransaction& _t, eMyMoney::Schedule::Occurrence occurrence); 0056 static void editSchedule(const MyMoneySchedule& inputSchedule); 0057 0058 protected: 0059 /** 0060 * This method adjusts @a _date according to the rules specified by 0061 * the schedule's weekend option. 0062 */ 0063 QDate adjustDate(const QDate& _date) const; 0064 0065 /// Overridden for internal reasons. No API changes. 0066 bool focusNextPrevChild(bool next) override; 0067 0068 /// Overridden for internal reasons. No API changes. 0069 void resizeEvent(QResizeEvent* ev) override; 0070 0071 private Q_SLOTS: 0072 void slotSetupSize(); 0073 void slotRemainingChanged(int); 0074 void slotEndDateChanged(const QDate& date); 0075 void slotPostDateChanged(const QDate& date); 0076 void slotFrequencyChanged(int item); 0077 void slotShowHelp(); 0078 void slotOccurrenceMultiplierChanged(int mult); 0079 void slotFilterPaymentType(int index); 0080 0081 /// Overridden for internal reasons. No API changes. 0082 void accept() override; 0083 0084 private: 0085 KEditScheduleDlgPrivate * const d_ptr; 0086 Q_DECLARE_PRIVATE(KEditScheduleDlg) 0087 }; 0088 0089 #endif