Skip to content

Commit

Permalink
Fix issues with Entry Editing
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
droidmonkey committed May 5, 2024
1 parent 8c91836 commit ffc72c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/gui/EditWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,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);
}
}

Expand Down
13 changes: 9 additions & 4 deletions src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,28 +1134,33 @@ 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);
m_advancedUi->attachmentsWidget->linkAttachments(m_entry->attachments());

showMessage(tr("Entry updated successfully."), MessageWidget::Positive);
setModified(false);
// Prevent a reload due to entry modified signals
m_entryModifiedTimer.stop();

return true;
}

Expand Down

0 comments on commit ffc72c8

Please # to comment.