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

0001 /*
0002     SPDX-FileCopyrightText: 2007-2012 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 KENTERSCHEDULEDLG_H
0008 #define KENTERSCHEDULEDLG_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 Ui {
0027 class KEnterScheduleDlg;
0028 }
0029 
0030 namespace eDialogs {
0031 enum class ScheduleResultCode;
0032 }
0033 
0034 /**
0035   * @author Thomas Baumgart
0036   */
0037 
0038 class KEnterScheduleDlgPrivate;
0039 class KEnterScheduleDlg : public QDialog
0040 {
0041     Q_OBJECT
0042     Q_DISABLE_COPY(KEnterScheduleDlg)
0043 
0044 public:
0045     explicit KEnterScheduleDlg(QWidget *parent, const MyMoneySchedule& schedule);
0046     ~KEnterScheduleDlg();
0047 
0048     TransactionEditor* startEdit();
0049     MyMoneyTransaction transaction();
0050 
0051     /**
0052      * Show (or hide) the extended dialog keys for 'Skip' and 'Ignore'
0053      * depending on the value of the parameter @a visible which defaults
0054      * to @a true.
0055      */
0056     void showExtendedKeys(bool visible = true);
0057 
0058     /**
0059      * Return the extended result code. Usage of the returned
0060      * value only makes sense, once the dialog has been executed.
0061      * Before execution it returns @a Cancel.
0062      */
0063     eDialogs::ScheduleResultCode resultCode() const;
0064 
0065 protected:
0066     /// Overridden for internal reasons. No API changes.
0067     bool focusNextPrevChild(bool next) override;
0068 
0069     /**
0070       * This method returns the adjusts @a _date according to
0071       * the setting of the schedule's weekend option.
0072       */
0073     QDate date(const QDate& _date) const;
0074 
0075     void resizeEvent(QResizeEvent* ev) override;
0076 
0077 public Q_SLOTS:
0078     int exec() override;
0079 
0080 private Q_SLOTS:
0081     void slotSetupSize();
0082     void slotShowHelp();
0083     void slotIgnore();
0084     void slotSkip();
0085 
0086 private:
0087     KEnterScheduleDlgPrivate * const d_ptr;
0088     Q_DECLARE_PRIVATE(KEnterScheduleDlg)
0089 };
0090 
0091 #endif