From 6cc6e42542e0e1c42836569b8342081f5ec2a996 Mon Sep 17 00:00:00 2001 From: xavives <154235477+xavives@users.noreply.github.com> Date: Mon, 13 Jan 2025 00:08:06 +0100 Subject: [PATCH] Add Group Path column choice in entry view * Closes #9574 --- share/translations/keepassxc_en.ts | 4 ++++ src/gui/entry/EntryModel.cpp | 11 ++++++++++- src/gui/entry/EntryModel.h | 3 ++- src/gui/entry/EntryView.cpp | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index 6947a937d4..2d250d4fcc 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -4068,6 +4068,10 @@ Would you like to overwrite the existing attachment? Background Color + + Group Path + + EntryPreviewWidget diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index 5f970aabd9..3a0ff18e79 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -116,7 +116,7 @@ int EntryModel::columnCount(const QModelIndex& parent) const return 0; } - return 16; + return 17; } QVariant EntryModel::data(const QModelIndex& index, int role) const @@ -136,6 +136,11 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const return entry->group()->name(); } break; + case ParentGroupPath: + if (entry->group()) { + return entry->group()->fullPath(); + } + break; case Title: result = entry->resolveMultiplePlaceholders(entry->title()); if (attr->isReference(EntryAttributes::TitleKey)) { @@ -373,6 +378,8 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro switch (section) { case ParentGroup: return tr("Group"); + case ParentGroupPath: + return tr("Group Path"); case Title: return tr("Title"); case Username: @@ -410,6 +417,8 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro switch (section) { case ParentGroup: return tr("Group name"); + case ParentGroupPath: + return tr("Group Path"); case Title: return tr("Entry title"); case Username: diff --git a/src/gui/entry/EntryModel.h b/src/gui/entry/EntryModel.h index 4ad81f4c48..44306b3a87 100644 --- a/src/gui/entry/EntryModel.h +++ b/src/gui/entry/EntryModel.h @@ -49,7 +49,8 @@ class EntryModel : public QAbstractTableModel Totp = 12, Size = 13, PasswordStrength = 14, - Color = 15 + Color = 15, + ParentGroupPath = 16 }; explicit EntryModel(QObject* parent = nullptr); diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index 7c5768ef4b..fa832790a0 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -482,6 +482,7 @@ void EntryView::resetViewToDefaults() header()->hideSection(EntryModel::Size); header()->hideSection(EntryModel::PasswordStrength); header()->hideSection(EntryModel::Color); + header()->hideSection(EntryModel::ParentGroupPath); onHeaderChanged(); // Reset column order to logical indices