summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Vanini <silhusk@gmail.com>2016-07-04 09:16:50 (GMT)
committerCarlo Vanini <silhusk@gmail.com>2016-07-04 09:18:11 (GMT)
commit0b0c3f8d1e6314a97264072c7907ddc02dc94649 (patch)
tree6fab4d07bed43dbd7e55f2606f1b27be42bddaf9
parenta06c7417542e07bb103b888c7d76c0617657aa28 (diff)
Remove leading space in description only if present.
When descriptions are loaded from translation files they start with a leading whitespace. But when translations are missing that space is not present. Therefore, remove the first character only if it actully is a space. BUG: 316650 REVIEW: 128337 Testing Done: Tested with Muon Before patching: * sudo apt-get -o=Acquire::Languages=none update * run Muon and notice the missing character After patching: * run Muon, the character is there * sudo apt-get update # get back translations * run Muon, correct description, no leading whitespace
-rw-r--r--src/package.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/package.cpp b/src/package.cpp
index 0526f9d..6184a4c 100644
--- a/src/package.cpp
+++ b/src/package.cpp
@@ -313,7 +313,9 @@ QString Package::longDescription() const
// Merge multiple whitespace chars into one
sections[i].replace(QRegExp(QLatin1String("\\ \\ +")), QChar::fromLatin1(' '));
// Remove the initial whitespace
- sections[i].remove(0, 1);
+ if (sections[i].startsWith(QChar::Space)) {
+ sections[i].remove(0, 1);
+ }
// Append to parsedDescription
if (sections[i].startsWith(QLatin1String("\n ") % QString::fromUtf8("\xE2\x80\xA2 ")) || !i) {
parsedDescription += sections[i];