From 0e91875345c4505abac54f6d2cb03252332fcbfb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 11 Mar 2010 15:17:46 +0200 Subject: Support for adding user specified list type content in rss file Added support for the following RSS_RULES variables to improve control over placement of user defined rules inside application registration resource file: RSS_RULES.header - Rule placed before APP_REGISTRATION_INFO RSS_RULES.footer - Rule placed after APP_REGISTRATION_INFO RSS_RULES.service_list - Rule placed inside a SERVICE_INFO item in the service_list of APP_REGISTRATION_INFO RSS_RULES.file_ownership_list - Rule placed inside a FILE_OWNERSHIP_INFO item in the file_ownership_list of APP_REGISTRATION_INFO RSS_RULES.datatype_list - Rule placed inside a DATATYPE item in the datatype_list of APP_REGISTRATION_INFO Task-number: QT-3083 Reviewed-by: Janne Anttila --- doc/src/development/qmake-manual.qdoc | 40 +++++++++---- doc/src/snippets/code/doc_src_qmake-manual.qdoc | 5 ++ qmake/generators/symbian/symmake.cpp | 79 +++++++++++++++++++++---- qmake/generators/symbian/symmake.h | 14 ++++- 4 files changed, 114 insertions(+), 24 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 3157536..7ab3cd2 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -2884,9 +2884,9 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 144 - This will add the specified statement to the end of the generated - registration resource file. As an impact of this statement, the application - will not be visible in application shell. + This will add the specified statement to the end of the \c APP_REGISTRATION_INFO + resource struct in the generated registration resource file. + As an impact of this statement, the application will not be visible in application shell. It is also possible to add multiple rows in a single block. Each double quoted string will be placed on a new row in the registration resource file. @@ -2899,16 +2899,36 @@ For example: platform application shell. In addition it will make the application to be launched in background. - For detailed list of possible RSS statements, please refer to the - Symbian platform help. + For detailed list of possible \c APP_REGISTRATION_INFO statements, please refer to the + Symbian platform help. \note You should not use \c RSS_RULES variable to set the following RSS statements: - - app_file - localisable_resource_file - localisable_resource_id + \c app_file, \c localisable_resource_file, and \c localisable_resource_id. + + These statements are internally handled by qmake. + + There is a number of special modifiers you can attach to \c RSS_RULES to specify where + in the application registration file the rule will be written: + + \table + \header \o Modifier \o Location of the rule + \row \o \o Inside \c APP_REGISTRATION_INFO resource struct. + \row \o .header \o Before \c APP_REGISTRATION_INFO resource struct. + \row \o .footer \o After \c APP_REGISTRATION_INFO resource struct. + \row \o .service_list \o Inside a \c SERVICE_INFO item in the \c service_list + of \c APP_REGISTRATION_INFO + \row \o .file_ownership_list \o Inside a \c FILE_OWNERSHIP_INFO item in the + \c file_ownership_list of \c APP_REGISTRATION_INFO + \row \o .datatype_list \o Inside a \c DATATYPE item in the \c datatype_list of + \c APP_REGISTRATION_INFO + \endtable + + For example: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 151 - These statements are internally handled by qmake. + This example will define service information for a fictional service that requires + an icon to be supplied via the \c opaque_data of the service information. \target S60_VERSION \section1 S60_VERSION diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index e8c00d3..36676ae 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -996,3 +996,8 @@ symbian { emulator_dll.condition = WINSCW } //! [150] + +//! [151] +RSS_RULES.service_list += "uid = 0x12345678; datatype_list = \{\}; opaque_data = r_my_icon;" +RSS_RULES.footer +="RESOURCE CAPTION_AND_ICON_INFO r_my_icon \{ icon_file =\"$$PWD/my_icon.svg\"; \}" +//! [151] diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 9ade699..f906c76 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -69,6 +69,12 @@ #define RSS_RULES_BASE "RSS_RULES." #define RSS_TAG_NBROFICONS "number_of_icons" #define RSS_TAG_ICONFILE "icon_file" +#define RSS_TAG_HEADER "header" +#define RSS_TAG_SERVICE_LIST "service_list" +#define RSS_TAG_FILE_OWNERSHIP_LIST "file_ownership_list" +#define RSS_TAG_DATATYPE_LIST "datatype_list" +#define RSS_TAG_FOOTER "footer" +#define RSS_TAG_DEFAULT "default_rules" // Same as just giving rules without tag #define MMP_TARGET "TARGET" #define MMP_TARGETTYPE "TARGETTYPE" @@ -200,7 +206,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) QString numberOfIcons; QString iconFile; - QStringList userRssRules; + QMap userRssRules; readRssRules(numberOfIcons, iconFile, userRssRules); // Get the application translations and convert to symbian OS lang code, i.e. decical number @@ -1426,7 +1432,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy } } -void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) +void SymbianMakefileGenerator::writeRegRssFile(QMap &userItems) { QString filename(fixedTarget); filename.append("_reg.rss"); @@ -1443,6 +1449,8 @@ void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) t << endl; t << "#include <" << fixedTarget << ".rsg>" << endl; t << "#include " << endl; + foreach(QString item, userItems[RSS_TAG_HEADER]) + t << item << endl; t << endl; t << "UID2 KUidAppRegistrationResourceFile" << endl; t << "UID3 " << uid3 << endl << endl; @@ -1450,16 +1458,51 @@ void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) t << "\t{" << endl; t << "\tapp_file=\"" << fixedTarget << "\";" << endl; t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; + + writeRegRssList(t, userItems[RSS_TAG_SERVICE_LIST], + QLatin1String(RSS_TAG_SERVICE_LIST), + QLatin1String("SERVICE_INFO")); + writeRegRssList(t, userItems[RSS_TAG_FILE_OWNERSHIP_LIST], + QLatin1String(RSS_TAG_FILE_OWNERSHIP_LIST), + QLatin1String("FILE_OWNERSHIP_INFO")); + writeRegRssList(t, userItems[RSS_TAG_DATATYPE_LIST], + QLatin1String(RSS_TAG_DATATYPE_LIST), + QLatin1String("DATATYPE")); t << endl; - foreach(QString item, userItems) - t << "\t" << item << endl; + foreach(QString item, userItems[RSS_TAG_DEFAULT]) + t << "\t" << item.replace("\n","\n\t") << endl; t << "\t}" << endl; + + foreach(QString item, userItems[RSS_TAG_FOOTER]) + t << item << endl; } else { PRINT_FILE_CREATE_ERROR(filename) } } +void SymbianMakefileGenerator::writeRegRssList(QTextStream &t, + QStringList &userList, + const QString &listTag, + const QString &listItem) +{ + int itemCount = userList.count(); + if (itemCount) { + t << "\t" << listTag << " ="<< endl; + t << "\t\t{" << endl; + foreach(QString item, userList) { + t << "\t\t" << listItem << endl; + t << "\t\t\t{" << endl; + t << "\t\t\t" << item.replace("\n","\n\t\t\t") << endl; + t << "\t\t\t}"; + if (--itemCount) + t << ","; + t << endl; + } + t << "\t\t}; "<< endl; + } +} + void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) { QString filename(fixedTarget); @@ -1538,7 +1581,9 @@ void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes) } } -void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) +void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, + QString &iconFile, QMap &userRssRules) { for (QMap::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { if (it.key().startsWith(RSS_RULES_BASE)) { @@ -1550,14 +1595,16 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico QStringList newValues; QStringList values = it.value(); foreach(QString item, values) { - // If there is no stringlist defined for a rule, use rule name directly + // If there is no stringlist defined for a rule, use rule value directly // This is convenience for defining single line statements if (project->values(item).isEmpty()) { newValues << item; } else { + QStringList itemList; foreach(QString itemRow, project->values(item)) { - newValues << itemRow; + itemList << itemRow; } + newValues << itemList.join("\n"); } } // Verify thet there is exactly one value in RSS_TAG_NBROFICONS @@ -1578,6 +1625,14 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico RSS_RULES_BASE, RSS_TAG_ICONFILE); continue; } + } else if (newKey == RSS_TAG_HEADER + || newKey == RSS_TAG_SERVICE_LIST + || newKey == RSS_TAG_FILE_OWNERSHIP_LIST + || newKey == RSS_TAG_DATATYPE_LIST + || newKey == RSS_TAG_FOOTER + || newKey == RSS_TAG_DEFAULT) { + userRssRules[newKey] = newValues; + continue; } else { fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", RSS_RULES_BASE, newKey.toLatin1().constData()); @@ -1586,15 +1641,17 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico } } + QStringList newValues; foreach(QString item, project->values(RSS_RULES)) { - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line mmp statements + // If there is no stringlist defined for a rule, use rule value directly + // This is convenience for defining single line statements if (project->values(item).isEmpty()) { - userRssRules << item; + newValues << item; } else { - userRssRules << project->values(item); + newValues << project->values(item); } } + userRssRules[RSS_TAG_DEFAULT] << newValues; // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist // or neither of them exist diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index ca697b4..9de852a 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -107,7 +107,10 @@ protected: QString &checkString); void writeHeader(QTextStream &t); - void writeBldInfContent(QTextStream& t, bool addDeploymentExtension, const QString &iconFile, DeploymentList &depList); + void writeBldInfContent(QTextStream& t, + bool addDeploymentExtension, + const QString &iconFile, + DeploymentList &depList); static bool removeDuplicatedStrings(QStringList& stringList); @@ -127,10 +130,15 @@ protected: void writeCustomDefFile(); - void writeRegRssFile(QStringList &useritems); + void writeRegRssFile(QMap &useritems); + void writeRegRssList(QTextStream &t, QStringList &userList, + const QString &listTag, + const QString &listItem); void writeRssFile(QString &numberOfIcons, QString &iconfile); void writeLocFile(QStringList &symbianLangCodes); - void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); + void readRssRules(QString &numberOfIcons, + QString &iconFile, + QMap &userRssRules); QStringList symbianLangCodesFromTsFiles(); void fillQt2S60LangMapTable(); -- cgit v0.12