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

Support KDE Frameworks 6 integration.

This commit is contained in:
Tiernan Hubble 2023-04-12 21:53:12 -06:00 committed by Juraj Oravec
parent 0152a9cdeb
commit 405295b4e1
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
3 changed files with 23 additions and 8 deletions

View File

@ -20,11 +20,11 @@ add_library(KDEFrameworksIntegration MODULE ${KDEFrameworksIntegration_SRCS} ${R
install(TARGETS KDEFrameworksIntegration DESTINATION ${FALKON_INSTALL_PLUGINDIR})
target_link_libraries(KDEFrameworksIntegration
FalkonPrivate
KF5::Wallet
KF5::KIOCore
KF5::KIOWidgets
KF5::Crash
KF5::CoreAddons
KF5::PurposeWidgets
KF${KF_MAJOR_VERSION}::Wallet
KF${KF_MAJOR_VERSION}::KIOCore
KF${KF_MAJOR_VERSION}::KIOWidgets
KF${KF_MAJOR_VERSION}::Crash
KF${KF_MAJOR_VERSION}::CoreAddons
KF${KF_MAJOR_VERSION}::PurposeWidgets
KF5::JobWidgets
)

View File

@ -19,7 +19,11 @@
#include "plugininterface.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <PurposeWidgets/Menu>
#else
#include <Purpose/Menu>
#endif
class KWalletPasswordBackend;
class KIOSchemeHandler;

View File

@ -84,6 +84,17 @@ QVector<PasswordEntry> KWalletPasswordBackend::getAllEntries()
return m_allEntries;
}
// 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);
}
void KWalletPasswordBackend::addEntry(const PasswordEntry &entry)
{
initialize();
@ -95,7 +106,7 @@ void KWalletPasswordBackend::addEntry(const PasswordEntry &entry)
PasswordEntry stored = entry;
stored.id = QString("%1/%2").arg(entry.host, entry.username);
stored.updated = QDateTime::currentDateTime().toTime_t();
stored.updated = Q_DATETIME_TOTIME_T(QDateTime::currentDateTime());
m_wallet->writeMap(stored.id.toString(), encodeEntry(stored));
m_allEntries.append(stored);
@ -133,7 +144,7 @@ void KWalletPasswordBackend::updateLastUsed(PasswordEntry &entry)
m_wallet->removeEntry(entry.id.toString());
entry.updated = QDateTime::currentDateTime().toTime_t();
entry.updated = Q_DATETIME_TOTIME_T(QDateTime::currentDateTime());
m_wallet->writeMap(entry.id.toString(), encodeEntry(entry));