0
0
mirror of https://github.com/keepassxreboot/keepassxc.git synced 2024-09-19 20:02:18 +02:00

Remember sort order in Autotype popup dialog.

Fixes #1684.
This commit is contained in:
Martin van Zijl 2023-06-02 05:42:25 +12:00
parent 4dcd41975d
commit c701e8ec73
3 changed files with 15 additions and 0 deletions

View File

@ -89,6 +89,10 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
connect(m_ui->action, &QToolButton::clicked, this, &AutoTypeSelectDialog::activateCurrentMatch);
connect(m_ui->cancelButton, SIGNAL(clicked()), SLOT(reject()));
auto sortColumn = config()->get(Config::AutoTypeDialogSortColumn).toInt();
auto sortOrder = static_cast<Qt::SortOrder> (config()->get(Config::AutoTypeDialogSortOrder).toInt());
m_ui->view->sortByColumn(sortColumn, sortOrder);
}
// Required for QScopedPointer
@ -401,6 +405,8 @@ void AutoTypeSelectDialog::showEvent(QShowEvent* event)
void AutoTypeSelectDialog::hideEvent(QHideEvent* event)
{
config()->set(Config::GUI_AutoTypeSelectDialogSize, size());
config()->set(Config::AutoTypeDialogSortColumn, m_ui->view->horizontalHeader()->sortIndicatorSection());
config()->set(Config::AutoTypeDialogSortOrder, m_ui->view->horizontalHeader()->sortIndicatorOrder());
if (!m_accepted) {
emit rejected();
}

View File

@ -44,6 +44,11 @@ struct ConfigDirective
QVariant defaultValue;
};
enum DialogSortOrder {
SORT_ORDER_ASCENDING,
SORT_ORDER_DESCENDING
};
// clang-format off
/**
@ -76,6 +81,8 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::AutoTypeDelay,{QS("AutoTypeDelay"), Roaming, 25}},
{Config::AutoTypeStartDelay,{QS("AutoTypeStartDelay"), Roaming, 500}},
{Config::AutoTypeHideExpiredEntry,{QS("AutoTypeHideExpiredEntry"), Roaming, false}},
{Config::AutoTypeDialogSortColumn,{QS("AutoTypeDialogSortColumn"), Roaming, 0}},
{Config::AutoTypeDialogSortOrder,{QS("AutoTypeDialogSortOrder"), Roaming, SORT_ORDER_ASCENDING}},
{Config::GlobalAutoTypeKey,{QS("GlobalAutoTypeKey"), Roaming, 0}},
{Config::GlobalAutoTypeModifiers,{QS("GlobalAutoTypeModifiers"), Roaming, 0}},
{Config::GlobalAutoTypeRetypeTime,{QS("GlobalAutoTypeRetypeTime"), Roaming, 15}},

View File

@ -58,6 +58,8 @@ public:
AutoTypeDelay,
AutoTypeStartDelay,
AutoTypeHideExpiredEntry,
AutoTypeDialogSortColumn,
AutoTypeDialogSortOrder,
GlobalAutoTypeKey,
GlobalAutoTypeModifiers,
GlobalAutoTypeRetypeTime,