Fix issues with Entry Editing

* Fix #10653 - prevent category switching if no category was actually hidden/visible. Also properly select a new category when a change is made instead of just changing the widget page.

* Fix apply button still being enabled after it is pressed and successfully committed
This commit is contained in:
Jonathan White 2024-05-05 09:41:59 -04:00
parent 1896883382
commit 6b62beab6e
2 changed files with 16 additions and 8 deletions

View File

@ -94,16 +94,19 @@ void EditWidget::setPageHidden(QWidget* widget, bool hidden)
}
}
if (index != -1) {
m_ui->categoryList->setCategoryHidden(index, hidden);
if (index == -1) {
return;
}
if (index == m_ui->stackedWidget->currentIndex()) {
bool changed = m_ui->categoryList->isCategoryHidden(index) != hidden;
m_ui->categoryList->setCategoryHidden(index, hidden);
if (changed && index == m_ui->stackedWidget->currentIndex()) {
int newIndex = m_ui->stackedWidget->currentIndex() - 1;
if (newIndex < 0) {
newIndex = m_ui->stackedWidget->count() - 1;
}
m_ui->stackedWidget->setCurrentIndex(newIndex);
m_ui->categoryList->setCurrentCategory(newIndex);
}
}

View File

@ -1173,21 +1173,23 @@ bool EditEntryWidget::commitEntry()
toKeeAgentSettings(m_sshAgentSettings);
#endif
// Begin entry update
if (!m_create) {
m_entry->beginUpdate();
}
#ifdef WITH_XC_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
updateBrowser();
}
#endif
if (!m_create) {
m_entry->beginUpdate();
}
updateEntryData(m_entry);
if (!m_create) {
m_entry->endUpdate();
}
// End entry update
m_historyModel->setEntries(m_entry->historyItems(), m_entry);
setPageHidden(m_historyWidget, m_history || m_entry->historyItems().count() < 1);
@ -1195,6 +1197,9 @@ bool EditEntryWidget::commitEntry()
showMessage(tr("Entry updated successfully."), MessageWidget::Positive);
setModified(false);
// Prevent a reload due to entry modified signals
m_entryModifiedTimer.stop();
return true;
}