┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Veness <[email protected]>2024-08-16 07:35:27 +0000
committerMéven Car <[email protected]>2024-08-16 07:35:27 +0000
commit68f1401ecf232ccdca54362d032a547b1ec5f48a (patch)
treeea2d3b377fdc9bc8d7cc89f5321e1568c471dd77
parentc934e803647674b4692668f047b6ffa18121982a (diff)
Fix display of filename ampersands in actions
If you added the "Actions for..." button to the toolbar, filenames that contain "&" would not appear correctly in that button. This MR fixes that, and also the button that appears when using "Delete" with selection mode. BUG: 491684
-rw-r--r--src/kitemviews/kfileitemlisttostring.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/kitemviews/kfileitemlisttostring.cpp b/src/kitemviews/kfileitemlisttostring.cpp
index 9f281c813..e289c8778 100644
--- a/src/kitemviews/kfileitemlisttostring.cpp
+++ b/src/kitemviews/kfileitemlisttostring.cpp
@@ -19,35 +19,35 @@ QString fileItemListToString(KFileItemList items, int maximumTextWidth, const QF
QString text;
switch (items.count()) {
case 1:
- text = i18nc("Textual representation of a file. %1 is the name of the file/folder.", "\"%1\"", items.first().name());
+ text = i18nc("Textual representation of a file. %1 is the name of the file/folder.", "\"%1\"", items.first().name().replace("&", "&&"));
break;
case 2:
text =
- i18nc("Textual representation of two files. %1 and %2 are names of files/folders.", "\"%1\" and \"%2\"", items.first().name(), items.last().name());
+ i18nc("Textual representation of two files. %1 and %2 are names of files/folders.", "\"%1\" and \"%2\"", items.first().name().replace("&", "&&"), items.last().name().replace("&", "&&"));
break;
case 3:
text = i18nc("Textual representation of three files. %1, %2 and %3 are names of files/folders.",
"\"%1\", \"%2\" and \"%3\"",
- items.first().name(),
- items.at(1).name(),
- items.last().name());
+ items.first().name().replace("&", "&&"),
+ items.at(1).name().replace("&", "&&"),
+ items.last().name().replace("&", "&&"));
break;
case 4:
text = i18nc("Textual representation of four files. %1, %2, %3 and %4 are names of files/folders.",
"\"%1\", \"%2\", \"%3\" and \"%4\"",
- items.first().name(),
- items.at(1).name(),
- items.at(2).name(),
- items.last().name());
+ items.first().name().replace("&", "&&"),
+ items.at(1).name().replace("&", "&&"),
+ items.at(2).name().replace("&", "&&"),
+ items.last().name().replace("&", "&&"));
break;
case 5:
text = i18nc("Textual representation of five files. %1, %2, %3, %4 and %5 are names of files/folders.",
"\"%1\", \"%2\", \"%3\", \"%4\" and \"%5\"",
- items.first().name(),
- items.at(1).name(),
- items.at(2).name(),
- items.at(3).name(),
- items.last().name());
+ items.first().name().replace("&", "&&"),
+ items.at(1).name().replace("&", "&&"),
+ items.at(2).name().replace("&", "&&"),
+ items.at(3).name().replace("&", "&&"),
+ items.last().name().replace("&", "&&"));
break;
default:
text = QString();