mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-07 05:52:33 -04:00
Remove Tools::currentDateTimeUtc().
This commit is contained in:
parent
60daa2b41b
commit
9882f16614
10 changed files with 19 additions and 32 deletions
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
|
||||||
#include "crypto/Random.h"
|
#include "crypto/Random.h"
|
||||||
#include "format/KeePass2.h"
|
#include "format/KeePass2.h"
|
||||||
|
|
||||||
|
@ -143,7 +142,7 @@ void Database::addDeletedObject(const DeletedObject& delObj)
|
||||||
void Database::addDeletedObject(const Uuid& uuid)
|
void Database::addDeletedObject(const Uuid& uuid)
|
||||||
{
|
{
|
||||||
DeletedObject delObj;
|
DeletedObject delObj;
|
||||||
delObj.deletionTime = Tools::currentDateTimeUtc();
|
delObj.deletionTime = QDateTime::currentDateTimeUtc();
|
||||||
delObj.uuid = uuid;
|
delObj.uuid = uuid;
|
||||||
|
|
||||||
addDeletedObject(delObj);
|
addDeletedObject(delObj);
|
||||||
|
@ -223,7 +222,7 @@ bool Database::setKey(const CompositeKey& key, const QByteArray& transformSeed,
|
||||||
m_data.transformedMasterKey = transformedMasterKey;
|
m_data.transformedMasterKey = transformedMasterKey;
|
||||||
m_data.hasKey = true;
|
m_data.hasKey = true;
|
||||||
if (updateChangedTime) {
|
if (updateChangedTime) {
|
||||||
m_metadata->setMasterKeyChanged(Tools::currentDateTimeUtc());
|
m_metadata->setMasterKeyChanged(QDateTime::currentDateTimeUtc());
|
||||||
}
|
}
|
||||||
Q_EMIT modifiedImmediate();
|
Q_EMIT modifiedImmediate();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "core/DatabaseIcons.h"
|
#include "core/DatabaseIcons.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
|
||||||
|
|
||||||
const int Entry::DefaultIconNumber = 0;
|
const int Entry::DefaultIconNumber = 0;
|
||||||
|
|
||||||
|
@ -74,8 +73,8 @@ template <class T> inline bool Entry::set(T& property, const T& value)
|
||||||
void Entry::updateTimeinfo()
|
void Entry::updateTimeinfo()
|
||||||
{
|
{
|
||||||
if (m_updateTimeinfo) {
|
if (m_updateTimeinfo) {
|
||||||
m_data.timeInfo.setLastModificationTime(Tools::currentDateTimeUtc());
|
m_data.timeInfo.setLastModificationTime(QDateTime::currentDateTimeUtc());
|
||||||
m_data.timeInfo.setLastAccessTime(Tools::currentDateTimeUtc());
|
m_data.timeInfo.setLastAccessTime(QDateTime::currentDateTimeUtc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +210,7 @@ QString Entry::notes() const
|
||||||
|
|
||||||
bool Entry::isExpired() const
|
bool Entry::isExpired() const
|
||||||
{
|
{
|
||||||
return m_data.timeInfo.expires() && m_data.timeInfo.expiryTime() < Tools::currentDateTimeUtc();
|
return m_data.timeInfo.expires() && m_data.timeInfo.expiryTime() < QDateTime::currentDateTimeUtc();
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryAttributes* Entry::attributes()
|
EntryAttributes* Entry::attributes()
|
||||||
|
@ -466,7 +465,7 @@ Entry* Entry::clone(CloneFlags flags) const
|
||||||
entry->setUpdateTimeinfo(true);
|
entry->setUpdateTimeinfo(true);
|
||||||
|
|
||||||
if (flags & CloneResetTimeInfo) {
|
if (flags & CloneResetTimeInfo) {
|
||||||
QDateTime now = Tools::currentDateTimeUtc();
|
QDateTime now = QDateTime::currentDateTimeUtc();
|
||||||
entry->m_data.timeInfo.setCreationTime(now);
|
entry->m_data.timeInfo.setCreationTime(now);
|
||||||
entry->m_data.timeInfo.setLastModificationTime(now);
|
entry->m_data.timeInfo.setLastModificationTime(now);
|
||||||
entry->m_data.timeInfo.setLastAccessTime(now);
|
entry->m_data.timeInfo.setLastAccessTime(now);
|
||||||
|
@ -560,7 +559,7 @@ void Entry::setGroup(Group* group)
|
||||||
QObject::setParent(group);
|
QObject::setParent(group);
|
||||||
|
|
||||||
if (m_updateTimeinfo) {
|
if (m_updateTimeinfo) {
|
||||||
m_data.timeInfo.setLocationChanged(Tools::currentDateTimeUtc());
|
m_data.timeInfo.setLocationChanged(QDateTime::currentDateTimeUtc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "core/Config.h"
|
#include "core/Config.h"
|
||||||
#include "core/DatabaseIcons.h"
|
#include "core/DatabaseIcons.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
|
||||||
|
|
||||||
const int Group::DefaultIconNumber = 48;
|
const int Group::DefaultIconNumber = 48;
|
||||||
const int Group::RecycleBinIconNumber = 43;
|
const int Group::RecycleBinIconNumber = 43;
|
||||||
|
@ -50,7 +49,7 @@ Group::~Group()
|
||||||
|
|
||||||
if (m_db && m_parent) {
|
if (m_db && m_parent) {
|
||||||
DeletedObject delGroup;
|
DeletedObject delGroup;
|
||||||
delGroup.deletionTime = Tools::currentDateTimeUtc();
|
delGroup.deletionTime = QDateTime::currentDateTimeUtc();
|
||||||
delGroup.uuid = m_uuid;
|
delGroup.uuid = m_uuid;
|
||||||
m_db->addDeletedObject(delGroup);
|
m_db->addDeletedObject(delGroup);
|
||||||
}
|
}
|
||||||
|
@ -84,8 +83,8 @@ template <class P, class V> inline bool Group::set(P& property, const V& value)
|
||||||
void Group::updateTimeinfo()
|
void Group::updateTimeinfo()
|
||||||
{
|
{
|
||||||
if (m_updateTimeinfo) {
|
if (m_updateTimeinfo) {
|
||||||
m_data.timeInfo.setLastModificationTime(Tools::currentDateTimeUtc());
|
m_data.timeInfo.setLastModificationTime(QDateTime::currentDateTimeUtc());
|
||||||
m_data.timeInfo.setLastAccessTime(Tools::currentDateTimeUtc());
|
m_data.timeInfo.setLastAccessTime(QDateTime::currentDateTimeUtc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +185,7 @@ Entry* Group::lastTopVisibleEntry() const
|
||||||
|
|
||||||
bool Group::isExpired() const
|
bool Group::isExpired() const
|
||||||
{
|
{
|
||||||
return m_data.timeInfo.expires() && m_data.timeInfo.expiryTime() < Tools::currentDateTimeUtc();
|
return m_data.timeInfo.expires() && m_data.timeInfo.expiryTime() < QDateTime::currentDateTimeUtc();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::setUuid(const Uuid& uuid)
|
void Group::setUuid(const Uuid& uuid)
|
||||||
|
@ -352,7 +351,7 @@ void Group::setParent(Group* parent, int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_updateTimeinfo) {
|
if (m_updateTimeinfo) {
|
||||||
m_data.timeInfo.setLocationChanged(Tools::currentDateTimeUtc());
|
m_data.timeInfo.setLocationChanged(QDateTime::currentDateTimeUtc());
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
|
@ -497,7 +496,7 @@ Group* Group::clone(Entry::CloneFlags entryFlags) const
|
||||||
|
|
||||||
clonedGroup->setUpdateTimeinfo(true);
|
clonedGroup->setUpdateTimeinfo(true);
|
||||||
|
|
||||||
QDateTime now = Tools::currentDateTimeUtc();
|
QDateTime now = QDateTime::currentDateTimeUtc();
|
||||||
clonedGroup->m_data.timeInfo.setCreationTime(now);
|
clonedGroup->m_data.timeInfo.setCreationTime(now);
|
||||||
clonedGroup->m_data.timeInfo.setLastModificationTime(now);
|
clonedGroup->m_data.timeInfo.setLastModificationTime(now);
|
||||||
clonedGroup->m_data.timeInfo.setLastAccessTime(now);
|
clonedGroup->m_data.timeInfo.setLastAccessTime(now);
|
||||||
|
|
|
@ -42,7 +42,7 @@ Metadata::Metadata(QObject* parent)
|
||||||
m_data.protectNotes = false;
|
m_data.protectNotes = false;
|
||||||
// m_data.autoEnableVisualHiding = false;
|
// m_data.autoEnableVisualHiding = false;
|
||||||
|
|
||||||
QDateTime now = Tools::currentDateTimeUtc();
|
QDateTime now = QDateTime::currentDateTimeUtc();
|
||||||
m_data.nameChanged = now;
|
m_data.nameChanged = now;
|
||||||
m_data.descriptionChanged = now;
|
m_data.descriptionChanged = now;
|
||||||
m_data.defaultUserNameChanged = now;
|
m_data.defaultUserNameChanged = now;
|
||||||
|
@ -67,7 +67,7 @@ template <class P, class V> bool Metadata::set(P& property, const V& value, QDat
|
||||||
if (property != value) {
|
if (property != value) {
|
||||||
property = value;
|
property = value;
|
||||||
if (m_updateDatetime) {
|
if (m_updateDatetime) {
|
||||||
dateTime = Tools::currentDateTimeUtc();
|
dateTime = QDateTime::currentDateTimeUtc();
|
||||||
}
|
}
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -23,7 +23,7 @@ TimeInfo::TimeInfo()
|
||||||
: m_expires(false)
|
: m_expires(false)
|
||||||
, m_usageCount(0)
|
, m_usageCount(0)
|
||||||
{
|
{
|
||||||
QDateTime now = Tools::currentDateTimeUtc();
|
QDateTime now = QDateTime::currentDateTimeUtc();
|
||||||
m_lastModificationTime = now;
|
m_lastModificationTime = now;
|
||||||
m_creationTime = now;
|
m_creationTime = now;
|
||||||
m_lastAccessTime = now;
|
m_lastAccessTime = now;
|
||||||
|
|
|
@ -122,15 +122,6 @@ bool readAllFromDevice(QIODevice* device, QByteArray& data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime currentDateTimeUtc()
|
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
|
|
||||||
return QDateTime::currentDateTimeUtc();
|
|
||||||
#else
|
|
||||||
return QDateTime::currentDateTime().toUTC();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QString imageReaderFilter()
|
QString imageReaderFilter()
|
||||||
{
|
{
|
||||||
QList<QByteArray> formats = QImageReader::supportedImageFormats();
|
QList<QByteArray> formats = QImageReader::supportedImageFormats();
|
||||||
|
|
|
@ -32,7 +32,6 @@ QString humanReadableFileSize(qint64 bytes);
|
||||||
bool hasChild(const QObject* parent, const QObject* child);
|
bool hasChild(const QObject* parent, const QObject* child);
|
||||||
bool readFromDevice(QIODevice* device, QByteArray& data, int size = 16384);
|
bool readFromDevice(QIODevice* device, QByteArray& data, int size = 16384);
|
||||||
bool readAllFromDevice(QIODevice* device, QByteArray& data);
|
bool readAllFromDevice(QIODevice* device, QByteArray& data);
|
||||||
QDateTime currentDateTimeUtc();
|
|
||||||
QString imageReaderFilter();
|
QString imageReaderFilter();
|
||||||
bool isHex(const QByteArray& ba);
|
bool isHex(const QByteArray& ba);
|
||||||
void sleep(int ms);
|
void sleep(int ms);
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ QDateTime KeePass2XmlReader::readDateTime()
|
||||||
raiseError("Invalid date time value");
|
raiseError("Invalid date time value");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dt = Tools::currentDateTimeUtc();
|
dt = QDateTime::currentDateTimeUtc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ void EditEntryWidget::useExpiryPreset(QAction* action)
|
||||||
{
|
{
|
||||||
m_mainUi->expireCheck->setChecked(true);
|
m_mainUi->expireCheck->setChecked(true);
|
||||||
TimeDelta delta = action->data().value<TimeDelta>();
|
TimeDelta delta = action->data().value<TimeDelta>();
|
||||||
QDateTime now = Tools::currentDateTimeUtc().toLocalTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
QDateTime expiryDateTime = now + delta;
|
QDateTime expiryDateTime = now + delta;
|
||||||
m_mainUi->expireDatePicker->setDateTime(expiryDateTime);
|
m_mainUi->expireDatePicker->setDateTime(expiryDateTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ void TestModified::testEntrySets()
|
||||||
entry->setExpires(entry->timeInfo().expires());
|
entry->setExpires(entry->timeInfo().expires());
|
||||||
QCOMPARE(spyModified.count(), spyCount);
|
QCOMPARE(spyModified.count(), spyCount);
|
||||||
|
|
||||||
entry->setExpiryTime(Tools::currentDateTimeUtc().addYears(1));
|
entry->setExpiryTime(QDateTime::currentDateTimeUtc().addYears(1));
|
||||||
QCOMPARE(spyModified.count(), ++spyCount);
|
QCOMPARE(spyModified.count(), ++spyCount);
|
||||||
entry->setExpiryTime(entry->timeInfo().expiryTime());
|
entry->setExpiryTime(entry->timeInfo().expiryTime());
|
||||||
QCOMPARE(spyModified.count(), spyCount);
|
QCOMPARE(spyModified.count(), spyCount);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue