mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-08 23:59:41 -04:00
Hide Auto-Type sequences column when unnecessary
* Fix #3688 - hide the sequences column if all of the entry matches return the same sequence. This cleans up redundent data in the Auto-Type selection dialog introduced in 2.5.0.
This commit is contained in:
parent
5996ba51c9
commit
035823e414
1 changed files with 15 additions and 1 deletions
|
@ -35,7 +35,7 @@ AutoTypeMatchView::AutoTypeMatchView(QWidget* parent)
|
||||||
m_sortModel->setDynamicSortFilter(true);
|
m_sortModel->setDynamicSortFilter(true);
|
||||||
m_sortModel->setSortLocaleAware(true);
|
m_sortModel->setSortLocaleAware(true);
|
||||||
m_sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
m_sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
QTreeView::setModel(m_sortModel);
|
setModel(m_sortModel);
|
||||||
|
|
||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
|
@ -90,12 +90,26 @@ void AutoTypeMatchView::keyPressEvent(QKeyEvent* event)
|
||||||
void AutoTypeMatchView::setMatchList(const QList<AutoTypeMatch>& matches)
|
void AutoTypeMatchView::setMatchList(const QList<AutoTypeMatch>& matches)
|
||||||
{
|
{
|
||||||
m_model->setMatchList(matches);
|
m_model->setMatchList(matches);
|
||||||
|
|
||||||
|
bool sameSequences = true;
|
||||||
|
if (matches.count() > 1) {
|
||||||
|
QString sequenceTest = matches[0].sequence;
|
||||||
|
for (const auto& match : matches) {
|
||||||
|
if (match.sequence != sequenceTest) {
|
||||||
|
sameSequences = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setColumnHidden(AutoTypeMatchModel::Sequence, sameSequences);
|
||||||
|
|
||||||
for (int i = 0; i < m_model->columnCount(); ++i) {
|
for (int i = 0; i < m_model->columnCount(); ++i) {
|
||||||
resizeColumnToContents(i);
|
resizeColumnToContents(i);
|
||||||
if (columnWidth(i) > 250) {
|
if (columnWidth(i) > 250) {
|
||||||
setColumnWidth(i, 250);
|
setColumnWidth(i, 250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFirstMatchActive();
|
setFirstMatchActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue