mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-04 08:55:31 -05:00
Add more options to database settings widget.
This commit is contained in:
parent
258af265c7
commit
26c4dedd01
@ -33,8 +33,17 @@ DatabaseSettingsWidget::~DatabaseSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void DatabaseSettingsWidget::setForms(int transformRounds)
|
||||
void DatabaseSettingsWidget::setForms(QString dbName, QString dbDescription,
|
||||
bool recylceBinEnabled, int transformRounds)
|
||||
{
|
||||
m_ui->dbNameEdit->setText(dbName);
|
||||
m_ui->dbDescriptionEdit->setText(dbDescription);
|
||||
if (recylceBinEnabled) {
|
||||
m_ui->recycleBinEnabledCheckBox->setCheckState(Qt::Checked);
|
||||
}
|
||||
else {
|
||||
m_ui->recycleBinEnabledCheckBox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
m_ui->transformRoundsSpinBox->setValue(transformRounds);
|
||||
}
|
||||
|
||||
@ -43,9 +52,33 @@ quint64 DatabaseSettingsWidget::transformRounds()
|
||||
return m_transformRounds;
|
||||
}
|
||||
|
||||
QString DatabaseSettingsWidget::dbName()
|
||||
{
|
||||
return m_dbName;
|
||||
}
|
||||
|
||||
QString DatabaseSettingsWidget::dbDescription()
|
||||
{
|
||||
return m_dbDescription;
|
||||
}
|
||||
|
||||
bool DatabaseSettingsWidget::recylceBinEnabled()
|
||||
{
|
||||
return m_recylceBinEnabled;
|
||||
}
|
||||
|
||||
void DatabaseSettingsWidget::changeSettings()
|
||||
{
|
||||
m_dbName = m_ui->dbNameEdit->text();
|
||||
m_dbDescription = m_ui->dbDescriptionEdit->text();
|
||||
if (m_ui->recycleBinEnabledCheckBox->checkState() == Qt::Checked) {
|
||||
m_recylceBinEnabled = true;
|
||||
}
|
||||
else {
|
||||
m_recylceBinEnabled = false;
|
||||
}
|
||||
m_transformRounds = m_ui->transformRoundsSpinBox->value();
|
||||
|
||||
Q_EMIT editFinished(true);
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,12 @@ public:
|
||||
explicit DatabaseSettingsWidget(QWidget* parent = 0);
|
||||
~DatabaseSettingsWidget();
|
||||
|
||||
void setForms(int transformRounds);
|
||||
void setForms(QString dbName, QString dbDescription,
|
||||
bool recylceBinEnabled, int transformRounds);
|
||||
quint64 transformRounds();
|
||||
QString dbName();
|
||||
QString dbDescription();
|
||||
bool recylceBinEnabled();
|
||||
|
||||
Q_SIGNALS:
|
||||
void editFinished(bool accepted);
|
||||
@ -48,6 +52,9 @@ private Q_SLOTS:
|
||||
private:
|
||||
QScopedPointer<Ui::DatabaseSettingsWidget> m_ui;
|
||||
|
||||
QString m_dbName;
|
||||
QString m_dbDescription;
|
||||
bool m_recylceBinEnabled;
|
||||
quint64 m_transformRounds;
|
||||
|
||||
Q_DISABLE_COPY(DatabaseSettingsWidget)
|
||||
|
@ -33,13 +33,33 @@
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="dbNameLabel">
|
||||
<property name="text">
|
||||
<string>Database name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="dbNameEdit"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="dbDescriptionEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="dbDescriptionLabel">
|
||||
<property name="text">
|
||||
<string>Database description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="transformRoundsLabel">
|
||||
<property name="text">
|
||||
<string>Transform rounds:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="transformRoundsSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@ -55,6 +75,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="recycleBinEnabledCheckBox">
|
||||
<property name="text">
|
||||
<string>Recycle bin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -198,6 +198,9 @@ void DatabaseWidget::updateSettings(bool accepted)
|
||||
{
|
||||
if (accepted) {
|
||||
m_db->updateKey(m_databaseSettingsWidget->transformRounds());
|
||||
m_db->metadata()->setDescription(m_databaseSettingsWidget->dbDescription());
|
||||
m_db->metadata()->setRecycleBinEnabled(m_databaseSettingsWidget->recylceBinEnabled());
|
||||
m_db->metadata()->setName(m_databaseSettingsWidget->dbName());
|
||||
}
|
||||
|
||||
setCurrentIndex(0);
|
||||
@ -221,7 +224,10 @@ void DatabaseWidget::switchToMasterKeyChange()
|
||||
|
||||
void DatabaseWidget::switchToDatabaseSettings()
|
||||
{
|
||||
m_databaseSettingsWidget->setForms(m_db->transformRounds());
|
||||
m_databaseSettingsWidget->setForms(m_db->metadata()->name(),
|
||||
m_db->metadata()->description(),
|
||||
m_db->metadata()->recycleBinEnabled(),
|
||||
m_db->transformRounds());
|
||||
setCurrentIndex(4);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user