Add natural sort of entry list

Introduce a third unsorted status that shows entries in the order they occur in the KDBX file.

* Add keyboard shortcut Ctrl+Alt+Up/Down to move entries up and down in sort order
* Add entry context menu icons to achieve movement up/down
* Only show menu icons when in natural sort order
* Add Material Design icons for moving up/down

* Add feature to track non-data changes and force a save on exit to ensure they are not lost when locking a database. This allows users to make entry movements and group expand/collapse operations and not lose that state.

Remove saveas
This commit is contained in:
Holger Böhnke 2020-05-21 21:43:00 -04:00 committed by Jonathan White
parent 43c82ccb09
commit eb198271ac
24 changed files with 500 additions and 11 deletions

View file

@ -279,6 +279,11 @@ bool DatabaseWidget::isSaving() const
return m_db->isSaving();
}
bool DatabaseWidget::isSorted() const
{
return m_entryView->isSorted();
}
bool DatabaseWidget::isSearchActive() const
{
return m_entryView->inSearchMode();
@ -645,6 +650,24 @@ void DatabaseWidget::focusOnGroups()
}
}
void DatabaseWidget::moveEntryUp()
{
auto currentEntry = currentSelectedEntry();
if (currentEntry) {
currentEntry->moveUp();
m_entryView->setCurrentEntry(currentEntry);
}
}
void DatabaseWidget::moveEntryDown()
{
auto currentEntry = currentSelectedEntry();
if (currentEntry) {
currentEntry->moveDown();
m_entryView->setCurrentEntry(currentEntry);
}
}
void DatabaseWidget::copyTitle()
{
auto currentEntry = currentSelectedEntry();
@ -1510,7 +1533,7 @@ bool DatabaseWidget::lock()
}
}
if (m_db->isModified()) {
if (m_db->isModified(true)) {
bool saved = false;
// Attempt to save on exit, but don't block locking if it fails
if (config()->get(Config::AutoSaveOnExit).toBool()
@ -1594,7 +1617,7 @@ void DatabaseWidget::reloadDatabaseFile()
QString error;
auto db = QSharedPointer<Database>::create(m_db->filePath());
if (db->open(database()->key(), &error)) {
if (m_db->isModified()) {
if (m_db->isModified(true)) {
// Ask if we want to merge changes into new database
auto result = MessageBox::question(
this,
@ -1641,6 +1664,11 @@ int DatabaseWidget::numberOfSelectedEntries() const
return m_entryView->numberOfSelectedEntries();
}
int DatabaseWidget::currentEntryIndex() const
{
return m_entryView->currentEntryIndex();
}
QStringList DatabaseWidget::customEntryAttributes() const
{
Entry* entry = m_entryView->currentEntry();