mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05: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
@ -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…
Reference in New Issue
Block a user