mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 13:05:51 +03:00
Add maximum date properties to datefieldbackend
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
858aa9fb9b
commit
7e26bbd5f0
2 changed files with 42 additions and 0 deletions
|
@ -93,5 +93,35 @@ void DateFieldBackend::setMinimumDateTimeMsecs(const qint64 minimumDateTimeMsecs
|
|||
const auto dt = QDateTime::fromMSecsSinceEpoch(minimumDateTimeMsecs);
|
||||
setMinimumDateTime(dt);
|
||||
}
|
||||
|
||||
QDateTime DateFieldBackend::maximumDateTime() const
|
||||
{
|
||||
return _maximumDateTime;
|
||||
}
|
||||
|
||||
void DateFieldBackend::setMaximumDateTime(const QDateTime &maximumDateTime)
|
||||
{
|
||||
if (_maximumDateTime == maximumDateTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
_maximumDateTime = maximumDateTime;
|
||||
Q_EMIT maximumDateTimeChanged();
|
||||
}
|
||||
|
||||
qint64 DateFieldBackend::maximumDateTimeMsecs() const
|
||||
{
|
||||
return _maximumDateTime.toMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
void DateFieldBackend::setMaximumDateTimeMsecs(const qint64 maximumDateTimeMsecs)
|
||||
{
|
||||
if (_maximumDateTime.toMSecsSinceEpoch() == maximumDateTimeMsecs) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto dt = QDateTime::fromMSecsSinceEpoch(maximumDateTimeMsecs);
|
||||
setMaximumDateTime(dt);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,10 @@ class DateFieldBackend : public QObject
|
|||
|
||||
Q_PROPERTY(QDateTime minimumDateTime READ minimumDateTime WRITE setMinimumDateTime NOTIFY minimumDateTimeChanged)
|
||||
Q_PROPERTY(qint64 minimumDateTimeMsecs READ minimumDateTimeMsecs WRITE setMinimumDateTimeMsecs NOTIFY minimumDateTimeChanged)
|
||||
|
||||
Q_PROPERTY(QDateTime maximumDateTime READ maximumDateTime WRITE setMaximumDateTime NOTIFY maximumDateTimeChanged)
|
||||
Q_PROPERTY(qint64 maximumDateTimeMsecs READ maximumDateTimeMsecs WRITE setMaximumDateTimeMsecs NOTIFY maximumDateTimeChanged)
|
||||
|
||||
public:
|
||||
explicit DateFieldBackend() = default;
|
||||
|
||||
|
@ -42,6 +46,9 @@ public:
|
|||
[[nodiscard]] QDateTime minimumDateTime() const;
|
||||
[[nodiscard]] qint64 minimumDateTimeMsecs() const;
|
||||
|
||||
[[nodiscard]] QDateTime maximumDateTime() const;
|
||||
[[nodiscard]] qint64 maximumDateTimeMsecs() const;
|
||||
|
||||
public slots:
|
||||
void setDateTime(const QDateTime &dateTime);
|
||||
void setDateTimeMsecs(const qint64 dateTimeMsecs);
|
||||
|
@ -50,13 +57,18 @@ public slots:
|
|||
void setMinimumDateTime(const QDateTime &minimumDateTime);
|
||||
void setMinimumDateTimeMsecs(const qint64 minimumDateTimeMsecs);
|
||||
|
||||
void setMaximumDateTime(const QDateTime &maximumDateTime);
|
||||
void setMaximumDateTimeMsecs(const qint64 maximumDateTimeMsecs);
|
||||
|
||||
signals:
|
||||
void dateTimeChanged();
|
||||
void minimumDateTimeChanged();
|
||||
void maximumDateTimeChanged();
|
||||
|
||||
private:
|
||||
QDateTime _dateTime;
|
||||
QDateTime _minimumDateTime;
|
||||
QDateTime _maximumDateTime;
|
||||
};
|
||||
|
||||
} // namespace Quick
|
||||
|
|
Loading…
Reference in a new issue