Skip to content

Commit

Permalink
Remember sort order in Autotype popup dialog
Browse files Browse the repository at this point in the history
Fixes #1684.
  • Loading branch information
martinvanzijl authored and droidmonkey committed Jan 12, 2025
1 parent 9de6231 commit 6494cdb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/autotype/AutoTypeSelectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,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 = config()->get(Config::AutoTypeDialogSortOrder).toInt();
m_ui->view->sortByColumn(sortColumn, sortOrder == 0 ? Qt::AscendingOrder : Qt::DescendingOrder);
}

// Required for QScopedPointer
Expand Down Expand Up @@ -397,6 +401,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();
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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, Qt::AscendingOrder}},
{Config::GlobalAutoTypeKey,{QS("GlobalAutoTypeKey"), Roaming, 0}},
{Config::GlobalAutoTypeModifiers,{QS("GlobalAutoTypeModifiers"), Roaming, 0}},
{Config::GlobalAutoTypeRetypeTime,{QS("GlobalAutoTypeRetypeTime"), Roaming, 15}},
Expand Down
2 changes: 2 additions & 0 deletions src/core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Config : public QObject
AutoTypeDelay,
AutoTypeStartDelay,
AutoTypeHideExpiredEntry,
AutoTypeDialogSortColumn,
AutoTypeDialogSortOrder,
GlobalAutoTypeKey,
GlobalAutoTypeModifiers,
GlobalAutoTypeRetypeTime,
Expand Down

0 comments on commit 6494cdb

Please sign in to comment.