diff --git a/ECL/LICENSE b/ECL/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/ECL/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/ECL/README.md b/ECL/README.md new file mode 100755 index 0000000..5e27750 --- /dev/null +++ b/ECL/README.md @@ -0,0 +1,88 @@ +BB10_ECL - Emergency Contact List Application. +======== + +## Description + +The Emergency Contact List (ECL) Application stores and displays the latest +emergency contact list. It allows the user to display the list and then +call, email, or sms the appropriate contact. + +The contact list is updated by a push to the device. When a new list is +received, a local copy of that list is stored. The user can start the +application manually. Since the data is stored locally it is available +when offline. + +## Data Transports and Upgrading to ECL + +This version of ECL uses JSON (JavaScript Object Notation) as a transport for efficiency. +For those upgrading from earlier versions of ECL, you should export your XLS to CSV and +then use a standard tool like csv2json (https://github.com/shawnbot/csv2json) to convert +that data to a compact and usable transport. As an alternative, you may do on-the-fly +binary conversion of the Excel XLS format with a server-side tool like Apache POI +(http://poi.apache.org), but this solution would require a Java Application server and +is beyond the scope of this document to set up. + +There is a blog @ http://devblog.blackberry.com that goes into this migration path in +greater detail. + + +## How to Build + +1. Import the project into QNX Momentics IDE. + +2. Build the application using build option in IDE. + +3. To deploy use the Run option from IDE. + +## File Structure + +bar-descriptor.xml - Cascades project file. Contains application parameters +and permissions. + +assets: + /data: This folder contains a configuration file and sample json and text + files for testing. + /data/ecl_data.txt: This file is used in the "Demo with Text File" feature. + It is converted to a json file using the config.json file below. + This file has contact data formatted in a similar manner as in + the ECL Application on the BB 7 Platform. + /data/config.json: This json is used to map fields from Text File to json + for the above text file. + /data/ecl_data.json: This is used to support the "Demo with JSON File" + feature. This json is used to populate the Contact list in the + application. + /images: images and icons for the application. + UI qml files. + + +src: + eclconfig: Config file with application ENUMs and utility functions maps + json fields with display strings. + eclcontact: Implements the adding the ECL contact to device address book. + ecldatamodel: Data model, loads and holds data from json file. + ecllistitem: Custom list item. + eclutils: Utility functions. + filtereddatamodel: Filtered data model, used for expandable and collapsible + list. + main: Application main file. + pushclient\pushclientnotification: Push notification handler. + pushclient\pushconfiguration: Push related configuration file. + + +## Server Component + +The server/index.htm is a small test application that can be used to send requests +to the enterprise server to push an emergency contact list to a device/phone. +This is a standalone HTML file and can run directly from the BlackBerry filesystem, +on a simple webserver (like Apache or Nginx), or packaged and deployed as a hybrid app +itself on BlackBerry platforms. + +## Known Issues +- Initiating calls doesn’t work on work perimeter. +- SMS sending feature is not implemented. + +## More Info + +Icons from BBUI.js and also Myers Design Limited (http://myersdesign.com/). + + diff --git a/ECL/app/.cproject b/ECL/app/.cproject new file mode 100755 index 0000000..4c31f72 --- /dev/null +++ b/ECL/app/.cproject @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + make + -j4 + Device-Release + true + true + true + + + + diff --git a/ECL/app/.project b/ECL/app/.project new file mode 100755 index 0000000..1ab0372 --- /dev/null +++ b/ECL/app/.project @@ -0,0 +1,96 @@ + + + ECL + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + Device-Debug + + + org.eclipse.cdt.make.core.buildArguments + -j4 + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + true + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + Device-Debug + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + com.rim.tad.tools.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + com.rim.tad.tools.qml.core.qmlFileBuilder + + + + + com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder + + + + + + com.rim.tad.tools.wst.jsdt.core.jsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + com.qnx.tools.ide.bbt.core.bbtnature + org.eclipse.cdt.core.ccnature + com.rim.tad.tools.qml.core.qmlNature + + diff --git a/ECL/app/.settings/org.eclipse.cdt.codan.core.prefs b/ECL/app/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100755 index 0000000..3858d80 --- /dev/null +++ b/ECL/app/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,67 @@ +com.rim.tad.tools.qml.core.qtsyntaxproblem=-Error +com.rim.tad.tools.qml.core.qtsyntaxproblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +eclipse.preferences.version=1 +org.eclipse.cdt.codan.checkers.errnoreturn=Warning +org.eclipse.cdt.codan.checkers.errnoreturn.params={implicit\=>false} +org.eclipse.cdt.codan.checkers.errreturnvalue=Error +org.eclipse.cdt.codan.checkers.errreturnvalue.params={} +org.eclipse.cdt.codan.checkers.noreturn=Error +org.eclipse.cdt.codan.checkers.noreturn.params={implicit\=>false} +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=-Error +org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=-Error +org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={} +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error +org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={} +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning +org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false} +org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning +org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={unknown\=>false,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=-Error +org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=-Error +org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=-Error +org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.InvalidArguments=-Error +org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=-Error +org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=-Error +org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=-Error +org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=-Error +org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info +org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning +org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={} +org.eclipse.cdt.codan.internal.checkers.OverloadProblem=-Error +org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=-Error +org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=-Error +org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={} +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning +org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={} +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning +org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={macro\=>true,exceptions\=>()} +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={paramNot\=>false} +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning +org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={else\=>false,afterelse\=>false} +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=-Error +org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={macro\=>true} +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning +org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={macro\=>true,exceptions\=>("@(\#)","$Id")} +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=-Error +org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}} diff --git a/ECL/app/.settings/org.eclipse.cdt.core.prefs b/ECL/app/.settings/org.eclipse.cdt.core.prefs new file mode 100755 index 0000000..268f543 --- /dev/null +++ b/ECL/app/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,49 @@ +eclipse.preferences.version=1 +environment/project/com.qnx.qcc.toolChain.1000361/CPULIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.1000361/CPULIST/operation=append +environment/project/com.qnx.qcc.toolChain.1000361/CPULIST/value=arm +environment/project/com.qnx.qcc.toolChain.1000361/VARIANTLIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.1000361/VARIANTLIST/operation=append +environment/project/com.qnx.qcc.toolChain.1000361/VARIANTLIST/value=g +environment/project/com.qnx.qcc.toolChain.1000361/append=true +environment/project/com.qnx.qcc.toolChain.1000361/appendContributed=true +environment/project/com.qnx.qcc.toolChain.107664675/CPULIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.107664675/CPULIST/operation=append +environment/project/com.qnx.qcc.toolChain.107664675/CPULIST/value=x86 +environment/project/com.qnx.qcc.toolChain.107664675/VARIANTLIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.107664675/VARIANTLIST/operation=append +environment/project/com.qnx.qcc.toolChain.107664675/VARIANTLIST/value=g +environment/project/com.qnx.qcc.toolChain.107664675/append=true +environment/project/com.qnx.qcc.toolChain.107664675/appendContributed=true +environment/project/com.qnx.qcc.toolChain.1419942408/CPULIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.1419942408/CPULIST/operation=append +environment/project/com.qnx.qcc.toolChain.1419942408/CPULIST/value=x86 +environment/project/com.qnx.qcc.toolChain.1419942408/EXCLUDE_VARIANTLIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.1419942408/EXCLUDE_VARIANTLIST/operation=append +environment/project/com.qnx.qcc.toolChain.1419942408/EXCLUDE_VARIANTLIST/value=c +environment/project/com.qnx.qcc.toolChain.1419942408/append=true +environment/project/com.qnx.qcc.toolChain.1419942408/appendContributed=true +environment/project/com.qnx.qcc.toolChain.1767760804/CPULIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.1767760804/CPULIST/operation=append +environment/project/com.qnx.qcc.toolChain.1767760804/CPULIST/value=arm +environment/project/com.qnx.qcc.toolChain.1767760804/EXCLUDE_VARIANTLIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.1767760804/EXCLUDE_VARIANTLIST/operation=append +environment/project/com.qnx.qcc.toolChain.1767760804/EXCLUDE_VARIANTLIST/value=r +environment/project/com.qnx.qcc.toolChain.1767760804/append=true +environment/project/com.qnx.qcc.toolChain.1767760804/appendContributed=true +environment/project/com.qnx.qcc.toolChain.682812767/CPULIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.682812767/CPULIST/operation=append +environment/project/com.qnx.qcc.toolChain.682812767/CPULIST/value=x86 +environment/project/com.qnx.qcc.toolChain.682812767/EXCLUDE_VARIANTLIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.682812767/EXCLUDE_VARIANTLIST/operation=append +environment/project/com.qnx.qcc.toolChain.682812767/EXCLUDE_VARIANTLIST/value=p +environment/project/com.qnx.qcc.toolChain.682812767/append=true +environment/project/com.qnx.qcc.toolChain.682812767/appendContributed=true +environment/project/com.qnx.qcc.toolChain.763810564/CPULIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.763810564/CPULIST/operation=append +environment/project/com.qnx.qcc.toolChain.763810564/CPULIST/value=arm +environment/project/com.qnx.qcc.toolChain.763810564/EXCLUDE_VARIANTLIST/delimiter=, +environment/project/com.qnx.qcc.toolChain.763810564/EXCLUDE_VARIANTLIST/operation=append +environment/project/com.qnx.qcc.toolChain.763810564/EXCLUDE_VARIANTLIST/value=c +environment/project/com.qnx.qcc.toolChain.763810564/append=true +environment/project/com.qnx.qcc.toolChain.763810564/appendContributed=true diff --git a/ECL/app/ECL.pro b/ECL/app/ECL.pro new file mode 100755 index 0000000..399393f --- /dev/null +++ b/ECL/app/ECL.pro @@ -0,0 +1,30 @@ +APP_NAME = ECL + +CONFIG += qt warn_on cascades10 + +LIBS += -lbbdata +LIBS += -lbbsystem +LIBS += -lbb +LIBS += -lbbpim +LIBS += -lbbnetwork +LIBS += -lbbplatform + +BASEDIR = $$quote($$_PRO_FILE_PWD_) + +INCLUDEPATH += \ + $$quote(${QNX_TARGET}/usr/include/bb/device) \ + $$quote(${QNX_TARGET}/usr/include/bb/data) + +DEPENDPATH += $$quote(${QNX_TARGET}/usr/include/bb/device) \ + $$quote(${QNX_TARGET}/usr/include/bb/data) + + +INCLUDEPATH += ../src ../src/pushclient +SOURCES += ../src/*.cpp ../src/pushclient/*.cpp +HEADERS += ../src/*.hpp ../src/*.h ../src/pushclient/*.hpp ../src/pushclient/*.h + +lupdate_inclusion { + SOURCES += ../assets/*.qml +} + +TRANSLATIONS = $$quote($${TARGET}.ts) diff --git a/ECL/app/Makefile b/ECL/app/Makefile new file mode 100755 index 0000000..d896fe4 --- /dev/null +++ b/ECL/app/Makefile @@ -0,0 +1,6 @@ +QMAKE_TARGET = ECL +PROJECT_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) +I18N_DIR := $(PROJECT_DIR)/translations + +include mk/cs-base.mk + diff --git a/ECL/app/assets/.assets.index b/ECL/app/assets/.assets.index new file mode 100755 index 0000000..7888776 --- /dev/null +++ b/ECL/app/assets/.assets.index @@ -0,0 +1,22 @@ +1 +20 +data/config.json +data/ecl_data.json +data/ecl_data.txt +EclHeaderListitem.qml +images/action_addcontact.png +images/backup.png +images/bbm.png +images/cell.png +images/chat.png +images/email.png +images/forward.png +images/header.png +images/mail.png +images/office.png +images/outgoingcall.png +images/sms.png +images/up.png +main.qml +phonelist.qml +viewdetails.qml diff --git a/ECL/app/assets/EclHeaderListitem.qml b/ECL/app/assets/EclHeaderListitem.qml new file mode 100755 index 0000000..1aecf12 --- /dev/null +++ b/ECL/app/assets/EclHeaderListitem.qml @@ -0,0 +1,74 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* +* This is custom Header list Item for ECL groups +* +*****************************************************************************/ + +import bb.cascades 1.0 + +Container { + id: headerListitem + property string title + property bool isExpand: true + layout: StackLayout { + orientation: LayoutOrientation.TopToBottom + } + Container { + layout: DockLayout { + } + ImageView { + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + imageSource: "asset:///images/header.png" + } + Container { + id: innerContainer + layout: DockLayout { + } + verticalAlignment: VerticalAlignment.Center + Label { + bottomMargin: 10 + text: headerListitem.title + preferredWidth: innerContainer.maxWidth + horizontalAlignment: HorizontalAlignment.Left + textStyle { + base: SystemDefaults.TextStyles.TitleText + } + } + Container { + rightPadding: 20 + verticalAlignment: VerticalAlignment.Center + horizontalAlignment: HorizontalAlignment.Right + ImageView { + id: imageView + imageSource: "images/up.png" + animations: [ + RotateTransition { + id: rotateAnimation + duration: 100 + } + ] + } + } + } + } + onIsExpandChanged: { + console.log("isExpandChanged ", isExpand); + rotateAnimation.toAngleZ = isExpand ? 0 : 180 + rotateAnimation.play(); + } +} diff --git a/ECL/app/assets/data/config.json b/ECL/app/assets/data/config.json new file mode 100755 index 0000000..4dc1d3a --- /dev/null +++ b/ECL/app/assets/data/config.json @@ -0,0 +1,9 @@ +{ + "name": "Name", + "role": "Role", + "Office": "OfficePhone", + "Cell": "CellPhone", + "Email": "Email", + "BlackBerry pin": "BBPin", + "Prime Backup": "Backup" +} \ No newline at end of file diff --git a/ECL/app/assets/data/ecl_data.json b/ECL/app/assets/data/ecl_data.json new file mode 100755 index 0000000..023557a --- /dev/null +++ b/ECL/app/assets/data/ecl_data.json @@ -0,0 +1,125 @@ +[ + { + "Title": "Operations Team", + "list": [ + { + "Name": "John Doe", + "Role": "Sr. Vice President, Operations", + "OfficePhone": "519 555-1111", + "CellPhone": "519 555-1222", + "Email": "john.doe@email.xyz.com", + "BBPin": "1111111F", + "Backup": "Jason Spencer" + }, + { + "Name": "Jason Spencer", + "Role": "Manager, Manufacturing Operations", + "OfficePhone": "519 555-2111", + "CellPhone": "519 555-2222", + "Email": "john.flow@Email.xyz.com", + "BBPin": "2222222F", + "Backup": "undefined" + }, + { + "Name": "Jack Smith", + "Role": "Manager, Transportation Operations", + "OfficePhone": "519 555-3111", + "CellPhone": "519 555-3222", + "Email": "jack.smith@email.xyz.com", + "BBPin": "3333333F", + "Backup": "Julian Migs" + } + ] + }, + { + "Title": "Support Team", + "list": [ + { + "Name": "Julian Migs", + "Role": "Team Planner", + "OfficePhone": "519 555-4111", + "CellPhone": "519 555-4222", + "Email": "julian@email.xyz.com", + "BBPin": "undefined", + "Backup": "Ricky Williams" + }, + { + "Name": "Ricky Williams", + "Role": "Vice President, Plannning", + "OfficePhone": "519 555-5111", + "CellPhone": "519 555-2222", + "Email": "ricky@email.xyz.com", + "BBPin": "undefined", + "Backup": "Neville DeGauss" + }, + { + "Name": "Neville DeGauss", + "Role": "Feline Affairs Specialist", + "OfficePhone": "519 555-6111", + "CellPhone": "519 555-6222", + "Email": "Neville@email.xyz.com", + "BBPin": "undefined", + "Backup": "Randy" + }, + { + "Name": "Randy Whitt", + "Role": "Assistant Weekend Supervisor", + "OfficePhone": "519 555-7111", + "Email": "randy@email.xyz.com", + "BBPin": "undefined", + "Backup": "Julian Migs" + } + ] + }, + { + "Title": "Communications Team", + "list": [ + { + "Name": "Linus Saarinen", + "Role": "Chief Food Executive", + "OfficePhone": "519 555-8111", + "CellPhone": "519 555-8222", + "Email": "linus.saarinen@email.xyz.com", + "BBPin": "undefined", + "Backup": "Lucy" + }, + { + "Name": "Lucy Liu", + "Role": "Assistant Pianist", + "CellPhone": "519 555-9222", + "Email": "lucy.liu@email.xyz.com", + "BBPin": "9999999F", + "Backup": "Linus" + } + ] + }, + { + "Title": "Testing Team", + "list": [ + { + "Name": "Steven Cho", + "Role": "Head Pachyderm Handler", + "OfficePhone": " 519 555-8111", + "CellPhone": " 519 555-8222", + "Email": "steven.cho@email.xyz.com", + "Backup": " Lucy" + }, + { + "Name": "Rakesh Nambiar", + "Role": "Canine Specialist", + "OfficePhone": " 519 555-9111", + "CellPhone": " 519 555-9222", + "Email": "rakesh.nambiar@email.xyz.com", + "BBPin": "9996999F" + }, + { + "Name": "Mika Sarinen", + "Role": "T-Rex Wrangler", + "OfficePhone": " 519 555-9111", + "CellPhone": " 519 555-9222", + "Email": "mika.sarinen@email.xyz.com", + "BBPin": "9925469F" + } + ] + } +] \ No newline at end of file diff --git a/ECL/app/assets/data/ecl_data.txt b/ECL/app/assets/data/ecl_data.txt new file mode 100755 index 0000000..b687d52 --- /dev/null +++ b/ECL/app/assets/data/ecl_data.txt @@ -0,0 +1 @@ +NEXT_GROUP;Operations Team;NEW_CONTACT;John Martin;Sr. Vice President, Operations;Office: 519 555-1111;Cell: 519 555-1222;Email: john.doe@email.xyz.com;BlackBerry pin:1111111F;Prime Backup: John Flow;NEW_CONTACT;John Flow;Manager, Manufacturing Operations;Office: 519 555-2111;Cell: 519 555-2222;Email: john.flow@email.xyz.com;BlackBerry pin:2222222F;Prime Backup: ;NEW_CONTACT;John Snow;Manager, Transportation Operations;Office: 519 555-3111;Cell: 519 555-3222;Email: john.snow@email.xyz.com;BlackBerry pin:3333333F;Prime Backup: Julian;NEXT_GROUP;Support Team;NEW_CONTACT;Julian Migs;Team Planner;Office: 519 555-4111;Cell: 519 555-4222;Email: julian@email.xyz.com;Prime Backup: Ricky;NEW_CONTACT;Ricky Williams;Vice President, Plannning;Office: 519 555-5111;Cell: 519 555-5222;Email: ricky@email.xyz.com;NEW_CONTACT;Bubbles Devil;Feline Affairs Specialist;Office: 519 555-6111;Cell: 519 555-6222;Email: bubbles@email.xyz.com;NEW_CONTACT;Randy Whitt;Assistant Weekend Supervisor;Office: 519 555-7111;Cell: 519 555-7222;Email: randy@email.xyz.com;NEXT_GROUP;Communications Team;NEW_CONTACT;Linus Luther;Head Pianist;Office: 519 555-8111;Cell: 519 555-8222;Prime Backup: Lucy;NEW_CONTACT;Lucy Lu;Pianist's Shadow;Office: 519 555-9111;Cell: 519 555-9222;BlackBerry pin:9999999F;NEXT_GROUP;Testing Team;NEW_CONTACT;Linus Luther;Head Pianist;Office: 519 555-8111;Cell: 519 555-8222;Prime Backup: Lucy;NEW_CONTACT;Lucy Lu;Pianist's Shadow;Office: 519 555-9111;Cell: 519 555-9222;BlackBerry pin:9999999F; \ No newline at end of file diff --git a/ECL/app/assets/images/action_addcontact.png b/ECL/app/assets/images/action_addcontact.png new file mode 100755 index 0000000..cf1b949 Binary files /dev/null and b/ECL/app/assets/images/action_addcontact.png differ diff --git a/ECL/app/assets/images/backup.png b/ECL/app/assets/images/backup.png new file mode 100755 index 0000000..295a5e4 Binary files /dev/null and b/ECL/app/assets/images/backup.png differ diff --git a/ECL/app/assets/images/bbm.png b/ECL/app/assets/images/bbm.png new file mode 100755 index 0000000..bc581e2 Binary files /dev/null and b/ECL/app/assets/images/bbm.png differ diff --git a/ECL/app/assets/images/cell.png b/ECL/app/assets/images/cell.png new file mode 100755 index 0000000..9cb120f Binary files /dev/null and b/ECL/app/assets/images/cell.png differ diff --git a/ECL/app/assets/images/chat.png b/ECL/app/assets/images/chat.png new file mode 100755 index 0000000..f5a9479 Binary files /dev/null and b/ECL/app/assets/images/chat.png differ diff --git a/ECL/app/assets/images/email.png b/ECL/app/assets/images/email.png new file mode 100755 index 0000000..1e5e46c Binary files /dev/null and b/ECL/app/assets/images/email.png differ diff --git a/ECL/app/assets/images/forward.png b/ECL/app/assets/images/forward.png new file mode 100755 index 0000000..da074e5 Binary files /dev/null and b/ECL/app/assets/images/forward.png differ diff --git a/ECL/app/assets/images/header.png b/ECL/app/assets/images/header.png new file mode 100755 index 0000000..9f6472f Binary files /dev/null and b/ECL/app/assets/images/header.png differ diff --git a/ECL/app/assets/images/mail.png b/ECL/app/assets/images/mail.png new file mode 100755 index 0000000..e198039 Binary files /dev/null and b/ECL/app/assets/images/mail.png differ diff --git a/ECL/app/assets/images/office.png b/ECL/app/assets/images/office.png new file mode 100755 index 0000000..b1105e7 Binary files /dev/null and b/ECL/app/assets/images/office.png differ diff --git a/ECL/app/assets/images/outgoingcall.png b/ECL/app/assets/images/outgoingcall.png new file mode 100755 index 0000000..b29869d Binary files /dev/null and b/ECL/app/assets/images/outgoingcall.png differ diff --git a/ECL/app/assets/images/sms.png b/ECL/app/assets/images/sms.png new file mode 100755 index 0000000..42b4025 Binary files /dev/null and b/ECL/app/assets/images/sms.png differ diff --git a/ECL/app/assets/images/up.png b/ECL/app/assets/images/up.png new file mode 100755 index 0000000..bf23cd0 Binary files /dev/null and b/ECL/app/assets/images/up.png differ diff --git a/ECL/app/assets/main.qml b/ECL/app/assets/main.qml new file mode 100755 index 0000000..485f908 --- /dev/null +++ b/ECL/app/assets/main.qml @@ -0,0 +1,177 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is the main screen of the application. This will create listview + * having custom Header list Item for ECL groups and also custom list item + * for expanded header item. + *****************************************************************************/ +import bb.cascades 1.0 +import ecl.contact.utils 1.0 + +NavigationPane { + id: mainPane + Page { + titleBar: TitleBar { + title: qsTr("Emergency Contact List") + } + Container { + layout: DockLayout { + } + //! [0] + ListView { + // This function creates the phone list screen when the user + // tries to call a contact from the context menu. + function phoneListScreen(indexPath, actionText) { + console.log("phoneListScreen\n"); + var selectedItemData = dataModel.data(indexPath); + var list = _eclutils.getPhoneList(selectedItemData); + console.log("\n List Count %d", list.length); + if (list.length > 1) { + var p = phoneList.createObject(); + p.detailData = list; + p.titleText = actionText + " To \"" + selectedItemData.Name + "\""; + p.actionText = actionText; + mainPane.push(p); + } else if ((list.length == 1) && (list[0].fieldName == eclConfig.jsonFieldName(EclConfig.CellPhone) || + list[0].fieldName == eclConfig.jsonFieldName(EclConfig.OfficePhone))) { + _eclutils.makeCall(list[0].fieldValue); + } + } + // This function invokes the Email Client pre-populated with the email address + // of the contact. + function invokeEmailClient(indexPath, actionText) { + var selectedItemData = dataModel.data(indexPath); + var email = _eclutils.getEmailAddress(selectedItemData); + _eclutils.sendEmail(email.fieldValue); + } + id: mainList + horizontalAlignment: HorizontalAlignment.Center + dataModel: _model + + //! [0] + listItemComponents: [ + // Standard header height is too short to be selectable. + // Using custom header item + //! [1] + ListItemComponent { + type: "header" + EclHeaderListitem { + title: ListItemData.data.Title + isExpand: ListItemData.expanded + } + }, + ListItemComponent { + type: "item" + CustomListItem { + id: itemRoot + title: ListItemData.Name + description: ListItemData.Role + contextActions: [ + ActionSet { + actions: [ + ActionItem { + id: call + title: qsTr("Call") + imageSource: "asset:///images/outgoingcall.png" + onTriggered: { + console.log("Call the contact"); + var mainList = itemRoot.ListItem.view; + mainList.phoneListScreen(mainList.selected(), call.title); + } + }, + ActionItem { + id: sms + title: qsTr("SMS") + imageSource: "asset:///images/chat.png" + onTriggered: { + console.log("Send SMS to contact"); + var mainList = itemRoot.ListItem.view; + mainList.phoneListScreen(mainList.selected(), sms.title); + } + }, + ActionItem { + id: email + title: qsTr("Email") + imageSource: "asset:///images/mail.png" + onTriggered: { + console.log("Send Email to contact"); + var mainList = itemRoot.ListItem.view; + mainList.invokeEmailClient(mainList.selected(), email.title); + } + } + ] + } + ] + } + } + ] + onTriggered: { + //console.log("On Triggered Called for mainList"); + mainList.clearSelection(); + select(indexPath); + if (_model.itemType(indexPath) == "item") { + var p = viewDetails.createObject(); + var selectedItemData = dataModel.data(indexPath); + console.log(selectedItemData); + p.detailData = selectedItemData; + mainPane.push(p); + } else { //Header item triggered + scrollToItem(indexPath, 2) + } + } + onSelectionChanged: { + _app.selectionChanged(indexPath, selected); + } + } + } + attachedObjects: [ + ComponentDefinition { + id: viewDetails + source: "viewdetails.qml" + }, + ComponentDefinition { + id: phoneList + source: "phonelist.qml" + }, + EclConfig { + id: eclConfig + } + ] + onCreationCompleted: { + OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All; + } + actions: [ + // Demos ECL app by loading the data from a text file + // instead of via the push notification + ActionItem { + ActionBar.placement: ActionBarPlacement.InOverflow + title: "Demo with Text File" + onTriggered: { + _app.demoTextActionTriggered(); + } + }, + // Demos ECL app by loading the data from a JSON file + // instead of via the push notification + ActionItem { + ActionBar.placement: ActionBarPlacement.InOverflow + title: "Demo with JSON File" + onTriggered: { + _app.demoJSONActionTriggered(); + } + } + ] + } +} diff --git a/ECL/app/assets/phonelist.qml b/ECL/app/assets/phonelist.qml new file mode 100755 index 0000000..54d3e3b --- /dev/null +++ b/ECL/app/assets/phonelist.qml @@ -0,0 +1,105 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is the phone list screen and is displayed only if multiple phone + * numbers are associated with the contact. + *****************************************************************************/ +import bb.cascades 1.0 +import ecl.contact.utils 1.0 + +Page { + property variant detailData + property string titleText + property string actionText + + onDetailDataChanged: { + listView.dataModel.clear(); + for (var i = 0; i < detailData.length; i++) { + var fieldMap = detailData[i]; + + if(fieldMap.fieldName == eclConfig.jsonFieldName(EclConfig.OfficePhone)) + { + fieldMap.fieldName = eclConfig.displayString(EclConfig.OfficePhone); + fieldMap.image = eclConfig.fieldIcon(EclConfig.OfficeIcon); + } else + { + fieldMap.fieldName = eclConfig.displayString(EclConfig.CellPhone); + fieldMap.image = eclConfig.fieldIcon(EclConfig.CellIcon); + } + + listView.dataModel.append(fieldMap); + } + } + titleBar: TitleBar { + title: qsTr(titleText) + } + content: Container { + layout: DockLayout { + } + ListView { + id: listView + horizontalAlignment: HorizontalAlignment.Center + dataModel: ArrayDataModel { + id: phonelistmodel + } + listItemComponents: [ + // define delegates for different item types here + ListItemComponent { + // StandardListItem is a convinient component for lists with default cascades look and feel + StandardListItem { + id: item + title: ListItemData.fieldName + description: ListItemData.fieldValue + imageSource: ListItemData.image + bottomMargin: 20 + } + } + ] + + onTriggered: { + if (actionText == qsTr("Call")) { + clearSelection(); + select(indexPath); + var selectedItemData = dataModel.data(indexPath); + _eclutils.makeCall(selectedItemData.fieldValue); + } + else + { + //SMS + clearSelection(); + select(indexPath); + var selectedItemData = dataModel.data(indexPath); + _eclutils.sendSMS(selectedItemData.fieldValue); + } + } + } + } + onCreationCompleted: { + // this slot is called when declarative scene is created + // write post creation initialization here + console.log("Page 2 - onCreationCompleted()") + + // enable layout to adapt to the device rotation + // don't forget to enable screen rotation in bar-bescriptor.xml (Application->Orientation->Auto-orient) + OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All; + } + + attachedObjects: [ + EclConfig { + id: eclConfig + } + ] +} diff --git a/ECL/app/assets/viewdetails.qml b/ECL/app/assets/viewdetails.qml new file mode 100755 index 0000000..9e5f3ca --- /dev/null +++ b/ECL/app/assets/viewdetails.qml @@ -0,0 +1,197 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is the details screen and it displays all the details of the selected + * contact. + *****************************************************************************/ +import bb.cascades 1.0 +import bb.system 1.0 +import ecl.contact.utils 1.0 + +Page { + id: viewPage + property variant detailData: undefined + property variant list: undefined + onDetailDataChanged: { + console.log("before setting map") + /* + * An "Unknown symbol" warning is shown for all the objects exposed from c++ + * could not figure out fix, this seems a qml editor problem + */ + list = _eclutils.mapToList(detailData); + var i = 0; + + /* + * For each JSON field it assigns as display string for UI + * assigns the icon for the field + * assign action for each filed + * and add the item to list + */ + function changeFieldNameAndInsert(jSonFieldName, displayFieldName, imageName, action) { + var fieldMap; + for (i = 0; i < list.length; i ++) { + if (list[i].fieldName == jSonFieldName) { + fieldMap = list[i]; + break; + } + } + if (i < list.length) { + fieldMap.image = imageName; + fieldMap.fieldName = displayFieldName; + fieldMap.action = action; + listView.dataModel.append(fieldMap); + } + } + changeFieldNameAndInsert(eclConfig.jsonFieldName(EclConfig.OfficePhone), + eclConfig.displayString(EclConfig.OfficePhone, "Call "), + eclConfig.fieldIcon(EclConfig.OfficeIcon), EclConfig.Call) + changeFieldNameAndInsert(eclConfig.jsonFieldName(EclConfig.OfficePhone), + eclConfig.displayString(EclConfig.OfficePhone, "SMS "), + eclConfig.fieldIcon(EclConfig.SMSIcon), EclConfig.SendSMS) + changeFieldNameAndInsert(eclConfig.jsonFieldName(EclConfig.CellPhone), + eclConfig.displayString(EclConfig.CellPhone, "Call "), + eclConfig.fieldIcon(EclConfig.CellIcon), EclConfig.Call) + changeFieldNameAndInsert(eclConfig.jsonFieldName(EclConfig.CellPhone), + eclConfig.displayString(EclConfig.CellPhone, "SMS "), + eclConfig.fieldIcon(EclConfig.SMSIcon), EclConfig.SendSMS) + changeFieldNameAndInsert(eclConfig.jsonFieldName(EclConfig.Email), + eclConfig.displayString(EclConfig.Email), + eclConfig.fieldIcon(EclConfig.EmailIcon), EclConfig.SendEmail) + changeFieldNameAndInsert(eclConfig.jsonFieldName(EclConfig.Backup), + eclConfig.displayString(EclConfig.Backup), + eclConfig.fieldIcon(EclConfig.BackupIcon), EclConfig.None) + changeFieldNameAndInsert(eclConfig.jsonFieldName(EclConfig.BBPin), + eclConfig.displayString(EclConfig.BBPin), + eclConfig.fieldIcon(EclConfig.BBMIcon), EclConfig.None) + } + content: Container { + layout: StackLayout { + orientation: LayoutOrientation.TopToBottom + } + Container { + id: innerContainer + layout: DockLayout { + } + ImageView { + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + preferredWidth: innerContainer.maxWidth + imageSource: "asset:///images/header.png" + } + Container { + leftPadding: 20 + bottomPadding: 20 + layout: StackLayout { + orientation: LayoutOrientation.TopToBottom + } + clipContentToBounds: false + Label { + text: detailData.Name + textStyle { + base: SystemDefaults.TextStyles.BigText + } + } + Label { + text: detailData.Role + } + } + } + ListView { + id: listView + objectName: "listView" + horizontalAlignment: HorizontalAlignment.Center + dataModel: ArrayDataModel { + } + property int activeItem: -1 + listItemComponents: [ + ListItemComponent { + type: "header" + Container { + } + }, + ListItemComponent { + StandardListItem { + id: listItem + title: ListItemData.fieldName + description: ListItemData.fieldValue + imageSource: ListItemData.image + } + } + ] + onTriggered: { + clearSelection(); + select(indexPath); + var selectedItemData = dataModel.data(indexPath); + if (selectedItemData.action == EclConfig.Call) { + _eclutils.makeCall(selectedItemData.fieldValue); + } else if (selectedItemData.action == EclConfig.SendEmail) { + _eclutils.sendEmail(selectedItemData.fieldValue) + } else if (selectedItemData.action == EclConfig.SendSMS) { + console.log("sending SMS..."); + _eclutils.sendSMS(selectedItemData.fieldValue) + } + } + leftPadding: 10 + } + } + onCreationCompleted: { + // this slot is called when declarative scene is created + // write post creation initialization here + console.log("Page - onCreationCompleted()") + + // enable layout to adapt to the device rotation + // don't forget to enable screen rotation in bar-bescriptor.xml (Application->Orientation->Auto-orient) + OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All; + } + actions: [ + ActionItem { + title: qsTr("Add To Contact") + imageSource: "asset:///images/action_addcontact.png" + ActionBar.placement: ActionBarPlacement.OnBar + onTriggered: { + addContactDialog.show(); + } + } + ] + attachedObjects: [ + EclContact { + id: eclContact + }, + EclConfig { + id: eclConfig + }, + SystemDialog { + id: addContactDialog + title: qsTr("Confirmation!!") + body: qsTr("Contact will be added to device contacts ?") + onFinished: { + console.log(addContactDialog.result) + if (addContactDialog.result == SystemUiResult.ConfirmButtonSelection) { + if (false == eclContact.saveToAddressBook(detailData)) { + console.log("Error in adding contact"); + userInfo.body = qsTr("Add to contact is failed") + } else { + userInfo.body = qsTr("Add to contact is successfull") + } + userInfo.show(); + } + } + }, + SystemToast { + id: userInfo + } + ] +} diff --git a/ECL/app/bar-descriptor.xml b/ECL/app/bar-descriptor.xml new file mode 100755 index 0000000..37babb8 --- /dev/null +++ b/ECL/app/bar-descriptor.xml @@ -0,0 +1,138 @@ + + + + + + + + bb10.cascades.ecl + + + ECL + + + 1.0.0 + + + 1 + + + + + + The Emergency Contact List application + + + + + + + + + + + true + none + false + + + + + armle-v7 + ECL + + + Qnx/Cascades + armle-v7 + ECL.so + + + armle-v7 + ECL + + + x86 + ECL + + \ + armle-v7 + ECL + + + x86 + ECL + + + x86 + ECL + + + + + icon.png + + + icon.png + assets + + + + + + + + run_native + access_phone + access_pimdomain_contacts + + post_notification + access_shared + read_device_identifying_information + + + + + + + + bb.action.PUSH + application/vnd.push + + + + + + + + bb.action.OPEN + text/plain + + + + diff --git a/ECL/app/config.pri b/ECL/app/config.pri new file mode 100755 index 0000000..b2b63a3 --- /dev/null +++ b/ECL/app/config.pri @@ -0,0 +1,11 @@ +# Auto-generated by IDE. Any changes made by user will be lost! +BASEDIR = $$quote($$_PRO_FILE_PWD_) + +lupdate_inclusion { + SOURCES += $$quote($$BASEDIR/../assets/*.qml) \ + $$quote($$BASEDIR/../assets/*.js) \ + $$quote($$BASEDIR/../assets/*.qs) + +} + +TRANSLATIONS = $$quote($${TARGET}.ts) diff --git a/ECL/app/icon.png b/ECL/app/icon.png new file mode 100755 index 0000000..7d1e508 Binary files /dev/null and b/ECL/app/icon.png differ diff --git a/ECL/app/src/ecl.cpp b/ECL/app/src/ecl.cpp new file mode 100755 index 0000000..5bdcf7c --- /dev/null +++ b/ECL/app/src/ecl.cpp @@ -0,0 +1,296 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is ECL application class + * + ****************************************************************************/ + +#include "ECL.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "filtereddatamodel.hpp" +#include "ecldatamodel.hpp" +#include "eclutils.hpp" +#include "eclcontact.hpp" +#include "eclconfig.hpp" +#include "ecllistitem.hpp" + +using namespace bb::cascades; +using namespace bb::network; +using namespace bb::system; +using namespace bb::platform; + +#define BB_OPEN_INVOCATION_ACTION "bb.action.OPEN" + +ECL::ECL(bb::cascades::Application *app) : + QObject(app), m_model(0), m_invokeManager(new InvokeManager(this)) { + + eclUtils = new EclUtils(this); + + jSonDataModel = new EclDataModel(this); + m_model = new FilteredDataModel(jSonDataModel, this); + + qmlRegisterType("ecl.contact.utils", 1, 0, "EclContact"); + qmlRegisterType("ecl.contact.utils", 1, 0, "EclConfig"); + qmlRegisterType("ecl.contact.utils", 1, 0, "CustomListItem"); + + connect(&m_pushNotificationService, + SIGNAL( createSessionCompleted(const bb::network::PushStatus&)), + this, + SLOT(onCreateSessionCompleted(const bb::network::PushStatus&))); + connect(&m_pushNotificationService, + SIGNAL(createChannelCompleted(const bb::network::PushStatus&, const QString)), + this, + SLOT(onCreateChannelCompleted(const bb::network::PushStatus&, const QString))); + connect(&m_pushNotificationService, + SIGNAL(destroyChannelCompleted(const bb::network::PushStatus&)), + this, + SLOT(onDestroyChannelCompleted(const bb::network::PushStatus&))); + connect(&m_pushNotificationService, + SIGNAL(registerToLaunchCompleted(const bb::network::PushStatus&)), + this, + SLOT(onRegisterToLaunchCompleted(const bb::network::PushStatus&))); + connect(&m_pushNotificationService, + SIGNAL(unregisterFromLaunchCompleted(const bb::network::PushStatus&)), + this, + SLOT(onUnregisterFromLaunchCompleted(const bb::network::PushStatus&))); + + connect(m_invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&)), + this, SLOT(onInvoked(const bb::system::InvokeRequest&))); + connect(this, SIGNAL(createSession()), this, SLOT(onCreateSession()), + Qt::QueuedConnection); + connect(&m_pushNotificationService, + SIGNAL(pushTransportReady(bb::network::PushCommand::Type)), this, + SLOT(onPushTransportReady(bb::network::PushCommand::Type))); + connect(&m_pushNotificationService, SIGNAL(noPushServiceConnection()), this, + SLOT(onNoPushServiceConnection())); + + initializePushSession(); + + QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); + qml->setContextProperty("_model", m_model); + qml->setContextProperty("_app", this); + qml->setContextProperty("_eclutils", eclUtils); + + AbstractPane* root = qml->createRootObject(); + Application::instance()->setScene(root); + +} + +void ECL::selectionChanged(const QVariantList &indexPath, bool selected) { + if (indexPath.size() != 1 || !selected) + return; // Not interested + + // Selected a header item! + const int selection = indexPath[0].toInt(); + + // Toggle the expanded state of the selected header + m_model->changeHeaderExpansion(selection); +} + +/**************************************************************************** + * Slot function to handle the Push Transport being Ready + ****************************************************************************/ +void ECL::onPushTransportReady(bb::network::PushCommand::Type command) { + if (command == PushCommand::CreateChannel) { + m_pushNotificationService.createChannel(); + } else if (command == PushCommand::DestroyChannel) { + m_pushNotificationService.destroyChannel(); + } + +} + +/**************************************************************************** + * Slot function to handle the noPushServiceConnection() signal. + ****************************************************************************/ +void ECL::onNoPushServiceConnection() { + qDebug() << "Error: Push Service could not connect to the Push Agent"; +} + +/**************************************************************************** + * This function is to initialize the Push service and to emit session + * creation signal. + ****************************************************************************/ +void ECL::initializePushSession() { + m_pushNotificationService.initializePushService(); + emit createSession(); +} + +/**************************************************************************** + * Slot function for creating a session. + ****************************************************************************/ +void ECL::onCreateSession() { + m_pushNotificationService.createSession(); +} + +/**************************************************************************** + * Slot function for checking the successful creation of the session. + * if success, then creates a channel + * otherwise an error + ****************************************************************************/ +void ECL::onCreateSessionCompleted(const bb::network::PushStatus &status) { + if (status.code() == PushErrorCode::NoError) { + m_pushNotificationService.registerToLaunch(); + m_pushNotificationService.createChannel(); + } else { + qDebug() << "onCreateSessionCompleted err: " << status.code(); + } +} + +/**************************************************************************** + * Slot function for checking the successful creation of the channel. + ****************************************************************************/ +void ECL::onCreateChannelCompleted(const bb::network::PushStatus &status, + const QString &token) { + Q_UNUSED(token) + if (PushErrorCode::NoError != status.code()) { + qDebug() << "onCreateChannelCompleted err: " << status.code(); + } +} + +/**************************************************************************** + * Slot function for checking the successful destruction of the channel. + ****************************************************************************/ +void ECL::onDestroyChannelCompleted(const bb::network::PushStatus &status) { + + if (PushErrorCode::NoError != status.code()) { + qDebug() << "Destroy channel failed err: " << status.code(); + } +} + +/**************************************************************************** + * Slot function for checking the completion of the signal + * registerToLaunchCompleted. + ****************************************************************************/ +void ECL::onRegisterToLaunchCompleted(const bb::network::PushStatus &status) { + + if (status.code() != PushErrorCode::NoError) { + qDebug() << "onRegisterToLaunchCompleted err: " << status.code(); + } +} + +/**************************************************************************** + * Slot function for checking the completion of signal + * unregisterFromLaunchCompleted. + ****************************************************************************/ +void ECL::onUnregisterFromLaunchCompleted( + const bb::network::PushStatus &status) { + if (status.code() != PushErrorCode::NoError) { + qDebug() << "onUnregisterFromLaunchCompleted err: " << status.code(); + } +} + +/**************************************************************************** + * Slot function for acting on the invoked signal + * - Initializes the push service + * - Extracts the payload from invoke request + * - Calls the push notification handler + ****************************************************************************/ +void ECL::onInvoked(const InvokeRequest &request) { + // The underlying PushService instance might not have been + // initialized when an invoke first comes in + // Make sure that we initialize it here if it hasn't been already + + m_pushNotificationService.initializePushService(); + + if (request.action().compare(BB_PUSH_INVOCATION_ACTION) == 0) { + qDebug() << "onInvoked BB_PUSH_INVOCATION_ACTION "; + // Received an incoming push + // Extract it from the invoke request and then process it + PushPayload payload(request); + if (payload.isValid()) { + pushNotificationHandler(payload); + } + } else if (request.action().compare(BB_OPEN_INVOCATION_ACTION) == 0) { + qDebug() << "onInvoked BB_OPEN_INVOCATION_ACTION"; + } +} + +/**************************************************************************** + * This function handles the push notifications that the application + * receives + * - Notifies the Blackberry hub about the push received + * - Configures the invoke request target and action for the notification + ****************************************************************************/ +void ECL::pushNotificationHandler(bb::network::PushPayload &pushPayload) { + // Create a notification for the push that will be added to the BlackBerry Hub + Notification *notification = new Notification(); + notification->setTitle("Emergency Contact List"); + notification->setBody(QString("New List received")); + + // Add an invoke request to the notification + InvokeRequest invokeRequest; + invokeRequest.setTarget(m_configuration.invokeTargetOpen()); + invokeRequest.setAction(BB_OPEN_INVOCATION_ACTION); + notification->setInvokeRequest(invokeRequest); + + // Add the notification for the push to the BlackBerry Hub + // Calling this method will add a "splat" to the application icon, indicating that a new push has been received + notification->notify(); + + // If an acknowledgment of the push is required (that is, the push was sent as a confirmed push + // - which is equivalent terminology to the push being sent with application level reliability), + // then you must either accept the push or reject the push + if (pushPayload.isAckRequired()) { + // In our sample, we always accept the push, but situations might arise where an application + // might want to reject the push (for example, after looking at the headers that came with the push + // or the data of the push, we might decide that the push received did not match what we expected + // and so we might want to reject it) + m_pushNotificationService.acceptPush(pushPayload.id()); + } + + if (eclUtils->writeToJson("data/data.json", pushPayload.data())) { + jSonDataModel->load("data/data.json"); + m_model->reload(jSonDataModel); + } +} + +/**************************************************************************** + * This triggers a demo of the ECL Native Application using a pre-created + * JSON file containing the contact informations. + ****************************************************************************/ +void ECL::demoJSONActionTriggered() { + if (eclUtils->showConfirmDialog( + tr("This will temporarily overwrite your contact list with test data.")) + == SystemUiResult::ConfirmButtonSelection) { + jSonDataModel->load("app/native/assets/data/ecl_data.json"); + m_model->reload(jSonDataModel); + } +} + +/**************************************************************************** + * This triggers a demo of the ECL Native Application using a pre-created + * text file which gets converted into a JSON file which in turn + * is used to populate the contact list. + ****************************************************************************/ +void ECL::demoTextActionTriggered() { + if (eclUtils->showConfirmDialog( + tr("This will temporarily overwrite your contact list with test data.")) + == SystemUiResult::ConfirmButtonSelection) { + eclUtils->textFileToJson("app/native/assets/data/ecl_data.txt", + "data/ecl_demo.json"); + jSonDataModel->load("data/ecl_demo.json"); + m_model->reload(jSonDataModel); + } +} + diff --git a/ECL/app/src/ecl.hpp b/ECL/app/src/ecl.hpp new file mode 100755 index 0000000..b809f9d --- /dev/null +++ b/ECL/app/src/ecl.hpp @@ -0,0 +1,89 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef ECL_HPP_ +#define ECL_HPP_ + +#include +#include +#include +#include + +#include "pushclient/pushconfiguration.hpp" +#include "pushclient/pushclientnotification.hpp" +#include "eclutils.hpp" + +class FilteredDataModel; +class EclDataModel; + +namespace bb { namespace cascades { class Application; }} + +/*! + * @brief Application pane object + * + *Use this object to create and init app UI, to create context objects, to register the new meta types etc. + */ + +class ECL : public QObject +{ + Q_OBJECT +public: + ECL(bb::cascades::Application *app); + virtual ~ECL() {} + +public Q_SLOTS: + void selectionChanged(const QVariantList &indexPath, bool selected); + void demoJSONActionTriggered(); + void demoTextActionTriggered(); + + void onCreateSessionCompleted(const bb::network::PushStatus &status); + void onCreateChannelCompleted(const bb::network::PushStatus &status, const QString &token); + void onDestroyChannelCompleted(const bb::network::PushStatus &status); + void onRegisterToLaunchCompleted(const bb::network::PushStatus &status); + void onUnregisterFromLaunchCompleted(const bb::network::PushStatus &status); + void onCreateSession(); + void onInvoked(const bb::system::InvokeRequest &request); + void onPushTransportReady(bb::network::PushCommand::Type command); + void onNoPushServiceConnection(); + +Q_SIGNALS: + + void notificationChanged(); + void closeActivityDialog(); + void openActivityDialog(); + void activityDialogChanged(); + void createSession(); + +private: + void initializePushSession(); + void pushNotificationHandler(bb::network::PushPayload &pushPayload); + +private: + EclDataModel *jSonDataModel; + FilteredDataModel *m_model; + + EclUtils *eclUtils; + + // The manager object to react to invocations + bb::system::InvokeManager *m_invokeManager; + + // The wrapper classes for loading/storing configuration values + PushConfiguration m_configuration; + + PushClientNotification m_pushNotificationService; +}; + +#endif /* ECL_HPP_ */ diff --git a/ECL/app/src/eclconfig.hpp b/ECL/app/src/eclconfig.hpp new file mode 100755 index 0000000..f43dc7b --- /dev/null +++ b/ECL/app/src/eclconfig.hpp @@ -0,0 +1,149 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This files defines EclConfig class, which contains all the enums used in + * the application. This also contains enum to string mapping functions for + * the field names and display strings + ****************************************************************************/ + +#ifndef ECLCONFIG_HPP_ +#define ECLCONFIG_HPP_ + +#include + +class EclConfig: public QObject { + Q_OBJECT + Q_ENUMS (jsonFields) + Q_ENUMS (fieldIcons) + Q_ENUMS (eclString) + Q_ENUMS (action) + +public: + enum jsonFields { + Title, + Name, + Role, + CellPhone, + OfficePhone, + Email, + BBPin, + Backup, + JSonList + }; + + enum action { + None, + Call, + SendSMS, + SendEmail + }; + + enum fieldIcons { + OfficeIcon, + CellIcon, + EmailIcon, + SMSIcon, + BBMIcon, + BackupIcon + }; + + Q_INVOKABLE static QString jsonFieldName(const jsonFields& field) { + QString fieldName; + switch (field) { + case Title: + fieldName = tr("Title"); + break; + case Name: + fieldName = tr("Name"); + break; + case Role: + fieldName = tr("Role"); + break; + case CellPhone: + fieldName = tr("CellPhone"); + break; + case OfficePhone: + fieldName = tr("OfficePhone"); + break; + case Email: + fieldName = tr("Email"); + break; + case Backup: + fieldName = tr("Backup"); + break; + case BBPin: + fieldName = tr("BBPin"); + break; + case JSonList: + fieldName = tr("list"); + break; + } + return fieldName; + } + + Q_INVOKABLE static QString displayString(const jsonFields& field, + QString strAdditional = "") { + QString fieldName; + switch (field) { + case OfficePhone: + fieldName = tr("Work"); + break; + case CellPhone: + fieldName = tr("Mobile"); + break; + case Email: + fieldName = tr("email"); + break; + case Backup: + fieldName = tr("Backup"); + break; + case BBPin: + fieldName = tr("BBM"); + break; + default: + break; + } + return strAdditional + fieldName; + } + + Q_INVOKABLE static QString fieldIcon(const fieldIcons& field) { + QString fieldName; + switch (field) { + case OfficeIcon: + fieldName = "asset:///images/office.png"; + break; + case CellIcon: + fieldName = "asset:///images/cell.png"; + break; + case EmailIcon: + fieldName = "asset:///images/email.png"; + break; + case SMSIcon: + fieldName = "asset:///images/sms.png"; + break; + case BBMIcon: + fieldName = "asset:///images/bbm.png"; + break; + case BackupIcon: + fieldName = "asset:///images/backup.png"; + break; + } + return fieldName; + } +}; + +#endif /* ECLCONFIG_HPP_ */ + diff --git a/ECL/app/src/eclcontact.cpp b/ECL/app/src/eclcontact.cpp new file mode 100755 index 0000000..9d430f6 --- /dev/null +++ b/ECL/app/src/eclcontact.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is EclContact class, that is used to save the contact details to the + * address book + ****************************************************************************/ + +#include "eclcontact.hpp" +#include "eclconfig.hpp" +#include +#include +#include + +#include + +using namespace bb::pim::contacts; + +EclContact::EclContact(QObject *parent) : + QObject(parent), m_contactService(new ContactService(this)) { + +} + +/**************************************************************************** + * This function is used to store the contact details to the phone address + * book. + ****************************************************************************/ +bool EclContact::saveToAddressBook(QVariant eclData) { + + if (!eclData.isValid() || eclData.isNull()) { + return false; + } + + QVariantMap contactData = eclData.value(); + QMapIterator contactItr(contactData); + QString key = ""; + + while (contactItr.hasNext()) { + contactItr.next(); + key = contactItr.key(); + + if (EclConfig::jsonFieldName(EclConfig::Name) == key) { + m_name = contactItr.value().value(); + } + if (EclConfig::jsonFieldName(EclConfig::Title) == key) { + m_title = contactItr.value().value(); + } + if (EclConfig::jsonFieldName(EclConfig::CellPhone) == key) { + m_cellPhone = contactItr.value().value(); + } + if (EclConfig::jsonFieldName(EclConfig::OfficePhone) == key) { + m_officePhone = contactItr.value().value(); + } + if (EclConfig::jsonFieldName(EclConfig::Email) == key) { + m_email = contactItr.value().value(); + } + if (EclConfig::jsonFieldName(EclConfig::BBPin) == key) { + m_bbPin = contactItr.value().value(); + } + if (EclConfig::jsonFieldName(EclConfig::Backup) == key) { + m_backup = contactItr.value().value(); + } + } + + // Create a builder to assemble the new contact + ContactBuilder builder; + + // Set the name + builder.addAttribute( + ContactAttributeBuilder().setKind(AttributeKind::Name).setSubKind( + AttributeSubKind::NameGiven).setValue(m_name)); + + // Set the Cell Phone + builder.addAttribute( + ContactAttributeBuilder().setKind(AttributeKind::Phone).setSubKind( + AttributeSubKind::PhoneMobile).setValue(m_cellPhone)); + + // Set the office Phone + builder.addAttribute( + ContactAttributeBuilder().setKind(AttributeKind::Phone).setSubKind( + AttributeSubKind::Work).setValue(m_officePhone)); + + // Set the email address + builder.addAttribute( + ContactAttributeBuilder().setKind(AttributeKind::Email).setSubKind( + AttributeSubKind::Other).setValue(m_email)); + + // Set the bbPin + builder.addAttribute( + ContactAttributeBuilder().setKind(AttributeKind::Hidden).setSubKind( + AttributeSubKind::Other).setValue(m_bbPin)); + + // Save the contact to persistent storage + Contact createdContact = m_contactService->createContact(builder, false); + + return true; +} diff --git a/ECL/app/src/eclcontact.hpp b/ECL/app/src/eclcontact.hpp new file mode 100755 index 0000000..3dd674b --- /dev/null +++ b/ECL/app/src/eclcontact.hpp @@ -0,0 +1,43 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef ECLCONTACT_HPP +#define ECLCONTACT_HPP + +#include +#include + +class EclContact : public QObject +{ + Q_OBJECT +private: + // The central object to access the contact service + bb::pim::contacts::ContactService *m_contactService; + + QString m_name; + QString m_title; + QString m_officePhone; + QString m_cellPhone; + QString m_email; + QString m_bbPin; + QString m_backup; + +public: + EclContact(QObject *parent = 0); + Q_INVOKABLE bool saveToAddressBook(QVariant eclData); +}; + +#endif //ECLCONTACT_HPP diff --git a/ECL/app/src/ecldatamodel.cpp b/ECL/app/src/ecldatamodel.cpp new file mode 100755 index 0000000..4fc8f7d --- /dev/null +++ b/ECL/app/src/ecldatamodel.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is EclDataModel class, responsible for population of the data model + * which in turn used by the UI to display the data. + ****************************************************************************/ + +#include "ecldatamodel.hpp" +#include "eclconfig.hpp" + +EclDataModel::EclDataModel(QObject *parent) : + bb::cascades::DataModel(parent) { + this->load("data/data.json"); +} + +/**************************************************************************** + * This function loads the json file into Variant list + ****************************************************************************/ +void EclDataModel::load(const QString& filename) { + + bb::data::JsonDataAccess jda; + m_jsonList = jda.load(filename).value(); + + if (jda.hasError()) { + bb::data::DataAccessError error = jda.error(); + qDebug() << filename << "JSON LOADING ERROR: " << error.errorType() + << " : " << error.errorMessage(); + } + + emit itemsChanged (); +} + +/**************************************************************************** + * This function returns the child count of the passed indexpath node in json + * data + ****************************************************************************/ +int EclDataModel::childCount(const QVariantList& indexPath) { + + const int level = indexPath.size(); + + int children = 0; + + if (level == 0) { + children = m_jsonList.count(); + } else if (level == 1) { + QString key = ""; + QVariantList list; + + const int header = indexPath[0].toInt(); + QVariantMap map = m_jsonList[header].value(); + QMapIterator it(map); + while (it.hasNext()) { + it.next(); + key = it.key(); + if (key == EclConfig::jsonFieldName(EclConfig::JSonList)) { + list = it.value().value(); + children = list.count(); + } + } + } + return children; +} + +bool EclDataModel::hasChildren(const QVariantList& indexPath) { + return childCount(indexPath) > 0; +} + +/*************************************************************** + * Return data as a string QVariant for any requested indexPath. + ***************************************************************/ +QVariant EclDataModel::data(const QVariantList& indexPath) { + QString key = ""; + QString value = ""; + QVariantMap map; + + if (1 == indexPath.size()) { // Header requested + map = m_jsonList[indexPath[0].toInt()].value(); + } else if (2 == indexPath.size()) { // 2nd-level item requested + const int header = indexPath[0].toInt(); + const int childItem = indexPath[1].toInt(); + + QVariantMap l1Map = m_jsonList[header].value(); + QMapIterator it(l1Map); + + QVariantList list; + while (it.hasNext()) { + it.next(); + key = it.key(); + if (key == EclConfig::jsonFieldName(EclConfig::JSonList)) { + list = it.value().value(); + map = list[childItem].value(); + } + } + } + + return QVariant(map); +} + +/********************************************************************* + * Returns the item type (header or item) for any requested indexPath. + *********************************************************************/ +QString EclDataModel::itemType(const QVariantList& indexPath) { + switch (indexPath.size()) { + case 0: + return QString(); + case 1: + return QLatin1String("header"); + default: + return QLatin1String("item"); + } +} diff --git a/ECL/app/src/ecldatamodel.hpp b/ECL/app/src/ecldatamodel.hpp new file mode 100755 index 0000000..5345c9e --- /dev/null +++ b/ECL/app/src/ecldatamodel.hpp @@ -0,0 +1,40 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef ECL_DATAMODEL_HPP +#define ECL_DATAMODEL_HPP + +#include +#include + +class EclDataModel : public bb::cascades::DataModel +{ + Q_OBJECT +public: + EclDataModel(QObject *parent = 0); + + // Required interface implementation + virtual int childCount(const QVariantList& indexPath); + virtual bool hasChildren(const QVariantList& indexPath); + virtual QVariant data(const QVariantList& indexPath); + virtual QString itemType(const QVariantList& indexPath); + void load(const QString& filename); + virtual ~EclDataModel() { } +private: + QVariantList m_jsonList; +}; + +#endif //ECL_DATAMODEL_HPP diff --git a/ECL/app/src/ecllistitem.cpp b/ECL/app/src/ecllistitem.cpp new file mode 100755 index 0000000..d20d60b --- /dev/null +++ b/ECL/app/src/ecllistitem.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is EclListItem class, responsible for creation of custom list item + * control. + ****************************************************************************/ + +#include "ecllistitem.hpp" +#include +#include +#include +#include +#include +#include +#include "eclutils.hpp" + +using namespace bb::cascades; + +EclListItem::EclListItem(Container *parent) : + CustomControl(parent), m_itemImage(0), m_listItem(0), m_highlightContainer(0) { + + Container *itemContainer = new Container(); + DockLayout *itemLayout = new DockLayout(); + itemContainer->setLayout(itemLayout); + + m_listItem = new StandardListItem(); + Container *imageContainer = new Container(); + imageContainer->setRightPadding(20); + imageContainer->setHorizontalAlignment(HorizontalAlignment::Right); + imageContainer->setVerticalAlignment(VerticalAlignment::Center); + + m_itemImage = new ImageView(); + m_itemImage->setImageSource(QUrl("asset:///images/forward.png")); + imageContainer->add(m_itemImage); + + itemContainer->add(m_listItem); + itemContainer->add(imageContainer); + + // A Colored Container will be used to show if an item is highlighted. + m_highlightContainer = new Container(); + + m_highlightContainer->setBackground(Color::fromARGB(0xff75b5d3)); + m_highlightContainer->setOpacity(0.0); + m_highlightContainer->setPreferredWidth(m_highlightContainer->maxWidth()); + + m_highlightContainer->setPreferredHeight(120.0f); + + itemContainer->add(m_highlightContainer); + setRoot(itemContainer); + +} + +/*************************************************************** + * Highlights the selected item. + ***************************************************************/ +void EclListItem::select(bool select) { + + // When an item is selected show the colored highlight Container + if (select) { + m_highlightContainer->setOpacity(0.5f); + } else { + m_highlightContainer->setOpacity(0.0f); + } + +} + +void EclListItem::reset(bool selected, bool activated) { + Q_UNUSED(activated); + select(selected); +} + +void EclListItem::activate(bool activate) { + select(activate); +} + +/*************************************************************** + * Return the list item's title. + ***************************************************************/ +const QString EclListItem::title() { + return m_title; +} + +/*************************************************************** + * Sets the title for the list item. + ***************************************************************/ +void EclListItem::setTitle(const QString newTitle) { + m_title = newTitle; + if (m_listItem) { + m_listItem->setTitle(m_title); + } +} + +/*************************************************************** + * Return the list item's description. + ***************************************************************/ +const QString EclListItem::description() { + return m_listItem->description(); +} +/*************************************************************** + * Sets the description for the list item. + ***************************************************************/ +void EclListItem::setDescription(const QString newDescription) { + if (m_listItem) { + m_listItem->setDescription(newDescription); + } +} diff --git a/ECL/app/src/ecllistitem.hpp b/ECL/app/src/ecllistitem.hpp new file mode 100755 index 0000000..fa9f7fa --- /dev/null +++ b/ECL/app/src/ecllistitem.hpp @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef ECLLISTITEM_HPP_ +#define ECLLISTITEM_HPP_ + +namespace bb { namespace cascades { class StandardListItem; }} +namespace bb { namespace cascades { class Container; }} +namespace bb { namespace cascades { class ImageView; }} + +#include +#include + +class EclListItem: public bb::cascades::CustomControl, public bb::cascades::ListItemListener { + + Q_OBJECT + Q_PROPERTY(QString title READ title WRITE setTitle); + Q_PROPERTY(QString description READ description WRITE setDescription); + +public: + EclListItem(bb::cascades::Container *parent = 0); + void select(bool select); + void reset(bool selected, bool activated); + void activate(bool activate); + + const QString title(); + void setTitle(const QString newTitle); + + const QString description(); + void setDescription(const QString newDescription); + +private: + bb::cascades::ImageView *m_itemImage; + bb::cascades::StandardListItem *m_listItem; + bb::cascades::Container *m_highlightContainer; + QString m_title; +}; + +#endif /* ECLLISTITEM_HPP_ */ + diff --git a/ECL/app/src/eclutils.cpp b/ECL/app/src/eclutils.cpp new file mode 100755 index 0000000..92aa2cd --- /dev/null +++ b/ECL/app/src/eclutils.cpp @@ -0,0 +1,396 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is EclUtils class, contains all the utility functions which are used + * by the application + * + ****************************************************************************/ + +#include "eclutils.hpp" +#include "eclconfig.hpp" +#include +#include + +#include +#include +#include +#include + +#include + +using namespace bb::system; + +EclUtils::EclUtils(QObject *parent) { + m_parent = parent; +} + +EclUtils::~EclUtils() { + +} + +/**************************************************************************** + * Converts the QVariantMap to QVariantList. + * Returns QVariantList + ****************************************************************************/ +QVariantList EclUtils::mapToList(const QVariantMap& map) { + + QMapIterator it(map); + QVariantMap displayMap; + QVariantList displayList; + + while (it.hasNext()) { + it.next(); + + displayMap.insert("fieldName", it.key()); + displayMap.insert("fieldValue", it.value()); + displayList.append(displayMap); + } + + return displayList; +} + +/**************************************************************************** + * Gets the Phone field list from the passed QVariantMap. + * Returns QVariantList of phone field entries + ***************************************************************************/ + +QVariantList EclUtils::getPhoneList(const QVariant& variant) { + + QVariantMap mainMap = variant.value(); + QVariantList lst; + QVariantMap subMap; + QMap::const_iterator it = mainMap.begin(); + while (it != mainMap.end()) { + + if (it.key() == EclConfig::jsonFieldName(EclConfig::OfficePhone) + || it.key() == EclConfig::jsonFieldName(EclConfig::CellPhone)) { + subMap.insert("fieldName", it.key()); + subMap.insert("fieldValue", it.value()); + lst.append(subMap); + } + it++; + } + + return lst; +} + +/**************************************************************************** + * Get email address for the selected contact + ****************************************************************************/ + +QVariantMap EclUtils::getEmailAddress(const QVariant& variant) { + + QVariantMap mainMap = variant.value(); + QVariantMap subMap; + QMap::const_iterator it = mainMap.begin(); + while (it != mainMap.end()) { + + if (it.key() == EclConfig::jsonFieldName(EclConfig::Email)) { + subMap.insert("fieldValue", it.value()); + } + it++; + } + return subMap; +} + +/**************************************************************************** + * Invokes the platform phone API to make a call. + ****************************************************************************/ +void EclUtils::makeCall(const QString& phNumber) { + + //bb::system::phone::Phone phone; + //phone.initiateCellularCall(number); + // this is not working in work side + /* + * making call is not working on the work side, tried using the above + * commented code (using bb::system::phone::Phone phone) and the below + * code, both are working on personal side without any problem + */ + + // Create a new invocation request + InvokeRequest request; + + request.setMimeType("application/vnd.blackberry.phone.startcall"); + request.setAction("bb.action.DIAL"); + + QVariantMap map; + map.insert("number", phNumber); + QByteArray requestData = bb::PpsObject::encode(map, NULL); + request.setData(requestData); + + // Start the invocation + InvokeManager *m_invokeManager = new InvokeManager(this); + const InvokeTargetReply *reply = m_invokeManager->invoke(request); + if (!reply) { + qDebug() << "EclUtils::makeCall-error"; + } +} + +/**************************************************************************** + * Invokes the platform email composer. + ****************************************************************************/ +bool EclUtils::sendEmail(const QString& email) { + + qDebug() << "EclUtils::sendEmail " << email; + // Create a new invocation request + InvokeRequest request; + + request.setTarget("sys.pim.uib.email.hybridcomposer"); + request.setAction("bb.action.OPEN"); + QString strUri("mailto:"); + strUri.append(email); + QUrl uri(strUri); + request.setUri(uri); + // Start the invocation + InvokeManager *m_invokeManager = new InvokeManager(this); + const InvokeTargetReply *reply = m_invokeManager->invoke(request); + if (!reply) { + qDebug() << "EclUtils::sendEmail-error invoking email client "; + return false; + } + return true; +} + +/**************************************************************************** + * Invokes the platform SMS composer. + ****************************************************************************/ +void EclUtils::sendSMS(const QString& number) { + Q_UNUSED(number) + showDialog("SMS feature not supported"); +} + +/**************************************************************************** + * Updates the destination file with the source file. + * Returns true on successful update, otherwise returns false + ****************************************************************************/ +bool EclUtils::updateFile(const QString& srcFile, const QString& destFile) { + + bool flag = true; + QFileInfo fi(destFile); + QString tempFile = fi.dir().path() + "/"; + tempFile = tempFile + "ecltest.json"; + + if (QFile::exists(destFile)) { + if (QFile::rename(destFile, tempFile)) { + qDebug() << "EclUtils:: File Renamed "; + if (QFile::copy(srcFile, destFile)) { + qDebug() << "EclUtils:: File Copied "; + QFile::remove(tempFile); + } else { + flag = false; + QFile::rename(tempFile, destFile); + qDebug() << "EclUtils:: File Copy Error "; + } + } else { + flag = false; + qDebug() << "EclUtils:: File Copy Error "; + } + } else { + + if (QFile::copy(srcFile, destFile)) { + qDebug() << "EclUtils:: File Copied "; + } else { + flag = false; + qDebug() << "EclUtils:: File Copy Error "; + } + } + + return flag; +} + +bool EclUtils::writeToJson(const QString filename, const QByteArray jsonContents) { + + QFile datafile(filename); + + if (datafile.open(QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream out(&datafile); + out << jsonContents; + datafile.close(); + return true; + } + + return false; +} + +/**************************************************************************** + * Loads the json file and returns the QVariant with the contents of + * the json. + ****************************************************************************/ +QVariant EclUtils::load(const QString& file_name) { + bb::data::JsonDataAccess jda; + + QVariant variant = jda.load(file_name).value(); + if (jda.hasError()) { + bb::data::DataAccessError error = jda.error(); + } + + return variant; +} + +/**************************************************************************** + * This function reads the ECL text file and generates the JSON file, which + * is used by the application UI. This was created to support the format + * in which the server is sending the ECL list to the BB7 ECL application + * shared with developer. + * To demo this there is a text file packaged with application. On selection + * of 'Demo with Text File' option this function is called and it generates + * the JSON file using the text file + * Returns true on successful conversion, otherwise returns false + ****************************************************************************/ + +bool EclUtils::textFileToJson(const QString& txtFile, const QString& jsonFile) { + + QFile file(txtFile); + QFile jfile(jsonFile); + + if (!file.open(QFile::ReadOnly)) { + qDebug() << "Unable to open file : " << txtFile; + return false; + } + + if (!jfile.open(QFile::WriteOnly)) { + qDebug() << "Unable to open file : " << jsonFile; + return false; + } + + QVariantMap map; + + QVariant variant = load("app/native/assets/data/config.json"); + if (variant.isValid()) { + map = variant.value(); + } + QTextStream ts(&file); + QTextStream out(&jfile); + + QChar ch; + int groupCount = 0; + int contactCount = 0; + int cfieldCount = 0; + bool gFlag = false; + QString element = ""; + + out << "[\n"; + do { + ts >> ch; + if (ch == '\n') + continue; + + if (ch == ';') { + if (element == "NEXT_GROUP") { + groupCount++; + gFlag = true; + if (groupCount > 1) { + out << "\n} \n] \n}, \n"; + groupCount--; + contactCount = 0; + } + out << "{ \"" << EclConfig::jsonFieldName(EclConfig::Title) + << "\" : "; + element = ""; + } else if (element == "NEW_CONTACT") { + contactCount++; + if (contactCount > 1) { + out << "\n}, \n"; + contactCount--; + } + + // Start of the new contact + out << "\n{ \n"; + // to indicate the first 2 fields are not having fieldname + cfieldCount = 2; + element = ""; + } else { + if (cfieldCount >= 1) { + // First two field names are not specified in text file, so handling that + switch (cfieldCount) { + case 2: + out << " \"" << EclConfig::jsonFieldName(EclConfig::Name) + << "\" : \"" << element << "\" "; + cfieldCount--; + break; + case 1: + out << ",\n \"" << EclConfig::jsonFieldName(EclConfig::Role) + << "\" : \"" << element << "\" "; + cfieldCount--; + break; + default: + break; + } + element = ""; + } else { + if (gFlag) { + // Only if it is the start of new group + out << "\"" << element << "\",\n \"list\": [ "; + gFlag = false; + } else { + out << "\"" << element << "\""; + } + + element = ""; + } + } + } else if (ch == ':') { + // Writes all keys by referring the config.json + out << ",\n \""<< (map[element].isValid() ? map[element].value() : element) << "\" : "; + element = ""; + } else { + element += ch; + } + + } while (!ts.atEnd()); + + out << "\n} \n] \n} \n]"; + + file.close(); + jfile.close(); + + qDebug() << "Json Conversion done"; + + return true; +} + +/**************************************************************************** + * A public function to display a SystemDialog. + ****************************************************************************/ +void EclUtils::showDialog(const QString msg) { + + SystemDialog *dialog = new SystemDialog("OK"); + + dialog->setTitle("Information"); + dialog->setBody(msg); + + //make a blocking call so we can delete the dialog once its responded by user + dialog->exec(); + dialog->deleteLater(); +} + +/**************************************************************************** + * A public function to display a SystemDialog for confirmation. + ****************************************************************************/ +int EclUtils::showConfirmDialog(const QString msg) { + + SystemDialog *dialog = new SystemDialog(); + + dialog->setTitle("Information"); + dialog->setBody(msg); + dialog->confirmButton()->setLabel(tr("Continue")); + dialog->cancelButton()->setLabel(tr("Cancel")); + + //make a blocking call so we can delete the dialog once its responded by user + int retValue = dialog->exec(); + dialog->deleteLater(); + return retValue; +} diff --git a/ECL/app/src/eclutils.hpp b/ECL/app/src/eclutils.hpp new file mode 100755 index 0000000..838e23b --- /dev/null +++ b/ECL/app/src/eclutils.hpp @@ -0,0 +1,59 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef ECLUTILS_HPP_ +#define ECLUTILS_HPP_ + +#include +#include + + +class EclUtils: public QObject{ + + Q_OBJECT +public: + EclUtils(QObject *parent); + virtual ~EclUtils(); + QVariant load(const QString& file_name); + +public: + Q_INVOKABLE QVariantList mapToList(const QVariantMap& item); + + Q_INVOKABLE QVariantList getPhoneList(const QVariant& variant); + Q_INVOKABLE QVariantMap getEmailAddress(const QVariant& variant); + + Q_INVOKABLE void makeCall(const QString& number); + Q_INVOKABLE bool sendEmail(const QString& email); + Q_INVOKABLE void sendSMS(const QString& number); + + Q_INVOKABLE bool updateFile(const QString& srcFile, const QString& destFile); + + Q_INVOKABLE bool textFileToJson(const QString& txtFile, const QString& jsonFile); + + bool writeToJson(const QString filename, const QByteArray jsonContents); + + Q_INVOKABLE void showDialog(const QString msg); + int showConfirmDialog(const QString msg); + +private: + QObject *m_parent; + + Q_SIGNALS: + void jsonUpdated(); +}; + +#endif /* ECLUTILS_HPP_ */ + diff --git a/ECL/app/src/filtereddatamodel.cpp b/ECL/app/src/filtereddatamodel.cpp new file mode 100755 index 0000000..e45d465 --- /dev/null +++ b/ECL/app/src/filtereddatamodel.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This is FilteredDataModel class, provides collapse/expand feature for the + * header item in a listview which dynamically populates the expanded items + * + ****************************************************************************/ + +#include "filtereddatamodel.hpp" + +FilteredDataModel::FilteredDataModel(bb::cascades::DataModel *sourceModel, + QObject *parent) : + bb::cascades::DataModel(parent), m_sourceDataModel(sourceModel) { + initialize(sourceModel); +} + +void FilteredDataModel::initialize(bb::cascades::DataModel *sourceModel) { + m_sourceDataModel = sourceModel; + QVariantList indexPath; + + int rootLevelItems = m_sourceDataModel->childCount(indexPath); + for (int i = 0; i < rootLevelItems; i++) { + m_expansionStates.append(true); + } +} + +/**************************************************************************** + * Return true if we are filtering this indexPath. + * Return false if we are using the underlying data as-is. + ****************************************************************************/ +bool FilteredDataModel::isFiltered(const QVariantList& indexPath) const { + return (indexPath.size() == 1 && + !isHeaderExpanded(indexPath[0].toInt())); +} + +/**************************************************************************** + * Return the number of children. + * Defer to the underlying data model unless the header is filtered. + * Note: assumes m_sourceDataModel is initialized + ****************************************************************************/ +int FilteredDataModel::childCount(const QVariantList& indexPath) { + if (isFiltered(indexPath)) { + // Unexpanded header + return 0; + } + return m_sourceDataModel->childCount(indexPath); // pointer always initialized +} + +/**************************************************************************** + * Return true if it has children. + ****************************************************************************/ +bool FilteredDataModel::hasChildren(const QVariantList& indexPath) { + if (isFiltered(indexPath)) { + // Unexpanded header + return false; + } + + return m_sourceDataModel->hasChildren(indexPath); +} + +/**************************************************************************** + * Return the data. + * The ListView will only call this for valid data, so just + * forward the request to the underlying data model. + ****************************************************************************/ +QVariant FilteredDataModel::data(const QVariantList& indexPath) { + if (indexPath.size() == 1) { // header item + QVariantMap data; + data["data"] = m_sourceDataModel->data(indexPath); + data["expanded"] = m_expansionStates.at(indexPath[0].toInt()); + + return data; + } else { + // Pass through the data from the source model + return m_sourceDataModel->data(indexPath); + } +} + +/**************************************************************************** + * Return the item type. + * The ListView will only call this for valid data, so just + * forward the request to the underlying data model. + ****************************************************************************/ + +QString FilteredDataModel::itemType(const QVariantList& indexPath) { + return m_sourceDataModel->itemType(indexPath); +} + +/**************************************************************************** + * Expand or collapse the specified header. + ****************************************************************************/ + +void FilteredDataModel::changeHeaderExpansion(int headerIndex) { + m_expansionStates[headerIndex] = !m_expansionStates[headerIndex]; + emit itemsChanged(bb::cascades::DataModelChangeType::AddRemove); +} + +bool FilteredDataModel::isHeaderExpanded(int headerIndex) const { + return m_expansionStates[headerIndex]; +} + +void FilteredDataModel::reload(bb::cascades::DataModel *sourceModel) { + initialize(sourceModel); + emit itemsChanged(bb::cascades::DataModelChangeType::AddRemove); +} + diff --git a/ECL/app/src/filtereddatamodel.hpp b/ECL/app/src/filtereddatamodel.hpp new file mode 100755 index 0000000..38b5b10 --- /dev/null +++ b/ECL/app/src/filtereddatamodel.hpp @@ -0,0 +1,47 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef FILTEREDDATAMODEL_HPP +#define FILTEREDDATAMODEL_HPP + +#include +#include + +class FilteredDataModel : public bb::cascades::DataModel +{ +public: + FilteredDataModel(bb::cascades::DataModel *sourceModel, QObject *parent = 0); + + // Required interface implementation + virtual int childCount(const QVariantList& indexPath); + virtual bool hasChildren(const QVariantList& indexPath); + virtual QVariant data(const QVariantList& indexPath); + virtual QString itemType(const QVariantList& indexPath); + + bool isHeaderExpanded(int headerIndex) const; + void changeHeaderExpansion(int headerIndex); + void reload(bb::cascades::DataModel *sourceModel); + virtual ~FilteredDataModel() { } +private: + bool isFiltered(const QVariantList& indexPath) const; + void initialize(bb::cascades::DataModel *sourceModel); + +private: + bb::cascades::DataModel* m_sourceDataModel; + QList m_expansionStates; +}; + +#endif //FILTEREDDATAMODEL_HPP diff --git a/ECL/app/src/main.cpp b/ECL/app/src/main.cpp new file mode 100755 index 0000000..6a5f873 --- /dev/null +++ b/ECL/app/src/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This has the application entry function main() + ****************************************************************************/ +#include +#include +#include +#include "ecl.hpp" + +using namespace bb::cascades; + +Q_DECL_EXPORT int main(int argc, char **argv) +{ + + // this is where the server is started etc + Application app(argc, argv); + + // localization support + QTranslator translator; + QString locale_string = QLocale().name(); + QString filename = QString( "ECL_%1" ).arg( locale_string ); + if (translator.load(filename, "app/native/qm")) { + app.installTranslator( &translator ); + } + + new ECL(&app); + + // we complete the transaction started in the app constructor and start the client event loop here + return Application::exec(); + // when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children) +} + diff --git a/ECL/app/src/pushclient/pushclientnotification.cpp b/ECL/app/src/pushclient/pushclientnotification.cpp new file mode 100755 index 0000000..c41ea9a --- /dev/null +++ b/ECL/app/src/pushclient/pushclientnotification.cpp @@ -0,0 +1,130 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This class takes care of creating and setting up the framework required + * to be able to reveive Push Notifications + * + ****************************************************************************/ + +#include "pushclientnotification.hpp" + +using namespace bb::network; + +PushClientNotification::PushClientNotification(QObject *parent) : + QObject(parent), m_pushService(0) { +} + + +/**************************************************************************** + * Create a Session with the Push Service. + ****************************************************************************/ +void PushClientNotification::createSession() { + + // Check to see if the PushService has a connection to the Push Agent. + // This can occur if the application doesn't have sufficient permissions to use Push. + if (m_pushService->hasConnection()) { + m_pushService->createSession(); + } else { + emit noPushServiceConnection(); + } + +} + +/**************************************************************************** + * Create a Channel to receive Push Notifications. + ****************************************************************************/ +void PushClientNotification::createChannel() { + if (m_pushService->hasConnection()) { + m_pushService->createChannel(m_configuration.ppgUrl()); + } else { + emit noPushServiceConnection(); + } +} + +/**************************************************************************** + * Register so that the Push notification can launch the application. + ****************************************************************************/ +void PushClientNotification::registerToLaunch() { + m_pushService->registerToLaunch(); +} + +/**************************************************************************** + * Unregister from Launch Requests. Now The application will no longer get + * launched after a push notification. + ****************************************************************************/ +void PushClientNotification::unregisterFromLaunch() { + m_pushService->unregisterFromLaunch(); +} + +/**************************************************************************** + * Accept the Pus Notification. + ****************************************************************************/ +void PushClientNotification::acceptPush(const QString &payloadId) { + m_pushService->acceptPush(payloadId); +} + +/**************************************************************************** + * Initialize the Push Service. This takes care of setting up the various + * signal-slot connections required for succesful reciept of push + * Notifications + ****************************************************************************/ +void PushClientNotification::initializePushService() { + + if (!m_pushService) { + + m_pushService = new PushService(m_configuration.providerApplicationId(), + m_configuration.invokeTargetPush(), this); + + QObject::connect(m_pushService, + SIGNAL(createSessionCompleted(const bb::network::PushStatus&)), + this, + SIGNAL(createSessionCompleted(const bb::network::PushStatus&))); + QObject::connect(m_pushService, + SIGNAL(createChannelCompleted(const bb::network::PushStatus&, const QString)), + this, + SIGNAL(createChannelCompleted(const bb::network::PushStatus&, const QString))); + QObject::connect(m_pushService, + SIGNAL(destroyChannelCompleted(const bb::network::PushStatus&)), + this, + SIGNAL(destroyChannelCompleted(const bb::network::PushStatus&))); + QObject::connect(m_pushService, + SIGNAL(registerToLaunchCompleted(const bb::network::PushStatus&)), + this, + SIGNAL(registerToLaunchCompleted(const bb::network::PushStatus&))); + QObject::connect(m_pushService, + SIGNAL(unregisterFromLaunchCompleted(const bb::network::PushStatus&)), + this, + SIGNAL(unregisterFromLaunchCompleted(const bb::network::PushStatus&))); + QObject::connect(m_pushService, SIGNAL(simChanged()), this, + SIGNAL(simChanged())); + QObject::connect(m_pushService, + SIGNAL(pushTransportReady(bb::network::PushCommand::Type)), + this, + SIGNAL(pushTransportReady(bb::network::PushCommand::Type))); + fprintf(stdout, "PushClientNotificationService::initializePushService <=\n"); + } + +} + +/**************************************************************************** + * Destroy the channel to receive Push Notifications. + ****************************************************************************/ +void PushClientNotification::destroyChannel() { + if (m_pushService->hasConnection()) { + m_pushService->destroyChannel(); + } +} + diff --git a/ECL/app/src/pushclient/pushclientnotification.hpp b/ECL/app/src/pushclient/pushclientnotification.hpp new file mode 100755 index 0000000..a2f63f8 --- /dev/null +++ b/ECL/app/src/pushclient/pushclientnotification.hpp @@ -0,0 +1,60 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef PUSHCLIENTNOTIFICATION_HPP_ +#define PUSHCLIENTNOTIFICATION_HPP_ + +#include "pushconfiguration.hpp" + +#include +#include + +class PushClientNotification : public QObject +{ + Q_OBJECT + +public: + PushClientNotification(QObject *parent = 0); + + void createSession(); + void createChannel(); + void initializePushService(); + void destroyChannel(); + void registerToLaunch(); + void unregisterFromLaunch(); + void acceptPush(const QString &payloadId); + +signals: + void createSessionCompleted(const bb::network::PushStatus &status); + void createChannelCompleted(const bb::network::PushStatus &status, const QString &token); + void destroyChannelCompleted(const bb::network::PushStatus &status); + void registerToLaunchCompleted(const bb::network::PushStatus &status); + void unregisterFromLaunchCompleted(const bb::network::PushStatus &status); + void simChanged(); + void pushTransportReady(bb::network::PushCommand::Type command); + void piRegistrationCompleted(int code, const QString &description); + void piDeregistrationCompleted(int code, const QString &description); + void noPushServiceConnection(); + + +private: + PushConfiguration m_configuration; + bb::network::PushService *m_pushService; + +}; + + +#endif /* PUSHCLIENTNOTIFICATION_HPP_ */ diff --git a/ECL/app/src/pushclient/pushconfiguration.cpp b/ECL/app/src/pushclient/pushconfiguration.cpp new file mode 100755 index 0000000..ddd278f --- /dev/null +++ b/ECL/app/src/pushclient/pushconfiguration.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ +/* + * This class is holds various configuration parameters of the push + * service for the Application. It also exposes getters and setter methods + * for those parameters. + ****************************************************************************/ + + +#include "pushconfiguration.hpp" + +//This should match with id specified in bar-descriptor.xml +#define AAP_ID "bb10.cascades.ecl" +// This needs to match the invoke target specified in bar-descriptor.xml +// The Invoke target key for receiving new push notifications +#define INVOKE_TARGET_KEY_PUSH "bb10.cascades.ecl.invoke.r1.push" + +// This needs to match the invoke target specified in bar-descriptor.xml +// The Invoke target key when selecting a notification in the BlackBerry Hub +#define INVOKE_TARGET_KEY_OPEN "bb10.cascades.ecl.invoke.r1.open" + +PushConfiguration::PushConfiguration() + : m_providerApplicationId(AAP_ID) + , m_ppgUrl("") + , m_invokeTargetPush(INVOKE_TARGET_KEY_PUSH) + , m_invokeTargetOpen(INVOKE_TARGET_KEY_OPEN) { +} + +PushConfiguration::~PushConfiguration() { +} + + +/**************************************************************************** +* Getter and Setter functions for the Push Invocation target. +****************************************************************************/ +QString PushConfiguration::invokeTargetPush() const { + return m_invokeTargetPush; +} + +void PushConfiguration::setInvokeTargetPush(QString invokeTargetPush) { + m_invokeTargetPush = invokeTargetPush; +} + +/**************************************************************************** +* Getter and Setter functions for the target to open when a Push Notification +* arrives. +****************************************************************************/ +QString PushConfiguration::invokeTargetOpen() const { + return m_invokeTargetOpen; +} + +void PushConfiguration::setInvokeTargetOpen(QString invokeTargetOpen) { + m_invokeTargetOpen = invokeTargetOpen; +} + +/**************************************************************************** +* Getter and Setter functions for the Application ID of the provider +****************************************************************************/ +QString PushConfiguration::providerApplicationId() const { + return m_providerApplicationId; +} + +void PushConfiguration::setProviderApplicationId( + const QString& providerApplicationId) { + m_providerApplicationId = providerApplicationId; +} + +/**************************************************************************** +* Getter and Setter functions for the URL of the Push Proxy Gateway +****************************************************************************/ +QString PushConfiguration::ppgUrl() const { + return m_ppgUrl; +} + +void PushConfiguration::setPpgUrl(const QString& ppgUrl) { + m_ppgUrl = ppgUrl; +} + diff --git a/ECL/app/src/pushclient/pushconfiguration.hpp b/ECL/app/src/pushclient/pushconfiguration.hpp new file mode 100755 index 0000000..87417a4 --- /dev/null +++ b/ECL/app/src/pushclient/pushconfiguration.hpp @@ -0,0 +1,62 @@ +/**************************************************************************** + * Copyright 2012 BlackBerry Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ****************************************************************************/ + +#ifndef PUSHCONFIGURATION_HPP_ +#define PUSHCONFIGURATION_HPP_ + +#include + +/*! + * Configuration settings for the push application. + */ +class PushConfiguration { +public: + PushConfiguration(); + virtual ~PushConfiguration(); + + QString providerApplicationId() const; + QString ppgUrl() const; + QString invokeTargetPush() const; + QString invokeTargetOpen() const; + bool launchApplicationOnPush() const; + + void setProviderApplicationId(const QString& providerApplicationId); + void setPpgUrl(const QString& ppgUrl); + void setPushInitiatorUrl(const QString& pushInitiatorUrl); + void setInvokeTargetPush(QString invokeTargetPush); + void setInvokeTargetOpen(QString invokeTargetOpen); + void setLaunchApplicationOnPush(bool launchApplicationOnPush); + +private: + // If writing a consumer application, this corresponds to the unique ID you receive in your confirmation email after signing up + // for the BlackBerry Push Service. + // If writing an enterprise application and you are using the Push Service SDK to implement your Push Initiator on the server-side, + // this corresponds to the arbitrary application ID that you decide on. + // If writing an enterprise application and you are not using the Push Service SDK, this will be null. + QString m_providerApplicationId; + + // This matches the URL used to register with / unregister from the BlackBerry Push Service (BIS) PPG. + // For eval, this would be http://cp.pushapi.eval.blackberry.com. + // For production, this would be http://cp.pushapi.na.blackberry.com + // Replace with your content provider ID (that you received when registering). + // This applies to consumer applications only and will be null for enterprise applications. + QString m_ppgUrl; + + QString m_invokeTargetPush; + QString m_invokeTargetOpen; +}; + +#endif /* PUSHCONFIGURATION_HPP_ */ diff --git a/ECL/app/translations/ECL.pro b/ECL/app/translations/ECL.pro new file mode 100755 index 0000000..4094b83 --- /dev/null +++ b/ECL/app/translations/ECL.pro @@ -0,0 +1 @@ +include (../ECL.pro) diff --git a/ECL/app/translations/ECL.qm b/ECL/app/translations/ECL.qm new file mode 100755 index 0000000..be651ee --- /dev/null +++ b/ECL/app/translations/ECL.qm @@ -0,0 +1 @@ +<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/ECL/app/translations/ECL.ts b/ECL/app/translations/ECL.ts new file mode 100755 index 0000000..b04e733 --- /dev/null +++ b/ECL/app/translations/ECL.ts @@ -0,0 +1,154 @@ + + + + + ECL + + + + This will temporarily overwrite your contact list with test data. + + + + + EclConfig + + + Title + + + + + Name + + + + + Role + + + + + CellPhone + + + + + OfficePhone + + + + + Email + + + + + + Backup + + + + + BBPin + + + + + list + + + + + Work + + + + + Mobile + + + + + email + + + + + BBM + + + + + EclUtils + + + Continue + + + + + Cancel + + + + + main + + + Emergency Contact List + + + + + Call + + + + + SMS + + + + + Email + + + + + phonelist + + + Call + + + + + viewdetails + + + Add To Contact + + + + + Confirmation!! + + + + + Contact will be added to device contacts ? + + + + + Add to contact is failed + + + + + Add to contact is successfull + + + + diff --git a/ECL/app/translations/Makefile b/ECL/app/translations/Makefile new file mode 100755 index 0000000..2128abd --- /dev/null +++ b/ECL/app/translations/Makefile @@ -0,0 +1,12 @@ +QMAKE_TARGET = ECL +LUPDATE = $(QNX_HOST)/usr/bin/lupdate +LRELEASE = $(QNX_HOST)/usr/bin/lrelease + +update: $(QMAKE_TARGET).pro FORCE + $(LUPDATE) $(QMAKE_TARGET).pro + +release: $(QMAKE_TARGET).pro $(QMAKE_TARGET).ts + $(LRELEASE) $(QMAKE_TARGET).pro + +FORCE: + diff --git a/ECL/docs/EmergencyContactList_Software_Architecture.docx b/ECL/docs/EmergencyContactList_Software_Architecture.docx new file mode 100755 index 0000000..f704fdc Binary files /dev/null and b/ECL/docs/EmergencyContactList_Software_Architecture.docx differ diff --git a/ECL/server/index.htm b/ECL/server/index.htm new file mode 100755 index 0000000..0e8cbb4 --- /dev/null +++ b/ECL/server/index.htm @@ -0,0 +1,395 @@ + + + + + + + Emergency Contact list + + + +

Emergency Contact list Test

+ Destination Email: +
+ +
+ BES Address: +
+ +
+ MDS-CS Listen Port: +
+ +
+ Application Listen Port: +
+ +
+ + + + ECL-1 + + + + ECL-2 + + + + ECL-3 + + +
+ Content to Push: +
+ +
+ +
+ + Emergency Contact List: +
+ When the Emergency Contact List(ECL) first runs the Contact list be empty. + This web app provides the ability to send emergency contact list to the application for testing and + demonstrations. It can be run via the browser on your PC as long as JavaScript and Ajax are enabled. + Enter the email address of user to whom the EC list should be sent. The contact list to be sent can + be selected via radio buttons or manually entered. Click on the 'Do Push' button to send the request. +
+
+ The EC list will be received on the device just seconds after it is sent and a notification + will be added to the notification hub and a splat to application icon. + From the application, user can send emails, call to the Emergency contact and the the emergency contact can be added to the device address book. +
+ + + \ No newline at end of file