| 1 | /* -*- C++ -*- |
| 2 | This file is part of the KDE libraries |
| 3 | SPDX-FileCopyrightText: 1997 Tim D. Gilman <tdgilman@best.org> |
| 4 | SPDX-FileCopyrightText: 1998-2001 Mirko Boehm <mirko@kde.org> |
| 5 | SPDX-FileCopyrightText: 2007 John Layt <john@layt.net> |
| 6 | |
| 7 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 8 | */ |
| 9 | |
| 10 | #ifndef KDATEVALIDATOR_H |
| 11 | #define KDATEVALIDATOR_H |
| 12 | |
| 13 | #include <kguiaddons_export.h> |
| 14 | |
| 15 | #include <QValidator> |
| 16 | |
| 17 | #include <memory> |
| 18 | |
| 19 | class KDateValidatorPrivate; |
| 20 | |
| 21 | /*! |
| 22 | * \class KDateValidator |
| 23 | * \inmodule KGuiAddons |
| 24 | * \brief Validates user-entered dates. |
| 25 | */ |
| 26 | class KGUIADDONS_EXPORT KDateValidator : public QValidator |
| 27 | { |
| 28 | Q_OBJECT |
| 29 | public: |
| 30 | explicit KDateValidator(QObject *parent = nullptr); |
| 31 | ~KDateValidator() override; |
| 32 | |
| 33 | public: |
| 34 | /*! |
| 35 | * \reimp |
| 36 | */ |
| 37 | State validate(QString &text, int &e) const override; |
| 38 | |
| 39 | /*! |
| 40 | * \reimp |
| 41 | */ |
| 42 | void fixup(QString &input) const override; |
| 43 | |
| 44 | State date(const QString &text, QDate &date) const; |
| 45 | |
| 46 | private: |
| 47 | std::unique_ptr<KDateValidatorPrivate> const d; |
| 48 | }; |
| 49 | |
| 50 | #endif // KDATEVALIDATOR_H |
| 51 | |