diff --git a/src/gui/DatabaseSettingsWidget.cpp b/src/gui/DatabaseSettingsWidget.cpp
index d86a3f120..c15119575 100644
--- a/src/gui/DatabaseSettingsWidget.cpp
+++ b/src/gui/DatabaseSettingsWidget.cpp
@@ -34,7 +34,8 @@ DatabaseSettingsWidget::~DatabaseSettingsWidget()
}
void DatabaseSettingsWidget::setForms(QString dbName, QString dbDescription,
- bool recylceBinEnabled, int transformRounds)
+ QString defaultUsername, bool recylceBinEnabled,
+ int transformRounds)
{
m_ui->dbNameEdit->setText(dbName);
m_ui->dbDescriptionEdit->setText(dbDescription);
@@ -44,6 +45,7 @@ void DatabaseSettingsWidget::setForms(QString dbName, QString dbDescription,
else {
m_ui->recycleBinEnabledCheckBox->setCheckState(Qt::Unchecked);
}
+ m_ui->defaultUsernameEdit->setText(defaultUsername);
m_ui->transformRoundsSpinBox->setValue(transformRounds);
m_ui->dbNameEdit->setFocus();
@@ -64,6 +66,11 @@ QString DatabaseSettingsWidget::dbDescription()
return m_dbDescription;
}
+QString DatabaseSettingsWidget::defaultUsername()
+{
+ return m_defaultUsername;
+}
+
bool DatabaseSettingsWidget::recylceBinEnabled()
{
return m_recylceBinEnabled;
@@ -73,6 +80,7 @@ void DatabaseSettingsWidget::changeSettings()
{
m_dbName = m_ui->dbNameEdit->text();
m_dbDescription = m_ui->dbDescriptionEdit->text();
+ m_defaultUsername = m_ui->defaultUsernameEdit->text();
if (m_ui->recycleBinEnabledCheckBox->checkState() == Qt::Checked) {
m_recylceBinEnabled = true;
}
diff --git a/src/gui/DatabaseSettingsWidget.h b/src/gui/DatabaseSettingsWidget.h
index 5f5bfa9f2..8652757ba 100644
--- a/src/gui/DatabaseSettingsWidget.h
+++ b/src/gui/DatabaseSettingsWidget.h
@@ -37,10 +37,12 @@ public:
~DatabaseSettingsWidget();
void setForms(QString dbName, QString dbDescription,
- bool recylceBinEnabled, int transformRounds);
+ QString defaultUsername, bool recylceBinEnabled,
+ int transformRounds);
quint64 transformRounds();
QString dbName();
QString dbDescription();
+ QString defaultUsername();
bool recylceBinEnabled();
Q_SIGNALS:
@@ -55,6 +57,7 @@ private:
QString m_dbName;
QString m_dbDescription;
+ QString m_defaultUsername;
bool m_recylceBinEnabled;
quint64 m_transformRounds;
diff --git a/src/gui/DatabaseSettingsWidget.ui b/src/gui/DatabaseSettingsWidget.ui
index 591526df2..5ca5aa877 100644
--- a/src/gui/DatabaseSettingsWidget.ui
+++ b/src/gui/DatabaseSettingsWidget.ui
@@ -75,13 +75,27 @@
- -
+
-
Recycle bin
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Default username:
+
+
+
-
@@ -106,6 +120,14 @@
+
+ dbNameEdit
+ dbDescriptionEdit
+ transformRoundsSpinBox
+ defaultUsernameEdit
+ recycleBinEnabledCheckBox
+ buttonBox
+
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index b56f019d4..a1ea521b9 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -105,6 +105,7 @@ void DatabaseWidget::createEntry()
{
m_newEntry = new Entry();
m_newEntry->setUuid(Uuid::random());
+ m_newEntry->setUsername(m_db->metadata()->defaultUserName());
m_newParent = m_groupView->currentGroup();
switchToEntryEdit(m_newEntry, true);
}
@@ -240,6 +241,7 @@ void DatabaseWidget::updateSettings(bool accepted)
if (accepted) {
m_db->updateKey(m_databaseSettingsWidget->transformRounds());
m_db->metadata()->setDescription(m_databaseSettingsWidget->dbDescription());
+ m_db->metadata()->setDefaultUserName(m_databaseSettingsWidget->defaultUsername());
m_db->metadata()->setRecycleBinEnabled(m_databaseSettingsWidget->recylceBinEnabled());
m_db->metadata()->setName(m_databaseSettingsWidget->dbName());
}
@@ -267,6 +269,7 @@ void DatabaseWidget::switchToDatabaseSettings()
{
m_databaseSettingsWidget->setForms(m_db->metadata()->name(),
m_db->metadata()->description(),
+ m_db->metadata()->defaultUserName(),
m_db->metadata()->recycleBinEnabled(),
m_db->transformRounds());
setCurrentIndex(4);