File indexing completed on 2024-05-12 05:07:58
0001 /* 0002 SPDX-FileCopyrightText: 2010-2018 Thomas Baumgart <tbaumgart@kde.org> 0003 SPDX-FileCopyrightText: 2010-2016 Cristian Oneț <onet.cristian@gmail.com> 0004 SPDX-FileCopyrightText: 2010 Alvaro Soliverez <asoliverez@gmail.com> 0005 SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KMYMONEYFREQUENCYCOMBO_H 0010 #define KMYMONEYFREQUENCYCOMBO_H 0011 0012 #include "kmm_base_widgets_export.h" 0013 0014 // ---------------------------------------------------------------------------- 0015 // QT Includes 0016 0017 // ---------------------------------------------------------------------------- 0018 // KDE Includes 0019 0020 // ---------------------------------------------------------------------------- 0021 // Project Includes 0022 0023 #include "kmymoneyoccurrencecombo.h" 0024 0025 /** 0026 * This class implements a payment frequency selector 0027 * @author Thomas Baumgart 0028 */ 0029 class KMM_BASE_WIDGETS_EXPORT KMyMoneyFrequencyCombo : public KMyMoneyOccurrenceCombo 0030 { 0031 Q_OBJECT 0032 Q_DISABLE_COPY(KMyMoneyFrequencyCombo) 0033 Q_PROPERTY(QVariant data READ currentData WRITE setCurrentData STORED false) 0034 0035 public: 0036 explicit KMyMoneyFrequencyCombo(QWidget* parent = nullptr); 0037 ~KMyMoneyFrequencyCombo() override; 0038 0039 /** 0040 * This method returns the number of events for the selected payment 0041 * frequency (eg for yearly the return value is 1 and for monthly it 0042 * is 12). In case, the frequency cannot be converted (once, every other year, etc.) 0043 * the method returns 0. 0044 */ 0045 int eventsPerYear() const; 0046 /** 0047 * This method returns the number of days between two events of 0048 * the selected frequency. The return value for months is based 0049 * on 30 days and the year is 360 days long. 0050 */ 0051 int daysBetweenEvents() const; 0052 0053 QVariant currentData() const; 0054 0055 void setCurrentData(QVariant datavar); 0056 0057 Q_SIGNALS: 0058 void currentDataChanged(QVariant data); 0059 0060 protected Q_SLOTS: 0061 void slotCurrentDataChanged(); 0062 0063 private: 0064 QVariant data; 0065 0066 }; 0067 0068 #endif