Skip to content

Commit

Permalink
Add Group Path column choice in entry view
Browse files Browse the repository at this point in the history
* Closes #9574
  • Loading branch information
xavives authored Jan 12, 2025
1 parent 6494cdb commit f5bb598
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4197,6 +4197,10 @@ Would you like to overwrite the existing attachment?</source>
<source>Background Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Group Path</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EntryPreviewWidget</name>
Expand Down
11 changes: 10 additions & 1 deletion src/gui/entry/EntryModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) {
Expand Down Expand Up @@ -377,6 +382,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:
Expand Down Expand Up @@ -414,6 +421,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:
Expand Down
3 changes: 2 additions & 1 deletion src/gui/entry/EntryModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/gui/entry/EntryView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f5bb598

Please sign in to comment.