File indexing completed on 2024-05-12 16:43:57

0001 /*
0002     SPDX-FileCopyrightText: 2002-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 DATERANGEDLG_H
0008 #define DATERANGEDLG_H
0009 
0010 #include "kmm_widgets_export.h"
0011 
0012 // ----------------------------------------------------------------------------
0013 // QT Includes
0014 
0015 #include <QWidget>
0016 
0017 // ----------------------------------------------------------------------------
0018 // KDE Includes
0019 
0020 // ----------------------------------------------------------------------------
0021 // Project Includes
0022 
0023 namespace eMyMoney {
0024 namespace TransactionFilter {
0025 enum class Date;
0026 }
0027 }
0028 
0029 class DateRangeDlgPrivate;
0030 class KMM_WIDGETS_EXPORT DateRangeDlg : public QWidget
0031 {
0032     Q_OBJECT
0033     Q_DISABLE_COPY(DateRangeDlg)
0034 
0035 public:
0036     explicit DateRangeDlg(QWidget* parent = nullptr);
0037     ~DateRangeDlg();
0038 
0039     /*!
0040      * Setup a sliding date range which is relative to the
0041      * current date (sliding date range)
0042      */
0043     void setDateRange(eMyMoney::TransactionFilter::Date);
0044 
0045     /*!
0046      * Setup a fixed user selected date range (does not slide)
0047      */
0048     void setDateRange(const QDate& from, const QDate& to);
0049 
0050     /*!
0051      * Return the currently selected date range option
0052      */
0053     eMyMoney::TransactionFilter::Date dateRange() const;
0054 
0055     QDate fromDate() const;
0056     QDate toDate() const;
0057 
0058 public Q_SLOTS:
0059     void slotReset();
0060     void slotDateRangeSelectedByUser();
0061     void slotDateChanged();
0062 
0063 Q_SIGNALS:
0064     /*!
0065      * The rangeChanged() signal is emitted whenever a range
0066      * is changed (user interaction or call to setDateRange() )
0067      */
0068     void rangeChanged();
0069 
0070 private:
0071     DateRangeDlgPrivate * const d_ptr;
0072     Q_DECLARE_PRIVATE(DateRangeDlg)
0073 };
0074 
0075 #endif