mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-02 11:26:30 -04:00
AutoType: resolve placeholders in window associations list
This commit is contained in:
parent
1f5a0c0130
commit
b6387f7709
@ -17,9 +17,12 @@
|
||||
|
||||
#include "AutoTypeAssociationsModel.h"
|
||||
|
||||
#include "core/Entry.h"
|
||||
|
||||
AutoTypeAssociationsModel::AutoTypeAssociationsModel(QObject* parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_autoTypeAssociations(nullptr)
|
||||
, m_entry(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -46,6 +49,11 @@ void AutoTypeAssociationsModel::setAutoTypeAssociations(AutoTypeAssociations* au
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void AutoTypeAssociationsModel::setEntry(const Entry *entry)
|
||||
{
|
||||
m_entry = entry;
|
||||
}
|
||||
|
||||
int AutoTypeAssociationsModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
if (!m_autoTypeAssociations || parent.isValid()) {
|
||||
@ -86,7 +94,12 @@ QVariant AutoTypeAssociationsModel::data(const QModelIndex& index, int role) con
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (index.column() == 0) {
|
||||
return m_autoTypeAssociations->get(index.row()).window;
|
||||
QString window = m_autoTypeAssociations->get(index.row()).window;
|
||||
if (m_entry) {
|
||||
window = m_entry->maskPasswordPlaceholders(window);
|
||||
window = m_entry->resolveMultiplePlaceholders(window);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
else {
|
||||
QString sequence = m_autoTypeAssociations->get(index.row()).sequence;
|
||||
|
@ -19,10 +19,11 @@
|
||||
#define KEEPASSX_AUTOTYPEASSOCIATIONSMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QPointer>
|
||||
|
||||
#include "core/AutoTypeAssociations.h"
|
||||
|
||||
class EntryAttributes;
|
||||
class Entry;
|
||||
|
||||
class AutoTypeAssociationsModel : public QAbstractListModel
|
||||
{
|
||||
@ -31,6 +32,7 @@ class AutoTypeAssociationsModel : public QAbstractListModel
|
||||
public:
|
||||
explicit AutoTypeAssociationsModel(QObject* parent = nullptr);
|
||||
void setAutoTypeAssociations(AutoTypeAssociations* autoTypeAssociations);
|
||||
void setEntry(const Entry* entry);
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
@ -47,6 +49,7 @@ public slots:
|
||||
|
||||
private:
|
||||
AutoTypeAssociations* m_autoTypeAssociations;
|
||||
QPointer<const Entry> m_entry;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_AUTOTYPEASSOCIATIONSMODEL_H
|
||||
|
@ -378,6 +378,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
|
||||
m_autoTypeUi->defaultWindowSequenceButton->setChecked(true);
|
||||
m_autoTypeUi->windowSequenceEdit->setText("");
|
||||
m_autoTypeAssoc->copyDataFrom(entry->autoTypeAssociations());
|
||||
m_autoTypeAssocModel->setEntry(entry);
|
||||
if (m_autoTypeAssoc->size() != 0) {
|
||||
m_autoTypeUi->assocView->setCurrentIndex(m_autoTypeAssocModel->index(0, 0));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user