diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b4d14b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/arm +.DS_Store +/x86 +*.settings/* + diff --git a/AutoTrak/.cproject b/AutoTrak/.cproject new file mode 100644 index 0000000..7320269 --- /dev/null +++ b/AutoTrak/.cproject @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AutoTrak/.device b/AutoTrak/.device new file mode 100644 index 0000000..279f134 --- /dev/null +++ b/AutoTrak/.device @@ -0,0 +1,6 @@ +#Project target device definition. +#Wed Jun 26 18:11:29 EDT 2013 +ppi=356 +height=1280 +kind=PHONE +width=768 diff --git a/AutoTrak/.gitignore b/AutoTrak/.gitignore new file mode 100644 index 0000000..8b4d14b --- /dev/null +++ b/AutoTrak/.gitignore @@ -0,0 +1,5 @@ +/arm +.DS_Store +/x86 +*.settings/* + diff --git a/AutoTrak/.project b/AutoTrak/.project new file mode 100644 index 0000000..568bbe4 --- /dev/null +++ b/AutoTrak/.project @@ -0,0 +1,44 @@ + + + AutoTrak + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.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 + + + + + + org.eclipse.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/AutoTrak/AutoTrak.pro b/AutoTrak/AutoTrak.pro new file mode 100644 index 0000000..d6096d1 --- /dev/null +++ b/AutoTrak/AutoTrak.pro @@ -0,0 +1,10 @@ +APP_NAME = AutoTrak + +CONFIG += qt warn_on cascades10 + +LIBS += -lbbcascadespickers +LIBS += -lbbdata +LIBS += -lbbsystem +LIBS += -lbb + +include(config.pri) diff --git a/AutoTrak/LICENSE b/AutoTrak/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/AutoTrak/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. \ No newline at end of file diff --git a/AutoTrak/Makefile b/AutoTrak/Makefile new file mode 100644 index 0000000..f32b90d --- /dev/null +++ b/AutoTrak/Makefile @@ -0,0 +1,6 @@ +QMAKE_TARGET = AutoTrak +PROJECT_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) +I18N_DIR := $(PROJECT_DIR)/translations + +include mk/cs-base.mk + diff --git a/AutoTrak/README.md b/AutoTrak/README.md new file mode 100644 index 0000000..008c322 --- /dev/null +++ b/AutoTrak/README.md @@ -0,0 +1,80 @@ + +***AUTOTRAK*** + + + +# Table of Contents + +[Introduction](#toc_1) +[Contributors](#toc_2) +[Tested On](#toc_3) +[Application Permissions](#toc_4) +[Summary](#toc_5) +[Project Build](#toc_6) +[Disclaimer](#toc_7) + +# Introduction + +This is a sample insurance mobile application to review submitted insurace claims by individuals. +The application allows insurance adjusters to lookup information pertaining to insurance claims. +Relevant information included in this application are: claim details, claimant reports, police reports, +and witness reports. Additional functionality for searching for repair facilities is also provided in the +sample application. + +# Contributors + +1. Jesse Boudreau +2. HyunJun Jung @hjung + +# Tested On + +BlackBerry Z30 v. 10.2.1.x +BlackBerry Z10 v. 10.2.1.x +BlackBerry Q10 v. 10.2.0.x + +# Application Permissions + +Requires the following permissions to be accepted by the user: +1. Camera +2. Internet +3. Location +4. Phone +5. Shared Files + +# Summary + +The application is a BlackBerry 10 Native application written in the Cascades UI framework. +This sample application demonstrates the usage of many BlackBerry 10 core controls which include +Navigation pane, Page, Container, Scroll View, Picker, Header, Image View, and List View. +This application keeps its collected data in a local SQLite database and provides the functionality +to edit existing records as well as share content using the share framework. + +# Project Build + +Assumptions: +- Momentics is installed and you have installed SDK version 10.1 or higher. If not please download +the latest version by following the link below. + +1. Import this project into the [BlackBerry Momentics IDE](https://developer.blackberry.com/native/). +2. Perform a clean build +3. Create a run configuration for your device connected via USB +4. Run the application in Debug mode with a Debug token unless you are ready to release the build + +# Issues +1. The event details within the police report detail page is not updating the database properly +2. Adding a photo after the picker selection results in a black tile (10.2.1 only) +3. Choosing a repair shop functionality has not been implemented +4. Claim detail page does not update all fields to the database. Fields that do not currently update are + a. Loss Damage Time + b. Cause + c. Notified Time + +# Disclaimer + +HE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + diff --git a/AutoTrak/assets/.assets.index b/AutoTrak/assets/.assets.index new file mode 100644 index 0000000..9bf3670 --- /dev/null +++ b/AutoTrak/assets/.assets.index @@ -0,0 +1,89 @@ +1 +87 +720x720/HeaderBar.qml +BaseTab.qml +HeaderBar.qml +img/add_icon_81x81.png +img/Background-8.jpg +img/blue_sign.png +img/car_icon.png +img/check_icon_81x81.png +img/details_icon.png +img/edit_icon_81x81.png +img/folder_icon_81x81.png +img/green_sign.png +img/Highway_401_Night_Busy.png +img/Highway_Night.png +img/Highway_Night_HKG.png +img/open_folder_icon_81x81.png +img/orange_sign.png +img/picture_icon_81x81.png +img/rotate_icon_81x81.png +img/samples/11981_1.jpg +img/samples/11981_2.jpg +img/samples/11981_3.jpg +img/samples/11981_4.jpg +img/samples/11982_1.jpg +img/samples/11983_1.jpg +img/samples/11984_1.jpg +img/samples/11984_2.jpg +img/samples/11985_1.jpg +img/samples/11986_1.jpg +img/samples/11986_2.jpg +img/samples/11987_1.jpg +img/samples/11988_1.jpg +img/samples/11988_2.jpg +img/samples/11988_3.jpg +img/samples/11989_1.jpg +img/samples/11990_1.jpg +img/samples/11990_2.jpg +img/samples/11990_3.jpg +img/samples/11991_1.jpg +img/samples/11991_2.jpg +img/samples/11992_1.jpg +img/samples/11992_2.jpg +img/samples/11992_3.jpg +img/samples/11993_1.jpg +img/samples/11993_2.jpg +img/samples/11993_3.jpg +img/samples/11993_4.jpg +img/samples/11994_1.jpg +img/samples/11994_2.jpg +img/samples/11994_3.jpg +img/samples/11995_1.jpg +img/samples/11996_1.jpg +img/samples/11997_1.jpg +img/samples/11998_1.jpg +img/samples/11999_1.jpg +img/samples/12000_1.jpg +img/search_icon_81x81.png +img/select_icon_81x81.png +img/share_icon_81x81.png +img/tag_icon_81x81.png +img/target.png +img/text_icon_81x81.png +img/undo_icon_81x81.png +img/yellow_sign.png +img/zoom_in_icon_81x81.png +js/utils.js +main.qml +models/AutoValues.xml +models/ClaimModel.qml +models/PhotoModel.qml +models/RepairModel.qml +models/ReportModel.qml +pages/BaseTabPage.qml +pages/ClaimantReport.qml +pages/ClaimDetail.qml +pages/EditClaim.qml +pages/EditClaimantReport.qml +pages/EditPhoto.qml +pages/EditPoliceReport.qml +pages/EditWitnessReport.qml +pages/Photos.qml +pages/PoliceReport.qml +pages/Repairs.qml +pages/Reports.qml +pages/ViewPhoto.qml +pages/WitnessReport.qml +sql/data_r5.db diff --git a/AutoTrak/assets/720x720/HeaderBar.qml b/AutoTrak/assets/720x720/HeaderBar.qml new file mode 100644 index 0000000..71c6d70 --- /dev/null +++ b/AutoTrak/assets/720x720/HeaderBar.qml @@ -0,0 +1,36 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 + +Container { + + property alias title: lbl.text + + horizontalAlignment: HorizontalAlignment.Fill + background: Color.create("#333333") + Label { + id: lbl + horizontalAlignment: HorizontalAlignment.Center + textStyle { + base: SystemDefaults.TextStyles.TitleText + color: Color.White + } + } + topPadding: 15 + bottomPadding: 15 +} diff --git a/AutoTrak/assets/BaseTab.qml b/AutoTrak/assets/BaseTab.qml new file mode 100644 index 0000000..a139c1f --- /dev/null +++ b/AutoTrak/assets/BaseTab.qml @@ -0,0 +1,70 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import "pages" + +Tab { + ActionBar.placement: ActionBarPlacement.InOverflow + imageSource: "asset:///img/folder_icon_81x81.png" + + property alias pageObjectName: pg.objectName + property alias modelObjectName: pg.modelObjectName + property alias dataSource: pg.dataSource + property alias whereClause: pg.whereClause + property bool autoLoad: false + + property variant claimDetail; + + function refresh() { + pg.refresh(); + } + + function updateData() { + pg.updateData(); + } + + NavigationPane { + id: nav + + onTopChanged: { + nav.peekEnabled = (page.objectName != "editPhoto"); + } + + BaseTabPage { + id: pg + + onShowClaimDetail: { + // Create the content page and push it on top to drill down to it. + claimDetail = claimDetailDefinition.createObject(); + claimDetail.claimData = selectedData; + claimDetail.updateClaim.connect(pg.updateClaim) + claimDetail.nav = nav; + nav.push(claimDetail); + } + } + + attachedObjects: [ + ComponentDefinition { + // Definition used for creating a Content Page to which the + // user can drill down to read the quote. + id: claimDetailDefinition + source: "pages/ClaimDetail.qml" + } + ] + } +} diff --git a/AutoTrak/assets/HeaderBar.qml b/AutoTrak/assets/HeaderBar.qml new file mode 100644 index 0000000..7f9add6 --- /dev/null +++ b/AutoTrak/assets/HeaderBar.qml @@ -0,0 +1,36 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 + +Container { + + property alias title: lbl.text + + horizontalAlignment: HorizontalAlignment.Fill + background: Color.create("#333333") + Label { + id: lbl + horizontalAlignment: HorizontalAlignment.Center + textStyle { + base: SystemDefaults.TextStyles.TitleText + color: Color.White + } + } + topPadding: 30 + bottomPadding: 30 +} diff --git a/AutoTrak/assets/img/Background-8.jpg b/AutoTrak/assets/img/Background-8.jpg new file mode 100644 index 0000000..ca8f7af Binary files /dev/null and b/AutoTrak/assets/img/Background-8.jpg differ diff --git a/AutoTrak/assets/img/Highway_401_Night_Busy.png b/AutoTrak/assets/img/Highway_401_Night_Busy.png new file mode 100644 index 0000000..8c9f376 Binary files /dev/null and b/AutoTrak/assets/img/Highway_401_Night_Busy.png differ diff --git a/AutoTrak/assets/img/Highway_Night.png b/AutoTrak/assets/img/Highway_Night.png new file mode 100644 index 0000000..453f1d4 Binary files /dev/null and b/AutoTrak/assets/img/Highway_Night.png differ diff --git a/AutoTrak/assets/img/Highway_Night_HKG.png b/AutoTrak/assets/img/Highway_Night_HKG.png new file mode 100644 index 0000000..82960e8 Binary files /dev/null and b/AutoTrak/assets/img/Highway_Night_HKG.png differ diff --git a/AutoTrak/assets/img/add_icon_81x81.png b/AutoTrak/assets/img/add_icon_81x81.png new file mode 100644 index 0000000..1deb56b Binary files /dev/null and b/AutoTrak/assets/img/add_icon_81x81.png differ diff --git a/AutoTrak/assets/img/blue_sign.png b/AutoTrak/assets/img/blue_sign.png new file mode 100644 index 0000000..220c447 Binary files /dev/null and b/AutoTrak/assets/img/blue_sign.png differ diff --git a/AutoTrak/assets/img/car_icon.png b/AutoTrak/assets/img/car_icon.png new file mode 100644 index 0000000..70ebd7b Binary files /dev/null and b/AutoTrak/assets/img/car_icon.png differ diff --git a/AutoTrak/assets/img/check_icon_81x81.png b/AutoTrak/assets/img/check_icon_81x81.png new file mode 100644 index 0000000..dfb0f1a Binary files /dev/null and b/AutoTrak/assets/img/check_icon_81x81.png differ diff --git a/AutoTrak/assets/img/details_icon.png b/AutoTrak/assets/img/details_icon.png new file mode 100644 index 0000000..5795a2b Binary files /dev/null and b/AutoTrak/assets/img/details_icon.png differ diff --git a/AutoTrak/assets/img/edit_icon_81x81.png b/AutoTrak/assets/img/edit_icon_81x81.png new file mode 100644 index 0000000..ea301cb Binary files /dev/null and b/AutoTrak/assets/img/edit_icon_81x81.png differ diff --git a/AutoTrak/assets/img/folder_icon_81x81.png b/AutoTrak/assets/img/folder_icon_81x81.png new file mode 100644 index 0000000..8134e58 Binary files /dev/null and b/AutoTrak/assets/img/folder_icon_81x81.png differ diff --git a/AutoTrak/assets/img/green_sign.png b/AutoTrak/assets/img/green_sign.png new file mode 100644 index 0000000..99daba6 Binary files /dev/null and b/AutoTrak/assets/img/green_sign.png differ diff --git a/AutoTrak/assets/img/open_folder_icon_81x81.png b/AutoTrak/assets/img/open_folder_icon_81x81.png new file mode 100644 index 0000000..5865a80 Binary files /dev/null and b/AutoTrak/assets/img/open_folder_icon_81x81.png differ diff --git a/AutoTrak/assets/img/orange_sign.png b/AutoTrak/assets/img/orange_sign.png new file mode 100644 index 0000000..d31bf64 Binary files /dev/null and b/AutoTrak/assets/img/orange_sign.png differ diff --git a/AutoTrak/assets/img/picture_icon_81x81.png b/AutoTrak/assets/img/picture_icon_81x81.png new file mode 100644 index 0000000..d2308d8 Binary files /dev/null and b/AutoTrak/assets/img/picture_icon_81x81.png differ diff --git a/AutoTrak/assets/img/rotate_icon_81x81.png b/AutoTrak/assets/img/rotate_icon_81x81.png new file mode 100644 index 0000000..96ad139 Binary files /dev/null and b/AutoTrak/assets/img/rotate_icon_81x81.png differ diff --git a/AutoTrak/assets/img/samples/11981_1.jpg b/AutoTrak/assets/img/samples/11981_1.jpg new file mode 100644 index 0000000..f4601c8 Binary files /dev/null and b/AutoTrak/assets/img/samples/11981_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11981_2.jpg b/AutoTrak/assets/img/samples/11981_2.jpg new file mode 100644 index 0000000..8d19036 Binary files /dev/null and b/AutoTrak/assets/img/samples/11981_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11981_3.jpg b/AutoTrak/assets/img/samples/11981_3.jpg new file mode 100644 index 0000000..ee2d8ab Binary files /dev/null and b/AutoTrak/assets/img/samples/11981_3.jpg differ diff --git a/AutoTrak/assets/img/samples/11981_4.jpg b/AutoTrak/assets/img/samples/11981_4.jpg new file mode 100644 index 0000000..c4e261a Binary files /dev/null and b/AutoTrak/assets/img/samples/11981_4.jpg differ diff --git a/AutoTrak/assets/img/samples/11982_1.jpg b/AutoTrak/assets/img/samples/11982_1.jpg new file mode 100644 index 0000000..6ca7c19 Binary files /dev/null and b/AutoTrak/assets/img/samples/11982_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11983_1.jpg b/AutoTrak/assets/img/samples/11983_1.jpg new file mode 100644 index 0000000..586f5ba Binary files /dev/null and b/AutoTrak/assets/img/samples/11983_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11984_1.jpg b/AutoTrak/assets/img/samples/11984_1.jpg new file mode 100644 index 0000000..1e6f606 Binary files /dev/null and b/AutoTrak/assets/img/samples/11984_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11984_2.jpg b/AutoTrak/assets/img/samples/11984_2.jpg new file mode 100644 index 0000000..fe364f8 Binary files /dev/null and b/AutoTrak/assets/img/samples/11984_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11985_1.jpg b/AutoTrak/assets/img/samples/11985_1.jpg new file mode 100644 index 0000000..7eef5f6 Binary files /dev/null and b/AutoTrak/assets/img/samples/11985_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11986_1.jpg b/AutoTrak/assets/img/samples/11986_1.jpg new file mode 100644 index 0000000..7e1b487 Binary files /dev/null and b/AutoTrak/assets/img/samples/11986_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11986_2.jpg b/AutoTrak/assets/img/samples/11986_2.jpg new file mode 100644 index 0000000..ab6f537 Binary files /dev/null and b/AutoTrak/assets/img/samples/11986_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11987_1.jpg b/AutoTrak/assets/img/samples/11987_1.jpg new file mode 100644 index 0000000..f3a9e1b Binary files /dev/null and b/AutoTrak/assets/img/samples/11987_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11988_1.jpg b/AutoTrak/assets/img/samples/11988_1.jpg new file mode 100644 index 0000000..032dbf1 Binary files /dev/null and b/AutoTrak/assets/img/samples/11988_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11988_2.jpg b/AutoTrak/assets/img/samples/11988_2.jpg new file mode 100644 index 0000000..e729007 Binary files /dev/null and b/AutoTrak/assets/img/samples/11988_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11988_3.jpg b/AutoTrak/assets/img/samples/11988_3.jpg new file mode 100644 index 0000000..c2e7008 Binary files /dev/null and b/AutoTrak/assets/img/samples/11988_3.jpg differ diff --git a/AutoTrak/assets/img/samples/11989_1.jpg b/AutoTrak/assets/img/samples/11989_1.jpg new file mode 100644 index 0000000..79bb10e Binary files /dev/null and b/AutoTrak/assets/img/samples/11989_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11990_1.jpg b/AutoTrak/assets/img/samples/11990_1.jpg new file mode 100644 index 0000000..758b534 Binary files /dev/null and b/AutoTrak/assets/img/samples/11990_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11990_2.jpg b/AutoTrak/assets/img/samples/11990_2.jpg new file mode 100644 index 0000000..4b42c54 Binary files /dev/null and b/AutoTrak/assets/img/samples/11990_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11990_3.jpg b/AutoTrak/assets/img/samples/11990_3.jpg new file mode 100644 index 0000000..798e247 Binary files /dev/null and b/AutoTrak/assets/img/samples/11990_3.jpg differ diff --git a/AutoTrak/assets/img/samples/11991_1.jpg b/AutoTrak/assets/img/samples/11991_1.jpg new file mode 100644 index 0000000..f4fa1da Binary files /dev/null and b/AutoTrak/assets/img/samples/11991_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11991_2.jpg b/AutoTrak/assets/img/samples/11991_2.jpg new file mode 100644 index 0000000..4ba1354 Binary files /dev/null and b/AutoTrak/assets/img/samples/11991_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11992_1.jpg b/AutoTrak/assets/img/samples/11992_1.jpg new file mode 100644 index 0000000..05f3346 Binary files /dev/null and b/AutoTrak/assets/img/samples/11992_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11992_2.jpg b/AutoTrak/assets/img/samples/11992_2.jpg new file mode 100644 index 0000000..c4cb201 Binary files /dev/null and b/AutoTrak/assets/img/samples/11992_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11992_3.jpg b/AutoTrak/assets/img/samples/11992_3.jpg new file mode 100644 index 0000000..64b08e1 Binary files /dev/null and b/AutoTrak/assets/img/samples/11992_3.jpg differ diff --git a/AutoTrak/assets/img/samples/11993_1.jpg b/AutoTrak/assets/img/samples/11993_1.jpg new file mode 100644 index 0000000..42367da Binary files /dev/null and b/AutoTrak/assets/img/samples/11993_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11993_2.jpg b/AutoTrak/assets/img/samples/11993_2.jpg new file mode 100644 index 0000000..e2408ce Binary files /dev/null and b/AutoTrak/assets/img/samples/11993_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11993_3.jpg b/AutoTrak/assets/img/samples/11993_3.jpg new file mode 100644 index 0000000..6d2389b Binary files /dev/null and b/AutoTrak/assets/img/samples/11993_3.jpg differ diff --git a/AutoTrak/assets/img/samples/11993_4.jpg b/AutoTrak/assets/img/samples/11993_4.jpg new file mode 100644 index 0000000..823a511 Binary files /dev/null and b/AutoTrak/assets/img/samples/11993_4.jpg differ diff --git a/AutoTrak/assets/img/samples/11994_1.jpg b/AutoTrak/assets/img/samples/11994_1.jpg new file mode 100644 index 0000000..5366c5c Binary files /dev/null and b/AutoTrak/assets/img/samples/11994_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11994_2.jpg b/AutoTrak/assets/img/samples/11994_2.jpg new file mode 100644 index 0000000..8bbccc6 Binary files /dev/null and b/AutoTrak/assets/img/samples/11994_2.jpg differ diff --git a/AutoTrak/assets/img/samples/11994_3.jpg b/AutoTrak/assets/img/samples/11994_3.jpg new file mode 100644 index 0000000..058113e Binary files /dev/null and b/AutoTrak/assets/img/samples/11994_3.jpg differ diff --git a/AutoTrak/assets/img/samples/11995_1.jpg b/AutoTrak/assets/img/samples/11995_1.jpg new file mode 100644 index 0000000..a0d28b4 Binary files /dev/null and b/AutoTrak/assets/img/samples/11995_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11996_1.jpg b/AutoTrak/assets/img/samples/11996_1.jpg new file mode 100644 index 0000000..f201f11 Binary files /dev/null and b/AutoTrak/assets/img/samples/11996_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11997_1.jpg b/AutoTrak/assets/img/samples/11997_1.jpg new file mode 100644 index 0000000..7142c72 Binary files /dev/null and b/AutoTrak/assets/img/samples/11997_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11998_1.jpg b/AutoTrak/assets/img/samples/11998_1.jpg new file mode 100644 index 0000000..ed12da7 Binary files /dev/null and b/AutoTrak/assets/img/samples/11998_1.jpg differ diff --git a/AutoTrak/assets/img/samples/11999_1.jpg b/AutoTrak/assets/img/samples/11999_1.jpg new file mode 100644 index 0000000..94b9c90 Binary files /dev/null and b/AutoTrak/assets/img/samples/11999_1.jpg differ diff --git a/AutoTrak/assets/img/samples/12000_1.jpg b/AutoTrak/assets/img/samples/12000_1.jpg new file mode 100644 index 0000000..effbef1 Binary files /dev/null and b/AutoTrak/assets/img/samples/12000_1.jpg differ diff --git a/AutoTrak/assets/img/search_icon_81x81.png b/AutoTrak/assets/img/search_icon_81x81.png new file mode 100644 index 0000000..b3f9d81 Binary files /dev/null and b/AutoTrak/assets/img/search_icon_81x81.png differ diff --git a/AutoTrak/assets/img/select_icon_81x81.png b/AutoTrak/assets/img/select_icon_81x81.png new file mode 100644 index 0000000..18078e8 Binary files /dev/null and b/AutoTrak/assets/img/select_icon_81x81.png differ diff --git a/AutoTrak/assets/img/share_icon_81x81.png b/AutoTrak/assets/img/share_icon_81x81.png new file mode 100644 index 0000000..cbbeb76 Binary files /dev/null and b/AutoTrak/assets/img/share_icon_81x81.png differ diff --git a/AutoTrak/assets/img/tag_icon_81x81.png b/AutoTrak/assets/img/tag_icon_81x81.png new file mode 100644 index 0000000..06d53df Binary files /dev/null and b/AutoTrak/assets/img/tag_icon_81x81.png differ diff --git a/AutoTrak/assets/img/target.png b/AutoTrak/assets/img/target.png new file mode 100644 index 0000000..004869c Binary files /dev/null and b/AutoTrak/assets/img/target.png differ diff --git a/AutoTrak/assets/img/text_icon_81x81.png b/AutoTrak/assets/img/text_icon_81x81.png new file mode 100644 index 0000000..7db54b8 Binary files /dev/null and b/AutoTrak/assets/img/text_icon_81x81.png differ diff --git a/AutoTrak/assets/img/undo_icon_81x81.png b/AutoTrak/assets/img/undo_icon_81x81.png new file mode 100644 index 0000000..824b0a7 Binary files /dev/null and b/AutoTrak/assets/img/undo_icon_81x81.png differ diff --git a/AutoTrak/assets/img/yellow_sign.png b/AutoTrak/assets/img/yellow_sign.png new file mode 100644 index 0000000..79935ef Binary files /dev/null and b/AutoTrak/assets/img/yellow_sign.png differ diff --git a/AutoTrak/assets/img/zoom_in_icon_81x81.png b/AutoTrak/assets/img/zoom_in_icon_81x81.png new file mode 100644 index 0000000..e54a664 Binary files /dev/null and b/AutoTrak/assets/img/zoom_in_icon_81x81.png differ diff --git a/AutoTrak/assets/js/utils.js b/AutoTrak/assets/js/utils.js new file mode 100644 index 0000000..718081e --- /dev/null +++ b/AutoTrak/assets/js/utils.js @@ -0,0 +1,21 @@ +/* Copyright (c) 2013 Research In Motion 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. +*/ + +var defaultStyle = "color:#333333"; + +function textFormat(str,style) { + style = style || defaultStyle; + return "" + str + ""; +} \ No newline at end of file diff --git a/AutoTrak/assets/main.qml b/AutoTrak/assets/main.qml new file mode 100644 index 0000000..49e06e7 --- /dev/null +++ b/AutoTrak/assets/main.qml @@ -0,0 +1,91 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import "pages" + +TabbedPane { + id: root + + Menu.definition: MenuDefinition { + actions: [ + ActionItem { + title: qsTr("About") + } + ] + } + + showTabsOnActionBar: false + onActiveTabChanged: { + for(var i=0; i < tabs.length; ++i) { + if (activeTab == tabs[i]) { + tabs[i].imageSource = "asset:///img/open_folder_icon_81x81.png"; + } else { + tabs[i].imageSource = "asset:///img/folder_icon_81x81.png"; + } + } + activeTab.refresh() + } + + tabs: [ + BaseTab { + title: qsTr("All") + imageSource: "asset:///img/open_folder_icon_81x81.png" + }, + BaseTab { + id: notViewed + title: qsTr("Not Viewed") + whereClause: "Status = 1" + }, + BaseTab { + title: qsTr("Viewed") + whereClause: "Status = 2" + }, + BaseTab { + title: qsTr("Customer Contacted") + whereClause: "Status = 3" + }, + BaseTab { + title: qsTr("Repair Shop Chosen") + whereClause: "Status = 4" + }, + BaseTab { + title: qsTr("Quote Received") + whereClause: "Status = 5" + }, + BaseTab { + title: qsTr("Repair Pending") + whereClause: "Status = 6" + }, + BaseTab { + title: qsTr("Repair Completed") + whereClause: "Status = 7" + }, + BaseTab { + title: qsTr("Funds Released") + whereClause: "Status = 8" + }, + BaseTab { + title: qsTr("Closed File") + whereClause: "Status = 9" + } + ] + + onCreationCompleted: { + activeTab.refresh(); + } +} diff --git a/AutoTrak/assets/models/AutoValues.xml b/AutoTrak/assets/models/AutoValues.xml new file mode 100644 index 0000000..deaabac --- /dev/null +++ b/AutoTrak/assets/models/AutoValues.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AutoTrak/assets/models/ClaimModel.qml b/AutoTrak/assets/models/ClaimModel.qml new file mode 100644 index 0000000..6f69cba --- /dev/null +++ b/AutoTrak/assets/models/ClaimModel.qml @@ -0,0 +1,65 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 + +GroupDataModel { + id: claimModel + signal updateSelectedData(variant indexPath); + signal newDataItem(); + + grouping: ItemGrouping.ByFullValue + sortingKeys: [ + "ClaimDate" + ] + sortedAscending: false + + onItemAdded: { + if (indexPath.length > 1){ + // Update the data that will be shown in the page. + updateSelectedData(indexPath); + newDataItem() + } + } + + onItemRemoved: { + // After removing the selected item, we want another claim to be shown. + // So we select the next quote relative to the removed one in the list. + // The header items are not of interest in this case so updates are only done if the removed + // item indexPath has a length larger then 1. + if (indexPath.length > 1) { + var selectIndexPath = indexPath; + + // Check for defined data around the removed indexPath. + if (data(selectIndexPath) == undefined) { + selectIndexPath[1] = indexPath[1] - 1 + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] + 1; + selectIndexPath[1] = indexPath[1]; + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] - 1 + } + } + } + updateSelectedData(selectIndexPath); + } + } + + onItemUpdated: { + updateSelectedData(indexPath); + } +} diff --git a/AutoTrak/assets/models/PhotoModel.qml b/AutoTrak/assets/models/PhotoModel.qml new file mode 100644 index 0000000..8baa7fd --- /dev/null +++ b/AutoTrak/assets/models/PhotoModel.qml @@ -0,0 +1,61 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 + +GroupDataModel { + id: claimModel + signal updateSelectedData(variant indexPath); + signal newDataItem(); + + grouping: ItemGrouping.None + + onItemAdded: { + if (indexPath.length > 1){ + // Update the data that will be shown in the page. + updateSelectedData(indexPath); + newDataItem() + } + } + + onItemRemoved: { + // After removing the selected item, we want another one to be shown. + // So we select the next item relative to the removed one in the list. + // The header items are not of interest in this case so updates are only done if the removed + // item indexPath has a length larger then 1. + if (indexPath.length > 1) { + var selectIndexPath = indexPath; + + // Check for defined data around the removed indexPath. + if (data(selectIndexPath) == undefined) { + selectIndexPath[1] = indexPath[1] - 1 + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] + 1; + selectIndexPath[1] = indexPath[1]; + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] - 1 + } + } + } + updateSelectedData(selectIndexPath); + } + } + + onItemUpdated: { + updateSelectedData(indexPath); + } +} diff --git a/AutoTrak/assets/models/RepairModel.qml b/AutoTrak/assets/models/RepairModel.qml new file mode 100644 index 0000000..d4a8fcd --- /dev/null +++ b/AutoTrak/assets/models/RepairModel.qml @@ -0,0 +1,64 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 + +GroupDataModel { + id: claimModel + signal updateSelectedData(variant indexPath); + signal newDataItem(); + + grouping: ItemGrouping.None + sortingKeys: [ + ] + sortedAscending: true + + onItemAdded: { + if (indexPath.length > 1){ + // Update the data that will be shown in the page. + updateSelectedData(indexPath); + newDataItem() + } + } + + onItemRemoved: { + // After removing the selected item, we want another one to be shown. + // So we select the next item relative to the removed one in the list. + // The header items are not of interest in this case so updates are only done if the removed + // item indexPath has a length larger then 1. + if (indexPath.length > 1) { + var selectIndexPath = indexPath; + + // Check for defined data around the removed indexPath. + if (data(selectIndexPath) == undefined) { + selectIndexPath[1] = indexPath[1] - 1 + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] + 1; + selectIndexPath[1] = indexPath[1]; + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] - 1 + } + } + } + updateSelectedData(selectIndexPath); + } + } + + onItemUpdated: { + updateSelectedData(indexPath); + } +} diff --git a/AutoTrak/assets/models/ReportModel.qml b/AutoTrak/assets/models/ReportModel.qml new file mode 100644 index 0000000..d0e8877 --- /dev/null +++ b/AutoTrak/assets/models/ReportModel.qml @@ -0,0 +1,65 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 + +GroupDataModel { + id: claimModel + signal updateSelectedData(variant indexPath); + signal newDataItem(); + + grouping: ItemGrouping.ByFullValue + sortingKeys: [ + "ReportType" + ] + sortedAscending: true + + onItemAdded: { + if (indexPath.length > 1){ + // Update the data that will be shown in the page. + updateSelectedData(indexPath); + newDataItem() + } + } + + onItemRemoved: { + // After removing the selected item, we want another one to be shown. + // So we select the next item relative to the removed one in the list. + // The header items are not of interest in this case so updates are only done if the removed + // item indexPath has a length larger then 1. + if (indexPath.length > 1) { + var selectIndexPath = indexPath; + + // Check for defined data around the removed indexPath. + if (data(selectIndexPath) == undefined) { + selectIndexPath[1] = indexPath[1] - 1 + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] + 1; + selectIndexPath[1] = indexPath[1]; + if (data(selectIndexPath) == undefined) { + selectIndexPath[0] = indexPath[0] - 1 + } + } + } + updateSelectedData(selectIndexPath); + } + } + + onItemUpdated: { + updateSelectedData(indexPath); + } +} diff --git a/AutoTrak/assets/pages/BaseTabPage.qml b/AutoTrak/assets/pages/BaseTabPage.qml new file mode 100644 index 0000000..7dd2a11 --- /dev/null +++ b/AutoTrak/assets/pages/BaseTabPage.qml @@ -0,0 +1,280 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import bb.data 1.0 +import autotrak.data 1.0 +import "../models" +import ".." +import "../js/utils.js" as Utils + +Page { + id: root + property alias modelObjectName: claimModel.objectName + property variant selectedData + property alias dataSource: asyncDataSource + property string whereClause: "1" + property string searchClause: "" + + signal showClaimDetail() + signal listEmpty() + + function updateData() { + refresh(); + } + + function refresh() { + claimModel.clear(); + asyncDataSource.load(); + } + + attachedObjects: [ + ImagePaintDefinition { + id: back + imageSource: "asset:///img/Highway_Night.png" + } + ] + + Container { + HeaderBar { + title: "AutoTrak" + } + + Container { + id: searchBar + visible: false + background: Color.LightGray + + onVisibleChanged: { + console.log("Is search visible: ", visible); + if (! visible) { + searchText.text = ""; + root.searchClause = ""; + refresh(); + } + } + + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + leftPadding: 15 + rightPadding: 15 + topPadding: 15 + bottomPadding: 15 + + TextField { + id: searchText + hintText: qsTr("Search") + layoutProperties: StackLayoutProperties { + spaceQuota: 0.7 + } + + input { + submitKey: SubmitKey.Search + onSubmitted: { + root.searchClause = " AND (Claimant.Name LIKE '%" + searchText.text + "%'" + root.searchClause += " OR Claim.ClaimNo LIKE '%" + searchText.text + "%'" + root.searchClause += ")" + refresh(); + } + } + onTextChanging: { + if (searchText.text.length == 0) { + root.searchClause = "" + refresh(); + } + } + } + + Button { + text: qsTr("Cancel") + onClicked: { + searchBar.visible = false; + } + + layoutProperties: StackLayoutProperties { + spaceQuota: 0.3 + } + } + } + Container { + background: back.imagePaint + + ListView { + + layout: StackListLayout { + headerMode: ListHeaderMode.Sticky + } + horizontalAlignment: HorizontalAlignment.Fill + // The data model used defined in the attachedObjects for the list. + dataModel: claimModel + + // There are two types of item; header for alphabetic groups and standard items + // showing the person name. + listItemComponents: [ + ListItemComponent { + type: "item" + Container { + id: listViewItems + layout: StackLayout { + orientation: LayoutOrientation.TopToBottom + } + + Container { + + Label { + text: ListItemData.Name + horizontalAlignment: HorizontalAlignment.Fill + + textStyle.fontStyle: FontStyle.Normal + textStyle.fontSizeValue: 0.0 + textStyle.color: Color.create("#fff9fb67") + textStyle.fontWeight: FontWeight.Bold + topMargin: 0.0 + minHeight: 50.0 + + } + + } + Container { + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + + } + + Label { + text: ListItemData.StatusName + horizontalAlignment: HorizontalAlignment.Fill + layoutProperties: StackLayoutProperties { + spaceQuota: 2.0 + + } + textStyle.fontStyle: FontStyle.Normal + textStyle.fontWeight: FontWeight.Bold + textStyle.color: Color.create("#ff78aaff") + + minHeight: 70.0 + + } + Label { + text: ListItemData.ClaimNo + horizontalAlignment: HorizontalAlignment.Fill + layoutProperties: StackLayoutProperties { + spaceQuota: -1.0 + + } + textStyle.fontStyle: FontStyle.Normal + textStyle.fontSizeValue: 0.0 + textStyle.color: Color.create("#ff78aaff") + textStyle.fontWeight: FontWeight.Bold + minHeight: 70.0 + + } + } + } + + }, + ListItemComponent { + type: "header" + Header { + title: _app.formatDate(ListItemData) + opacity: 0.75 + } + } + ] + + onTriggered: { + // To avoid triggering navigation when pressing the header items, we check so that the + // index path length is larger then one (one entry would be a group under a header item). + if (indexPath.length > 1) { + // Update the data that will be shown in the Claim Detail Page. + root.selectedData = dataModel.data(indexPath); + root.showClaimDetail(); + } + } + + attachedObjects: [ + ClaimModel { + id: claimModel + onUpdateSelectedData: { + if (indexPath[0] >= 0 && indexPath[1] >= 0) { + //quotesList.scrollToItem(indexPath, ScrollAnimation.Default); + root.selectedData = data(indexPath); + } else { + root.listEmpty(); + } + } + }, + // Custom data source object, loads data using a SqlConnection, see customsqldatasource.cpp + CustomSqlDataSource { + id: asyncDataSource + source: "sql/data_r5.db" + query: { + "SELECT *, ClaimStatus.Name as StatusName FROM Claim LEFT JOIN Claimant ON Claimant.ClaimNo = Claim.ClaimNo LEFT JOIN ClaimStatus ON ClaimStatus.ID = Claim.Status WHERE 1 AND " + root.whereClause + root.searchClause + } + property int loadCounter: 0 + + onDataLoaded: { + console.log(asyncDataSource.query) + console.log("Data loaded! Size: ", data.length); + if (data.length > 0) { + claimModel.insertList(data); + // Load the next batch, the last parameter is set to zero to tell the data source that we are loading data to the list. + //var offsetData = {"offset": (10 + 5 * loadCounter)}; + //execute("SELECT * FROM Claim ORDER BY Created LIMIT 5 OFFSET :offset", offsetData, 0); + //loadCounter ++; + } + } + } + ] // attachedObjects + } + } + } + + function updateClaim(data) { + console.log("updating claim from page"); + asyncDataSource.execute("UPDATE Claim SET ClaimDate = :ClaimDate, PolicyNo = :PolicyNo, Insurer = :Insurer, InsuredUntil = :InsuredUntil, Vehicle = :Vehicle, SerialNo = :SerialNo, LicensePlateNo = :LicensePlateNo, LossDamageDate = :LossDamageDate, Location = :Location, PoliceUnit = :PoliceUnit, UnitNotifyDate = :UnitNotifyDate WHERE ClaimNo = :ClaimNo", { + ClaimDate: data.ClaimDate, + PolicyNo: data.PolicyNo, + Insurer: data.Insurer, + InsuredUntil: data.InsureUntil, + Vehicle: data.Vehicle, + SerialNo: data.SerialNo, + LicensePlateNo: data.LicensePlate, + LossDamageDate: data.LossDate, + Location: data.Location, + PoliceUnit: data.PoliceUnit, + UnitNotifyDate: data.UnitNotifyDate, + ClaimNo: data.ClaimNo + }, data.ID); + + var indexPath = claimModel.find(root.selectedData); + claimModel.updateItem(indexPath, data); + } + actions: [ + ActionItem { + title: qsTr("Search") + ActionBar.placement: ActionBarPlacement.OnBar + imageSource: "asset:///img/search_icon_81x81.png" + + onTriggered: { + searchBar.visible = true; + searchText.requestFocus(); + } + } + ] +} diff --git a/AutoTrak/assets/pages/ClaimDetail.qml b/AutoTrak/assets/pages/ClaimDetail.qml new file mode 100644 index 0000000..44d7c1d --- /dev/null +++ b/AutoTrak/assets/pages/ClaimDetail.qml @@ -0,0 +1,443 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import "../models" + +Page { + id: root + property variant claimData + property variant nav + property variant editPage + + signal updateClaim(variant data) + + function updateClaimData() { + console.log("updating claim data") + root.claimData = null; + root.claimData = editPage.claimData; + + updateClaim(editPage.claimData); + } + + titleBar: TitleBar { + id: titleBar + } + Container { + background: back.imagePaint + + Container { + horizontalAlignment: HorizontalAlignment.Fill + background: Color.create("#333333") + + Container { + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Container { + layoutProperties: StackLayoutProperties { + spaceQuota: 0.5 + } + Label { + id: claimantName + textStyle { + base: SystemDefaults.TextStyles.TitleText + color: Color.White + } + } + } + + Container { + layoutProperties: StackLayoutProperties { + spaceQuota: 0.5 + } + Label { + id: claimNo + horizontalAlignment: HorizontalAlignment.Right + textStyle { + base: SystemDefaults.TextStyles.TitleText + color: Color.White + } + } + } + + } + + topPadding: 30 + bottomPadding: 30 + rightPadding: 30 + leftPadding: 30 + } + + ScrollView { + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + scrollViewProperties { + scrollMode: ScrollMode.Vertical + } + + Container { + Header { + id: header + opacity: 0.75 + } + + Container { + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + leftPadding: 20 + rightPadding: 20 + Container { + topPadding: 20 + bottomPadding: 20 + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Claim Date: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: claimDate + text: "." + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Insurer: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: insurer + text: "." + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Policy #: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: policyNo + text: "." + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Insured Until: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: insureUntil + text: "." + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + //orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Auto Year/Make/Model: ") + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: autoModel + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("License Plate: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: licensePlate + text: "." + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Loss/Damage Date: ") + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: lossDate + text: "." + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Location: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: location + multiline: true + text: "." + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Cause: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: cause + multiline: true + text: "." + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Police Unit Notified: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: policeUnit + multiline: true + text: "." + textStyle.color: Color.create("#ff78aaff") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Notified Date: ") + minWidth: 250 + textStyle.color: Color.create("#fff9fb67") + } + Label { + id: unitNotifyDate + text: "." + textStyle.color: Color.create("#ff78aaff") + } + } + } + + Container { + horizontalAlignment: HorizontalAlignment.Right + } + } + + } + } + + } + + attachedObjects: [ + ComponentDefinition { + id: editClaimDefinition + source: "asset:///pages/EditClaim.qml" + }, + ComponentDefinition { + id: reportDefinition + source: "asset:///pages/Reports.qml" + }, + ComponentDefinition { + id: photoDefinition + source: "asset:///pages/Photos.qml" + }, + ComponentDefinition { + id: repairDefinition + source: "asset:///pages/Repairs.qml" + }, + ImagePaintDefinition { + id: back + imageSource: "asset:///img/Highway_Night_HKG.png" + } + ] + + actions: [ + ActionItem { + title: qsTr("Photos") + imageSource: "asset:///img/picture_icon_81x81.png" + + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + var photoPage = photoDefinition.createObject(); + photoPage.claimNo = root.claimData.ClaimNo; + nav.push(photoPage); + } + }, + ActionItem { + title: qsTr("Details & Reports") + imageSource: "asset:///img/details_icon.png" + + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + var reportPage = reportDefinition.createObject(); + reportPage.claimNo = root.claimData.ClaimNo; + nav.push(reportPage); + } + }, + ActionItem { + title: qsTr("Repairs") + imageSource: "asset:///img/car_icon.png" + + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + var reportPage = repairDefinition.createObject(); + reportPage.claimNo = root.claimData.ClaimNo; + nav.push(reportPage); + } + }, + ActionItem { + title: qsTr("Edit") + imageSource: "asset:///img/edit_icon_81x81.png" + + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + editPage = editClaimDefinition.createObject(root); + editPage.updateClaim.connect(updateClaimData); + editPage.claimData = root.claimData; + editPage.open(); + //nav.push(editPage); + } + }, + InvokeActionItem { + id: shareAction + query { + mimeType: "text/plain" + invokeActionId: "bb.action.SHARE" + data: "" + } + title: qsTr("Share") + //imageSource: "asset:///img/share_icon_81x81.png" + + ActionBar.placement: ActionBarPlacement.OnBar + } + ] + + onClaimDataChanged: { + if (claimData) { + claimantName.text = claimData.Name; + header.title = qsTr("Status:") + " " + claimData.StatusName; + claimDate.text = Qt.formatDateTime(_app.strToDate(claimData.ClaimDate), "MMMM d, yyyy"); + claimNo.text = qsTr("Claim #: ") + claimData.ClaimNo; + policyNo.text = claimData.PolicyNo; + insurer.text = claimData.Insurer; + insureUntil.text = Qt.formatDateTime(_app.strToDate(claimData.InsuredUntil), "M/d/yyyy"); + autoModel.text = claimData.Vehicle; + licensePlate.text = claimData.LicensePlateNo; + lossDate.text = Qt.formatDateTime(_app.strToDate(claimData.LossDamageDate), "M/d/yyyy h:mmA"); + location.text = claimData.Location; + cause.text = claimData.DamageLossCause; + policeUnit.text = claimData.PoliceUnit; + unitNotifyDate.text = Qt.formatDateTime(_app.strToDate(claimData.UnitNotifyDate), "M/d/yyyy h:mmA"); + + var str = "Claim #: %1\n\nClaim Date: %2\nClaimant: %3"; + + shareAction.query.data = str.arg(claimData.ClaimNo).arg(claimDate.text).arg(claimData.Name); + + shareAction.query.updateQuery(); + } + } +} diff --git a/AutoTrak/assets/pages/ClaimantReport.qml b/AutoTrak/assets/pages/ClaimantReport.qml new file mode 100644 index 0000000..e73b601 --- /dev/null +++ b/AutoTrak/assets/pages/ClaimantReport.qml @@ -0,0 +1,302 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import ".." + +Page { + id: root + property variant data + property variant editPage + + signal updateClaimantReport(variant data) + + function update() { + console.log("updating CR data") + root.data = null; + root.data = editPage.data; + + updateClaimantReport(editPage.data); + } + + attachedObjects: [ + ImagePaintDefinition { + id: back + imageSource: "asset:///img/green_sign.png" + }, + ComponentDefinition { + id: editReportDefinition + source: "asset:///pages/EditClaimantReport.qml" + } + ] + + + Container{ + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + background: back.imagePaint + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + HeaderBar { + title: "Claimant Report" + + } + ScrollView{ + Container { + rightPadding: 30 + leftPadding: 30 + bottomPadding: 30 + topPadding: 30 + Container { + layout: StackLayout { + orientation: LayoutOrientation.TopToBottom + } + Label { + text: "" + qsTr("Contact Info ") + "" + minWidth: 175 + + } + } + Container { + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: "" + qsTr("Name: ") + "" + minWidth: 175 + + } + + Label { + id: repName + text: "" + } + } + + Container { + topPadding: 30 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: "" + qsTr("Address: ") + "" + minWidth: 175 + + } + + Label { + id: address + multiline: true + text: qsTr("") + minHeight: 100.0 + autoSize.maxLineCount: 2 + + } + } + + Container { + topPadding: 30 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: "" + qsTr("Phone: ") + "" + minWidth: 175 + } + + Label { + id: phoneNo + textStyle { + fontWeight: FontWeight.Bold + } + gestureHandlers: [ + TapHandler { + onTapped: { + _app.callNumber(data.phoneNo) + } + } + ] + } + } + + Container { + topPadding: 30 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: "" + qsTr("Phone 2: ") + "" + minWidth: 175 + } + + Label { + id: phoneNo2 + textStyle { + fontWeight: FontWeight.Bold + } + gestureHandlers: [ + TapHandler { + onTapped: { + _app.callNumber(data.phoneNo2) + } + } + ] + } + } + + Container { + topPadding: 30 + id: emailBlock + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: "" + qsTr("Email: ") + "" + minWidth: 175 + } + + Label { + id: email + textStyle { + fontWeight: FontWeight.Bold + } + attachedObjects: [ + Invocation { + id: invoke + query { + invokeActionId: "bb.action.SENDEMAIL" + invokeTargetId: "sys.pim.uib.email.hybridcomposer" + mimeType: "message/rfc822" + } + } + ] + gestureHandlers: [ + TapHandler { + onTapped: { + invoke.trigger("bb.action.SENDEMAIL") + } + } + ] + multiline: true + autoSize.maxLineCount: 2 + minHeight: 100.0 + } + } + + Container { + topPadding: 30 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + minWidth: 175 + text: "" + qsTr("Statement: ") + "" + } + ScrollView { + scrollViewProperties.scrollMode: ScrollMode.Vertical + Container { + Label { + id: statement + multiline: true + minHeight: 100 + textStyle { + fontWeight: FontWeight.Bold + } + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + } + } + } + } + + } + + } +} + actions: [ + ActionItem { + title: qsTr("Edit") + imageSource: "asset:///img/edit_icon_81x81.png" + + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + editPage = editReportDefinition.createObject(root); + editPage.updateClaimantReport.connect(update); + editPage.data = root.data; + editPage.open(); + //nav.push(editPage); + } + }, + ActionItem { + id: shareAction + + attachedObjects: [ + Invocation { + id: shareInvoke + property bool autoTrigger: false + query { + mimeType: "text/plain" + + onDataChanged: { + shareInvoke.query.updateQuery() + } + } + onArmed: { + + if (autoTrigger) + trigger("bb.action.SHARE"); + autoTrigger = true; + } + } + ] + + title: qsTr("Share") + imageSource: "asset:///img/share_icon_81x81.png" + onTriggered: { + var str = "Claim #: " + data.ClaimNo + "\nClaimant: " + data.Name + "\nAddress:" + (data.Address) + "\nPhone #:" + (data.Phone1 || '') + "\nPhone 2#:" + (data.Phone2 || '') + "\nStatement:\n\n" + data.Statement; + shareInvoke.query.data = str + } + ActionBar.placement: ActionBarPlacement.OnBar + } + ] + + onDataChanged: { + if (data) { + statement.text = "" + data.Statement + "" + phoneNo.text = "" + data.Phone + "" + phoneNo2.text = "" + data.Phone2 + "" + repName.text = "" + data.Name + "" + address.text = "" + data.Address + "" + + if (data.Email && data.Email.length > 0) { + emailBlock.visible = true + email.text = "" + data.Email + "" + invoke.query.uri = "mailto:" + data.Email + "?subject=Your%20Claim" + invoke.query.updateQuery() + } + } + } +} diff --git a/AutoTrak/assets/pages/EditClaim.qml b/AutoTrak/assets/pages/EditClaim.qml new file mode 100644 index 0000000..1abd1b7 --- /dev/null +++ b/AutoTrak/assets/pages/EditClaim.qml @@ -0,0 +1,503 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import ".." + +Sheet { + id: root + + property variant claimData; + signal updateClaim(variant d); + + Page { + titleBar: TitleBar { + title: qsTr("Edit Claim") + dismissAction: ActionItem { + title: "Cancel" + onTriggered: { + root.close(); + } + } + acceptAction: ActionItem { + title: "Save" + onTriggered: { + console.log("Updating..") + var data = root.claimData; + data.ClaimDate = Qt.formatDate(claimDate.value,'yyyy-MM-dd'); + data.PolicyNo = policyNo.text; + data.Insurer = insurer.text; + data.InsuredUntil = Qt.formatDate(insureUntil.value, 'yyyy-MM-dd'); + data.Vehicle = autoYear.selectedOption.text + ", " + autoMake.selectedOption.text + ", " + autoModel.selectedOption.text + data.SerialNo = serialNo.text; + data.LicensePlateNo = licensePlate.text; + data.LossDamageDate = Qt.formatDate(lossDate.value, 'yyyy-MM-dd'); + data.Location = location.text; + data.PoliceUnit = policeUnit.text; + data.UnitNotifyDate = Qt.formatDate(unitNotifyDate.value, 'yyyy-MM-dd'); + root.claimData = data; + updateClaim(data); + root.close(); + } + } + } + ScrollView { + scrollViewProperties { + scrollMode: ScrollMode.Vertical + } + Container { + topPadding: 20 + bottomPadding: 20 + leftPadding: 20 + rightPadding: 20 + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + DateTimePicker { + id: claimDate + title: qsTr("Claim Date: ") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Insurer: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: insurer + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Policy #: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: policyNo + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + DateTimePicker { + id: insureUntil + title: qsTr("Insured Until: ") + } + } + + Container { + topPadding: 10 + layout: StackLayout { + //orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Auto Year/Make/Model: ") + } + Container { + topPadding: 10 + layout: StackLayout { + //orientation: LayoutOrientation.LeftToRight + } + DropDown { + id: autoYear + title: "Year" + + options: [ + Option { + text: "1984" + }, + Option { + text: "1985" + }, + Option { + text: "1986" + }, + Option { + text: "1987" + }, + Option { + text: "1988" + }, + Option { + text: "1989" + }, + Option { + text: "1990" + }, + Option { + text: "1991" + }, + Option { + text: "1992" + }, + Option { + text: "1993" + }, + Option { + text: "1994" + }, + Option { + text: "1995" + }, + Option { + text: "1996" + }, + Option { + text: "1997" + }, + Option { + text: "1998" + }, + Option { + text: "1999" + }, + Option { + text: "2000" + }, + Option { + text: "2001" + }, + Option { + text: "2002" + }, + Option { + text: "2003" + }, + Option { + text: "2004" + }, + Option { + text: "2005" + }, + Option { + text: "2006" + }, + Option { + text: "2007" + }, + Option { + text: "2008" + }, + Option { + text: "2009" + }, + Option { + text: "2010" + }, + Option { + text: "2011" + }, + Option { + text: "2012" + }, + Option { + text: "2013" + } + ] + } + DropDown { + id: autoMake + title: "Make" + + options: [ + Option { + text: "BMW" + value: text + }, + Option { + text: "Chevrolet" + value: text + }, + Option { + text: "Dodge" + value: text + }, + Option { + text: "Ford" + value: text + }, + Option { + text: "GMC" + value: text + }, + Option { + text: "Honda" + value: text + }, + Option { + text: "Lexus" + value: text + }, + Option { + text: "Mazda" + value: text + }, + Option { + text: "Nissan" + value: text + }, + Option { + text: "Peugeot" + value: text + }, + Option { + text: "Subaru" + value: text + }, + Option { + text: "Toyota" + value: text + } + ] + } + DropDown { + id: autoModel + title: "Model" + + options: [ + Option { + text: "3" + }, + Option { + text: "405" + }, + Option { + text: "Altima" + }, + Option { + text: "Brat GL" + }, + Option { + text: "Civic Coupe" + }, + Option { + text: "Civic ES" + }, + Option { + text: "Escape" + }, + Option { + text: "E92" + }, + Option { + text: "EOS" + }, + Option { + text: "Fusion" + }, + Option { + text: "Impala" + }, + Option { + text: "Impreza" + }, + Option { + text: "LS" + }, + Option { + text: "Malibu" + }, + Option { + text: "Miata" + }, + Option { + text: "Rav-4" + }, + Option { + text: "Sonoma" + }, + Option { + text: "Stratus" + }, + Option { + text: "Taurus" + } + ] + } + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("VIN: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: serialNo + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("License Plate: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: licensePlate + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + DateTimePicker { + id: lossDate + title: qsTr("Loss/Damage Date: ") + mode: DateTimePickerMode.DateTime + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Location: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: location + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Cause: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: cause + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Police Unit Notified: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: policeUnit + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + DateTimePicker { + id: unitNotifyDate + title: qsTr("Notify Date: ") + mode: DateTimePickerMode.DateTime + } + } + } + } + } + + function setYears() {} + + function setMakes() {} + + function setModels() {} + + onClaimDataChanged: { + var auto = claimData.Vehicle.split(",") + + for (var i=autoYear.options.length-1; i >=0; --i) { + if (auto[0].trim() == autoYear.at(i).text) { + autoYear.setSelectedIndex(i) + break; + } + } + + for (var i=autoMake.options.length-1; i >=0; --i) { + if (auto[1].trim() == autoMake.at(i).text) { + autoMake.setSelectedIndex(i) + break; + } + } + + for (var i=autoModel.options.length-1; i >=0; --i) { + if (auto[2].trim() == autoModel.at(i).text) { + autoModel.setSelectedIndex(i) + break; + } + } + + claimantName.text = claimData.Name + header.title = qsTr("Status:") + " " + claimData.StatusName + claimNo.text = qsTr("Claim #: ") + claimData.ClaimNo + claimDate.value = _app.strToDate(claimData.ClaimDate) + policyNo.text = claimData.PolicyNo + serialNo.text = claimData.SerialNo + insureUntil.value = _app.strToDate(claimData.InsuredUntil) + insurer.text = claimData.Insurer + licensePlate.text = claimData.LicensePlateNo + lossDate.value = _app.strToDate(claimData.LossDamageDate) + location.text = claimData.Location + cause.text = claimData.DamageLossCause + policeUnit.text = claimData.PoliceUnit + unitNotifyDate.value = _app.strToDate(claimData.UnitNotifyDate) + } +} diff --git a/AutoTrak/assets/pages/EditClaimantReport.qml b/AutoTrak/assets/pages/EditClaimantReport.qml new file mode 100644 index 0000000..340da6e --- /dev/null +++ b/AutoTrak/assets/pages/EditClaimantReport.qml @@ -0,0 +1,127 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import ".." + +Sheet { + id: root + + property variant data; + signal updateClaimantReport(variant d); + + Page { + titleBar: TitleBar { + title: qsTr("Edit Claimant Report") + dismissAction: ActionItem { + title: "Cancel" + onTriggered: { + root.close(); + } + } + acceptAction: ActionItem { + title: "Save" + onTriggered: { + console.log("Updating..") + var dat = root.data; + dat.Phone = phoneNo.text + dat.Name = repName.text + dat.Email = email.text + dat.Statement = statement.text + root.data = dat; + updateClaimantReport(dat); + root.close(); + } + } + } + ScrollView { + scrollViewProperties { + scrollMode: ScrollMode.Vertical + } + Container { + topPadding: 20 + bottomPadding: 20 + leftPadding: 20 + rightPadding: 20 + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Name: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: repName + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Email: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: email + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Phone #: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: phoneNo + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Statement: ") + verticalAlignment: VerticalAlignment.Top + } + TextArea { + id: statement + } + } + } + } + } + + onDataChanged: { + phoneNo.text = data.Phone + repName.text = data.Name + email.text = data.Email + statement.text = data.Statement + } +} diff --git a/AutoTrak/assets/pages/EditPhoto.qml b/AutoTrak/assets/pages/EditPhoto.qml new file mode 100644 index 0000000..11d4b6e --- /dev/null +++ b/AutoTrak/assets/pages/EditPhoto.qml @@ -0,0 +1,247 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import bb.cascades.pickers 1.0 + +Page { + id: root + property string claimNo; + property string photoPath; + + objectName: "viewPhoto" + + actions: [ + /* + ActionItem { + title: "Select Image" + ActionBar.placement: ActionBarPlacement.InOverflow + onTriggered: { + webView.visible = false; + imagePicker.visible = true; + webView.url = webView.url; + filePicker.open(); + } + }, + */ + ActionItem { + id: aiDraw + title: "Draw" + enabled: false + imageSource: "asset:///img/edit_icon_81x81.png" + ActionBar.placement: ActionBarPlacement.OnBar + onTriggered: { + scrollView.scrollViewProperties.scrollMode = ScrollMode.None; + enabled = false; + + aiText.enabled = + aiZoom.enabled = true; + + var msg = JSON.stringify({ + type: "setMode", + mode: "draw" + }); + webView.postMessage(msg); + + } + }, + ActionItem { + id: aiText + title: "Text" + enabled: true + imageSource: "asset:///img/text_icon_81x81.png" + ActionBar.placement: ActionBarPlacement.OnBar + onTriggered: { + scrollView.scrollViewProperties.scrollMode = ScrollMode.None; + enabled = false; + + aiDraw.enabled = + aiZoom.enabled = true; + + var msg = JSON.stringify({ + type: "setMode", + mode: "text" + }); + webView.postMessage(msg); + } + }, + ActionItem { + id: aiZoom + title: "Zoom" + imageSource: "asset:///img/zoom_in_icon_81x81.png" + enabled: true + ActionBar.placement: ActionBarPlacement.OnBar + onTriggered: { + scrollView.scrollViewProperties.scrollMode = ScrollMode.Both; + enabled = false; + + aiText.enabled = + aiDraw.enabled = true; + + var msg = JSON.stringify({ + type: "setMode", + mode: "zoom" + }); + webView.postMessage(msg); + } + }, + ActionItem { + id: aiUndo + title: "Undo" + imageSource: "asset:///img/undo_icon_81x81.png" + enabled: false + ActionBar.placement: ActionBarPlacement.InOverflow + onTriggered: { + var msg = JSON.stringify({ + type: "undo" + }); + webView.postMessage(msg); + } + }, + ActionItem { + id: aiClearTags + title: "Remove annotations" + imageSource: "asset:///img/tag_icon_81x81.png" + enabled: true + ActionBar.placement: ActionBarPlacement.InOverflow + onTriggered: { + var msg = JSON.stringify({ + type: "removeTags" + }); + webView.postMessage(msg); + } + } + ] + Container { + layout: DockLayout{} + background: Color.Black + ScrollView { + id: scrollView + scrollViewProperties { + scrollMode: ScrollMode.Both + pinchToZoomEnabled: true + maxContentScale: 5 + minContentScale: 1 + } + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + layoutProperties: StackLayoutProperties { spaceQuota: 1.0 } + minWidth: 720 + minHeight: 620 + preferredHeight: 1280 + Container { + background: Color.Black + layout: StackLayout { + orientation: LayoutOrientation.TopToBottom } + + layoutProperties: StackLayoutProperties { spaceQuota: 1.0 } + minWidth: 720 + minHeight: 620 + preferredWidth: 768 + preferredHeight: 1280 + WebView { + id: webView + //visible: false + url: "local:///assets/web/draw.html" + + settings { + webInspectorEnabled: true + zoomToFitEnabled: true + devicePixelRatio: 1.0 + background: Color.Black + viewport: { + "width": "device-width", + "initial-scale": 1.0 + } + } + + minWidth: 720 + minHeight: 620 + preferredWidth: Infinity + preferredHeight: Infinity + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + + onMinContentScaleChanged: { + console.log("New min scale: ", minContentScale); + // Update the scroll view properties to match the content scale + // given by the WebView. + scrollView.scrollViewProperties.minContentScale = minContentScale; + + // Let's show the entire page to start with. + scrollView.zoomToPoint(0,0, minContentScale,ScrollAnimation.None) + } + + onMaxContentScaleChanged: { + // Update the scroll view properties to match the content scale + // given by the WebView. + scrollView.scrollViewProperties.maxContentScale = maxContentScale; + } + + onMessageReceived: { + console.log(message.data); + + var msg = JSON.parse(message.data); + + if (msg.type == "ready") { + var file = _app.copyToData(root.photoPath.replace("file://","")); + var msg = JSON.stringify({ + type: "setImage", + url: file///root.photoPath + }); + scrollView.scrollViewProperties.scrollMode = ScrollMode.Both; + scrollView.scrollViewProperties.minContentScale = webView.minContentScale; + console.log("posting message"); + webView.postMessage(msg); + return; + } + + if (msg.type == "resetScale") { + scrollView.scrollViewProperties.minContentScale = 0.17; + return; + } + + if (msg.type == "resetZoom") { + scrollView.zoomToPoint(0,0, scrollView.scrollViewProperties.minContentScale, ScrollAnimation.None); + return; + } + + if (msg.type == "disableScroll") { + scrollView.scrollViewProperties.scrollMode = ScrollMode.None; + return; + } + + if (msg.type == "undoCount") { + aiUndo.enabled = (msg.count > 0); + return; + } + + if (msg.type == "log") { + console.log(message); + return; + } + } + } // end WebView + } + } + } + + function setImage(file) { + console.log("setImage : " + file); + root.photoPath = file; + } +} diff --git a/AutoTrak/assets/pages/EditPoliceReport.qml b/AutoTrak/assets/pages/EditPoliceReport.qml new file mode 100644 index 0000000..85607b6 --- /dev/null +++ b/AutoTrak/assets/pages/EditPoliceReport.qml @@ -0,0 +1,145 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import bb.data 1.0 +import autotrak.data 1.0 +import ".." + +Sheet { + id: root + + property variant data; + signal updatePoliceReport(variant d); + + Page { + titleBar: TitleBar { + title: qsTr("Edit Police Report") + dismissAction: ActionItem { + title: "Cancel" + onTriggered: { + root.close(); + } + } + acceptAction: ActionItem { + title: "Save" + onTriggered: { + console.log("Updating..") + var dat = root.data; + data.Phone = phoneNo.text + data.Name = repName.text + data.Email = email.text + data.Incident = incident.text + data.EventDetail = eventDetail.text + root.data = dat; + updatePoliceReport(dat); + root.close(); + } + } + } + ScrollView { + scrollViewProperties { + scrollMode: ScrollMode.Vertical + } + Container { + topPadding: 20 + bottomPadding: 20 + leftPadding: 20 + rightPadding: 20 + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Name: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: repName + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Email: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: email + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Phone #: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: phoneNo + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Incident: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: incident + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Event Detail: ") + verticalAlignment: VerticalAlignment.Top + } + TextArea { + id: eventDetail + } + } + } + } + } + + onDataChanged: { + phoneNo.text = data.Phone + repName.text = data.Name + email.text = data.Email + incident.text = data.Incident + eventDetail.text = data.Statement + } +} diff --git a/AutoTrak/assets/pages/EditWitnessReport.qml b/AutoTrak/assets/pages/EditWitnessReport.qml new file mode 100644 index 0000000..bca77f1 --- /dev/null +++ b/AutoTrak/assets/pages/EditWitnessReport.qml @@ -0,0 +1,129 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import bb.data 1.0 +import autotrak.data 1.0 +import ".." + +Sheet { + id: root + + property variant data; + signal updateWitnessReport(variant d); + + Page { + titleBar: TitleBar { + title: qsTr("Edit Witness Report") + dismissAction: ActionItem { + title: "Cancel" + onTriggered: { + root.close(); + } + } + acceptAction: ActionItem { + title: "Save" + onTriggered: { + console.log("Updating..") + var dat = root.data; + dat.Phone = phoneNo.text + dat.Name = repName.text + dat.Email = email.text + dat.Statement = statement.text + root.data = dat; + updateWitnessReport(dat); + root.close(); + } + } + } + ScrollView { + scrollViewProperties { + scrollMode: ScrollMode.Vertical + } + Container { + topPadding: 20 + bottomPadding: 20 + leftPadding: 20 + rightPadding: 20 + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Name: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: repName + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Email: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: email + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Phone: ") + verticalAlignment: VerticalAlignment.Center + } + TextField { + id: phoneNo + } + } + + Container { + topPadding: 10 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + Label { + text: qsTr("Statement: ") + verticalAlignment: VerticalAlignment.Top + } + TextArea { + id: statement + } + } + } + } + } + + onDataChanged: { + phoneNo.text = data.Phone + repName.text = data.Name + email.text = data.Email + statement.text = data.Statement + } +} diff --git a/AutoTrak/assets/pages/Photos.qml b/AutoTrak/assets/pages/Photos.qml new file mode 100644 index 0000000..a775179 --- /dev/null +++ b/AutoTrak/assets/pages/Photos.qml @@ -0,0 +1,163 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import autotrak.data 1.0 +import bb.cascades.pickers 1.0 +import ".." +import "../models" + +Page { + id: root + + property string claimNo: ""; + property variant selectedData + + actions: [ + ActionItem { + title: qsTr("Add Photo") + ActionBar.placement: ActionBarPlacement.OnBar + imageSource: "asset:///img/add_icon_81x81.png" + onTriggered: { + filePicker.open() + } + } + ] + + attachedObjects: [ + FilePicker { + id: filePicker + mode: FilePickerMode.Picker + type: FileType.Picture + imageCropEnabled: true + onFileSelected: { + _app.photoImported.connect(onImported); + _app.importPhoto(claimNo, selectedFiles[0]); + } + } + ] + + function onImported(){ + _app.photoImported.disconnect(onImported) + photoModel.clear(); + asyncDataSource.load() + } + + Container { + background: Color.Black + HeaderBar { + title: qsTr("Photos") + } + ListView { + id: listView + dataModel: photoModel + layout: GridListLayout { + columnCount: 3 + verticalCellSpacing: 1 + horizontalCellSpacing: 1 + + } + listItemComponents: [ + ListItemComponent { + type: "image" + + ImageView { + imageSource: "file://" + _app.dataPath + "/photos/" + ListItemData.ID + ".jpg" + scalingMethod: ScalingMethod.AspectFill + contextActions: [ + ActionSet { + actions: [ + DeleteActionItem { + onTriggered: { + + } + } + ] + } + ] + } + } + ] + + + attachedObjects: [ + PhotoModel { + id: photoModel + onUpdateSelectedData: { + if (indexPath[0] >= 0 && indexPath[1] >= 0) { + //quotesList.scrollToItem(indexPath, ScrollAnimation.Default); + root.selectedData = data(indexPath); + } else { + root.listEmpty(); + } + } + }, + + ComponentDefinition { + id: viewPhotoDefinition + source: "asset:///pages/ViewPhoto.qml" + }, + + // Custom data source object, loads data using a SqlConnection, see customsqldatasource.cpp + CustomSqlDataSource { + id: asyncDataSource + source: "sql/data_r5.db" + property int loadCounter: 0 + + onDataLoaded: { + console.log(asyncDataSource.query) + console.log("Data loaded! Size: ", data.length); + if (data.length > 0) { + photoModel.insertList(data); + // Load the next batch, the last parameter is set to zero to tell the data source that we are loading data to the list. + //var offsetData = {"offset": (10 + 5 * loadCounter)}; + //execute("SELECT * FROM Claim ORDER BY Created LIMIT 5 OFFSET :offset", offsetData, 0); + //loadCounter ++; + } + } + } + ] + + onTriggered: { + // To avoid triggering navigation when pressing the header items, we check so that the + // index path length is larger then one (one entry would be a group under a header item). + //if (indexPath.length > 1) { + // Update the data that will be shown in the Quotes Page. + root.selectedData = dataModel.data(indexPath); + var page = viewPhotoDefinition.createObject(); + page.claimNo = root.claimNo; + page.photoPath = "file://" + _app.dataPath + "/photos/" + root.selectedData.ID + ".jpg" + nav.push(page); + //} + } + + function itemType(data, indexPath) { + return "image"; + } + } + } + + onClaimNoChanged: { + if (claimNo.trim().length == 0) { + return; + } + var str = "SELECT * FROM Photos WHERE ClaimNo = '" + claimNo +"'" + asyncDataSource.query = str + //console.log("Claim No: ", claimNo) + asyncDataSource.load(); + } +} diff --git a/AutoTrak/assets/pages/PoliceReport.qml b/AutoTrak/assets/pages/PoliceReport.qml new file mode 100644 index 0000000..f792e2a --- /dev/null +++ b/AutoTrak/assets/pages/PoliceReport.qml @@ -0,0 +1,267 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import ".." + +Page { + id: root + property variant data; + property variant editPage + + signal updatePoliceReport(variant data); + + function update() { + console.log("updating PR data") + root.data = null; + root.data = editPage.data; + + updatePoliceReport(editPage.data); + } + + attachedObjects: [ + ImagePaintDefinition { + id: back + imageSource: "asset:///img/blue_sign.png" + }, + ComponentDefinition { + id: editReportDefinition + source: "asset:///pages/EditPoliceReport.qml" + } + ] + + + Container { + background: back.imagePaint + verticalAlignment: VerticalAlignment.Fill + horizontalAlignment: HorizontalAlignment.Fill + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + HeaderBar { + title: "Police Report" + } + + Header { + title: qsTr("Contact Info") + } + ScrollView{ + Container { + rightPadding: 30 + leftPadding: 30 + bottomPadding: 30 + topPadding: 30 + + Container { + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Name: ") + minWidth: 175 + textStyle.color: Color.create("#FFFFFF") + } + + Label { + id: repName + textStyle.color: Color.create("#FFFFFF") + } + } + + Container { + topPadding: 30 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Phone: ") + minWidth: 175 + textStyle.color: Color.create("#FFFFFF") + } + + Label { + id: phoneNo + textStyle { + fontWeight: FontWeight.Bold + } + gestureHandlers: [ + TapHandler { + onTapped: { + _app.callNumber(phoneNo.text) + } + } + ] + textStyle.color: Color.create("#FFFFFF") + } + } + + Container { + topPadding: 30 + id: emailBlock + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Email: ") + minWidth: 175 + textStyle.color: Color.create("#FFFFFF") + } + + Label { + id: email + textStyle { + fontWeight: FontWeight.Bold + } + attachedObjects: [ + Invocation { + id: invoke + query { + invokeActionId: "bb.action.SENDEMAIL" + invokeTargetId: "sys.pim.uib.email.hybridcomposer" + mimeType: "message/rfc822" + } + } + ] + gestureHandlers: [ + TapHandler { + onTapped: { + invoke.trigger("bb.action.SENDEMAIL") + } + } + ] + textStyle.color: Color.create("#FFFFFF") + minHeight: 100.0 + multiline: true + autoSize.maxLineCount: 2 + } + } + + Container { + topPadding: 30 + layout: StackLayout { + //orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Incident: ") + minWidth: 175 + textStyle.color: Color.create("#FFFFFF") + } + + + Label { + id: incident + multiline: true + textStyle.color: Color.create("#FFFFFF") + } + } + + + + Container { + topPadding: 30 + layout: StackLayout { + //orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Detail of Event: ") + minWidth: 175 + textStyle.color: Color.create("#FFFFFF") + } + + ScrollView { + Label { + id: eventDetail + multiline: true + minHeight: 100 + textStyle.color: Color.create("#FFFFFF") + } + } + + } + } + + } +} + + actions: [ + ActionItem { + title: qsTr("Edit") + imageSource: "asset:///img/edit_icon_81x81.png" + + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + editPage = editReportDefinition.createObject(root); + editPage.updatePoliceReport.connect(update); + editPage.data = root.data; + editPage.open(); + //nav.push(editPage); + } + }, + ActionItem { + id: shareAction + + attachedObjects: [ + Invocation { + id: shareInvoke + property bool autoTrigger: false + query { + mimeType: "text/plain" + + onDataChanged: { + shareInvoke.query.updateQuery() + } + } + onArmed: { + if (autoTrigger) + trigger("bb.action.SHARE"); + autoTrigger = true; + } + } + ] + + title: qsTr("Share") + imageSource: "asset:///img/share_icon_81x81.png" + onTriggered: { + var str = "Claim #: "+data.ClaimNo+"\nName: "+data.Name+"\nPhone #:"+(data.Phone || '')+"\nIncident: "+data.Incident+"\nEvent Detail: " + data.Statement; + shareInvoke.query.data = str + } + ActionBar.placement: ActionBarPlacement.OnBar + } + ] + + onDataChanged: { + if (data) { + phoneNo.text = data.Phone + " Ext. " + data.Extension + repName.text = data.Name + + if (data.Email && data.Email.length > 0) { + emailBlock.visible = true + email.text = data.Email + invoke.query.uri = "mailto:" + data.Email + "?subject=Police%20Report%20-%20Claimant%20" + data.Name + invoke.query.updateQuery() + } + incident.text = data.Incident + eventDetail.text = data.Statement + } + } +} diff --git a/AutoTrak/assets/pages/Repairs.qml b/AutoTrak/assets/pages/Repairs.qml new file mode 100644 index 0000000..3a9713c --- /dev/null +++ b/AutoTrak/assets/pages/Repairs.qml @@ -0,0 +1,172 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import bb.data 1.0 +import autotrak.data 1.0 +import "../models" +import ".." + +Page { + id: root + + property string claimNo: ""; + property variant selectedData + + attachedObjects: [ + ImagePaintDefinition { + id: back + imageSource: "asset:///img/orange_sign.png" + } + ] + + Container { + background: back.imagePaint + HeaderBar { + title: qsTr("Repair Shops") + } + + ListView { + id: reportList + layout: StackListLayout { + headerMode: ListHeaderMode.Sticky + } + + // The data model used defined in the attachedObjects for the list. + dataModel: reportModel + + // There are two types of item; header for alphabetic groups and standard items + // showing the person name. + listItemComponents: [ + ListItemComponent { + type: "item" + StandardListItem { + id: claimItem + // Some entries only have a last name (we enforce last name always being added) + title: ListItemData.Name + description: ListItemData.Email + status: ListItemData.Phone + contextActions: [ + + ] + } + }, + ListItemComponent { + type: "header" + Container { + background: Color.White + Header { + title: ListItemData + } + } + } + ] + + onTriggered: { + // To avoid triggering navigation when pressing the header items, we check so that the + // index path length is larger then one (one entry would be a group under a header item). + if (indexPath.length > 1) { + // Update the data that will be shown in the Quotes Page. + root.selectedData = dataModel.data(indexPath); + reportList.showReport(); + } + } + + function showReport() { + var rep = null; + + switch (selectedData.ReportType) { + case "Claimant Reports": + rep = claimantReportDefinition.createObject(); + rep.data = root.selectedData + break; + case "Police Reports": + rep = policeReportDefinition.createObject(); + rep.data = root.selectedData + break; + case "Witness Reports": + rep = witnessReportDefinition.createObject(); + rep.data = root.selectedData + break; + } + nav.push(rep); + } + + attachedObjects: [ + ComponentDefinition { + id: claimantReportDefinition + source: "asset:///pages/ClaimantReport.qml" + }, + ComponentDefinition { + id: policeReportDefinition + source: "asset:///pages/PoliceReport.qml" + }, + ComponentDefinition { + id: witnessReportDefinition + source: "asset:///pages/WitnessReport.qml" + }, + RepairModel { + id: reportModel + onUpdateSelectedData: { + if (indexPath[0] >= 0 && indexPath[1] >= 0) { + //quotesList.scrollToItem(indexPath, ScrollAnimation.Default); + root.selectedData = data(indexPath); + } else { + root.listEmpty(); + } + } + }, + // Custom data source object, loads data using a SqlConnection, see customsqldatasource.cpp + CustomSqlDataSource { + id: asyncDataSource + source: "sql/data/_r5.db" + property int loadCounter: 0 + query: "SELECT * FROM RepairShops" + onDataLoaded: { + //console.log(asyncDataSource.query) + //console.log("Data loaded! Size: ", data.length); + if (data.length > 0) { + reportModel.insertList(data); + // Load the next batch, the last parameter is set to zero to tell the data source that we are loading data to the list. + //var offsetData = {"offset": (10 + 5 * loadCounter)}; + //execute("SELECT * FROM Claim ORDER BY Created LIMIT 5 OFFSET :offset", offsetData, 0); + //loadCounter ++; + } + } + } + ] // attachedObjects + } + } + + actions: [ + ActionItem { + title: qsTr("Choose Repair Shop") + ActionBar.placement: ActionBarPlacement.OnBar + imageSource: "asset:///img/check_icon_81x81.png" + } + ] + + onClaimNoChanged: { + if (claimNo.trim().length == 0) { + return; + } + + //asyncDataSource.query = str + //console.log("Claim No: ", claimNo) + asyncDataSource.load(); + } +} diff --git a/AutoTrak/assets/pages/Reports.qml b/AutoTrak/assets/pages/Reports.qml new file mode 100644 index 0000000..0aa1f07 --- /dev/null +++ b/AutoTrak/assets/pages/Reports.qml @@ -0,0 +1,265 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import bb.data 1.0 +import autotrak.data 1.0 +import "../models" +import ".." + +Page { + id: root + + property string claimNo: "" + property variant selectedData + + attachedObjects: [ + ImagePaintDefinition { + id: back + imageSource: "asset:///img/Highway_401_Night_Busy.png" + } + ] + + Container { + background: back.imagePaint + HeaderBar { + title: qsTr("Details and Reports") + } + + ListView { + id: reportList + layout: StackListLayout { + headerMode: ListHeaderMode.Sticky + } + + // The data model used defined in the attachedObjects for the list. + dataModel: reportModel + + // There are two types of item; header for alphabetic groups and standard items + // showing the person name. + listItemComponents: [ + ListItemComponent { + type: "item" + Container { + id: listViewItems + layout: StackLayout { + orientation: LayoutOrientation.TopToBottom + } + Container { + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + + } + Label { + text: ListItemData.Name + horizontalAlignment: HorizontalAlignment.Fill + + textStyle.fontStyle: FontStyle.Normal + textStyle.fontSizeValue: 0.0 + textStyle.color: Color.create("#fff9fb67") + textStyle.fontWeight: FontWeight.Bold + topMargin: 0.0 + minHeight: 50.0 + layoutProperties: StackLayoutProperties { + spaceQuota: 2.0 + + } + + } + + Label { + text: ListItemData.Phone + horizontalAlignment: HorizontalAlignment.Fill + layoutProperties: StackLayoutProperties { + spaceQuota: -1.0 + + } + textStyle.fontStyle: FontStyle.Normal + textStyle.fontSizeValue: 0.0 + textStyle.color: Color.create("#fff9fb67") + textStyle.fontWeight: FontWeight.Bold + minHeight: 70.0 + + } + } + Container { + Label { + + text: ListItemData.Email + horizontalAlignment: HorizontalAlignment.Fill + textStyle.fontStyle: FontStyle.Normal + textStyle.fontWeight: FontWeight.Bold + textStyle.color: Color.create("#ff78aaff") + + minHeight: 70.0 + + } + + } + + } + + }, + + ListItemComponent { + type: "header" + + Header { + title: ListItemData + opacity: 0.75 + } + + } + ] + + onTriggered: { + // To avoid triggering navigation when pressing the header items, we check so that the + // index path length is larger then one (one entry would be a group under a header item). + if (indexPath.length > 1) { + // Update the data that will be shown in the Quotes Page. + root.selectedData = dataModel.data(indexPath); + reportList.showReport(); + } + } + + function showReport() { + var rep = null; + + switch (selectedData.ReportType) { + case "Claimant Reports": + rep = claimantReportDefinition.createObject(); + rep.data = root.selectedData; + rep.updateClaimantReport.connect(onUpdateClaimantReport); + break; + case "Police Reports": + rep = policeReportDefinition.createObject(); + rep.data = root.selectedData + rep.updatePoliceReport.connect(onUpdatePoliceReport); + break; + case "Witness Reports": + rep = witnessReportDefinition.createObject(); + rep.data = root.selectedData + rep.updateWitnessReport.connect(onUpdateWitnessReport); + break; + } + nav.push(rep); + } + + attachedObjects: [ + ComponentDefinition { + id: claimantReportDefinition + source: "asset:///pages/ClaimantReport.qml" + }, + ComponentDefinition { + id: policeReportDefinition + source: "asset:///pages/PoliceReport.qml" + }, + ComponentDefinition { + id: witnessReportDefinition + source: "asset:///pages/WitnessReport.qml" + }, + ReportModel { + id: reportModel + onUpdateSelectedData: { + if (indexPath[0] >= 0 && indexPath[1] >= 0) { + //quotesList.scrollToItem(indexPath, ScrollAnimation.Default); + root.selectedData = data(indexPath); + } else { + root.listEmpty(); + } + } + }, + // Custom data source object, loads data using a SqlConnection, see customsqldatasource.cpp + CustomSqlDataSource { + id: asyncDataSource + source: "sql/data_r5.db" + property int loadCounter: 0 + + onDataLoaded: { + //console.log(asyncDataSource.query) + //console.log("Data loaded! Size: ", data.length); + if (data.length > 0) { + reportModel.insertList(data); + // Load the next batch, the last parameter is set to zero to tell the data source that we are loading data to the list. + //var offsetData = {"offset": (10 + 5 * loadCounter)}; + //execute("SELECT * FROM Claim ORDER BY Created LIMIT 5 OFFSET :offset", offsetData, 0); + //loadCounter ++; + } + } + } + ] // attachedObjects + } + } + + function onUpdatePoliceReport(data) { + console.log("updating PR from page"); + asyncDataSource.execute("UPDATE PoliceReport SET Name = :Name, Phone = :Phone, Email = :Email, Incident = :Incident, EventDetail = :EventDetail WHERE ClaimNo = :ClaimNo", { + Name: data.Name, + Phone: data.Phone, + Email: data.Email, + Incident: data.Incident, + EventDetail: data.EventDetail, + ClaimNo: claimNo + }, data.ID); + + var indexPath = reportModel.find(root.selectedData); + reportModel.updateItem(indexPath, data); + } + + function onUpdateWitnessReport(data) { + console.log("updating WR from page"); + asyncDataSource.execute("UPDATE Witness SET Name = :Name, Phone = :Phone, Email = :Email, Statement = :Statement WHERE ID = :ClaimNo", { + Name: data.Name, + Phone: data.Phone, + Email: data.Email, + Statement: data.Statement, + ClaimNo: claimNo + }, data.ID); + + var indexPath = reportModel.find(root.selectedData); + reportModel.updateItem(indexPath, data); + } + + function onUpdateClaimantReport(data) { + console.log("updating CR from page"); + asyncDataSource.execute("UPDATE Claimant SET Name = :Name, Phone1 = :Phone, Email = :Email, Statement = :Statement WHERE ID = :ClaimNo", { + Name: data.Name, + Phone: data.Phone, + Email: data.Email, + Statement: data.Statement, + ClaimNo: claimNo + }, data.ID); + + var indexPath = reportModel.find(root.selectedData); + reportModel.updateItem(indexPath, data); + } + + onClaimNoChanged: { + if (claimNo.trim().length == 0) { + return; + } + var str = "SELECT ClaimNo, Name, Address, Phone1 as Phone, Phone2, '' as Extension, Email, Statement, 'Claimant Reports' as ReportType, '' as Incident FROM Claimant " + str += "WHERE ClaimNo = '" + claimNo + "' UNION " + str += "SELECT ClaimNo, Name, '' as Address, Phone, '' as Phone2, Extension, Email, EventDetail as Statement,'Police Reports' as ReportType, Incident FROM PoliceReport " + str += "WHERE ClaimNo = " + claimNo + " UNION " + str += "SELECT ClaimNo, Name, Address, Phone, '' as Phone2, '' as Extension, Email, Statement, 'Witness Reports' as ReportType, '' as Incident FROM Witness " + str += "WHERE ClaimNo = " + claimNo + "" + asyncDataSource.query = str + //console.log("Claim No: ", claimNo) + asyncDataSource.load(); + } +} diff --git a/AutoTrak/assets/pages/ViewPhoto.qml b/AutoTrak/assets/pages/ViewPhoto.qml new file mode 100644 index 0000000..5e33ec0 --- /dev/null +++ b/AutoTrak/assets/pages/ViewPhoto.qml @@ -0,0 +1,109 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 + +Page { + id: root + objectName: "viewPhoto" + property string photoID: "" + property string claimNo: "" + property string photoPath + property variant selectedData + + actionBarVisibility: ChromeVisibility.Overlay + + Container { + background: Color.Black + + ImageView { + id : img + + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + + scalingMethod: ScalingMethod.AspectFit + + gestureHandlers: [ + TapHandler { + onTapped: { + root.actionBarVisibility = root.actionBarVisibility == ChromeVisibility.Hidden ? + ChromeVisibility.Overlay : ChromeVisibility.Hidden; + } + } + ] + } + } + + attachedObjects: [ + ComponentDefinition { + id: editPhotoDefinition + source: "asset:///pages/EditPhoto.qml" + } + ] + + actions: [ + ActionItem { + title: qsTr("Edit") + imageSource: "asset:///img/edit_icon_81x81.png" + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + var page = editPhotoDefinition.createObject(); + page.claimNo = root.claimNo; + nav.push(page); + nav.peekEnabled = false; + page.setImage(photoPath); + } + }, + + ActionItem { + title: qsTr("Share") + imageSource: "asset:///img/share_icon_81x81.png" + ActionBar.placement: ActionBarPlacement.OnBar + + attachedObjects: [ + Invocation { + property bool armed: false + id: invokeShare + + onArmed: { + if (armed) { + invokeShare.trigger("bb.action.SHARE") + } + armed = true; + } + } + ] + + onTriggered: { + invokeShare.trigger("bb.action.SHARE") + } + }, + + DeleteActionItem { + ActionBar.placement: ActionBarPlacement.InOverflow + } + ] + + onPhotoPathChanged: { + img.imageSource = photoPath; + + invokeShare.query.uri = photoPath + invokeShare.query.updateQuery(); + } +} diff --git a/AutoTrak/assets/pages/WitnessReport.qml b/AutoTrak/assets/pages/WitnessReport.qml new file mode 100644 index 0000000..bff39ad --- /dev/null +++ b/AutoTrak/assets/pages/WitnessReport.qml @@ -0,0 +1,250 @@ +/* Copyright (c) 2013 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. +*/ + + + +import bb.cascades 1.0 +import ".." + +Page { + id: root + + property variant data; + property variant editPage + + signal updateWitnessReport(variant data); + + function update() { + console.log("updating PR data") + root.data = null; + root.data = editPage.data; + + updateWitnessReport(editPage.data); + } + + + attachedObjects: [ + ImagePaintDefinition { + id: back + imageSource: "asset:///img/yellow_sign.png" + }, + ComponentDefinition { + id: editReportDefinition + source: "asset:///pages/EditWitnessReport.qml" + } + ] + + Container { + background: back.imagePaint + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + layoutProperties: StackLayoutProperties { + spaceQuota: 1 + } + HeaderBar { + title: "Witness Report" + } + ScrollView { + Container { + rightPadding: 30 + leftPadding: 30 + bottomPadding: 30 + topPadding: 30 + + Container { + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Name: ") + } + + Label { + id: repName + } + } + + Container { + topPadding: 30 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Address: ") + } + + Label { + id: address + multiline: true + minHeight: 100.0 + } + } + + Container { + topPadding: 30 + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Phone: ") + } + + Label { + id: phoneNo + textStyle { + fontWeight: FontWeight.Bold + } + gestureHandlers: [ + TapHandler { + onTapped: { + _app.callNumber(phoneNo.text) + } + } + ] + } + } + + Container { + topPadding: 30 + id: emailBlock + layout: StackLayout { + orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Email: ") + } + + Label { + id: email + textStyle { + fontWeight: FontWeight.Bold + } + attachedObjects: [ + Invocation { + id: invoke + query { + invokeActionId: "bb.action.SENDEMAIL" + invokeTargetId: "sys.pim.uib.email.hybridcomposer" + mimeType: "message/rfc822" + } + } + ] + gestureHandlers: [ + TapHandler { + onTapped: { + invoke.trigger("bb.action.SENDEMAIL") + } + } + ] + multiline: true + minHeight: 100.0 + } + } + + Container { + topPadding: 30 + layout: StackLayout { + // orientation: LayoutOrientation.LeftToRight + } + + Label { + text: qsTr("Statement: ") + } + + ScrollView { + Label { + id: statement + multiline: true + minHeight: 100 + textStyle { + fontWeight: FontWeight.Bold + } + } + } + + } + } + + } + +} + actions: [ + ActionItem { + title: qsTr("Edit") + imageSource: "asset:///img/edit_icon_81x81.png" + + ActionBar.placement: ActionBarPlacement.OnBar + + onTriggered: { + editPage = editReportDefinition.createObject(root); + editPage.updateWitnessReport.connect(update); + editPage.data = root.data; + editPage.open(); + //nav.push(editPage); + } + }, + ActionItem { + id: shareAction + + attachedObjects: [ + Invocation { + id: shareInvoke + property bool autoTrigger: false + query { + mimeType: "text/plain" + + onDataChanged: { + shareInvoke.query.updateQuery() + } + } + onArmed: { + + if (autoTrigger) + trigger("bb.action.SHARE"); + autoTrigger = true; + } + } + ] + + title: qsTr("Share") + imageSource: "asset:///img/share_icon_81x81.png" + onTriggered: { + var str = "Claim #: "+data.ClaimNo+"\nWitness: "+data.Name+"\nAddress:"+data.Address+"\nPhone #:"+(data.Phone||'')+"\nStatement:\n\n" + data.Statement; + shareInvoke.query.data = str + } + ActionBar.placement: ActionBarPlacement.OnBar + } + ] + + onDataChanged: { + if (data) { + phoneNo.text = data.Phone + repName.text = data.Name + address.text = data.Address + statement.text = data.Statement + + if (data.Email && data.Email.length > 0) { + emailBlock.visible = true + email.text = data.Email + invoke.query.uri = "mailto:" + data.Email + "?subject=Witness%20Report" + invoke.query.updateQuery() + } + } + } +} diff --git a/AutoTrak/assets/sql/data_r5.db b/AutoTrak/assets/sql/data_r5.db new file mode 100644 index 0000000..fc5fc59 Binary files /dev/null and b/AutoTrak/assets/sql/data_r5.db differ diff --git a/AutoTrak/bar-descriptor.xml b/AutoTrak/bar-descriptor.xml new file mode 100644 index 0000000..5d017db --- /dev/null +++ b/AutoTrak/bar-descriptor.xml @@ -0,0 +1,111 @@ + + + + + + + + com.kisailabs.AutoTrak + + + AutoTrak + + + 0.8.0 + buildnum + + + + + + + + The AutoTrak application + + + + + + Kisai Labs + gYAAgKhoUJPa3lLl12JxlbqRaNM + core.games + + + + + + true + none + false + + + + + armle-v7 + AutoTrak + + + Qnx/Cascades + armle-v7 + AutoTrak.so + + + armle-v7 + AutoTrak + + + x86 + AutoTrak + + + + + icon.png + + + icon.png + assets + + + + + + + + run_native + read_geolocation + access_internet + access_location_services + use_camera + access_shared + access_phone + + + bright + diff --git a/AutoTrak/buildnum b/AutoTrak/buildnum new file mode 100644 index 0000000..6c0c834 --- /dev/null +++ b/AutoTrak/buildnum @@ -0,0 +1 @@ +362 \ No newline at end of file diff --git a/AutoTrak/config.pri b/AutoTrak/config.pri new file mode 100644 index 0000000..1d8eae7 --- /dev/null +++ b/AutoTrak/config.pri @@ -0,0 +1,79 @@ +# Auto-generated by IDE. Any changes made by user will be lost! +BASEDIR = $$quote($$_PRO_FILE_PWD_) + +device { + CONFIG(debug, debug|release) { + SOURCES += $$quote($$BASEDIR/src/applicationui.cpp) \ + $$quote($$BASEDIR/src/customsqldatasource.cpp) \ + $$quote($$BASEDIR/src/main.cpp) + + HEADERS += $$quote($$BASEDIR/src/applicationui.hpp) \ + $$quote($$BASEDIR/src/customsqldatasource.h) + } + + CONFIG(release, debug|release) { + SOURCES += $$quote($$BASEDIR/src/applicationui.cpp) \ + $$quote($$BASEDIR/src/customsqldatasource.cpp) \ + $$quote($$BASEDIR/src/main.cpp) + + HEADERS += $$quote($$BASEDIR/src/applicationui.hpp) \ + $$quote($$BASEDIR/src/customsqldatasource.h) + } +} + +simulator { + CONFIG(debug, debug|release) { + SOURCES += $$quote($$BASEDIR/src/applicationui.cpp) \ + $$quote($$BASEDIR/src/customsqldatasource.cpp) \ + $$quote($$BASEDIR/src/main.cpp) + + HEADERS += $$quote($$BASEDIR/src/applicationui.hpp) \ + $$quote($$BASEDIR/src/customsqldatasource.h) + } +} + +INCLUDEPATH += $$quote($$BASEDIR/src) + +CONFIG += precompile_header + +PRECOMPILED_HEADER = $$quote($$BASEDIR/precompiled.h) + +lupdate_inclusion { + SOURCES += $$quote($$BASEDIR/../src/*.c) \ + $$quote($$BASEDIR/../src/*.c++) \ + $$quote($$BASEDIR/../src/*.cc) \ + $$quote($$BASEDIR/../src/*.cpp) \ + $$quote($$BASEDIR/../src/*.cxx) \ + $$quote($$BASEDIR/../assets/*.qml) \ + $$quote($$BASEDIR/../assets/*.js) \ + $$quote($$BASEDIR/../assets/*.qs) \ + $$quote($$BASEDIR/../assets/720x720/*.qml) \ + $$quote($$BASEDIR/../assets/720x720/*.js) \ + $$quote($$BASEDIR/../assets/720x720/*.qs) \ + $$quote($$BASEDIR/../assets/img/*.qml) \ + $$quote($$BASEDIR/../assets/img/*.js) \ + $$quote($$BASEDIR/../assets/img/*.qs) \ + $$quote($$BASEDIR/../assets/img/samples/*.qml) \ + $$quote($$BASEDIR/../assets/img/samples/*.js) \ + $$quote($$BASEDIR/../assets/img/samples/*.qs) \ + $$quote($$BASEDIR/../assets/js/*.qml) \ + $$quote($$BASEDIR/../assets/js/*.js) \ + $$quote($$BASEDIR/../assets/js/*.qs) \ + $$quote($$BASEDIR/../assets/models/*.qml) \ + $$quote($$BASEDIR/../assets/models/*.js) \ + $$quote($$BASEDIR/../assets/models/*.qs) \ + $$quote($$BASEDIR/../assets/pages/*.qml) \ + $$quote($$BASEDIR/../assets/pages/*.js) \ + $$quote($$BASEDIR/../assets/pages/*.qs) \ + $$quote($$BASEDIR/../assets/sql/*.qml) \ + $$quote($$BASEDIR/../assets/sql/*.js) \ + $$quote($$BASEDIR/../assets/sql/*.qs) + + HEADERS += $$quote($$BASEDIR/../src/*.h) \ + $$quote($$BASEDIR/../src/*.h++) \ + $$quote($$BASEDIR/../src/*.hh) \ + $$quote($$BASEDIR/../src/*.hpp) \ + $$quote($$BASEDIR/../src/*.hxx) +} + +TRANSLATIONS = $$quote($${TARGET}.ts) diff --git a/AutoTrak/icon.png b/AutoTrak/icon.png new file mode 100644 index 0000000..4c002fe Binary files /dev/null and b/AutoTrak/icon.png differ diff --git a/AutoTrak/precompiled.h b/AutoTrak/precompiled.h new file mode 100644 index 0000000..fddb580 --- /dev/null +++ b/AutoTrak/precompiled.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2013 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 file is used to store precompiled headers. +// It is intentionally left blank. It is up to you to decide which headers should be included here. diff --git a/AutoTrak/src/applicationui.cpp b/AutoTrak/src/applicationui.cpp new file mode 100644 index 0000000..4666d17 --- /dev/null +++ b/AutoTrak/src/applicationui.cpp @@ -0,0 +1,281 @@ +/* Copyright (c) 2013 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. +*/ + + + +#include "applicationui.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace bb::cascades; +using namespace bb::system; + +BlaqService::BlaqService(bb::cascades::Application *app) : + QObject(app) + , m_dataSource(new CustomSqlDataSource(this)) +{ + m_photoQuery = QLatin1String("INSERT INTO Photos (ClaimNo, OriginalPath,Created,Modified) VALUES (:ClaimNo, :OPath, :Created, :Modified)"); + + m_dataSource->setSource("sql/data_r5.db"); + connect(m_dataSource, SIGNAL(reply(bb::data::DataAccessReply)), this, SLOT(onDataSourceReply(bb::data::DataAccessReply))); + + bool firstRun = getValueFor("firstRun", false).toBool(); + + if (!firstRun) { + loadPhotos(); + saveValueFor("firstRun", true); + } + + // prepare the localization + m_pTranslator = new QTranslator(this); + m_pLocaleHandler = new LocaleHandler(this); + if(!QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()))) { + // This is an abnormal situation! Something went wrong! + // Add own code to recover here + qWarning() << "Recovering from a failed connect()"; + } + + // initial load + onSystemLanguageChanged(); + + qmlRegisterType < CustomSqlDataSource > ("autotrak.data", 1, 0, "CustomSqlDataSource"); + + // Create scene document from main.qml asset, the parent is set + // to ensure the document gets destroyed properly at shut down. + QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); + QmlDocument::defaultDeclarativeEngine()->rootContext()->setContextProperty("_app", this); + + // Create root object for the UI + AbstractPane *root = qml->createRootObject(); + + // Set created root object as the application scene + app->setScene(root); +} + +QString BlaqService::copyToData(const QString& path) const { + QFile sourceFile(path); + + qDebug() << "Exists: " << sourceFile.exists(); + + if (sourceFile.open(QFile::ReadOnly)) { + + QByteArray base64Encoded = sourceFile.readAll(); + QByteArray a = base64Encoded.toBase64(); + + qDebug() << QString::fromLatin1(a); + + sourceFile.close(); + return QString(a); + } + return QLatin1String(""); +} + +void BlaqService::onSystemLanguageChanged() +{ + QCoreApplication::instance()->removeTranslator(m_pTranslator); + // Initiate, load and install the application translation files. + QString locale_string = QLocale().name(); + QString file_name = QString("AutoTrak_%1").arg(locale_string); + if (m_pTranslator->load(file_name, "app/native/qm")) { + QCoreApplication::instance()->installTranslator(m_pTranslator); + } +} + +QString BlaqService::formatDate(const QString& dateStr) { + QDateTime dt = QDateTime::fromString(dateStr, Qt::ISODate); + + return dt.toString("dddd, MMMM d, yyyy"); +} + +QDateTime BlaqService::strToDate(const QString& dateStr) { + QDateTime dt = QDateTime::fromString(dateStr, Qt::ISODate); + + return dt; +} + +void BlaqService::callNumber(const QString& number) { + SystemDialog d; + d.setTitle("Phone Call"); + d.setBody(QString("Call %1?").arg(number)); + + SystemUiResult::Type result = d.exec(); + + if (result == SystemUiResult::ConfirmButtonSelection) { + bb::system::phone::Phone phone; + phone.initiateCellularCall(number); + } +} + +void BlaqService::composeEmail(const QString& sendTo) { + InvokeManager im; + InvokeRequest request; + request.setAction("bb.action.COMPOSE"); + request.setTarget("sys.pim.text_messaging.composer"); + request.setMimeType("application/text_messaging"); + QVariantMap map; + map.insert("to", QVariantList() << sendTo); + //map.insert("body", body); + //map.insert("send", sendNow); + QByteArray requestData = bb::PpsObject::encode(map, NULL); + request.setData(requestData); + im.invoke(request); +} + +QVariant BlaqService::getValueFor(const QString &objectName, const QVariant &defaultValue) +{ + QSettings settings; + + // If no value has been saved return the value. + if (settings.value(objectName).isNull()) { + return defaultValue; + } + + // Otherwise return the value stored in the settings object. + return settings.value(objectName); +} + +void BlaqService::saveValueFor(const QString &objectName, const QVariant &inputValue) +{ + // A new value is saved to the application settings object. + QSettings settings; + settings.setValue(objectName, inputValue); +} + +void BlaqService::loadPhotos() { + qDebug() << QDir::homePath(); + QString appFolder(QDir::homePath()); + appFolder.chop(4); + + QString photoDir = appFolder + "app/native/assets/img/samples/"; + + QStringList filter = QStringList() << "*.jpg"; + + QDir dir(photoDir); + QFileInfoList files = dir.entryInfoList(filter); + + QVariantList values; + + for (int i=0; i < files.size(); ++i) { + QFileInfo fi = files.value(i); + + QString claimNo = fi.fileName().split("_",QString::SkipEmptyParts).value(0); + + QVariantMap row; + row["ClaimNo"] = claimNo; + row["OPath"] = fi.filePath(); + row["Created"] = QDateTime::currentDateTime().toString(Qt::ISODate); + row["Modified"] = QDateTime::currentDateTime().toString(Qt::ISODate); + + values.append(row); + } + m_dataSource->beginTransaction(); + m_dataSource->executeBatch(m_photoQuery, values, 1); + m_dataSource->endTransaction(); + //qDebug() << files; +} + +void BlaqService::onDataSourceReply(const bb::data::DataAccessReply& reply) { + QString dataFolder = QDir::homePath(); + QString newFileName = dataFolder + QLatin1String("/photos/"); + + QDir dir; + + switch (reply.id()) { + case 1: + QTimer::singleShot(1500, this, SLOT(movePhotos())); + break; + case 2:{ + QVariantList resultList = reply.result().value(); + //qDebug() << resultList; + + int count = resultList.size(); + + dir.mkpath(newFileName); + for (int i=0; i < count; ++i) { + QVariantMap map = resultList.value(i).toMap(); + QFile file(map.value("OriginalPath").toString()); + QFileInfo fileInfo(file); + QString f = QString(newFileName).append(QString("%1.%2").arg(map.value("ID").toString()).arg(fileInfo.suffix())); + + qDebug() << f; + //if (!file.exists()) { + if (!file.copy(fileInfo.filePath(), f)) { + qDebug() << file.errorString(); + } + //} + } + break; + } + case 3: + { + QVariantMap map; + map["OPath"] = m_importedPhotoPath; + + m_dataSource->execute("SELECT * FROM photos WHERE OriginalPath = :OPath", map, 4); + break; + } + case 4: + { + dir.mkpath(newFileName); + qDebug() << reply.result(); + + QVariantMap map = reply.result().value().at(0).toMap(); + QFile file(m_importedPhotoPath); + QFileInfo fileInfo(file); + QString f = QString(newFileName).append(QString("%1.%2").arg(map.value("ID").toString()).arg(fileInfo.suffix())); + + qDebug() << f; + //if (!file.exists()) { + if (!file.copy(fileInfo.filePath(), f)) { + qDebug() << file.errorString(); + } + //} + emit photoImported(); + break; + } + } +} + +void BlaqService::movePhotos() { + QVariantMap map; + m_dataSource->execute("SELECT * FROM Photos", map, 2); +} + +QString BlaqService::dataPath() const { + return QDir::homePath(); +} + +void BlaqService::importPhoto(const QString& claimNo, const QString& path) { + m_importedPhotoPath = path; + + qDebug() << "Importing photo..."; + qDebug() << path; + + QVariantMap row; + row["ClaimNo"] = claimNo; + row["OPath"] = path; + row["Created"] = QDateTime::currentDateTime().toString(Qt::ISODate); + row["Modified"] = QDateTime::currentDateTime().toString(Qt::ISODate); + + m_dataSource->execute(m_photoQuery, row, 3); +} diff --git a/AutoTrak/src/applicationui.hpp b/AutoTrak/src/applicationui.hpp new file mode 100644 index 0000000..57bc5e3 --- /dev/null +++ b/AutoTrak/src/applicationui.hpp @@ -0,0 +1,107 @@ +/* Copyright (c) 2013 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 ApplicationUI_HPP_ +#define ApplicationUI_HPP_ + +#include +#include +#include +#include +#include +#include + +#include "customsqldatasource.h" + +namespace bb +{ + namespace cascades + { + class Application; + class LocaleHandler; + } +} + +class QTranslator; + +/*! + * @brief Application object + * + * + */ + +class BlaqService : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString dataPath READ dataPath CONSTANT) +public: + BlaqService(bb::cascades::Application *app); + virtual ~BlaqService() { } + + Q_INVOKABLE QString copyToData(const QString& path) const; + + Q_INVOKABLE QString formatDate(const QString& dateStr); + Q_INVOKABLE QDateTime strToDate(const QString& dateStr); + + Q_INVOKABLE void callNumber(const QString& number); + Q_INVOKABLE void composeEmail(const QString& to); + + Q_INVOKABLE void importPhoto(const QString& claimNo, const QString& path); + + /** + * Invokable functions that we can call from QML. + * This function get's a value from the QSettings, + * if that value does not exist in the QSettings database, that data will be added. + * + * @param objectName Index path to the item. + * @param defaultValue is used to create that data in the database when created. + */ + Q_INVOKABLE static QVariant getValueFor(const QString &objectName, const QVariant &defaultValue); + + /** + * Invokable functions that we can call from QML. + * This function sets a value in the QSettings database, it's supposed to be called + * when a datavalue has been updated from QML + * + * @param objectName Index path to the item. + * @param inputValue new value to the QSettings database. + */ + + Q_INVOKABLE static void saveValueFor(const QString &objectName, const QVariant &inputValue); + + void loadPhotos(); + + QString dataPath() const; + +private slots: + Q_INVOKABLE void movePhotos(); + void onSystemLanguageChanged(); + void onDataSourceReply(const bb::data::DataAccessReply &reply); + +signals: + void photoImported(); + +private: + QTranslator* m_pTranslator; + bb::cascades::LocaleHandler* m_pLocaleHandler; + + CustomSqlDataSource *m_dataSource; + QString m_photoQuery; + QString m_importedPhotoPath; +}; + +#endif /* ApplicationUI_HPP_ */ diff --git a/AutoTrak/src/customsqldatasource.cpp b/AutoTrak/src/customsqldatasource.cpp new file mode 100644 index 0000000..9488f39 --- /dev/null +++ b/AutoTrak/src/customsqldatasource.cpp @@ -0,0 +1,183 @@ +/* Copyright (c) 2013 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. +*/ + + + +#include "customsqldatasource.h" + +int const CustomSqlDataSource::LOAD_EXECUTION = 0; + +CustomSqlDataSource::CustomSqlDataSource(QObject *parent) : + QObject(parent), mSqlConnector(0), mDataSource(0) +{ + +} + +CustomSqlDataSource::~CustomSqlDataSource() +{ + delete mSqlConnector; +} + +void CustomSqlDataSource::copyFileToDataFolder(const QString fileName) +{ + // Since we need read and write access to the file, it has + // to be moved to a folder where we have access to it. First, + // we check if the file already exists (previously copied). + QString dataFolder = QDir::homePath(); + QString newFileName = dataFolder + "/" + fileName; + QFile newFile(newFileName); + + + if (!newFile.exists()) { + // If the file is not already in the data folder, we copy it from the + // assets folder (read only) to the data folder (read and write). + QString appFolder(QDir::homePath()); + appFolder.chop(4); + QString originalFileName = appFolder + "app/native/assets/" + fileName; + QFile originalFile(originalFileName); + + if (originalFile.exists()) { + // Create sub folders if any creates the SQL folder for a file path like e.g. sql/quotesdb + QFileInfo fileInfo(newFileName); + QDir().mkpath (fileInfo.dir().path()); + + if(!originalFile.copy(newFileName)) { + qDebug() << "Failed to copy file to path: " << newFileName; + } + } else { + qDebug() << "Failed to copy file data base file does not exists."; + } + } + + mSourceInDataFolder = newFileName; +} + + +void CustomSqlDataSource::setSource(const QString source) +{ + if (mSource.compare(source) != 0) { + // Copy the file to the data folder to get read and write access. + copyFileToDataFolder(source); + mSource = source; + emit sourceChanged(mSource); + } +} + +QString CustomSqlDataSource::source() +{ + return mSource; +} + +void CustomSqlDataSource::setQuery(const QString query) +{ + if (mQuery.compare(query) != 0) { + mQuery = query; + emit queryChanged(mQuery); + } +} + +QString CustomSqlDataSource::query() +{ + return mQuery; +} + +bool CustomSqlDataSource::checkConnection() +{ + if (mSqlConnector) { + return true; + } else { + QFile newFile(mSourceInDataFolder); + + if (newFile.exists()) { + + // Remove the old connection if it exists + if(mSqlConnector){ + disconnect(mSqlConnector, SIGNAL(reply(const bb::data::DataAccessReply&)), this, + SLOT(onLoadAsyncResultData(const bb::data::DataAccessReply&))); + delete mSqlConnector; + } + + // Set up a connection to the data base + mSqlConnector = new SqlConnection(mSourceInDataFolder, "connect", this); + + // Connect to the reply function + connect(mSqlConnector, SIGNAL(reply(const bb::data::DataAccessReply&)), this, + SLOT(onLoadAsyncResultData(const bb::data::DataAccessReply&))); + + return true; + + } else { + qDebug() << "CustomSqlDataSource::checkConnection Failed to load data base, file does not exist."; + } + } + return false; +} + +void CustomSqlDataSource::execute (const QString& query, const QVariantMap &valuesByName, int id) +{ + if (checkConnection()) { + mSqlConnector->execute(query, valuesByName, id); + } +} + + +void CustomSqlDataSource::load() +{ + if (mQuery.isEmpty() == false) { + if (checkConnection()) { + mSqlConnector->execute(mQuery, LOAD_EXECUTION); + } + } +} + +void CustomSqlDataSource::onLoadAsyncResultData(const bb::data::DataAccessReply& replyData) +{ + if (replyData.hasError()) { + qWarning() << "onLoadAsyncResultData: " << replyData.id() << ", SQL error: " << replyData; + } else { + + if(replyData.id() == LOAD_EXECUTION) { + // The reply belongs to the execution of the query property of the data source + // Emit the the data loaded signal so that the model can be populated. + QVariantList resultList = replyData.result().value(); + + + emit dataLoaded(resultList); + } else { + // Forward the reply signal. + emit reply(replyData); + } + } +} + +void CustomSqlDataSource::executeBatch(const QString& query, + const QVariantList& valuesByName, int id) { + + if (checkConnection()) { + mSqlConnector->executeBatch(query, valuesByName, id); + } +} + +void CustomSqlDataSource::beginTransaction() { + if (checkConnection()) { + mSqlConnector->beginTransaction(-1); + } +} + +void CustomSqlDataSource::endTransaction() { + if (checkConnection()) { + mSqlConnector->endTransaction(-1); + } +} diff --git a/AutoTrak/src/customsqldatasource.h b/AutoTrak/src/customsqldatasource.h new file mode 100644 index 0000000..c64a11f --- /dev/null +++ b/AutoTrak/src/customsqldatasource.h @@ -0,0 +1,169 @@ +/* Copyright (c) 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 QUOTESSQLDATASOURCE_H_ +#define QUOTESSQLDATASOURCE_H_ + +#include +#include +#include + +using namespace bb::data; + +namespace bb +{ + namespace data + { + class SqlConnection; + } +} +/** + * QuotesSqlDataSource Description: + * + * A custom data source for accessing a SQL data source, with the ability + * to execute SQL queries. + */ +class CustomSqlDataSource: public QObject +{ + Q_OBJECT + + /** + * The path to the SQL database. + */ + Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) + + /** + * The initial query that will be run on the database. + */ + Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged) + +public: + CustomSqlDataSource(QObject *parent = 0); + ~CustomSqlDataSource(); + + /** + * Sets the path to the SQK database + * + * @param newStatusText the new string + */ + void setSource(const QString source); + + /** + * Returns the current source path used by the data source + * + * @return A string for the current source path + */ + QString source(); + + /** + * Sets the SQL query that should be executed. + * + * @param query The new SQL query. + */ + void setQuery(const QString query); + + /** + * The query property contains an SQL query. + * + * @return A string containing the query. + */ + QString query(); + + + /** + * Loads the data from the data source. + */ + Q_INVOKABLE void load(); + + /** + * Executes a SQL query on the database the execution is non blocking the result will be delivered + * in the dataLoaded signal. The id has to greater than or equal to 1 (0 is reserved + * for loading data using the query property) + * + * @param A parameterized query which should be executed (see execute function on SqlConnection) + * @param valuesByName The data corresponding to the parameterized query + * @param An id that can be used to match requests + */ + Q_INVOKABLE void execute (const QString& query, const QVariantMap &valuesByName, int id = 1); + + Q_INVOKABLE void executeBatch (const QString& query, const QVariantList &valuesByName, int id = 1); + + Q_INVOKABLE void beginTransaction (); + Q_INVOKABLE void endTransaction(); + +signals: + + /** + * Emitted when the source path changes + * + * @param A string containing the new source + */ + void sourceChanged(QString source); + + /** + * Emitted when the query changes + * + * @param A string containing the new query + */ + void queryChanged(QString query); + + /** + * Emitted when data has been received. + * + * @param A variant containing the new data. + */ + void dataLoaded (const QVariant &data); + + /** + * Emitted when an asynchronous execute operation has completed and has results to return. + * + * @param replyData The reply data from the execute operation. + */ + void reply (const bb::data::DataAccessReply &replyData); + +private slots: + /** + * Function that is connected to the SqlConnection reply signal. + * + * @param reply The reply data delivered from the asynchronous request to the SqlConnection + */ + void onLoadAsyncResultData(const bb::data::DataAccessReply& reply); + +private: + /** + * Helper function for moving a file from the assets folder to the + * read writable application data folder. + * + * @param fileName The name of the file that should be moved. + */ + void copyFileToDataFolder(const QString fileName); + bool checkConnection(); + + QString mSource; + QString mQuery; + QString mSourceInDataFolder; + + // Data base connector + SqlConnection *mSqlConnector; + + DataSource *mDataSource; + + static int const LOAD_EXECUTION; + +}; + +#endif /* QUOTESDATASOURCE_H_ */ \ No newline at end of file diff --git a/AutoTrak/src/main.cpp b/AutoTrak/src/main.cpp new file mode 100644 index 0000000..f6d70bf --- /dev/null +++ b/AutoTrak/src/main.cpp @@ -0,0 +1,87 @@ +/* Copyright (c) 2013 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. +*/ + + + +#include + +#include +#include +#include "applicationui.hpp" +#include +#include + +using namespace bb::cascades; +using namespace bb::cascades::pickers; + +void myMessageOutput(QtMsgType type, const char *msg) +{ + //return; + //in this function, you can write the message to any stream! + switch (type) { + case QtDebugMsg: { + QString qmsg(msg); + if (!qmsg.contains("PPS", Qt::CaseInsensitive) && + !qmsg.contains("bbm", Qt::CaseInsensitive) && + !qmsg.contains("getPersonalMessage()")) { + //fprintf(logFile, "Debug: %s\n", msg); + fprintf(stdout, "Debug: %s\n", msg); + fflush(stdout); + //fflush(logFile); + } + break; + } + case QtWarningMsg: + //fprintf(logFile, "Warning: %s\n", msg); + fprintf(stdout, "Warning: %s\n", msg); + fflush(stdout); + //fflush(logFile); + break; + case QtCriticalMsg: + //fprintf(logFile, "Critical: %s\n", msg); + fprintf(stdout, "Critical: %s\n", msg); + fflush(stdout); + //fflush(logFile); + break; + case QtFatalMsg: + //fprintf(logFile, "Fatal: %s\n", msg); + fprintf(stdout, "Fatal: %s\n", msg); + fflush(stdout); + //fflush(logFile); + abort(); + break; + } +} + +Q_DECL_EXPORT int main(int argc, char **argv) +{ + Application app(argc, argv); + + #ifndef QT_NO_DEBUG + qInstallMsgHandler(myMessageOutput); + #endif + + QCoreApplication::setOrganizationName("Kisai Labs"); + QCoreApplication::setOrganizationDomain("kisailabs.com"); + QCoreApplication::setApplicationName("AutoTrak"); + + qmlRegisterType("bb.cascades.pickers", 1, 0, "FilePicker"); + // Create the Application UI object, this is where the main.qml file + // is loaded and the application scene is set. + new BlaqService(&app); + + // Enter the application main event loop. + return Application::exec(); +} diff --git a/AutoTrak/translations/AutoTrak.pro b/AutoTrak/translations/AutoTrak.pro new file mode 100644 index 0000000..d86f721 --- /dev/null +++ b/AutoTrak/translations/AutoTrak.pro @@ -0,0 +1 @@ +include (../AutoTrak.pro) diff --git a/AutoTrak/translations/AutoTrak.qm b/AutoTrak/translations/AutoTrak.qm new file mode 100644 index 0000000..c5edc7f Binary files /dev/null and b/AutoTrak/translations/AutoTrak.qm differ diff --git a/AutoTrak/translations/AutoTrak.ts b/AutoTrak/translations/AutoTrak.ts new file mode 100644 index 0000000..53fdc08 --- /dev/null +++ b/AutoTrak/translations/AutoTrak.ts @@ -0,0 +1,422 @@ + + + + + BaseTabPage + + Search + + + + Cancel + + + + + ClaimDetail + + Claim Date: + + + + Insurer: + + + + Policy #: + + + + Insured Until: + + + + Auto Year/Make/Model: + + + + License Plate: + + + + Loss/Damage Date: + + + + Location: + + + + Cause: + + + + Police Unit Notified: + + + + Notified Date: + + + + Photos + + + + Details & Reports + + + + Repairs + + + + Edit + + + + Share + + + + Status: + + + + Claim #: + + + + + ClaimantReport + + Contact Info + + + + Name: + + + + Address: + + + + + + + + Phone: + + + + Phone 2: + + + + Email: + + + + Statement: + + + + Edit + + + + Share + + + + + EditClaim + + Edit Claim + + + + Claim Date: + + + + Insurer: + + + + Policy #: + + + + Insured Until: + + + + Auto Year/Make/Model: + + + + VIN: + + + + License Plate: + + + + Loss/Damage Date: + + + + Location: + + + + Cause: + + + + Police Unit Notified: + + + + Notify Date: + + + + Status: + + + + Claim #: + + + + + EditClaimantReport + + Edit Claimant Report + + + + Name: + + + + Email: + + + + Phone #: + + + + Statement: + + + + + EditPoliceReport + + Edit Police Report + + + + Name: + + + + Email: + + + + Phone #: + + + + Incident: + + + + Event Detail: + + + + + EditWitnessReport + + Edit Witness Report + + + + Name: + + + + Email: + + + + Phone: + + + + Statement: + + + + + Photos + + Add Photo + + + + Photos + + + + + PoliceReport + + Contact Info + + + + Name: + + + + Phone: + + + + Email: + + + + Incident: + + + + Detail of Event: + + + + Edit + + + + Share + + + + + Repairs + + Repair Shops + + + + Choose Repair Shop + + + + + Reports + + Details and Reports + + + + + ViewPhoto + + Edit + + + + Share + + + + + WitnessReport + + Name: + + + + Address: + + + + Phone: + + + + Email: + + + + Statement: + + + + Edit + + + + Share + + + + + main + + Not Viewed + + + + Viewed + + + + Customer Contacted + + + + Repair Shop Chosen + + + + Quote Received + + + + Repair Pending + + + + Repair Completed + + + + Funds Released + + + + Closed File + + + + About + + + + All + + + + diff --git a/AutoTrak/translations/Makefile b/AutoTrak/translations/Makefile new file mode 100644 index 0000000..0982d68 --- /dev/null +++ b/AutoTrak/translations/Makefile @@ -0,0 +1,12 @@ +QMAKE_TARGET = AutoTrak +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: +