From f6d645b54dd11ac8d12da12751a88e831e3f3415 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 5 Oct 2010 17:20:29 +0300 Subject: Added .flags modifier support for DEPLOYMENT items in Symbian The .flags modifier can be used to specify pkg flags for files. For example, to make default application run after install: default_bin_deployment.flags += FR RI For example, to show a note at installation time: notedep.sources = install_note.txt notedep.flags = FT TC DEPLOYMENT += notedep See Symbian package file format documentation for exact supported flag values. Cherry picked to 4.7 branch from master branch as part of QTBUG-15068, original commit: 50b2477e6ffd64a0730cc5c0f0a6190b1a6b5861 Task-number: QTBUG-15068 Task-number: QTBUG-13367 Reviewed-by: Janne Anttila --- doc/src/development/qmake-manual.qdoc | 17 +++++++++++++++++ doc/src/snippets/code/doc_src_qmake-manual.qdoc | 7 +++++++ .../generators/symbian/initprojectdeploy_symbian.cpp | 20 ++++++++++++++------ qmake/generators/symbian/initprojectdeploy_symbian.h | 6 +++++- qmake/generators/symbian/symbiancommon.cpp | 20 ++++++++++++++++++-- 5 files changed, 61 insertions(+), 9 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 278822e..883c9d8 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1474,6 +1474,23 @@ This will entirely remove the default application deployment. + On the Symbian platform, you can specify file specific install options + with \c{.flags} modifier. Please consult the Symbian platform documentation + for supported options. + + For example: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 155 + + This will show a message box that gives user an option to cancel the + installation and then automatically runs the application after + installation is complete. + + \note Automatically running the applications after install may require signing + the package with better than self-signed certificate, depending on the phone model. + Additionally, some tools such as Runonphone may not work properly with sis + packages that automatically run the application upon install. + On the Symbian platform, you can use \c{DEPLOYMENT.installer_header} variable to generate smart installer wrapper for your application. If you specify just UID of the installer package as the value, then diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index 20d8d45..a5bc1f3 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -1018,3 +1018,10 @@ DEPLOYMENT += my_note //! [154] DEPLOYMENT -= default_bin_deployment default_resource_deployment default_reg_deployment //! [154] + +//! [155] +default_bin_deployment.flags += FILERUN RUNINSTALL +dep_note.sources = install_note.txt +dep_note.flags = FILETEXT TEXTEXIT +DEPLOYMENT += dep_note +//! [155] diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 5963773..22a4a82 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -253,6 +253,8 @@ void initProjectDeploySymbian(QMakeProject* project, continue; } + QStringList flags = project->values(item + ".flags"); + foreach(QString source, project->values(item + ".sources")) { source = Option::fixPathToLocalOS(source); QString nameFilter; @@ -284,13 +286,15 @@ void initProjectDeploySymbian(QMakeProject* project, Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), false, true), fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") - + info.fileName()))); + + info.fileName()), + flags)); } else { deploymentList.append(CopyItem( Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), false, true), fixPathToEpocOS(deploymentDrive + QLatin1String("/" SYSBIN_DIR "/") - + info.fileName()))); + + info.fileName()), + flags)); } } if (isPlugin(info, devicePath)) { @@ -301,7 +305,8 @@ void initProjectDeploySymbian(QMakeProject* project, // Generate deployment even if file doesn't exist, as this may be the case // when generating .pkg files. deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()), - fixPathToEpocOS(devicePath + "/" + info.fileName()))); + fixPathToEpocOS(devicePath + "/" + info.fileName()), + flags)); continue; } } @@ -328,12 +333,14 @@ void initProjectDeploySymbian(QMakeProject* project, deploymentList.append(CopyItem( Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") - + iterator.fileName()))); + + iterator.fileName()), + flags)); } else { deploymentList.append(CopyItem( Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), fixPathToEpocOS(deploymentDrive + QLatin1String("/" SYSBIN_DIR "/") - + iterator.fileName()))); + + iterator.fileName()), + flags)); } } createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize), @@ -343,7 +350,8 @@ void initProjectDeploySymbian(QMakeProject* project, deploymentList.append(CopyItem( Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), fixPathToEpocOS(devicePath + "/" + absoluteItemPath.right(diffSize) - + "/" + iterator.fileName()))); + + "/" + iterator.fileName()), + flags)); } } } diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h index 2653d2a..bc17b04 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.h +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -56,9 +56,13 @@ struct CopyItem { - CopyItem(const QString& f, const QString& t) : from(f) , to(t) { } + CopyItem(const QString& f, const QString& t) + : from(f) , to(t) { } + CopyItem(const QString& f, const QString& t, const QStringList& l) + : from(f) , to(t), flags(l) { } QString from; QString to; + QStringList flags; }; typedef QList DeploymentList; diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index c0a6626..5e8bc4a 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -397,6 +397,15 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB for (int i = 0; i < depList.size(); ++i) { QString from = depList.at(i).from; QString to = depList.at(i).to; + QString flags; + bool showOnlyFile = false; + foreach(QString flag, depList.at(i).flags) { + if (flag == QLatin1String("FT") + || flag == QLatin1String("FILETEXT")) { + showOnlyFile = true; + } + flags.append(QLatin1Char(',')).append(flag); + } if (epocBuild) { // Deploy anything not already deployed from under epoc32 instead from under @@ -410,8 +419,15 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB } } - t << QString("\"%1\" - \"%2\"").arg(from.replace('\\','/')).arg(to) << endl; - ts << QString("\"\" - \"%1\"").arg(romPath(to)) << endl; + // Files with "FILETEXT"/"FT" flag are meant for showing only at installation time + // and therefore do not belong to the stub package and will not install the file into phone. + if (showOnlyFile) + to.clear(); + else + ts << QString("\"\" - \"%1\"").arg(romPath(to)) << endl; + + t << QString("\"%1\" - \"%2\"%3").arg(from.replace('\\','/')).arg(to).arg(flags) << endl; + } t << endl; ts << endl; -- cgit v0.12