Add dateTime property to datefieldbackend
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 7 Aug 2023 12:21:22 +0000 (20:21 +0800)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Wed, 13 Sep 2023 08:47:54 +0000 (08:47 +0000)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/datefieldbackend.cpp
src/gui/filedetails/datefieldbackend.h

index 7bc585650a967f557294cc183c63329c9432bfa0..218f6346c0321e2ddb167e0acb478f3d5426a3e6 100644 (file)
@@ -19,5 +19,19 @@ namespace OCC
 namespace Quick
 {
 
+QDateTime DateFieldBackend::dateTime() const
+{
+    return m_dateTime;
+}
+
+void DateFieldBackend::setDateTime(const QDateTime &dateTime)
+{
+    if (m_dateTime == dateTime) {
+        return;
+    }
+
+    m_dateTime = dateTime;
+    Q_EMIT dateTimeChanged();
+}
 }
 }
\ No newline at end of file
index 96d92784f5e1e10366d5282b0206c3025c138e3d..1311e7bba0199e541817ef999a0600aec8741f14 100644 (file)
@@ -14,6 +14,7 @@
 
 #pragma once
 
+#include <QDateTime>
 #include <QObject>
 
 namespace OCC
@@ -25,8 +26,21 @@ class DateFieldBackend : public QObject
 {
     Q_OBJECT
 
+    Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged)
+
 public:
     explicit DateFieldBackend() = default;
+
+    [[nodiscard]] QDateTime dateTime() const;
+
+public slots:
+    void setDateTime(const QDateTime &dateTime);
+
+signals:
+    void dateTimeChanged();
+
+private:
+    QDateTime m_dateTime;
 };
 
 } // namespace Quick