[network/ruqola] src/core/managedevices: Test newLoginAt == -1

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit a8eb68d9a704a2fd1e8152871f3c6cd1ad4adddd by Laurent Montel.
Committed on 13/08/2026 at 19:45.
Pushed by mlaurent into branch 'master'.

Test newLoginAt == -1

M  +6    -2    src/core/managedevices/deviceinfo.cpp

https://invent.kde.org/network/ruqola/-/commit/a8eb68d9a704a2fd1e8152871f3c6cd1ad4adddd

diff --git a/src/core/managedevices/deviceinfo.cpp b/src/core/managedevices/deviceinfo.cpp
index 95ea549490..0aa34cacd5 100644
--- a/src/core/managedevices/deviceinfo.cpp
+++ b/src/core/managedevices/deviceinfo.cpp
@@ -113,8 +113,12 @@ qint64 DeviceInfo::loginAt() const
 void DeviceInfo::setLoginAt(qint64 newLoginAt)
 {
     mLoginAt = newLoginAt;
-    QLocale l;
-    mLoginAtDateTimeStr = l.toString(QDateTime::fromMSecsSinceEpoch(mLoginAt), QLocale::LongFormat);
+    if (mLoginAt != -1) {
+        const QLocale l;
+        mLoginAtDateTimeStr = l.toString(QDateTime::fromMSecsSinceEpoch(mLoginAt), QLocale::LongFormat);
+    } else {
+        mLoginAtDateTimeStr.clear();
+    }
 }
 
 QString DeviceInfo::loginAtDisplay() const
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.