diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-14 12:54:02 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-14 12:54:02 (GMT) |
commit | 3e4d8596edd8061a81f641df4f09d018b73c81f0 (patch) | |
tree | 9b474de460f44c65eba61b7b5b8c01dac22bf275 /src/script/api/qscriptengine.cpp | |
parent | b371999d3e9c207047be6afda89d008b6cf04763 (diff) | |
parent | 62cd360b3f2ef9e9787359a9105fd805b721b49f (diff) | |
download | Qt-3e4d8596edd8061a81f641df4f09d018b73c81f0.zip Qt-3e4d8596edd8061a81f641df4f09d018b73c81f0.tar.gz Qt-3e4d8596edd8061a81f641df4f09d018b73c81f0.tar.bz2 |
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration:
Provide overview for Symbian capabilities.
Fix QNX screen initialization
tst_qftp: Attempting to reproduce a crash
QNAM HTTP: Do not pipeline with WebLogic servers
Autotest: update path location on the test server
Autotest: update location of fluke.gif on test server
Make qsTr work in global scope
Not possible to show selected text in virtual keyboard
Fix typos, there is no QT_NO_SSL
Export .flm files always if they are different
Make qmake possible to build with mingw using qmake.pro
QS60Style: Single Click UI support for SD 9.2 time-box
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 2417d80..58c8d83 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -42,6 +42,7 @@ #include <math.h> +#include "CodeBlock.h" #include "Error.h" #include "JSLock.h" #include "Interpreter.h" @@ -792,9 +793,18 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT JSC::UString context; - QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec); - if (ctx && ctx->parentContext()) - context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName(); + // The first non-empty source URL in the call stack determines the translation context. + { + JSC::ExecState *frame = exec->removeHostCallFrameFlag(); + while (frame) { + if (frame->codeBlock() && frame->codeBlock()->source() + && !frame->codeBlock()->source()->url().isEmpty()) { + context = QFileInfo(frame->codeBlock()->source()->url()).baseName(); + break; + } + frame = frame->callerFrame()->removeHostCallFrameFlag(); + } + } #endif JSC::UString text = args.at(0).toString(exec); #ifndef QT_NO_QOBJECT |