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

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 class WidgetHintFrameCollection;
0024 
0025 namespace eMyMoney {
0026 namespace TransactionFilter {
0027 enum class Date;
0028 }
0029 }
0030 
0031 class DateRangeDlgPrivate;
0032 class KMM_WIDGETS_EXPORT DateRangeDlg : public QWidget
0033 {
0034     Q_OBJECT
0035     Q_DISABLE_COPY(DateRangeDlg)
0036 
0037 public:
0038     explicit DateRangeDlg(QWidget* parent = nullptr);
0039     ~DateRangeDlg();
0040 
0041     /*!
0042      * Setup a sliding date range which is relative to the
0043      * current date (sliding date range)
0044      */
0045     void setDateRange(eMyMoney::TransactionFilter::Date);
0046 
0047     /*!
0048      * Setup a fixed user selected date range (does not slide)
0049      */
0050     void setDateRange(const QDate& from, const QDate& to);
0051 
0052     /*!
0053      * Return the currently selected date range option
0054      */
0055     eMyMoney::TransactionFilter::Date dateRange() const;
0056 
0057     QDate fromDate() const;
0058     QDate toDate() const;
0059 
0060     WidgetHintFrameCollection* widgetHintFrameCollection() const;
0061 
0062 public Q_SLOTS:
0063     void slotReset();
0064     void slotDateRangeSelectedByUser();
0065     void slotDateChanged();
0066 
0067 Q_SIGNALS:
0068     /*!
0069      * The rangeChanged() signal is emitted whenever a range
0070      * is changed (user interaction or call to setDateRange() )
0071      */
0072     void rangeChanged();
0073 
0074 private:
0075     DateRangeDlgPrivate * const d_ptr;
0076     Q_DECLARE_PRIVATE(DateRangeDlg)
0077 };
0078 
0079 #endif