Properly initialize various attributes.

This commit is contained in:
Felix Geyer 2011-06-29 16:47:05 +02:00
parent c548c7f4b4
commit 5cb906c235
5 changed files with 26 additions and 0 deletions

View File

@ -22,10 +22,16 @@
#include "Metadata.h" #include "Metadata.h"
#include "crypto/Random.h" #include "crypto/Random.h"
#include "format/KeePass2.h"
Database::Database() Database::Database()
{ {
m_metadata = new Metadata(this); m_metadata = new Metadata(this);
m_rootGroup = 0;
m_cipher = KeePass2::CIPHER_AES;
m_compressionAlgo = CompressionNone; // TODO change to CompressionGZip?
m_transformRounds = 1000; // TODO random number
} }
Group* Database::rootGroup() Group* Database::rootGroup()

View File

@ -26,6 +26,8 @@ Entry::Entry()
{ {
m_group = 0; m_group = 0;
m_db = 0; m_db = 0;
m_iconNumber = 0; // TODO change?
} }
Entry::~Entry() Entry::~Entry()

View File

@ -28,6 +28,8 @@ Group::Group()
{ {
m_parent = 0; m_parent = 0;
m_db = 0; m_db = 0;
m_iconNumber = 0; // TODO change?
} }
Group::~Group() Group::~Group()

View File

@ -28,6 +28,14 @@ Metadata::Metadata(Database* parent)
m_entryTemplatesGroup = 0; m_entryTemplatesGroup = 0;
m_lastSelectedGroup = 0; m_lastSelectedGroup = 0;
m_lastTopVisibleGroup = 0; m_lastTopVisibleGroup = 0;
QDateTime now = QDateTime::currentDateTime();
m_nameChanged = now;
m_descriptionChanged = now;
m_defaultUserNameChanged = now;
m_recycleBinChanged = now;
m_entryTemplatesGroupChanged = now;
m_masterKeyChanged = now;
} }
QString Metadata::generator() const QString Metadata::generator() const

View File

@ -20,6 +20,14 @@
TimeInfo::TimeInfo() TimeInfo::TimeInfo()
{ {
m_expires = false; m_expires = false;
m_usageCount = 0; // TODO ???
QDateTime now = QDateTime::currentDateTime();
m_lastModificationTime = now;
m_creationTime = now;
m_lastAccessTime = now;
m_expiryTime = now;
m_locationChanged = now;
} }
QDateTime TimeInfo::lastModificationTime() const QDateTime TimeInfo::lastModificationTime() const