Make sure all auto-type settings are saved and the UI is reset before loading entries.

This commit is contained in:
Felix Geyer 2012-10-21 12:47:30 +02:00
parent 169e6327ea
commit 788cc02685

View File

@ -294,16 +294,19 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
iconStruct.number = entry->iconNumber();
m_iconsWidget->load(entry->uuid(), m_database, iconStruct);
m_autoTypeUi->windowTitleCombo->lineEdit()->clear();
m_autoTypeAssoc->copyDataFrom(entry->autoTypeAssociations());
m_autoTypeUi->enableButton->setChecked(entry->autoTypeEnabled());
if (entry->defaultAutoTypeSequence().isEmpty()) {
m_autoTypeUi->inheritSequenceButton->setChecked(true);
m_autoTypeUi->sequenceEdit->setText("");
}
else {
m_autoTypeUi->customSequenceButton->setChecked(true);
m_autoTypeUi->sequenceEdit->setText(entry->defaultAutoTypeSequence());
}
m_autoTypeUi->windowTitleCombo->lineEdit()->clear();
m_autoTypeUi->defaultWindowSequenceButton->setChecked(true);
m_autoTypeUi->windowSequenceEdit->setText("");
m_autoTypeAssoc->copyDataFrom(entry->autoTypeAssociations());
if (m_autoTypeAssoc->size() != 0) {
m_autoTypeUi->assocView->setCurrentIndex(m_autoTypeAssocModel->index(0, 0));
}
@ -384,6 +387,14 @@ void EditEntryWidget::saveEntry()
m_entry->setIcon(iconStruct.uuid);
}
m_entry->setAutoTypeEnabled(m_autoTypeUi->enableButton->isChecked());
if (m_autoTypeUi->inheritSequenceButton->isChecked()) {
m_entry->setDefaultAutoTypeSequence(QString());
}
else {
m_entry->setDefaultAutoTypeSequence(m_autoTypeUi->sequenceEdit->text());
}
m_autoTypeAssoc->removeEmpty();
m_entry->autoTypeAssociations()->copyDataFrom(m_autoTypeAssoc);