mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-02 06:36:07 -04:00
Add tags feature
* show the tags in the entry preview * allow searching by tag * add a sidebar listing the tags in the database * filter entries by tag on click * Introduce a new TagsEdit widget that provides pill aesthetics, fast removal functionality and autocompletion * add tests for the tags feature * introduce the "is" tag for searching. Support for weak passwords and expired added.
This commit is contained in:
parent
56a1b465a1
commit
4a21cee98c
33 changed files with 1541 additions and 73 deletions
|
@ -53,6 +53,7 @@
|
|||
#include "gui/group/EditGroupWidget.h"
|
||||
#include "gui/group/GroupModel.h"
|
||||
#include "gui/group/GroupView.h"
|
||||
#include "gui/tag/TagsEdit.h"
|
||||
#include "gui/wizard/NewDatabaseWizard.h"
|
||||
#include "keys/FileKey.h"
|
||||
|
||||
|
@ -447,6 +448,19 @@ void TestGui::testEditEntry()
|
|||
QCOMPARE(entry->historyItems().size(), ++editCount);
|
||||
QVERIFY(entry->excludeFromReports());
|
||||
|
||||
// Test tags
|
||||
auto* tags = editEntryWidget->findChild<TagsEdit*>("tagsList");
|
||||
QTest::keyClicks(tags, "_tag1");
|
||||
QTest::keyClick(tags, Qt::Key_Space);
|
||||
QCOMPARE(tags->tags().last(), QString("_tag1"));
|
||||
QTest::keyClick(tags, Qt::Key_Space);
|
||||
QTest::keyClicks(tags, "_tag2"); // adds another tag
|
||||
QCOMPARE(tags->tags().last(), QString("_tag2"));
|
||||
QTest::keyClick(tags, Qt::Key_Backspace); // Back into editing last tag
|
||||
QTest::keyClicks(tags, "gers");
|
||||
QTest::keyClick(tags, Qt::Key_Space);
|
||||
QCOMPARE(tags->tags().last(), QString("_taggers"));
|
||||
|
||||
// Test entry colors (simulate choosing a color)
|
||||
editEntryWidget->setCurrentPage(1);
|
||||
auto fgColor = QString("#FF0000");
|
||||
|
@ -872,6 +886,16 @@ void TestGui::testSearch()
|
|||
QTRY_VERIFY(m_dbWidget->isSearchActive());
|
||||
QTRY_COMPARE(entryView->model()->rowCount(), 0);
|
||||
// Press the search clear button
|
||||
searchTextEdit->clear();
|
||||
QTRY_VERIFY(searchTextEdit->text().isEmpty());
|
||||
QTRY_VERIFY(searchTextEdit->hasFocus());
|
||||
|
||||
// Test tag search
|
||||
searchTextEdit->clear();
|
||||
QTest::keyClicks(searchTextEdit, "tag: testTag");
|
||||
QTRY_VERIFY(m_dbWidget->isSearchActive());
|
||||
QTRY_COMPARE(entryView->model()->rowCount(), 1);
|
||||
|
||||
searchTextEdit->clear();
|
||||
QTRY_VERIFY(searchTextEdit->text().isEmpty());
|
||||
QTRY_VERIFY(searchTextEdit->hasFocus());
|
||||
|
@ -1736,6 +1760,8 @@ void TestGui::addCannedEntries()
|
|||
// Add entry "test" and confirm added
|
||||
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
|
||||
QTest::keyClicks(titleEdit, "test");
|
||||
auto* editEntryWidgetTagsEdit = editEntryWidget->findChild<TagsEdit*>("tagsList");
|
||||
editEntryWidgetTagsEdit->tags(QStringList() << "testTag");
|
||||
auto* editEntryWidgetButtonBox = editEntryWidget->findChild<QDialogButtonBox*>("buttonBox");
|
||||
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue