diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-11-07 15:42:42 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-11-07 16:12:51 (GMT) |
commit | 865ad5053f053c9274973bb07e9f0ca04fd043d3 (patch) | |
tree | 9b13e3a7580b9ae8dee510b7cecb7d136dd7f659 /src | |
parent | 3342cd1a4003912dfb419dbe4d3babd1f9c30173 (diff) | |
download | Qt-865ad5053f053c9274973bb07e9f0ca04fd043d3.zip Qt-865ad5053f053c9274973bb07e9f0ca04fd043d3.tar.gz Qt-865ad5053f053c9274973bb07e9f0ca04fd043d3.tar.bz2 |
symbian - handle path being passed as part of filename in QTranslator
Although incorrect API usage, this was a regression from 4.7.3 behaviour
Task-number: QTBUG-22489
Reviewed-by: mread
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qtranslator.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 8c08760..ca30db1 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -405,13 +405,26 @@ bool QTranslator::load(const QString & filename, const QString & directory, Q_D(QTranslator); d->clear(); + QString fname = filename; QString prefix; if (QFileInfo(filename).isRelative()) { #ifdef Q_OS_SYMBIAN - if (directory.isEmpty()) + //TFindFile doesn't like path in the filename + QString dir(directory); + int slash = filename.lastIndexOf(QLatin1Char('/')); + slash = qMax(slash, filename.lastIndexOf(QLatin1Char('\\'))); + if (slash >=0) { + //so move the path component into the directory prefix + if (dir.isEmpty()) + dir = filename.left(slash + 1); + else + dir = dir + QLatin1Char('/') + filename.left(slash + 1); + fname = fname.mid(slash + 1); + } + if (dir.isEmpty()) prefix = QCoreApplication::applicationDirPath(); else - prefix = QFileInfo(directory).absoluteFilePath(); //TFindFile doesn't like dirty paths + prefix = QFileInfo(dir).absoluteFilePath(); //TFindFile doesn't like dirty paths if (prefix.length() > 2 && prefix.at(1) == QLatin1Char(':') && prefix.at(0).isLetter()) prefix[0] = QLatin1Char('Y'); #else @@ -425,7 +438,6 @@ bool QTranslator::load(const QString & filename, const QString & directory, QString nativePrefix = QDir::toNativeSeparators(prefix); #endif - QString fname = filename; QString realname; QString delims; delims = search_delimiters.isNull() ? QString::fromLatin1("_.") : search_delimiters; |