From 456293a8ef286fa9db9b44bdd466a00e81c8e14f Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Sat, 1 Jun 2024 18:14:55 -0400 Subject: Present a shorter path to user in recent file list --- src/recent_files.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/recent_files.cpp b/src/recent_files.cpp index 2382f1a..57ecb6c 100644 --- a/src/recent_files.cpp +++ b/src/recent_files.cpp @@ -1,5 +1,6 @@ #include "recent_files.h" #include +#include RecentFiles::RecentFiles(unsigned int size, bool force_empty) : size(size) { if (not force_empty) @@ -28,7 +29,13 @@ void RecentFiles::generate_menu_actions() { if (not list.isEmpty()) { int i = 1; for (const QString& path : list) { - Action* action = new Action(QStringLiteral("&%1. %2").arg(i++).arg(QFileInfo(path).fileName())); + QFileInfo file(path); + + // Showing the parent directory's name allows knowing from which archive the file comes from + Action* action = new Action(QStringLiteral("&%1. %2").arg(i++).arg( + file.dir().dirName() + QStringLiteral("/") + file.fileName() + )); + action->file_path = path; menu->addAction(action); } -- cgit v1.2.3-54-g00ecf