mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
GnomeKeyring: Port to Qt6
Limit the timestamp to 32 bits. Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
4f953aa0aa
commit
1e9b37bccb
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user