diff options
author | Gatis Paeglis <gatis.paeglis@digia.com> | 2014-06-11 11:37:58 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-11 15:01:06 +0200 |
commit | d06c6d8a51c9bd79396471f4131ac67f1d11e2c2 (patch) | |
tree | 4aa99154056ee1e3828fba8652d6bb54772d2596 /src/plugins/platforminputcontexts/compose | |
parent | 857c82f8a4a29399733218f783241b839b939f58 (diff) |
Compose key plugin: expand "%L" to full path.
According to [1] "%L" should expand to a full path for the
default (based on system's locale) Compose file.
[1] http://www.x.org/archive/current/doc/man/man5/Compose.5.xhtml
Task-number: QTBUG-35943
Change-Id: Ie803a89742d9c0aa3b2d759bea28ed403dc68c9c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/plugins/platforminputcontexts/compose')
-rw-r--r-- | src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 21 | ||||
-rw-r--r-- | src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h | 3 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index ea0b5261c4..395bb5b090 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -111,21 +111,17 @@ void TableGenerator::findComposeFile() } // check for the system provided compose files if (!found && cleanState()) { - QByteArray loc = locale().toUpper().toUtf8(); - QString table = readLocaleMappings(loc); - if (table.isEmpty()) - table = readLocaleMappings(readLocaleAliases(loc)); - + QString table = composeTableForLocale(); if (cleanState()) { if (table.isEmpty()) // no table mappings for the system's locale in the compose.dir m_state = UnsupportedLocale; else - found = processFile(systemComposeDir() + QLatin1String("/") + table); + found = processFile(systemComposeDir() + QLatin1Char('/') + table); #ifdef DEBUG_GENERATOR if (found) qDebug() << "Using Compose file from: " << - systemComposeDir() + QLatin1String("/") + table; + systemComposeDir() + QLatin1Char('/') + table; #endif } } @@ -137,6 +133,15 @@ void TableGenerator::findComposeFile() m_state = MissingComposeFile; } +QString TableGenerator::composeTableForLocale() +{ + QByteArray loc = locale().toUpper().toUtf8(); + QString table = readLocaleMappings(loc); + if (table.isEmpty()) + table = readLocaleMappings(readLocaleAliases(loc)); + return table; +} + bool TableGenerator::findSystemComposeDir() { bool found = false; @@ -311,7 +316,7 @@ void TableGenerator::parseIncludeInstruction(QString line) // expand substitutions if present line.replace(QLatin1String("%H"), QString(qgetenv("HOME"))); - line.replace(QLatin1String("%L"), locale()); + line.replace(QLatin1String("%L"), systemComposeDir() + QLatin1Char('/') + composeTableForLocale()); line.replace(QLatin1String("%S"), systemComposeDir()); processFile(line); diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h index 248c09f3ea..6ce89cfe77 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h @@ -118,13 +118,14 @@ protected: void findComposeFile(); bool findSystemComposeDir(); QString systemComposeDir(); + QString composeTableForLocale(); ushort keysymToUtf8(quint32 sym); QString readLocaleMappings(const QByteArray &locale); QByteArray readLocaleAliases(const QByteArray &locale); void initPossibleLocations(); - bool cleanState() const { return ((m_state & NoErrors) == NoErrors); } + bool cleanState() const { return m_state == NoErrors; } QString locale() const; private: |