File indexing completed on 2024-05-12 16:44:03
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 // ---------------------------------------------------------------------------- 0013 // QT Includes 0014 0015 // ---------------------------------------------------------------------------- 0016 // KDE Includes 0017 0018 // ---------------------------------------------------------------------------- 0019 // Project Includes 0020 0021 #include "kmymoneyoccurrencecombo.h" 0022 0023 /** 0024 * This class implements a payment frequency selector 0025 * @author Thomas Baumgart 0026 */ 0027 class KMM_WIDGETS_EXPORT KMyMoneyFrequencyCombo : public KMyMoneyOccurrenceCombo 0028 { 0029 Q_OBJECT 0030 Q_DISABLE_COPY(KMyMoneyFrequencyCombo) 0031 Q_PROPERTY(QVariant data READ currentData WRITE setCurrentData STORED false) 0032 0033 public: 0034 explicit KMyMoneyFrequencyCombo(QWidget* parent = nullptr); 0035 ~KMyMoneyFrequencyCombo() override; 0036 0037 /** 0038 * This method returns the number of events for the selected payment 0039 * frequency (eg for yearly the return value is 1 and for monthly it 0040 * is 12). In case, the frequency cannot be converted (once, every other year, etc.) 0041 * the method returns 0. 0042 */ 0043 int eventsPerYear() const; 0044 /** 0045 * This method returns the number of days between two events of 0046 * the selected frequency. The return value for months is based 0047 * on 30 days and the year is 360 days long. 0048 */ 0049 int daysBetweenEvents() const; 0050 0051 QVariant currentData() const; 0052 0053 void setCurrentData(QVariant datavar); 0054 0055 Q_SIGNALS: 0056 void currentDataChanged(QVariant data); 0057 0058 protected Q_SLOTS: 0059 void slotCurrentDataChanged(); 0060 0061 private: 0062 QVariant data; 0063 0064 }; 0065 0066 #endif