1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

GnomeKeyring: Port to Qt6

Limit the timestamp to 32 bits.

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2023-11-13 22:02:14 +01:00
parent 4f953aa0aa
commit 1e9b37bccb
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
2 changed files with 14 additions and 3 deletions

View File

@ -126,7 +126,7 @@ endif()
# Optional: GnomeKeyring
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
option(BUILD_KEYRING "Gnome keyring password plugin" OFF)
option(BUILD_KEYRING "Gnome keyring password plugin" ON)
if (BUILD_KEYRING)
pkg_check_modules(GNOME_KEYRING IMPORTED_TARGET gnome-keyring-1 )
endif()

View File

@ -24,6 +24,17 @@ extern "C" {
#include "gnome-keyring.h"
}
// TODO QT6 - should we just start storing timestamps as 64-bit instead?
static uint Q_DATETIME_TOTIME_T(const QDateTime &dateTime)
{
if (!dateTime.isValid())
return uint(-1);
qint64 retval = dateTime.toMSecsSinceEpoch() / 1000;
if (quint64(retval) >= Q_UINT64_C(0xFFFFFFFF))
return uint(-1);
return uint(retval);
}
static PasswordEntry createEntry(GnomeKeyringFound* item)
{
PasswordEntry entry;
@ -141,7 +152,7 @@ void GnomeKeyringPasswordBackend::addEntry(const PasswordEntry &entry)
initialize();
PasswordEntry stored = entry;
stored.updated = QDateTime::currentDateTime().toTime_t();
stored.updated = Q_DATETIME_TOTIME_T(QDateTime::currentDateTime());
storeEntry(stored);
@ -201,7 +212,7 @@ void GnomeKeyringPasswordBackend::updateLastUsed(PasswordEntry &entry)
{
initialize();
entry.updated = QDateTime::currentDateTime().toTime_t();
entry.updated = Q_DATETIME_TOTIME_T(QDateTime::currentDateTime());
GnomeKeyringAttributeList* attributes = createAttributes(entry);