summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_s60.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2011-01-11 10:48:38 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2011-01-11 14:22:53 (GMT)
commita601a45f7fbff6df2b39990d0e1dbd00542b9819 (patch)
tree4ccef6d0bc78b9ed03209f99e873e5ba37209351 /src/gui/kernel/qapplication_s60.cpp
parentb58eb0419f9f724af5d9baf8bbce4e0f1e2f3f8b (diff)
downloadQt-a601a45f7fbff6df2b39990d0e1dbd00542b9819.zip
Qt-a601a45f7fbff6df2b39990d0e1dbd00542b9819.tar.gz
Qt-a601a45f7fbff6df2b39990d0e1dbd00542b9819.tar.bz2
Allow use of command line parameters with RApaLsSession::StartApp.
When a Symbian application is launched using RApaLsSession::StartApp, command line parameters can be given with CApaCommandLine::SetTailEndL and will now be correctly interpreted by Qt applications as command line parameters. There are a couple of limitations: 1) The parameters given with CApaCommandLine::SetTailEndL will not be available in main method's argv array; they can be accessed via QCoreApplication::arguments function. 2) CApaCommandLine::SetTailEndL does support any arbitrary binary data as parameter, but only 8-bit string data gets parsed properly into QCoreApplication::arguments. For other kind of tail data, you need to subclass QS60MainAppUi and implement ProcessCommandParametersL callback. Task-number: QTBUG-15987 Reviewed-by: axis
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 4793437..789f198 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1431,21 +1431,20 @@ void qt_init(QApplicationPrivate * /* priv */, int)
// The S60 framework has not been initialized. We need to do it.
TApaApplicationFactory factory(S60->s60ApplicationFactory ?
S60->s60ApplicationFactory : newS60Application);
- CApaCommandLine* commandLine = 0;
- TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
- // After this construction, CEikonEnv will be available from CEikonEnv::Static().
- // (much like our qApp).
- QtEikonEnv* coe = new QtEikonEnv;
- //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there.
- if(err == KErrNone)
- TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine));
- delete commandLine;
- if(err != KErrNone) {
- qWarning() << "qt_init: Eikon application construct failed ("
- << err
- << "), maybe missing resource file on S60 3.1?";
- delete coe;
- qt_symbian_throwIfError(err);
+ CApaCommandLine* commandLine = q_check_ptr(QCoreApplicationPrivate::symbianCommandLine());
+ if (commandLine) {
+ // After this construction, CEikonEnv will be available from CEikonEnv::Static().
+ // (much like our qApp).
+ QtEikonEnv* coe = new QtEikonEnv;
+ //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there.
+ TRAPD(err, coe->ConstructAppFromCommandLineL(factory, *commandLine));
+ if(err != KErrNone) {
+ qWarning() << "qt_init: Eikon application construct failed ("
+ << err
+ << "), maybe missing resource file on S60 3.1?";
+ delete coe;
+ qt_symbian_throwIfError(err);
+ }
}
S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler);