Summary: | Form completion does not work when name of form element contains [] | ||
---|---|---|---|
Product: | [Frameworks and Libraries] kdelibs | Reporter: | Sebastian Kratzert <krase> |
Component: | general | Assignee: | Thomas Braxton <brax108> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
formcompletion.diff
patch KConfigBase to handle entries with embedded [] |
Description
Sebastian Kratzert
2005-09-10 19:58:47 UTC
Created attachment 12521 [details]
formcompletion.diff
Dupe of this one #107170? No i don't think so. #107170 is only about browsing files. Created attachment 16811 [details]
patch KConfigBase to handle entries with embedded []
This is actually a KConfig bug. KConfig uses [] to delimit the locale and
options/flags on the entry, so an entry with embedded [ or ] confuses the
parser when it tries to read the entry back in. After you apply this patch you
can edit your config files to replace embedded [/] with %5b/%5d and KConfig
should be able to read them back in.
SVN commit 556653 by braxton: allow embedded [] in entry names. This fixes the parser, instead of KConfigBase. BUG: 112379 M +22 -2 kconfigbackend.cpp --- branches/KDE/3.5/kdelibs/kdecore/kconfigbackend.cpp #556652:556653 @@ -211,6 +211,26 @@ return result; } +static QCString encodeKey(const char* key) +{ + QCString newKey(key); + + newKey.replace('[', "%5b"); + newKey.replace(']', "%5d"); + + return newKey; +} + +static QCString decodeKey(const char* key) +{ + QCString newKey(key); + + newKey.replace("%5b", "["); + newKey.replace("%5d", "]"); + + return newKey; +} + class KConfigBackEnd::KConfigBackEndPrivate { public: @@ -675,7 +695,7 @@ QCString val = printableToString(st, s - st); //qDebug("found key '%s' with value '%s'", key.data(), val.data()); - KEntryKey aEntryKey(aCurrentGroup, key); + KEntryKey aEntryKey(aCurrentGroup, decodeKey(key)); aEntryKey.bLocal = (locale != 0); aEntryKey.bDefault = bDefault; @@ -870,7 +890,7 @@ firstEntry = false; // it is data for a group - fputs(key.mKey.data(), pStream); // Key + fputs(encodeKey(key.mKey.data()), pStream); // Key if ( currentEntry.bNLS ) { |