Improve existing code prior to implementing FDO Secrets
* DatabaseTabWidget::newDatabase returns the created DatabaseWidget * Emit DatabaseTabWidget::databaseOpened signal before a new tab is added * EntrySearcher can now search attribute values including custom ones * Add Group::applyGroupIconTo to set the group icon on the supplied entry * Implement desktop notifications through the system tray icon * Add DatabaseWidget::deleteEntries to delete a list of entries * Add Aes128 in SymmetricCipher::algorithmIvSize * Add DatabaseWidget::databaseReplaced signal * Add a helper class to override the message box's parent (prevent bugs)
This commit is contained in:
@@ -140,12 +140,20 @@ bool EntrySearcher::searchEntryImpl(Entry* entry)
|
||||
case Field::Notes:
|
||||
found = term->regex.match(entry->notes()).hasMatch();
|
||||
break;
|
||||
case Field::Attribute:
|
||||
case Field::AttributeKey:
|
||||
found = !attributes.filter(term->regex).empty();
|
||||
break;
|
||||
case Field::Attachment:
|
||||
found = !attachments.filter(term->regex).empty();
|
||||
break;
|
||||
case Field::AttributeValue:
|
||||
// skip protected attributes
|
||||
if (entry->attributes()->isProtected(term->word)) {
|
||||
continue;
|
||||
}
|
||||
found = entry->attributes()->contains(term->word)
|
||||
&& term->regex.match(entry->attributes()->value(term->word)).hasMatch();
|
||||
break;
|
||||
default:
|
||||
// Terms without a specific field try to match title, username, url, and notes
|
||||
found = term->regex.match(entry->resolvePlaceholder(entry->title())).hasMatch()
|
||||
@@ -207,12 +215,18 @@ void EntrySearcher::parseSearchTerms(const QString& searchString)
|
||||
} else if (field.compare("notes", cs) == 0) {
|
||||
term->field = Field::Notes;
|
||||
} else if (field.startsWith("attr", cs)) {
|
||||
term->field = Field::Attribute;
|
||||
term->field = Field::AttributeKey;
|
||||
} else if (field.startsWith("attach", cs)) {
|
||||
term->field = Field::Attachment;
|
||||
} else {
|
||||
term->field = Field::Undefined;
|
||||
} else if (field.startsWith("_", cs)) {
|
||||
term->field = Field::AttributeValue;
|
||||
// searching a custom attribute
|
||||
// in this case term->word is the attribute key (removing the leading "_")
|
||||
// and term->regex is used to match attribute value
|
||||
term->word = field.mid(1);
|
||||
}
|
||||
} else {
|
||||
term->field = Field::Undefined;
|
||||
}
|
||||
|
||||
m_searchTerms.append(term);
|
||||
|
||||
@@ -48,8 +48,9 @@ private:
|
||||
Password,
|
||||
Url,
|
||||
Notes,
|
||||
Attribute,
|
||||
Attachment
|
||||
AttributeKey,
|
||||
Attachment,
|
||||
AttributeValue
|
||||
};
|
||||
|
||||
struct SearchTerm
|
||||
|
||||
@@ -1057,6 +1057,23 @@ Entry* Group::addEntryWithPath(const QString& entryPath)
|
||||
return entry;
|
||||
}
|
||||
|
||||
void Group::applyGroupIconTo(Entry* entry)
|
||||
{
|
||||
if (!config()->get("UseGroupIconOnEntryCreation").toBool()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iconNumber() == Group::DefaultIconNumber && iconUuid().isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iconUuid().isNull()) {
|
||||
entry->setIcon(iconNumber());
|
||||
} else {
|
||||
entry->setIcon(iconUuid());
|
||||
}
|
||||
}
|
||||
|
||||
bool Group::GroupData::operator==(const Group::GroupData& other) const
|
||||
{
|
||||
return equals(other, CompareItemDefault);
|
||||
|
||||
@@ -167,6 +167,8 @@ public:
|
||||
void addEntry(Entry* entry);
|
||||
void removeEntry(Entry* entry);
|
||||
|
||||
void applyGroupIconTo(Entry* entry);
|
||||
|
||||
signals:
|
||||
void groupDataChanged(Group* group);
|
||||
void groupAboutToAdd(Group* group, int index);
|
||||
|
||||
Reference in New Issue
Block a user