mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 09:16:29 -05:00
reuse referenceRegExp
This commit is contained in:
parent
a03e354504
commit
40851409fb
@ -690,7 +690,7 @@ QString Entry::resolvePlaceholder(const QString& str) const
|
||||
// using format from http://keepass.info/help/base/fieldrefs.html at the time of writing,
|
||||
// but supporting lookups of standard fields and references by UUID only
|
||||
|
||||
QRegExp tmpRegExp("\\{REF:([TUPAN])@I:([^}]+)\\}", Qt::CaseInsensitive, QRegExp::RegExp2);
|
||||
QRegExp tmpRegExp = m_attributes->referenceRegExp();
|
||||
if (tmpRegExp.indexIn(result) != -1) {
|
||||
// cap(0) contains the whole reference
|
||||
// cap(1) contains which field is wanted
|
||||
|
@ -28,6 +28,7 @@ const QString EntryAttributes::RememberCmdExecAttr = "_EXEC_CMD";
|
||||
|
||||
EntryAttributes::EntryAttributes(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_referenceRegExp("\\{REF:([TUPAN])@I:([^}]+)\\}", Qt::CaseInsensitive, QRegExp::RegExp2)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@ -77,13 +78,17 @@ bool EntryAttributes::isReference(const QString& key) const
|
||||
}
|
||||
|
||||
QString data = value(key);
|
||||
QRegExp referenceRegExp("\\{REF:([TUPAN])@I:([^}]+)\\}", Qt::CaseInsensitive, QRegExp::RegExp2);
|
||||
if (referenceRegExp.indexIn(data) != -1) {
|
||||
if (m_referenceRegExp.indexIn(data) != -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QRegExp EntryAttributes::referenceRegExp() const
|
||||
{
|
||||
return m_referenceRegExp;
|
||||
}
|
||||
|
||||
void EntryAttributes::set(const QString& key, const QString& value, bool protect)
|
||||
{
|
||||
bool emitModified = false;
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
bool contains(const QString& key) const;
|
||||
bool isProtected(const QString& key) const;
|
||||
bool isReference(const QString& key) const;
|
||||
QRegExp referenceRegExp() const;
|
||||
void set(const QString& key, const QString& value, bool protect = false);
|
||||
void remove(const QString& key);
|
||||
void rename(const QString& oldKey, const QString& newKey);
|
||||
@ -72,6 +73,7 @@ Q_SIGNALS:
|
||||
private:
|
||||
QMap<QString, QString> m_attributes;
|
||||
QSet<QString> m_protectedAttributes;
|
||||
QRegExp m_referenceRegExp;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_ENTRYATTRIBUTES_H
|
||||
|
Loading…
Reference in New Issue
Block a user