From: HyungKyu Song Date: Fri, 15 Feb 2013 15:53:19 +0000 (+0900) Subject: Tizen 2.0 Release X-Git-Tag: accepted/tizen_2.0/20130215.202349^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_2.0;p=apps%2Fosp%2FInternet.git Tizen 2.0 Release --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9f75437 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +# Target name and AppID +## TODO : set application name and ID +SET(this_target Internet) +SET(APPID kmcele1k0n) + +# include directory +INCLUDE_DIRECTORIES( + /usr/include/osp + inc + ) + +# Source files +FILE(GLOB ${this_target}_SOURCE_FILES src/*.cpp) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") + +# Create executable +SET(CMAKE_EXECUTABLE_SUFFIX ".exe") +ADD_EXECUTABLE (${this_target} ${${this_target}_SOURCE_FILES}) + +# Set link libraries and link options +## TODO : add more link libraries and options +TARGET_LINK_LIBRARIES(${this_target} -L/usr/lib/osp osp-appfw osp-uifw osp-media osp-web osp-image osp-net pthread) +TARGET_LINK_LIBRARIES(${this_target} -Xlinker --allow-shlib-undefined -pthread -pie) + +# Copy info, data, res, and icons directories +INSTALL(TARGETS ${this_target} DESTINATION ../usr/apps/${APPID}/bin) + +# Copy resource +INSTALL(FILES ${CMAKE_SOURCE_DIR}/manifest.xml DESTINATION ../usr/apps/${APPID}/info) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION ../usr/apps/${APPID}) +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/shared DESTINATION ../usr/apps/${APPID}) diff --git a/LICENSE.APLv2.0 b/LICENSE.APLv2.0 new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE.APLv2.0 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE.Flora b/LICENSE.Flora new file mode 100644 index 0000000..9f3fe14 --- /dev/null +++ b/LICENSE.Flora @@ -0,0 +1,206 @@ +Flora License + +Version 1.0, May, 2012 + +http://floralicense.org/license/ + +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. + +"Tizen Certified Platform" shall mean a software platform that complies +with the standards set forth in the Compatibility Definition Document +and passes the Compatibility Test Suite as defined from time to time +by the Tizen Technical Steering Group and certified by the Tizen +Association or its designated agent. + +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 +solely as incorporated into a Tizen Certified Platform, 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 solely +as incorporated into a Tizen Certified Platform 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 pursuant to the copyright license +above, in any medium, with or without modifications, and in Source or +Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works + a copy of this License; and + 2. You must cause any modified files to carry prominent notices stating + that You changed the files; and + 3. 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 + 4. 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 Flora License to your work + +To apply the Flora 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 Flora License, Version 1.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://floralicense.org/license/ + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..1151c22 --- /dev/null +++ b/NOTICE @@ -0,0 +1,9 @@ +Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE.APLv2.0 file for Apache License, Version 2 terms and conditions. + +Several source codes may have its original copyright owner and/or +be licensed under other than Apache License, Version 2, say, Flora License, Version 1. +Please, see copyright and license comments section in the header of each file, +and the LICENSE.Flora file for Flora License, Version 1 terms and conditions. + diff --git a/data/reader.js b/data/reader.js new file mode 100644 index 0000000..6345f03 --- /dev/null +++ b/data/reader.js @@ -0,0 +1,937 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// 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. +// + + +try { +var test; +var sample= null; +totalPageNum = 1; +var readability = { +} +var page = null; + parsedPages= {}; + pageETags = {}; + +function findBaseUrl() { + var noUrlParams = window.location.pathname.split("?")[0], + urlSlashes = noUrlParams.split("/").reverse(), + cleanedSegments = [], + possibleType = ""; + + for (var i = 0, slashLen = urlSlashes.length; i < slashLen; i+=1) { + var segment = urlSlashes[i]; + + if (segment.indexOf(".") !== -1) { + possibleType = segment.split(".")[1]; + + if(!possibleType.match(/[^a-zA-Z]/)) { + segment = segment.split(".")[0]; + } + } + + if(segment.indexOf(',00') !== -1) { + segment = segment.replace(',00', ''); + } + + if (segment.match(/((_|-)?p[a-z]*|(_|-))[0-9]{1,2}$/i) && ((i === 1) || (i === 0))) { + segment = segment.replace(/((_|-)?p[a-z]*|(_|-))[0-9]{1,2}$/i, ""); + } + + + var del = false; + + if (i < 2 && segment.match(/^\d{1,2}$/)) { + del = true; + } + + if(i === 0 && segment.toLowerCase() === "index") { + del = true; + } + + if(i < 2 && segment.length < 3 && !urlSlashes[0].match(/[a-z]/i)) { + del = true; + } + + if (!del) { + cleanedSegments.push(segment); + } + } + + return window.location.protocol + "//" + window.location.host + cleanedSegments.reverse().join("/"); + } + + +function findNextPageLink(elem) { + var possiblePages = {}, + allLinks = elem.getElementsByTagName('a'), + articleBaseUrl = findBaseUrl(); + + for(var i = 0, il = allLinks.length; i < il; i+=1) { + var link = allLinks[i], + linkHref = allLinks[i].href.replace(/#.*$/, '').replace(/\/$/, ''); + + if(linkHref === "" || linkHref === articleBaseUrl || linkHref === window.location.href || linkHref in parsedPages) { + continue; + } + + if(window.location.host !== linkHref.split(/\/+/g)[1]) { + continue; + } + + var linkText = getInnerText(link); + + if(linkText.match(regexps.extraneous)) { + continue; + } + + var linkHrefLeftover = linkHref.replace(articleBaseUrl, ''); + if(!linkHrefLeftover.match(/\d/)) { + continue; + } + + if(!(linkHref in possiblePages)) { + possiblePages[linkHref] = {"score": 0, "linkText": linkText, "href": linkHref}; + } else { + possiblePages[linkHref].linkText += ' | ' + linkText; + } + + var linkObj = possiblePages[linkHref]; + + if(linkHref.indexOf(articleBaseUrl) !== 0) { + linkObj.score -= 25; + } + + var linkData = linkText + ' ' + link.className + ' ' + link.id + link.innerHTML; + if(linkData.match(regexps.nextLink)) { + linkObj.score += 50; + } + if(linkData.match(/pag(e|ing|inat)/i)) { + linkObj.score += 25; + } + if(linkData.match(/(first|last)/i)) { + if(!linkObj.linkText.match(regexps.nextLink)) { + linkObj.score -= 65; + } + } + if(linkData.match(regexps.negative) || linkData.match(regexps.extraneous)) { + linkObj.score -= 50; + } + if(linkData.match(regexps.prevLink)) { + linkObj.score -= 200; + } + + var parentNode = link.parentNode, + positiveNodeMatch = false, + negativeNodeMatch = false; + while(parentNode) { + var parentNodeClassAndId = parentNode.className + ' ' + parentNode.id; + if(!positiveNodeMatch && parentNodeClassAndId && parentNodeClassAndId.match(/pag(e|ing|inat)/i)) { + positiveNodeMatch = true; + linkObj.score += 15; + } + if(!negativeNodeMatch && parentNodeClassAndId && parentNodeClassAndId.match(regexps.negative)) { + if(!parentNodeClassAndId.match(regexps.positive)) { + linkObj.score -= 25; + negativeNodeMatch = true; + } + } + + parentNode = parentNode.parentNode; + } + + if (linkHref.match(/p(a|g|ag)?(e|ing|ination)?(=|\/)[0-9]{1,2}/i) || linkHref.match(/(page|paging)/i)) { + linkObj.score += 25; + } + + if (linkHref.match(regexps.extraneous)) { + linkObj.score -= 15; + } + + var linkTextAsNumber = parseInt(linkText, 10); + if(linkTextAsNumber) { + if (linkTextAsNumber === 1) { + linkObj.score -= 10; + } + else { + linkObj.score += Math.max(0, 10 - linkTextAsNumber); + } + } + } + + var topPage = null; + for(var page in possiblePages) { + if(possiblePages.hasOwnProperty(page)) { + if(possiblePages[page].score > 100 && (!topPage || topPage.score < possiblePages[page].score)) { + topPage = possiblePages[page]; + } + } + } + + if(topPage) { + var nextHref = topPage.href.replace(/\/$/,''); + + parsedPages[nextHref] = true; + return nextHref; + console.log("Reader :: reader.js :: INFO - Second Page link = "+nextHref); + } + else { + console.log("Reader :: reader.js :: INFO - Second Page link = null"); + return null; + } + } + + function xhr() { + if (typeof XMLHttpRequest !== 'undefined' && (window.location.protocol !== 'file:' || !window.ActiveXObject)) { + return new XMLHttpRequest(); + } + else { + try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(sixerr) { } + try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(threrr) { } + try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(err) { } + } + + return false; + } + + function successfulRequest(request) { + return (request.status >= 200 && request.status < 300) || request.status === 304 || (request.status === 0 && request.responseText); + } + + function ajax(url, options) { + var request = xhr(); + + function respondToReadyState(readyState) { + if (request.readyState === 4) { + if (successfulRequest(request)) { + if (options.success) { options.success(request); } + } + else { + if (options.error) { options.error(request); } + } + } + } + + if (typeof options === 'undefined') { options = {}; } + + request.onreadystatechange = respondToReadyState; + request.open('get', url, true); + request.setRequestHeader('Accept', 'text/html'); + + try { + request.send(options.postBody); + } + catch (e) { + if (options.error) { options.error(); } + } + + return request; + } + + curPageNum = 1; + maxPages = 30; + function appendNextPage(nextPageLink) { + + curPageNum+=1; + + var articlePage = document.createElement("DIV"); + articlePage.id = 'readability-page-' + curPageNum; + articlePage.className = 'SISO_page'; + articlePage.innerHTML = '

Page '+curPageNum+'

'; + + + if(curPageNum > maxPages) { + var nextPageMarkup = "
View Next Page
"; + + articlePage.innerHTML = articlePage.innerHTML + nextPageMarkup; + return; + } + (function(pageUrl, thisPage) { + ajax(pageUrl, { + success: function(r) { + + var eTag = r.getResponseHeader('ETag'); + if(eTag) { + if(eTag in pageETags) { + dbg("Exact duplicate page found via ETag. Aborting."); + articlePage.style.display = 'none'; + return; + } else { + pageETags[eTag] = 1; + } + } + + var page = document.createElement("DIV"); + + var responseHtml = r.responseText.replace(/\n/g,'\uffff').replace(/.*?<\/script>/gi, ''); + responseHtml = responseHtml.replace(/\n/g,'\uffff').replace(/.*?<\/script>/gi, ''); + responseHtml = responseHtml.replace(/\uffff/g,'\n').replace(/<(\/?)noscript/gi, '<$1div'); + responseHtml = responseHtml.replace(regexps.replaceBrs, '

'); + responseHtml = responseHtml.replace(regexps.replaceFonts, '<$1span>'); + + page.innerHTML = responseHtml; + + flags = 0x1 | 0x2 | 0x4; + + var nextPageLink = findNextPageLink(page), + content = grabArticle(page); + + if(!content) { + return; + } + + thisPage.innerHTML += content; + document.getElementById("reader_content_div").appendChild(thisPage); + + if(nextPageLink) { + appendNextPage(nextPageLink); + } + } + }); + }(nextPageLink, articlePage)); + } + + regexps = { + unlikelyCandidates: /combx|comment|community|disqus|extra|foot|header|menu|remark|rss|shoutbox|sidebar|sponsor|ad-break|agegate|pagination|pager|popup|tweet|twitter/i, + okMaybeItsACandidate: /and|article|body|column|main|shadow/i, + positive: /article|body|content|entry|hentry|main|page|pagination|post|text|blog|story|date/i, + negative: /combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|script|tool|widget|scbox|reply|div_dispalyslide|galleryad|disqus_thread|cnn_strylftcntnt|topRightNarrow|fs-stylelist-thumbnails|replText|ttalk_layer|disqus_post_message|disqus_post_title|cnn_strycntntrgt|wpadvert|sharedaddy sd-like-enabled sd-sharing-enabled|fs-slideshow-wrapper|fs-stylelist-launch|reply_box|contentHeader|jive-paginator lw-label/i, + extraneous: /print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single/i, + divToPElements: /<(a|blockquote|dl|div|img|ol|p|pre|table|ul|article)/i, + replaceBrs: /(]*>[ \n\r\t]*){2,}/gi, + replaceFonts: /<(\/?)font[^>]*>/gi, + trim: /^\s+|\s+$/g, + normalize: /\s{2,}/g, + killBreaks: /((\s| ?)*){1,}/g, + videos: /http:\/\/(www\.)?(youtube|vimeo)\.com/i, + skipFootnoteLink: /^\s*(\[?[a-z0-9]{1,2}\]?|^|edit|citation needed)\s*$/i, + nextLink: /(next|right|weiter|continue|>([^\|]|$)|\u00BB([^\|]|$))/i, + prevLink: /(prev|earl|old|<|«)/i, + retainDiv: /whois_record/i + } + + function cleanHeaders(e) { + for (var headerIndex = 1; headerIndex < 3; headerIndex+=1) { + var headers = e.getElementsByTagName('h' + headerIndex); + for (var i=headers.length-1; i >=0; i-=1) { + if (getClassWeight(headers[i]) < 0 || getLinkDensity(headers[i]) > 0.33) { + headers[i].parentNode.removeChild(headers[i]); + } + } + } + } + + function clean(e, tag) { + var targetList = e.getElementsByTagName( tag ); + var isEmbed = (tag === 'object' || tag === 'embed'); + + for (var y=targetList.length-1; y >= 0; y-=1) { + if(isEmbed) { + var attributeValues = ""; + for (var i=0, il=targetList[y].attributes.length; i < il; i+=1) { + attributeValues += targetList[y].attributes[i].value + '|'; + } + + if (attributeValues.search(regexps.videos) !== -1) { + continue; + } + + if (targetList[y].innerHTML.search(regexps.videos) !== -1) { + continue; + } + } + + targetList[y].parentNode.removeChild(targetList[y]); + } + } + function cleanHTML5(e, tag) { + var targetList = e.getElementsByTagName( tag ); + for (var y=targetList.length-1; y >= 0; y-=1) { + targetList[y].parentNode.removeChild(targetList[y]); + } + } + function cleanSelect(e, tag) { + var targetList = e.getElementsByTagName( tag ); + for (var y=targetList.length-1; y >= 0; y-=1) { + targetList[y].style.display = 'none'; + } + } + function getCharCount(e,s) { + s = s || ","; + return getInnerText(e).split(s).length-1; + } + function getClassWeight(e) { + + var weight = 0; + + if (typeof(e.className) === 'string' && e.className !== '') + { + if(e.className.search(regexps.negative) !== -1) { + weight -= 25; } + + if(e.className.search(regexps.positive) !== -1) { + weight += 25; } + } + + if (typeof(e.id) === 'string' && e.id !== '') + { + if(e.id.search(regexps.negative) !== -1) { + weight -= 25; } + + if(e.id.search(regexps.positive) !== -1) { + weight += 25; } + } + + return weight; + } +function ChineseJapneseKorean(innerCharacter) { + if (!innerCharacter || innerCharacter.length == 0) return false; + var innerCharacterCode = innerCharacter.charCodeAt(0); + if (innerCharacterCode > 11904 && innerCharacterCode < 12031) return true; //CJK Radicals Supplement + if (innerCharacterCode > 12352 && innerCharacterCode < 12543) return true; //Hiragana + if (innerCharacterCode > 12736 && innerCharacterCode < 19903) return true; + if (innerCharacterCode > 19968 && innerCharacterCode < 40959) return true; //CJK Unified Ideographs + if (innerCharacterCode > 44032 && innerCharacterCode < 55215) return true; //Hangul Syllables + if (innerCharacterCode > 63744 && innerCharacterCode < 64255) return true; //CJK Compatibility Ideographs + if (innerCharacterCode > 65072 && innerCharacterCode < 65103) return true; //CJK Compatibility Forms + if (innerCharacterCode > 131072 && innerCharacterCode < 173791) return true; + if (innerCharacterCode > 194560 && innerCharacterCode < 195103) return true; + return false; +} + function cleanConditionally(e, tag) { + + + var tagsList = e.getElementsByTagName(tag); + var curTagsLength = tagsList.length; + + for (var i=curTagsLength-1; i >= 0; i-=1) { + var toRemove = false; + var weight = getClassWeight(tagsList[i]); + var contentScore = (typeof tagsList[i].readability !== 'undefined') ? tagsList[i].readability.contentScore : 0; + + if(weight+contentScore < 0) + { + if(tag === "div" || tag === "article") { + var readerDivClass5 = document.getElementsByClassName("view_cnt"); + var readerDivClass6 = document.getElementById("description"); + + if(readerDivClass5.length > 0) { + toRemove = false; + } + if(readerDivClass6!==null && readerDivClass6.innerHTML.length > 0) { + toRemove = false; + } + + } else { + tagsList[i].parentNode.removeChild(tagsList[i]); + } + } + else if ( getCharCount(tagsList[i],',') < 10) { + var p = tagsList[i].getElementsByTagName("p").length; + var img = tagsList[i].getElementsByTagName("img").length; + var li = tagsList[i].getElementsByTagName("li").length-100; + var input = tagsList[i].getElementsByTagName("input").length; + + var embedCount = 0; + var embeds = tagsList[i].getElementsByTagName("embed"); + for(var ei=0,il=embeds.length; ei < il; ei+=1) { + if (embeds[ei].src.search(regexps.videos) === -1) { + embedCount+=1; + } + } + + var linkDensity = getLinkDensity(tagsList[i]); + var contentLength = getInnerText(tagsList[i]).length; + var finalWord = null; + var checkCJK = null; + var checkCJKText = null; + var checkWordOfTag = function(){ + checkCJKText = getInnerText(tagsList[i]); + for(var h = 0;h < contentLength; h +=1){ + if(ChineseJapneseKorean(checkCJKText[h]) === true) { + finalWord = checkCJKText[h]; + checkCJK = true; + break; + } + } + return finalWord; + } + if ( img > p ) { + toRemove = true; + } else if(li > p && tag !== "ul" && tag !== "ol") { + toRemove = true; + } else if( input > Math.floor(p/3) ) { + toRemove = true; + } else if(contentLength < 25 && (img > 2 || img === 0) ) { + toRemove = true; + } else if(weight < 25 && linkDensity > 0.2) { + toRemove = true; + } else if(weight >= 25 && linkDensity > 0.5) { + toRemove = true; + } else if((embedCount === 1 && contentLength < 75) || embedCount > 1) { + toRemove = true; + } + if((checkWordOfTag() !== 'undefined') && checkCJK && toRemove){ + if(weight < 25 && linkDensity > 0.3){ + toRemove = true; + }else { + toRemove = false; + } + } + + var images = tagsList[i].getElementsByTagName("img"); + for(var im=0,il=images.length; im < il; im+=1) { + if ((images[im].height >= 150) && (images[im].width >= 200)) { + toRemove = false; + break; + } + } + if(tag === "div" || tag === "article") { + var readerDivClass = document.getElementsByClassName("whois_record"); + if(readerDivClass.length > 0) { + toRemove = false; + } + var readerDivClass1 = document.getElementsByClassName("sixteen columns hreview hentry hnews full"); + if(readerDivClass1.length > 0) { + toRemove = false; + } + var readerDivClass2 = document.getElementsByClassName("list"); + if(readerDivClass2.length > 0) { + toRemove = false; + } + var readerDivClass3 = document.getElementsByClassName("articleContent"); + if(readerDivClass3.length > 0) { + toRemove = false; + } + var readerDivClass4 = document.getElementsByClassName("content"); + if(readerDivClass4.length > 0) { + toRemove = false; + } + var readerDivClass5 = document.getElementsByClassName("view_cnt"); + if(readerDivClass5.length > 0) { + toRemove = false; + } + var readerDivClass6 = document.getElementById("description"); + if(readerDivClass6!==null && readerDivClass6.innerHTML.length > 0) { + toRemove = false; + } + } + + if(toRemove) { + tagsList[i].parentNode.removeChild(tagsList[i]); + } + } + } + } + function killBreaks(e) { + try { + e.innerHTML = e.innerHTML.replace(regexps.killBreaks,'
'); + } + catch (eBreaks) { + } + } + function cleanStyles(e) { + e = e || document; + var cur = e.firstChild; + + if(!e) { + return; } + + if(typeof e.removeAttribute === 'function' && e.className !== 'readability-styled') { + e.removeAttribute('style'); } + + while ( cur !== null ) { + if ( cur.nodeType === 1 ) { + if(cur.className !== "readability-styled") { + cur.removeAttribute("style"); + } + cleanStyles( cur ); + } + cur = cur.nextSibling; + } + } + +function cleanLinkHrefs(e) { + var links = e.getElementsByTagName("a"); + for(var i=0, il=links.length; i= 0; i-=1) { + var imgCount = articleParagraphs[i].getElementsByTagName('img').length; + var embedCount = articleParagraphs[i].getElementsByTagName('embed').length; + var objectCount = articleParagraphs[i].getElementsByTagName('object').length; + + if(imgCount === 0 && embedCount === 0 && objectCount === 0 && getInnerText(articleParagraphs[i], false) === '') { + articleParagraphs[i].parentNode.removeChild(articleParagraphs[i]); + } + } + + try { + articleContent.innerHTML = articleContent.innerHTML.replace(/]*>\s*

topCandidate.readability.contentScore) { + topCandidate = candidates[c]; } + } + + if (topCandidate === null || topCandidate.tagName === "BODY") + { + topCandidate = document.createElement("DIV"); + topCandidate.innerHTML = page.innerHTML; + page.innerHTML = ""; + page.appendChild(topCandidate); + initializeNode(topCandidate); + } + + var articleContent = document.createElement("DIV"); + articleContent.id = "readability-content"; + var siblingScoreThreshold = Math.max(10, topCandidate.readability.contentScore * 0.2); + var siblingNodes = topCandidate.parentNode.childNodes; + + + for(var s=0, sl=siblingNodes.length; s < sl; s+=1) { + var siblingNode = siblingNodes[s]; + var append = false; + + if(!siblingNode) { + continue; + } + + + if(siblingNode === topCandidate) + { + append = true; + } + + var contentBonus = 0; + if(siblingNode.className === topCandidate.className && topCandidate.className !== "") { + contentBonus += topCandidate.readability.contentScore * 0.2; + } + + if(typeof siblingNode.readability !== 'undefined' && (siblingNode.readability.contentScore+contentBonus) >= siblingScoreThreshold) + { + append = true; + } + + if(siblingNode.nodeName === "P") { + var linkDensity = getLinkDensity(siblingNode); + var nodeContent = getInnerText(siblingNode); + var nodeLength = nodeContent.length; + + if(nodeLength > 80 && linkDensity < 0.25) + { + append = true; + } + else if(nodeLength < 80 && linkDensity === 0 && nodeContent.search(/\.( |$)/) !== -1) + { + append = true; + } + } + + if(append) { + var nodeToAppend = null; + if(siblingNode.nodeName !== "DIV" && siblingNode.nodeName !== "P") { + nodeToAppend = document.createElement("DIV"); + try { + nodeToAppend.id = siblingNode.id; + nodeToAppend.innerHTML = siblingNode.innerHTML; + } + catch(er) { + nodeToAppend = siblingNode; + s-=1; + sl-=1; + } + } else { + nodeToAppend = siblingNode; + } + + if(nodeToAppend.className.search(regexps.retainDiv) !== -1) { + } + articleContent.appendChild(nodeToAppend.cloneNode(true)); + } + } + + + prepArticle(articleContent); + for (var pt=0; pt < nodesToScore.length; pt+=1) { + var parentNode = nodesToScore[pt].parentNode; + var grandParentNode = parentNode ? parentNode.parentNode : null; + delete parentNode.readability; + if (grandParentNode) { + delete grandParentNode.readability; + } + } + + if( articleContent.innerHTML == '' ) + { + return " " ; + } + + return articleContent.innerHTML; + } + +function getArticleTitle() { + var curTitle = "", + origTitle = ""; + + try { + curTitle = origTitle = document.title; + if(typeof curTitle !== "string") { + curTitle = origTitle = getInnerText(document.getElementsByTagName('title')[0]); + } + } + catch(e) {} + + if(curTitle.match(/ [\|\-] /)) + { + curTitle = origTitle.replace(/(.*)[\|\-] .*/gi,'$1'); + + if(curTitle.split(' ').length < 3) { + curTitle = origTitle.replace(/[^\|\-]*[\|\-](.*)/gi,'$1'); + } + } + else if(curTitle.indexOf(': ') !== -1) + { + curTitle = origTitle.replace(/.*:(.*)/gi, '$1'); + + if(curTitle.split(' ').length < 3) { + curTitle = origTitle.replace(/[^:]*[:](.*)/gi,'$1'); + } + } + else if(curTitle.length > 150 || curTitle.length < 15) + { + var hOnes = document.getElementsByTagName('h1'); + if(hOnes.length === 1) + { + curTitle = getInnerText(hOnes[0]); + } + } + + curTitle = curTitle.replace( regexps.trim, "" ); + + if(curTitle.split(' ').length <= 4) { + curTitle = origTitle; + } + return curTitle; +} + +function initReader() { + var article_block = grabArticle(); + var article_title = getArticleTitle() + if (article_block && article_block.length > 1000) { + var title = '

'+article_title+'

' + var meta = '\n'; + return meta + title + article_block; + } else { + return "undefined"; + } +} + +initReader(); +} +catch(e) { +console.log("Reader Error - Reader.js"); +} + diff --git a/inc/IntAddBookmarkForm.h b/inc/IntAddBookmarkForm.h new file mode 100644 index 0000000..77238ac --- /dev/null +++ b/inc/IntAddBookmarkForm.h @@ -0,0 +1,130 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: IntAddBookmarkForm.h + *@brief: This header file contains the declarations of the AddBookmarkForm class. + * + */ + +#ifndef _INT_ADD_BOOKMARK_FORM_H_ +#define _INT_ADD_BOOKMARK_FORM_H_ + +#include +#include +#include "IntBookmarkData.h" +#include "IntMultipleWindowPresentationModel.h" + +class AddBookmarkForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IKeypadEventListener + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::ITextEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + { + public: + /** + * @brief The Default Constructor + */ + AddBookmarkForm(void); + + /** + * @brief The Default Destructor + */ + virtual ~AddBookmarkForm(void); + + /** + * @brief Add Radio Buttons to the list panel. + */ + void AddRadioButtonsToListPanel(void); + + /** + * @brief Shows alert message. + */ + void CreateMessage(Tizen::Base::String& str); + + /** + * @brief Initializes this instance of AddBookmarkForm. + */ + bool Initialize(void); + + // Initializes the controls of the UI for AddBookmarkForm. + virtual result OnInitializing(void); + + virtual result OnTerminating(void); + + // IListViewItemEventListener + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state); + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + + //IListViewItemProvider + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + virtual int GetItemCount(void); + + //IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IKeypadEventListener + virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction); + virtual void OnKeypadClosed(Tizen::Ui::Control& source); + virtual void OnKeypadOpened(Tizen::Ui::Control& source); + virtual void OnKeypadWillOpen(Tizen::Ui::Control& source); + + //IOrientationEventListener + virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + + // ITextEventListener + virtual void OnTextValueChanged(const Tizen::Ui::Control& source); + virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source); + + //ISceneEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + static const int IDA_CREATE_BOOKMARK_FOLDER; + static const int IDA_BUTTON_DONE; + static const int IDA_BUTTON_CANCEL; + static const int IDA_LIST_LEFT_SIDE_MARGIN; + static const int IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN; + private: + int __folderCount; // Number of bookmark folders + Tizen::Base::String __folderName; // Selected folder name + int __listHeight; + int __oldFolderCount; // Folder count when view is deactivated. + BookmarkData* __pBookmark; + Tizen::Ui::Controls::EditField* __pEditFieldTitle; // Title Edit-field + Tizen::Ui::Controls::EditField* __pEditFieldUrl; // URL Editfield + Tizen::Ui::Controls::ListView* __pList; // contains only one item + Tizen::Ui::Controls::Panel* __pListPanel; // Contains the list of Bookmark folders inluding default Bookmark and Create Bookmark Folder Button + Tizen::Ui::Scenes::SceneId __previousScene; // previous scene id + Tizen::Ui::Controls::Label* __pLabel1; + Tizen::Ui::Controls::ScrollPanel* __pScrollPanel; // The Main panel which is a scroll panel + WindowInfo* __pWindowInfo; // Contains window information of current scene + int __selectedIndex; // The index of check-button which is selected + bool __showFolderList; + Tizen::Base::String __titleOnViewDeactivated; + Tizen::Base::String __view; + Tizen::Base::String __urlOnViewDeactivated; + }; + +#endif /* _INT_ADD_BOOKMARK_FORM_H_ */ diff --git a/inc/IntAddressbar.h b/inc/IntAddressbar.h new file mode 100644 index 0000000..a401aaf --- /dev/null +++ b/inc/IntAddressbar.h @@ -0,0 +1,190 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntAddressbar + *@brief: This class defines common behaviour of Addressbar control. + * + */ + +#ifndef _INT_ADDRESSBAR_H_ +#define _INT_ADDRESSBAR_H_ + +#include +#include +#include +#include "IntIAddressbarEventListener.h" + +enum AddressBarMode +{ + ADDRESSBAR_MODE_INVALID = -1, + ADDRESSBAR_MODE_READER = 0, + ADDRESSBAR_MODE_LOADING, + ADDRESSBAR_MODE_LOADING_COMPLETE, + ADDRESSBAR_MODE_EDIT, +}; + +class Addressbar +: public Tizen::Ui::Controls::Panel + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IKeypadEventListener + { + public: + /** + * @brief This is the default constructor for this class. + */ + Addressbar(void); + + /** + * @brief This is the default destructor for this class. + */ + virtual ~Addressbar(void); + + // IActionEventListener + void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IKeypadActionEventListener + void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction); + void OnKeypadClosed(Tizen::Ui::Control& source); + void OnKeypadOpened(Tizen::Ui::Control& source); + void OnKeypadWillOpen(Tizen::Ui::Control& source); + + /** + * @brief Initializes this instance of Addressbar with the specified parameters. + */ + result Initialize(const Tizen::Graphics::Rectangle& rect); + + /** + * @brief Gets the current addressbar Mode. + */ + AddressBarMode GetAddressbarMode(void); + + /** + * brief To remove the Http from the Url editfield + */ + Tizen::Graphics::Bitmap* GetLockedImageN(void); + + /** + * @brief Gets the current progress value Addressbar control in percentage + */ + int GetProgress(void); + + /** + * @brief Gets the currently displayed Url for the Addressbar control. + */ + Tizen::Base::String GetUrl(void); + + /** + * @brief Event when orientationChanged + */ + void OrientationChanged(void); + + /** + * brief To remove the Http from the Url editfield + */ + Tizen::Base::String RemoveHttpTextFromDisplayURL(void); + + /** + * @brief Save the text of address bar + */ + void SaveAddressbarEditText(); + + /** + * @brief Sets the specified Url for the Addressbar control. + * + */ + void SetUrl(const Tizen::Base::String& url); + + /** + * @brief Sets the event listener for the Addressbar control. + * + */ + void SetAddressbarEventListener(IAddressbarEventListener* pListener); + + /** + * @brief Sets the current addressbar Mode. + */ + void SetAddressbarMode(AddressBarMode addMode); + + /** + * brief Sets the backward Button enable or disable as per the input parameter isEnabled. + */ + void SetBackButtonEnabled(bool isEnabled); + + /** + * @brief Sets the favicon bitmap. + */ + void SetFaviconBitmap(const Tizen::Graphics::Bitmap& favicon); + + /** + * @brief Sets the Forward Button enable or disable as per the input parameter isEnabled. + */ + void SetForwardButtonEnabled(bool isEnabled); + + /** + * @brief Updates the favicon bitmap/image depending on browsing mode. + */ + void UpdateFaviconBitmap(bool isPrivateOn); + + /** + * @brief Updates the progressbar Value. + */ + void UpdateProgress(const int percentage); + + private: + /** + * @brief Updates the progressbar Value. + */ + void UpdateProgressBitmap(void); + + //Action IDs + static const int IDA_REFRESH_BTN_CLICKED; + static const int IDA_READER_BTN_CLICKED; + static const int IDA_STOP_BTN_CLICKED; + static const int IDA_GO_BACK; + static const int IDA_GO_FORWARD; + static const int IDA_CANCEL; + static const int IDA_CLEAR_URL; + + private: + AddressBarMode __currentAddMode; + Tizen::Base::String __displayUrl; + Tizen::Base::String __editTextUrl; + + bool __isLoadingData; + bool __isLoadingCompleted; + int __progressPercentage; + + Tizen::Ui::Controls::Label* __pAddressbarBg; + Tizen::Ui::Controls::Panel* __pBgPanel; + Tizen::Ui::Controls::Button* __pCancelBtn; + Tizen::Ui::Controls::Button* __pClearBtn; + Tizen::Graphics::Bitmap* __pFavIcon; + Tizen::Ui::Controls::Label* __pFaviconLabel; + Tizen::Ui::Controls::Button* __pGoBackBtn; + Tizen::Ui::Controls::Button* __pGoForwardBtn; + Tizen::Ui::Controls::Label* __pLabelPrivateOn; + IAddressbarEventListener* __pListener; + Tizen::Ui::Controls::Label* __pPrivateIconLabel; + Tizen::Ui::Controls::Label* __pProgressbarLabel; + Tizen::Ui::Controls::Button* __pReaderBtn; + Tizen::Ui::Controls::Button* __pRefreshBtn; + Tizen::Ui::Controls::Button* __pStopBtn; + Tizen::Ui::Controls::Label* __pSearchLabel; + Tizen::Ui::Controls::EditField* __pUrlField; + }; + +#endif /* _INT_ADDRESSBAR_H_ */ diff --git a/inc/IntBookmarkData.h b/inc/IntBookmarkData.h new file mode 100644 index 0000000..54dff3a --- /dev/null +++ b/inc/IntBookmarkData.h @@ -0,0 +1,220 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +/** + * @file IntBookmark.h + * @brief This header file contains the declarations of the BookmarkData class. + * + * + */ +#ifndef _INT_BOOKMARK_DATA_H_ +#define _INT_BOOKMARK_DATA_H_ + + +#include + +/** + * @enum BookmarkType + * + * BookmarkType enum is used to define type of bookmark + * + */ +typedef enum BookmarkType +{ + BOOKMARK_TYPE_URL = 0, + BOOKMARK_TYPE_FOLDER +}type; + +/** + * @class Bookmark + * @brief This is a model class which contains all the properties of Bookmark class + * and the methods to get and set the values for those properties + */ +class BookmarkData + : public Tizen::Base::Object +{ +public: + /** + * @brief Default constructor + */ + BookmarkData(void); + + /** + *@brief Initialises the instance the class Bookmark with the specified parameter + */ + BookmarkData(const BookmarkData& bm); + + /** + *@brief Default destructor + */ + ~BookmarkData(void); + + /** + *@brief "=" operator overloading + */ + BookmarkData& operator =(const BookmarkData& pBookmark); + + /** + * This function gets the BookmarkId + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetBookmarkId(void); + + /** + * This function gets the BookmarkTitle + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetBookmarkTitle(void); + + /** + * This function gets the BookmarkType whether FOLDER or URL + * + * @return enum type + * @param No parameter + */ + type GetBookmarkType(void); + + /** + * This function gets the created time for the bookmark + * + * @return DateTime + * @param No parameter + */ + Tizen::Base::DateTime GetCreatedTime(void); + + /** + * This function gets the FaviconId + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetFaviconId(void); + + /** + * This function gets the path of the favicon of URL + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetIconPath(void); + + /** + * This function gets the modified time for the bookmark + * + * @return DateTime + * @param No parameter + */ + Tizen::Base::DateTime GetModifiedTime(void); + + /** + * This function gets the parentId + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetParentId(void); + + /** + * This function gets the URL + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetUrl(void); + + + /** + * This function sets the BookmarkId for the bookmark object + * + * @return No return type + * @param strBookmarkId The ID for the bookmark object + */ + void SetBookmarkId(const Tizen::Base::String& strBookmarkId); + + /** + * This function sets the BookmarkTitle for the bookmark object + * + * @return No return type + * @param strTitle The Title for the bookmark object + */ + void SetBookmarkTitle(Tizen::Base::String& strTitle); + + /** + * This function sets the createdTime for the bookmark object + * + * @return No return type + * @param strCreatedTime The createdTime for the bookmark + */ + void SetCreatedTime(const Tizen::Base::DateTime& strCreatedTime); + + /** + * This function sets the faviconid + * + * @return No return type + * @param strFaviconId The ID for the favicon object + */ + void SetFaviconId(const Tizen::Base::String& strFaviconId); + + /** + * This function sets the path for the favicon of the bookmark object + * + * @return No return type + * @param strFilePath The path for the favicon icon of bookmark + */ + void SetIconPath(const Tizen::Base::String& strFilePath); + + /** + * This function sets the ModifiedTime for the bookmark object + * + * @return No return type + * @param strModifiedTime The ModifiedTime for the bookmark + */ + void SetModifiedTime(const Tizen::Base::DateTime& strModifiedTime); + + /** + * This function sets the ParentId for the bookmark object + * + * @return No return type + * @param strParentID The parentId for the bookmark object + */ + void SetParentId(const Tizen::Base::String& strParentID); + + /** + * This function sets the URL for the bookmark object + * + * @return No return type + * @param strTitle The URL for the bookmark object + */ + void SetUrl(const Tizen::Base::String& strUrl); + +private: + Tizen::Base::String __bookmarkId; + type __bookmarkType; + Tizen::Base::String __bookmarkTitle; + Tizen::Base::String __bookmarkUrl; + Tizen::Base::DateTime __createdTime; + Tizen::Base::String __faviconId; + Tizen::Base::String __iconPath; + Tizen::Base::DateTime __modifiedTime; + Tizen::Base::String __parentId; +}; + +#endif //_INT_BOOKMARK_DATA_H_ diff --git a/inc/IntBookmarkListForm.h b/inc/IntBookmarkListForm.h new file mode 100644 index 0000000..7346854 --- /dev/null +++ b/inc/IntBookmarkListForm.h @@ -0,0 +1,147 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: BookmarkListForm + *@brief: This class defines BookmarkListForm + * + */ + +#ifndef _INT_BOOKMARK_LIST_FORM_H_ +#define _INT_BOOKMARK_LIST_FORM_H_ + +#include +#include +#include "IntConfirmationPopup.h" +#include "IntSharePopup.h" + +class BookmarkListForm +: public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFastScrollListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::IKeypadEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + , public Tizen::Ui::Controls::ISearchBarEventListener + + { + public: + + /** + * @brief The Default Constructor + * + */ + BookmarkListForm(void); + + /** + * @brief The Default Destructor + * + */ + virtual ~BookmarkListForm(void); + + /** + * @brief Initializes this instance of BookmarkListForm. + * + */ + bool Initialize(void); + + // IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + /** + * Initializes the controls of the UI for BookmarkListForm. + * + */ + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + // IOrientationEventListener + void OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + // ISceneEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + protected: + + // IListViewItemProvider + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + virtual int GetItemCount(void); + + // IFastScrollListener + virtual void OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index); + + // IListViewItemEventListener + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status); + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + + //IKeypadEventListener + virtual void OnKeypadWillOpen(Tizen::Ui::Control& source); + virtual void OnKeypadOpened(Tizen::Ui::Control& source); + virtual void OnKeypadClosed(Tizen::Ui::Control& source); + virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction); + + //ISearchBarEventListener + virtual void OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode); + + private: + static const int IDA_TABBAR_ITEM_1; + static const int IDA_TABBAR_ITEM_2; + static const int IDA_FOOTER_ITEM1; + static const int IDA_FOOTER_ITEM2; + static const int IDA_FOOTER_ITEM_ADDBOOKMARK; + static const int IDA_FORMAT_FOLDER; + static const int IDA_FORMAT_SITE; + static const int IDA_CONTEXT_ITEM_FOLDER_EDIT; + static const int IDA_CONTEXT_ITEM_FOLDER_DELETE; + static const int IDA_CONTEXT_ITEM_EDIT; + static const int IDA_CONTEXT_ITEM_SHARE; + static const int IDA_CONTEXT_ITEM_DELETE; + static const int IDA_FORMAT_ICON; + static const int IDA_FORMAT_URL; + + static const int IDA_CONFIRMATION_NO; + static const int IDA_CONFIRMATION_YES; + bool __noBookmarks; + Tizen::Base::String __parentID; + Tizen::Base::Collection::ArrayList* __pData; + ConfirmationPopup* __pConfirmationPopup; + Tizen::Ui::Controls::Footer* __pFooter; + Tizen::Ui::Controls::ListContextItem* __pItemContextFolder; + Tizen::Ui::Controls::ListContextItem* __pItemContextSite; + Tizen::Ui::Controls::ListView* __pListview; + SharePopup* __pPopUp; + + Tizen::Ui::Scenes::SceneId __previousSceneId; + Tizen::Ui::Controls::SearchBar* __pSearchBar; + Tizen::Ui::Controls::ListView* __pSearchListView; // The GroupedListView which contains the Search Bookmark lists + bool __searchBookmark; + Tizen::Base::String __searchText; + int __selectedindex; + Tizen::Base::String __selectedTitle; + }; + +#endif //_INT_BOOKMARK_LIST_FORM_H_ diff --git a/inc/IntBookmarkPresentationModel.h b/inc/IntBookmarkPresentationModel.h new file mode 100644 index 0000000..1da03cc --- /dev/null +++ b/inc/IntBookmarkPresentationModel.h @@ -0,0 +1,297 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntBookmarkPresentationModel.h + *@brief: This is the header file for BookmarkPresentationModel class + */ + +#ifndef _INT_BOOKMARK_PRESENTATION_MODEL_H +#define _INT_BOOKMARK_PRESENTATION_MODEL_H + +#include +#include +#include + +#include "IntBookmarkData.h" +#include "IntPresentationModelBase.h" +#include "IntTypes.h" + +/** + * @class BookmarkPresentationModel + * @brief This class declares functions which will manage database + */ +class BookmarkPresentationModel +:public PresentationModelBase + { +public: + /** + * @brief The method used to get the already created instance of the FaviconManager + */ + static BookmarkPresentationModel* GetInstance(void); + /** + * This function deletes the bookmark from the bookmark table + * + * @return An error code + * @param bookmarkId The bookmarkId + * @exception E_SUCCESS The bookmark is successfully deleted + * @exception E_FAILURE The bookmark deletion is unsuccessful + */ + result DeleteBookmark(int bookmarkId); + + /** + * This function deletes the bookmark from the bookmark table + * + * @return An error code + * @param url URL of the bookmark + * @exception E_SUCCESS The bookmark is successfully deleted + * @exception E_FAILURE The bookmark deletion is unsuccessful + */ + result DeleteBookmark(const Tizen::Base::String& url); + + /** + * This function deletes the bookmark from the bookmark table + * + * @return An error code + * @param folderId The folderID + * @exception E_SUCCESS The bookmark is successfully deleted + * @exception E_FAILURE The bookmark deletion is unsuccessful + */ + result DeleteBookmarkByFolderId(int folderId); + + /** + * This function deletes the folder from the folder table + * + * @return An error code + * @param bookmarkId The folderId + * @exception E_SUCCESS The folder is successfully deleted + * @exception E_FAILURE The folder deletion is unsuccessful + */ + result DeleteFolder(int folderId); + + + /** + * This function checks whether the Bookmark with given URl already exists or not + * + * @return An error code + * @param URl + * @exception E_SUCCESS The method is successful + * @exception E_FAILURE The method is not successful as the list is not being created + * @remarks To check whether the Bookmark with given URl already exists or not + */ + result DoesBookmarkExist(const Tizen::Base::String& Url, bool &exist, const Tizen::Base::String& parentId = L"-1", bool checkParentId = false); + /** + * This function selects the bookmarks from the table + * + * @return An error code + * @param parentID parentId for bookmark : Folder or URL + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param bookmarkList The arraylist where the selected bookmarks will be saved + */ + result GetBookmark(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList); + + + /** + * This function returns the no of bookmarks + * + * @return An error code + * @param parentID Folder or URL + */ + result GetBookmarkCount(const Tizen::Base::String& parentID, int& count); + + /** + * This function selects the bookmark folders from the table + * + * @return An error code + * @param parentID parentId for bookmark : Folder or URL + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param bookmarkList The arraylist where the selected bookmarks will be saved + */ + result GetFolder(const Tizen::Base::String& parentID, int startIndex,int limit, Tizen::Base::Collection::ArrayList& bookmarkList); + + + /** + * This function returns the no of bookmark folders + * + * @return An error code + * @param parentID Folder or URL + */ + result GetFolderBookmarkCount(const Tizen::Base::String& parentID, int& Count); + + /** + * This function selects the bookmark folders from the table + * + * @return An error code + * @param parentID parentId for bookmark : Folder or URL + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param bookmarkList The arraylist where the selected bookmarks will be saved + */ + result GetFoldersBookmarks(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList); + + /** + * This function returns the no of bookmark folders. + * + * @return An error code + * @param parentID Folder or URL + */ + result GetFolderCount(const Tizen::Base::String& parentID, int& count); + + /** + * This function selects the searched bookmarks from the table + * + * @return An error code + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param BookmarkList The arraylist where the selected searched bookmarks will be saved + */ + result GetSearchBookmark(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text); + + + /** + * This function returns the no of searched Bookmarks + * + * @return An error code + * @param count The no of matching bookmarks will be returned in count. + */ + result GetSearchBookmarkCount(int& count, Tizen::Base::String& text); + + /** + * This function selects the searched folders from the table + * + * @return An error code + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param FolderList The arraylist where the selected searched folders will be saved + */ + result GetSearchFolder(int startIndex,int limit, Tizen::Base::Collection::ArrayList& FolderList, Tizen::Base::String& text); + + /** + * This function returns the no of searched Bookmarks and Folders + * + * @return An error code + * @param count The no of matching bookmarks and folders will be returned in count. + */ + result GetSearchFolderBookmarkCount(int& count, Tizen::Base::String& text); + + /** + * This function returns the no of searched Folders + * + * @return An error code + * @param count The no of matching Folders will be returned in count. + */ + result GetSearchFolderCount(int& count, Tizen::Base::String& text); + + /** + * This function selects the searched bookmark folders from the table + * + * @return An error code + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param BookmarkList The arraylist where the selected searched bookmarks will be saved + */ + result GetSearchFoldersBookmarks(int startIndex,int limit, Tizen::Base::Collection::ArrayList& BookmarkList, Tizen::Base::String& text); + + /** + * This function adds the folder to the folder table + * + * @return An error code + * @param bookmark The folder + * @exception E_SUCCESS The folder is inserted successfully to the table + * @exception E_FAILURE The folder is not inserted successfully + */ + result SaveFolder(BookmarkData& bookmark); + + /** + * This function adds the bookmarks to the bookmark table + * + * @return An error code + * @param bookmark The bookmark + * @exception E_SUCCESS The bookmark is inserted successfully to the table + * @exception E_FAILURE The bookmark is not inserted successfully + */ + result SaveBookmark(BookmarkData& bookmark); + +private: + /** + * @brief The Default Constructor + */ + BookmarkPresentationModel(void); + + /** + * @brief The Default Destructor + */ + ~BookmarkPresentationModel(void); + + /** + * copy constructor + */ + BookmarkPresentationModel(const BookmarkPresentationModel& settingModelObj); + + /** + * assignment operator + */ + + BookmarkPresentationModel& operator=(const BookmarkPresentationModel& settingModelObj); + + /** + *@brief Initialize storage service + */ + result Construct(void); + + /** + * @brief The method used to create the instance of the SettingsManager class + */ + static void CreateInstance(void); + + /** + * @brief The method used to remove the already created instance of the SettingsManager + */ + static void DestroyInstance(void); + + /** + * This function creates the list of BookMark + * + * @return An error code + * @param nBookmarkCount The no of BookMark present + * @param bookmarkList An ArrayList where the BookMark will be stored + * @exception E_SUCCESS The method is successful + * @exception E_FAILURE The method is not successful as the list is not being created + * @remarks To work properly , the bookmark count and and existing list should be passed + */ + result CreateBookmarkList(int nBookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList); + /** + * This function creates the list of BookMark folders + * + * @return An error code + * @param bookmarkCount The no of BookMark folders present + * @param bookmarkList An ArrayList where the BookMark will be stored + * @exception E_SUCCESS The method is successful + * @exception E_FAILURE The method is not successful as the list is not being created + * @remarks To work properly , the bookmark count and and existing list should be passed + */ + + result CreateFolderList(int bookmarkCount, Tizen::Base::Collection::ArrayList& bookmarkList); + +private: + static BookmarkPresentationModel* __pBookmarkPresentationModel; + + }; + +#endif //_INT_BOOKMARK_PRESENTATION_MODEL_H diff --git a/inc/IntBrightnessForm.h b/inc/IntBrightnessForm.h new file mode 100644 index 0000000..093888c --- /dev/null +++ b/inc/IntBrightnessForm.h @@ -0,0 +1,101 @@ + +// Copyright 2012 Samsung Electronics Co., Ltd. +// +// 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. +// +//!Internet IntBrightness class +/*@file: IntBrightness.h + *@brief: This class defines IntBrightness used to change the brightness + * + */ + +#ifndef _INT_BRIGHTNESS_FORM_H_ +#define _INT_BRIGHTNESS_FORM_H_ + +#include +#include +#include + + +class BrightnessForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + , public Tizen::Ui::Controls::ISliderEventListener + +{ +public: + /** + * @brief The Default Constructor + * + * @return + */ + BrightnessForm(void); + + /** + * @brief The Default Destructor + * + * @return + */ + virtual ~BrightnessForm(void); + + /** + * @brief Initializes this Brightness Form. + * + * @return An error code + * @param[in] void + * @exception true The method is successful. + * @exception false An error occurred. + */ + bool Initialize(void); + + /** + * @brief Initializes the controls of the UI for Brightness. + * + * @return An error code + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result OnInitializing(void); + +protected: + + //IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + //IOrientationEventListener + virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + + //ISceenEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + //ISliderEventListener + virtual void OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value); + +private: + bool __manualBrightness; + Tizen::Ui::Controls::Slider* __pBrightnessSlider; + Tizen::Ui::Controls::Label* __pLabel; +}; + +#endif /* _INT_BRIGHTNESS_FORM_H_ */ diff --git a/inc/IntCommonLib.h b/inc/IntCommonLib.h new file mode 100644 index 0000000..e36bbda --- /dev/null +++ b/inc/IntCommonLib.h @@ -0,0 +1,106 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// +//!Internet +/*@file: IntCommonLib.h + *@brief: To define the common method of Internet application + */ + +#ifndef _INT_COMMON_LIB_H_ +#define _INT_COMMON_LIB_H_ + +#include + +/** +* @struct CommonBitmapTable +* +* Defines the table to store a bitmap +* +*/ +struct CommonBitmapTable +{ + Tizen::Graphics::Bitmap* ptr; + int refcount; + Tizen::Base::String filename; + int width; + int height; +}; + +/** +* @enum CommonBitmapId +* +* Defines a ID for a Bitmap path +* +*/ +enum CommonBitmapId +{ + +}; + +/** + * @class CommonUtil + * @brief This file declares common methods to be used + */ +class CommonUtil +{ +public: + + /** + * Returns a pointer to a bitmap value using ID + * + * @return Pointer to a bitmap value + * @param[in] CommonBitmapId The ID of the Bitmap + * @remarks To work properly, the existing CommonBitmapId has to be passed. + */ + static Tizen::Graphics::Bitmap* GetBitmap(uint id); + + /** + * Returns a pointer to a bitmap value using bitmap path, bitmap width and bitmap height + * + * @return Pointer to a bitmap value + * @param[in] strPath The path of the existing bitmap stored in res folder + * @param[in] width The width of the existing bitmap stored in res folder + * @param[in] height The height of the existing bitmap stored in res folder + * @remarks To work properly, the existing strPath, its width and height has to be passed. + */ + static Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& strPath, const int width, const int height); + + /** + * Gets a bitmap using ID assigned to it. + * + * @return Bitmap + * @param[in] Path + * @param[in] width + * @param[in] height + * @remarks Releases all the bitmaps stored + */ + static Tizen::Graphics::Bitmap* GetNinepatchedBitmapN(const Tizen::Base::String& strPath, const int width, const int height); + + /** + * Returns the string value using ID + * + * @return String + * @param[in] resourceId The ID of the resource string + * @remarks To work properly, the existing resourceId has to be passed. + */ + static Tizen::Base::String GetString(const Tizen::Base::String& resourceId); + + +private: + static CommonBitmapTable __commonBitmapTable[]; +}; + +#endif //_INT_COMMON_LIB_H_ diff --git a/inc/IntConfirmationPopup.h b/inc/IntConfirmationPopup.h new file mode 100644 index 0000000..514ba9a --- /dev/null +++ b/inc/IntConfirmationPopup.h @@ -0,0 +1,58 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: IntConfirmationPopup.h + *@brief: This header file contains the declarations of the ConfirmationPopup + * + */ + +#ifndef CONFIRMATIONPOPUP_H_ +#define CONFIRMATIONPOPUP_H_ + +#include +#include + +class ConfirmationPopup + : public Tizen::Ui::Controls::Popup + { +public: + ConfirmationPopup(void); + + virtual ~ConfirmationPopup(void); + + bool Initialize(void); + + void AddActionListener(Tizen::Ui::IActionEventListener& listener); + + Tizen::Base::String GetMessage(void); + + virtual result OnTerminating(void); + + void RemoveActionListener(Tizen::Ui::IActionEventListener& listener); + + void setMessage(Tizen::Base::String& str); + +private: + + Tizen::Base::String __message; + Tizen::Ui::Controls::Button* __pNoButton; + Tizen::Ui::Controls::Label* __pPopupText; + Tizen::Ui::Controls::Button* __pYesButton; +}; + +#endif /* CONFIRMATIONPOPUP_H_ */ diff --git a/inc/IntCreateBookmarkFolderForm.h b/inc/IntCreateBookmarkFolderForm.h new file mode 100644 index 0000000..48db1b6 --- /dev/null +++ b/inc/IntCreateBookmarkFolderForm.h @@ -0,0 +1,97 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntCreateBookMarkFolderForm + *@brief: This class creates Bookmark folder + * + */ + + +#ifndef _INT_CREATE_BOOKMARK_FOLDER_FORM_H_ +#define _INT_CREATE_BOOKMARK_FOLDER_FORM_H_ + +#include +#include +#include "IntBookmarkData.h" + +class CreateBookmarkFolderForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IKeypadEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + , public Tizen::Ui::ITextEventListener +{ + +public: + /** + * @brief The Default Constructor + * + */ + + CreateBookmarkFolderForm(void); + + /** + * @brief The Default Destructor + */ + + virtual ~CreateBookmarkFolderForm(void); + + /** + * @brief Shows alert message + * + */ + void CreateMessage(Tizen::Base::String& str); + + /** + * @brief Initializes this instance of %CreateBookmarkFolderForm. + */ + bool Initialize(void); + + virtual result OnInitializing(void); + virtual result OnTerminating(void); + + // IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IKeypadListener + virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction); + virtual void OnKeypadClosed(Tizen::Ui::Control& source); + virtual void OnKeypadOpened(Tizen::Ui::Control& source); + virtual void OnKeypadWillOpen(Tizen::Ui::Control& source); + + //ISceneEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + // ITextEventListener + virtual void OnTextValueChanged(const Tizen::Ui::Control& source); + virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source); + +protected: + static const int IDA_BUTTON_DONE; + static const int IDA_BUTTON_CANCEL; +private: + int __modalMsgBoxResult; + BookmarkData* __pBookmark; + Tizen::Ui::Controls::EditField* __pFolderTitle; // Folder Title Editfield + Tizen::Ui::Controls::MessageBox* __pMsgBox; // Message Box to display alert if folder with same name already exists + Tizen::Ui::Scenes::SceneId __previousScene; + bool __ret; +}; + +#endif /* _INT_CREATE_BOOKMARK_FOLDER_FORM_H_ */ diff --git a/inc/IntDefaultCustomItem.h b/inc/IntDefaultCustomItem.h new file mode 100644 index 0000000..24c98d0 --- /dev/null +++ b/inc/IntDefaultCustomItem.h @@ -0,0 +1,79 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// +//!Internet +/*@file: DefaultCustomItem + *@brief: This class defines common behaviour of custom Item. + * + */ + +#ifndef _INT_DEFAULT_CUSTOM_ITEM_H_ +#define _INT_DEFAULT_CUSTOM_ITEM_H_ + + + +#include +#include +#include + + +class DefaultCustomItem + : public Tizen::Ui::Controls::CustomItem +{ + +public: + /** + * @brief The Default Constructor + */ + DefaultCustomItem(void); + + /** + * @brief The Default Destructor + */ + virtual ~DefaultCustomItem(void); + + /** + * @brief Initializes this instance of %DropDownCustomItem. + */ + result Construct(int width, int height); + + + //getter and setter methods for Text + + /** + * @brief The method used to get the text of CustomItem + */ + Tizen::Base::String GetText(void); + + /** + * @brief Add all the required elements and create the Custom Item. + */ + result Make(void); + + /** + * @brief The method used to set the text of CustomItem + */ + void SetText(Tizen::Base::String& text); +protected: + static const int IDA_FORMAT_STRING; + +private: + int __height; ///Height of the SettingToggleCustomItem Instance + Tizen::Base::String __text; ///The Text for the Toggle Button + int __width; ///Width of the SettingToggleCustomItem Instance +}; + +#endif /* _INT_DEFAULT_CUSTOM_ITEM_H_ */ diff --git a/inc/IntDropDownCustomItem.h b/inc/IntDropDownCustomItem.h new file mode 100644 index 0000000..c7851db --- /dev/null +++ b/inc/IntDropDownCustomItem.h @@ -0,0 +1,111 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// +//!Internet +/*@file: DropDownCustomItem + *@brief: This class defines common behaviour of Drop down custom Item. + * + */ + +#ifndef _INT_DROPDOWN_CUSTOM_ITEM_H_ +#define _INT_DROPDOWN_CUSTOM_ITEM_H_ + + +#include +#include + +enum DropDownItemState +{ + DROP_DOWN_ITEM_STATE_OPENED = 0, + DROP_DOWN__ITEM_STATE_CLOSED +}; + +class DropDownCustomItem + : public Tizen::Ui::Controls::CustomItem +{ + +public: + /** + * Initializes this instance of DropDownCustomItem. + */ + result Construct(int width); + + + /** + * @brief The Default constructor + */ + DropDownCustomItem(void); + + + /** + * @brief The Default Destructor + */ + virtual ~DropDownCustomItem(void); + + //getter and setter methods for Main Text + + /** + * @brief The method used to get the Title text of CustomItem + */ + DropDownItemState GetCurState(void); + + /** + * @brief The method used to get the Title text of CustomItem + */ + Tizen::Base::String GetMainText(void); + + /** + * @brief The method used to get the Sub text of CustomItem + */ + Tizen::Base::String GetSubText(void); + + /** + * @brief Add all the required elements and create the Custom Item. + * + */ + result Make(void); + + /** + * @brief The method used to set the Title text of CustomItem + */ + void SetCurState(DropDownItemState); + + /** + * @brief The method used to set the Title text of CustomItem + */ + void SetMainText(const Tizen::Base::String& text); + + /** + * @brief The method used to set the Sub text of CustomItem + */ + void SetSubText(const Tizen::Base::String& text); + +protected: + static const int IDA_FORMAT_BITMAP; + static const int IDA_FORMAT_MAIN_STRING; + static const int IDA_FORMAT_SUB_STRING; + static const int IDA_FORMAT_DROPPER; + +private: + DropDownItemState __currentState; + int __height; ///Height of the SettingToggleCustomItem Instance + int __width; ///Width of the SettingToggleCustomItem Instance + + Tizen::Base::String __mainText; ///The MainText for the Toggle Button + Tizen::Base::String __subText; ///The SubText for the Toggle Button +}; + +#endif /* _INT_DROPDOWN_CUSTOM_ITEM_H_ */ diff --git a/inc/IntEditBookmarkListForm.h b/inc/IntEditBookmarkListForm.h new file mode 100644 index 0000000..e2e493e --- /dev/null +++ b/inc/IntEditBookmarkListForm.h @@ -0,0 +1,116 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: EditBookmarkListForm + *@brief: This class defines EditBookmarkListForm used to edit the bookmark + * + */ + +#ifndef _INT_EDIT_BOOKMARK_LIST_FORM_H_ +#define _INT_EDIT_BOOKMARK_LIST_FORM_H_ + +#include +#include +#include "IntConfirmationPopup.h" + +class EditBookmarkListForm + : public Tizen::Ui::Controls::Form + , public Tizen::Base::Runtime::ITimerEventListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFastScrollListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + { +public: + EditBookmarkListForm(void); + + /** + * @brief The Default Destructor + */ + virtual ~EditBookmarkListForm(void); + + /** + * @brief Initializes this instance of EditBookmarkListForm. + * + */ + bool Initialize(void); + + public: + virtual result OnInitializing(void); + + // IListViewItemProvider + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + virtual int GetItemCount(void); + + // IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IFastScrollListener + virtual void OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index); + + // IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + // IOrientationEventListener + virtual void OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + // IListViewItemEventListener + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status); + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + virtual void OnListViewItemReordered(Tizen::Ui::Controls::ListView& listView, int indexFrom, int indexTo); + + //ITimerEventListener + virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); + + //ISceenEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + +protected: + static const int IDA_BUTTON_CHECKED; + static const int IDA_TABBAR_ITEM_1; + static const int IDA_TABBAR_ITEM_2; + static const int IDA_DELETEITEM_CLICKED; + static const int IDA_SHAREITEM_CLICKED; + static const int IDA_CANCELITEM_CLICKED; + static const int IDA_FORMAT_FOLDER; + static const int IDA_FORMAT_SITE; + static const int IDA_FORMAT_ICON; + static const int IDA_FORMAT_BITMAP; + static const int IDA_BUTTON_UNCHECKED; + static const int IDA_FORMAT_URL; + +private: + Tizen::Base::String __parentID; + Tizen::Ui::Controls::CheckButton* __pCheckButton; + ConfirmationPopup* __pConfirmationPopup; + Tizen::Base::Collection::ArrayList* __pData; + Tizen::Base::Runtime::Timer* __pTimer; + Tizen::Ui::Controls::Label* __pInfoLabel; + Tizen::Ui::Controls::Panel* __pInfoPanel; + Tizen::Ui::Controls::ListView* __pListview; + int __selectedItemCount; + }; + +#endif /* _INT_EDIT_BOOKMARK_LIST_FORM_H_ */ diff --git a/inc/IntEditHistoryListForm.h b/inc/IntEditHistoryListForm.h new file mode 100644 index 0000000..a7ee023 --- /dev/null +++ b/inc/IntEditHistoryListForm.h @@ -0,0 +1,149 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntEditHistoryListForm + *@brief: This class defines EditHistoryListForm used to edit the history scene + * + */ + +#ifndef _INT_EDIT_HISTORY_LIST_FORM_H_ +#define _INT_EDIT_HISTORY_LIST_FORM_H_ + +#include +#include + + +class EditHistoryListForm + : public Tizen::Ui::Controls::Form + , public Tizen::Base::Runtime::ITimerEventListener + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IGroupedListViewItemEventListener + , public Tizen::Ui::Controls::IGroupedListViewItemProvider + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + { + public: + + /** + * @brief The Default constructor + */ + EditHistoryListForm(void); + + /** + * @brief The Default Destructor + */ + virtual ~EditHistoryListForm(void); + + /** + * @brief To Create Group Items. + * + */ + void CreateGroupItems(void); + + /** + * @brief Initializes this instance of EditHistoryListForm. + * + */ + bool Initialize(void); + + /** + * @brief converts the integer value of month to string value for that corresponding month. + * + */ + Tizen::Base::String GetMonth(int month); + + public: + + // IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + //IGroupedListViewItemProvider + Tizen::Ui::Controls::GroupItem* CreateGroupItem(int groupIndex, int itemWidth); + Tizen::Ui::Controls::ListItemBase* CreateItem(int groupIndex, int itemIndex, int itemWidth); + bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth); + bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + int GetGroupCount(void); + int GetItemCount(int groupIndex); + + /** + * Initializes the controls of the UI for EditHistoryListForm. + */ + virtual result OnInitializing(void); + + virtual result OnTerminating(void); + + + //ITimerEventListener + virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); + + //IGroupedListViewItemEventListener + void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status); + void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status); + void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction); + + //ISceneEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + //IOrientationEventListener + virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + + protected: + static const int IDA_TABBAR_ITEM_1; + static const int IDA_TABBAR_ITEM_2; + static const int IDA_BUTTON_NEXT_FORM; + static const int IDA_FORMAT_ICON; + static const int IDA_FORMAT_TITLE; + static const int IDA_FORMAT_URL; + static const int IDA_SELECT_ALL_CHECKED; + static const int IDA_SELECT_ALL_UNCHECKED; + static const int IDA_DELETE_HISTORY; + static const int IDA_CANCEL; + + private: + bool __isNoHistoryPresent; + Tizen::Base::Collection::ArrayList* __pGroupData; + Tizen::Base::Runtime::Timer* __pTimer; + Tizen::Ui::Controls::GroupedListView* __pListView; // The GroupedListView which contains the history lists + + Tizen::Ui::Controls::CheckButton* __pSelectAllCheck; + Tizen::Ui::Controls::Label* __pSelectedLabel; + int __selectedCount; + + class GroupItemClass + :public Tizen::Base::Object + { + public: + GroupItemClass() { __pData = NULL ; } + ~GroupItemClass(){ if(__pData!=null) __pData->RemoveAll(true); delete __pData; __pData = null;} + GroupItemClass(const GroupItemClass& groupItem){__pData = groupItem.__pData; } + GroupItemClass& operator =(const GroupItemClass& groupItem){if (this != &groupItem) __pData = groupItem.__pData; return *this;} + public: + Tizen::Base::DateTime __endTime; + Tizen::Base::Collection::ArrayList* __pData; + Tizen::Base::DateTime __startTime; + Tizen::Base::String __titleText; + + }; + }; + +#endif /* _INT_EDIT_HISTORY_LIST_FORM_H_ */ diff --git a/inc/IntEditHomePageForm.h b/inc/IntEditHomePageForm.h new file mode 100644 index 0000000..1a8d8b7 --- /dev/null +++ b/inc/IntEditHomePageForm.h @@ -0,0 +1,114 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet EditHomePageScene class +/*@file: EditHomePageScene.h + *@brief: Allow user to set any page as Home page. + * + */ + +#ifndef _INT_EDIT_HOME_PAGE_FORM_H_ +#define _INT_EDIT_HOME_PAGE_FORM_H_ + +#include +#include +#include +#include +#include + +class EditHomePageForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + , public Tizen::Ui::ITextEventListener +{ +public: + /** + *@brief Default constructor + */ + EditHomePageForm(void); + + /** + * Default destructor + */ + virtual ~EditHomePageForm(void); + + /** + * @brief Shows alert message. + */ + void CreateMessage(Tizen::Base::String& str); + + /** + *@brief Constructing and Initializing EditHomePageScene + */ + bool Initialize(void); + +public: + /** + *brief Used to create instances and set styles for the form content. + */ + virtual result OnInitializing(void); + + /** + *brief Called on terminate of a form + */ + virtual result OnTerminating(void); + + // IActionEventListener + /** + *brief Called when an action event occurs. + */ + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + + // IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + // ISceneEventListener + + /** + *brief Called after setting as current scene. + */ + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + + /** + *brief Called when the current scene is deactivated. + */ + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + // ITextEventListener + virtual void OnTextValueChanged(const Tizen::Ui::Control& source); + virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source); + + // IOrientationEventListener + virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + +protected: + static const int IDA_BUTTON_DONE; + static const int IDA_BUTTON_CANCEL; + +private: + int __modalMsgBoxResult; + Tizen::Ui::Controls::MessageBox* __pMsgBox; // Message Box to display alert if folder with same name already exists + Tizen::Ui::Controls::EditField* __pUrlEditField; +}; + + + +#endif /* _INT_EDIT_HOME_PAGE_FORM_H_ */ diff --git a/inc/IntFaviconManager.h b/inc/IntFaviconManager.h new file mode 100644 index 0000000..03694fc --- /dev/null +++ b/inc/IntFaviconManager.h @@ -0,0 +1,137 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntFaviconManager.h + *@brief: This is the header file for FaviconManager class + */ + + +#ifndef _FAVICON_MANAGER_H +#define _FAVICON_MANAGER_H + +#include +#include +#include +#include +#include +#include + +#include "IntTypes.h" +#include "IntPresentationModelBase.h" + +/** + * @class FaviconManager + * @brief This class declares functions which will manage Favicon + */ +class FaviconManager +:public PresentationModelBase + { + +public: + /** + * @brief The method used to get the already created instance of the FaviconManager + */ + static FaviconManager* GetInstance(void); + + /** + * This function selects the favicons from the table + * + * @return A Bitmap Pointer + * @param no parameters + */ + Tizen::Graphics::Bitmap* GetDefaultFaviconN(void); + + /** + * This function selects the favicons from the table + * + * @return A Bitmap Pointer + * @param ID the Favicon ID + */ + Tizen::Graphics::Bitmap* GetFaviconN(Tizen::Base::String& ID); + + /** + * This function adds the favicons to the Favicon table + * + * @return String Type + * @param bitmap The bitmap for favicon + * @param URL The URL for the corresponding favicon + */ + Tizen::Base::String SaveFavicon(Tizen::Graphics::Bitmap& bitmap, Tizen::Base::String& URL); + + +private: + /** + * @brief The Default Constructor + */ + FaviconManager(void); + + /** + * @brief The Default Destructor + */ + ~FaviconManager(void); + + /** + * copy constructor + */ + FaviconManager(const FaviconManager& settingModelObj); + + /** + * assignment operator + */ + + FaviconManager& operator=(const FaviconManager& settingModelObj); + + /** + *@brief Initialize storage service + */ + result Construct(void); + + /** + * @brief The method used to create the instance of the SettingsManager class + */ + static void CreateInstance(void); + + /** + * @brief The method used to remove the already created instance of the SettingsManager + */ + static void DestroyInstance(void); + + /** + * This function generates the filename + * + * @return Filename + * @param none + */ + Tizen::Base::String GenerateFileName(void); + + /** + * This function generates the filename + * + * @return void + * @param bitmap The bitmap + * filePath The path where bitmap is supposed to be saved + */ + void SaveBitmapToFile(Tizen::Graphics::Bitmap& bitmap, Tizen::Base::String& filePath); + + +private: + static Tizen::Graphics::Bitmap* __pDefaultBitmap; + static FaviconManager* __pFaviconManagerInstance; + }; + +#endif // _FAVICON_MANAGER_H diff --git a/inc/IntFontManager.h b/inc/IntFontManager.h new file mode 100644 index 0000000..a4ac136 --- /dev/null +++ b/inc/IntFontManager.h @@ -0,0 +1,115 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: FontManager.h + *@brief: This header file contains the declarations of the %FontManager class. + */ + +#ifndef _INT_FONT_MANAGER_H_ +#define _INT_FONT_MANAGER_H_ + +#include +#include + + +/** +* @enum FontId +* +* Defines a ID for a different font size +* +*/ +enum FontId +{ + FONT_INVALID = -1, + + FONT_GT34 = 0, + FONT_GT32, + FONT_GT30, + FONT_GT26, + FONT_GT20, + FONT_GT14, + + FONT_GP40, + FONT_GP38, + FONT_GP36, + FONT_GP34, + FONT_GP30, + FONT_GP26, + FONT_GP24, + FONT_GP18, + + FONT_GS30, + FONT_GS34, + + MAX_FONT +}; + +/** +* @struct FontTable +* +* Defines a table for text fontName, fontStyle and fontSize +* +*/ +struct FontTable +{ + Tizen::Graphics::Font* pInstance; + Tizen::Base::String fontName; + int fontStyle; + int fontSize; +}; + +/** + * @class FontManager + * @brief This class declares functions which can change text font properties + */ +class FontManager +{ +public: + /** + * Gets the font using fontValue + * + * @return * This header file contains the declarations of the %FontManager class. + * + * pointer to a font value + * @param[in] fontValue The ID of the font + * @remarks To work properly, the existing fontValue has to be passed. + */ + static Tizen::Graphics::Font* GetFont(FontId fontValue); + + /** + * Release all the created fonts + * + * @return no return value + * @param[in] no input parameters + */ + static void ReleaseFonts(void); + +private: + /** + * Creates a font using fontValue + * + * @return no return value + * @param[in] fontValue The ID of the font + * @remarks To work properly, the existing fontValue has to be passed. + */ + static void CreateFont(FontId fontValue); + +}; + + +#endif //_INT_FONT_MANAGER_H_ diff --git a/inc/IntFormFactory.h b/inc/IntFormFactory.h new file mode 100644 index 0000000..b6867e0 --- /dev/null +++ b/inc/IntFormFactory.h @@ -0,0 +1,77 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntFormFactory.h + *@brief: FormFactory class helps in creating appropriate forms with a specified form ID. + * It Should be derived from Tizen::Ui::Scenes::IFormFactory class + */ + + +#ifndef _INT_SCENE_FACTORY_H_ +#define _INT_SCENE_FACTORY_H_ + +#include + +/// Use 'extern' to eliminate duplicate data allocation. +extern const wchar_t* IDL_FORM_MAIN_VIEW_SCENE; +extern const wchar_t* IDL_FORM_HISTORY_LIST_SCENE; +extern const wchar_t* IDL_FORM_FIND_WORD_SCENE; +extern const wchar_t* IDL_FORM_EDIT_HISTORY_LIST_SCENE; +extern const wchar_t* IDL_FORM_SETTINGS_CLEAR_PRIVATE_DATA_SCENE; +extern const wchar_t* IDL_FORM_MULTIPLE_WINDOW_SCENE; +extern const wchar_t* IDL_FORM_MULTIPLE_WINDOW_GRID_SCENE; +extern const wchar_t* IDL_FORM_SETTINGS_SCENE; +extern const wchar_t* IDL_FORM_ADD_BOOKMARK_SCENE; +extern const wchar_t* IDL_FORM_BOOKMARK_LIST_SCENE; +extern const wchar_t* IDL_FORM_ARTICLE_READER_SCENE; +extern const wchar_t* IDL_FORM_EDIT_BOOKMARK_LIST_SCENE; +extern const wchar_t* IDL_FORM_CREATE_BOOKMARK_FOLDER_SCENE; +extern const wchar_t* IDL_FORM_FONT_SIZE_SCENE; +extern const wchar_t* IDL_FORM_EDIT_HOME_PAGE_SCENE; +extern const wchar_t* IDL_FORM_BRIGHTNESS_SCENE; + +/** + * @class FormFactory + * @brief FormFactory class helps in creating appropriate forms with a specified form ID. + * It Should be derived from Tizen::Ui::Scenes::IFormFactory class + */ +class FormFactory + : public Tizen::Ui::Scenes::IFormFactory +{ +public: + /** + * Default constructor + */ + FormFactory(void); + /** + * Default destructor + */ + virtual ~FormFactory(void); + + /** + * Called with a form ID and scene ID when an instance of Form control is required. + * + * @return Pointer to a form + * @param[in] formId The ID of the form + * @param[in] sceneId The ID of the scene + * @remarks To work properly, the existing formId and sceneId has to be passed. + */ + virtual Tizen::Ui::Controls::Form* CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId); +}; + +#endif // _INT_SCENE_FACTORY_H_ diff --git a/inc/IntHistoryData.h b/inc/IntHistoryData.h new file mode 100644 index 0000000..32f3e28 --- /dev/null +++ b/inc/IntHistoryData.h @@ -0,0 +1,232 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + + +/** + * Internet + * @file IntHistory.h + * @brief This is a model class which contains all the properties of History class + * and the methods to get and set the values for those properties + * + * This header file contains the declarations of the History class. + */ +#ifndef _INT_HISTORY_DATA_H_ +#define _INT_HISTORY_DATA_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class History + : public Tizen::Base::Object +{ +public: + /** + * Default constructor + */ + History(void); + + /** + * Initialises the instance the class History with the specified parameter + */ + History(const History& hs); + + /** + * Default destructor + */ + ~History(void); + + /** + * "=" operator overloading + */ + History& operator =(const History& pHistory); + + /** + * This function is used to get the bookmark id + * + * @return bookmarkID + * @param No parameter + */ + Tizen::Base::String GetBookmarkId(void) const; + + /** + * This function gets the FaviconId + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetFaviconId(void) const; + + /** + * This function gets the HistoryId + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetHistoryId(void) const; + + /** + * This function gets the path of the favicon of URL + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetHistoryIconPath(void) const; + + /** + * This function gets the HistoryTitle + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetHistoryTitle(void) const; + /** + * This function gets the URL + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetHistoryUrl(void) const; + + /* + * This function is used to get thumbnail + * + * @return thumbnail + * @param No parameter + */ + Tizen::Graphics::Bitmap* GetThumbnail(void) const; + + Tizen::Base::String GetThumbnailPath(void) const; + + /** + * This function is used to get visited count + * + * @return visited count + * @param No parameter + */ + int GetVisitedCount(void) const; + + /** + * This function gets the visited time for the History + * + * @return DateTime + * @param No parameter + */ + Tizen::Base::DateTime GetVisitedTime(void) const; + + /** + * This function sets history to bookmark or removes the history from bookmarks + * + * @return No return type + * @param isBookmark true to add to bookmark, false to remove from bookmark + */ + void SetBookmarkId(const Tizen::Base::String& bookmarkId); + + /** + * This function sets the faviconid + * + * @return No return type + * @param strFaviconId The ID for the favicon object + */ + void SetFaviconId(const Tizen::Base::String& strFaviconId); + + /** + * This function sets the HistoryId for the History object + * + * @return No return type + * @param strHistoryId The ID for the History object + */ + void SetHistoryId(const Tizen::Base::String& strHistoryId); + + /** + * This function sets the HistoryTitle for the History object + * + * @return No return type + * @param strTitle The Title for the History object + */ + void SetHistoryTitle(Tizen::Base::String& strHistoryTitle); + + /** + * This function sets the URL for the History object + * + * @return No return type + * @param strTitle The URL for the History object + */ + void SetHistoryUrl(const Tizen::Base::String& strHistoryUrl); + + /** + * This function sets the path for the favicon of the History object + * + * @return No return type + * @param strFilePath The path for the favicon icon of History + */ + void SetIconPath(const Tizen::Base::String& strFilePath); + + /** + * This function sets thumbnail of a URL + * + * @return No return type + * @param thumbnail to set thumbnail of URL + */ + void SetThumbnail(Tizen::Graphics::Bitmap* thumbnail); + + /** + * This function sets thumbnail path of a URL + * + * @return No return type + * @param thumbnailPath to set thumbnail path of URL + */ + void SetThumbnailPath(Tizen::Base::String& thumbnailPath); + + /** + * This function sets the createdTime for the History object + * + * @return No return type + * @param strCreatedTime The createdTime for the bookmark + */ + void SetVisitedTime(const Tizen::Base::DateTime& strVisitedTime); + + + /** + * This function sets visited count of a URL + * + * @return No return type + * @param visitedCount to set visited count of URL + */ + void SetVisitedCount(int& visitedCount); + +private: + Tizen::Base::String __bookmarkId; + Tizen::Base::String __faviconId; + Tizen::Base::String __historyId; + Tizen::Base::String __historyTitle; + Tizen::Base::String __historyUrl; + Tizen::Base::String __iconPath; + Tizen::Base::String __thumbnailPath; + Tizen::Graphics::Bitmap* __pThumbnail; + int __visitedCount; + Tizen::Base::DateTime __visitedTime; +}; + +#endif //_INT_HISTORY_DATA_H_ diff --git a/inc/IntHistoryListForm.h b/inc/IntHistoryListForm.h new file mode 100644 index 0000000..6be792c --- /dev/null +++ b/inc/IntHistoryListForm.h @@ -0,0 +1,215 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet HistoryListForm class +/*@file: HistoryListForm.h + *@brief: This class defines HistoryListForm used define history + * + */ + +#ifndef _INT_HISTORY_LIST_FORM_H_ +#define _INT_HISTORY_LIST_FORM_H_ + +#include +#include + +/** + * @class HistoryListForm + * @brief This class declares functions which displays history of browsed items, also one can search for items + */ +class HistoryListForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IGroupedListViewItemProvider + , public Tizen::Ui::Controls::IGroupedListViewItemEventListener + , public Tizen::Ui::IKeypadEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Controls::ISearchBarEventListener + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + /** + * @brief The Default Constructor + */ + HistoryListForm(void); + /** + * @brief The Default Destructor + */ + virtual ~HistoryListForm(void); + + /** + * @brief Initializes this HistoryListForm. + */ + bool Initialize(void); + + /** + * @brief creates group items and store them in arraylist for later use. + */ + void CreateGroupItems(void); + + /** + * @brief converts the integer value of month to string value for that corresponding month. + */ + Tizen::Base::String GetMonth(int month); + + // IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + //IGroupedListViewItemEventListener + void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status); + void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status); + void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction); + + /** + * brief Initializes the controls of the UI for HistoryListForm. + */ + virtual result OnInitializing(void); + + virtual result OnTerminating(void); + + //IOrientationEventListener + virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + + //IGroupedListViewItemProvider + Tizen::Ui::Controls::GroupItem* CreateGroupItem(int groupIndex, int itemWidth); + Tizen::Ui::Controls::ListItemBase* CreateItem(int groupIndex, int itemIndex, int itemWidth); + bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth); + bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + int GetGroupCount(void); + int GetItemCount(int groupIndex); + + //IKeypadEventListener + virtual void OnKeypadWillOpen(Tizen::Ui::Control& source); + virtual void OnKeypadOpened(Tizen::Ui::Control& source); + virtual void OnKeypadClosed(Tizen::Ui::Control& source); + virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction); + + //ISceneEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + //ISearchBarEventListener + virtual void OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode); + + +protected: + static const int IDA_TABBAR_ITEM_1; + static const int IDA_TABBAR_ITEM_2; + static const int IDA_EDIT_HISTORY_LIST_FORM; + static const int IDA_FORMAT_ICON; + static const int IDA_FORMAT_TITLE; + static const int IDA_FORMAT_URL; + static const int IDA_FORMAT_BOOKMARK; + +private: + bool __isNoHistoryPresent; + Tizen::Base::Collection::ArrayList* __pGroupData; + Tizen::Ui::Controls::GroupedListView* __pGroupedListView; // The GroupedListView which contains the history lists + Tizen::Ui::Controls::SearchBar* __pSearchBar; + Tizen::Base::Collection::ArrayList* __pSearchedData; + Tizen::Ui::Controls::GroupedListView* __pSearchListView; // The GroupedListView which contains the Search history lists + bool __searchHistory; +}; + +/** + * @class GroupItemClass + * @brief This class helps in storing group item data + */ +class GroupItemClass + :public Tizen::Base::Object +{ +private: + Tizen::Base::DateTime __startTime; + Tizen::Base::DateTime __endTime; + Tizen::Base::String __titleText; + Tizen::Base::Collection::ArrayList* __pData; + +public: + GroupItemClass(void); + ~GroupItemClass(void); + GroupItemClass(const GroupItemClass& groupItem); + GroupItemClass& operator =(const GroupItemClass& groupItem); + /** + * This function gets the GetEndTime of History + * + * @return A DateTime + * @param No parameter + */ + Tizen::Base::DateTime GetEndTime(void); + + /** + * This function gets the GetHistoryData of History + * + * @return A Pointer to ArrayList + * @param No parameter + */ + Tizen::Base::Collection::ArrayList* GetHistoryData(void); + + /** + * This function gets the GetStartTime of History + * + * @return A DateTime + * @param No parameter + */ + Tizen::Base::DateTime GetStartTime(void); + + /** + * This function gets the GetTitleText of History + * + * @return A String + * @param No parameter + */ + Tizen::Base::String GetTitleText(void); + + /** + * This function sets the StartTime for the History object + * + * @return No return type + * @param startTime The StartTime for the History + */ + void SetStartTime(Tizen::Base::DateTime& startTime); + + /** + * This function sets the endTime for the History object + * + * @return No return type + * @param endTime The endTime for the History + */ + void SetEndTime(Tizen::Base::DateTime& endTime); + + /** + * This function sets the titleText for the History object + * + * @return No return type + * @param titleText The titleText for the History + */ + void SetTitleText(Tizen::Base::String& titleText); + + /** + * This function sets the data for the History object + * + * @return No return type + * @param pData The data for the History + */ + void SetHistoryData(Tizen::Base::Collection::ArrayList* pData); + +}; +#endif /* _INT_HISTORY_LIST_FORM_H_ */ diff --git a/inc/IntHistoryPresentationModel.h b/inc/IntHistoryPresentationModel.h new file mode 100644 index 0000000..d0732d7 --- /dev/null +++ b/inc/IntHistoryPresentationModel.h @@ -0,0 +1,248 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + + +//!Internet +/*@file: IntHistoryPresentationModel.h + *@brief: This is the header file for HistoryPresentationModel class + */ + + +#ifndef _INT_HISTORY_PRESENTATION_MODEL_H +#define _INT_HISTORY_PRESENTATION_MODEL_H + +#include +#include +#include + + +#include "IntHistoryData.h" +#include "IntPresentationModelBase.h" +#include "IntTypes.h" + +enum { + HISTORY_ID = 0, + HISTORY_TITLE, + HISTORY_URL, + HISTORY_VISITED_TIME, + HISTORY_ICON_PATH, + HISTORY_FAVICONID, + HISTORY_THUMBNAIL, + HISTORY_BOOKMARK_ID, + HISTORY_VISITED_COUNT +}; + +/** + * @class HistoryPresentationModel + * @brief This class declares functions which will manage Browser History + */ +class HistoryPresentationModel + :public PresentationModelBase +{ +public: + /** + * @brief The method used to get the already created instance of the HistoryPresentationModel + */ + static HistoryPresentationModel* GetInstance(void); + + /** + * This function deletes all the histories. + * + * @return An error code + * @param No parameter + */ + result ClearHistory(void); + + /** + * This function creates the list of History + * + * @return An error code + * @param nHistoryCount The no of History present + * @param historyList An ArrayList where the History will be stored + * @param maxCount is used for maximum most visited site else its value is default to -1 + * @exception E_SUCCESS The method is successful + * @exception E_FAILURE The method is not successful as the list is not being created + * @remarks To work properly , the history count and and existing list should be passed + */ + result CreateHistoryList(int nHistoryCount, Tizen::Base::Collection::ArrayList& historyList, int maxCount = -1); + + /** + * This function deletes particular history of history ID from the history table + * + * @return An error code + * @param historyId The historyId + * @exception E_SUCCESS The history is successfully deleted + * @exception E_FAILURE The history deletion is unsuccessful + */ + result DeleteHistory(int historyId); + + /** + * This function deletes particular history of history URL. + * + * @return An error code + * @param No parameter + */ + result DeleteHistory(Tizen::Base::String& historyUrl); + + /** + * This function deletes Multiple histories from the history table + * + * @return An error code + * @param pHistoryIdList The Arraylist of ids of history to be deleted + * @exception E_SUCCESS The history is successfully deleted + * @exception E_FAILURE The history deletion is unsuccessful + */ + result DeleteMultipleHistory(Tizen::Base::Collection::ArrayList* pHistoryIdList); + + /** + * This function adds the history to the history table + * + * @return An error code + * @param history The history + * @exception E_SUCCESS The history is inserted successfully to the table + * @exception E_FAILURE The history is not inserted successfully + */ + result SaveHistory(History& history); + + /** + * This function selects the history from the table + * + * @return An error code + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param historyList The arraylist where the selected history will be saved + */ + result GetHistory( int startIndex, int limit, Tizen::Base::Collection::ArrayList& historyList); + + /** + * This function returns the no of history + * + * @return An error code + * @param count The no of History present will be saved in count. + */ + result GetHistoryCount(int& count); + + /** + * This function returns the history count from the table on the basis of the time range + * + * @return An error code + * @param startTime the startTime + * @param endTime the end time + */ + result GetHistoryCountWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime, int& count); + + /** + * This function selects the history from the table within given time range + * + * @return An error code + * @param startTime start value of time + * @param endTime end value of time + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param historyList The arraylist where the selected history will be saved + */ + result GetHistoryWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime,int startIndex,int limit, Tizen::Base::Collection::ArrayList& pHistoryList); + + /** + * This function used to get most visited site in a arraylist + * + * @return An error code + * @param historyList The arraylist where the most visited sites will be saved. + */ + result GetMostVisitedSites(Tizen::Base::Collection::ArrayList& historyList); + + /** + * This function returns the no of searched text history + * + * @return An error code + * @param count The no of History present will be saved in count. + * @param text text entered for search + */ + result GetSearchHistoryCount(int& count, Tizen::Base::String& text); + + /** + * This function selects the searched history from the table + * + * @return An error code + * @param startIndex the OFFSET value + * @param limit The LIMIT till which the select statement will be executed + * @param text text entered for search + * @param historyList The arraylist where the selected history will be saved + */ + result GetSearchHistory(int startIndex,int limit, Tizen::Base::Collection::ArrayList& historyList, Tizen::Base::String& text); + + /** + * This function used to given URL count + * + * @return An error code + * @param url URL to get its count + * @param count count of a URL + */ + result GetUrlCount(const Tizen::Base::String& url, int& count); + +private: + + /** + * @brief The Default Constructor + */ + HistoryPresentationModel(void); + + /** + * @brief The Default Destructor + */ + ~HistoryPresentationModel(void); + + /** + * copy constructor + */ + HistoryPresentationModel(const HistoryPresentationModel& settingModelObj); + + /** + * assignment operator + */ + + HistoryPresentationModel& operator=(const HistoryPresentationModel& settingModelObj); + + /** + *@brief Initialize storage service + */ + result Construct(void); + + /** + * @brief The method used to create the instance of the SettingsManager class + */ + static void CreateInstance(void); + + /** + * @brief The method used to remove the already created instance of the SettingsManager + */ + static void DestroyInstance(void); + + /** + * This function is used to generate file name + * + * @return filename name of a file + * @param No parameter + */ + Tizen::Base::String GenerateFileName(void); + + Tizen::Base::String GetStringFromDate(Tizen::Base::DateTime& date); + + static HistoryPresentationModel* __pHistoryPresentationModel; +}; + +#endif //_INT_HISTORY_PRESENTATION_MODEL_H diff --git a/inc/IntIAddressbarEventListener.h b/inc/IntIAddressbarEventListener.h new file mode 100644 index 0000000..03e9178 --- /dev/null +++ b/inc/IntIAddressbarEventListener.h @@ -0,0 +1,56 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet IntIAddressbarEventListener class +/*@file: IntIAddressbarEventListener.h + *@brief: The %IntIAddressbarEventListener interface is the listener interface for receiving the Addressbar events such as + * the event for clicking refresh,stop loading etc. + * + */ + +#ifndef _INT_IADDRESSBAR_EVENT_LISTENER_H_ +#define _INT_IADDRESSBAR_EVENT_LISTENER_H_ + +class Addressbar; + +/** + * @interface IAddressbarEventListener + * @brief This interface implements the listener for Addressbar Events. + * + * The %IAddressbarEventListener interface is the listener interface for receiving the Addressbar events such as + * the event for clicking refresh,stoThis class defines HistoryListScene used define historyp loading etc. + * + */ +class IAddressbarEventListener +{ +public: + virtual ~IAddressbarEventListener(void) {}; + virtual void OnAddressBarKeypadClosed(const Addressbar&) = 0; + virtual void OnAddressBarKeypadOpened(const Addressbar&) = 0; + virtual void OnAddressBarKeypadWillOpen(const Addressbar&) = 0; + virtual void OnAddressBarModeChanged(const Addressbar&) = 0; + virtual void OnAddressCancelledClicked(const Addressbar&) = 0; + virtual void OnBackClicked(const Addressbar&) = 0; + virtual void OnForwardClicked(const Addressbar&) = 0; + virtual void OnReaderClicked(const Addressbar&) = 0; + virtual void OnRefreshClicked(const Addressbar&) = 0; + virtual void OnStopClicked(Addressbar&) = 0; + virtual void OnUrlSubmitted(Addressbar&) = 0; +}; + + +#endif /* _INT_IADDRESSBAR_EVENT_LISTENER_H_ */ diff --git a/inc/IntISettingChangeListener.h b/inc/IntISettingChangeListener.h new file mode 100644 index 0000000..2403bdd --- /dev/null +++ b/inc/IntISettingChangeListener.h @@ -0,0 +1,46 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet ISettingsChangeEventListener class +/*@file: IntISettingsChangeEventListener.h + *@brief: The %IntISettingsChangeEventListener + * + */ + +#ifndef _INT_SETTINGS_CHANGE_LISTENER_H_ +#define _INT_SETTINGS_CHANGE_LISTENER_H_ + +/** + * @interface IntISettingsChangeListener + * @brief This interface implements the listener for Addressbar Events. + * + * The %IntIAddressbarEventListener interface is the listener interface for receiving the Addressbar events such as + * the event for clicking refresh,stoThis class defines HistoryListScene used define historyp loading etc. + * + */ +class ISettingChangeEventListener + : public Tizen::Base::Object +{ +public: + virtual ~ISettingChangeEventListener(void) {}; + virtual void OnClearCache(void) = 0; + virtual void OnClearCookie(void) = 0; + virtual void OnSettingsChange(int settingvalue) = 0; + virtual void OnSettingsReset(void) = 0; +}; + +#endif /* _INT_SETTINGS_CHANGE_LISTENER_H_ */ diff --git a/inc/IntInternetApp.h b/inc/IntInternetApp.h new file mode 100644 index 0000000..ab71cc9 --- /dev/null +++ b/inc/IntInternetApp.h @@ -0,0 +1,84 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: Internet.h + *@brief: provides basic features necessary to define an UiApp. + */ + +#ifndef _INT_INTERNET_APP_H_ +#define _INT_INTERNET_APP_H_ + +#include +#include +#include +#include + +#include "IntMultipleWindowPresentationModel.h" + +class InternetApp + : public Tizen::App::UiApp + , public Tizen::App::IAppControlProviderEventListener + , public Tizen::System::IScreenEventListener +{ +public: + /** + * UiApp must have a factory method that creates an instance of itself. + */ + static Tizen::App::UiApp* CreateInstance(void); + void ShowPopup(Tizen::Base::String& pTitle, Tizen::Base::String& pText); + +public: + /** + *@brief Default constructor + */ + InternetApp(void); + /** + *@brief Default destructor + */ + virtual ~InternetApp(void); + +public: + + bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry); + + bool OnAppInitialized(void); + + bool OnAppWillTerminate(void); + + bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false); + + void OnBackground(void); + + void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel); + + void OnForeground(void); + + void OnLowMemory(void); + + void OnScreenOff(void); + + void OnScreenOn(void); + + //IAppControlProviderEventListener + void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String &operationId, const Tizen::Base::String *pDataType, const Tizen::Base::String *pUriScheme, const Tizen::Base::Collection::IMap *pArgs); +private: + MultipleWindowPresentationModel* __pMultiWindowManager; + WindowInfo* __pNewWindowInfo;//the new window object to be created either by the normal launch of application or as an appcontrol launch +}; + +#endif // _INT_INTERNET_APP_H_ diff --git a/inc/IntMainForm.h b/inc/IntMainForm.h new file mode 100644 index 0000000..ebeee1e --- /dev/null +++ b/inc/IntMainForm.h @@ -0,0 +1,296 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet MainForm class +/*@file: MainForm.h + *@brief: The %MainForm provides the common functionalities for the Main View of the Browser including the addressbar, + * loading,handling events etc. + */ + +#ifndef _INT_MAIN_FORM_H_ +#define _INT_MAIN_FORM_H_ + +#include +#include +#include + +#include "IntAddressbar.h" +#include "IntHistoryData.h" +#include "IntHistoryPresentationModel.h" +#include "IntIAddressbarEventListener.h" +#include "IntISettingChangeListener.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSharePopup.h" + +class MainForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::IActionEventListener + , public IAddressbarEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::IKeypadEventListener + , public Tizen::Web::Controls::ILoadingListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::ITextEventListener + , public Tizen::Ui::ITouchEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + , public ISettingChangeEventListener + , public Tizen::Web::Controls::IWebKeypadEventListener + , public Tizen::Web::Controls::IWebUiEventListener + , public Tizen::Web::Controls::ITextSearchListener +{ +public: + /** + *@brief Default constructor + */ + MainForm(void); + + /** + *@brief Default destructor + */ + virtual ~MainForm(void); + + /** + * @brief The method initializes the screen variables and controls to be used by the user. + * + */ + bool Initialize(void); + + /** + * @brief Initializes this instance of %MainForm. + * + */ + result InitWebControl(); + + /** + * @brief Initializes this instance of Reader Panel. + */ + result CreateReaderPanel(void); + + Tizen::Base::String GetImagePath(void); + + void LoadUrl(Tizen::Base::String& url); + + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + //IAddressbarEventListener + void OnAddressCancelledClicked(const Addressbar&); + + void OnAddressBarKeypadClosed(const Addressbar&); + + void OnAddressBarKeypadOpened(const Addressbar&); + + void OnAddressBarKeypadWillOpen(const Addressbar&); + + void OnAddressBarModeChanged(const Addressbar&); + + void OnBackClicked(const Addressbar&); + + void OnForwardClicked(const Addressbar&); + + void OnReaderClicked(const Addressbar&); + + void OnRefreshClicked(const Addressbar&){} + + void OnSearchClicked(const Addressbar&){} + + void OnStopClicked(Addressbar&); + + void OnUrlSubmitted(Addressbar&); + + //ILoadingeventListener + virtual void OnEstimatedProgress(int progress); + + virtual bool OnHttpAuthenticationRequestedN(const Tizen::Base::String& host, const Tizen::Base::String& realm, const Tizen::Web::Controls::AuthenticationChallenge& authentication); + + virtual void OnHttpAuthenticationCanceled(void); + + virtual result OnInitializing(void); + + virtual void OnKeypadWillOpen(Tizen::Ui::Control& source); + + virtual void OnKeypadOpened(Tizen::Ui::Control& source){} + + virtual void OnKeypadClosed(Tizen::Ui::Control& source);; + + virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction){} + + void OnLoadingErrorOccurred(Tizen::Web::Controls::LoadingErrorType error, const Tizen::Base::String& reason); + + virtual void OnLoadingStarted(void); + + virtual void OnLoadingCanceled(void); + + virtual void OnLoadingCompleted(void); + + bool OnLoadingRequested(const Tizen::Base::String& url, Tizen::Web::Controls::WebNavigationType type); + + virtual void OnPageTitleReceived(const Tizen::Base::String& title); + + virtual Tizen::Web::Controls::DecisionPolicy OnWebDataReceived(const Tizen::Base::String& mime, const Tizen::Net::Http::HttpHeader& httpHeader); + + //IOrientationEventListener + virtual void OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus); + + //ISceenEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + virtual result OnTerminating(void); + + void SetImageLoadEnabled(void); + + void SetJavascriptEnabled(void); + + // IListViewItemEventListener + /** + *Called when the state of an element in the ListContextItem is changed. + */ + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state); + + /** + *Called when the state of an element in the ListViewItem in the ListView or GroupedListView is changed. + */ + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + + /** + *Called when the ListItem is swept. + */ + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + + /** + *Called when the item or the element is long pressed. + */ + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback){}; + + + //IListViewItemProvider + virtual Tizen::Ui::Controls::ListItemBase * CreateItem (int index, int itemWidth); + virtual bool DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth); + virtual int GetItemCount (void); + + //IWebUiEventListener + virtual void OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint); + virtual void OnWebPageShowRequested(Tizen::Web::Controls::Web& source); + virtual Tizen::Web::Controls::Web* OnWebWindowCreateRequested(void); + virtual void OnWebWindowCloseRequested(Tizen::Web::Controls::Web& source) {AppLog("acdaqsc");} + + //IWebKeypadEventListener + virtual void OnWebKeypadClosed(Tizen::Web::Controls::Web& source); + virtual void OnWebKeypadOpened(Tizen::Web::Controls::Web& source); + virtual void OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source); + + //ITouchEventListener + virtual void OnTouchDoublePressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo){} + virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo){} + virtual void OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo); + + virtual void OnTextFound(int totalCount, int currentOrdinal); + + //ISettingsChangeListener + void OnClearCache(void); + void OnClearCookie(void); + void OnSettingsChange(int settingvalue); + void OnSettingsReset(void); + + virtual void OnTextValueChangeCanceled (const Tizen::Ui::Control &source){} + virtual void OnTextValueChanged (const Tizen::Ui::Control &source); + + void UpdateImageContent(Tizen::Base::ByteBuffer* aBuffer, Tizen::Base::String imageName); +private: + double findDistance(int x1,int y1,int x2, int y2); + void FindNextWord(bool next = true); + result InitAddressbar(void); + result InitFooter(void); + result InitContextMenu(Tizen::Graphics::Point& p); + result InitFindWordPanel(void); + result InitImageContextMenu(Tizen::Graphics::Point p); + result InitSelectTextContextMenu(Tizen::Graphics::Point p, bool pasteOption, bool onlyPasteOption); + result InitMostVisitedSitesPanel(Tizen::Ui::OrientationStatus orientationStatus); + result InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatus); + void MoveUiControls(void); + void UpdateFavicon(void); + void RelayoutControls(bool showAddressbar); + void ShowFindWordPanel(bool show = true, bool isTouchPressed = false); + void ShowMostVisitedSitesPanel(void); + void StartWordSearch(); + +private: + + static const int IDA_FORMAT_BITMAP; + static const int IDA_FORMAT_DELETE_BITMAP; + static const int IDA_FORMAT_TITLE_STRING; + static const int IDA_FORMAT_URL_STRING; + static const int IDA_CONTEXT_ITEM_DELETE; + + Tizen::Graphics::Point __adressPanelPosition; + AddressBarMode __curAddressBarMode; + Tizen::Base::String __currentSearchStr; + Tizen::Base::String __currentSelectedStr; + int __distanceMoved; + int __webControlHeight; + float __previousZoomLevel; + int __maxOccurrances; + int __currentWordIndex; + bool __isLoaded; + bool __inputEventToBeSupressed; + Addressbar* __pAddressbar; + Tizen::Ui::Controls::Label* __pArticleReaderLabel; + Tizen::Ui::Controls::Panel* __pArticleReaderPanel; + Tizen::Ui::Controls::Panel* __pBlankPanel; + Tizen::Ui::Controls::Label * __pFindWordBgLabel; + Tizen::Ui::Controls::Button* __pFindWordClear; + Tizen::Ui::Controls::Label* __pFindWordCountLabel; + Tizen::Ui::Controls::Panel* __pFindWordControl; + Tizen::Ui::Controls::EditField* __pFindWordEditField; + Tizen::Ui::Controls::Button* __pFindWordNext; + Tizen::Ui::Controls::Button* __pFindWordPrev; + Tizen::Ui::Controls::Panel* __pFindWordPanel; + Tizen::Ui::Controls::Panel* __pFooterPanel; + Tizen::Web::Controls::HitElementResult* __pHitElementResult; + Tizen::Ui::Controls::ContextMenu* __pImageMenu; + Tizen::Ui::Controls::ContextMenu* __pMenu; + Tizen::Ui::Controls::Button* __pMoreButton; + Tizen::Ui::Controls::Button* __pMultiWindowButton; + Tizen::Ui::Controls::Button* __pNewWindowButton; + SharePopup* __pPopUp; + AddressBarMode __prevAddressBarMode; + Tizen::Ui::Controls::Button* __pReaderCloseBtn; + Tizen::Base::String* __pReaderData; + Tizen::Media::Image* __pSaveImage; + Tizen::Web::Controls::Web* __pWebReader; + Tizen::Web::Controls::Web* __pWebViewer; + WindowInfo* __pWindowInfo; + Tizen::Ui::Controls::ListView* __pMostVisitedListView; + + Tizen::Graphics::Point __touchPoint1; + Tizen::Graphics::Point __touchPoint2; + Tizen::Graphics::Point __webControlPosition; + + Tizen::Ui::Controls::ListContextItem* __pItemContext; + Tizen::Base::Collection::ArrayList* __pMostVisitedSites; +}; + +#endif //_INT_MAIN_FORM_H_ diff --git a/inc/IntMainFrame.h b/inc/IntMainFrame.h new file mode 100644 index 0000000..f5ee7d3 --- /dev/null +++ b/inc/IntMainFrame.h @@ -0,0 +1,45 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet InternetFrame class +/*@file: InternetFrame.h + *@brief: Internet Frame + */ + +#ifndef _INT_INTERNET_FRAME_H_ +#define _INT_INTERNET_FRAME_H_ + +#include +#include + +class MainFrame + : public Tizen::Ui::Controls::Frame +{ +public: + /** + *@brief Default constructor + */ + MainFrame(void); + /** + *@brief Default destructor + */ + virtual ~MainFrame(void); + virtual result OnInitializing(void); + virtual result OnTerminating(void); +}; + +#endif //_INT_INTERNET_FRAME_H_ diff --git a/inc/IntMultipleWindowForm.h b/inc/IntMultipleWindowForm.h new file mode 100644 index 0000000..fd0d47b --- /dev/null +++ b/inc/IntMultipleWindowForm.h @@ -0,0 +1,160 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntMultipleWindowForm.h + *@brief: The IntMultipleWindowForm provides multiple instance of mainscenes and displays them in a Listview + * + */ + +#ifndef _INT_MULTIPLE_WINDOW_FORM_H_ +#define _INT_MULTIPLE_WINDOW_FORM_H_ + +#include +#include +#include +#include +#include + +class MultipleWindowForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + +{ +public: + /** + *@brief Default constructor + */ + MultipleWindowForm(void); + + /** + *@brief Default destructor + */ + virtual ~MultipleWindowForm(void); + + /** + *@brief Constructing and Initializing MultipleWindowForm + */ + bool Initialize(void); + +public: + /** + *Used to create instances and set styles for the form content. + */ + virtual result OnInitializing(void); + + /** + *Called on terminate of a form + */ + virtual result OnTerminating(void); + + // ISceneEventListener + + /** + *Called after setting as current scene. + */ + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + + /** + *Called when the current scene is deactivated. + */ + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + // IFormBackEventListener + /** + *Called when the current Form control needs to be closed to revert back to the previous Form control. + */ + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + // IActionEventListener + /** + *Called when an action event occurs. + */ + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IListViewItemEventListener + /** + *Called when the state of an element in the ListContextItem is changed. + */ + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state); + + /** + *Called when the state of an element in the ListViewItem in the ListView or GroupedListView is changed. + */ + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + + /** + *Called when the ListItem is swept. + */ + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + + /** + *Called when the item or the element is long pressed. + */ + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + + //IListViewItemProvider + /** + *Called when items need to be loaded. + */ + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + + /** + *Called when items need to be loaded. + */ + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + + /** + *Called when the IconListView is about to be drawn and requests the listener to set the number of total items. + */ + virtual int GetItemCount(void); + + //IOrientationEventListener + /** + *Called when an orientation event occurs. + */ + void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + +private: + static const int IDA_FORMAT_BITMAP = 500; + static const int IDA_FORMAT_DELETE_BITMAP = 501; + static const int IDA_FORMAT_TITLE_STRING = 502; + static const int IDA_FORMAT_URL_STRING = 503; + static const int IDA_BUTTON_NEW = 504; + static const int IDA_BUTTON_BACK = 505; + static const int IDA_BUTTON_CLOSEALL = 506; + static const int IDA_FORMAT_CUSTOM = 507; + + static const int IDA_CONFIRMATION_NO = 1000; + static const int IDA_CONFIRMATION_YES = 1001; + + // __pList Pointer to ListView + Tizen::Ui::Controls::ListView* __pList; + // __pListIconImage Pointer to Bitmap contains list icon image + Tizen::Graphics::Bitmap* __pListIconImage; + // __pListDeleteImage Pointer to Bitmap contains list delete image + Tizen::Graphics::Bitmap* __pListDeleteImage; + ConfirmationPopup* __pConfirmationPopup; + +}; + +#endif /* _INT_MULTIPLE_WINDOW_FORM_H_ */ diff --git a/inc/IntMultipleWindowPresentationModel.h b/inc/IntMultipleWindowPresentationModel.h new file mode 100644 index 0000000..1aefccd --- /dev/null +++ b/inc/IntMultipleWindowPresentationModel.h @@ -0,0 +1,226 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntMultipleWindowPresentationModel.h + *@brief: MultipleWindowPresentationModel is used to maintain browser window information + * + */ +#ifndef _INT_MULTIPLE_WINDOW_PRESENTATION_MODEL_H_ +#define _INT_MULTIPLE_WINDOW_PRESENTATION_MODEL_H_ + +#include +#include +#include +#include + +#include "IntFaviconManager.h" +#include "IntFormFactory.h" +#include "IntSceneRegister.h" + +enum Key +{ + SELECTED_SCENE_ID +}; +class MainForm; + +class WindowInfo +: public Tizen::Base::Object + { + public: + /** + * WindowInfo default constructor + */ + WindowInfo(); + + /** + * WindowInfo default destructor + */ + ~WindowInfo(); + + public: + Tizen::Base::String faviconUrl; + Tizen::Base::String faviconFilePath; + Tizen::Base::String formID; + int ID; + bool isAppcontrolTriggered; + bool isJavascriptInitiated; + Tizen::Base::String pageTitle; + Tizen::Base::String pageUrl; + Tizen::Web::Controls::Web* pCurrentWeb; + Tizen::Graphics::Bitmap* pFavicon; + static Tizen::Graphics::Bitmap* pFormCanvasBitmap; + Tizen::Graphics::Bitmap* pWebCanvasBitmap; + Tizen::Base::String sceneID; + private: + static int __windowId; + }; + +class MultipleWindowPresentationModel +{ +public: + + /** + * This method add the windowInfo object in ArrayList + * + * @return An error code + * @param[in] WindowInfo The windowInfo object to be added. + * @exception E_SUCCESS The method is successful. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @remarks This method performs a shallow copy. It adds just the pointer; not the element itself. + */ + result AddWindoInfo(WindowInfo* pWindowInfo); + + /** + *@name CreateNewMainViewScene + *@brief Create new instance of MainScene form + *@param[in] no input parameter + *@retval no return value + */ + WindowInfo* CreateNewMainViewScene(const Tizen::Base::String& Url = L"", bool isAppControlTriggered = false); + + /** + * To get active Window URL and title + * + * @return An error code + * @param title + * @param url + * @exception E_SUCCESS The method is successful. + */ + WindowInfo* GetActiveWindowInfo(void); + + /** + * This method returns the ArrayList object + * + * @return ArrayList* + * @param[in] void + * @remarks Return the ArrayList object + */ + Tizen::Base::Collection::ArrayList* GetAllWindowArrayList(void); + + /** + * To get current sceneID of Main Form + * + * @return An error code + * @param currentSceneID The Current Scene ID + * @exception E_SUCCESS The method is successful. + */ + void GetCurrentSceneId(Tizen::Base::String& currentSceneId); + + /** + * @brief The method used to get the already created instance of the MultipleWindowPresentationModel + */ + static MultipleWindowPresentationModel* GetInstance(void); + + /** + * Object is returned corresponding to its key value + * + * @return An error code + * @param[in] key The key of the object needed + * @param[in] Object A pointer to a pointer to an objec_t + * @exception E_SUCCESS The method is successful. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @remarks To work properly, existing key has to be passed + */ + result GetValue(Key key, Tizen::Base::Object**); + + /** + * To set current sceneID of Main Form + * + * @return An error code + * @param currentSceneID The Current Scene ID + * @exception E_SUCCESS The method is successful. + */ + void SetCurrentSceneID(const Tizen::Base::String& currentSceneID); + + /** + * Object is set corresponding to its key value + * + * @return An error code + * @param[in] key The key of the object to be set + * @param[in] Object A pointer to an object + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG A specified input parameter is invalid, or + * the comparer has failed to compare the keys. + * @exception E_OBJ_NOT_FOUND The specified @c key is not found in the map. + * @remarks To work properly, existing key and object has to be passed + */ + result SetValue(Key key, Tizen::Base::Object*); + + /** + * Uninitialize MultiWindowManager + * + * @return no return value + * @param[in] no input parameters + */ + void UnInitialize(void); +private: + + /** + * Default constructor, It is declared as private to make this class a singleton class + */ + MultipleWindowPresentationModel(void); + + /** + * Default destructor + */ + virtual ~MultipleWindowPresentationModel(void); + + /** + * copy constructor + */ + MultipleWindowPresentationModel(const MultipleWindowPresentationModel& multipleWindowModelObj); + + /** + * assignment operator + */ + + MultipleWindowPresentationModel& operator=(const MultipleWindowPresentationModel& multipleWindowModelObj); + + /** + * Initializing MultiWindowManager + * + * @return An error code + * @param[in] no input parameters + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG A specified input parameter is invalid, or + * the @c capacity or the @c loadFactor is negative. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + */ + + result Construct(void); + + /** + * @brief The method used to create the instance of the MultipleWindowPresentationModel class + */ + static void CreateInstance(void); + + /** + * @brief The method used to remove the already created instance of the MultipleWindowPresentationModel + */ + static void DestroyInstance(void); + + +private: + static Tizen::Base::String __currentSceneId; + static Tizen::Base::Collection::HashMapT< Key, Tizen::Base::Object* > __keyAndValues; + static Tizen::Base::Collection::ArrayList* __pAllWindowList; + static WindowInfo* __pCurWindowInfo; + static MultipleWindowPresentationModel* __pMultiWindowManager; +}; + +#endif // _INT_MULTIPLE_WINDOW_PRESENTATION_MODEL_H_ diff --git a/inc/IntNotificationPanel.h b/inc/IntNotificationPanel.h new file mode 100644 index 0000000..b5431a9 --- /dev/null +++ b/inc/IntNotificationPanel.h @@ -0,0 +1,81 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/basic features necessary to define an UiApp. +// +// 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. +// + +// !Internet +/*@file: IntNotification.h + *@brief: This header file contains the declarations of the Notification + * + */ + +#ifndef _INT_NOTIFICATION_H_ +#define _INT_NOTIFICATION_H_ + +#include +#include +#include +#include "IntTypes.h" + +class NotificationPanel + : public Tizen::Ui::Controls::Panel + , public Tizen::Base::Runtime::ITimerEventListener + { + public: + /** + * @brief The Default Constructor + */ + NotificationPanel(Tizen::Ui::Controls::Form& aForm); + + /** + * @brief The Default Destructor + */ + ~NotificationPanel(void); + + // ITimerEventListener + void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); + + /** + * This function gets the Sets the __position (FooterPanelheight) + * + * @return No return type. + * @param int position. + */ + void SetPositionDiff(int pos); + + /** + * This function displays the Notification + * + * @return No return type. + * @param none. + */ + void ShowNotification(void); + + /** + * This function gets the Sets the text of the Notification + * + * @return No return type. + * @param message The Notification Message. + */ + void SetText(Tizen::Base::String& message); + + private: + Tizen::Ui::Controls::Form& __form; + Tizen::Ui::Controls::Label* __pLabel; + int __position; + Tizen::Base::Runtime::Timer* __pTimer; + }; + +#endif /* _INT_NOTIFICATION_H_ */ diff --git a/inc/IntPresentationModelBase.h b/inc/IntPresentationModelBase.h new file mode 100644 index 0000000..5b4f12e --- /dev/null +++ b/inc/IntPresentationModelBase.h @@ -0,0 +1,164 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntPresentationModelBase.h + *@brief: This is the header file for PresentationModelBase class + */ + + +#ifndef _INT_PRESENTATION_MODEL_BASE_H_ +#define _INT_PRESENTATION_MODEL_BASE_H_ + +#include +#include +#include + +#include "IntTypes.h" + +/** + * @class PresentationModelBase + * @brief This class declares functions which will manage database + */ +class PresentationModelBase +{ +public: + /** + * Default constructor + */ + PresentationModelBase(void); + + /** + * Default destructor + */ + ~PresentationModelBase(void); + + /** + * Initialize storage service + */ + static result Initialize(void); + + /** + * Deinitialize storage service + */ + static result UnInitialize(void); + +public: + + /** + * This function deletes the database + * + * @return An error code + * @param No parameter + * @exception E_SUCCESS The database closed successfully + * @exception E_FAILURE The database is not closed successfully + */ + static result CloseDb(void); + + static result CommitDb(void); + + /** + * This function creates the table in database + * + * @return An error code + * @param tableType The name of the table + * @exception E_SUCCESS The table is created successfully in database + * @exception E_FAILURE The table creation in database is not successful + */ + static result CreateDBTables(BrowserDbTableTypes tableType); + + /** + * This function drops the existing tables from database + * + * @return An error code + * @param No parameter + * @exception E_SUCCESS The table is dropped successfully from database + * @exception E_FAILURE The table drop is unsuccessful + */ + static result DropDBTables(void); + + static result DbIsNextRowPresent(bool& nextRowpresent); + + /** + * This function drops the existing tables from database + * + * @return An error code + * @param No parameter + * @exception E_SUCCESS The table is dropped successfully from database + * @exception E_FAILURE The table drop is unsuccessful + */ + static result ExecuteQuery(const Tizen::Base::String& pszFormatQuery, int& nRowCount); + + static result GetColumn(int nIndex, Tizen::Base::String& strVal); + + static result GetColumn(int nIndex, int& nIntVal); + + static result GetColumn(int nIndex, double& dblVal); + + static result GetColumn(int nIndex, Tizen::Base::DateTime& dtVal); + + static bool GetCurrentDateTime(Tizen::Base::DateTime& dt); + + /** + * This function gives the last inserted row id + * + * @return An error code + * @param tableName The name of the table + * @param rowId The rowId in which last inserted rowId will be saved. + * @exception E_SUCCESS The method is successful + * @exception E_FAILURE The method is not successful + * @remarks To work properly , the table name should be passed properly + */ + static result GetLastInsertedId(Tizen::Base::String& tableName, int& rowId); + + /** + * This function calls the CreateDBTables function for all the tables + * + * @return An error code + * @param No parameter + */ + static result InitializeDBTables(void); + + static result IsNullColumn(int nIndex, bool& isColumNull); + + /** + * This function creates the database and constructs it. + * + * @return An error code + * @param No parameter + * @exception E_SUCCESS The database created successfully + * @exception E_FAILURE The database creation is failed + */ + static result OpenDb(void); + + static result RollbackDb(void); + +public: + static Tizen::Base::String DB_FILE_PATH; + static const int MAX_DB_QUERY_SIZE; + static const int QUERY_TYPE_LENGTH; + +private: + static bool __isBeginTransaction; + + static Tizen::Io::Database* __pDataBase; + static Tizen::Io::DbEnumerator* __pDbEnum; + static Tizen::Io::DbStatement* __pDbStatement; + +}; + + #endif //_INT_PRESENTATION_MODEL_BASE_H_ diff --git a/inc/IntRadioCustomItem.h b/inc/IntRadioCustomItem.h new file mode 100644 index 0000000..74f48f8 --- /dev/null +++ b/inc/IntRadioCustomItem.h @@ -0,0 +1,114 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet RadioCustomItem class +/*@file: IntRadioCustomItem.h + *@brief: The %IntRadioCustomItem defines radio custom item. + * + */ + +#ifndef _INT_RADIO_CUSTOM_ITEM_H_ +#define _INT_RADIO_CUSTOM_ITEM_H_ + +#include +#include +#include "IntTypes.h" + +class RadioCustomItem + : public Tizen::Ui::Controls::CustomItem +{ +public: + /** + * @brief The Default Constructor + */ + RadioCustomItem(void); + + /** + * @brief The Default Destructor + */ + virtual ~RadioCustomItem(void); + + /** + * @brief Initializes this instance of %DropDownCustomItem. + * + * @return An error code + * @param[in] width The width of the Custom Item + * @param[in] height The height of the Custom Item + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result Construct(int width, int height); + + //getter and setter methods for Text + + /** + * @brief The method used to get the text of CustomItem + * @return An error code + */ + Tizen::Base::String GetText(void); + + /** + * @brief The method used to get selection state of the Radio Button + * @return True if selected or false if unselected + */ + bool GetSelected(void); + + + /** + * @brief Add all the required elements and create the Custom Item. + * + * @return An error code + * @param[in] void An instance of the Rectangle class @n + * This instance represents the x and y coordinates of the top-left corner of the created window along with + * the width and height of the window. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result Make(void); + + /** + * @brief The method used to set the text of CustomItem + * @return An error code + */ + void SetText(Tizen::Base::String& text); + + /** + * @brief The method used to set the selection state of the Radio Button + * @return void + */ + void SetSelected(bool selectedValue); + +protected: + static const int IDA_FORMAT_STRING; + static const int IDA_FORMAT_RADIO_BUTTON; + +private: + bool __isSelected; + int __height; ///Height of the SettingToggleCustomItem Instance + Tizen::Base::String __text; ///The Text for the Toggle Button + int __width; ///Width of the SettingToggleCustomItem Instance +}; + +#endif /* _INT_RADIO_CUSTOM_ITEM_H_ */ diff --git a/inc/IntReaderFontSizeForm.h b/inc/IntReaderFontSizeForm.h new file mode 100644 index 0000000..dc63274 --- /dev/null +++ b/inc/IntReaderFontSizeForm.h @@ -0,0 +1,89 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet IntFontSize class +/*@file: IntFontSize.h + *@brief: This class defines IntFontSize used to change the font size + * + */ + +#ifndef _INT_READER_FONT_SIZE_FORM_H_ +#define _INT_READER_FONT_SIZE_FORM_H_ + +#include +#include + +class ReaderFontSizeForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Scenes::ISceneEventListener + , public Tizen::Ui::Controls::ISliderEventListener +{ +public: + /** + * @brief The Default Constructor + */ + ReaderFontSizeForm(void); + + /** + * @brief The Default Destructor + */ + virtual ~ReaderFontSizeForm(void); + + /** + * @brief Initializes this IntFontSize Form. + * @return An error code + * @param[in] void + * @exception true The method is successful. + * @exception false An error occurred. + */ + bool Initialize(void); + + /** + * @brief Initializes the controls of the UI for IntFontSize. + * + * @return An error code + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result OnInitializing(void); + +protected: + //IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + //ISceenEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + //ISliderEventListener + virtual void OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value); + +private: + Tizen::Ui::Controls::Slider* __pFontSlider; + Tizen::Base::Integer* __pFontValue; +}; + +#endif /* _INT_READER_FONT_SIZE_FORM_H_ */ diff --git a/inc/IntSceneRegister.h b/inc/IntSceneRegister.h new file mode 100644 index 0000000..f9176ba --- /dev/null +++ b/inc/IntSceneRegister.h @@ -0,0 +1,95 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntSceneRegister.h + *@brief: This header file contains the declarations of the %SceneRegister class. + * + */ + +#ifndef _INT_SCENE_REGISTER_H_ +#define _INT_SCENE_REGISTER_H_ + +/// Use 'extern' to eliminate duplicate data allocation. +extern const wchar_t* IDSCN_MAIN_VIEW; +extern const wchar_t* IDSCN_BOOKMARK_VIEW; +extern const wchar_t* IDSCN_HISTORY_LIST; +extern const wchar_t* IDSCN_FIND_WORD; +extern const wchar_t* IDSCN_EDIT_HISTORY_LIST; +extern const wchar_t* IDSCN_SETTINGS_CLEAR_PRIVATE_DATA; +extern const wchar_t* IDSCN_MULTIPLE_WINDOW; +extern const wchar_t* IDSCN_MULTIPLE_WINDOW_GRID; +extern const wchar_t* IDSCN_SETTINGS; +extern const wchar_t* IDSCN_ADD_BOOKMARK; +extern const wchar_t* IDSCN_ARTICLE_READER; +extern const wchar_t* IDSCN_EDIT_BOOKMARK_LIST; +extern const wchar_t* IDSCN_CREATE_BOOKMARK_FOLDER; +extern const wchar_t* IDSCN_FONT_SIZE; +extern const wchar_t* IDSCN_EDIT_HOMEPAGE_VIEW; +extern const wchar_t* IDSCN_BRIGHTNESS; + +class SceneRegister +{ +public: + /** + * Registers all the scenes using Register~SceneRegisterScene() method of the SceneManager class + * + */ + static void RegisterAllScenes(void); + + /** + * Registers New main view scene for multi window + * + * @return no return value + * @param[in] sceneID The sceneID of new view. + * @param[in] formID The formID of new View. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OBJ_ALREADY_EXIST The specified @c sceneId already exists. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_INVALID_STATE This instance has not been constructed as yet. + * @remarks Register the new main view in scenemanager. + */ + static result RegisterNewMainView(const Tizen::Base::String& sceneID, const Tizen::Base::String& FormID); + + /** + * Unregister and destroy the scene + * + * @return An error code + * @param[in] sceneID The sceneID of new view. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OBJ_ALREADY_EXIST The specified @c sceneId already exists. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_INVALID_STATE This instance has not been constructed as yet. + * @remarks Unregister and destroy the scene + */ + static result DestroyAndUnRegisterScene(const Tizen::Base::String& sceneID); + +private: + /** + * Default constructor + */ + SceneRegister(void); + + /** + * Default destructor + */ + ~SceneRegister(void); +}; + +#endif // _INT_SCENE_REGISTER_H_ diff --git a/inc/IntSettingClearPrivateDataForm.h b/inc/IntSettingClearPrivateDataForm.h new file mode 100644 index 0000000..eaa1b73 --- /dev/null +++ b/inc/IntSettingClearPrivateDataForm.h @@ -0,0 +1,212 @@ + +// Copyright 2012 Samsung Electronics Co., Ltd. +// +// 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.SETTINGSCLEARPRIVATEDATAFORM_H_ +// +//!Internet SettingsClearPrivateDataForm class +/*@file: IntSettingsClearPrivateDataForm.h + *@brief: The SettingsClearPrivateDataForm used to create private data scene + * + */ + +#ifndef _INT_SETTINGS_CLEAR_PRIVATE_DATA_FORM_H_ +#define _INT_SETTINGS_CLEAR_PRIVATE_DATA_FORM_H_ + +#include +#include + +using namespace Tizen::Ui; + +class SettingsClearPrivateDataForm + : public Controls::Form + , public IActionEventListener + , public Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + /** + * Default constructor + */ + SettingsClearPrivateDataForm(void); + + /** + * Default destructor + */ + virtual ~SettingsClearPrivateDataForm(void); + + /** + *@name Initialize + *@brief Constructing and Initializing ClearPrivateDataScene + *@param[in] no input parameters + *@retval TRUE Initialize success + *@retval FALSE Initialize failure + * + */ + bool Initialize(void); + + /** + *@name OnInitializing + *@brief Used to create instances and set styles for the form content. + *@param[in] no input parameters + *@retval TRUE Initialize success + *@retval FALSE Initialize failure + */ + virtual result OnInitializing(void); + + /** + *@name OnTerminating + *@brief Called on terminate of a form + *@param[in] no input parameters + *@retval TRUE Terminate success + *@retval FALSE Terminate failure + */ + virtual result OnTerminating(void); + + //IListViewItemProvider + /** + *@name CreateItem + *@brief Called when items need to be loaded. + *@param[in] index The index of the list + *@param[in] itemWidth The width of the element + *@retval no return value + */ + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + + /** + *@name DeleteItem + *@brief Called when items need to be loaded. + *@param[in] index The index of the list + *@param[in] pItem The pointer to the item to be deleted + *@param[in] itemWidth The width of the element + *@retval no return value + */ + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + + /** + *@name GetItemCount + *@brief Called when the IconListView is about to be drawn and requests the listener to set the number of total items. + *@param[in] no input parameter + *@retval no return value + */ + virtual int GetItemCount(void); + + // IActionEventListener + /** + *@name OnActionPerformed + *@brief Called when an action event occurs. + *@param[in] source The source of the event + *@param[in] actionId The information about the action event + *@retval no return value + */ + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IFormBackEventListener + /** + *@name OnSceneDeactivated + *@brief Called when the current Form control needs to be closed to revert back to the previous Form control. + *@param[in] source The source of the event + *@retval no return value + */ + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + // IListViewItemEventListener + /** + *@name OnListViewContextItemStateChanged + *@brief Called when the state of an element in the ListContextItem is changed. + *@param[in] listView The source of the event + *@param[in] index The index of the list + *@param[in] elementId The element ID + *@param[in] state The status of the element + *@retval no return value + */ + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state); + + /** + *@name OnListViewItemStateChanged + *@brief Called when the state of an element in the ListViewItem in the ListView or GroupedListView is changed. + *@param[in] listView The source of the event + *@param[in] index The index of the list + *@param[in] elementId The element ID + *@param[in] status The status of the element + *@retval no return value + */ + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + + /** + *@name OnListViewItemSwept + *@brief Called when the ListItem is swept. + *@param[in] listView The source of the event + *@param[in] index The index of the list + *@param[in] direction The sweep direction + *@retval no return value + */ + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + + /** + *@name OnListViewItemLongPressed + *@brief Called when the item or the element is long pressed. + *@param[in] listView The source of the event + *@param[in] index The index of the list + *@param[in] elementId The element ID + *@param[in] invokeListViewItemCallback Indicates whether to invoke ListView item callback after this method returns + *@retval no return value + */ + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + + //IOrientationEventListener + /** + *@name OnOrientationChanged + *@brief Called when an orientation event occurs. + *@param[in] source The source of the event + *@param[in] orientationStatus The information about the orientation event + *@remarks The orientation changed event is fired on %Control for which orientation mode change has been enabled by calling SetOrientation(). + *@retval no return value + */ + void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + + // ISceneEventListener + /** + *@name OnSceneActivatedN + *@brief Called after setting as current scene. + *@param[in] previousSceneId The scene ID of the deactivated scene + *@param[in] currentSceneId The scene ID of the newly activated scene + *@param[in] IList A pointer to an argument list that is user-specified + *@retval no return value + */ + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + + /** + *@name OnSceneDeactivated + *@brief Called when the current scene is deactivated. + *@param[in] currentSceneId The scene ID of the scene being deactivated + *@param[in] nextSceneId The scene ID of the newly activated scene + *@param[in] IList A pointer to an argument list that is user-specified + *@retval no return value + */ + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + +protected: + static const int IDA_FORMAT_TITLE_STRING; + static const int IDA_BUTTON_DELETE; + static const int IDA_BUTTON_CANCEL; + +private: + int __clearItem; + // __pList Pointer to ListView + Tizen::Ui::Controls::ListView* __pList; +}; + +#endif /* _INT_SETTINGS_CLEAR_PRIVATE_DATA_FORM_H_ */ diff --git a/inc/IntSettingForm.h b/inc/IntSettingForm.h new file mode 100644 index 0000000..6d092cd --- /dev/null +++ b/inc/IntSettingForm.h @@ -0,0 +1,196 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet SettingForm class +/*@file: IntSettingForm.h + *@brief: The %IntSettingForm defines settings. + * + */ + +#ifndef _INT_SETTING_FORM_H_ +#define _INT_SETTING_FORM_H_ + +#include +#include + +#include "IntMultipleWindowPresentationModel.h" +#include "IntConfirmationPopup.h" + +class SettingForm + : public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IGroupedListViewItemEventListener + , public Tizen::Ui::Controls::IGroupedListViewItemProvider + , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::IOrientationEventListener + , public Tizen::Ui::Scenes::ISceneEventListener +{ +public: + /** + * @brief The Default Constructor + */ + SettingForm(void); + + /** + * @brief The Default Destructor + */ + virtual ~SettingForm(void); + + /** + * @brief Initializes this SettingForm Form. + */ + bool Initialize(void); + + /** + * @brief Initializes the controls of the UI for SettingForm. + */ + result OnInitializing(void); + + //IActionEventListener + void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IGroupedListViewItemProvider + Tizen::Ui::Controls::GroupItem* CreateGroupItem(int groupIndex, int itemWidth); + + Tizen::Ui::Controls::ListItemBase* CreateItem(int groupIndex, int itemIndex, int itemWidth); + + bool DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth); + + bool DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + + int GetGroupCount(void); + + int GetItemCount(int groupIndex); + + //IGroupedListViewItemEventListener + void OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status); + + void OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status); + + void OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction); + + //IFormBackEventListener + void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + + //IOrientationEventListener + void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); + + //ISceneEventListener + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + enum + { + SETTING_INVALID = -1, + SETTING_HOMEPAGE_TITLE = 0, + SETTING_CURRENT_PAGE, //1 + SETTING_BLANK_PAGE, //2 + SETTING_MOST_VISITED_SITE, //3 + //SETTING_EMPTY_PAGE, //1 + SETTING_FAVORITE_URL, //4 + SETTING_DEFAULT_VIEW_TITLE, //5 + SETTING_FIT_TO_WIDTH, //6 + SETTING_READABLE, //7 + SETTING_RUN_JAVASCRIPT, //8 + SETTING_DISPLAY_IMAGES, //9 + SETTING_BLOCK_POPUP, //10 + SETTING_CLEAR_CACHE, //11 + SETTING_CLEAR_HISTORY, //12 + SETTING_SHOW_SECURITY_WARNINGS, //13 + SETTING_ACCEPT_COOKIES, //14 + SETTING_CLEAR_COOKIE_DATA, //15 + SETTING_SEARCH_ENGINE_TITLE, //20 + SETTING_SEARCH_ENGINE_YAHOO, //21 + SETTING_SEARCH_ENGINE_NAVER, //22 + SETTING_SEARCH_ENGINE_GOOGLE, //23 + SETTING_RESET_TO_DEFAULT, //24 + SETTING_MAX //25 + + }; + + enum SettingListItemType + { + ITEM_TYPE_NORMAL = 0, + ITEM_TYPE_TOGGLE, + ITEM_TYPE_DROPDOWN, + ITEM_TYPE_RADIO, + }; + + class SettingItemInfo + { + public: + /** + * @brief The Default Constructor + */ + SettingItemInfo(void); + + /** + * @brief The Default Destructor + */ + virtual ~SettingItemInfo(void){}; + + public: + int childCount; //only for ITEM_TYPE_DROPDOWN type items + bool isOpen; //true for opened and false for closed + bool isSelected; //only for ITEM_TYPE_RADIO && ITEM_TYPE_TOGGLE type of items + SettingListItemType itemType; + Tizen::Base::String titleText; + Tizen::Base::String subText; + }; + + int groupCount; + int* pGroupItemCount; + SettingItemInfo settingInfo[SETTING_MAX]; +private: + /** + * @brief Initializes this instance of settings default values. + */ + void InitializeSettingValues(void); + + /** + * @brief Opens a popup to clear cache data. + */ + void ClearCache(void); + + /** + * @brief Opens a popup to clear all the cookies. + */ + void ClearCookie(void); + + /** + * @brief Opens a popup to clear the browser history + */ + void ClearHistory(void); + + /** + * @brief Opens a popup for resetting the default settings. + */ + void ResetToDefault(void); + +private: + Tizen::Base::String __currentURL; + int __fontValue; + ConfirmationPopup* __pConfirmationPopup; + Tizen::Ui::Controls::GroupedListView* __pList; + Tizen::Ui::Controls::Popup* __pResetPopup; + WindowInfo* __pWindowInfo; // Contains window information of current scene + bool __isCurrentPageDisable; + +}; + + +#endif /* _INT_SETTING_FORM_H_ */ diff --git a/inc/IntSettingPresentationModel.h b/inc/IntSettingPresentationModel.h new file mode 100644 index 0000000..e6b146b --- /dev/null +++ b/inc/IntSettingPresentationModel.h @@ -0,0 +1,466 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntSettingsManager.cpp + *@brief: Used to define SettingsManager + */ + +#ifndef _INT_SETTINGS_PRESENTATION_MODEL_H_ +#define _INT_SETTINGS_PRESENTATION_MODEL_H_ + +#include +#include +#include +#include +#include + +#include "IntISettingChangeListener.h" + + +enum SettingValues +{ + REGISTRY_SETTING_INVALID = -1, + REGISTRY_SETTING_HOMEPAGE = 0, + REGISTRY_SETTING_DEFAULT_VIEW, //1 + REGISTRY_SETTING_RUN_JAVASCRIPT, //2 + REGISTRY_SETTING_DISPLAY_IMAGES, //3 + REGISTRY_SETTING_HTML5_VIDEOS, //4 + REGISTRY_SETTING_WORD_WRAPPING, //5 + REGISTRY_SETTING_BLOCK_POPUP, //6 + REGISTRY_SETTING_ACCEPT_COOKIES, //7 + REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD, //8 + REGISTRY_SETTING_SHOW_SECURITY_WARNINGS, //9 + REGISTRY_SETTING_SEARCH_ENGINE, //10 + REGISTRY_SETTING_CASE_SENSITIVE, //11 + REGISTRY_SETTING_RUN_READER, //12 + REGISTRY_SETTING_READER_FONT_SIZE, //13 + REGISTRY_SETTING_FAVORITE_URL_VALUE, //14 + REGISTRY_SETTING_REMEMBER_FORM_DATA, //15 + REGISTRY_SETTING_REMEMBER_PASSWORD, //16 + MAX_REGISTRY_SETTING //17 +}; + +class SettingPresentationModel +{ +public: + + + /** + * @brief The method initializes the registry and the SettingsManager values. + * + * @return An error code + * @param[in] void + * + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result Construct(void); + + /** + * @brief The method used to add a listener to get the setting change events + */ + void AddSettingsEventListener(const ISettingChangeEventListener& pListener); + + + + /** + * @name ClearCache + * @brief The method used to clear the cache of web browser + * @param[in] void + * @return String The Search URL + */ + void ClearCache(void); + + /** + * @name ClearCookie + * @brief The method used to clear the cache of web browser + * @param[in] void + * @return String The Search URL + */ + void ClearCookie(void); + + /** + * @brief The method used to get the default view + * @param[in] void + * @return String The default view value + * + */ + Tizen::Base::String GetDefaultView(void); + + /** + * @brief The method used to get the Favorite URL + * @param[in] void + * @return String The Favorite URL + */ + Tizen::Base::String GetFavoriteUrl(void); + + /** + * @brief The method used to get the already created instance of the SettingPresentationModel + */ + static SettingPresentationModel* GetInstance(void); + + /** + * @brief The method used to set the homepage value + * @param[in] void + * @return String The Homepage Value + */ + Tizen::Base::String GetHomepage(void); + + /** + * @brief The method used to get the value of reader font size + * @param[in] void + * @return int fontSize of reader + */ + int GetReaderFontSize(void); + + /** + * @brief The method used to get the Save Password string value. + * @param[in] void + * @return String The Save Password String + */ + Tizen::Base::String GetSavePassword(void); + + /** + * @brief The method used to get the Search Engine string value. + * @param[in] void + * @return String The Search Engine String + */ + Tizen::Base::String GetSearchEngine(void); + + /** + * @brief The method used to get the Search URL Based on the default search engine value. + * @param[in] void + * @return String The Search URL + */ + Tizen::Base::String GetSearchUrl(const Tizen::Base::String& searchText); + + bool GetPrivateOn(void); + + /** + * @brief The method used to get the Block popup as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsBlockPopUp(void); + + /** + * @brief The method used to get the Cookies Enabled as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsCookiesEnabled(void); + + /** + * @brief The method used to get the case sensitivity as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsCaseSensitiveEnabled(void); + + /** + * @brief The method used to get the Display Images value as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsDisplayImagesEnabled(void); + + /** + * @brief The method used to get the HTML5 Videos as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsHtml5VideosEnabled(void); + + /** + * @brief The method used to get the Remember password Enabled as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsRememberFormData(void); + + /** + * @brief The method used to get the Remember password Enabled as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsRememberPassword(void); + + /** + * @brief The method used to get the Javascript enabled value as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsRunJavascriptEnabled(void); + + /** + * @brief The method used to get the Run Reader as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsRunReaderEnabled(void); + + /** + * @brief The method used to get the Security Warnings as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsSecurityWarningsEnabled(void); + + /** + * @brief The method used to get the Word Wrap as true or false + * @param[in] void + * @return bool true to enable and false for disable + */ + bool IsWordWrapEnabled(void); + + /** + * @brief The method loads the data and the SettingsManager values from the registry. + * + * @return An error code + * @param[in] void + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result LoadRegistry(void); + + /** + * @brief The method used to remove the ISettingsChangeListener + */ + void RemoveSettingsEventListener(ISettingChangeEventListener& pListener); + + /** + * @brief The method resets the registry and the SettingsManager values to default. + * + * @return An error code + * @param[in] void + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result ResetRegistry(void); + + /** + * @brief The method used to set the Default values of settings + */ + void SetDefaultValues(void); + + /** + * @brief The method used to set the default view + * @param[in] String The default view value + * @return void + */ + void SetDefaultView(const Tizen::Base::String& viewLevel); + + /** + * @brief The method used to set the homepage value + * @param[in] String The Homepage Value + * @return void + */ + void SetHomepage(const Tizen::Base::String& homePage); + + /** + * @brief The method used to set the Javascript enabled value to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetRunJavascriptEnabled(bool runJsEnabled); + + /** + * @brief The method used to set the Display Images value to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetDisplayImagesEnabled(bool displayImages); + + /** + * @brief The method used to set the HTML5 Videos to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetHtml5VideosEnabled(bool html5Videos); + + /** + * @brief The method used to set the Word Wrap to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetWordWrapEnabled(bool wordWrap); + + /** + * @brief The method used to set the Block popup to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetBlockPopUp(bool blockPopUp); + + /** + * @brief The method used to set the Cookies Enabled to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetCookiesEnabled(bool cookiesEnabled); + + /** + * @brief The method used to set the Save Password string value. + * @param[in] String The Save Password String + * @return void + */ + void SetSavePassword(const Tizen::Base::String& savePassword); + + /** + * @brief The method used to set Remember form data to true or false + * @param[in] bool true to enable false for disable + * @return void + */ + void SetRememberFormData(bool rememberFormData); + + /** + * @brief The method used to set Remember password to true or false + * @param[in] bool true to enable false for disable + * @return void + */ + void SetRememberPassword(bool rememberPassword); + + /** + * @brief The method used to enabling the Security Warnings to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetSecurityWarningsEnabled(bool securityWarnings); + + /** + * @brief The method used to set the Default Search Engine. + * @param[in] String The Search Engine String + * @return void + */ + void SetSearchEngine(const Tizen::Base::String& searchEngine); + + + + void SetCaseSensitiveEnabled(bool caseSensitive); + + /** + * @brief The method used to enabling the Reader to true or false + * @param[in] bool true to enable and false for disable + * @return void + */ + void SetRunReaderEnabled(bool runReader); + + /** + * @brief The method used to set the value of reader font size + * @param[in] int fontSize of reader + * @return void + */ + void SetReaderFontSize(int fontSize); + + /** + * @name GetWebSettings + * @brief The method used to get web browser settings + * @param[in] void + * @return WebSetting The Settings of web browser + */ + Tizen::Web::Controls::WebSetting& GetWebSettings(void); + + /** + * @name SetFavoriteValue + * @brief The method used to set favourite URL for web browser + * @param[in] val favorite value to set + * @return An error code + * @exception E_INVALID_ARG The length of the specified string for a section or entry is smaller than or equal to @c 0, or the specified string is a @c null value or string with '\0' and '\n'. + * @exception E_KEY_NOT_FOUND The specified key is not used in the application preferences. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_KEY_ALREADY_EXIST The key has already been used in the application preferences. + * @exception E_SUCCESS The method is successful. + */ + result SetFavoriteValue(const Tizen::Base::String& val); + + void SetPrivateOn(bool isPrivateOn); + +private: + /** + * @brief The Default Constructor + */ + SettingPresentationModel(void); + + /** + * @brief The Default Destructor + */ + ~SettingPresentationModel(void); + + /** + * copy constructor + */ + SettingPresentationModel(const SettingPresentationModel& settingModelObj); + + /** + * @brief The method used to create the instance of the SettingsManager class + */ + static void CreateInstance(void); + + /** + * @brief The method used to remove the already created instance of the SettingsManager + */ + static void DestroyInstance(void); + /** + * assignment operator + */ + SettingPresentationModel& operator=(const SettingPresentationModel& settingModelObj); + + result SetValue(const int settingValueName, const Tizen::Base::String& val); + +private: + static SettingPresentationModel* __pSettingsPresentationModel; + + Tizen::Base::Collection::ArrayList __listenerList; + Tizen::Base::String __homePage; + Tizen::Base::String __defaultViewLevel; + Tizen::Base::String __favouriteURL; + bool __runJsEnabled; + bool __displayImages; + bool __html5Videos; + bool __wordWrap; + bool __blockPopUp; + bool __rememberFormData; + bool __rememberPassword; + bool __cookies; + Tizen::Base::String __savePassword; + bool __securityWarnings; + Tizen::Base::String __searchEngine; + bool __caseSensitive; + bool __runReader; + int __fontSize; + bool __isPrivateOn; + Tizen::Web::Controls::WebSetting __setting; + + // Tizen::Io::Registry* __pRegistry; + Tizen::Base::String __entry[MAX_REGISTRY_SETTING]; + Tizen::Base::String __values[MAX_REGISTRY_SETTING]; +}; + +#endif // _INT_SETTINGS_PRESENTATION_MODEL_H_ diff --git a/inc/IntSettingToggleCustomItem.h b/inc/IntSettingToggleCustomItem.h new file mode 100644 index 0000000..afd2535 --- /dev/null +++ b/inc/IntSettingToggleCustomItem.h @@ -0,0 +1,103 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet SettingToggleCustomItem class +/*@file: SettingToggleCustomItem.h + *@brief: The SettingToggleCustomItem used to toggle the item. + * + */ + +#ifndef _INT_SETTING_TOGGLE_CUSTOM_ITEM_H_ +#define _INT_SETTING_TOGGLE_CUSTOM_ITEM_H_ + +#include +#include +#include "IntTypes.h" + +class SettingToggleCustomItem + : public Tizen::Ui::Controls::CustomItem +{ + +public: + /** + * @brief The Default constructor + */ + SettingToggleCustomItem(void); + + /** + * @brief The Default destructor + */ + virtual ~SettingToggleCustomItem(void); + + /** + * @brief Initializes this instance of %DropDownCustomItem. + * + * @return An error code + * @param[in] void An instance of the Rectangle class @n + * This instance represents the x and y coordinates of the top-left corner of the created window along with + * the width and height of the window. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result Construct(int width, int height); + + //getter and setter methods for __text + + /** + * @brief The method used to get the text of CustomItem + * + * @return A String + */ + Tizen::Base::String GetText(void); + + /** + * @brief Add all the required elements and create the Custom Item. + * + * @return An error code + * @param[in] void An instance of the Rectangle class @n + * This instance represents the x and y coordinates of the top-left corner of the created window along with + * the width and height of the window. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance has already been constructed. + * @exception E_INVALID_ARG A specified input parameter is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @exception E_SYSTEM A system error has occurred. + * + */ + result Make(void); + + /** + * @brief The method used to set the text of CustomItem + */ + + void SetText(Tizen::Base::String& text); + + + +private: + int __height; ///Height of the SettingToggleCustomItem Instance + int __width; ///Width of the SettingToggleCustomItem Instance + + Tizen::Base::String __text; ///The Text for the Toggle Button + +}; + +#endif /* _INT_SETTING_TOGGLE_CUSTOM_ITEM_H_ */ diff --git a/inc/IntSharePopup.h b/inc/IntSharePopup.h new file mode 100644 index 0000000..bdca853 --- /dev/null +++ b/inc/IntSharePopup.h @@ -0,0 +1,169 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: IntSharePopUp.h + *@brief: This header file contains the declarations of the SharePopup + * + */ + +#ifndef INTSHAREPOPUP_H_ +#define INTSHAREPOPUP_H_ + +#include +#include +#include + +class ShareInfo : public Tizen::Base::Object +{ +public: + /** + * @brief The Default constructor + */ + ShareInfo(void); + + /** + * @brief The Default destructor + */ + ~ShareInfo(void); + + /** + * @brief The method used to get the Page title + * @param[in] void + * @return String The Page title + */ + Tizen::Base::String GetPageTitle(void); + + /** + * @brief The method used to get the Page URL + * @param[in] void + * @return String The Page URL + */ + Tizen::Base::String GetPageURL(void); + + /** + * @brief The method used to set the Page title + * @param[in] aPageTitle + */ + void SetPageTitle(Tizen::Base::String aPageTitle); + + /** + * @brief The method used to set the Page URL + * @param[in] aPageURL + */ + void SetPageUrl(Tizen::Base::String aPageURL); + + void SetImageAttached(bool imageAttached); + + bool GetImageAttached(); + + void SetImagePath(Tizen::Base::String aImagePath); + + Tizen::Base::String GetImagePath(void); +private: + Tizen::Base::String __pageTitle; + Tizen::Base::String __pageURL; + Tizen::Base::String __imagePath; + bool isImageAttached; +}; + +class SharePopup + : public Tizen::App::IAppControlEventListener + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Controls::Popup + , public Tizen::Ui::IActionEventListener + { + public: + /** + * @brief The Default Constructor + */ + SharePopup(void); + + /** + * @brief The Default Destructor + */ + ~SharePopup(void); + + /** + * @brief Initializes this SettingForm Form. + * + * @return An error code + * @exception true The method is succeIOrientationEventListenerssful. + * @exception false An error Occured. + */ + bool Initialize(void); + + virtual result OnTerminating(void); + + /** + * This function adds the share info object in the array list + * + * @return An Error Code + * @param An Object of ShareInfo. + */ + result AddShareInfo(ShareInfo* pShareInfo); + + void RemoveAllShareInfo(); + + //IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IAppControlListener + void OnAppControlCompleted(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::Collection::IList* pResultList); + + //IListViewItemProvider + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + virtual int GetItemCount(void); + + // IListViewItemEventListener + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state); + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + + /** + * This function displays the Notification + * + * @return No return type. + * @param none. + */ + void StartMessageAppControl(void); + + /** + * This function Starts the EmailApp Control + * + * @return No return type. + * @param none. + */ + void StartEmailAppControl(void); + + + protected: + static const int IDA_CANCEL_BUTTON; + static const int ID_FORMAT_MESSAGE_STRING; + static const int ID_FORMAT_EMAIL_STRING; + static const int ID_FORMAT_FACEBOOK_STRING; + static const int ID_FORMAT_TWITTER_STRING; + + private: + Tizen::Ui::Controls::ListView* __pList; + Tizen::Base::Collection::ArrayList* __pShareList; + }; + +#endif /* INTSHAREPOPUP_H_ */ diff --git a/inc/IntSharePopup.h.bak b/inc/IntSharePopup.h.bak new file mode 100644 index 0000000..bc7ebc0 --- /dev/null +++ b/inc/IntSharePopup.h.bak @@ -0,0 +1,158 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: IntSharePopUp.h + *@brief: This header file contains the declarations of the SharePopup + * + */ + +#ifndef INTSHAREPOPUP_H_ +#define INTSHAREPOPUP_H_ + +#include +#include +#include + +class ShareInfo : public Tizen::Base::Object +{ +public: + /** + * @brief The Default constructor + */ + ShareInfo(void); + + /** + * @brief The Default destructor + */ + ~ShareInfo(void); + + /** + * @brief The method used to get the Page title + * @param[in] void + * @return String The Page title + */ + Tizen::Base::String GetPageTitle(void); + + /** + * @brief The method used to get the Page URL + * @param[in] void + * @return String The Page URL + */ + Tizen::Base::String GetPageURL(void); + + /** + * @brief The method used to set the Page title + * @param[in] aPageTitle + */ + void SetPageTitle(Tizen::Base::String aPageTitle); + + /** + * @brief The method used to set the Page URL + * @param[in] aPageURL + */ + void SetPageUrl(Tizen::Base::String aPageURL); + +private: + Tizen::Base::String __pageTitle; + Tizen::Base::String __pageURL; +}; + +class SharePopup + : public Tizen::App::IAppControlEventListener + , public Tizen::Ui::Controls::IListViewItemEventListener + , public Tizen::Ui::Controls::IListViewItemProvider + , public Tizen::Ui::Controls::Popup + , public Tizen::Ui::IActionEventListener + { + public: + /** + * @brief The Default Constructor + */ + SharePopup(void); + + /** + * @brief The Default Destructor + */ + ~SharePopup(void); + + /** + * @brief Initializes this SettingForm Form. + * + * @return An error code + * @exception true The method is succeIOrientationEventListenerssful. + * @exception false An error Occured. + */ + bool Initialize(void); + + virtual result OnTerminating(void); + + /** + * This function adds the share info object in the array list + * + * @return An Error Code + * @param An Object of ShareInfo. + */ + result AddShareInfo(ShareInfo* pShareInfo); + + //IActionEventListener + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + // IAppControlListener + void OnAppControlCompleted(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::Collection::IList* pResultList); + + //IListViewItemProvider + virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); + virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); + virtual int GetItemCount(void); + + // IListViewItemEventListener + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state); + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + + /** + * This function displays the Notification + * + * @return No return type. + * @param none. + */ + void StartMessageAppControl(void); + + /** + * This function Starts the EmailApp Control + * + * @return No return type. + * @param none. + */ + void StartEmailAppControl(void); + + + protected: + static const int IDA_CANCEL_BUTTON; + static const int ID_FORMAT_MESSAGE_STRING; + static const int ID_FORMAT_EMAIL_STRING; + static const int ID_FORMAT_FACEBOOK_STRING; + static const int ID_FORMAT_TWITTER_STRING; + + private: + Tizen::Ui::Controls::ListView* __pList; + Tizen::Base::Collection::ArrayList* __pShareList; + }; + +#endif /* INTSHAREPOPUP_H_ */ diff --git a/inc/IntTypes.h b/inc/IntTypes.h new file mode 100644 index 0000000..403cc14 --- /dev/null +++ b/inc/IntTypes.h @@ -0,0 +1,66 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntTypes.h + *@brief: This is the header file for TableType + */ +#ifndef _INT_TYPES_H +#define _INT_TYPES_H + +#include + +static const int NB_DB_PRIMARY_KEY = -1; +static const int MAX_NB_DB_ID_LEN = 100; +static const int MAX_NB_DB_TITLE_LEN = 100000; +static const int MAX_NB_DB_CONTENT_LEN = 100000; + +static const int MAX_NOTE_TABLE_COLUMN = 10; +static const int MAX_NOTEBOOK_TABLE_COLUMN = 8; + +static const int IDA_BUTTON_NO = 1000; +static const int IDA_BUTTON_YES = 1001; + +static const unsigned int CUSTOM_COLOR_GREY = Tizen::Graphics::Color32<124,124,124>::Value; +static const unsigned int CUSTOM_COLOR_TRANSPARENT = Tizen::Graphics::Color32<0,0,0>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_LISTVIEW = Tizen::Graphics::Color32<236,240,242>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_LISTVIEW_PRESSED_HIGHLIGHTED = Tizen::Graphics::Color32<42, 137, 194>::Value; +static const unsigned int CUSTOM_COLOR_LISTVIEW_TEXT = Tizen::Graphics::Color32<249,249,249>::Value; +static const unsigned int CUSTOM_COLOR_BROWN = Tizen::Graphics::Color32<32, 32, 32>::Value; +static const unsigned int CUSTOM_COLOR_INFO_LABEL = Tizen::Graphics::Color32<68, 68, 68>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_PREVIEW_PANEL = Tizen::Graphics::Color32<81,81,81>::Value; +static const unsigned int CUSTOM_BACKGROUND_COLOR_PREVIEW_PANEL_INACTIVE = Tizen::Graphics::Color32<0,0,0,20>::Value; +static const unsigned int CUSTOM_COLOR_PREVIEW_PANEL_PRESSED_RECTANGLE = Tizen::Graphics::Color32<7,180,211>::Value; +static const unsigned int CUSTOM_COLOR_LISTVIEW_TEXT2 = Tizen::Graphics::Color32<70,70,70>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_TEXT = Tizen::Graphics::Color32<128, 128, 128>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND = Tizen::Graphics::Color32<248, 246, 239>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND = Tizen::Graphics::Color32<220, 218, 211>::Value; +static const unsigned int CUSTOM_COLOR_SETTINGS_GROUPTITLE = Tizen::Graphics::Color32<59, 115, 182>::Value; + +enum BrowserDbTableTypes +{ + DB_TYPE_INVALID = -1, + DB_TYPE_BOOKMARKURLS, + DB_TYPE_BOOKMARKFOLDERS, + DB_TYPE_HISTORYDATA, + DB_TYPE_FAVICON, + DB_TYPE_MAX +}; + + +#endif // _INT_TYPES_H + diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 0000000..6ba411b --- /dev/null +++ b/manifest.xml @@ -0,0 +1,157 @@ + + + kmcele1k0n + 1.0.0 + C++App + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + x86 + vfpv3 + + + 2.0 + + http://tizen.org/privilege/web.privacy + http://tizen.org/privilege/web.service + http://tizen.org/privilege/alarm + http://tizen.org/privilege/application.launch + http://tizen.org/privilege/power + http://tizen.org/privilege/content.write + + + + + + Internet-Ref + 网络-Ref + ინტერნეტი-Ref + Internet-Ref + Браузер-Ref + Internet-Ref + Internet-Ref + Internetið-Ref + Internet-Ref + Internet-Ref + Internetas-Ref + Internet-Ref + Internet-Ref + Интернет-Ref + 瀏覽器-Ref + Internet-Ref + Internet-Ref + Ինտերնետ-Ref + Internet-Ref + Internet-Ref + الإنترنت-Ref + Internet-Ref + Internet-Ref + İnternet-Ref + Интернет-Ref + Internet-Ref + Шолушы-Ref + Internet-Ref + 互联网-Ref + Internet-Ref + Internet-Ref + Internet-Ref + Internet-Ref + इंटरनेट-Ref + Internet-Ref + Internet-Ref + Internet-Ref + Internet-Ref + Internet-Ref + Интернет-Ref + 網際網路-Ref + インターネット-Ref + Internet-Ref + 인터넷-Ref + Internet-Ref + Internett-Ref + Internet-Ref + Internet-Ref + an tIdirlíon-Ref + Internets-Ref + Internet-Ref + + + mainmenu.png + + + + http://tizen.org/appcontrol/operation/view + file + http + https + javascript + + + application/xml + image/svg+xml + text/html + http://tizen.org/appcontrol/operation/view + + + + + On + On + Off + On + + + + diff --git a/packaging/apps.Internet.spec b/packaging/apps.Internet.spec new file mode 100755 index 0000000..b8e7917 --- /dev/null +++ b/packaging/apps.Internet.spec @@ -0,0 +1,61 @@ +Name: apps.Internet +Summary: Internet application +Version: 1.0.0.0 +Release: 1 +Group: TO_BE/FILLED_IN +License: TO BE FILLED IN +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(osp-content) +BuildRequires: pkgconfig(osp-appfw) +BuildRequires: osp-appfw-internal-devel +BuildRequires: pkgconfig(osp-uifw) +BuildRequires: osp-uifw-internal-devel +BuildRequires: pkgconfig(osp-media) +BuildRequires: osp-media-internal-devel +BuildRequires: pkgconfig(osp-image) +BuildRequires: osp-image-internal-devel +BuildRequires: pkgconfig(osp-net) +BuildRequires: osp-net-internal-devel +BuildRequires: pkgconfig(osp-json) +BuildRequires: pkgconfig(osp-web) +BuildRequires: pkgconfig(osp-image-core) +BuildRequires: pkgconfig(osp-locations) + +%description +Verification application: Internet + +%prep +%setup -q + +%build +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%ifarch %{ix86} +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%else +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%endif + +# Call make instruction with smp support +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post +/sbin/ldconfig +PKG_ID=kmcele1k0n +echo "/usr/etc/package-manager/backend/tpk -i /usr/apps/"${PKG_ID} +/usr/etc/package-manager/backend/tpk -i /usr/apps/${PKG_ID} +cp -f /usr/lib/osp/osp-ui-app-loader /usr/apps/${PKG_ID}/bin/Internet + +%postun +/sbin/ldconfig +PKG_ID=kmcele1k0n +echo "/usr/etc/package-manager/backend/tpk -u "${PKG_ID} +/usr/etc/package-manager/backend/tpk -u ${PKG_ID} + +%files +%defattr(-,root,root,-) +/usr/apps/* diff --git a/res/.workflow b/res/.workflow new file mode 100644 index 0000000..b7228a4 Binary files /dev/null and b/res/.workflow differ diff --git a/res/ara-AE.xml b/res/ara-AE.xml new file mode 100644 index 0000000..3320e7f --- /dev/null +++ b/res/ara-AE.xml @@ -0,0 +1,134 @@ + + + + اختيار الكل + 11 + المواقع الأكثر زيارة + Close all + إغلاق + حجم الخط + 12 + العلامة موجودة بالفعل + قبول ملفات تعريف الارتباط + هل تريد حذف محفوظات المستعرض؟ + هل تريد حذف المحتوى المخزن محليا وقواعد البيانات؟ + مسح كافة بيانات ملفات الارتباط + إثنـ + لا + إلغاء + مشاركة عبر Twitter + آخر شهر + سبت + تمت إضافة إشارة مرجعية + أضف للعلامات + اسأل دائما + صفحة فارغة + 06 + تلقائي + 07 + نسخ + تذكر كلمات المرور + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + بيانات النموذج + 04 + Edit Folder + 05 + البحث في الصفحة + نسخ الصورة + تم المسح + 03 + Yahoo + محرك البحث + بحث + مشاركة + ابحث عن عنوان URL أو أدخله + No Recently Visited Sites. + مشاركة صورة + مسح + هل تريد حذف كافة ملفات تعريف الارتباط؟ + لا يوجد علامات + أربـ + لا توجد محفوظات + 01 + إعدادات موقع الويب + الخصوصية والأمان + تمت + الإطار المتعدد + Earlier this month + ملفات تعريف الارتباط + العرض الافتراضي + 09 + كلمة المرور + 08 + إعدادات محتوى الصفحة + مقروء + مسح كلمات المرور + لصق + حفظ الصورة + Naver + تذكر بيانات النموذج + تعديل + الإنترنت + عرض الصور + اليوم + تحديد كلمة + أمس + العنوان + صفحة المستخدم الرئيسية + ملائمة للعرض + محدد + السطوع + الضبط + مسح الذاكرة المؤقتة + about: blank + إنشاء مجلد + العلامات + عرض الصور + مشاركة عبر البريد الإلكتروني + تشغيل JAVAscript + إعادة الضبط إلى الافتراضي + أدخل اسم الإشارة المرجعية + الموقع + الأسبوع الأخير + مشاركة عبر Facebook + المجلد + مجلد جديد + تمت إزالة العلامة + Reset all settings to default? + حفظ + إطار جديد + تمكين الموقع + إضافة + جمعة + منع الإطارات المنبثقة + نعم + الموقع + الخصوصية + إلغاء إمكانية الوصول إلى الموقع + منذ %d أسبوع + علامة + عنوان غير صحيح + No History \nAfter you load pages, the history will be shown. + المحفوظات + أحد + عرض تحذيرات الأمان + تعديل العلامة + الصفحة الحالية + مشاركة عبر الرسائل + الصفحة الرئيسية + يدوي + مسح بيانات النموذج + ثلا + 10 + خميس + لا توجد نتائج + مسح السجل + 02 + Failed to save Image + diff --git a/res/aze-AZ.xml b/res/aze-AZ.xml new file mode 100644 index 0000000..eb85330 --- /dev/null +++ b/res/aze-AZ.xml @@ -0,0 +1,134 @@ + + + + Hamısını seç + Noy. + Ən çox daxil olunan saytlar + Close all + Bağla + Şriftin ölçüsü + Dek + Əlfəcin artıq mövcuddur + Kukiləri qəbul edin + Brauzer tarixçəsi silinsin? + Lokal keş məzmunu və məlumat bazaları təmizlənsin? + Bütün kuki məlumatlarını silin + B.e + Xeyr + Ləğv et + Twitter ilə paylaş + Keçən ay + Şən + Əlfəcin əlavə edildi + Nişanlara əlavə et + Həmişə soruş + Boş səhifə + İyun + Avtomatik + İyul + Köçür + Parolları yadda saxlayın + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Forma məlumatları + Apr. + Edit Folder + May + Səhifədə tapın + Şəkli köçür + Silindi + Mart + Yahoo + Axtarış mexanizmi + Axtarış + Paylaş + Axtar və ya URL daxil et + No Recently Visited Sites. + Şəkil paylaş + Sil + Bütün kukilər silinsin? + Nişanlar yoxdur + Çərş. + Tarixçə yoxdur + Yan. + Vebsayt parametrləri + Məxfilik və təhlükəsizlik + Bitdi + Çoxpəncərəli + Earlier this month + Kukilər + Standart görünüş + Sent + Şifrə + Avq + Səhifə məzmunu parametrləri + Oxuna bilən + Parolları silin + Yapışdır + Təsviri yaddaşa yaz + Naver + Forma məlumatını xatırlayın + Redaktə et + Internet + Displey təsvirləri + Bu gün + Sözü seçin + Dünən + Başlıq + İstifadəçinin baş səhifəsi + Eninə uyğunlaşdırın + Seçilmişi + Parlaqlıq + Parametrlər + Keşi təmizlə + about: blank + Qovluq yaradın + Çevik keçidlər + Şəkil göstərlsn + E-poçtla paylaş + JavaScript-i işə sal + İlkin parametrə təyin et + Əlfəcin adını daxil edin + Yeri + Keçən həftə + Facebook ilə paylaş + Qovluq + Yeni qovluq + Əlfəcin silindi + Reset all settings to default? + Yaddaşa yaz + Yeni pəncərə + Məkanı aktivləşdir + Əlavə et + Cümə + Peyda olan menyuları blokla + Bəli + URL + Gizlilik + Məkana girişi sil + %d həftə əvvəl + Çevik keçid silindi + Yanlış ünvan + No History \nAfter you load pages, the history will be shown. + Tarix + Baz + Təhlükəsizlik xəbərdarlıqlarını göstərin + Nişanı redaktə et + Cari səhifə + Mesajlar ilə paylaş + Ana səhifə + Ələ işlət + Forma məlumatlarını silin + Ç.A. + Okt + C.A. + Heç bir nəticə tapılmamışdır + Tarixçəni sil + Fev. + Failed to save Image` + diff --git a/res/bul-BG.xml b/res/bul-BG.xml new file mode 100644 index 0000000..1824e62 --- /dev/null +++ b/res/bul-BG.xml @@ -0,0 +1,134 @@ + + + + Избери всички + Ное + Най-посещавани сайтове + Close all + Затваряне + Размер на шрифта + Дек. + Показалецът вече съществува + Приемане на бисквитки + Изтриване на хронологията на браузъра? + Изтриване на локално кешираното съдържание и бази данни? + Изчистване на всички данни от бисквитки + Пон + Не + Отмени + Споделяне чрез Twitter + Последен месец + Съб + Добавен е маркер + Добави към маркери + Винаги питай + Празна страница + Юни + Авто + Юли + Копиране + Запомняне на паролите + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Данни за формуляра + Апр. + Edit Folder + Май + Търсене в стр. + Копиране на изображение + Изтрито + Март + Yahoo + Търсачка + Търси + Споделям + Потърсете или въведете URL + No Recently Visited Sites. + Сподели образ + Изтрий + Желаете ли да изтриете всички cookies? + Няма показалци + Ср + Няма хронологии + Ян + Настройки на уеб сайт + Поверителност и защита + Готово + Множ. прозорец + Earlier this month + Бисквитки + Изглед по подразбиране + Сеп. + Парола + Авг. + Настр.съдържание страници + Четима + Изчисти паролите + Поставяне + Запис на изображение + Naver + Запомняне на данни за формуляри + Редактиране + Интернет + Покажи изображения + Днес + Избор на дума + Вчера + Заглавие + Потребителска начална страница + Побиране в ширината + Избрани + Яркост + Настройки + Изчистване на кеша / Изчисти кеша + about: blank + Създай папка + Показалци + Покажи изображ. + Споделяне през email + Изпълнение на JavaScript + Нулиране до стойности по подразбиране + Въведете име на показалец + Позиция + Последна седмица + Споделяне чрез Facebook + Папка + Ръчно + Показалецът е премахнат + Reset all settings to default? + Запази + Нов прозорец + Активиране на местоположение + Добави + Пет + Блокирай изскачащи прозорци + Да + URL + Поверителност + Изчистване на достъпа до местоположения + преди %d седмици + Показалец + Невалиден адрес + No History \nAfter you load pages, the history will be shown. + Хронология + Нед + Показване на предупрежденията за защита + Редактиране на показалец + Текуща страница + Споделяне чрез Съобщения + Начална страница + Ръчно + Изчистване на данни за формуляри + Вт + Окт. + Чтв + Няма намерени резултати + Изтриване на хронология + Фев. + Failed to save Image + diff --git a/res/cat-ES.xml b/res/cat-ES.xml new file mode 100644 index 0000000..f7acc0e --- /dev/null +++ b/res/cat-ES.xml @@ -0,0 +1,134 @@ + + + + Seleccioni-ho tot + Nov. + Llocs més visitats + Close all + Tancar + Mida de font + Des. + Ja existeix el preferit + Acceptar cookies + Esborrar historial de navegació? + Esborrar les bases de dades i el contingut en memòria cau local? + Esborrar totes les dades de cookies + Dl. + No + Cancel·lar + Compartir mitjançant Twitter + Mes passat + Ds. + Preferit afegit + Afegir a Preferits + Preguntar sempre + Pàgina buida + Juny + Auto + Jul. + Copiar + Recordar contrasenyes + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Dades del formulari + Abr. + Edit Folder + Maig + Cercar a pàgina + Copiar la imatge + Esborrat + Mar. + Yahoo + Cercador + Cercar + Compartir + Cerqui o introdueixi URL + No Recently Visited Sites. + Comp imatge + Esborrar + Eliminar totes les cookies? + No hi ha preferits + Dc. + Sense historials + Gen. + Ajustaments de lloc web + Privadesa i seguretat + Finalit. + Finestr múltip + Earlier this month + Cookies + Vista predeterminada + Set. + Contrasenya + Ago. + Ajustam contingut pàgina + Llegible + Esborrar contrasenyes + Enganxar + Desar imatge + Naver + Recordar dades de formularis + Editar + Internet + Mostrar imatges + Avui + Seleccionar paraula + Ahir + Títol + Pàgina d'inici d'usuari + Adaptar a l'amplada + Seleccionat + Brillantor + Ajustaments + Esborrar memòria cau + about: blank + Crear carpeta + Preferits + Veure imatge + Compartir amb correu electrònic + Executar JavaScript + Restablir a predeterminat + Introdueixi el nom del preferit + Ubicació + Setmana passada + Compartir mitjançant Facebook + Carpeta + Carpeta nova + Preferit eliminat + Reset all settings to default? + Desar + Finestra nova + Habilitar ubicació + Afegir + Dv. + Bloquejar finestres emergents + Sí + URL + Confidencialitat + Esborrar accés d'ubicació + fa %d setmanes + Preferit + Adreça no vàlida + No History \nAfter you load pages, the history will be shown. + Historial + Dg. + Mostrar advertiments de seguretat + Editar preferit + Pàgina actual + Compartir mitjançant Missatges + Pàgina d'inici + Manual + Esborrar dades de formularis + Dm. + Oct. + Dj. + No s'han trobat resultats + Esborrar historial + Feb. + Failed to save Image + diff --git a/res/ces-CZ.xml b/res/ces-CZ.xml new file mode 100644 index 0000000..28c2e95 --- /dev/null +++ b/res/ces-CZ.xml @@ -0,0 +1,134 @@ + + + + Vybrat vše + Lis + Nejnavštěvovanější stránky + Close all + Zavřít + Velikost písma + Pro + Záložka již existuje + Povolit cookies + Odstranit historii prohlížeče? + Odstranit obsah a databáze uložené v místní paměti? + Vymazat všechna data cookie + Po + Ne + Zrušit + Sdílet prostřednictvím Twitteru + Poslední měsíc + So + Záložka přidána + Přidat záložku + Vždy zobrazit dotaz + Prázdná stránka + Čer + Automaticky + Čvc + Kopírovat + Zapamatovat hesla + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Data formuláře + Dub + Edit Folder + Kvě + Najít na str. + Kopírovat obrázek + Odstraněno + Bře + Yahoo + Vyhledávač + Hledat + Sdílet + Vyhledejte nebo zadejte adresu URL + No Recently Visited Sites. + Sdílet obr. + Odstr + Odstranit všechny soubory cookie? + Žádné záložky + St + Žádná historie + Led + Nastavení webového serveru + Ochrana osobních údajů a zabezpečení + Hotovo + Více oken + Earlier this month + Soubory cookie + Výchozí zobrazení + Zář + Heslo + Srp + Nastavení obsahu stránky + Čitelný + Vymazat hesla + Vložit + Uložit obrázek + Naver + Zapamatovat data formuláře + Upravit + Internet + Zobrazit obrázky + Dnes + Vybrat slovo + Včera + Název + Domovská stránka uživatele + Přizpůsobit na šířku + Vybráno + Jas + Nastavení + Vyprázdnit vyrovnávací paměť + about: blank + Vytvořit složku + Záložky + Zobr. obrázek + Sdílet pomocí e-mailu + Spustit JavaScript + Obnovit výchozí nastavení + Zadejte název záložky + Místo + Poslední týden + Sdílet prostřednictvím Facebooku + Složka + Nová složka + Záložka byla odebrána + Reset all settings to default? + Uložit + Nové okno + Povolit informace o poloze + Přidat + Pá + Blokovat autom. otevíraná okna + Ano + URL + Soukromí + Zrušit přístup k informacím o poloze + Před %d týdny + Záložka + Neplatná adresa + No History \nAfter you load pages, the history will be shown. + Historie + Ne + Zobrazit upozornění zabezpečení + Upravit záložku + Aktuální stránka + Sdílet pomocí Zpráv + Domovská stránka + Ručně + Vymazat data formuláře + Út + Říj + Čt + Nebylo nic nalezeno + Smazat historii + Úno + Failed to save Image + diff --git a/res/dan-DK.xml b/res/dan-DK.xml new file mode 100644 index 0000000..794514b --- /dev/null +++ b/res/dan-DK.xml @@ -0,0 +1,134 @@ + + + + Vælg alle + Nov + Mest besøgte steder + Close all + Luk + Skriftstørrelse + Dec + Bogmærke findes allerede + Acceptér cookies + Slet browseroversigt? + Slet lokalt gemt indhold og databaser? + Tøm alle cookie data + Man + Nej + Annullér + Del via Twitter + Sidste måned + Lør + Bogmærke tilføjet + Føj til Bogmærker + Spørg altid + Tom side + Jun + Auto + Jul. + Kopiér + Husk adgangskoder + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Formulardata + Apr + Edit Folder + Maj + Find på side + Kopiér billede + Slettet + Mar + Yahoo + Søgemaskine + Søg + Del + Søg eller angiv URL + No Recently Visited Sites. + Del billede + Slet + Slet alle cookies? + Ingen bogmærker + Ons + Ingen artikler + Jan + Webside indstillinger + Fortrolighed og sikkerhed + Udført + Multi vindue + Earlier this month + Cookies + Standardvisning + Sep + Adgangskode + Aug + Indst. for sideindhold + Læsbar + Slet adgangskoder + Indsæt + Gem billede + Naver + Husk formulardata + Redigér + Internet + Vis billeder + I dag + Vælg ord + I går + Titel + Brugers startside + Tilpas til bredden + Valgte + Lysstyrke + Indstillinger + Ryd cache + about: blank + Opret mappe + Bogmærker + Vis billede + Del via e-mail + Kør JavaScript + Nulstil til standard + Indtast bogmærkenavn + Placering + Sidste uge + Del via Facebook + Mappe + Ny mappe + Bogmærke fjernet + Reset all settings to default? + Gem + Nyt vindue + Aktivér placering + Tilføj + Fre + Blokér popup-vinduer + Ja + URL + Beskyttelse + Ryd placeringsadgang + %d uger siden + Bogmærke + Ugyldig adresse + No History \nAfter you load pages, the history will be shown. + Oversigt + Søn + Vis sikkerhedsadvarsler + Redigér bogmærke + Aktuel side + Del via Meddelelser + Startside + Manuelt + Tøm formulardata + Tir + Okt + Tor + Ingen resultater fundet + Ryd historik + Feb + Failed to save Image + diff --git a/res/deu-DE.xml b/res/deu-DE.xml new file mode 100644 index 0000000..e45c203 --- /dev/null +++ b/res/deu-DE.xml @@ -0,0 +1,134 @@ + + + + Alle auswählen + Nov. + Häufig besuchte Seiten + Close all + Schließen + Schriftgröße + Dez. + Lesezeichen ist bereits vorhanden. + Cookies akzeptieren + Browser-Verlauf löschen? + Lokalen Inhalt und lokale Datenbanken aus dem Cache löschen? + Alle Cookiedaten löschen + Mo + Nein + Abbrechen + Über Twitter freigeben + Letzter Monat + Sa + Lesezeichen hinzugefügt + Zu Favoriten hinzufügen + Immer fragen + Leere Seite + Jun. + Auto + Jul. + Kopieren + Passwörter merken + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Formulardaten + Apr. + Edit Folder + Mai + Auf Seite suchen + Bild kopieren + Gelöscht + Mär. + Yahoo + Suchmaschine + Suche + Senden via + URL suchen oder eingeben + No Recently Visited Sites. + Bild freigeb. + Löschen + Alle Cookies löschen? + Keine Favoriten + Mi + Keine Verläufe + Jan. + Website-Einstellungen + Datenschutz und Sicherheit + OK + Multi-Window + Earlier this month + Cookies + Standardansicht + Sep. + Passwort + Aug. + Seiteninhaltseinstellungen + Lesbar + Passwörter löschen + Einfügen + Bild speichern + Naver + Formulardaten speichern + Bearbeiten + Internet + Bilder anzeigen + Heute + Wort auswählen + Gestern + Titel + Benutzer-Startseite + An Breite anpassen + Ausgewählt + Helligkeit + Einstellungen + Cache leeren + about: blank + Ordner erstellen + Favoriten + Bild anzeigen + Senden via E-Mail + JavaScript ausführen + Auf Standard zurücksetzen + Namen des Lesezeichens eingeben + Standortzugriff + Letzte Woche + Über Facebook freigeben + Ordner + Neuer Ordner + Lesezeichen entfernt + Reset all settings to default? + Speichern + Neues Fenster + Standortzugriff aktivieren + Hinzufügen + Fr + Pop-ups blockieren + Ja + URL + Datenschutz + Standortzugriffsdaten löschen + Vor %d Wochen + Lesezeichen + Ungültige Adresse + No History \nAfter you load pages, the history will be shown. + Verlauf + So + Sicherheitswarnungen anzeigen + Favorit bearbeiten + Aktuelle Seite + Senden via Nachricht + Startseite + Manuell + Formulardaten löschen + Di + Okt. + Do + Keine Ergebnisse gefunden + Verlauf löschen + Feb. + Failed to save Image + diff --git a/res/ell-GR.xml b/res/ell-GR.xml new file mode 100644 index 0000000..bfbe5ea --- /dev/null +++ b/res/ell-GR.xml @@ -0,0 +1,134 @@ + + + + Επιλογή όλων + Noέμ + Δημοφιλέστερες τοποθεσίες + Close all + Κλείσιμο + Μέγεθος γραμματοσειράς + Δεκ + Ο σελιδοδείκτης υπάρχει ήδη + Αποδοχή των cookies + Διαγραφή ιστορικού προγράμματος περιήγησης; + Διαγραφή περιεχομένου και βάσεις δεδομένων της τοπικής μνήμης cache; + Διαγραφή όλων των δεδομένων cookie + Δευ. + Όχι + Άκυρο + Κοινή χρήση μέσω Twitter + Περασμένος μήνας + Σάβ. + Προστέθηκε σελιδοδείκτης + Προσθήκη στους σελιδ/τες + Να γίνεται πάντα ερώτηση + Κενή σελίδα + Ιούν + Αυτόματο + Ιούλ + Αντιγραφή + Απομνημόνευση κωδ. πρόσβ. + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Δεδομένα φορμών + Απρ + Edit Folder + Μάης + Εύρ. σε σελίδα + Αντιγραφή εικόνας + Διαγράφηκε + Μάρτ + Yahoo + Μηχανή αναζήτησης + Αναζήτηση + Κοινόχρηστο + Αναζήτηση ή εισαγωγή διεύθυνσης URL + No Recently Visited Sites. + Κοινή χρ.εικ. + Διαγρ. + Διαγραφή όλων των cookies; + Κανένας σελιδοδείκτης + Τετ. + Κανένα ιστορικό + Ιαν + Ρυθμίσεις τοποθεσίας Web + Ιδιωτικό απόρρητο και ασφάλεια + Ok + Πολλαπλά Παράθυρα + Earlier this month + Cookies + Προεπιλεγμένη προβολή + Σεπτ + Κωδικός πρόσβασης + Αυγ + Ρυθμ. περιεχομένου σελ. + Για ανάγνωση + Διαγραφή κωδ. πρόσβασης + Επικόλληση + Αποθ. εικόνας + Naver + Απομνημόνευση των δεδομένων φορμών + Επεξεργ. + Internet + Προβολή εικόνων + Σήμερα + Επιλογή λέξης + Xθές + Τίτλος + Αρχική σελίδα χρήστη + Προσαρμογή κατά πλάτος + Επιλεγμένο + Φωτεινότητα + Ρυθμίσεις + Διαγραφή μνήμης cache + about: blank + Δημ/ργία φακέλου + Προσθ.στους σελιδ/τες + Προβολή εικόνας + Κοινή χρήση μέσω email + Εκτέλεση JavaScript + Επαναφορά της προεπιλογής + Εισαγωγή ονόματος σελιδοδείκτη + Θέση + Προηγούμενη εβδομάδα + Κοινή χρήση μέσω Facebook + Φάκελος + Νέος φάκελος + Ο σελιδοδείκτης καταργήθηκε + Reset all settings to default? + Αποθ/ση + Νέο παράθυρο + Ενεργοποίηση τοποθεσίας + Προσθήκη + Παρ. + Αποκλεισμός αναδυόμ. παραθύρων + Ναι + URL + Απόρρητο + Εκκαθάριση πρόσβασης τοποθεσίας + Πριν %d εβδομάδες + Σελιδοδείκτης + Άκυρη διεύθυνση + No History \nAfter you load pages, the history will be shown. + Ιστορικό + Κυρ. + Εμφάνιση προειδοποιήσεων ασφαλείας + Επεξεργασία σελιδοδείκτη + Τρέχουσα σελίδα + Κοινή χρήση μέσω μηνυμάτων + Αρχική σελίδα + Χειροκίνητα + Διαγραφή δεδομένων φορμών + Τρ. + Οκτ + Πέμ. + Δεν βρέθηκαν αποτελέσματα + Εκκαθάριση ιστορικού + Φεβρ + Failed to save Image + diff --git a/res/eng-GB.xml b/res/eng-GB.xml new file mode 100644 index 0000000..eed6e23 --- /dev/null +++ b/res/eng-GB.xml @@ -0,0 +1,135 @@ + + + + Select all + Nov + Most visited sites + Close all + Close + Font size + Dec + Bookmark already exists + Accept cookies + Delete browser history? + Delete locally cached content and databases? + Clear all cookie data + Mon + No + Cancel + Share via Twitter + Last month + Sat + Bookmark added + Add to Bookmarks + Always ask + Blank page + Jun + Auto + Jul + Copy + Remember passwords + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Form data + Apr + Edit Folder + May + Find on page + Copy image + Deleted + Mar + Yahoo + Search engine + Search + Share + Search or enter URL + No Recently Visited Sites. + Share image + Delete + Delete all cookies? + No bookmarks + Wed + No histories + Jan + Website settings + Privacy and security + Done + Multi window + Earlier this month + Cookies + Default view + Sep + Password + Aug + Page content settings + Readable + Clear passwords + Paste + Save image + Naver + Remember form data + Edit + Internet + Display images + Today + Select word + Yesterday + Title + User homepage + Fit to width + Selected + Brightness + Settings + Clear cache + about: blank + Create folder + Bookmarks + View image + Share via Email + Run JavaScript + Reset to default + Enter bookmark name + Location + Last week + Share via Facebook + Folder + New folder + Bookmark removed + Reset all settings to default? + Save + New window + Enable location + Add + Fri + Block pop-ups + Yes + URL + Privacy + Clear location access + %d weeks ago + Bookmark + Invalid address + No History \nAfter you load pages, the history will be shown. + History + Sun + Show security warnings + Edit bookmark + Current page + Share via Messages + Homepage + Manual + Clear form data + Tue + Oct + Thu + No results found + Clear history + Feb + Failed to save Image + + diff --git a/res/eng-PH.xml b/res/eng-PH.xml new file mode 100644 index 0000000..2ccfa1d --- /dev/null +++ b/res/eng-PH.xml @@ -0,0 +1,134 @@ + + + + Select all + Nov. + Most visited sites + Close all + Close + Font size + Dec. + Bookmark already exists + Accept cookies + Delete browser history? + Delete locally cached content and databases? + Clear all cookie data + Mon + No + Cancel + Share via Twitter + Last month + Sat + Bookmark added + Add to Bookmarks + Always ask + Blank page + Jun. + Auto + Jul. + Copy + Remember passwords + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Form data + Apr. + Edit Folder + May + Find on page + Copy image + Deleted + Mar. + Yahoo + Search engine + Search + Share + Search or enter URL + No Recently Visited Sites. + Share image + Delete + Delete all cookies? + No bookmarks + Wed + No histories + Jan. + Website settings + Privacy and security + Done + Multi window + Earlier this month + Cookies + Default view + Sep. + Password + Aug. + Page content settings + Readable + Clear passwords + Paste + Save image + Naver + Remember form data + Edit + Internet + Display images + Today + Select word + Yesterday + Title + User homepage + Fit to width + Selected + Brightness + Settings + Clear cache + about: blank + Create folder + Bookmarks + View image + Share via Email + Run JavaScript + Reset to default + Enter bookmark name + Location + Last week + Share via Facebook + Folder + New folder + Bookmark removed + Reset all settings to default? + Save + New window + Enable location + Add + Fri + Block pop-ups + Yes + URL + Privacy + Clear location access + %d weeks ago + Bookmark + Invalid address + No History \nAfter you load pages, the history will be shown. + History + Sun + Show security warnings + Edit bookmark + Current page + Share via Messages + Homepage + Manual + Clear form data + Tue + Oct. + Thu + No results found + Clear history + Feb. + Failed to save Image + diff --git a/res/eng-US.xml b/res/eng-US.xml new file mode 100644 index 0000000..66d6149 --- /dev/null +++ b/res/eng-US.xml @@ -0,0 +1,134 @@ + + + + Select all + Nov. + Most visited sites + Close all + Close + Font size + Dec. + Bookmark already exists + Accept cookies + Delete browser history? + Delete locally cached content and databases? + Clear all cookie data + Mon + No + Cancel + Share via Twitter + Last month + Sat + Bookmark added + Add to Bookmarks + Always ask + Blank page + Jun. + Auto + Jul. + Copy + Remember passwords + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Form data + Apr. + Edit Folder + May + Find on page + Copy image + Deleted + Mar. + Yahoo + Search engine + Search + Share + Search or enter URL + No Recently Visited Sites. + Share image + Delete + Delete all cookies? + No bookmarks + Wed + No histories + Jan. + Website settings + Privacy and security + Done + Multi window + Earlier this month + Cookies + Default view + Sep. + Password + Aug. + Page content settings + Readable + Clear passwords + Paste + Save image + Naver + Remember form data + Edit + Internet + Display images + Today + Select word + Yesterday + Title + User homepage + Fit to width + Selected + Brightness + Settings + Clear cache + about: blank + Create folder + Bookmarks + View image + Share via email + Run JavaScript + Reset to default + Enter bookmark name + Location + Last week + Share via Facebook + Folder + New folder + Bookmark removed + Reset all settings to default? + Save + New window + Enable location + Add + Fri + Block pop-ups + Yes + URL + Privacy + Clear location access + %d weeks ago + Bookmark + Invalid address + No History \nAfter you load pages, the history will be shown. + History + Sun + Show security warnings + Edit bookmark + Current page + Share via Messages + Homepage + Manual + Clear form data + Tue + Oct. + Thu + No results found + Clear history + Feb. + Failed to save Image + diff --git a/res/est-EE.xml b/res/est-EE.xml new file mode 100644 index 0000000..1709188 --- /dev/null +++ b/res/est-EE.xml @@ -0,0 +1,134 @@ + + + + Vali kõik + Nov + Enim külastatud saidid + Close all + Sulge + Fondi suurus + Det. + Järjehoidja on juba olemas + Nõustu küpsistega + Kas kustutada baruseri ajalugu? + Kas tühjendada kohaliku vahemälu sisu ja andmebaasid? + Kustuta kõik küpsiste andmed + E + Ei + Tühista + Jaga Twitteris + Eelmine kuu + L + Järjehoidja lisatud + Lisa järjehoidjatesse + Küsi alati + Tühi leht + Jun. + Automaatne + Jul. + Kopeeri + Mäleta paroole + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Ankeedi andmed + Apr. + Edit Folder + Mai + Otsi lehelt + Kopeeri pilt + Kustutatud + Mär. + Yahoo + Otsingumootor + Otsi + Jaga + Otsige või sisestage URL + No Recently Visited Sites. + Jaga pilti + Kustuta + Kas kustutada kõik küpsised? + Järjehoidjaid ei ole + K + Ajalugu pole + Jan. + Veebisaidi seaded + Privaatsus ja turvalisus + Valmis + Mitmikaken + Earlier this month + Küpsised + Vaikevaade + Sept + Parool + Aug. + Lehekülje sisu seaded + Loetav + Kustuta paroolid + Kleebi + Salvesta pilt + Naver + Mäleta ankeedi andmeid + Muuda + Internet + Kuva pildid + Täna + Valige sõna + Eile + Pealkiri + Kasutaja avaleht + Mahuta laiusele + Valitud + Heledus + Seaded + Tühjenda vahemälu + about: blank + Loo kaust + Järjehoidjad + Kuva pilt + Jaga e-kirja kaudu + Käivita JavaScript + Lähtesta vaikeväärtusele + Sisestage järjehoidja nimi + Asukoht + Eelmine nädal + Jaga Facebookis + Kaust + Uus kaust + Järjehoidja on eemaldatud + Reset all settings to default? + Salvesta + Uus aken + Luba asukoht + Lisa + R + Blokeeri hüpikud + Jah + URL + Privaatsus + Tühista asukoha juurdepääs + %d nädalat tagasi + Järjehoidja + Kehtetu aadress + No History \nAfter you load pages, the history will be shown. + Ajalugu + P + Kuva turvahoiatused + Muuda järjehoidjat + Hetkel kuvatav leht + Jaga sõnumite kaudu + Avalehekülg + Käsitsi + Kustuta ankeedi andmed + T + Okt + N + Tulemusi ei leitud + Kustuta ajalugu + Veeb + Failed to save Image + diff --git a/res/eus-ES.xml b/res/eus-ES.xml new file mode 100644 index 0000000..7210078 --- /dev/null +++ b/res/eus-ES.xml @@ -0,0 +1,134 @@ + + + + Denak aukeratu + Aza. + Gehien bisitatutako guneak + Close all + Itxi + Letraren tamaina + Abe. + Lastermarka badago + Onartu cookieak + Ezabatu nabigatzailearen historia? + Ezabatu lokalki katxean gordetako edukia eta datu baseak? + Garbitu cookie datu guztiak + Asl. + Ez + Ezeztatu + Partekatu Twitter bidez + Joan den hilean + Lar. + Lastermarka gehitu da + Laster-marketara gehitu + Beti galdetu + Orri zuria + Eka. + Auto + Uzt. + Kopiatu + Gogoratu pasahitzak + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Formularioko datuak + Api. + Edit Folder + Maiatza + Aurkitu orrian + Kopiatu irudia + Ezabatua + Mar. + Yahoo + Bilaketa motorra + Bilatu + Partekatu + Bilatu edo idatzi URLa + No Recently Visited Sites. + Part. irudia + Ezabatu + Cookie guztiak ezabatu? + Laster-markarik ez + Asz. + Historiarik ez + Urt. + Webgunearen ezarpenak + Pribatutasuna eta segurtasuna + Amaituta + Multi window + Earlier this month + Cookie-ak + Ikuspegi lehenetsia + Ira. + Pasahitza + Abu. + Orri edukiaren ezarpenak + Irakurgarria + Garbitu pasahitzak + Itsatsi + Irudia gorde + Naver + Gogoratu formulario datuak + Editatu + Internet + Irudiak erakutsi + Gaur + Aukeratu hitza + Atzo + Izenburua + Erabiltzailearen orri nagusia + Egokitu zabalerara + Aukeratutakoa(k) + Argitasuna + Ezarpenak + Cachea hustu + about: blank + Sortu karpeta + Laster-markak + Ikusi irudia + Partekatu email bidez + JavaScript abiarazi + Lehenetsira berrezarri + Idatzi laster-markaren izena + Kokalekua + Azkeneko astea + Partekatu Facebook bidez + Karpeta + Karpeta berria + Lastermarka kenduta + Reset all settings to default? + Gorde + Leiho berria + Gaitu kokapena + Gehitu + Otr. + Blokeatu agerkariak + Bai + URLa + Pribatutasuna + Garbitu kokapen sarrera + Duela %d aste + Laster-marka + Helbide baliogabea + No History \nAfter you load pages, the history will be shown. + Historia + Iga. + Erakutsi segurtasun oharrak + Laster-marka editatu + Uneko orria + Partekatu mezuen bidez + Hasiera orria + Eskuzkoa + Garbitu formularioko datuak + Asr. + Urr. + Osg. + Ez da emaitzarik aurkitu + Historia ezabatu + Ots. + Failed to save Image + diff --git a/res/fin-FI.xml b/res/fin-FI.xml new file mode 100644 index 0000000..113b3ef --- /dev/null +++ b/res/fin-FI.xml @@ -0,0 +1,134 @@ + + + + Valitse kaikki + Mar + Useimmin katsotut sivustot + Close all + Sulje + Kirjasinkoko + Jou + Kirjanmerkki on jo olemassa + Hyväksy evästeet + Poistetaanko selainhistoria? + Poistetaanko paikallisessa välimuistissa olevat sisällöt ja tietokannat? + Poista kaikki evästetiedot + Ma + Ei + Peruuta + Jaa Twitterin kautta + Edellinen kuukausi + La + Kirjanmerkki lisätty + Lisää kirjanmerkkeihin + Kysy aina + Tyhjä sivu + Kesä + Automaattinen + Hei + Kopioi + Muista salasanat + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Lomaketiedot + Huh + Edit Folder + Toukokuu + Etsi sivulta + Kopioi kuva + Poistettu + Maa. + Yahoo + Hakukone + Etsi + Jaa + Hae tai anna URL-osoite + No Recently Visited Sites. + Jaa kuva + Poista + Poistetaanko kaikki evästeet? + Ei kirjanmerkkejä + Ke + Historioita ei ole + Tam. + Sivuston asetukset + Yksityisyys ja tietoturva + Valmis + Moni-ikkuna + Earlier this month + Evästeet + Oletusnäkymä + Syys + Salasana + Elo + Sivun sisällön asetukset + Luku + Tyhjennä salasanat + Liitä + Tallenna kuva + Naver + Muista lomaketiedot + Muokkaa + Internet + Näytä kuvat + Tänään + Valitse sana + Eilen + Otsikko + Käyttäjän kotisivu + Sovita leveyteen + Valittu + Kirkkaus + Asetukset + Tyhjennä välimuisti + about: blank + Luo kansio + Kirjanmerkit + Näytä kuva + Jaa sähköpostin kautta + Suorita JavaScript + Palauta oletukset + Anna kirjanmerkin nimi + Osoite + Viime viikko + Jaa Facebookin kautta + Kansio + Uusi kansio + Kirjanmerkki poistettu + Reset all settings to default? + Tallenna + Uusi ikkuna + Ota sijainti käyttöön + Lisää + Pe + Estä ponnahdusikkunat + Kyllä + URL-osoite + Yksityisyys + Poista sijainnin käyttö + %d viikkoa sitten + Kirjanmerkki + Virheellinen osoite + No History \nAfter you load pages, the history will be shown. + Historia + Su + Näytä suojausvaroitukset + Muokkaa kirjanmerkkiä + Nykyinen sivu + Jaa viestien kautta + Kotisivu + Manuaalinen + Poista lomaketiedot + Ti + Lok + To + Tuloksia ei löytynyt + Tyhjennä historia + Hel + Failed to save Image + diff --git a/res/fra-CA.xml b/res/fra-CA.xml new file mode 100644 index 0000000..e956fab --- /dev/null +++ b/res/fra-CA.xml @@ -0,0 +1,134 @@ + + + + Sélectionner tout + Nov. + Sites les plus visités + Close all + Fermer + Taille de police + Déc. + Ce favori existe déjà + Accepter les témoins + Supprimer l'historique du navigateur ? + Supprimer les bases de données et le contenu en cache ? + Effacer toutes les données du témoin + Lun. + Non + Annuler + Partager via Twitter + Mois précédent + Sam. + Marque-page ajouté + Ajouter aux signets + Toujours demander + Page vierge + Jui. + Auto + Juil. + Copier + Mémoriser les MDP + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Données formulaire + Avr. + Edit Folder + Mai + Rechercher dans la page + Copier l'image + Supprimé + Mars + Yahoo + Moteur de recherche + Recherche + Partager + Rechercher ou entrer une URL + No Recently Visited Sites. + Partager l'image + Supp. + Supprimer tous les témoins? + Aucun favori + Mer. + Aucun historique + Jan. + Paramètres des sites Web + Confidentialité et sécurité + OK + Fenêtres multi. + Earlier this month + Témoins + Vue par défaut + Sep. + Mot de passe + Aou. + Param. contenu des pages + Lisible + Effacer les mots de passe + Coller + Enregistrer l'image + Naver + Mémoriser les données de formulaire + Modifier + Internet + Afficher les images + Aujourd'hui + Sélectionner un mot + Hier + Titre + Page d'accueil utilisateur + Ajuster selon largeur + Sélectionné + Luminosité + Paramètres + Vider le cache + about: blank + Créer dossier + Favoris + Afficher l'image + Partager par courriel + Exécuter JavaScript + Restaurer valeurs par défaut + Entrez le nom d'un favori + Emplacement + Dernière semaine + Partager via Facebook + Dossier + Nouveau dossier + Favori supprimé + Reset all settings to default? + Sauv. + Nouvelle fenêtre + Activer la localisation + Ajouter + Ven. + Bloquer fen. contextuelles + Oui + URL + Confidentialité + Effacer l'accès à la position + il y a %d semaines + Favori + Adresse invalide + No History \nAfter you load pages, the history will be shown. + Historique + Dim. + Afficher les avertissements de sécurité + Modifier le marque-page + Page en cours + Partager par messages + Page d'accueil + Manuel + Effacer les données de formulaire + Mar. + Oct. + Jeu. + Aucun résultat trouvé + Effacer l'historique + Fév. + Failed to save Image + diff --git a/res/fra-FR.xml b/res/fra-FR.xml new file mode 100644 index 0000000..62bc657 --- /dev/null +++ b/res/fra-FR.xml @@ -0,0 +1,134 @@ + + + + Sélect. tout + Nov. + Sites les plus visités + Close all + Fermer + Taille de la police + Déc. + Ce favori existe déjà + Accepter les cookies + Supprimer l'historique du navigateur ? + Supprimer les bases de données et le contenu en cache ? + Supprimer tous les cookies + Lun + Non + Annuler + Partager via Twitter + Mois précédent + Sam + Marque-page ajouté + Ajouter aux favoris + Toujours demander + Page vierge + Jui. + Auto. + Juil + Copier + Retenir les mots de passe + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Données formulaire + Avr. + Edit Folder + Mai + Rech. sur page + Copier l'image + Supprimé + Mars + Yahoo + Moteur de recherche + Rechercher + Partager + Rechercher ou entrer une URL + No Recently Visited Sites. + Part. image + Suppr. + Supprimer tous les cookies ? + Aucun favori + Mer + Aucun historique + Jan. + Paramètres des sites Web + Confidentialité et sécurité + Effectué + Fenêtres multiples + Earlier this month + Cookies + Vue par défaut + Sep. + Mot de passe + Aoû. + Param. contenu des pages + Lisible + Effacer les mots de passe + Coller + Enregistrer image + Naver + Se rappeler des données de formulaire + Modifier + Internet + Afficher les images + Aujourd'hui + Sélect. mot + Hier + Titre + Page d'accueil utilisateur + Ajuster selon largeur + Sélectionné + Luminosité + Paramètres + Vider le cache + about: blank + Créer dossier + Favoris + Afficher image + Partager par e-mail + Exécuter JavaScript + Restaurer valeurs par défaut + Entrez le nom d'un favori + Position + Dernière semaine + Partager via Facebook + Dossier + Nouveau dossier + Favori supprimé + Reset all settings to default? + Sauveg. + Nouvelle fenêtre + Activer la localisation + Ajouter + Ven + Bloquer les pop-ups + Oui + URL + Confidentialité + Effacer l'accès à la position + il y a %d semaines + Favori + Adresse non valide + No History \nAfter you load pages, the history will be shown. + Historique + Dim + Afficher les avertissements de sécurité + Modifier le marque-page + Page en cours + Partager par messages + Page d'accueil + Manuel + Supprimer les données de formulaire + Mar + Oct. + Jeu + Aucun résultat trouvé + Effacer l'historique + Fév. + Failed to save Image + diff --git a/res/gle-IE.xml b/res/gle-IE.xml new file mode 100644 index 0000000..63a3c74 --- /dev/null +++ b/res/gle-IE.xml @@ -0,0 +1,134 @@ + + + + Roghnaigh gach + Samh + Láithreáin is mó cuairt orthu + Close all + Dún + Méid an chló + Nol. + Tá an leabharmharc ann cheana + Glac le fianáin + Scrios stair an bhrabhsálaí? + Scrios inneachar agus bunachair shonraí a taisceadh go logánta? + Glan gach sonra fianáin + Luan + Ná déan é + Cuir ar ceal + Comhroinn le Twitter + An mhí seo caite + Sath + Leabharmharc curtha leis + Cuir le Leabharmharcanna + Iarr i gcónaí + Leathanach bán + Meit + Uath- + Iúil + Cóipeáil + Cuimhnigh ar phasfhocail + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Sonraí ar fhoirm + Aib. + Edit Folder + Bealtaine + Aimsigh ar lch. + Cóipeáil íomhá + Scriosta + Már. + Yahoo + Inneall cuardaigh + Cuardaigh + Comhroinn + Cuardaigh nó iontráil URL + No Recently Visited Sites. + C.roinn íomhá + Scrs + Scrios gach fianán? + Níl leabharmharcanna ann + Céad + Níl stair ann + Ean. + Socruithe láithreán Gréasáin + Príobháideacht agus slándáil + Déanta + Multi window + Earlier this month + Fianáin + Réamh-amharc + M.F. + Pasfhocal + Lún. + Soc. inneachar an lch. + Inléite + Glan pasfhocail + Greamaigh + Sábháil íomhá + Naver + Cuimhnigh sonraí foirme + Eagraigh + an tIdirlíon + Taispeáin íomhánna + Inniu + Roghnaigh focal + Inné + Teideal + Leathanach baile d'úsáideoirí + Oir don leithead + Roghnaithe + Gile + Socruithe + Glan taisce + about: blank + Déan fillteán + Leabharmharcanna + Amharc ar íomhá + Comhroinn le r-phost + Rith JavaScript + Athshocraigh go réamhshocraithe + Iontráil ainm an leabharmhairc + Suíomh + An tseachtain seo caite + Comhroinn le Facebook + Fillteán + Fillteán nua + Leabharmharc bainte + Reset all settings to default? + Sábháil + Fuinneog nua + Cumasaigh suíomh + Cuir leis + Aoin + Cuir bac ar mhíreanna aníos + Déan é + URL + Príobháideacht + Glan rochtain an tsuímh + %d seachtain ó shin + Leabharmharc + Seoladh neamhbhailí + No History \nAfter you load pages, the history will be shown. + Stair + Domh + Taispeáin rabhaidh shlándála + Cuir leabharmharc in eagar + Leathanach reatha + Comhroinn trí Theachtaireachtaí + Leathanach baile + Láimhe + Glan sonraí foirme + Már + D.F. + Déar + Níor aimsíodh torthaí + Glan stair + Feab + Failed to save Image + diff --git a/res/glg-ES.xml b/res/glg-ES.xml new file mode 100644 index 0000000..f1a5909 --- /dev/null +++ b/res/glg-ES.xml @@ -0,0 +1,134 @@ + + + + Seleccionar todo + Nov. + Sitios máis visitados + Close all + Pechar + Tamaño da fonte + Dec. + O favorito xa existe + Aceptar cookies + Desexas borrar o historial do navegador? + Desexas borrar contidos e bases de datos gardados localmente na caché? + Borrar todos os datos de cookies + Lun + Non + Cancelar + Compartir a través de Twitter + O mes pasado + Sáb + Favorito engadido + Engadir a Favoritos + Preguntar sempre + Páxina en branco + Xun. + Automático + Xul. + Copiar + Recordar contrasinais + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Datos do formulario + Abr. + Edit Folder + Mai. + Buscar en páx. + Copiar imaxe + Eliminado + Mar. + Yahoo + Motor de busca + Buscar + Compartir + Buscar ou introducir URL + No Recently Visited Sites. + Comp. imaxe + Elim. + Eliminar Todas as Cookies? + Sen favoritos + Mér + Non hai historiais + Xan. + Axustes do sitio Web + Privacidade e seguridade + Finalizado + Multi window + Earlier this month + Cookies + Vista predeterminada + Set. + Contrasinal + Ago. + Axust do contido da páx + Lexible + Borrar contrasinais + Pegar + Gardar imaxe + Naver + Recordar datos de formularios + Editar + Internet + Mostrar imaxes + Hoxe + Seleccionar palabra + Onte + Título + Páxina de inicio de usuario + Axustar anchura + Seleccionado + Brillo + Axustes + Borrar caché + about: blank + Crear carpeta + Favoritos + Ver imaxe + Compartir a través de correo electrónico + Executar JavaScript + Restablecer como predeterminado + Introduce o nome do favorito + Localización + Última semana + Compartir a través de Facebook + Carpeta + Nova carpeta + Favorito eliminado + Reset all settings to default? + Gardar + Nova ventá + Permitir localización + Engadir + Ven + Bloquear ventás emerxentes + Si + URL + Privacidade + Borrar acceso de localización + Hai %d semanas + Favorito + Enderezo non válido + No History \nAfter you load pages, the history will be shown. + Historial + Dom + Mostrar advertencias de seguridade + Editar favorito + Páxina actual + Compartir a través de Mensaxes + Páxina de inicio + Manual + Borrar datos de formularios + Mar + Out. + Xov + Non se atoparon resultados + Borrar historial + Feb. + Failed to save Image + diff --git a/res/hin-IN.xml b/res/hin-IN.xml new file mode 100644 index 0000000..ae81ee5 --- /dev/null +++ b/res/hin-IN.xml @@ -0,0 +1,134 @@ + + + + सभी चुनें + नव. + अधिकतम भेंट दिए साइट्स + Close all + बंद करें + फॉन्ट आकार + दिस. + बुकमार्क पहले से मौजूद है + कुकीज स्‍वीकारें + ब्राउज़र इतिहास हटाएँ? + स्थानीय कैचे सामग्री और डाटाबेस हटाएँ? + सभी कुकीज़ डेटा साफ़ करें + सोम + नहीं + रद्द + ट्विटर के द्वारा साझा करें + अंतिम महीना + शनि + बुकमार्क जोड़ा गया + बुकमार्क्स में जोड़ें + हमेशा पूछें + खाली पेज + जून + स्वतः + जुल. + कॉपी करें + पासवर्ड्स याद रखें + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + फ़ॉर्म डेटा + अप. + Edit Folder + मई + पेज़ पर ढूँढें + छवि कॉपी करें + हटाया गया + मा. + Yahoo + खोज इंजन + खोजें + शेयर करें + खोजें या URL दर्ज करें + No Recently Visited Sites. + छवि शेयर करें + हटाएँ + सभी कुकीज़ डिलीट करें? + कोई बुकमार्क नहीं + बुध + इतिहास नहीं + जन. + वेबसाइट सेटिंग + गोपनीयता और सुरक्षा + हुआ + मल्टी विंडो + Earlier this month + कुकीज + डीफ़ॉल्ट दृश्य + सित. + पासवर्ड + अग. + पेज सामग्री सेटिंग्स + पढ़ने योग्य + पासवर्ड्‍स साफ़ करें + पेस्ट करें + छवि सुरक्षित करें + Naver + फॉर्म डाटा याद रखें + संपादन + इंटरनेट + छवियाँ दर्शाएँ + आज + शब्‍द चुनें + बीता हुआ कल + शीर्षक + उपयोगकर्ता होमपेज + चौड़ाई में फिट करें + चुना गया + चमक + सेटिंग्स + कैचे साफ़ करें + about: blank + फ़ोल्‍डर बनाएँ + बुकमार्क्स + छवि देखें + ईमेल के द्वारा साझा करें + जावा स्क्रिप्ट चलाएँ + डिफॉल्‍ट में रीसेट करें + बुकमार्क का नाम दर्ज करें + स्थान + पिछला सप्ताह + फ़ेसबुक के द्वारा साझा करें + फोल्डर + नया फ़ोल्‍डर + बुकमार्क निकाला गया + Reset all settings to default? + सेव + नई विंडो + स्थान सक्षम करें + जोड़ें + शुक्र + पॉप-अप अवरुद्ध करें + हाँ + URL + गोपनीयता + स्थान ऍक्सेस साफ करें + %d सप्ताह पहले + बुकमार्क + अमान्य पता + No History \nAfter you load pages, the history will be shown. + इतिहास + रवि + सुरक्षा चेतावनियां दिखाएँ + बुकमार्क संपादित करें + वर्तमान पेज + संदेशो के द्वारा साझा करें + होमपेज + मैनुअल + फ़ॉर्म डेटा साफ़ करें + मंगल + अक. + गुरु + कोई परिणाम नहीं मिले + इतिहास साफ़ करें + फ़र + Failed to save Image + diff --git a/res/hrv-HR.xml b/res/hrv-HR.xml new file mode 100644 index 0000000..b404e06 --- /dev/null +++ b/res/hrv-HR.xml @@ -0,0 +1,134 @@ + + + + Odaberi sve + Stu + Najposjećenija mjesta + Close all + Prekid + Veličina slova + Pro + Oznaka se već koristi + Prihvati kolačiće + Obrisati povijest preglednika? + Obrisati lokalno spremljeni sadržaj i baze podataka? + Obriši sve podatke kolačića + Pon + Ne + Prekid + Dijeli putem Twittera + Prošli mjesec + Sub + Dodano u favorite + Dodaj u Favorite + Uvijek pitaj + Prazna stranica + Lip + Auto + Srp + Kopiraj + Zapamti šifre + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Podaci formi + Tra + Edit Folder + Svibanj + Traži na stranici + Kopiraj sliku + Obrisano + Ožu + Yahoo + Pretraživač + Traži + Dijeli + Potražite ili unesi URL + No Recently Visited Sites. + Dijeli sliku + Obriši + Obrisati sve kolačiće? + Nema favorita + Sri + Nema povijesti + Sij + Postavke web stranice + Privatnost i sigurnost + OK + Više prozora + Earlier this month + Kolačići + Zadani prikaz + Ruj + Šifra + Kol + Postavke stranice + Čitljivo + Obriši šifre + Zalijepi + Spremi sliku + Naver + Zapamti unose obrazaca + Uredi + Internet + Prikaz slika + Danas + Odaberite riječ + Jučer + Naslov + Poč. str. korisnika + Prilagodi širini + Odabrano + Svjetlina + Postavke + Obriši međuspremnik + about: blank + Nova mapa + Favoriti + Prikaži sliku + Dijeljenje preko emaila + Pokreni JavaScript + Vrati na zadano + Unesite naziv favorita + Lokacija + Zadnji tjedan + Dijeli putem Facebooka + Mapa + Nova mapa + Favorit uklonjen + Reset all settings to default? + Spremi + Novi prozor + Uključi lokaciju + Dodaj + Pet + Blokiraj pop-up prozore + Da + Adresa + Privatnost + Obriši pristup lokaciji + Prije %d tjedana + Favorit + Neispravna adresa + No History \nAfter you load pages, the history will be shown. + Povijest + Ned + Prikaži sigurnosna upozorenja + Uredi favorita + Trenutna stranica + Dijeljenje preko poruka + Početna stranica + Ručno + Obriši unose obrazaca + Uto + Lis + Čet + Nema rezultata + Brisanje povijesti + Velj + Failed to save Image + diff --git a/res/hun-HU.xml b/res/hun-HU.xml new file mode 100644 index 0000000..98f50f3 --- /dev/null +++ b/res/hun-HU.xml @@ -0,0 +1,134 @@ + + + + Összes kijelölése + nov. + Leggyakrabban látogatott helyek + Close all + Bezárás + Betűméret + dec. + Már van ilyen könyvjelző + Cookie-k elfogadása + Törli a böngészőelőzményeket? + Törli a helyi gyorsítótárba helyezett tartalmat és adatbázisokat? + Minden cookie törlése + Hét + Nem + Mégse + Megosztás a Twitteren + Elmúlt hónap + Szo + Könyvjelző hozzáadva + Könyvjelző mentése + Mindig kérdezzen rá + Üres oldal + jún. + Auto. + júl. + Másol + Jelszót megjegyez + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Űrlap adatok + ápr. + Edit Folder + máj. + Keresés az oldalon + Kép másolása + Törölve + már. + Yahoo + Kereső + Keresés + Megosztás + Keressen vagy írjon be URL-t + No Recently Visited Sites. + Kép megoszt. + Töröl + Törli a cookie-kat? + Nincs könyvjelző + Sze + Nincsenek előzmények + jan. + Webhelybeállítások + Adatvédelem és biztonság + Kész + Több ablak + Earlier this month + Cookie-k + Alapértelmezett nézet + szep + Jelszó + aug. + Oldaltartalom beállításai + Olvasható + Jelszavak törlése + Beilleszt + Kép mentése + Naver + Űrlapadatok megjegyzése + Szerkeszt + Internet + Képek megjelenítése + Ma + Szó kiválasztása + Tegnap + Cím + Felhasználó kezdőlapja + Szélességhez + Kiválasztott + Fényerő + Beállítások + Gyorsítótár ürítése + about: blank + Mappát létrehoz + Könyvjelzők + Képet megtekint + Megosztás e-mailben + JavaScript futtatása + Alapértelmezés visszaállítása + Adja meg a könyvjelző nevét + Hely + Utolsó hét + Megosztás a Facebookon + Mappa + Új mappa + Könyvjelző eltávolítva + Reset all settings to default? + Ment + Új ablak + Hely engedélyezése + Hozzáad + Pén + Előugró ablakok blokkolása + Igen + URL + Védett adataim + Helyadatok törlése + %d héttel ezelőtt + Könyvjelző + Érvénytelen cím + No History \nAfter you load pages, the history will be shown. + Előzmények + Vas + Biztonsági figyelmeztetések + Könyvjelző szerkesztése + Jelenlegi oldal + Megosztás üzenetben + Kezdőlap + Kézi + Űrlapadatok törlése + Ke + okt. + Csü + Nincs találat + Előzmények törlése + feb. + Failed to save Image + diff --git a/res/hye-AM.xml b/res/hye-AM.xml new file mode 100644 index 0000000..34866af --- /dev/null +++ b/res/hye-AM.xml @@ -0,0 +1,134 @@ + + + + Ընտրել բոլորը + Նոյ + Առավել այցելված կայքեր + Close all + Փակել + Տառաչափ + Դեկտ + Էջանիշն արդեն գոյություն ունի + Ընդունել թխուկները + Վերացնե՞լ զննարկչի պատմությունը: + Վերացնե՞լ հիշապահեստում տեղայնորեն պահված բովանդակությունն ու տվյալների շտեմարանները: + Ջնջել թխուկների ողջ տվյալները + Երկ + Ոչ + Չեղարկել + Համօգտագործել Twitter-ի միջոցով + Անցյալ ամիս + Շբթ + Էջանիշն ավելացվել է + Ավելացնել Էջանիշերում + Միշտ հարցնել + Դատարկ էջը + Հուն + Ավտոմատ + Հուլ + Պատճենել + Հիշել գաղտնաբառերը + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Ձևի տվյալներ + Ապր. + Edit Folder + Մայ + Գտնել էջում + Պատճենել պատկեր + Ջնջված է + Մրտ + Yahoo + Որոնիչ + Որոնել + Համատեղ օգտագործում + Որոնել կամ մուտքագրել URL + No Recently Visited Sites. + Հմօգտ. պատկեր + Ջնջել + Ջնջե՞լ բոլոր թխուկները + Էջանիշներ չկան + Չրք + Պատմություններ չկան + Հնվ + Կայքի դրվածքներ + Գաղտնիություն և անվտանգություն + Պատրաստ + Բազմապատուհան + Earlier this month + Cookies + Կանխադրված դիտում + Սպտ + Գաղտնաբառ + Օգս + Էջի բվնդկության դրվածքներ + Ընթեռնելի + Մաքրել գաղտնաբառերը + Տեղադրել + Պահպանել պատկերը + Naver + Հիշել տվյալներից + Խմբագրել + Ինտերնետ + Ցուցադրել պատկերներ + Այսօր + Ընտրել բառ + Երեկ + Վերնագիր + Օգտվողի հիմնաէջ + Տեղավորել լայնքի վրա + Ընտրված + Պայծառություն + Պարամետրեր + Դատարկել հիշապահեստը + about: blank + Ստեղծել թղթպանակ + Էջանիշեր + Տեսնել պատկերը + Համօգտագործել էլփոստի միջոցով + Գործարկել JavaScript + Զրոյացնել լռելյայնի + Մուտքագրեք էջանիշի անվանումը + Գտնվելու վայր + Վերջին շաբաթ + Համօգտագործել Facebook-ի միջոցով + Թղթապանակ + Նոր թղթապանակ + Էջանիշը հեռացվեց + Reset all settings to default? + Պահել + Նոր պատուհան + Ընձեռել տեղ + Ավելացնել + Ուրբ + Արգելափակել ելնող պատուհանները + Այո + URL + Գաղտնիություն + Մաքրել տեղի մուտքը + %d շաբաթ առաջ + Էջանիշ + Անվավեր հասցե + No History \nAfter you load pages, the history will be shown. + Պատմություն + Կիր + Ցուցադրել անվտանգության զգուշացումները + Խմբագրել էջանիշը + Ընթացիկ էջ + Համօգտագործել Հաղորդագրությունների միջոցով + Սկզբնական էջ + Ձեռքով + Ջնջել տվյալներից + Երք + Հոկտ + Հնգ + Արդյունքներ չեն գտնվել + Մաքրել պատմությունը + Փտրվ + Failed to save Image + diff --git a/res/isl-IS.xml b/res/isl-IS.xml new file mode 100644 index 0000000..87c0fce --- /dev/null +++ b/res/isl-IS.xml @@ -0,0 +1,134 @@ + + + + Velja allt + nóv. + Mest opnuð svæði + Close all + Loka + Leturstærð + Des. + Bókamerkið er þegar til + Samþykkja fótspor + Eyða vafrasögu? + Eyða gagnagrunnum og staðbundnu efni í skyndiminni? + Hreinsa öll fótsporagögn + Mán + Nei + Hætta við + Samnýta um Twitter + Síðasti mánuð + Lau + Bókamerki bætt við + Bæta við Bókamerki + Spyrja alltaf + Auð síða + Jún. + Sjálfvirkt + Júl. + Afrita + Muna lykilorð + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Innsláttargögn + apr. + Edit Folder + Maí + Finna á síðu + Afrita mynd + Eytt + Mar. + Yahoo + Leitarvél + Leit + Samnýta + Leita eða slá inn vefslóð + No Recently Visited Sites. + Samnýta mynd + Eyða + Viltu eyða öllum fótsporum? + Ný bókamerki + Mið + Engin saga + Jan. + Vefsíðustillingar + Gagnaleynd og öryggi + Lokið + Margir gluggar + Earlier this month + Fótspor + Sjálfgefin skjár + Sep. + Aðgangsorð + ág. + Efnisstillingar síðu + Læsileg + Hreinsa lykilorð + Líma + Vista mynd + Naver + Vista innslegnar upplýsingar + Breyta + Internetið + Birta myndir + Í dag + Velja orð + Í gær + Titill + Heimasíða notanda + Fella að breidd + Valið + Birtustig + Stillingar + Hreinsa skyndiminni + about: blank + Búa til möppu + Bókamerki + Skoða mynd + Samnýta með tölvupósti + Keyra Java-vefforskrift + Endurstilla á sjálfgildi + Sláðu inn heiti bókamerkis + Staðsetning + Síðasta vika + Birta í gegnum Facebook + Mappa + Ný mappa + Bókamerki fjarlægt + Reset all settings to default? + Vista + Nýr gluggi + Virkja staðsetningu + Bæta við + Fös + Loka fyrir sprettiglugga + Já + Vefslóð + Leynd + Hreinsa aðgang að staðsetningu + Fyrir %d vikum + Bókamerki + Ógilt veffang + No History \nAfter you load pages, the history will be shown. + Saga + Sun + Sýna öryggisviðvaranir + Breyta bókamerki + Opin síða + Samnýta með skilaboðum + Heimasíða + Handvirkt + Hreinsa innslegnar upplýsingar + Þri + okt. + Fim + Ekkert fannst + Hreinsa feril + feb. + Failed to save Image + diff --git a/res/ita-IT.xml b/res/ita-IT.xml new file mode 100644 index 0000000..672750e --- /dev/null +++ b/res/ita-IT.xml @@ -0,0 +1,134 @@ + + + + Seleziona tutto + Nov + Siti più visitati + Close all + Chiudi + Dimensioni carattere + Dic + Preferito già esistente + Accetta cookie + Eliminare cronologia browser? + Eliminare contenuto della cache e database locali? + Cancella tutti i dati cookie + Lun + No + Annulla + Condividi con Twitter + Ultimo mese + Sab + Preferito aggiunto + Aggiungi a Preferiti + Chiedi sempre + Pagina vuota + Giu + Automatica + Lug + Copia + Ricorda password + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Dati modulo + Apr + Edit Folder + Maggio + Trova nella pagina + Copia immagine + Eliminato/i + Mar + Yahoo + Motore di ricerca + Cerca + Condividi + Cerca o immetti URL + No Recently Visited Sites. + Condiv. immag. + Elimina + Eliminare tutti i cookie? + Nessun preferito + Mer + Nessuna cronologia + Gen + Impostazioni sito web + Privacy e sicurezza + Fatto + Multischermo + Earlier this month + Cookie + Vista predefinita + Set + Password + Ago + Impost. contenuto pagina + Leggibile + Cancella password + Incolla + Salva immagine + Naver + Ricorda dati modulo + Modifica + Internet + Visualizza immagini + Oggi + Parola + Ieri + Titolo + Pagina iniziale utente + Adatta a larghezza + Selezionato + Luminosità + Impostazioni + Svuota cache + about: blank + Crea cartella + Preferiti + Vedi immagine + Condividi con e-mail + Esegui JavaScript + Ripristina impostazioni predefinite + Inserisci nome preferito + Posizione + Ultima settimana + Condividi con Facebook + Cartella + Nuova cartella + Segnalibro rimosso + Reset all settings to default? + Salva + Nuova finestra + Attiva localizzazione + Aggiungi + Ven + Blocca pop-up + Sì + URL + Privacy + Cancella accesso posizione + %d settimane fa + Preferito + Indirizzo non valido + No History \nAfter you load pages, the history will be shown. + Cronologia + Dom + Mostra avvisi di sicurezza + Modifica preferito + Pagina corrente + Condividi con Messaggi + Homepage + Manuale + Cancella dati modulo + Mar + Ott + Gio + Nessun risultato trovato + Cancella cronologia + Feb + Failed to save Image + diff --git a/res/jpn-JP.xml b/res/jpn-JP.xml new file mode 100644 index 0000000..7f9368d --- /dev/null +++ b/res/jpn-JP.xml @@ -0,0 +1,134 @@ + + + + 全て選択 + 11月 + よく見るサイト + Close all + 閉じる + 文字サイズ + 12月 + ブックマークは既に存在します。 + Cookieを許可 + 保存された閲覧履歴を消去しますか? + 保存された全てのキャッシュ情報を消去しますか? + Cookieを消去 + 月 + いいえ + キャンセル + Twitterで共有 + 先月 + 土 + ブックマークが追加されました + ブックマークに追加 + 毎回確認 + 空白のページ + 6月 + 自動 + 7月 + コピー + パスワードを保存 + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + 文字入力履歴 + 4月 + Edit Folder + 5月 + ページ内を検索 + 画像をコピー + 削除しました。 + 3月 + Yahoo + 検索エンジン + 検索 + 共有 + 検索、またはURLを入力 + No Recently Visited Sites. + 画像を共有 + 削除 + 保存された全てのCookieを消去しますか? + ブックマークがありません。 + 水 + 履歴がありません。 + 1月 + Webサイト設定 + プライバシーとセキュリティ + 完了 + マルチウィンドウ + Earlier this month + Cookie + 基本表示モード + 9月 + パスワード + 8月 + ページコンテンツ設定 + 判読可能 + パスワードを消去 + 貼り付け + 画像を保存 + Naver + 文字入力履歴を保存 + 編集 + インターネット + 画像表示 + 今日 + テキスト選択 + 昨日 + タイトル + ユーザーホームページ + 幅に合わせる + 選択済み + 明るさ + 設定 + キャッシュを消去 + about: blank + フォルダ作成 + ブックマーク + 画像を表示 + Eメールで共有 + JavaScriptを実行 + 初期値にリセット + ブックマーク名を入力してください。 + 場所 + 先週 + Facebookで共有 + フォルダ + 新規フォルダ + ブックマークが削除されました。 + Reset all settings to default? + 保存 + 新規ウィンドウ + 位置情報を有効にする + 追加 + 金 + ポップアップをブロック + はい + URL + プライバシー + 位置情報を消去 + %d週間前 + ブックマーク + アドレスが正しくありません。 + No History \nAfter you load pages, the history will be shown. + 履歴 + 日 + セキュリティ警告を表示 + ブックマークを編集 + 現在のページ + メッセージで共有 + ホームページ + 手動 + 文字入力履歴を消去 + 火 + 10月 + 木 + 検索結果がありません。 + 履歴を消去 + 2月 + Failed to save Image + diff --git a/res/kat-GE.xml b/res/kat-GE.xml new file mode 100644 index 0000000..b39137e --- /dev/null +++ b/res/kat-GE.xml @@ -0,0 +1,134 @@ + + + + ყველას არჩევა + ნოე. + ყველაზე ხშირად ნანახი საიტები + Close all + დახურვა + შრიფტის ზომა + დეკ. + სანიშნე უკვე არსებობს + ქუქი–ფაილების მიღება + წაშლით ბრაუზერის ისტორიას? + წაშლით ადგილობრივ ქეშ-მეხსიერებაში შენახული მასალებსა და მონაცემთა ბაზებს? + ყველა ქუქი–მონაცემების გასუფთავება + ორშ. + არა + გაუქმება + გაზიარება Twitter-ით + გასული თვე + შაბ. + სანიშნე დაემატა + სანიშნეებში დამატება + ყოველთვის მკითხე + ცარიელი გვერდი + ივნ. + ავტომატური + ივლ. + ასლი + დაიმახსოვრეთ პაროლები + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + ფორმის მონაცემები + აპრ. + Edit Folder + მაისი + გვერდზე პოვნა + სურათის ასლის გადაღება + წაშლილია + მარ. + Yahoo + საძიებო სისტემა + ძიება + გაზიარება + მოძებნეთ ან ჩაწერეთ URL + No Recently Visited Sites. + გააზიარე სურ. + წაშლა + წავშალო ყველა ფუნთუშა-ფაილი? + ჩემი ნიშნულები + ოთხ. + ისტორიები არ არის + იან. + ვებსაიტის პარამეტრები + კონფიდენციალურობა და უსაფრთხოება + შესრულდა + რამდენიმე ფანჯარა + Earlier this month + ქუქი-ფაილები + ნაგულისხმევი ხედი + სექ. + პაროლი + აგვ. + გვერდის შინაარსის პარამ. + წაკითხვადი + პაროლების წაშლა + ჩასმა + სურათის შენახვა + Naver + ფორმის მონაცემების დამახსოვრება + შესწორება + ინტერნეტი + ეკრანის სურათები + დღეს + აირჩიეთ სიტყვა + გუშინ + სათაური + მომხმარებლის საწყისი გვერდი + მორგება სიგანეზე + შერჩეული + სიკაშკაშე + პარამეტრები + ქეშის გასუფთავება + about: blank + საქაღალდის შექმნა + სანიშნი + სურათის ნახვა + გაზიარება ელ.ფოსტით + JavaScript-ის გაშვება + ავტო. პარამეტრის დაბრუნება + ჩაწერეთ სანიშნის სახელი + ადგილმდებ. + გასული კვირა + გაზიარება Facebook-ით + საქაღალდე + ახალი საქაღალდე + სანიშნე მოცილდა + Reset all settings to default? + შენახვა + ახალი ფანჯარა + ლოკაციის ჩართვა + დამატება + პარ. + ამოსახტომი ფანჯრების დაბლოკვა + დიახ + URL + პირადი + გაასუფთავეთ ლოკაციაზე წვდომის მონაცემი + %d კვირის წინ + სანიშნე + მისამართი არასწორია + No History \nAfter you load pages, the history will be shown. + ისტორია + კვ. + უსაფრთხოების გაფრთხილებების ჩვენება + ნიშნულის შეცვლა + მიმდინარე გვერდი + გაზიარება წერილებით + საწყისი გვერდი + მექანიკური + ფორმის მონაცემების გასუფთავება + სამ. + ოქტ. + ხუთ. + შედეგები არ მოიძებნა + ისტორიის გასუფთავება + თებ. + Failed to save Image + diff --git a/res/kaz-KZ.xml b/res/kaz-KZ.xml new file mode 100644 index 0000000..ac97f8c --- /dev/null +++ b/res/kaz-KZ.xml @@ -0,0 +1,134 @@ + + + + Бәрін бөлектеу + Қар + Көп кіретін сайттар + Close all + Жабу + Шрифт өлшемі + Жел + Бетбелгі бұрыннан бар + Куки файлдарын қабылдау + Браузер журналын жою керек пе? + Жергілікті кэштелген мазмұн мен дерекқорларды жою керек пе? + Барлық куки деректерін өшіру + Дүй + Жоқ + Тоқтату + Twitter арқылы бөлісу + Соңғы ай + Сен + Бетбелгі қосылды + Бетбелгілерге қосу + Әрқашан сұрау + Бос бет + Мау + Авто + Шіл + Көшіру + Құпиясөзді сақтау + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Үлгі деректері + Сәу + Edit Folder + Maм. + Беттен табу + Сурет көшіру + Жойылды + Нау + Yahoo + Іздеу механизмі + Іздеу + Байланысқа жол + URL мекенжайын іздеу немесе енгізу + No Recently Visited Sites. + Сурет бөлісу + Жою + Барлық «куки» файлдарын жою керек пе? + Бетбелгі жоқ + Сәр + Журналдар жоқ + Қаң + Веб-сайт параметрлері + Құпиялық және қауіпсіздік + Дайын + Көп терезе + Earlier this month + Cookies + Әдепкі көрініс + Қыр + Кілтсөз + Там + Бет мазмұны параметрлері + Оқылатын + Құпия сөзді жою + Қою + Көріністі сақтау + Naver + Деректерден еске сақтау + Өзгер. + Шолушы + Суреттерді көрсету + Бүгін + Сөз таңдау + Кеше + Тақырыбы + Пайдаланушының бастапқы беті + Еніне сәйкес келу + Таңдалды + Ашықтығы + Қондырғ-р + Кэшті тазарту + about: blank + Қалта жасау + Қосымшалар + Суретті көру + Электрондық пошта арқылы бөлісу + JavaScript орындау + Стандартты бапстапқы мәндеріне баптау + Бетбелгі атын енгізіңіз + Орналасу орны + Соңғы апта + Facebook арқылы бөлісу + Қалта + Жаңа қалта + Бетбелгі жойылды + Reset all settings to default? + Сақтау + Жаңа терезе + Орнын қосу + Қосу + Жұм + Қалқымалы терезелерді бұғаттау + Иә + URL + Құпия + Орнына кіруді тазалау + %d апта бұрын + Белгі қосу + Мекен-жай жарамсыз + No History \nAfter you load pages, the history will be shown. + Тарих + Жек + Қауіпсіздік ескертулерін көрсету + Қосымшаны өзгерту + Ағымдағы бет + Хабарлар арқылы бөлісу + Үй беті + Қолмен + Формадағы деректерді өшіру + Сей + Қаз + Бей + Ешқандай нәтиже табылмады + Журналды тазарту + Ақп + Failed to save Image + diff --git a/res/kor-KR.xml b/res/kor-KR.xml new file mode 100644 index 0000000..83ab635 --- /dev/null +++ b/res/kor-KR.xml @@ -0,0 +1,134 @@ + + + + 모두 선택 + 11월 + 자주 방문한 웹사이트 + Close all + 닫기 + 글자 크기 + 12월 + 이미 있는 북마크입니다 + 쿠키 허용 + 웹사이트 방문 기록을 삭제할까요? + 캐시에 저장된 컨텐츠와 데이터베이스를 삭제할까요? + 모든 쿠키 삭제 + 월 + 아니요 + 취소 + Twitter로 공유 + 지난 달 + 토 + 북마크가 추가되었습니다 + 북마크에 추가 + 항상 묻기 + 빈 페이지 + 6월 + 자동 + 7월 + 복사 + 비밀번호 저장 + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + 양식 데이터 + 4월 + Edit Folder + 5월 + 페이지 내에서 검색 + 이미지 복사 + 삭제되었습니다 + 3월 + Yahoo + 검색 엔진 + 검색 + 공유 + URL을 검색하거나 입력하세요 + No Recently Visited Sites. + 사진 공유 + 삭제 + 모든 쿠키를 삭제할까요? + 북마크가 없습니다 + 수 + 기록이 없습니다 + 1월 + 웹사이트 설정 + 개인정보 보호 및 보안 + 완료 + 멀티윈도우 + Earlier this month + 쿠키 + 기본 화면 + 9월 + 비밀번호 + 8월 + 페이지 컨텐츠 설정 + 읽을 수 있는 크기 + 비밀번호 삭제 + 붙여넣기 + 이미지 저장 + Naver + 양식 데이터 저장 + 편집 + 인터넷 + 이미지 보기 + 오늘 + 단어 선택 + 어제 + 제목 + 사용자 홈페이지 + 너비에 맞추기 + 단일 선택 + 밝기 + 설정 + 캐시 삭제 + about: blank + 폴더 추가 + 북마크 + 이미지 보기 + 이메일을 통해 공유 + 자바 스크립트 실행 + 기본값으로 초기화 + 북마크 이름을 입력하세요 + 위치 + 마지막 주 + Facebook으로 공유 + 폴더 + 새 폴더 + 북마크가 삭제되었습니다 + Reset all settings to default? + 저장 + 새 창 + 위치 정보 사용 + 추가 + 금 + 팝업 차단 + 예 + URL + 개인정보 보호 + 위치 정보 삭제 + %d주 전 + 북마크 + 주소가 바르지 않습니다 + No History \nAfter you load pages, the history will be shown. + 기록 + 일 + 보안 경고 보기 + 북마크 편집 + 현재 페이지 + 메시지로 공유합니다 + 홈페이지 + 수동 + 양식 데이터 삭제 + 화 + 10월 + 목 + 검색 결과가 없습니다 + 기록 삭제 + 2월 + Failed to save Image + diff --git a/res/lav-LV.xml b/res/lav-LV.xml new file mode 100644 index 0000000..76b2150 --- /dev/null +++ b/res/lav-LV.xml @@ -0,0 +1,134 @@ + + + + Izv. visu + Nov. + Biežāk apmeklētās vietnes + Close all + Aizvērt + Fonta lielums + Dec. + Grāmatzīme jau pastāv + Pieņemt sīkfailus + Vai dzēst pārlūka vēsturi? + Vai dzēst vietējās kešatmiņas saturu un datu bāzes? + Notīrīt visus sīkfailu datus + Pr. + Nē + Atcelt + Koplietot, izmantojot Twitter + Pagājušais mēnesis + Se. + Pievienota grāmatzīme + Pievienot grāmatzīmēm + Jautāt vienmēr + Tukša lapa + Jūn. + Automātiski + Jūl. + Kopēt + Atcerēties paroles + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Veidlapas dati + Apr. + Edit Folder + Maijs + Meklēt lapā + Kopēt attēlu + Izdzēsts + Mar. + Yahoo + Meklētājprogramma + Meklēt + Koplietot + Meklējiet vai ievadiet vietrādi URL + No Recently Visited Sites. + Kopl. attēlu + Dzēst + Vai izdzēst visus sīkfailus? + Nav grāmatzīmes + Tr. + Nav vēstures + Jan. + Tīmekļa vietnes iestatījumi + Konfidencialitāte un drošība + Gatavs + Vairāki logi + Earlier this month + Sīkfaili + Noklusējuma skats + Sep. + Parole + Aug. + Lapas satura iestatījumi + Lasāma + Notīrīt paroles + Ielīmēt + Saglabāt attēlu + Naver + Iegaumēt veidlapas datus + Rediģēt + Internets + Rādīt attēlus + Šodien + Izv. vārdu + Vakar + Nosaukums + Lietotāja sākumlapa + Pielāgot platumam + Izvēlēts + Spilgtums + Iestatījumi + Iztīrīt kešatmiņu + about: blank + Izveidot mapi + Grāmatzīmes + Skatīt attēlu + Koplietot, izmantojot e-pastu + Palaist JavaScript + Atjaunot noklusējumu + Ievadiet grāmatzīmes nosaukumu + Atrašanās vieta + Pēdējā nedēļa + Koplietot, izmantojot Facebook + Mape + Jauna mape + Grāmatzīme noņemta + Reset all settings to default? + Saglabāt + Jauns logs + Aktivizēt atrašanās vietu + Pievienot + Pk. + Bloķēt uznirstošos logus + Jā + URL + Konfidencialitāte + Notīrīt atrašanās vietas piekļuvi + Pirms %d nedēļām + Grāmatzīme + Nederīga adrese + No History \nAfter you load pages, the history will be shown. + Vēsture + Sv. + Rādīt drošības brīdinājumus + Rediģēt grāmatzīmi + Pašreizējā lapa + Koplietošana, izmantojot Ziņas + Mājas lapa + Manuāli + Notīrīt veidlapas datus + Ot. + Okt. + Ce. + Nav atrasts neviens rezultāts + Nodzēst vēsturi + Feb. + Failed to save Image + diff --git a/res/lit-LT.xml b/res/lit-LT.xml new file mode 100644 index 0000000..4f714fb --- /dev/null +++ b/res/lit-LT.xml @@ -0,0 +1,134 @@ + + + + Pasirinkti viską + Lap. + Dažniausiai lankomos svetainės + Close all + Uždaryti + Šrifto dydis + Gru. + Adresyno įrašas jau yra + Priimti slapukus + Trinti naršyklės istoriją? + Ištrinti įrenginyje saugomą turinį ir duomenų bazes? + Pašalinti visus slapukų duomenis + Pir. + Ne + Atšaukti + Bendrinti per „Twitter“ + Paskutinis mėnuo + Šeš. + Žymelė pridėta + Pridėti prie adresyno įrašų + Visada klausti + Tuščias puslapis + Bir. + Automatinis + Lie. + Kopijuoti + Prisiminti slaptažodžius + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Formos duomenys + Bal. + Edit Folder + Geg. + Iešk. puslapyje + Kopijuoti vaizdą + Ištrinta + Kov. + Yahoo + Paieškos sistema + Ieškoti + Dalytis + Ieškoti arba įvesti URL + No Recently Visited Sites. + Bendr. vaizdą + Trinti + Ištrinti visus slapukus? + Žymeklių nėra + Tre. + Istorijos nėra + Sau. + Svetainės nustatymai + Privatumas ir sauga + Atlikta + Keli langai + Earlier this month + Slapukai + Numatytasis vaizdas + Rug. + Slaptažodis + Rgp. + Puslapio turinio nustat. + Nuskaitoma + Išvalyti slaptažodžius + Įklijuoti + Išsaugoti vaizdą + Naver + Prisiminti formos duomenis + Redaguoti + Internetas + Rodyti vaizdus + Šiandien + Pasirinkite žodį + Vakar + Pavadinimas + Pagrindinis naudotojo puslapis + Pritaikyti pagal plotį + Pasirinkta + Ryškumas + Nustat. + Valyti talpyklą + about: blank + Kurti aplanką + Žymelės + Žiūrėti pav. + Bendrinti per el. paštą + Vykdyti „JavaScript“ + Nustatyti į numatytąjį + Čia įveskite žymeklio pavadinimą + Vieta + Praėjusią savaitę + Bendrinti per „Facebook“ + Aplankas + Naujas aplankas + Adresyno įrašas pašalintas + Reset all settings to default? + Išsaugoti + Naujas langas + Įjungti vietą + Pridėti + Pen. + Blokuoti iškylančiuosius lang. + Taip + URL + Privatumas + Ištrinti vietos prieigą + Prieš %d sav. + Adresyno įrašas + Neteisingas adresas + No History \nAfter you load pages, the history will be shown. + Istorija + Sek. + Rodyti apsaugos įspėjimus + Redaguoti žymelę + Dabartinis puslpais + Bendrinti per žinutes + Pradinis puslapis + Rankinis + Išvalyti formos duomenis + Ant. + Spal. + Ket. + Rezultatų nerasta + Išvalyti istoriją + Vas. + Failed to save Image + diff --git a/res/mkd-MK.xml b/res/mkd-MK.xml new file mode 100644 index 0000000..d47fcbe --- /dev/null +++ b/res/mkd-MK.xml @@ -0,0 +1,134 @@ + + + + Избери ги сите + Ное. + Најпосетувани сајтови + Close all + Затвори + Големина на букви + Дек. + Омилената страница веќе постои + Прифаќај колачиња + Да се избрише историјата на прегледникот? + Да се избрише локално кешираната содржина и бази? + Избриши ги сите податоци за колачињата + Пон + Не + Откажи + Сподели преку Twitter + Последниот месец + Саб + Омилената страница е додадена + Додај во Омилени + Прашувај секогаш + Празна страница + Јун + Автоматски + Јул + Копирај + Памети лозинки + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Податоци за формулари + Апр + Edit Folder + Мај + Најди на стр. + Копирај слика + Избришано + Март + Yahoo + Пребарувач + Побарај + Сподели + Пребарајте или внесете URL + No Recently Visited Sites. + Сподели слика + Избр. + Избриши сите колачиња? + Нема сочувани страници + Сре + Нема истории + Јан + Опции за сајт + Приватност и безбеднсот + Готово + Повеќе прозорци + Earlier this month + Колачиња + Основен преглед + Сеп + Лозинка + Авг + Опции за содрж. на стр. + Читливо + Избриши ги лозинките + Пресликај + Меморирај слика + Naver + Запомни податоци за формулар + Измени + Интернет + Прикажи слики + Денес + Изберете збор + Вчера + Наслов + Корисничка почетна страница + На цела широчина + Избраните + Светлина + Опции + Избриши кеш-меморија + about: blank + Нова папка + Сочувани адреси + Види слика + Подели преку email + Активирај JavaScript + Ресетирај на основните вредности + Внесете име на омилената страница + Локација + Последна седмица + Сподели преку Facebook + Папка + Нова папка + Омилената страница е отстранета + Reset all settings to default? + Сочувај + Нов прозорец + Овозможи локација + Додај + Пет + Блокирај појавни прозорци + Да + URL + Доверливо + Избриши пристап кон локација + Пред %d недели + Омилена страница + Неправилна адреса + No History \nAfter you load pages, the history will be shown. + Историја + Нед + Прикажи безбедносни предупредувања + Измени омилена стр. + Тековна страница + Сподели преку Пораки + Почетна стр. + Рачно + Избриши податоци за формулари + Вто + Окт. + Чет + Нема резултати + Избриши историја + Фев + Failed to save Image + diff --git a/res/nld-NL.xml b/res/nld-NL.xml new file mode 100644 index 0000000..4f9d4fd --- /dev/null +++ b/res/nld-NL.xml @@ -0,0 +1,134 @@ + + + + Alles selecteren + nov + Meest bezochte sites + Close all + Sluiten + Tekstgrootte + dec + Favoriet bestaat al + Cookies accepteren + Browsergeschiedenis verwijderen? + Inhoud in lokale cache en databases verwijderen? + Alle cookiegegevens wissen + MA + Nee + Annuleren + Delen via Twitter + Vorige maand + ZA + Favoriet toegevoegd + Toevoegen aan Favorieten + Altijd vragen + Lege pagina + jun + Automatisch + jul + Kopiëren + Wachtwoorden onthouden + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Formuliergegevens + apr + Edit Folder + Mei + Zoek op pagina + Afbeelding kopiëren + Verwijderd + mrt + Yahoo + Zoekmachine + Zoeken + Delen + URL zoeken of ingeven + No Recently Visited Sites. + Afbld. delen + Wissen + Alle cookies wissen? + Geen favorieten + WO + Geen geschiedenis + jan + Website-instellingen + Privacy en beveiliging + Gereed + Multi window + Earlier this month + Cookies + Standaardweergave + sep + Wachtwoord + aug + Instellingen pagina-inhoud + Leesbaar + Wachtwoorden wissen + Plakken + Afbeelding opslaan + Naver + Formuliergegevens onthouden + Bewerken + Internet + Afbeeldingen weergeven + Vandaag + Woord selecteren + Gisteren + Titel + Startpagina gebruiker + Passend in breedte + Geselecteerd + Helderheid + Instellingen + Buffer leegmaken + about: blank + Map maken + Favorieten + Afbeelding bekijken + Delen via e-mail + JavaScript uitvoeren + Standaardinstellingen + Geef naam favoriet in + Locatie + Laatste week + Delen via Facebook + Map + Nieuwe map + Favoriet verwijderd + Reset all settings to default? + Opslaan + Nieuw venster + Locatie activeren + Toevoegen + VR + Pop-ups blokkeren + Ja + URL + Privacy + Toegang tot locatie wissen + %d weken geleden + Favorieten + Ongeldig adres + No History \nAfter you load pages, the history will be shown. + Geschiedenis + ZO + Beveiligingswaarschuwingen weergeven + Favoriet bewerken + Huidige pagina + Delen via Berichten + Startpagina + Handmatig + Formuliergegevens wissen + DI + okt + DO + Geen resultaten gevonden + Geschiedenis wissen + feb + Failed to save Image + diff --git a/res/nob-NO.xml b/res/nob-NO.xml new file mode 100644 index 0000000..5f60817 --- /dev/null +++ b/res/nob-NO.xml @@ -0,0 +1,134 @@ + + + + Merk alt + Nov. + Mest besøkte sider + Close all + Lukk + Skriftstørrelse + Des. + Bokmerket finnes allerede + Godta informasjonskapsler + Slette nettleserhistorikk? + Slette lokalt bufret innhold og databaser? + Tøm alle informasjonskapseldata + Man + Nei + Avbryt + Del via Twitter + Forrige måned + Lør + Bokmerke lagt til + Legg til i Bokmerker + Spør alltid + Tom side + Juni + Auto + Juli + Kopier + Husk passord + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Skjemadata + Apr. + Edit Folder + Mai + Finn på side + Kopier bilde + Slettet + Mars + Yahoo + Søkemotor + Søk + Del + Søk eller angi URL + No Recently Visited Sites. + Del bilde + Slett + Slette alle informasjonskapsler? + Ingen bokmerker + Ons + Ingen poster + Jan. + Innstillinger for webområde + Personvern og sikkerhet + Utført + Flervindu + Earlier this month + Informasjonskapsler + Standard visning + Sep. + Passord + Aug. + Innst. for sideinnhold + Lesbar + Tøm passord + Lim inn + Lagre bilde + Naver + Husk skjemadata + Rediger + Internett + Vis bilder + I dag + Velg ord + I går + Tittel + Brukerangitt hjemmeside + Tilpass til bredde + Valgt + Lysstyrke + Innstillinger + Tøm mellomlager + about: blank + Lag mappe + Bokmerker + Vis bilde + Del via e-post + Kjør Java-skript + Tilbakestill til standard + Angi bokmerkenavn + Sted + Siste uke + Del via Facebook + Mappe + Ny mappe + Bokmerke fjernet + Reset all settings to default? + Lagre + Nytt vindu + Aktiver plassering + Legg til + Fre + Blokker popups + Ja + URL + Personvern + Fjern plasseringstilgang + %d uker siden + Bokmerke + Ugyldig adresse + No History \nAfter you load pages, the history will be shown. + Historikk + Søn + Vis sikkerhetsvarsler + Rediger bokmerke + Gjeldende side + Del via Meldinger + Startside + Manuelt + Tøm skjemadata + Tir + Okt. + Tor + Fant ingen resultater + Tøm logg + Feb. + Failed to save Image + diff --git a/res/pol-PL.xml b/res/pol-PL.xml new file mode 100644 index 0000000..333e847 --- /dev/null +++ b/res/pol-PL.xml @@ -0,0 +1,134 @@ + + + + Zaznacz wszystko + Lis. + Najczęściej odwiedzane witryny + Close all + Zamknij + Rozmiar czcionki + Gru. + Zakładka już istnieje + Odbiór plików cookie + Usunąć historię przeglądania? + Usunąć zawartość lokalnej pamięci podręcznej oraz bazy danych? + Usuń wszystkie pliki cookie + Pn + Nie + Anuluj + Udostępnij przez Twitter + Ostatni miesiąc + So + Zakładka została dodana + Dodaj do zakładek + Zawsze pytaj + Pusta strona + Cze. + Automatyczny + Lip. + Kopiuj + Pamiętaj hasła + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Dane formularzy + Kwi. + Edit Folder + Maj + Znajdź na str. + Skopiuj obraz + Usunięto + Mar. + Yahoo + Wyszukiwarka + Szukaj + Udostępnij + Wyszukaj lub wprowadź adres URL + No Recently Visited Sites. + Udost. obraz + Usuń + Usunąć wszystkie pliki cookie? + Brak zakładek + Śr + Brak historii + Sty. + Ustawienia witryn internetowych + Prywatność i bezpieczeństwo + Gotowe + Wiele okien + Earlier this month + Pliki cookie + Widok domyślny + Wrz. + Hasło + Sie. + Ust. zawartości strony + Można odczytać + Wyczyść hasła + Wklej + Zapisz obraz + Naver + Zapamiętaj dane formularza + Edytuj + Internet + Wyświetl obrazy + Dzisiaj + Wybierz słowo + Wczoraj + Tytuł + Strona główna użytkownika + Dopasuj do szerokości + Wybrany + Jasność + Ustawienia + Wyczyść cache + about: blank + Utwórz katalog + Zakładki + Wyświetl obraz + Udostępnij poprzez wiadomość email + Uruchom JavaScript + Przywróć domyślne + Wprowadź nazwę zakładki + Miejsce + Ostatni tydzień + Udostępnij przez Facebook + Katalog + Nowy katalog + Usunięto zakładkę + Reset all settings to default? + Zapisz + Nowe okno + Włącz lokalizację + Dodaj + Pt + Blokuj wyskakujące okna + Tak + Adres URL + Prywatność + Wyczyść dostęp do lokalizacji + %d tyg. temu + Zakładka + Nieprawidłowy adres + No History \nAfter you load pages, the history will be shown. + Historia + Nd + Ostrzeżenia zabezpieczeń + Edytuj zakładkę + Bieżąca strona + Udostępnij w wiadomości + Strona domowa + Ręcznie + Wyczyść dane formularza + Wt + Paź. + Cz + Nie znaleziono wyników + Wyczyść historię + Lut. + Failed to save Image + diff --git a/res/por-BR.xml b/res/por-BR.xml new file mode 100644 index 0000000..d321e75 --- /dev/null +++ b/res/por-BR.xml @@ -0,0 +1,134 @@ + + + + Selecionar tudo + Nov. + Sites mais visitados + Close all + Fechar + Tamanho de fonte + Dez. + O indicador já existe + Aceitar cookies + Excluir histórico do navegador? + Excluir conteúdo em cache local e bancos de dados? + Limpar todos os dados de cookies + Seg + Não + Cancelar + Compartilhar via Twitter + Mês passado + Sáb + Favorito adicionado + Adicionar aos Favoritos + Perguntar sempre + Página em branco + Jun. + Automático + Jul. + Copiar + Lembrar senhas + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Dados do formulário + Abr. + Edit Folder + Maio + Encontrar na página + Copiar imagem + Apagado + Mar. + Yahoo + Mecanismo de pesquisa + Pesquisar + Compartilhar + Procurar ou inserir URL + No Recently Visited Sites. + Compartilhar imagem + Apagar + Apagar todos os cookies? + Sem favoritos + Qua + Nenhum histórico + Jan. + Configurações de site da Internet + Privacidade e segurança + Concluído + Multi janela + Earlier this month + Cookies + Vista padrão + Set. + Senha + Ago. + Def. conteúdo de página + Legível + Limpar senhas + Colar + Salvar imagem + Naver + Lembrar dados de formulário + Editar + Internet + Exibir imagens + Hoje + Selecionar palavra + Ontem + Título + Página inicial do usuário + Ajustar à largura + Selecionado + Brilho + Configurações + Excluir cache + about: blank + Criar pasta + Favoritos + Ver imagem + Compartilhar via e-mail + Executar JavaScript + Restaurar padrão + Inserir nome do favorito + Local + Última semana + Compartilhar via Facebook + Pasta + Nova pasta + Marcador removido + Reset all settings to default? + Salvar + Nova janela + Ativar localização + Adicionar + Sex + Bloquear pop-ups + Sim + URL + Privacidade + Limpar acesso à localização + há %d semanas + Favoritos + Endereço inválido + No History \nAfter you load pages, the history will be shown. + Histórico + Dom + Exibir avisos de segurança + Editar favorito + Página atual + Compartilhar via Mensagens + Página inicial + Manual + Limpar dados de formulário + Ter + Out. + Qui + Nenhum resultado encontrado + Limpar histórico + Fev. + Failed to save Image + diff --git a/res/por-PT.xml b/res/por-PT.xml new file mode 100644 index 0000000..c269c0b --- /dev/null +++ b/res/por-PT.xml @@ -0,0 +1,134 @@ + + + + Selec. tudo + Nov. + Sites mais visitados + Close all + Fechar + Tamanho da fonte + Dez. + Favorito já existe + Aceitar cookies + Eliminar o histórico do browser? + Eliminar conteúdo na memória cache local e bases de dados? + Limpar todos os dados de cookies + Seg. + Não + Cancelar + Partilhar via Twitter + Mês passado + Sáb. + Favorito adicionado + Adicionar aos Favoritos + Perguntar sempre + Página em branco + Jun. + Automático + Jul. + Copiar + Lembrar palavras-passe + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Dados do formulário + Abr. + Edit Folder + Maio + Local. na pág. + Copiar imagem + Eliminado + Mar. + Yahoo + Motor de pesquisa + Procurar + Partilhar + Procurar ou introduzir URL + No Recently Visited Sites. + Part. imagem + Eliminar + Eliminar todos os cookies? + Nenhum favorito + Qua. + Nenhuns históricos + Jan. + Definições de site da Web + Privacidade e segurança + Concluído + Multi Janela + Earlier this month + Cookies + Vista padrão + Set. + Palavra-passe + Ago. + Def. conteúdo de página + Legível + Limpar palavras-passe + Colar + Guardar imagem + Naver + Lembrar dados de formulário + Editar + Internet + Visualizar imagens + Hoje + Selec. palavra + Ontem + Título + Página inicial do utilizador + Ajustar à largura + Seleccionado + Brilho + Definições + Limpar cache + about: blank + Criar pasta + Favoritos + Ver imagem + Partilhar via e-mail + Executar JavaScript + Repor padrão + Introduzir nome do favorito + Localização + Última semana + Partilhar via Facebook + Pasta + Nova pasta + Favorito removido + Reset all settings to default? + Guardar + Nova janela + Activar localização + Adicionar + Sex. + Bloquear janelas de contexto + Sim + URL + Privacidade + Limpar acesso à localização + há %d semanas + Favorito + Endereço inválido + No History \nAfter you load pages, the history will be shown. + Histórico + Dom. + Mostrar avisos de segurança + Editar favoritos + Página actual + Partilhar via Mensagens + Página inicial + Manual + Limpar dados de formulário + Ter. + Out. + Qui. + Nenhuns resultados encontrados + Limpar histórico + Fev. + Failed to save Image + diff --git a/res/ron-RO.xml b/res/ron-RO.xml new file mode 100644 index 0000000..60f8f8c --- /dev/null +++ b/res/ron-RO.xml @@ -0,0 +1,134 @@ + + + + Selectare toate + Nov + Site-urile cele mai vizitate + Close all + Închidere + Dimensiune font + Dec + Marcajul există deja + Acceptare module cookie + Ştergeţi istoricul browserului? + Ştergeţi conţinutul stocat în memoria cache la nivel local şi bazele de date? + Ştergere integrală date module cookie + Lun + Nu + Anulare + Partajare prin Twitter + Luna trecută + Sâm + Marcaj adăugat + Adăugare la Marcaje + Se întreabă întotdeauna + Pagină goală + Iun + Automat + Iul + Copiere + Memorare parole + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Date formular + Apr + Edit Folder + Mai + Găsire în pag. + Copiere imagine + Şters + Mar + Yahoo + Motor de căutare + Căutare + Partajare + Căutaţi sau introduceţi adresa URL + No Recently Visited Sites. + Partaj. imag. + Şter. + Ştergeţi toate modulele cookie? + Niciun marcaj + Mie + Niciun istoric + Ian + Setări pentru site-uri web + Confidenţialitate şi securitate + Gata + Ferestre + Earlier this month + Module cookie + Vizualizare implicită + Sep + Parolă + Aug + Setări conţinut pagină + Lizibil + Ştergere parole + Lipire + Salvare imagine + Naver + Memorare date formular + Editare + Internet + Afişare imagini + Azi + Selectaţi un cuvânt + Ieri + Titlu + Pagina de pornire a utilizatorului + Încadrare pe lăţime + Selectat + Luminozitate + Setări + Ştergere cache + about: blank + Creare folder + Marcaje + Viz. imagine + Partajare prin e-mail + Executare JavaScript + Reiniţializare la valori implicite + Introduceţi numele marcajului + Locaţie + Ultima săptămână + Partajare prin Facebook + Folder + Folder nou + Marcaj eliminat + Reset all settings to default? + Salvare + Fereastră nouă + Activare locaţie + Adaugă + Vin + Blocare ferestre de tip pop-up + Da + URL + Confidenţialitate + Autorizare acces la locaţie + Acum %d săptămâni + Marcaj + Adresă incorectă + No History \nAfter you load pages, the history will be shown. + Istoric + Dum + Afişare avertismente de securitate + Editare marcaj + Pagină actuală + Partajare prin Mesaje + Pagină de pornire + Manual + Ştergere date formular + Mar + Oct + Joi + Nu au fost găsite rezultate + Ştergere istoric + Feb + Failed to save Image + diff --git a/res/rus-RU.xml b/res/rus-RU.xml new file mode 100644 index 0000000..dfba50c --- /dev/null +++ b/res/rus-RU.xml @@ -0,0 +1,134 @@ + + + + Выбрать все + Ноя + Часто посещаемые сайты + Close all + Закрыть + Размер шрифта + Дек + Закладка уже существует + Разрешить cookies + Удалить журнал браузера? + Удалить локально кэшированное содержимое и базы данных? + Удалить cookies + Пн + Нет + Отмена + Отправить в Twitter + Последний месяц + Сб + Закладка добавлена + Добавить в Закладки + Всегда спрашивать + Пустая страница + Июн + Авто + Июл + Копировать + Сохранять пароли + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Данные формы + Апр + Edit Folder + Май + Найти на странице + Копировать изображение + Удалено + Мар + Yahoo + Поисковая система + Поиск + Поделиться + Выполните поиск или введите URL-адрес + No Recently Visited Sites. + Картинки + Удал. + Удалить все cookies? + Нет закладок + Ср + Нет журналов + Янв + Настройки веб-сайтов + Конфиденциальность и безопасность + Готово + Несколько окон + Earlier this month + Файлы Cookie + По умолчанию + Сен + Пароль + Авг + Параметры содерж.страницы + Для чтения + Очистить пароли + Вставить + Сохранить картинку + Naver + Сохранять данные форм + Изменить + Интернет + Показывать картинки + Сегодня + Выберите слово + Вчера + Название + Домашняя страница пользователя + По ширине + Выбрано + Яркость + Настройки + Очистить кэш + about: blank + Создать папку + Закладки + Просмотр картинки + Отправить по электронной почте + Выполнять JavaScript + Восстановить настройки по умолчанию + Введите имя закладки + Местоположение + Последняя неделя + Отправить в Facebook + Папка + Новая папка + Закладка удалена + Reset all settings to default? + Соxранить + Новое окно + Включить местоположение + Добавить + Пт + Блокировать всплыв. сообщения + Да + URL + Конфиденциальность + Удалить данные о местоположении + %d нед. назад + Закладка + Неверный адрес + No History \nAfter you load pages, the history will be shown. + Журнал + Вс + Предупреждать о безопасности + Редактировать закладку + Текущая страница + Отправить с помощью сообщения + Домашняя страница + Вручную + Очистить данные форм + Вт + Окт + Чт + Ничего не найдено + Очистить журнал + Фев + Failed to save Image + diff --git a/res/screen-density-xhigh/00_button_off.png b/res/screen-density-xhigh/00_button_off.png new file mode 100644 index 0000000..a87a8dc Binary files /dev/null and b/res/screen-density-xhigh/00_button_off.png differ diff --git a/res/screen-density-xhigh/00_button_on.png b/res/screen-density-xhigh/00_button_on.png new file mode 100644 index 0000000..43212d7 Binary files /dev/null and b/res/screen-density-xhigh/00_button_on.png differ diff --git a/res/screen-density-xhigh/00_button_radio.png b/res/screen-density-xhigh/00_button_radio.png new file mode 100644 index 0000000..83a1a54 Binary files /dev/null and b/res/screen-density-xhigh/00_button_radio.png differ diff --git a/res/screen-density-xhigh/00_button_radio_selected.png b/res/screen-density-xhigh/00_button_radio_selected.png new file mode 100644 index 0000000..7b00666 Binary files /dev/null and b/res/screen-density-xhigh/00_button_radio_selected.png differ diff --git a/res/screen-density-xhigh/00_button_sweep_delete.9.png b/res/screen-density-xhigh/00_button_sweep_delete.9.png new file mode 100644 index 0000000..ad7b154 Binary files /dev/null and b/res/screen-density-xhigh/00_button_sweep_delete.9.png differ diff --git a/res/screen-density-xhigh/00_button_sweep_delete_press.9.png b/res/screen-density-xhigh/00_button_sweep_delete_press.9.png new file mode 100644 index 0000000..e1015bf Binary files /dev/null and b/res/screen-density-xhigh/00_button_sweep_delete_press.9.png differ diff --git a/res/screen-density-xhigh/00_circle_button_Expand_closed.png b/res/screen-density-xhigh/00_circle_button_Expand_closed.png new file mode 100644 index 0000000..83e6762 Binary files /dev/null and b/res/screen-density-xhigh/00_circle_button_Expand_closed.png differ diff --git a/res/screen-density-xhigh/00_circle_button_Expand_open.png b/res/screen-density-xhigh/00_circle_button_Expand_open.png new file mode 100644 index 0000000..85e99f9 Binary files /dev/null and b/res/screen-density-xhigh/00_circle_button_Expand_open.png differ diff --git a/res/screen-density-xhigh/00_list_expand_closed_press.png b/res/screen-density-xhigh/00_list_expand_closed_press.png new file mode 100644 index 0000000..b421ad1 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_closed_press.png differ diff --git a/res/screen-density-xhigh/00_list_expand_opened_press.png b/res/screen-density-xhigh/00_list_expand_opened_press.png new file mode 100644 index 0000000..1b49c94 Binary files /dev/null and b/res/screen-density-xhigh/00_list_expand_opened_press.png differ diff --git a/res/screen-density-xhigh/1.png b/res/screen-density-xhigh/1.png new file mode 100644 index 0000000..2d731eb Binary files /dev/null and b/res/screen-density-xhigh/1.png differ diff --git a/res/screen-density-xhigh/2.png b/res/screen-density-xhigh/2.png new file mode 100644 index 0000000..32ff645 Binary files /dev/null and b/res/screen-density-xhigh/2.png differ diff --git a/res/screen-density-xhigh/3.png b/res/screen-density-xhigh/3.png new file mode 100644 index 0000000..8d74949 Binary files /dev/null and b/res/screen-density-xhigh/3.png differ diff --git a/res/screen-density-xhigh/4.png b/res/screen-density-xhigh/4.png new file mode 100644 index 0000000..66bc543 Binary files /dev/null and b/res/screen-density-xhigh/4.png differ diff --git a/res/screen-density-xhigh/5.png b/res/screen-density-xhigh/5.png new file mode 100644 index 0000000..f17bba0 Binary files /dev/null and b/res/screen-density-xhigh/5.png differ diff --git a/res/screen-density-xhigh/6.png b/res/screen-density-xhigh/6.png new file mode 100644 index 0000000..dce660a Binary files /dev/null and b/res/screen-density-xhigh/6.png differ diff --git a/res/screen-density-xhigh/7.png b/res/screen-density-xhigh/7.png new file mode 100644 index 0000000..427f171 Binary files /dev/null and b/res/screen-density-xhigh/7.png differ diff --git a/res/screen-density-xhigh/8.png b/res/screen-density-xhigh/8.png new file mode 100644 index 0000000..8c4467c Binary files /dev/null and b/res/screen-density-xhigh/8.png differ diff --git a/res/screen-density-xhigh/9.png b/res/screen-density-xhigh/9.png new file mode 100644 index 0000000..5a7719f Binary files /dev/null and b/res/screen-density-xhigh/9.png differ diff --git a/res/screen-density-xhigh/EditBackground.png b/res/screen-density-xhigh/EditBackground.png new file mode 100644 index 0000000..a6bcaa5 Binary files /dev/null and b/res/screen-density-xhigh/EditBackground.png differ diff --git a/res/screen-density-xhigh/I01_Nocontents_Bookmarks.png b/res/screen-density-xhigh/I01_Nocontents_Bookmarks.png new file mode 100644 index 0000000..f944b88 Binary files /dev/null and b/res/screen-density-xhigh/I01_Nocontents_Bookmarks.png differ diff --git a/res/screen-density-xhigh/I01_PlugIn_icon_Article_reader_temp.png b/res/screen-density-xhigh/I01_PlugIn_icon_Article_reader_temp.png new file mode 100644 index 0000000..3972451 Binary files /dev/null and b/res/screen-density-xhigh/I01_PlugIn_icon_Article_reader_temp.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_Play_disabled.png b/res/screen-density-xhigh/I01_controlbar_icon_Play_disabled.png new file mode 100644 index 0000000..8890d41 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_Play_disabled.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_Play_temp.png b/res/screen-density-xhigh/I01_controlbar_icon_Play_temp.png new file mode 100644 index 0000000..b1f9cdb Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_Play_temp.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_Play_temp_press.png b/res/screen-density-xhigh/I01_controlbar_icon_Play_temp_press.png new file mode 100644 index 0000000..af15370 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_Play_temp_press.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_backward_disabled.png b/res/screen-density-xhigh/I01_controlbar_icon_backward_disabled.png new file mode 100644 index 0000000..a7699aa Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_backward_disabled.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_backward_temp.png b/res/screen-density-xhigh/I01_controlbar_icon_backward_temp.png new file mode 100644 index 0000000..db67c90 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_backward_temp.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_backward_temp_press.png b/res/screen-density-xhigh/I01_controlbar_icon_backward_temp_press.png new file mode 100644 index 0000000..04b94f2 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_backward_temp_press.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_bookmark.png b/res/screen-density-xhigh/I01_controlbar_icon_bookmark.png new file mode 100644 index 0000000..5a9f522 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_bookmark.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_compose.png b/res/screen-density-xhigh/I01_controlbar_icon_compose.png new file mode 100644 index 0000000..11cdaf1 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_compose.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_compose_diabled.png b/res/screen-density-xhigh/I01_controlbar_icon_compose_diabled.png new file mode 100644 index 0000000..fb2ec22 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_compose_diabled.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_create.png b/res/screen-density-xhigh/I01_controlbar_icon_create.png new file mode 100644 index 0000000..1abbc98 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_create.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_create_disable.png b/res/screen-density-xhigh/I01_controlbar_icon_create_disable.png new file mode 100644 index 0000000..71ef71e Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_create_disable.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_create_folder.png b/res/screen-density-xhigh/I01_controlbar_icon_create_folder.png new file mode 100644 index 0000000..f3f1e37 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_create_folder.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_create_folder_diabled.png b/res/screen-density-xhigh/I01_controlbar_icon_create_folder_diabled.png new file mode 100644 index 0000000..c5019f1 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_create_folder_diabled.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_delete.png b/res/screen-density-xhigh/I01_controlbar_icon_delete.png new file mode 100644 index 0000000..4cd4551 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_delete.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_delete_disable.png b/res/screen-density-xhigh/I01_controlbar_icon_delete_disable.png new file mode 100644 index 0000000..82f0d06 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_delete_disable.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_more.png b/res/screen-density-xhigh/I01_controlbar_icon_more.png new file mode 100644 index 0000000..6e2fbd6 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_more.png differ diff --git a/res/screen-density-xhigh/I01_controlbar_icon_multiview.png b/res/screen-density-xhigh/I01_controlbar_icon_multiview.png new file mode 100644 index 0000000..a468f73 Binary files /dev/null and b/res/screen-density-xhigh/I01_controlbar_icon_multiview.png differ diff --git a/res/screen-density-xhigh/I01_field_btn_Clear.png b/res/screen-density-xhigh/I01_field_btn_Clear.png new file mode 100644 index 0000000..4431776 Binary files /dev/null and b/res/screen-density-xhigh/I01_field_btn_Clear.png differ diff --git a/res/screen-density-xhigh/I01_field_btn_Clear_temp.png b/res/screen-density-xhigh/I01_field_btn_Clear_temp.png new file mode 100644 index 0000000..af6d00f Binary files /dev/null and b/res/screen-density-xhigh/I01_field_btn_Clear_temp.png differ diff --git a/res/screen-density-xhigh/I01_fit_screen.png b/res/screen-density-xhigh/I01_fit_screen.png new file mode 100644 index 0000000..666ba6c Binary files /dev/null and b/res/screen-density-xhigh/I01_fit_screen.png differ diff --git a/res/screen-density-xhigh/I01_icon_Back.png b/res/screen-density-xhigh/I01_icon_Back.png new file mode 100644 index 0000000..e217a0a Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_Back.png differ diff --git a/res/screen-density-xhigh/I01_icon_Back_press.png b/res/screen-density-xhigh/I01_icon_Back_press.png new file mode 100644 index 0000000..344e209 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_Back_press.png differ diff --git a/res/screen-density-xhigh/I01_icon_bookmark_bg.png b/res/screen-density-xhigh/I01_icon_bookmark_bg.png new file mode 100644 index 0000000..adbbe6a Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_bookmark_bg.png differ diff --git a/res/screen-density-xhigh/I01_icon_bookmark_off_temp.png b/res/screen-density-xhigh/I01_icon_bookmark_off_temp.png new file mode 100644 index 0000000..93b0504 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_bookmark_off_temp.png differ diff --git a/res/screen-density-xhigh/I01_icon_bookmark_on_temp.png b/res/screen-density-xhigh/I01_icon_bookmark_on_temp.png new file mode 100644 index 0000000..396d49b Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_bookmark_on_temp.png differ diff --git a/res/screen-density-xhigh/I01_icon_default_favicon.png b/res/screen-density-xhigh/I01_icon_default_favicon.png new file mode 100644 index 0000000..f8301a3 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_default_favicon.png differ diff --git a/res/screen-density-xhigh/I01_icon_find word.png b/res/screen-density-xhigh/I01_icon_find word.png new file mode 100644 index 0000000..0054df5 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_find word.png differ diff --git a/res/screen-density-xhigh/I01_icon_folder_open.png b/res/screen-density-xhigh/I01_icon_folder_open.png new file mode 100644 index 0000000..c9567ce Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_folder_open.png differ diff --git a/res/screen-density-xhigh/I01_icon_more.png b/res/screen-density-xhigh/I01_icon_more.png new file mode 100644 index 0000000..49a6d06 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_more.png differ diff --git a/res/screen-density-xhigh/I01_icon_more_press.png b/res/screen-density-xhigh/I01_icon_more_press.png new file mode 100644 index 0000000..3a13509 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_more_press.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation.png b/res/screen-density-xhigh/I01_icon_page_navigation.png new file mode 100644 index 0000000..cdd413f Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_01.png b/res/screen-density-xhigh/I01_icon_page_navigation_01.png new file mode 100644 index 0000000..494b1df Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_01.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_02.png b/res/screen-density-xhigh/I01_icon_page_navigation_02.png new file mode 100644 index 0000000..85f11e4 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_02.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_03.png b/res/screen-density-xhigh/I01_icon_page_navigation_03.png new file mode 100644 index 0000000..f217d82 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_03.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_04.png b/res/screen-density-xhigh/I01_icon_page_navigation_04.png new file mode 100644 index 0000000..b2d7dc9 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_04.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_05.png b/res/screen-density-xhigh/I01_icon_page_navigation_05.png new file mode 100644 index 0000000..7545f21 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_05.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_06.png b/res/screen-density-xhigh/I01_icon_page_navigation_06.png new file mode 100644 index 0000000..47e260e Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_06.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_07.png b/res/screen-density-xhigh/I01_icon_page_navigation_07.png new file mode 100644 index 0000000..1557535 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_07.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_08.png b/res/screen-density-xhigh/I01_icon_page_navigation_08.png new file mode 100644 index 0000000..d017474 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_08.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_09.png b/res/screen-density-xhigh/I01_icon_page_navigation_09.png new file mode 100644 index 0000000..bf759d5 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_09.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_10.png b/res/screen-density-xhigh/I01_icon_page_navigation_10.png new file mode 100644 index 0000000..d762f4c Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_10.png differ diff --git a/res/screen-density-xhigh/I01_icon_page_navigation_bar.png b/res/screen-density-xhigh/I01_icon_page_navigation_bar.png new file mode 100644 index 0000000..e49b277 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_page_navigation_bar.png differ diff --git a/res/screen-density-xhigh/I01_icon_plus.png b/res/screen-density-xhigh/I01_icon_plus.png new file mode 100644 index 0000000..92da261 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_plus.png differ diff --git a/res/screen-density-xhigh/I01_icon_plus_press.png b/res/screen-density-xhigh/I01_icon_plus_press.png new file mode 100644 index 0000000..7ed6443 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_plus_press.png differ diff --git a/res/screen-density-xhigh/I01_icon_private.png b/res/screen-density-xhigh/I01_icon_private.png new file mode 100644 index 0000000..b238a73 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_private.png differ diff --git a/res/screen-density-xhigh/I01_icon_upper folder.png b/res/screen-density-xhigh/I01_icon_upper folder.png new file mode 100644 index 0000000..050c295 Binary files /dev/null and b/res/screen-density-xhigh/I01_icon_upper folder.png differ diff --git a/res/screen-density-xhigh/I01_popup_bg.9.png b/res/screen-density-xhigh/I01_popup_bg.9.png new file mode 100644 index 0000000..0f80f9b Binary files /dev/null and b/res/screen-density-xhigh/I01_popup_bg.9.png differ diff --git a/res/screen-density-xhigh/I01_popup_bottom_bg.9.png b/res/screen-density-xhigh/I01_popup_bottom_bg.9.png new file mode 100644 index 0000000..d74827f Binary files /dev/null and b/res/screen-density-xhigh/I01_popup_bottom_bg.9.png differ diff --git a/res/screen-density-xhigh/I01_right_arrow.png b/res/screen-density-xhigh/I01_right_arrow.png new file mode 100644 index 0000000..ceee3ba Binary files /dev/null and b/res/screen-density-xhigh/I01_right_arrow.png differ diff --git a/res/screen-density-xhigh/I01_search_icon.png b/res/screen-density-xhigh/I01_search_icon.png new file mode 100644 index 0000000..224056e Binary files /dev/null and b/res/screen-density-xhigh/I01_search_icon.png differ diff --git a/res/screen-density-xhigh/I01_search_icon_refresh.png b/res/screen-density-xhigh/I01_search_icon_refresh.png new file mode 100644 index 0000000..eb10036 Binary files /dev/null and b/res/screen-density-xhigh/I01_search_icon_refresh.png differ diff --git a/res/screen-density-xhigh/I01_search_icon_refresh_temp.png b/res/screen-density-xhigh/I01_search_icon_refresh_temp.png new file mode 100644 index 0000000..eb10036 Binary files /dev/null and b/res/screen-density-xhigh/I01_search_icon_refresh_temp.png differ diff --git a/res/screen-density-xhigh/I01_search_input_field_bg.9.png b/res/screen-density-xhigh/I01_search_input_field_bg.9.png new file mode 100644 index 0000000..49e8aef Binary files /dev/null and b/res/screen-density-xhigh/I01_search_input_field_bg.9.png differ diff --git a/res/screen-density-xhigh/I01_search_list_icon_favorite.png b/res/screen-density-xhigh/I01_search_list_icon_favorite.png new file mode 100644 index 0000000..8f45268 Binary files /dev/null and b/res/screen-density-xhigh/I01_search_list_icon_favorite.png differ diff --git a/res/screen-density-xhigh/I01_search_list_icon_favorite_press.png b/res/screen-density-xhigh/I01_search_list_icon_favorite_press.png new file mode 100644 index 0000000..599242d Binary files /dev/null and b/res/screen-density-xhigh/I01_search_list_icon_favorite_press.png differ diff --git a/res/screen-density-xhigh/I01_tab_icon_bookmarks.png b/res/screen-density-xhigh/I01_tab_icon_bookmarks.png new file mode 100644 index 0000000..4d91a66 Binary files /dev/null and b/res/screen-density-xhigh/I01_tab_icon_bookmarks.png differ diff --git a/res/screen-density-xhigh/I01_tab_icon_history.png b/res/screen-density-xhigh/I01_tab_icon_history.png new file mode 100644 index 0000000..bcee66e Binary files /dev/null and b/res/screen-density-xhigh/I01_tab_icon_history.png differ diff --git a/res/screen-density-xhigh/I01_title_btn.9.png b/res/screen-density-xhigh/I01_title_btn.9.png new file mode 100644 index 0000000..8af2911 Binary files /dev/null and b/res/screen-density-xhigh/I01_title_btn.9.png differ diff --git a/res/screen-density-xhigh/I01_title_btn_icon_down.png b/res/screen-density-xhigh/I01_title_btn_icon_down.png new file mode 100644 index 0000000..2a393b3 Binary files /dev/null and b/res/screen-density-xhigh/I01_title_btn_icon_down.png differ diff --git a/res/screen-density-xhigh/I01_title_btn_icon_down_disabled.png b/res/screen-density-xhigh/I01_title_btn_icon_down_disabled.png new file mode 100644 index 0000000..f7e091a Binary files /dev/null and b/res/screen-density-xhigh/I01_title_btn_icon_down_disabled.png differ diff --git a/res/screen-density-xhigh/I01_title_btn_icon_up.png b/res/screen-density-xhigh/I01_title_btn_icon_up.png new file mode 100644 index 0000000..38fed5b Binary files /dev/null and b/res/screen-density-xhigh/I01_title_btn_icon_up.png differ diff --git a/res/screen-density-xhigh/I01_title_btn_icon_up_disabled.png b/res/screen-density-xhigh/I01_title_btn_icon_up_disabled.png new file mode 100644 index 0000000..7b43e96 Binary files /dev/null and b/res/screen-density-xhigh/I01_title_btn_icon_up_disabled.png differ diff --git a/res/screen-density-xhigh/I01_title_btn_press.9.png b/res/screen-density-xhigh/I01_title_btn_press.9.png new file mode 100644 index 0000000..753b7b2 Binary files /dev/null and b/res/screen-density-xhigh/I01_title_btn_press.9.png differ diff --git a/res/screen-density-xhigh/I01_title_progress_bar.png b/res/screen-density-xhigh/I01_title_progress_bar.png new file mode 100644 index 0000000..4250944 Binary files /dev/null and b/res/screen-density-xhigh/I01_title_progress_bar.png differ diff --git a/res/screen-density-xhigh/I01_title_progress_bar_bg.png b/res/screen-density-xhigh/I01_title_progress_bar_bg.png new file mode 100644 index 0000000..fef3aab Binary files /dev/null and b/res/screen-density-xhigh/I01_title_progress_bar_bg.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_bg_01.png b/res/screen-density-xhigh/I01_toolbar_bg_01.png new file mode 100644 index 0000000..dd42229 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_bg_01.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_bg_02.png b/res/screen-density-xhigh/I01_toolbar_bg_02.png new file mode 100644 index 0000000..7c0c02e Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_bg_02.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_bg_h.png b/res/screen-density-xhigh/I01_toolbar_bg_h.png new file mode 100644 index 0000000..81650d0 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_bg_h.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_01.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_01.png new file mode 100644 index 0000000..8c8a466 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_01.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_01_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_01_press.png new file mode 100644 index 0000000..a41bc96 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_01_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_02.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_02.png new file mode 100644 index 0000000..5916584 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_02.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_02_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_02_press.png new file mode 100644 index 0000000..f92c5a8 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_02_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_03.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_03.png new file mode 100644 index 0000000..ffc4281 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_03.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_03_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_03_press.png new file mode 100644 index 0000000..9ba95d6 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_03_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_04.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_04.png new file mode 100644 index 0000000..d69f799 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_04.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_04_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_04_press.png new file mode 100644 index 0000000..80fc18d Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_04_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_05.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_05.png new file mode 100644 index 0000000..2dd80e6 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_05.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_05_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_05_press.png new file mode 100644 index 0000000..e931c3e Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_05_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_06.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_06.png new file mode 100644 index 0000000..85f9079 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_06.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_06_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_06_press.png new file mode 100644 index 0000000..d18ab68 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_06_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_07.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_07.png new file mode 100644 index 0000000..09e822d Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_07.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_07_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_07_press.png new file mode 100644 index 0000000..504af6b Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_07_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_08.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_08.png new file mode 100644 index 0000000..f7196b7 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_08.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_08_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_08_press.png new file mode 100644 index 0000000..f8a53dd Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_08_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_09.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_09.png new file mode 100644 index 0000000..8cade2c Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_09.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_09_press.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_09_press.png new file mode 100644 index 0000000..fdf6632 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_09_press.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_empty.png b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_empty.png new file mode 100644 index 0000000..87a8580 Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_icon_windows_manager_empty.png differ diff --git a/res/screen-density-xhigh/I01_toolbar_input_field.9.png b/res/screen-density-xhigh/I01_toolbar_input_field.9.png new file mode 100644 index 0000000..fac478d Binary files /dev/null and b/res/screen-density-xhigh/I01_toolbar_input_field.9.png differ diff --git a/res/screen-density-xhigh/ListIcon.png b/res/screen-density-xhigh/ListIcon.png new file mode 100644 index 0000000..c1e42b8 Binary files /dev/null and b/res/screen-density-xhigh/ListIcon.png differ diff --git a/res/screen-density-xhigh/ListLeftSide.png b/res/screen-density-xhigh/ListLeftSide.png new file mode 100644 index 0000000..4866dd0 Binary files /dev/null and b/res/screen-density-xhigh/ListLeftSide.png differ diff --git a/res/screen-density-xhigh/Thumbs.db b/res/screen-density-xhigh/Thumbs.db new file mode 100644 index 0000000..66412b3 Binary files /dev/null and b/res/screen-density-xhigh/Thumbs.db differ diff --git a/res/screen-density-xhigh/deleteIcon.png b/res/screen-density-xhigh/deleteIcon.png new file mode 100644 index 0000000..6ff16c7 Binary files /dev/null and b/res/screen-density-xhigh/deleteIcon.png differ diff --git a/res/screen-density-xhigh/edit_item.png b/res/screen-density-xhigh/edit_item.png new file mode 100644 index 0000000..67b4c33 Binary files /dev/null and b/res/screen-density-xhigh/edit_item.png differ diff --git a/res/screen-density-xhigh/opennewwindow.png b/res/screen-density-xhigh/opennewwindow.png new file mode 100644 index 0000000..fdd7dcf Binary files /dev/null and b/res/screen-density-xhigh/opennewwindow.png differ diff --git a/res/screen-density-xhigh/private_on.png b/res/screen-density-xhigh/private_on.png new file mode 100644 index 0000000..15d444b Binary files /dev/null and b/res/screen-density-xhigh/private_on.png differ diff --git a/res/screen-size-normal/IDL_ADDRESSBAR.xml b/res/screen-size-normal/IDL_ADDRESSBAR.xml new file mode 100644 index 0000000..38ff4a1 --- /dev/null +++ b/res/screen-size-normal/IDL_ADDRESSBAR.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_ADD_BOOKMARK.xml b/res/screen-size-normal/IDL_ADD_BOOKMARK.xml new file mode 100644 index 0000000..0dd9f5c --- /dev/null +++ b/res/screen-size-normal/IDL_ADD_BOOKMARK.xml @@ -0,0 +1,77 @@ + + + + + 720 +
+ + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/res/screen-size-normal/IDL_ARTICLE_READER.xml b/res/screen-size-normal/IDL_ARTICLE_READER.xml new file mode 100644 index 0000000..73f303b --- /dev/null +++ b/res/screen-size-normal/IDL_ARTICLE_READER.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_BLANK_PANEL.xml b/res/screen-size-normal/IDL_BLANK_PANEL.xml new file mode 100644 index 0000000..3a60f45 --- /dev/null +++ b/res/screen-size-normal/IDL_BLANK_PANEL.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_BOOKMARK_LIST.xml b/res/screen-size-normal/IDL_BOOKMARK_LIST.xml new file mode 100644 index 0000000..a27dc33 --- /dev/null +++ b/res/screen-size-normal/IDL_BOOKMARK_LIST.xml @@ -0,0 +1,35 @@ + + + + + 480 +
+ + + + +
+ + + + + + +
+
+ + +
+ + + + + + + + + + +
diff --git a/res/screen-size-normal/IDL_BRIGHTNESS.xml b/res/screen-size-normal/IDL_BRIGHTNESS.xml new file mode 100644 index 0000000..ad6025d --- /dev/null +++ b/res/screen-size-normal/IDL_BRIGHTNESS.xml @@ -0,0 +1,34 @@ + + + + + 720 +
+ + + + +
+ + + + + +
+
+ + +
+ + + + + + +
diff --git a/res/screen-size-normal/IDL_CONFIRMATION_POPUP.xml b/res/screen-size-normal/IDL_CONFIRMATION_POPUP.xml new file mode 100644 index 0000000..e66e1e2 --- /dev/null +++ b/res/screen-size-normal/IDL_CONFIRMATION_POPUP.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_CREATE_BOOKMARK_FOLDER.xml b/res/screen-size-normal/IDL_CREATE_BOOKMARK_FOLDER.xml new file mode 100644 index 0000000..4f5e55d --- /dev/null +++ b/res/screen-size-normal/IDL_CREATE_BOOKMARK_FOLDER.xml @@ -0,0 +1,36 @@ + + + + + + 720 +
+ + + + +
+ + + + + +
+ + + + + + + +
diff --git a/res/screen-size-normal/IDL_EDIT_BOOKMARK_LIST.xml b/res/screen-size-normal/IDL_EDIT_BOOKMARK_LIST.xml new file mode 100644 index 0000000..d706abb --- /dev/null +++ b/res/screen-size-normal/IDL_EDIT_BOOKMARK_LIST.xml @@ -0,0 +1,43 @@ + + + + + 720 +
+ + + + +
+ + + + +
+
+ + +
+ + + + + + + + + + + + + + + + +
diff --git a/res/screen-size-normal/IDL_EDIT_HISTORY_LIST.xml b/res/screen-size-normal/IDL_EDIT_HISTORY_LIST.xml new file mode 100644 index 0000000..8de0833 --- /dev/null +++ b/res/screen-size-normal/IDL_EDIT_HISTORY_LIST.xml @@ -0,0 +1,39 @@ + + + + + 720 +
+ + + + +
+ + + + + +
+
+ + +
+ + + + + + + + + + + +
diff --git a/res/screen-size-normal/IDL_EDIT_HOME_PAGE.xml b/res/screen-size-normal/IDL_EDIT_HOME_PAGE.xml new file mode 100644 index 0000000..5963718 --- /dev/null +++ b/res/screen-size-normal/IDL_EDIT_HOME_PAGE.xml @@ -0,0 +1,35 @@ + + + + + 720 +
+ + + + +
+ + + + + +
+ + + + + + + +
diff --git a/res/screen-size-normal/IDL_FIND_ON_PAGE.xml b/res/screen-size-normal/IDL_FIND_ON_PAGE.xml new file mode 100644 index 0000000..46eee25 --- /dev/null +++ b/res/screen-size-normal/IDL_FIND_ON_PAGE.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_FONT_SIZE.xml b/res/screen-size-normal/IDL_FONT_SIZE.xml new file mode 100644 index 0000000..7e81667 --- /dev/null +++ b/res/screen-size-normal/IDL_FONT_SIZE.xml @@ -0,0 +1,26 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+ + + + + +
diff --git a/res/screen-size-normal/IDL_FORM.xml b/res/screen-size-normal/IDL_FORM.xml new file mode 100644 index 0000000..7ad4fb1 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM.xml @@ -0,0 +1,59 @@ + + + + + + 720 +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/res/screen-size-normal/IDL_HISTORY_LIST.xml b/res/screen-size-normal/IDL_HISTORY_LIST.xml new file mode 100644 index 0000000..6271a5b --- /dev/null +++ b/res/screen-size-normal/IDL_HISTORY_LIST.xml @@ -0,0 +1,33 @@ + + + + + 480 +
+ + + + +
+ + + + +
+
+ + +
+ + + + + + + + + + +
diff --git a/res/screen-size-normal/IDL_MULTIPLE_WINDOW.xml b/res/screen-size-normal/IDL_MULTIPLE_WINDOW.xml new file mode 100644 index 0000000..6295a18 --- /dev/null +++ b/res/screen-size-normal/IDL_MULTIPLE_WINDOW.xml @@ -0,0 +1,26 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+ + + + + +
diff --git a/res/screen-size-normal/IDL_NOTIFICATION_PANEL.xml b/res/screen-size-normal/IDL_NOTIFICATION_PANEL.xml new file mode 100644 index 0000000..101c89b --- /dev/null +++ b/res/screen-size-normal/IDL_NOTIFICATION_PANEL.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_READER.xml b/res/screen-size-normal/IDL_READER.xml new file mode 100644 index 0000000..9c058da --- /dev/null +++ b/res/screen-size-normal/IDL_READER.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + diff --git a/res/screen-size-normal/IDL_SETTINGS.xml b/res/screen-size-normal/IDL_SETTINGS.xml new file mode 100644 index 0000000..1ff2a36 --- /dev/null +++ b/res/screen-size-normal/IDL_SETTINGS.xml @@ -0,0 +1,21 @@ + + + + + 480 +
+ + + + +
+ + +
+
+ + +
+
diff --git a/res/screen-size-normal/IDL_SETTINGS_CLEAR_PRIVATE_DATA.xml b/res/screen-size-normal/IDL_SETTINGS_CLEAR_PRIVATE_DATA.xml new file mode 100644 index 0000000..f26d285 --- /dev/null +++ b/res/screen-size-normal/IDL_SETTINGS_CLEAR_PRIVATE_DATA.xml @@ -0,0 +1,26 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+ + + + + +
diff --git a/res/screen-size-normal/IDL_SETTING_FORM.xml b/res/screen-size-normal/IDL_SETTING_FORM.xml new file mode 100644 index 0000000..a696eae --- /dev/null +++ b/res/screen-size-normal/IDL_SETTING_FORM.xml @@ -0,0 +1,26 @@ + + + + + 720 +
+ + + + +
+ + +
+
+ + +
+ + + + + +
diff --git a/res/screen-size-normal/IDL_SHARE_POPUP.xml b/res/screen-size-normal/IDL_SHARE_POPUP.xml new file mode 100644 index 0000000..61136f5 --- /dev/null +++ b/res/screen-size-normal/IDL_SHARE_POPUP.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/res/slk-SK.xml b/res/slk-SK.xml new file mode 100644 index 0000000..9569332 --- /dev/null +++ b/res/slk-SK.xml @@ -0,0 +1,134 @@ + + + + Vybrať všetky + Nov. + Najnavštevovanejšie lokality + Close all + Zavrieť + Veľkosť písma + Dec. + Záložka už existuje + Prijať súbory cookie + Odstrániť históriu prehliadača? + Odstrániť obsah a databázy uložené do lokálnej vyrovnávacej pamäte? + Vymazať údaje všetkých súborov cookie + Po + Nie + Zrušiť + Zdieľať cez Twitter + Minulý mesiac + So + Záložka je pridaná + Pridať do priečinka Záložky + Vždy sa pýtať + Prázdna strana + Jún + Automaticky + Júl + Kopírovať + Zapamätať heslá + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Údaje formulára + Apr. + Edit Folder + Máj + Hľadať na str. + Kopírovať obrázok + Odstránené + Mar. + Yahoo + Vyhľadávací nástroj + Hľadať + Zdieľať + Hľadajte alebo zadajte adresu URL + No Recently Visited Sites. + Zdieľať obr. + Odstrániť + Odstrániť všetky súbory cookie? + Žiadne záložky + St + Žiadne histórie + Jan. + Nastavenia webovej lokality + Ochrana osobných údajov a zabezpečenie + Hotovo + Viac okien + Earlier this month + Súbory cookie + Predvolené zobrazenie + Sep. + Heslo + Aug. + Nastavenia obsahu stránok + Čitateľný + Vymazať heslá + Vložiť + Uložiť obrázok + Naver + Zapamätať údaje formulára + Upraviť + Internet + Zobraziť obrázky + Dnes + Vybrať slovo + Včera + Názov + Používateľská domovská stránka + Prispôsobiť na šírku + Vybrané + Jas + Nastavenia + Vymazať vyrovnávaciu pamäť + about: blank + Vytvoriť priečinok + Záložky + Zobr. obrázok + Zdieľať cez e-mail + Spustiť JavaScript + Obnoviť predvolené + Zadajte názov záložky + Miesto + Minulý týždeň + Zdieľať cez Facebook + Priečinok + Nový priečinok + Záložka bola odstránená + Reset all settings to default? + Uložiť + Nové okno + Povoliť umiestnenie + Pridať + Pi + Blokovať kontextové okná + Áno + URL + Súkromie + Vymazať prístup k umiestneniu + Pred %d týždňami + Záložka + Neplatná adresa + No History \nAfter you load pages, the history will be shown. + História + Ne + Zobraziť bezpečnostné upozornenia + Upraviť záložku + Aktuálna stránka + Zdieľať cez správy + Domovská stránka + Ručne + Vymazať údaje formulára + Ut + Okt. + Št + Nenašli sa žiadne výsledky + Vymazať históriu + Feb. + Failed to save Image + diff --git a/res/slv-SI.xml b/res/slv-SI.xml new file mode 100644 index 0000000..043d0b7 --- /dev/null +++ b/res/slv-SI.xml @@ -0,0 +1,134 @@ + + + + Izberi vse + Nov + Največkrat obiskane strani + Close all + Zapri + Velikost pisave + Dec + Zaznamek že obstaja + Sprejmi piškotke + Želite izbrisati zgodovino iskalnika? + Želite izbrisati vsebino in podatkovne zbirke v lokalnem medpomnilniku? + Počisti vse podatke piškotkov + Pon + Ne + Prekliči + Skupna raba prek storitve Twitter + Zadnji mesec + Sob + Zaznamek dodan + Dodaj med zaznamke + Vedno vprašaj + Prazna stran + Jun + Samodejno + Jul + Kopiraj + Zapomni si gesla + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Podatki obrazcev + Apr + Edit Folder + Maj + Najdi na strani + Kopiraj sliko + Izbrisano + Mar + Yahoo + Iskalnik + Iskanje + Deli + Poiščite ali vnesite URL + No Recently Visited Sites. + Soupor. slike + Izbriši + Izbrišem vse piškotke? + Ni zaznamkov + Sre + Ni zgodovin + Jan + Nastavitve spletnega mesta + Zasebnost in varnost + Končano + Več oken + Earlier this month + Piškotki + Privzeti pogled + Sep + Geslo + Avg + Nastavitve vsebine strani + Čitljivo + Izbriši gesla + Prilepi + Shrani sliko + Naver + Zapomni si podatke obrazcev + Uredi + Internet + Prikaži slike + Danes + Izberi besedo + Včeraj + Naslov + Uporabnikova domača stran + Prilagodi širini + Izbrano + Svetlost + Nastavitve + Izprazni medpomnilnik + about: blank + Ustvari mapo + Zaznamki + Prikaži sliko + Souporaba preko e-pošte + Zaženi JavaScript + Ponastavi na privzeto + Vnesite ime zaznamka + Lokacija + Zadnji teden + Skupna raba prek storitve Facebook + Mapa + Nova mapa + Zaznamek je odstranjen + Reset all settings to default? + Shrani + Novo okno + Omogoči položaj + Dodaj + Pet + Blokiraj pojavna okna + Da + URL + Zasebnost + Počisti dostop do položaja + Pred %d tedni + Zaznamek + Neveljaven naslov + No History \nAfter you load pages, the history will be shown. + Zgodovina + Ned + Prikaži varnostna opozorila + Uredi zaznamek + Trenutna stran + Souporaba preko sporočil + Domača stran + Ročno + Počisti podatke obrazca + Tor + Okt + Čet + Ni najdenih rezultatov + Počisti zgodovino + Feb + Failed to save Image + diff --git a/res/spa-ES.xml b/res/spa-ES.xml new file mode 100644 index 0000000..1625608 --- /dev/null +++ b/res/spa-ES.xml @@ -0,0 +1,134 @@ + + + + Seleccionar todo + Nov. + Sitios más visitados + Close all + Cerrar + Tamaño de fuente + Dic. + El favorito ya existe + Aceptar cookies + ¿Eliminar historial del navegador? + ¿Eliminar las bases de datos y el contenido guardado en la caché local? + Borrar todos los datos de cookies + Lunes + No + Cancelar + Compartir mediante Twitter + Último mes + Sábado + Favorito añadido + Añadir a Favoritos + Preguntar siempre + Página en blanco + Jun. + Auto + Jul. + Copiar + Recordar contraseñas + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Datos de formulario + Abr. + Edit Folder + Mayo + Buscar en página + Copiar imagen + Eliminado + Mar. + Yahoo + Motor de búsqueda + Buscar + Compartir + Buscar o introducir URL + No Recently Visited Sites. + Compar imagen + Eliminar + ¿Eliminar todas las cookies? + Ningún favorito + Miércoles + No hay historiales + Ene. + Ajustes del sitio web + Privacidad y seguridad + Hecho + Ventana múltiple + Earlier this month + Cookies + Vista predeterminada + Sep. + Contraseña + Ago. + Ajuste. del cont. de pág. + Legible + Borrar contraseñas + Pegar + Guardar imagen + Naver + Recordar datos de formularios + Editar + Internet + Mostrar imágenes + Hoy + Seleccionar palabra + Ayer + Título + Página de inicio del usuario + Ajustar al ancho + Seleccionado + Brillo + Ajustes + Borrar caché + about: blank + Crear carpeta + Favoritos + Ver imagen + Compartir por correo electrónico + Ejecutar JavaScript + Restablecer valores predeterminados + Introducir nombre de favorito + Ubicación + Última semana + Compartir mediante Facebook + Carpeta + Nueva carpeta + Favorito eliminado + Reset all settings to default? + Guardar + Nueva ventana + Activar ubicación + Añadir + Viernes + Bloquear ventanas emergentes + Sí + URL + Privacidad + Borrar acceso a ubicación + Hace %d semanas + Favorito + Dirección no válida + No History \nAfter you load pages, the history will be shown. + Historial + Dom. + Mostrar advertencias de seguridad + Editar elemento favorito + Página actual + Compartir mediante mensajes + Página de inicio + Manual + Borrar datos del formulario + Mar. + Oct. + Jue. + No se han encontrado resultados + Borrar historial + Feb. + Failed to save Image + diff --git a/res/spa-MX.xml b/res/spa-MX.xml new file mode 100644 index 0000000..49114de --- /dev/null +++ b/res/spa-MX.xml @@ -0,0 +1,134 @@ + + + + Seleccionar todo + Nov. + Sitios más visitados + Close all + Cerrar + Tamaño de fuente + Dic. + El Favorito ya existe + Aceptar cookies + ¿Eliminar historial del navegador? + ¿Eliminar bases de datos y contenido en memoria caché local? + Eliminar cookies + Lun + No + Cancelar + Compartir en Twitter + Último mes + Sáb + Favorito añadido + Añadir a Favoritos + Preguntar siempre + Página en blanco + Jun. + Automático + Jul. + Copiar + Recordar contraseñas + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Datos de formulario + Abr. + Edit Folder + Mayo + Buscar en páginas + Copiar imagen + Eliminado + Mar. + Yahoo + Motor de búsqueda + Buscar + Compartir + Buscar o introducir URL + No Recently Visited Sites. + Compart imagen + Eliminar + ¿Eliminar todas las cookies? + No hay favoritos + Mié + No hay historiales + Ene. + Configuración del sitio Web + Privacidad y seguridad + Realizado + Ventana múltiple + Earlier this month + Cookies + Vista predeterminada + Sep. + Contraseña + Ago. + Config. del cont. de pág. + Legible + Eliminar contraseñas + Pegar + Guardar imagen + Naver + Recordar datos de formularios + Editar + Internet + Mostrar imágenes + Hoy + Seleccionar palabra + Ayer + Título + Página de inicio del usuario + Ajustar al ancho + Seleccionado + Brillo + Configuración + Eliminar caché + about: blank + Crear carpeta + Favoritos + Ver imagen + Compartir vía correo + Ejecutar JavaScript + Restablecer valores predeterminados + Introducir nombre de Favorito + Ubicación + Última semana + Compartir en Facebook + Carpeta + Nueva carpeta + Favorito eliminado + Reset all settings to default? + Guardar + Nueva ventana + Activar ubicación + Añadir + Vie + Bloquear ventanas emergentes + Sí + URL + Privacidad + Eliminar acceso a ubicación + Hace %d semanas + Favoritos + Dirección no válida + No History \nAfter you load pages, the history will be shown. + Historial + Dom + Mostrar advertencias de seguridad + Editar Favorito + Página actual + Compartir mediante mensajes + Inicio + Manual + Eliminar datos de formularios + Mar + Oct. + Jue + No se han encontrado resultados + Eliminar historial + Feb. + Failed to save Image + diff --git a/res/srp-RS.xml b/res/srp-RS.xml new file mode 100644 index 0000000..e5efc9e --- /dev/null +++ b/res/srp-RS.xml @@ -0,0 +1,134 @@ + + + + Izaberi sve + Nov. + Najposećeniji sajtovi + Close all + Zatvori + Veličina fonta + Dec. + Obeleživač već postoji + Prihvataj kolačiće + Izbrisati istorije pretraživača? + Obrisati lokalno keširan sadržaj i baze podataka? + Obriši sve kolačiće + Pon + Ne + Poništi + Podeli putem Twitter-a + Zadnji mesec + Sub + Obeleživač dodat + Dodaj u obeleživače + Uvek pitaj + Prazna strana + Jun + Automatski + Jul + Kopiraj + Zapamti šifre + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Sačuvani podaci + Apr. + Edit Folder + Maj + Nađi na strani + Kopiraj sliku + Obrisano + Mar. + Yahoo + Pretraživač + Pretraži + Podeli + Traži ili unesi URL + No Recently Visited Sites. + Podeli sliku + Obriši + Izbrisati sve kolačiće? + Nema obeleživača + Sre + Nema istorija + Jan. + Podešavanja sajta + Privatnost i bezbednost + Gotovo + Više prozora + Earlier this month + Kolačići + Podrazumevani prikaz + Sep. + Šifra + Avg. + Podešav. sadržaja strane + Čitljivo + Obriši šifre + Zalepi + Sačuvaj sliku + Naver + Zapamti podatke obrazaca + Izmeni + Internet + Prikaži slike + Danas + Izaberi reč + Juče + Naslov + Korisnička početna stranica + Podesi prema širini + Označeno + Osvetljenje + Podešavanja + Obriši keš memoriju + about: blank + Kreiraj folder + Bookmark-ovi + Prikaži sliku + Podeli putem e-pošte + Pokreni JavaScript + Resetuj na podrazumevano + Unesi naziv obeleživača + Lokacija + Zadnja nedelja + Podeli putem Facebook-a + Folder + Novi folder + Obeleživač je uklonjen + Reset all settings to default? + Sačuvaj + Novi prozor + Omogući lociranje + Dodaj + Pet + Blokiraj iskačuće prozore + Da + URL + Privatnost + Obriši pristup lokaciji + Pre %d nedelja + Obeleživač + Neispravna adresa + No History \nAfter you load pages, the history will be shown. + Istorija + Ned + Prikazuj bezbednosna upozorenja + Izmeni obeleživač + Trenutna strana + Podeli putem poruke + Početna strana + Ručno + Obriši podatke iz obrasca + Uto + Okt. + Čet + Nema rezultata + Obriši istoriju + Feb. + Failed to save Image + diff --git a/res/swe-SE.xml b/res/swe-SE.xml new file mode 100644 index 0000000..dff71ac --- /dev/null +++ b/res/swe-SE.xml @@ -0,0 +1,134 @@ + + + + Välj alla + Nov + Mest besökta webbplatser + Close all + Stäng + Teckenstorlek + Dec + Bokmärket finns redan + Acceptera cookies + Ta bort webbläsarhistorik? + Ta bort lokalt cachat innehåll och lokala cachade databaser? + Rensa all cookie-data + Mån + Nej + Avbryt + Dela via Twitter + Senaste månaden + Lör + Bokmärke har lagts till + Lägg till i Bokmärken + Fråga alltid + Tom sida + Jun + Auto + Jul + Kopiera + Kom ihåg lösenord + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Formulärdata + Apr + Edit Folder + maj + Sök på sidan + Kopiera bild + Raderad + Mar + Yahoo + Sökmotor + Sök + Dela + Sök eller ange URL + No Recently Visited Sites. + Dela bild + Radera + Radera alla cookies? + Inga bokmärken + Ons + Inga berättelser + Jan + Webbplatsinställningar + Sekretess och säkerhet + Klar + Flera fönster + Earlier this month + Cookie + Standardvy + Sept + Lösenord + Aug + Sidinnehållsinställningar + Läsbart + Rensa lösenord + Klistra in + Spara bild + Naver + Kom ihåg data + Redigera + Internet + Visa bilder + Idag + Välj ord + Igår + Rubrik + Användarens startsida + Anpassa till bredd + Markerade + Ljusstyrka + Inställningar + Töm cache + about: blank + Skapa mapp + Bokmärken + Visa bild + Dela via e-post + Kör JavaScript + Återställ till standard + Ange bokmärkesnamn + Plats + Förra veckan + Dela via Facebook + Mapp + Ny mapp + Bokmärket har tagits bort + Reset all settings to default? + Spara + Nytt fönster + Aktivera plats + Lägg till + Fre + Blockera popuper + Ja + URL + Privat + Rensa platsåtkomst + %d veckor sedan + Bokmärke + Ogiltig adress + No History \nAfter you load pages, the history will be shown. + Tidigare + Sön + Visa säkerhetsvarningar + Redigera bokmärke + Denna sida + Dela via meddelanden + Startsida + Manuellt + Ta bort formulärdata + Tis + Okt + Tor + Inga resultat hittades + Rensa historik + Feb + Failed to save Image + diff --git a/res/tur-TR.xml b/res/tur-TR.xml new file mode 100644 index 0000000..e8c606a --- /dev/null +++ b/res/tur-TR.xml @@ -0,0 +1,134 @@ + + + + Hepsini seç + Kas. + En çok ziyaret edilen siteler + Close all + Kapat + Yazı tipi boyutu + Ara. + Yer imi zaten mevcut + Çerezleri kabul et + Tarayıcı geçmişi silinsin mi? + Yerel olarak ön belleğe alınmış içerik ve veritabanları silinsin mi? + Tüm çerez verilerini sil + Pts + Hayır + İptal + Twitter ile paylaş + Geçen ay + Cts + Yer imi eklendi + Yer imlerine ekle + Her zaman sor + Boş sayfa + Haz. + Otomatik + Tem. + Kopyala + Şifreleri hatırlayın + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Form verileri + Nis. + Edit Folder + Mayıs + Sayfada bul + Resmi kopyala + Silindi + Mar. + Yahoo + Arama motoru + Buluyor + Paylaşıma aç + Ara veya URL gir + No Recently Visited Sites. + Resim paylaş + Sil + Tüm tanımlama bilgileri silinsin mi? + Yer imi yok + Çar + Geçmiş yok + Oca. + Websitesi ayarları + Gizlilik ve güvenlik + Kaydet + Çoklu Pencere + Earlier this month + Tanımlama bilgileri + Varsayılan görünüm + Eyl. + Şifre + Ağu. + Sayfa içeriği ayarları + Okunabilir + Şifreleri sil + Yapıştır + Resmi kaydet + Naver + Veriden hatırla + Düzenle + İnternet + Resimleri göster + Bugün + Kelime seç + Dün + Başlık + Kullanıcı ana sayfası + Genişliğe sığdır + Seçili + Parlaklık + Ayarlar + Önbelleği sil + about: blank + Klasör oluştur + Yer imleri + Resmi görüntüle + E-posta ile paylaş + JavaScript'i çalıştır + Varsayılan olarak sıfırla + Yer imi adı girin + Konum + son hafta + Facebook ile paylaş + Klasör + Yeni klasör + Yer imi kaldırıldı + Reset all settings to default? + Kaydet + Yeni pencere + Konumu etkinleştir + Ekle + Cum + Açılır pencereleri engelle + Evet + URL + Gizlilik + Konum erişimini sil + %d hafta önce + Yer İmi + Geçersiz adres + No History \nAfter you load pages, the history will be shown. + Geçmiş + Paz + Güvenlik uyarılarını göster + Yer imini düzelt + Geçerli sayfa + Mesajlar ile paylaş + Ana sayfa + Manuel + Veri formunu sil + Sal + Eki. + Per + Sonuç bulunamadı + Geçmişi sil + Şub. + Failed to save Image + diff --git a/res/ukr-UA.xml b/res/ukr-UA.xml new file mode 100644 index 0000000..413b5d8 --- /dev/null +++ b/res/ukr-UA.xml @@ -0,0 +1,134 @@ + + + + Вибрати всі + Лис + Найбільш відвідувані сайти + Close all + Закрити + Розмір шрифту + Гру + Закладка вже існує + Приймати файли cookies + Видалити історію браузера? + Видалити локальний вміст кеша та бази даних? + Очистити всі дані файлів cookie + Пн + Ні + Скасувати + Спільний доступ через Twitter + Останній місяць + Сб + Закладку додано + Додати до закладок + Завжди запитувати + Пуста сторінка + Чер + Авто + Лип + Копіювати + Запам’ятати паролі + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Дані форми + Кві + Edit Folder + Трав. + Знайти на стор. + Копіювати зображення + Видалено + бер + Yahoo + Система веб-пошуку + Пошук + Надіслати + Знайдіть або введіть URL-адресу + No Recently Visited Sites. + Передати зобр + Вида-\nлити + Видалити всі файли cookie? + Немає закладок + Ср + Немає історій + Січ + Установки веб-сайта + Конфіденційність і безпека + Готово + Декілька вікон + Earlier this month + Файли cookie + Стандартний режим перегляду + Вер + Пароль + Сер + Установки вмісту сторінки + Чітко + Очистити паролі + Вставити + Зберегти зображення + Naver + Запам’ятати дані форми + Редагув. + Браузер + Показати зображення + Сьогодні + Виберіть слово + Вчора + Назва + Домашня сторінка користувача + За шириною + Вибране + Яскравість + Установки + Очистити кеш + about: blank + Створити папку + Закладки + Перегл. зображ. + Спільний доступ через Email + Запуск JavaScript + Скинути на стандартні + Введіть ім’я закладки + Розташування + Останній тиждень + Спільний доступ через Facebook + Папка + Ручний + Закладку видалено + Reset all settings to default? + Зберегти + Нове вікно + Увімкнути розташування + Додати + Пт + Блокувати спливаючі вікна + Так + URL + Конфіденційність + Очистити доступ до розташування + %d тижнів тому + Закладка + Хибна адреса + No History \nAfter you load pages, the history will be shown. + Історія + Нд + Показувати попередження системи безпеки + Редагувати закладку + Поточна сторінка + Спільний доступ через повідомлення + Домашня сторінка + Вручну + Очистити дані форми + Вт + Жов + Чт + Результатів не знайдено + Очистити журнал + Лют + Failed to save Image + diff --git a/res/uzb-UZ.xml b/res/uzb-UZ.xml new file mode 100644 index 0000000..69f3282 --- /dev/null +++ b/res/uzb-UZ.xml @@ -0,0 +1,134 @@ + + + + Barchasini tanlash + Noy. + Eng ko‘p kirilgan saytlar + Close all + Yopish + Shrift o‘lchami + Dek. + Veb-hujjat avvaldan mavjud + Cookie-fayllarni qabul qilish + Brauzer jurnali o'chirilsinmi? + Mahalliy keshlangan tarkib va ma'lumot bazalari o'chirilsinmi? + Barcha cookie ma’lumotlarini o'chirish + Du. + Yo‘q + Bekor q. + Twitter orqali ulashish + Oxirgi oy + Sha + Saqlangan veb-hujjat qo‘shildi + Saqlangan veb-hujjatlarga qo‘shish + Har doim so‘ralsin + Bo‘sh sahifa + Iyn. + Avtomatik + Iyl. + Nusxa olish + Parollarni eslab qolish + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + Shakl ma’lumoti + Apr. + Edit Folder + May + Sahifada topish + Suratdan nusxa olish + O'chirildi + Mar. + Yahoo + Qidirish mexanizmi + Qidirish + Ulashish + URL-manzilni qidirish yoki kiritish + No Recently Visited Sites. + Tasvir ulash. + O'chr + Barcha cookie-fayllar yo‘q qilinsinmi? + Veb-hujjatlar yo‘q + Cho + Jurnallar yo‘q + Yan. + Veb-sayt parametrlari + Maxfiylik va xavfsizlik + Bajarildi + Ko‘p oynali + Earlier this month + Cookie-fayllar + Ilk ko‘rinish + Sen. + Parol + Avg. + Sahifa tarkibi parametri + O‘qish mumkin bo‘lgan + Parollarni tozalash + Qo‘shib qo‘yish + Tasvirni saqlash + Naver + Ma’lumotdan eslab qolish + Tahrirl. + Internet + Tasvirlarni aks ettirish + Bugun + So‘z tanlang + Kecha + Sarlavha + Foydalanuvchi asosiy sahifasi + Kenglikka moslash + Tanlangan + Ravshanlik + Parametrlar + Keshni o'chirish + about: blank + Jild yaratish + Veb-hujjatlar + Rasmni ko‘rish + E-pochta orqali ulashish + JavaScriptni ishga tushirish + Birlamchi o'rnatilgan holatiga tiklash + Veb-hujjat nomini kiriting + Joylashuv + Oxirgi hafta + Facebook orqali ulashish + Jild + Yangi jild + Veb-hujjat olib tashlandi + Reset all settings to default? + Saqlash + Yangi oyna + Joylashuvni yoqish + Qo‘shish + Jum. + Qalqib chiquvchi oyna bloki + Ha + URL-manzil + Maxfiylik + Joylashuvga kirishni tozalash + %d hafta avval + Saqlangan veb-hujjat + Noto‘g‘ri manzil + No History \nAfter you load pages, the history will be shown. + Jurnal + Yak + Xavfsizlik ogohlantirishlarini ko‘rsatish + Veb-hujjatni tahrirlash + Joriy sahifa + Xabarlar orqali ulashish + Asosiy sahifa + Qo‘lda + Ma’lumotdan o'chirib tashlash + Sesh + Okt. + Pay + Natijalar topilmadi + Jurnalni tozalash + Fev. + Failed to save Image + diff --git a/res/zho-CN.xml b/res/zho-CN.xml new file mode 100644 index 0000000..1028595 --- /dev/null +++ b/res/zho-CN.xml @@ -0,0 +1,134 @@ + + + + 全选 + 11 月 + 访问最多的站点 + Close all + 关闭 + 字体大小 + 12 月 + 书签已存在 + 接受 Cookies + 是否删除浏览器历史记录? + 是否删除本地缓存的内容和数据库? + 清除所有 Cookie 数据 + 星期一 + 否 + 取消 + 通过 Twitter 共享 + 上个月 + 星期六 + 已添加书签 + 添加到书签 + 总是询问 + 空白页面 + 6 月 + 自动 + 7 月 + 复制 + 记住密码 + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + 格式数据 + 4 月 + Edit Folder + 5月 + 在页面上查找 + 复制图像 + 已删除 + 3 月 + Yahoo + 搜索引擎 + 搜索 + 共享 + 搜索或输入网址 + No Recently Visited Sites. + 共享图像 + 删除 + 删除所有 Cookies 吗? + 无书签 + 星期三 + 没有历史记录 + 1 月 + 网站设置 + 隐私和安全 + 完成 + 多窗口 + Earlier this month + Cookies + 默认视图 + 9月 + 密码 + 8 月 + 页面内容设置 + 方便阅读 + 清除密码 + 粘贴 + 保存图像 + Naver + 记住表单数据 + 编辑 + 互联网 + 显示图片 + 今天 + 选择单词 + 昨天 + 标题 + 用户主页 + 适合宽度 + 已选择 + 亮度 + 设定 + 清除缓存 + about: blank + 新文件夹 + 书签 + 查看图像 + 通过电子邮件共享 + 运行 Java 脚本 + 重置为默认值 + 输入书签名称 + 位置 + 最后一周 + 通过 Facebook 共享 + 文件夹 + 新文件夹 + 书签已移除 + Reset all settings to default? + 保存 + 新窗口 + 启用定位功能 + 添加 + 星期五 + 阻止弹出窗口 + 是 + 网址 + 隐私权 + 取消定位权限 + %d 周前 + 书签 + 地址无效 + No History \nAfter you load pages, the history will be shown. + 历史记录 + 星期日 + 显示安全警告 + 编辑书签 + 当前页面 + 通过信息共享 + 主页 + 手动 + 清除表单数据 + 星期二 + 10 月 + 星期四 + 未找到结果 + 清除历史记录 + 2 月 + Failed to save Image + diff --git a/res/zho-HK.xml b/res/zho-HK.xml new file mode 100644 index 0000000..5e331fb --- /dev/null +++ b/res/zho-HK.xml @@ -0,0 +1,134 @@ + + + + 選擇全部 + 11 月 + 最常瀏覽網站 + Close all + 關閉 + 字體大小 + 12 月 + 書籤已存在 + 接受 Cookies + 刪除瀏覽器紀錄嗎? + 刪除本機緩存的內容和數據庫嗎? + 清除全部 Cookie 數據 + 週一 + 否 + 取消 + 透過 Twitter 分享 + 上個月 + 週六 + 已加入書籤 + 加到書籤 + 總是詢問 + 空白頁面 + 6 月 + 自動 + 7 月 + 複製 + 記住密碼 + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + 表格數據 + 4 月 + Edit Folder + 5 月 + 在頁面上尋找 + 複製圖像 + 已刪除 + 3 月 + Yahoo + 搜尋引擎 + 搜尋 + 分享 + 搜尋或輸入網址 + No Recently Visited Sites. + 共享圖像 + 刪除 + 要刪除全部 Cookie 嗎? + 無書籤 + 週三 + 無歷史記錄 + 1 月 + 網址設定 + 私隱和安全 + 完成 + 多重視窗 + Earlier this month + Cookies + 預設檢視 + 9 月 + 密碼 + 8 月 + 頁面內容設定 + 可讀取 + 清除密碼 + 貼上 + 儲存圖像 + Naver + 記住表格數據 + 編輯 + 瀏覽器 + 顯示圖像 + 今天 + 擇擇字詞 + 昨天 + 標題 + 用戶首頁 + 符合寬度 + 已選擇 + 亮度 + 設定 + 清除緩存 + about: blank + 建立資料夾 + 書籤 + 檢視圖像 + 透過電子郵件分享 + 執行 JavaScript + 重設為預設 + 輸入書籤名稱 + 位置 + 最後一週 + 透過 Facebook 分享 + 資料夾 + 新資料夾 + 已移除書籤 + Reset all settings to default? + 儲存 + 新視窗 + 啟用定位功能 + 加入 + 週五 + 封鎖彈出視窗 + 是 + 網址 + 私隱 + 清除位置資訊存取權 + %d 個星期前 + 書籤 + 位址無效 + No History \nAfter you load pages, the history will be shown. + 歷程記錄 + 週日 + 顯示安全性警告 + 編輯書籤 + 目前頁面 + 透過訊息共享 + 首頁 + 手動 + 清除表格數據 + 週二 + 10 月 + 週四 + 找不到結果 + 清除歷程記錄 + 2 月 + Failed to save Image + diff --git a/res/zho-SG.xml b/res/zho-SG.xml new file mode 100644 index 0000000..4633ae1 --- /dev/null +++ b/res/zho-SG.xml @@ -0,0 +1,134 @@ + + + + 全选 + 11月 + 访问最多的站点 + Close all + 关闭 + 字体大小 + 12月 + 书签已存在 + 接受 Cookies + 是否删除浏览器历史? + 是否删除本地缓存的内容和数据库? + 清除所有 Cookie 数据 + 周一 + 否 + 取消 + 通过 Twitter 共享 + 上个月 + 周六 + 已添加书签 + 添加到书签 + 始终询问 + 空白页面 + 6月 + 自动 + 7月 + 复制 + 记住密码 + 谷歌 + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + 格式数据 + 4月 + Edit Folder + 5月 + 在页面上查找 + 复制图像 + 已删除 + 3月 + Yahoo + 搜索引擎 + 搜寻 + 共享 + 搜索或输入URL + No Recently Visited Sites. + 共享图像 + 删除 + 删除所有 Cookie 吗? + 无书签 + 周三 + 没有历史记录 + 1月 + 网络设置 + 隐私和安全 + 已完成 + 多窗口 + Earlier this month + Cookies + 预置视图 + 9月 + 密码 + 8月 + 页面内容设置 + 方便阅读 + 清除密码 + 粘贴 + 保存图像 + Naver + 记住表单数据 + 编辑 + 网络 + 显示图片 + 今天 + 选择字词 + 昨天 + 标题 + 用户主页 + 适合宽度 + 已选定 + 亮度 + 设定 + 清除缓存 + about: blank + 创建文件夹 + 书签 + 查看图像 + 通过电子邮件共享 + 运行Java脚本 + Reset to default + 输入书签名称 + 地址 + 最后一周 + 通过 Facebook 共享 + 文件夹 + 新文件夹 + 书签已移除 + Reset all settings to default? + 储存 + 新窗口 + 启动位置 + 添加 + 周五 + 阻止弹出窗口 + 是 + 网址 + 隐私 + 清除位置接入? + %d 周前 + 已添加书签 + 地址无效 + No History \nAfter you load pages, the history will be shown. + 历史记录 + 周日 + 显示安全警告 + 编辑书签 + 当前页面 + 通过信息共享 + 主页 + 手动 + 清除表单数据 + 周二 + 10月 + 周四 + 未找到结果 + 清除历史记录 + 2月 + Failed to save Image + diff --git a/res/zho-TW.xml b/res/zho-TW.xml new file mode 100644 index 0000000..5fc32be --- /dev/null +++ b/res/zho-TW.xml @@ -0,0 +1,135 @@ + + + + 全選 + 11 月 + 訪客最多的網站 + Close all + 關閉 + 字型大小 + 12 月 + 書籤已存在 + 接受 Cookie + 刪除瀏覽器紀錄嗎? + 刪除本機快取的內容與資料庫嗎? + 清除所有 Cookie 資料 + 週一 + 否 + 取消 + 透過 Twitter 分享 + 最近1個月 + 週六 + 增加書籤 + 加至書籤 + 每次詢問 + 空白頁面 + 6 月 + 自動 + 7 月 + 複製 + 記住密碼 + Google + Older + Searched items + No Bookmarks \nAdd favorite sites bookmark to access easily + Close all windows? + 表單資料 + 4 月 + Edit Folder + 5 月 + 在頁面中尋找 + 複製圖像 + 已刪除 + 3 月 + Yahoo + 搜尋引擎 + 搜尋 + 分享 + 搜尋或輸入網址 + No Recently Visited Sites. + 圖像分享 + 刪除 + 刪除所有 Cookie? + 無書籤 + 週三 + 無歷史記錄 + 1 月 + 網站設定 + 隱私權與安全性 + 完成 + 多重視窗 + Earlier this month + Cookies + 預設檢視 + 9 月 + 密碼 + 8 月 + 頁面內容設置 + 可讀取 + 清除密碼 + 貼上 + 儲存圖像 + Naver + 記住表單資料 + 編輯 + 網際網路 + 顯示影像 + 今天 + 選擇字詞 + 昨天 + 標題 + 使用者首頁 + 符合寬度 + 已選擇 + 亮度 + 設定 + 清除快取 + about: blank + 建立資料夾 + 書籤 + 檢視圖像 + 透過電子郵件分享 + 執行 JavaScript + 重設為預設值 + 輸入書籤名稱 + 位置 + 上一週 + 透過 Facebook 分享 + 資料夾 + 新資料夾 + 已移除書籤 + Reset all settings to default? + 儲存 + 新視窗 + 啟用定位功能 + 新增 + 週五 + 封鎖彈出視窗 + 是 + URL + 隱私設定 + 清除位置存取 + %d 週前 + 書籤 + 地址無效 + No History \nAfter you load pages, the history will be shown. + 歷程記錄 + 週日 + 顯示安全性警告 + 編輯書籤 + 目前頁面 + 經由訊息分享 + 首頁 + 手動模式 + 清除表單資料 + 週二 + 10 月 + 週四 + 找不到結果 + 清除記錄 + 2 月 + Failed to save Image + + diff --git a/shared/data/nofile.dummy b/shared/data/nofile.dummy new file mode 100644 index 0000000..e69de29 diff --git a/shared/res/screen-density-xhigh/mainmenu.png b/shared/res/screen-density-xhigh/mainmenu.png new file mode 100644 index 0000000..07d3b71 Binary files /dev/null and b/shared/res/screen-density-xhigh/mainmenu.png differ diff --git a/shared/trusted/nofile.dummy b/shared/trusted/nofile.dummy new file mode 100644 index 0000000..e69de29 diff --git a/src/IntAddBookmarkForm.cpp b/src/IntAddBookmarkForm.cpp new file mode 100644 index 0000000..e595eb9 --- /dev/null +++ b/src/IntAddBookmarkForm.cpp @@ -0,0 +1,1126 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: AddBookmarkForm.cpp + *@brief: This header file contains the definitions of the AddBookmarkForm class. + * + */ + +#include +#include + +#include "IntAddBookmarkForm.h" +#include "IntBookmarkData.h" +#include "IntBookmarkPresentationModel.h" +#include "IntCommonLib.h" +#include "IntDropDownCustomItem.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntRadioCustomItem.h" +#include "IntSceneRegister.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const int LIST_ITEM_HEIGHT = 112; +static const int H_ITEM_HEIGHT = 128; +static const wchar_t* IDB_LIST_LEFT_SIDE = L"ListLeftSide.png"; + +const int AddBookmarkForm::IDA_CREATE_BOOKMARK_FOLDER = 101; +const int AddBookmarkForm::IDA_BUTTON_DONE = 102; +const int AddBookmarkForm::IDA_BUTTON_CANCEL = 103; +const int AddBookmarkForm::IDA_LIST_LEFT_SIDE_MARGIN = 104; +const int AddBookmarkForm::IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN = 105; + +AddBookmarkForm::AddBookmarkForm(void) +:__folderCount(0) +,__folderName(CommonUtil::GetString(L"IDS_BR_TAB_BOOKMARKS")) +,__listHeight(H_ITEM_HEIGHT) +, __oldFolderCount(0) +, __pBookmark(null) +, __pEditFieldTitle(null) +, __pEditFieldUrl(null) +,__pList(null) +, __pListPanel(null) +, __previousScene(null) +, __pScrollPanel(null) +, __pWindowInfo(null) +, __selectedIndex(0) +, __showFolderList(false) +,__titleOnViewDeactivated(L"") +, __view(L"") +,__urlOnViewDeactivated(L"") + +{ + +} + +AddBookmarkForm::~AddBookmarkForm(void) +{ + // RemoveAllControls(); +} + +bool +AddBookmarkForm::Initialize(void) +{ + Construct(L"IDL_ADD_BOOKMARK"); + + return true; +} + +result +AddBookmarkForm::OnInitializing(void) +{ + result r = E_SUCCESS; + Header* pHeader = null; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return E_FAILURE; + } + pSceneManager->AddSceneEventListener(IDSCN_ADD_BOOKMARK, *this); + + pHeader = GetHeader(); + + if (pHeader != null) + { + pHeader->AddActionEventListener(*this); + } + + // Main Panel which is a Scroll Panel + __pScrollPanel = static_cast< ScrollPanel* >(GetControl(L"IDC_SCROLLPANEL2")); + + if (__pScrollPanel == null) + { + return E_FAILURE; + } + + __pLabel1 = static_cast< Label* >(__pScrollPanel->GetControl(L"IDC_LABEL1")); + + if (__pLabel1 == null) + { + return E_FAILURE; + } + + // Title EditField added on the Scroll Panel + __pEditFieldTitle = static_cast< EditField* >(__pScrollPanel->GetControl(L"IDC_EDITFIELD1")); + + if (__pEditFieldTitle == null) + { + return E_FAILURE; + } + + __pEditFieldTitle->SetGuideText(CommonUtil::GetString(L"IDS_BR_POP_ENTER_BOOKMARK_NAME")); + __pEditFieldTitle->AddTextEventListener(*this); + __pEditFieldTitle->AddKeypadEventListener(*this); + __pEditFieldTitle->SetOverlayKeypadCommandButtonVisible(false); + + // Url Editfield added on the Scroll Panel + __pEditFieldUrl = static_cast< EditField* >(__pScrollPanel->GetControl(L"IDC_EDITFIELD2")); + + if (__pEditFieldUrl == null) + { + return E_FAILURE; + } + + __pEditFieldUrl->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL")); + __pEditFieldUrl->AddTextEventListener(*this); + __pEditFieldUrl->AddKeypadEventListener(*this); + __pEditFieldUrl->SetOverlayKeypadCommandButtonVisible(false); + + __pList = static_cast< ListView* >(__pScrollPanel->GetControl(L"IDC_LISTVIEW1")); + + if (__pList == null) + { + return E_FAILURE; + } + __pList->SetItemProvider(*this); + __pList->AddListViewItemEventListener(*this); + AddOrientationEventListener(*this); + + __pScrollPanel->SetSize(GetClientAreaBounds().width, GetClientAreaBounds().height); + r = __pScrollPanel->SetClientAreaHeight(__pList->GetY() + __listHeight); + ScrollPanelScrollDirection direction = __pScrollPanel->GetScrollDirection(); + AppLogDebug("ScrollDirection = %d SetClientAreaHeight ret = %s value = %d autoresize = %d",direction,GetErrorMessage(r),__pScrollPanel->GetClientAreaBounds().height,__pScrollPanel->IsScrollAreaAutoResizingEnabled()); + r = E_SUCCESS; + + return r; +} + +result +AddBookmarkForm::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +void +AddBookmarkForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLog("AddBookmarkForm::OnActionPerformed entered actionId %d",actionId); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return ; + } + + switch (actionId) + { + case IDA_CREATE_BOOKMARK_FOLDER: + { + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_BOOKMARK_FOLDER, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)); + } + break; + + case IDA_BUTTON_DONE: + { + // Code to save the Bookmark + String title = L""; + String Url = L""; + String bookMarkID = L""; + String folderTitle = L""; + ArrayList folderList; + result r= E_SUCCESS; + int count = 0; + bool exist = false; + bool ret = false; + bool flag = false; + bool valid = false; + + + String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"); + String secondPattern(L"^[A-Za-z0-9\.\+-:#@%/;$~?]+\\.[A-Za-z0-9\+-=:#@%/;$~()_?\\\.&]{2,}$"); // Url of type abc.com (i.e without protocol in front of it) + + RegularExpression firstRegex; + RegularExpression secondRegex; + + firstRegex.Construct(firstPattern, REGEX_CASELESS); + secondRegex.Construct(secondPattern, REGEX_CASELESS); + + title = __pEditFieldTitle->GetText(); + Url = __pEditFieldUrl->GetText(); + + // Match + ret = firstRegex.Match(Url, false); // This returns true value + flag = secondRegex.Match(Url, false); // Checks whether Url typed is of type abc.com (i.e without protocol in front of it) + + if (ret == true) + { + valid = true ; + } + else + { + String tempUrl = L"http://"; + tempUrl.Append(Url); + + if (flag == true) + { + valid = true; + Url= tempUrl ; + } + } + + if (valid == false) + { + String msg = CommonUtil::GetString(L"IDS_BR_POP_INVALIDADDRESS"); + CreateMessage(msg); + } + else + { + if (__view == CommonUtil::GetString(L"IDS_BR_SK_EDIT")) + { + String tempUrl ; + String tempTitle; + String tempParentId; + + tempUrl = __pBookmark->GetUrl(); + tempTitle = __pBookmark->GetBookmarkTitle(); + tempParentId = __pBookmark->GetParentId(); + + + + r = BookmarkPresentationModel::GetInstance()->GetFolder("-1", 0, __folderCount, folderList); + TryCatch(r == E_SUCCESS,,"Failed to intitialize GetFolder %s",GetErrorMessage(r)); + + for (count = 0; count < __folderCount; count++) + { + BookmarkData* pBookmark = null; + pBookmark = dynamic_cast< BookmarkData* >(folderList.GetAt(count)); + if (pBookmark == NULL) + { + return; + } + folderTitle = pBookmark->GetBookmarkTitle(); + + if (folderTitle == __folderName) + { + bookMarkID = pBookmark->GetBookmarkId(); + break; + } + } + + + + + if(bookMarkID.GetLength() == 0) + { + bookMarkID = L"-1"; + } + + AppLog("IDA_BUTTON_DONE tempParentId ID is %S",tempParentId.GetPointer()); + AppLog("IDA_BUTTON_DONE bookMarkID ID is %S",bookMarkID.GetPointer()); + + if (bookMarkID.CompareTo(tempParentId) == 0 && __pEditFieldUrl->GetText().CompareTo(tempUrl) == 0 && __pEditFieldTitle->GetText().CompareTo(tempTitle) == 0) + { + pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + return; + } + + if(tempUrl != __pEditFieldUrl->GetText() || tempParentId != bookMarkID) + { + r = BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(Url,exist, bookMarkID, true); + TryCatch( r == E_SUCCESS,,"Failed to intitialize GetFolder %s",GetErrorMessage(r)); + } + + + if ( exist == true) + { + String msg = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_ALREADY_EXISTS"); + CreateMessage(msg); + + AppLogDebug("Bookmark already exists"); + } + else + { + __pBookmark->SetUrl(Url); + __pBookmark->SetBookmarkTitle(title); + + if (bookMarkID == L"") + { + __pBookmark->SetParentId(L"-1"); + } + else + { + __pBookmark->SetParentId(bookMarkID); + } + + r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*__pBookmark); + AppLogDebug("ID_BUTTON_DONE SaveBookmark = %s", GetErrorMessage(r)); + AppLogDebug("parent id = %ls",__pBookmark->GetParentId().GetPointer()); + pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + } + } + else + { + AppLog("AddBookmarkForm::OnActionPerformed does url exist 1"); + + r = BookmarkPresentationModel::GetInstance()->GetFolder(L"-1", 0, __folderCount, folderList); + TryCatch(r == E_SUCCESS,,"Failed to intitialize GetFolder %s",GetErrorMessage(r)); + + for (count = 0; count < __folderCount; count++) + { + BookmarkData* pBookmark = null; + pBookmark = dynamic_cast< BookmarkData* >(folderList.GetAt(count)); + if (pBookmark == NULL) + { + return; + } + folderTitle = pBookmark->GetBookmarkTitle(); + + if (folderTitle == __folderName) + { + bookMarkID = pBookmark->GetBookmarkId(); + break; + } + } + if(bookMarkID.GetLength() == 0) + { + bookMarkID = L"-1"; + } + r = BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(Url,exist, bookMarkID, true); + + TryCatch( r == E_SUCCESS,,"Failed to intitialize GetFolder %s",GetErrorMessage(r)); + AppLog("AddBookmarkForm::OnActionPerformed does url exist 2"); + if ( exist == true) + { + String msg = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_ALREADY_EXISTS"); + CreateMessage(msg); + + AppLogDebug("Bookmark already exists"); + } + else + { + + r = BookmarkPresentationModel::GetInstance()->GetFolder("-1", 0, __folderCount, folderList); + TryCatch( r == E_SUCCESS,,"Failed to intitialize GetFolder %s",GetErrorMessage(r)); + + for (count = 0; count < __folderCount; count++) + { + BookmarkData* pBookmark = null; + pBookmark = dynamic_cast< BookmarkData* >(folderList.GetAt(count)); + if( pBookmark == NULL ) + { + return; + } + folderTitle = pBookmark->GetBookmarkTitle(); + + if (folderTitle == __folderName) + { + bookMarkID = pBookmark->GetBookmarkId(); + break; + } + } + BookmarkData bookmark; + + if (__folderName != CommonUtil::GetString(L"IDS_BR_TAB_BOOKMARKS")) + { + bookmark.SetParentId(bookMarkID); + } + + bookmark.SetBookmarkTitle(title); + bookmark.SetUrl(Url); + if (__pBookmark != null) + { + bookmark.SetFaviconId(__pBookmark->GetFaviconId()); + } + BookmarkPresentationModel::GetInstance()->SaveBookmark(bookmark); + pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + } + } + } + + folderList.RemoveAll(true); + } + break; + + case IDA_BUTTON_CANCEL: + { + if (__pEditFieldTitle != NULL) + { + __pEditFieldTitle->Clear(); + } + + if (__pEditFieldUrl != NULL) + { + __pEditFieldUrl->Clear(); + } + + pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + + } + break; + + default: + break; + } + + CATCH: return; +} + +void +AddBookmarkForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) +{ + return; +} + +void +AddBookmarkForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status) +{ + if (__pEditFieldTitle != NULL) + { + __pEditFieldTitle->HideKeypad(); + } + + if (__pEditFieldUrl != NULL) + { + __pEditFieldUrl->HideKeypad(); + } + if (index == 0) + { + if (__showFolderList == false) + { + AppLog("AddBookmarkForm::OnListViewItemStateChanged false"); + __showFolderList = true; + __pList->UpdateList(); + __listHeight = __pList->GetItemCount() * H_ITEM_HEIGHT; + __pLabel1->SetShowState(false); + + } + else + { + AppLog("AddBookmarkForm::OnListViewItemStateChanged true"); + __showFolderList = false; + __pList->UpdateList(); + __listHeight = __pList->GetItemCount() * H_ITEM_HEIGHT; + __pLabel1->SetShowState(true); + + } + + } + else + { + __selectedIndex = index; + if (index > 1 && __pList->GetItemCount() != index +1) + { + String parentID = "-1"; + ArrayList folderList; + BookmarkData* pBookmark = null; + BookmarkPresentationModel::GetInstance()->GetFolder(parentID, 0, __folderCount, folderList); + + pBookmark = static_cast(folderList.GetAt(index-2)); + __folderName = pBookmark->GetBookmarkTitle(); + } + else if(index == 1) + { + __folderName = CommonUtil::GetString(L"IDS_BR_TAB_BOOKMARKS") ; + } + __listHeight = __pList->GetItemCount() * H_ITEM_HEIGHT; + if (__pList->GetItemCount() == index +1) + { + SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_CREATE_BOOKMARK_FOLDER, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)); + return; + } + + __pList->UpdateList(); + // __pList->RefreshList(0, LIST_REFRESH_TYPE_ITEM_MODIFY); + + } + + __pLabel1->SetBounds(__pLabel1->GetX(),__pList->GetY()+ __listHeight + 2,__pLabel1->GetWidth(),__pLabel1->GetHeight()); + __pLabel1->Invalidate(true); + result r = __pList->SetBounds(Rectangle(__pList->GetX(), __pList->GetY(), __pList->GetWidth(), __listHeight)); + //__pList->Invalidate(true); + Invalidate(true); + AppLog("the result is %s", GetErrorMessage(r)); + AppLog("the list height is %d", __pList->GetHeight()); + return; +} + +void +AddBookmarkForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction) +{ + __pList->RefreshList(0, LIST_REFRESH_TYPE_ITEM_MODIFY); + return; +} + +void +AddBookmarkForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state) +{ + return; +} + +int +AddBookmarkForm::GetItemCount(void) +{ + AppLogDebug("AddBookmarkForm::GetItemCount"); + int count = 0; + ArrayList folderList; + String parentID = "-1"; + BookmarkData* pBookmark = null; + BookmarkPresentationModel::GetInstance()->GetFolder(parentID, 0, __folderCount, folderList); + + if (__selectedIndex == 0 && __view == CommonUtil::GetString(L"IDS_BR_SK_EDIT")) + { + for(int count = 0; count < __folderCount; count++) + { + pBookmark = dynamic_cast< BookmarkData* >(folderList.GetAt(count)); + + if (__pBookmark != null && pBookmark != NULL && __pBookmark->GetParentId() == pBookmark->GetBookmarkId()) + { + __selectedIndex = count + 2; + __folderName = pBookmark->GetBookmarkTitle(); + break; + } + else + { + __selectedIndex = 1; + } + } + } + + folderList.RemoveAll(true); + + if (__showFolderList == false) + { + return 1; + } + else + { + result r = BookmarkPresentationModel::GetInstance()->GetFolderCount(L"-1",count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetBookmarkCount query failed %s",GetErrorMessage(r)); + AppLog("count = %d", count); + return count + 3; + CATCH: + return E_FAILURE; + } + +} + +ListItemBase* +AddBookmarkForm::CreateItem(int index, int itemWidth) +{ + AppLog("AddBookmarkForm::CreateItem index = %d itemWidth %d list width = %d",index,itemWidth,__pList->GetWidth()); + result r = E_FAILURE; + String folderTitle = L""; + RadioCustomItem* radioItem = null; + DropDownCustomItem* pItem = null; + Bitmap* pBitmap = null; + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_LIST_LEFT_SIDE); + if(itemWidth == 0) + { + itemWidth = __pList->GetWidth(); + } + if (index == 0) + { + pItem = new(std::nothrow) DropDownCustomItem(); + r = pItem->Construct(itemWidth); + + if (IsFailed(r)) + { + AppLog("Create Item Failed with error %s", GetErrorMessage(r)); + delete pItem; + delete pBitmap; + return null; + } + + if ( __showFolderList == true ) + { + pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED); + } + else + { + pItem->SetCurState(DROP_DOWN__ITEM_STATE_CLOSED); + } + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_HIGHLIGHTED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + pItem->SetMainText(CommonUtil::GetString(L"IDS_BR_BODY_FOLDER")); + pItem->SetSubText(__folderName); + pItem->Make(); + if (pBitmap != null) + { + //pItem->AddElement(Rectangle(0, 0, 10, H_ITEM_HEIGHT), IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN, *pBitmap, null); + delete pBitmap; + } + return pItem; + } + else + { + String parentID = "-1"; + ArrayList folderList; + + BookmarkData* pBookmark = null; + r = BookmarkPresentationModel::GetInstance()->GetFolder(parentID, 0, __folderCount, folderList); + + if (index == 1) + { + radioItem = new(std::nothrow) RadioCustomItem(); + // r = radioItem->Construct(GetClientAreaBounds().width, LIST_ITEM_HEIGHT); + r = radioItem->Construct(itemWidth, LIST_ITEM_HEIGHT); + if (IsFailed(r)) + { + AppLog("Create Item Failed with error %s", GetErrorMessage(r)); + delete radioItem; + delete pBitmap; + return null; + } + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_HIGHLIGHTED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + folderTitle = CommonUtil::GetString(L"IDS_BR_TAB_BOOKMARKS") ; + radioItem->SetText(folderTitle); + } + else if (index <= __folderCount + 1) + { + pBookmark = dynamic_cast< BookmarkData* >(folderList.GetAt(index - 2)); + if (pBookmark != null) + { + folderTitle = pBookmark->GetBookmarkTitle(); + } + radioItem = new(std::nothrow) RadioCustomItem(); + // r = radioItem->Construct(GetClientAreaBounds().width, LIST_ITEM_HEIGHT); + r = radioItem->Construct(itemWidth, LIST_ITEM_HEIGHT); + if (IsFailed(r)) + { + AppLog("Create Item Failed with error %s", GetErrorMessage(r)); + delete radioItem; + delete pBitmap; + return null; + } + + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_HIGHLIGHTED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetText(folderTitle); + } + else + { + radioItem = new(std::nothrow) RadioCustomItem(); + // r = radioItem->Construct(GetClientAreaBounds().width, LIST_ITEM_HEIGHT); + r = radioItem->Construct(itemWidth, LIST_ITEM_HEIGHT); + if (IsFailed(r)) + { + AppLog("Create Item Failed with error %s", GetErrorMessage(r)); + delete radioItem; + delete pBitmap; + return null; + } + //radioItem->AddElement(Rectangle(MARGIN_X, 0, __pList->GetBounds().width, LIST_ITEM_HEIGHT), IDA_FORMAT_STRING1, CommonUtil::GetString(L"IDS_CREATE_NEW_FOLDER"), textsize, Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), true); + folderTitle = CommonUtil::GetString(L"IDS_BR_OPT_NEW_FOLDER"); + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_HIGHLIGHTED, CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND); + radioItem->SetText(folderTitle); + + } + + if (__selectedIndex == index) + { + radioItem->SetSelected(true); + } + else + { + radioItem->SetSelected(false); + } + + if(__selectedIndex == 0 && index == 1) + radioItem->SetSelected(true); + if (radioItem->GetSelected() == true) + { + __folderName = radioItem->GetText(); + } + + if (pBitmap != null) + { + //radioItem->AddElement(Rectangle(0, 0, 10, LIST_ITEM_HEIGHT), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null); + delete pBitmap; + } + + folderList.RemoveAll(true); + radioItem->Make(); + return radioItem; + } +} + +bool +AddBookmarkForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth) +{ + if (pItem != null) + { + delete pItem; + pItem = null; + } + + return true; +} + +void +AddBookmarkForm::OnKeypadActionPerformed(Control& source, KeypadAction keypadAction) +{ + return; +} + +void +AddBookmarkForm::OnKeypadClosed(Control& source) +{ + + AppLog("the client area height is %d",GetClientAreaBounds().height); + + __pScrollPanel->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height)); + __pScrollPanel->Invalidate(true); + + Invalidate(true); + return; +} + +void +AddBookmarkForm::OnKeypadOpened(Control& source) +{ + AppLog("the client area height is %d",GetClientAreaBounds().height); + + // __pScrollPanel->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height)); + + // __pScrollPanel->Invalidate(true); + // __pScrollPanel->SetScrollPosition(source.GetY()-48,false); + __pScrollPanel->SetSize(GetClientAreaBounds().width,GetClientAreaBounds().height); + __pScrollPanel->SetClientAreaWidth(__pScrollPanel->GetWidth()); + __pScrollPanel->SetClientAreaHeight(__pList->GetY()+__listHeight); + Invalidate(true); + AppLog("the scroll panel height is Rect(%d,%d,%d,%d) ClientHeight = %d",__pScrollPanel->GetX(),__pScrollPanel->GetY(),__pScrollPanel->GetWidth(),__pScrollPanel->GetHeight(),__pScrollPanel->GetClientAreaBounds().height); + return; +} + +void +AddBookmarkForm::OnKeypadWillOpen(Control& source) +{ + return; +} + +void +AddBookmarkForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + + // Code to handle events when the AddBookmarkForm is activated. + String str = "-1"; + String pageTitle = L""; + String pageUrl = L"http://"; + String title = L""; + String url = L""; + result r = E_FAILURE; + Header* pHeader = GetHeader(); + + r = BookmarkPresentationModel::GetInstance()->GetFolderCount(str, __folderCount); + TryCatch( r == E_SUCCESS, ,"Failed to intitialize GETFOLDERCOUNT %s",GetErrorMessage(r)); + + if ( pHeader == NULL ) + { + return ; + } + if ( previousSceneId != IDSCN_CREATE_BOOKMARK_FOLDER ) + { + // check first argument of pargs 0 for Add, 1 - for Edit + String* firstValue = NULL; + if(pArgs) + { + firstValue = dynamic_cast(pArgs->GetAt(0)); + } + + if( firstValue == NULL || pArgs == NULL) + { + return ; + } + if (firstValue->CompareTo(L"1") == 0) + { + __view = CommonUtil::GetString(L"IDS_BR_SK_EDIT"); + + pHeader->SetTitleText(CommonUtil::GetString(L"IDS_BR_HEADER_EDIT_BOOKMARK")); + + if (__pBookmark != NULL && pArgs != NULL) + { + delete __pBookmark; + __pBookmark = null; + } + + if (__pBookmark == NULL && pArgs != NULL) + { + __pBookmark = dynamic_cast(pArgs->GetAt(1)); + } + + if (__pBookmark) + { + pageTitle = __pBookmark->GetBookmarkTitle(); + pageUrl = __pBookmark->GetUrl(); + } + } + else if (firstValue->CompareTo(L"0") == 0) + { + __view = CommonUtil::GetString(L"IDS_COM_SK_ADD"); + pHeader->SetTitleText(CommonUtil::GetString(L"IDS_BR_HEADER_EDIT_BOOKMARK")); + + WindowInfo* pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo(); + + if( pWindowInfo == NULL ) + { + return; + } + + pageTitle = pWindowInfo->pageTitle; + if(pWindowInfo->pageUrl.IsEmpty() == false) + { + pageUrl = pWindowInfo->pageUrl; + } + String* parentID = dynamic_cast(pArgs->GetAt(1)); + + ArrayList folderList; + + BookmarkData* pBookmark = null; + BookmarkPresentationModel::GetInstance()->GetFolder(L"-1", 0, __folderCount, folderList); + for(int count = 0; count < folderList.GetCount(); count++) + { + pBookmark = dynamic_cast< BookmarkData* >(folderList.GetAt(count)); + + if ( pBookmark == null ) + { + return ; + } + + if (parentID != NULL && pBookmark->GetBookmarkId().CompareTo(parentID->GetPointer()) == 0) + { + __selectedIndex = count + 2; + __folderName = pBookmark->GetBookmarkTitle(); + break; + } + else + { + __selectedIndex = 1 ; + __folderName = CommonUtil::GetString(L"IDS_BR_TAB_BOOKMARKS") ; + } + + } + + if (__folderCount == 0) + { + __selectedIndex = 1 ; + __folderName = CommonUtil::GetString(L"IDS_BR_TAB_BOOKMARKS") ; + } + + folderList.RemoveAll(true); + } + } + + if ( previousSceneId == IDSCN_CREATE_BOOKMARK_FOLDER ) + { + pageTitle = __titleOnViewDeactivated; + pageUrl = __urlOnViewDeactivated; + } + + if (__pEditFieldTitle != NULL) + { + __pEditFieldTitle->SetText(pageTitle); + __pEditFieldTitle->ShowKeypad(); + } + if (__pEditFieldUrl != NULL) + { + __pEditFieldUrl->SetText(pageUrl); + __pEditFieldUrl->HideKeypad(); + } + + if (__view == CommonUtil::GetString(L"IDS_BR_SK_EDIT") && previousSceneId == IDSCN_CREATE_BOOKMARK_FOLDER ) + { + if (__oldFolderCount == 0) + { + if (__folderCount == 1) + { + __selectedIndex = 2; + } + } + else if (__oldFolderCount != __folderCount) + { + __selectedIndex = __folderCount + 1; + } + + } + + + if (__view == CommonUtil::GetString(L"IDS_COM_SK_ADD") && previousSceneId == IDSCN_CREATE_BOOKMARK_FOLDER) + { + + if (__oldFolderCount == 0) + { + if (__folderCount == 1) + { + __selectedIndex = 2; + } + } + else if (__oldFolderCount != __folderCount) + { + __selectedIndex = __folderCount + 1; + if(__selectedIndex > 1) + { + String parentID = L"-1"; + ArrayList folderList; + BookmarkData* pBookmark = null; + BookmarkPresentationModel::GetInstance()->GetFolder(parentID, 0, __folderCount, folderList); + pBookmark = static_cast(folderList.GetAt(__selectedIndex-2)); + __folderName = pBookmark->GetBookmarkTitle(); + } + } + else if (__oldFolderCount == __folderCount ) + { + __selectedIndex = __folderCount + 1; + } + } + if (__pEditFieldTitle != NULL) + { + title = __pEditFieldTitle->GetText(); + title.Trim(); + } + + if (__pEditFieldUrl != NULL) + { + url = __pEditFieldUrl->GetText(); + url.Trim(); + } + + // To disable done button if either of the Title or Url field is empty + if (title.GetLength() == 0 || url.GetLength() == 0) + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, false); + pHeader->Invalidate(true); + } + else + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, true); + pHeader->Invalidate(true); + } + + if(__pList != null) + { + + __pList->UpdateList(); + __listHeight = __pList->GetItemCount() * H_ITEM_HEIGHT; + __pList->SetBounds(__pList->GetX(),__pList->GetY(),__pList->GetWidth(),__listHeight); + } + // __pList->RefreshList(0, LIST_REFRESH_TYPE_ITEM_MODIFY); + CATCH : return; +} + +void +AddBookmarkForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + // Add code to handle events when the AddBookmarkForm is Deactivated. + if ( __pEditFieldTitle != NULL) + { + __titleOnViewDeactivated = __pEditFieldTitle->GetText(); + } + + if ( __pEditFieldUrl != NULL) + { + __urlOnViewDeactivated = __pEditFieldUrl->GetText(); + } + + __oldFolderCount = __folderCount; + + if (__view == CommonUtil::GetString(L"IDS_BR_SK_EDIT") ) + { + __selectedIndex = 0; + } + return; +} + +void +AddBookmarkForm::OnTextValueChanged(const Control& source) +{ + String title = L""; + String url = L""; + Header* pHeader = GetHeader(); + if (pHeader == NULL) + { + return; + } + + if (__pEditFieldTitle == NULL || __pEditFieldUrl == NULL) + { + return; + } + + title = __pEditFieldTitle->GetText(); + url = __pEditFieldUrl->GetText(); + title.Trim(); + url.Trim(); + + // To disable done button if either of the Title or Url field is empty + if (title.GetLength() == 0 || url.GetLength() == 0) + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, false); + pHeader->Invalidate(true); + } + else + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, true); + pHeader->Invalidate(true); + } + + return; +} + +void +AddBookmarkForm::OnTextValueChangeCanceled(const Control& source) +{ + return; +} + +void +AddBookmarkForm::CreateMessage(String& str) +{ + Tizen::Ui::Controls::MessageBox* pMsgBox = null; // Message Box to display alert if folder with same name already exists + int __modalMsgBoxResult; + + pMsgBox = new(std::nothrow) MessageBox; + if (pMsgBox != null) + { + pMsgBox->Construct(str, L"", MSGBOX_STYLE_OK, 3000); + pMsgBox->ShowAndWait(__modalMsgBoxResult); + delete pMsgBox; + pMsgBox = null; + __modalMsgBoxResult = 0; + } + + return; +} + +void +AddBookmarkForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) +{ + // if (__pEditFieldTitle != NULL) + // { + // __pEditFieldTitle->HideKeypad(); + // } + // if (__pEditFieldUrl != NULL) + // { + // __pEditFieldUrl->HideKeypad(); + // } + + if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE) + { + if (__pScrollPanel != null) + { + __pScrollPanel->ScrollToTop(); + __pScrollPanel->SetClientAreaHeight(__pList->GetY()+__listHeight); + } + } + + //__pScrollPanel->Invalidate(true); + + if(__showFolderList == false) + { + if(__pLabel1 != null) + { + __pLabel1->SetShowState(true); + } + } + else + { + if(__pLabel1 != null) + { + __pLabel1->SetShowState(false); + } + } + + if (__pLabel1 != null) + { + __pLabel1->SetBounds(__pLabel1->GetX(),__pList->GetY()+ __listHeight + 2,__pLabel1->GetWidth(),__pLabel1->GetHeight()); + __pLabel1->Invalidate(true); + } + + if (__pList != null) + { + __pList->SetBounds(__pList->GetX(),__pList->GetY(),__pList->GetWidth(),__listHeight); + __pList->UpdateList(); + } + Invalidate(true); +} diff --git a/src/IntAddressbar.cpp b/src/IntAddressbar.cpp new file mode 100644 index 0000000..51637e0 --- /dev/null +++ b/src/IntAddressbar.cpp @@ -0,0 +1,853 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntAddressbar + *@brief: This class defines common behaviour of Addressbar control. + * + */ + +#include "IntAddressbar.h" +#include "IntCommonLib.h" +#include "IntTypes.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSettingPresentationModel.h" +#include "IntMultipleWindowPresentationModel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Graphics; + +static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png"; +static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png"; +static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png"; +static const wchar_t* IDB_ICON_PRIVATE = L"I01_icon_private.png"; + +//Action IDs +const int Addressbar::IDA_REFRESH_BTN_CLICKED = 101; +const int Addressbar::IDA_READER_BTN_CLICKED = 102; +const int Addressbar::IDA_STOP_BTN_CLICKED = 103; +const int Addressbar::IDA_GO_BACK = 104; +const int Addressbar::IDA_GO_FORWARD = 105; +const int Addressbar::IDA_CANCEL = 106; +const int Addressbar::IDA_CLEAR_URL = 107; + +Addressbar::Addressbar(void) +{ + __currentAddMode = ADDRESSBAR_MODE_LOADING_COMPLETE; + __displayUrl = L""; + __editTextUrl = L""; + __isLoadingData = false; + __isLoadingCompleted = false; + __progressPercentage = 0; + __pAddressbarBg = null; + __pBgPanel = null; + __pCancelBtn = null; + __pClearBtn = null; + __pFavIcon = FaviconManager::GetInstance()->GetDefaultFaviconN(); + __pFaviconLabel = null; + __pGoBackBtn = null; + __pGoForwardBtn = null; + __pLabelPrivateOn = null; + __pListener = null; + __pPrivateIconLabel = null; + __pProgressbarLabel = null; + __pPrivateIconLabel = null ; + __pReaderBtn = null; + __pRefreshBtn = null; + __pStopBtn = null; + __pClearBtn = null ; + __pSearchLabel = null; + __pUrlField = null; +} + +Addressbar::~Addressbar(void) +{ + if (__pFavIcon != null) + { + delete __pFavIcon; + __pFavIcon = null; + } +} + +result +Addressbar::Initialize(const Rectangle& rect) +{ + result r = E_SUCCESS; + + AppLogDebug("Addressbar::Initialize entered"); + //Construct the base first + r = Construct(L"IDL_ADDRESSBAR"); + + //Add background label + Label* pBgLabel = static_cast (GetControl(L"IDC_BG_LABEL",true)); + if (pBgLabel == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + + //Add inner panel for border + __pBgPanel = static_cast (GetControl(L"IDC_BG_PANEL",true)); + if (__pBgPanel == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + + __pLabelPrivateOn = static_cast (GetControl(L"IDC_LABEL_PRIVATE_ON",true)); + + if (__pLabelPrivateOn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pLabelPrivateOn->SetShowState(false); + + __pAddressbarBg = static_cast (GetControl(L"IDC_ADDRESSBAR_BG_LABEL",true)); + if (__pAddressbarBg == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pBgPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT); + Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pAddressbarBg->GetWidth(), __pAddressbarBg->GetHeight()); + if (pBitmap != null) + { + __pAddressbarBg->SetBackgroundBitmap(*pBitmap); + delete pBitmap; + } + + //Add the backround label for displaying progressbar + __pProgressbarLabel = static_cast (GetControl(L"IDC_PROGRESS_BAR_LABEL",true)); + if (__pProgressbarLabel == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pProgressbarLabel->SetShowState(false); + + //Add the go Back Button + __pGoBackBtn = static_cast (GetControl(L"IDC_BACKWARD_BUTTON",true)); + if (__pGoBackBtn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pGoBackBtn->SetActionId(IDA_GO_BACK); + __pGoBackBtn->AddActionEventListener(*this); + __pGoBackBtn->SetEnabled(false); + + //Add the go forward Button + __pGoForwardBtn = static_cast (GetControl(L"IDC_FORWARD_BUTTON",true)); + if (__pGoForwardBtn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pGoForwardBtn->SetActionId(IDA_GO_FORWARD); + __pGoForwardBtn->AddActionEventListener(*this); + __pGoForwardBtn->SetEnabled(false); + + + //Add the favicon + __pFaviconLabel = static_cast (GetControl(L"IDC_FAVICON_BUTTON",true)); + if (__pFaviconLabel == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + + __pFaviconLabel->SetShowState(false); + + //Add the search icon + __pSearchLabel = static_cast (GetControl(L"IDC_SEARCH_BUTTON",true)); + if (__pSearchLabel == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + + __pSearchLabel->SetShowState(true); + + //Add the refresh button + __pRefreshBtn = static_cast (GetControl(L"IDC_REFRESH_BUTTON",true)); + if (__pRefreshBtn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + + __pRefreshBtn->SetActionId(IDA_REFRESH_BTN_CLICKED); + __pRefreshBtn->AddActionEventListener(*this); + __pRefreshBtn->SetShowState(true); + + + //Add the stop button + __pStopBtn = static_cast (GetControl(L"IDC_STOP_BUTTON",true)); + if (__pStopBtn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED); + __pStopBtn->AddActionEventListener(*this); + __pStopBtn->SetShowState(false); + + + //Add the reader button + __pReaderBtn = static_cast (GetControl(L"IDC_READER_BUTTON",true)); + if (__pReaderBtn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + + __pReaderBtn->SetActionId(IDA_READER_BTN_CLICKED); + __pReaderBtn->AddActionEventListener(*this); + __pReaderBtn->SetShowState(false); + + __pClearBtn = static_cast (GetControl(L"IDC_CLEAR_BUTTON",true)); + if (__pClearBtn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pClearBtn->SetActionId(IDA_CLEAR_URL); + __pClearBtn->AddActionEventListener(*this); + __pClearBtn->SetShowState(false); + + //Add the editfield for url + __pUrlField = static_cast (GetControl(L"IDC_URL_EDITFIELD",true)); + if (__pUrlField == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + + __pUrlField->SetOverlayKeypadCommandButtonVisible(false); + __pUrlField->SetKeypadAction(KEYPAD_ACTION_GO); + + //Add the Cancel Button + __pCancelBtn = static_cast (GetControl(L"IDC_CANCEL_BUTTON",true)); + if (__pCancelBtn == NULL) + { + AppLogDebug("Control not found returning E_INVALID_KEY"); + return E_INVALID_KEY; + } + __pCancelBtn->SetActionId(IDA_CANCEL); + __pCancelBtn->AddActionEventListener(*this); + __pCancelBtn->SetShowState(false); + // Added to get the favorite url if not set then address bar is about blank + + if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0) + { + __pUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL")); + } + else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE")) == 0) + { + __pUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK")); + } + else + { + //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL()); + __pUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL")); + } + __pUrlField->AddKeypadEventListener(*this); + + AppLogDebug("Addressbar::Initialize exit"); + return r; +} + +void +Addressbar::UpdateProgressBitmap(void) +{ + result r = E_SUCCESS; + if (__pProgressbarLabel == null) + return; + int w = __pProgressbarLabel->GetWidth(); + int h = __pProgressbarLabel->GetHeight(); + Canvas canvas; + int progressWidth = 0; + Bitmap* pRetBitmap = null; + + if (__progressPercentage == 0 || __progressPercentage == 100) + { + __pProgressbarLabel->SetShowState(false); + __pProgressbarLabel->Invalidate(false); + return; + } + else + { + __pProgressbarLabel->SetShowState(true); + __pProgressbarLabel->Invalidate(false); + } + + r = canvas.Construct(Rectangle(0, 0, w, h)); + + if (r != E_SUCCESS) + { + AppLogException("Canvas construction failed with %s", GetErrorMessage(r)); + return; + } + + canvas.Clear(); + Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG); + + if (pBgBmp != null) + { + pBgBmp->Scale(Dimension(w, h)); + canvas.DrawBitmap(Point(0,0), *pBgBmp); + delete pBgBmp; + } + + progressWidth = (double) (w) * __progressPercentage / 100; + AppLogDebug("progressWidth: %d", progressWidth); + Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR); + + if (pProgressBmp != null) + { + pProgressBmp->Scale(Dimension(progressWidth, h)); + canvas.DrawBitmap(Point(0,0), *pProgressBmp); + delete pProgressBmp; + } + + pRetBitmap = new (std::nothrow) Bitmap(); + + if (pRetBitmap == null) + { + AppLogException("Bitmap creation failed with %s", GetErrorMessage(r)); + return; + } + + pRetBitmap->Construct(canvas, canvas.GetBounds()); + + if (__pProgressbarLabel != null && pRetBitmap != null) + { + __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap); + __pProgressbarLabel->Invalidate(false); + } + + + if (pRetBitmap != null) + { + delete pRetBitmap; + pRetBitmap = null; + } + return; +} + +void +Addressbar::SetUrl(const String& url) +{ + __displayUrl = url; + String updatedDisplayUrl; + updatedDisplayUrl.Clear(); + + if (__pUrlField != NULL) + { + String removedHttpUrl = RemoveHttpTextFromDisplayURL(); + if (removedHttpUrl.IsEmpty() == false) + { + __pUrlField->SetText(removedHttpUrl); + } + else + { + __pUrlField->SetText(__displayUrl); + } + + __pUrlField->Invalidate(false); + __pUrlField->SetCursorPosition(0); + } +} + +String +Addressbar::GetUrl(void) +{ + return __displayUrl; +} + +AddressBarMode +Addressbar::GetAddressbarMode(void) +{ + return __currentAddMode; +} + +void +Addressbar::SetAddressbarMode(AddressBarMode addMode) +{ + AppLogDebug("AddressBar::setAddressbarMode to %d",addMode); + + __currentAddMode = addMode; + + switch(addMode) + { + case ADDRESSBAR_MODE_INVALID: + { + // do nothing + } + break; + case ADDRESSBAR_MODE_READER: + { + __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y); + __pSearchLabel->SetShowState(false); + __pFaviconLabel->SetShowState(true); + __pCancelBtn->SetShowState(false); + __pRefreshBtn->SetShowState(false); + __pStopBtn->SetShowState(false); + __pReaderBtn->SetShowState(true); + __pReaderBtn->Invalidate(true); + __pGoForwardBtn->SetShowState(true); + __pGoBackBtn->SetShowState(true); + __pClearBtn->SetShowState(false); + + } + break; + + case ADDRESSBAR_MODE_LOADING: + { + __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y); + __pSearchLabel->SetShowState(false); + __pFaviconLabel->SetShowState(true); + __pCancelBtn->SetShowState(false); + __pRefreshBtn->SetShowState(false); + __pStopBtn->SetShowState(true); + __pReaderBtn->SetShowState(false); + __pGoForwardBtn->SetShowState(true); + __pGoBackBtn->SetShowState(true); + __pClearBtn->SetShowState(false); + + } + break; + + case ADDRESSBAR_MODE_LOADING_COMPLETE: + { + __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y); + __pCancelBtn->SetShowState(false); + + if (__pUrlField && __pUrlField->GetText().IsEmpty() == false) + { + + __pSearchLabel->SetShowState(false); + __pFaviconLabel->SetShowState(true); + } + else + { + __pSearchLabel->SetShowState(true); + __pFaviconLabel->SetShowState(false); + } + + if (__pUrlField != NULL) + { + __pUrlField->SetText(__displayUrl); + __pUrlField->HideKeypad(); + } + + __pRefreshBtn->SetShowState(true); + __pStopBtn->SetShowState(false); + __pReaderBtn->SetShowState(false); + __pGoForwardBtn->SetShowState(true); + __pGoBackBtn->SetShowState(true); + __pClearBtn->SetShowState(false); + } + break; + case ADDRESSBAR_MODE_EDIT: + { + __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x,__pBgPanel->GetPosition().y); + __pCancelBtn->SetShowState(true); + __pRefreshBtn->SetShowState(false); + __pStopBtn->SetShowState(false); + __pReaderBtn->SetShowState(false); + __pGoForwardBtn->SetShowState(false); + __pGoBackBtn->SetShowState(false); + __pClearBtn->SetShowState(true); + if (__pUrlField && __pUrlField->GetText().IsEmpty() == true) + { + __pSearchLabel->SetShowState(true); + __pFaviconLabel->SetShowState(false); + } + else + { + __pSearchLabel->SetShowState(false); + __pFaviconLabel->SetShowState(true); + } + if (__pUrlField != NULL) + { + __pUrlField->SetCursorPosition(__pUrlField->GetTextLength()); + } + + } + break; + } + + if (__pAddressbarBg->GetWidth() != __pBgPanel->GetWidth()) + { + __pAddressbarBg->SetBounds(Rectangle(0, 0, __pBgPanel->GetWidth(), __pBgPanel->GetHeight())); + Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pAddressbarBg->GetWidth(), __pAddressbarBg->GetHeight()); + if (pBitmap != null) + { + __pAddressbarBg->SetBackgroundBitmap(*pBitmap); + delete pBitmap; + } + } + + Invalidate(true); + + if (__pListener != null) + { + __pListener->OnAddressBarModeChanged(*this); + } +} + +void +Addressbar::SetFaviconBitmap(const Tizen::Graphics::Bitmap& favicon) +{ + + String url =__pUrlField->GetText(); + String secureSiteText = "https://"; + bool flag = false; + flag = url.StartsWith(secureSiteText,0); + + if (__pFavIcon != null) + { + delete __pFavIcon; + } + + __pFavIcon = new(std::nothrow) Bitmap(); + __pFavIcon->Construct(favicon,Rectangle(0,0,favicon.GetWidth(),favicon.GetHeight())); + + if (flag == true) + { + Bitmap* pButtonImage = GetLockedImageN(); + + if (pButtonImage != null) + { + __pFaviconLabel->SetBackgroundBitmap(*pButtonImage); + __pFaviconLabel->Invalidate(true); + delete pButtonImage; + } + } + else + { + if (__pFaviconLabel != null) + { + __pFaviconLabel->SetBackgroundBitmap(*__pFavIcon); + __pFaviconLabel->Invalidate(true); + } + } +} + +void Addressbar::SaveAddressbarEditText() +{ + __editTextUrl = __pUrlField->GetText(); +} + +void +Addressbar::UpdateFaviconBitmap(bool isPrivateOn) +{ + + String url =__pUrlField->GetText(); + String secureSiteText = "https://"; + bool flag = false; + flag = url.StartsWith(secureSiteText,0); + + if (isPrivateOn == true) + { + __pUrlField->SetBounds(__pLabelPrivateOn->GetBounds().x + __pLabelPrivateOn->GetBounds().width,__pUrlField->GetBounds().y , __pAddressbarBg->GetBounds().width - __pLabelPrivateOn->GetBounds().width - __pRefreshBtn->GetBounds().width - __pSearchLabel->GetBounds().width,__pUrlField->GetBounds().height ); + __pLabelPrivateOn->SetShowState(true); + + } + else + { + __pUrlField->SetBounds(__pLabelPrivateOn->GetBounds().x ,__pUrlField->GetBounds().y , __pAddressbarBg->GetBounds().width - __pRefreshBtn->GetBounds().width - __pSearchLabel->GetBounds().width,__pUrlField->GetBounds().height ); + __pLabelPrivateOn->SetShowState(false); + } + + + if (flag == true) + { + Bitmap* pButtonImage = GetLockedImageN(); + + if (pButtonImage != null) + { + __pFaviconLabel->SetBackgroundBitmap(*pButtonImage); + __pFaviconLabel->Invalidate(true); + delete pButtonImage; + } + } + else + { + if (__pFaviconLabel != null) + { + __pFaviconLabel->SetBackgroundBitmap(*__pFavIcon); + __pFaviconLabel->Invalidate(true); + } + } + + + __pAddressbarBg->Invalidate(true); +} + +void +Addressbar::SetForwardButtonEnabled(bool isEnabled) +{ + __pGoForwardBtn->SetEnabled(isEnabled); + __pGoBackBtn->Invalidate(true); +} + +void +Addressbar::SetBackButtonEnabled(bool isEnabled) +{ + __pGoBackBtn->SetEnabled(isEnabled); + __pGoBackBtn->Invalidate(true); +} + +void +Addressbar::SetAddressbarEventListener(IAddressbarEventListener* plistener) +{ + __pListener = plistener; +} + +void +Addressbar::UpdateProgress(int percentage) +{ + __progressPercentage = percentage; + if (percentage == 0 || percentage == 100) + { + __isLoadingData = false; + if (percentage == 100) + { + __isLoadingCompleted = true; + __progressPercentage = 0; + } + else + { + __isLoadingCompleted = false; + } + } + else + { + __isLoadingData = true; + } + UpdateProgressBitmap(); +} + +int +Addressbar::GetProgress(void) +{ + return __progressPercentage; +} + +void +Addressbar::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + AppLogDebug("Addressbar::OnActionPerformed action %d",actionId); + + switch (actionId) + { + case IDA_REFRESH_BTN_CLICKED: + __isLoadingCompleted = false; + __isLoadingData = true; + __progressPercentage = 0; + __pUrlField->HideKeypad(); + __displayUrl = __pUrlField->GetText(); + + if (__pListener != NULL) + { + __pListener->OnUrlSubmitted(*this); + } + + UpdateProgressBitmap(); + break; + + case IDA_STOP_BTN_CLICKED: + __isLoadingCompleted = false; + __isLoadingData = false; + __progressPercentage = 0; + __pUrlField->HideKeypad(); + __displayUrl = __pUrlField->GetText(); + + if (__pListener != NULL) + { + __pListener->OnStopClicked(*this); + } + + UpdateProgressBitmap(); + break; + case IDA_READER_BTN_CLICKED: + __pUrlField->HideKeypad(); + __displayUrl = __pUrlField->GetText(); + + if (__pListener != NULL) + { + __pListener->OnReaderClicked(*this); + } + + break; + + case IDA_GO_BACK: + { + if (__pListener != NULL) + { + __pListener->OnBackClicked(*this); + + } + } + break; + + case IDA_GO_FORWARD: + { + if (__pListener != NULL ) + __pListener->OnForwardClicked(*this); + } + break; + + case IDA_CANCEL: + { + __pListener->OnAddressCancelledClicked(*this); + __pUrlField->SetText(__displayUrl); + __editTextUrl = L""; + __pUrlField->HideKeypad(); + SetAddressbarMode(ADDRESSBAR_MODE_LOADING_COMPLETE); + } + break; + + case IDA_CLEAR_URL: + { + if (__pUrlField->GetText().IsEmpty() == false) + { + //__displayUrl = __pUrlField->GetText(); + __pUrlField->Clear(); + __pUrlField->Invalidate(true); + } + } + break; + default: + break; + } +} + +void +Addressbar::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction) +{ + AppLog("Addressbar::OnKeypadActionPerformed keypadAction %d",keypadAction); + switch (keypadAction) + { + case KEYPAD_ACTION_GO: + case KEYPAD_ACTION_ENTER: + case KEYPAD_ACTION_SEND: + { + if (__pUrlField->GetText().IsEmpty() == false) + { + SetAddressbarMode(ADDRESSBAR_MODE_LOADING); + __displayUrl = __pUrlField->GetText(); + + __isLoadingCompleted = false; + __isLoadingData = true; + __progressPercentage = 0; + __pUrlField->HideKeypad(); + + if (__pListener != NULL) + { + __pListener->OnUrlSubmitted(*this); + } + UpdateProgressBitmap(); + + } + } + break; + + default: + break; + } +} + +void +Addressbar::OnKeypadClosed(Tizen::Ui::Control& source) +{ + __pListener->OnAddressBarKeypadClosed(*this); +} + +void +Addressbar::OnKeypadOpened(Tizen::Ui::Control& source) +{ +// __pListener->OnAddressBarKeypadOpened(*this); + __pListener->OnAddressBarKeypadOpened(*this); +} + +void +Addressbar::OnKeypadWillOpen(Tizen::Ui::Control& source) +{ + SetAddressbarMode(ADDRESSBAR_MODE_EDIT); + // SetAddressbarMode(__prevAddMode); + if(__pListener != null) + { + __pListener->OnAddressBarKeypadWillOpen(*this); + } +} +void +Addressbar::OrientationChanged(void) +{ + Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pAddressbarBg->GetWidth(), __pAddressbarBg->GetHeight()); + if (pBitmap != null) + { + __pAddressbarBg->SetBackgroundBitmap(*pBitmap); + delete pBitmap; + } + Invalidate(true); +} + +String +Addressbar::RemoveHttpTextFromDisplayURL(void) +{ + bool isHttpText = __displayUrl.Contains(L"http://"); + String updatedDisplayUrl; + updatedDisplayUrl.Clear(); + + if (isHttpText == true) + { + __displayUrl.SubString(7,updatedDisplayUrl); + } + return updatedDisplayUrl; +} + +Bitmap* +Addressbar::GetLockedImageN(void) +{ + Bitmap* pIconImage = null; + + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + if (pAppResource) + { + pIconImage = pAppResource->GetBitmapN(IDB_ICON_PRIVATE); + } + + Bitmap* pLockImage = new (std::nothrow) Bitmap(); + + Canvas* pCanvas = new (std::nothrow) Canvas(); + pCanvas->Construct(Rectangle(0,0,__pFaviconLabel->GetWidth(),__pFaviconLabel->GetHeight())); + pCanvas->Clear(); + pCanvas->DrawBitmap(Rectangle(0,0,__pFaviconLabel->GetWidth(),__pFaviconLabel->GetHeight()),*__pFavIcon); + pCanvas->DrawBitmap(Rectangle(__pFaviconLabel->GetWidth()/2,__pFaviconLabel->GetHeight()/2,__pFaviconLabel->GetWidth()/2,__pFaviconLabel->GetHeight()/2),*pIconImage); + pLockImage->Construct(*pCanvas,Rectangle(0,0,__pFaviconLabel->GetWidth(),__pFaviconLabel->GetHeight())); + + delete pCanvas; + return pLockImage; +} + + diff --git a/src/IntBookmarkData.cpp b/src/IntBookmarkData.cpp new file mode 100644 index 0000000..e496f4f --- /dev/null +++ b/src/IntBookmarkData.cpp @@ -0,0 +1,177 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntBookmark.cpp + *@brief: Used to define bookmark + */ + +#include "IntBookmarkData.h" + +using namespace Tizen::Base; + +BookmarkData::BookmarkData(void) + : __bookmarkId("") + , __bookmarkType(BOOKMARK_TYPE_URL) + , __bookmarkTitle("") + , __bookmarkUrl("") + , __parentId("-1") + , __iconPath("") + , __faviconId("") +{ + __createdTime.SetValue(0, 0, 0); + __modifiedTime.SetValue(0, 0, 0); +} + +BookmarkData::BookmarkData(const BookmarkData& bookmark) +{ + __bookmarkId = bookmark.__bookmarkId; + __bookmarkType = bookmark.__bookmarkType; + __bookmarkTitle = bookmark.__bookmarkTitle; + __bookmarkUrl = bookmark.__bookmarkUrl; + __parentId = bookmark.__parentId; + __iconPath=bookmark.__iconPath; + __faviconId=bookmark.__faviconId; +} + +BookmarkData::~BookmarkData(void) +{ + +} + +BookmarkData& +BookmarkData::operator =(const BookmarkData& rhs) +{ + if (this != &rhs) + { + __bookmarkId = rhs.__bookmarkId; + __bookmarkType = rhs.__bookmarkType; + __bookmarkTitle = rhs.__bookmarkTitle; + __bookmarkUrl = rhs.__bookmarkUrl; + __parentId = rhs.__parentId; + __iconPath = rhs.__iconPath; + __faviconId = rhs.__faviconId; + } + return *this; +} + +String +BookmarkData::GetBookmarkId(void) +{ + return __bookmarkId; +} + +type +BookmarkData::GetBookmarkType(void) +{ + if (__bookmarkUrl.GetLength() > 0) + __bookmarkType = BOOKMARK_TYPE_URL; + else + __bookmarkType = BOOKMARK_TYPE_FOLDER; + return __bookmarkType; +} + +String +BookmarkData::GetBookmarkTitle(void) +{ + return __bookmarkTitle; +} + +String +BookmarkData::GetUrl(void) +{ + return __bookmarkUrl; +} + +String +BookmarkData::GetParentId(void) +{ + return __parentId; +} + +DateTime +BookmarkData::GetCreatedTime(void) +{ + return __createdTime; +} + +DateTime +BookmarkData::GetModifiedTime(void) +{ + return __modifiedTime; +} + +String +BookmarkData::GetIconPath(void) +{ + return __iconPath; +} + +String +BookmarkData::GetFaviconId(void) +{ + return __faviconId; +} + +void +BookmarkData::SetBookmarkId(const String& strBookmarkId) +{ + __bookmarkId = strBookmarkId; +} + +void +BookmarkData::SetBookmarkTitle(String& strTitle) +{ + strTitle.Trim(); + __bookmarkTitle = strTitle; +} + +void +BookmarkData::SetUrl(const String& strUrl) +{ + __bookmarkUrl = strUrl; +} + +void +BookmarkData::SetParentId(const String& strParentID) +{ + __parentId = strParentID; +} + +void +BookmarkData::SetCreatedTime(const DateTime& strCreatedTime) +{ + __createdTime = strCreatedTime; +} + +void +BookmarkData::SetModifiedTime(const DateTime& strModifiedTime) +{ + __modifiedTime = strModifiedTime; +} + +void +BookmarkData::SetIconPath(const String& strFilePath) +{ + __iconPath = strFilePath; +} + +void +BookmarkData::SetFaviconId(const String& strFaviconId) +{ + __faviconId = strFaviconId; +} diff --git a/src/IntBookmarkListForm.cpp b/src/IntBookmarkListForm.cpp new file mode 100644 index 0000000..c30e429 --- /dev/null +++ b/src/IntBookmarkListForm.cpp @@ -0,0 +1,1095 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntBookmarkListForm + *@brief: This class defines BookmarkListForm + * + */ + +#include +#include "IntBookmarkData.h" +#include "IntBookmarkListForm.h" +#include "IntBookmarkPresentationModel.h" +#include "IntCommonLib.h" +#include "IntConfirmationPopup.h" +#include "IntFaviconManager.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSceneRegister.h" +#include "IntTypes.h" + + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +const wchar_t* DEFAULT_VALUE_PARENTID = L"-1"; +static const wchar_t* IDB_TAB_ICON_BOOKMARK = L"I01_tab_icon_bookmarks.png"; +static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png"; +static const wchar_t* IDB_NO_CONTENT_BOOKMARK = L"I01_Nocontents_Bookmarks.png"; +static const wchar_t* IDB_ICON_FOLDER_OPEN = L"I01_icon_folder_open.png"; + +const int BookmarkListForm::IDA_TABBAR_ITEM_1 = 101; +const int BookmarkListForm::IDA_TABBAR_ITEM_2 = 102; +const int BookmarkListForm::IDA_FOOTER_ITEM1 = 103; +const int BookmarkListForm::IDA_FOOTER_ITEM2 = 104; +const int BookmarkListForm::IDA_FOOTER_ITEM_ADDBOOKMARK = 105; +const int BookmarkListForm::IDA_FORMAT_FOLDER = 106; +const int BookmarkListForm::IDA_FORMAT_SITE = 107; +const int BookmarkListForm::IDA_CONTEXT_ITEM_FOLDER_EDIT = 108; +const int BookmarkListForm::IDA_CONTEXT_ITEM_FOLDER_DELETE = 109; +const int BookmarkListForm::IDA_CONTEXT_ITEM_EDIT = 110; +const int BookmarkListForm::IDA_CONTEXT_ITEM_SHARE = 111; +const int BookmarkListForm::IDA_CONTEXT_ITEM_DELETE = 112; +const int BookmarkListForm::IDA_FORMAT_ICON = 113; +const int BookmarkListForm::IDA_FORMAT_URL = 114; + +//const int BookmarkListForm::IDA_CONFIRMATION_NO = 1000; +//const int BookmarkListForm::IDA_CONFIRMATION_YES = 1001; + +BookmarkListForm::BookmarkListForm(void) +{ + __pItemContextFolder = null ; + __pItemContextSite = null ; + __pListview = null; + __pData = null; + __pSearchListView = null; + __pSearchBar = null; + __searchBookmark = false; + __parentID = DEFAULT_VALUE_PARENTID; + __noBookmarks = true; + __selectedindex = 0; +} + +BookmarkListForm::~BookmarkListForm(void) +{ + + if (__pData != null) + { + __pData->RemoveAll(true); + delete __pData; + __pData = NULL; + } + + if (__pItemContextFolder != null) + { + delete __pItemContextFolder; + } + + if (__pItemContextSite != null) + { + delete __pItemContextSite; + } +} + +result +BookmarkListForm::OnTerminating(void) +{ + result r = E_SUCCESS; + + if (__pData != null) + { + __pData->RemoveAll(true); + delete __pData; + __pData = NULL; + } + + return r; +} + + +bool +BookmarkListForm::Initialize(void) +{ + Construct(L"IDL_BOOKMARK_LIST"); + return true; +} + +result +BookmarkListForm::OnInitializing(void) +{ + result r = E_SUCCESS; + HeaderItem bookmark; + HeaderItem history; + Bitmap *pBitmapNormal = null; + Bitmap *pBitmapPressed = null; + Header *pHeader = GetHeader(); + Bitmap *pIconBitmap = null; + AppResource* pAppResource = UiApp::GetInstance()->GetAppResource(); + int bookmarkCount = 0; + const int WIDTH_CONTEXT_MENU_TWO_BUTTON = 336; + const int WIDTH_CONTEXT_MENU_THREE_BUTTON = 160; + const int HEIGHT_CONTEXT_MENU_BUTTON = 72; + + // Setup back event listener + SetFormBackEventListener(this); + AddOrientationEventListener(*this); + + SceneManager::GetInstance()->AddSceneEventListener(IDSCN_BOOKMARK_VIEW, *this); + GetHeader()->AddActionEventListener(*this); + GetFooter()->AddActionEventListener(*this); + + if ( pAppResource == NULL ) + { + return E_FAILURE; + } + + __pItemContextFolder = new(std::nothrow) ListContextItem(); + __pItemContextFolder->Construct(); + __pItemContextFolder->AddElement(IDA_CONTEXT_ITEM_FOLDER_EDIT, CommonUtil::GetString(L"IDS_BR_SK_EDIT")); + pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", WIDTH_CONTEXT_MENU_TWO_BUTTON, HEIGHT_CONTEXT_MENU_BUTTON); + pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", WIDTH_CONTEXT_MENU_TWO_BUTTON, HEIGHT_CONTEXT_MENU_BUTTON); + + if (pBitmapNormal != null && pBitmapPressed != null) + { + __pItemContextFolder->AddElement(IDA_CONTEXT_ITEM_FOLDER_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed); + } + + if (pBitmapNormal != null) + { + delete pBitmapNormal; + } + + if (pBitmapPressed != null) + { + delete pBitmapPressed; + } + + __pItemContextSite = new(std::nothrow) ListContextItem(); + __pItemContextSite->Construct(); + __pItemContextSite->AddElement(IDA_CONTEXT_ITEM_EDIT, CommonUtil::GetString(L"IDS_BR_SK_EDIT")); + __pItemContextSite->AddElement(IDA_CONTEXT_ITEM_SHARE, CommonUtil::GetString(L"IDS_BR_OPT_SHARE")); + pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", WIDTH_CONTEXT_MENU_THREE_BUTTON, HEIGHT_CONTEXT_MENU_BUTTON); + pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", WIDTH_CONTEXT_MENU_THREE_BUTTON, HEIGHT_CONTEXT_MENU_BUTTON); + + if (pBitmapNormal != null && pBitmapPressed != null) + { + __pItemContextSite->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed); + } + + if (pBitmapNormal != null) + { + delete pBitmapNormal; + } + + if (pBitmapPressed != null) + { + delete pBitmapPressed; + } + __pListview = static_cast< ListView* >(GetControl("IDC_LISTVIEW1")); + + if (__pListview == null) + { + return E_FAILURE; + } + __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1")); + + if (__pSearchBar == null) + { + return E_FAILURE; + } + + if (__pListview != null) + { + // __pListview->SetBounds(__pListview->GetX(), __pListview->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height); + __pListview->AddFastScrollListener(*this); + __pListview->AddListViewItemEventListener(*this); + __pListview->SetItemProvider(*this); + __pListview->UpdateList(); + } + + __pPopUp = new(std::nothrow) SharePopup(); + + if (__pPopUp != null) + { + __pPopUp->Initialize(); + AddControl(*__pPopUp); + } + + __pSearchListView = new(std::nothrow) ListView(); + + if (__pSearchListView == null) + { + return E_FAILURE; + } + + r = __pSearchListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height -72 - 30), true, false); + TryCatch( !IsFailed(r),,"BookmarkListForm::OnSearchBarModeChanged Update list failed %s",GetErrorMessage(r)); + + __pSearchListView->SetItemProvider(*this); + __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND")); + __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK)); + __pSearchListView->SetShowState(false); + __pSearchListView->AddListViewItemEventListener(*this); + + __pSearchBar->AddSearchBarEventListener(*this); + __pSearchBar->AddKeypadEventListener(*this); + __pSearchBar->SetContent(__pSearchListView); + + BookmarkPresentationModel::GetInstance()->GetFolderBookmarkCount(__parentID, bookmarkCount); + if(bookmarkCount <= 0) + { + __pSearchBar->SetShowState(false); + //__pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pSearchBar->GetWidth(),GetClientAreaBounds().height - __pSearchBar->GetPosition().y); + __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pListview->GetWidth(),GetClientAreaBounds().height); + } + else + { + __pSearchBar->SetShowState(true); + } + + + if (pHeader != null) + { + pHeader->SetStyle(HEADER_STYLE_TAB); + bookmark.Construct(IDA_TABBAR_ITEM_1); + String strbookmark; + pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark); + bookmark.SetText(strbookmark); + pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARK); + bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap); + bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap); + pHeader->AddItem(bookmark); + + if (pIconBitmap != NULL) + { + delete pIconBitmap; + } + + history.Construct(IDA_TABBAR_ITEM_2); + String strhistory; + pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory); + history.SetText(strhistory); + pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY); + history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap); + history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap); + pHeader->AddItem(history); + pHeader->SetItemSelected(0); + + if (pIconBitmap != NULL) + { + delete pIconBitmap; + } + } + + + CATCH:return r; +} + +void +BookmarkListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + AppLogDebug("BookmarkListForm::OnActionPerformed actionId = %d",actionId); + String bookmarkId; + int id = 0; + BookmarkData* pBookMark = null; + + switch (actionId) + { + case IDA_FOOTER_ITEM1: + { + GetHeader()->SetItemSelected(0); + GetHeader()->Invalidate(true); + SceneManager* pSceneManager = SceneManager::GetInstance(); + pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(__selectedindex)); + + if ( pBookMark == NULL ) + { + return; + } + + ArrayList* pArgList = null; + pArgList = new(std::nothrow) ArrayList(); + if (pArgList != null) + { + pArgList->Construct(); + pArgList->Add(*new(std::nothrow) String(pBookMark->GetParentId())); + } + //pArgList->Add(*new(std::nothrow) String(pBookmark->); + if (pSceneManager != null) + { + if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_BOOKMARK_LIST),pArgList) != E_SUCCESS) + { + AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed"); + pArgList->RemoveAll(true); + delete pArgList; + pArgList = null; + return; + } + } + + if ( pArgList != NULL) + { + pArgList->RemoveAll(true); + delete pArgList; + } + } + + break; + case IDA_TABBAR_ITEM_2: + { + GetHeader()->SetItemSelected(0); + GetHeader()->Invalidate(true); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager != null) + { + if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS) + { + AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed"); + return; + } + } + } + break; + case IDA_FOOTER_ITEM2: + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager) + { + if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_BOOKMARK_FOLDER)) != E_SUCCESS) + { + AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed"); + return; + } + } + } + break; + case IDA_FOOTER_ITEM_ADDBOOKMARK: + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + + // send array list 0-for add, 1 for edit with parent ID + ArrayList* pArgList = null; + pArgList = new(std::nothrow) ArrayList(); + if (pArgList != null) + { + pArgList->Construct(); + pArgList->Add(*new(std::nothrow) String(L"0")); + pArgList->Add(*new(std::nothrow) String(__parentID)); + } + + if (pSceneManager) + { + if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ADD_BOOKMARK),pArgList) != E_SUCCESS) + { + AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed"); + pArgList->RemoveAll(true); + delete pArgList; + return; + } + } + + if (pArgList != null) + { + pArgList->RemoveAll(true); + delete pArgList; + } + + } + break; + case IDA_BUTTON_NO: + __pConfirmationPopup->SetShowState(false); + __pConfirmationPopup->Show(); + break; + case IDA_BUTTON_YES: + pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(__selectedindex)); + if ( pBookMark== null) + return; + bookmarkId=pBookMark->GetBookmarkId(); + Integer::Parse(bookmarkId,id); + if (pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER) + BookmarkPresentationModel::GetInstance()->DeleteFolder(id); + else + BookmarkPresentationModel::GetInstance()->DeleteBookmark(id); + if (__pListview == null) + { + return; + } + AppLogDebug("__pListview GetBounds %d,%d,%d,%d",__pListview->GetBounds().x,__pListview->GetBounds().y,__pListview->GetBounds().width,__pListview->GetBounds().height); + __pSearchListView->UpdateList(); + __pListview->UpdateList(); + + if (__pListview->GetItemCount() == 0) + { + GetFooter()->SetItemEnabled(1,false); + __pSearchBar->SetShowState(false); + __pSearchBar->Invalidate(true); + } + + if (__noBookmarks == true) + { + Bitmap* emptyListBmp = AppResource::GetInstance()->GetBitmapN(IDB_NO_CONTENT_BOOKMARK); + GetFooter()->SetItemEnabled(1,false); + __pSearchBar->SetShowState(false); + __pSearchBar->Invalidate(true); + // __pListview->SetBounds(__pSearchBar->GetPosition().x,__pSearchBar->GetPosition().y,__pSearchBar->GetWidth() ,GetClientAreaBounds().height); + __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetPosition().y,__pSearchBar->GetWidth() ,GetClientAreaBounds().height); + __pListview->SetBitmapOfEmptyList(emptyListBmp); + if (emptyListBmp) + { + delete emptyListBmp; + emptyListBmp = null; + } + __pListview->UpdateList(); + + } + else + { + GetFooter()->SetItemEnabled(1,true); + + if (__parentID.CompareTo(L"-1") == 0) + { + __pSearchBar->SetShowState(true); + __pSearchBar->Invalidate(true); + } + } + + GetFooter()->Invalidate(true); + __pConfirmationPopup->SetShowState(false); + __pConfirmationPopup->Show(); + + break; + default: + break; + } +} + +void +BookmarkListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) +{ + AppLogDebug("BrowserApplicationForm::OnFormBackRequested"); + + UiApp* pApp = UiApp::GetInstance(); + if (pApp == null) + { + return; + } + + if (__parentID != DEFAULT_VALUE_PARENTID) + { + __parentID = DEFAULT_VALUE_PARENTID; + __pSearchBar->SetShowState(true); + __pListview->SetBounds(__pListview->GetX() ,__pSearchBar->GetPosition().y + __pSearchBar->GetHeight(),__pListview->GetWidth(),GetClientAreaBounds().height - (__pSearchBar->GetY() + __pSearchBar->GetHeight())); + __pListview->UpdateList(); + __pFooter = GetFooter(); + GetFooter()->SetItemEnabled(2,true); + GetFooter()->Invalidate(true); + } + else + { + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager != null) + { + pSceneManager->GoBackward(BackwardSceneTransition()); + } + } + + if (__noBookmarks == true) + { + GetFooter()->SetItemEnabled(1,false); + } + else + { + GetFooter()->SetItemEnabled(1,true); + } +} + +Tizen::Ui::Controls::ListItemBase* +BookmarkListForm::CreateItem(int index, int itemWidth) +{ + AppLog("BookmarkListForm::CreateItem index %d , itemWidth %d",index, itemWidth); + AppLog("listviewwidth %d",__pListview->GetWidth()); + result r = E_FAILURE; + ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; + CustomItem* pItem = new(std::nothrow) CustomItem(); + BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index)); + Bitmap* pBitmap = null; + + const int x_Margin_Icon = 16; // local as there used only in this function + const int y_Margin_Icon = 28; + const int height_Icon = 72; + const int width_Icon = 72 ; + const int x_Margin_Title = 104 ; + const int y_Margin_Title = 10; + const int width_Title = GetClientAreaBounds().width - 108 - 52 - 30; + const int x_Margin_Url = 104 ; + const int y_Margin_Url = 70 ; + const int width_Url = GetClientAreaBounds().width - 108 - 52 ; + const int height_Url = 48; + const int itemHeight = 128; + const int textSize = 32; + String bitmapId; + + if( pBookMark == NULL ) + { + delete pItem; + pItem = null; + return NULL; + } + if ( pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER ) + { + r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth,112), LIST_ANNEX_STYLE_DETAILED); + TryCatch(!IsFailed(r),,"BookmarkListForm::CreateItem Construct failed %s",GetErrorMessage(r)); + + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_FOLDER_OPEN); + if (pBitmap != null) + { + pItem->AddElement(Rectangle(x_Margin_Icon, 20, width_Icon, height_Icon), IDA_FORMAT_ICON, *pBitmap, null); + delete pBitmap; + } + + pItem->AddElement(Rectangle(x_Margin_Title, 26, width_Title, 60), IDA_FORMAT_FOLDER, pBookMark->GetBookmarkTitle(), true); + + if ( __pItemContextFolder != NULL) + { + pItem->SetContextItem(__pItemContextFolder); + } + } + else + { + r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, itemHeight), style); + TryCatch( !IsFailed(r),,"BookmarkListForm::CreateItem Construct failed %s",GetErrorMessage(r)); + + AppLogDebug("BookmarkListForm::faviconid %ls",pBookMark->GetFaviconId().GetPointer()); + bitmapId = pBookMark->GetFaviconId(); + + pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId); + if (pBitmap == null) + { + AppLogDebug("BookmarkListForm::CreateItem bitmap is null"); + pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN(); + } + pItem->AddElement(Rectangle(x_Margin_Icon, y_Margin_Icon, width_Icon, height_Icon), IDA_FORMAT_ICON, *pBitmap, null); + pItem->AddElement(Rectangle(x_Margin_Title, 0, width_Title, itemHeight - height_Url), IDA_FORMAT_SITE, pBookMark->GetBookmarkTitle(),44,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true); + if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT) + pItem->AddElement(Rectangle(x_Margin_Url, y_Margin_Url, width_Url, height_Url), IDA_FORMAT_URL, pBookMark->GetUrl(),textSize,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true); + else + pItem->AddElement(Rectangle(x_Margin_Url, y_Margin_Url, width_Url, height_Url), IDA_FORMAT_URL, pBookMark->GetUrl(),textSize,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true); + + if (pBitmap != null) + { + delete pBitmap; + } + if ( __pItemContextSite != NULL) + { + pItem->SetContextItem(__pItemContextSite); + } + } + + return pItem; + + CATCH: + delete pItem; + pItem = null; + return null; + +} + +bool +BookmarkListForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth) +{ + delete pItem; + pItem = null; + return true; +} + +int +BookmarkListForm::GetItemCount(void) +{ + int count = 0; + + if (__pData != NULL ) + { + __pData->RemoveAll(true); + delete __pData; + __pData = null; + } + __pData = new(std::nothrow) Collection::ArrayList(); + __pData->Construct(); + + if (__searchBookmark == false) + { + BookmarkPresentationModel::GetInstance()->GetFolderBookmarkCount(__parentID, count); + BookmarkPresentationModel::GetInstance()->GetFoldersBookmarks(__parentID, 0, count, *__pData); + } + else + { + String searchBarText = __pSearchBar->GetText(); + BookmarkPresentationModel::GetInstance()->GetSearchFolderBookmarkCount(count,searchBarText); + BookmarkPresentationModel::GetInstance()->GetSearchFoldersBookmarks(0, count, *__pData, searchBarText); + } + + AppLogDebug("Count = %d parentId = %ls", count, __parentID.GetPointer()); + + if (count <= 0) + { + __noBookmarks = true; + GetFooter()->SetItemEnabled(1,false); + } + else + { + __noBookmarks = false; + GetFooter()->SetItemEnabled(1,true); + } + + AppLogDebug("Result: %s", GetErrorMessage(GetLastResult())); + GetFooter()->Invalidate(true); + if (__pData != null && __pData->GetCount() >= 1) + { + // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL); + __pSearchBar->SetShowState(true); + __pSearchBar->Invalidate(true); + } + else if (__searchBookmark == false) + { + __pSearchBar->SetShowState(false); + __pSearchBar->Invalidate(true); + } + + if (__parentID.CompareTo(L"-1") != 0) + { + __pSearchBar->SetShowState(false); + __pSearchBar->Invalidate(true); + } + if (__noBookmarks == true) + { + __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetPosition().y,__pSearchBar->GetWidth() ,GetClientAreaBounds().height); + Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_NO_CONTENT_BOOKMARK); + + if ( pBitmap != NULL) + { + __pListview->SetBitmapOfEmptyList(pBitmap); + delete pBitmap; + } + } + else + { + if (__parentID.CompareTo(L"-1") == 0) + { + __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetHeight(),GetClientAreaBounds().width ,GetClientAreaBounds().height - __pSearchBar->GetY() - __pSearchBar->GetHeight()); + } + else + { + __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pSearchBar->GetWidth() ,GetClientAreaBounds().height); + + } + + } + __pListview->Invalidate(true); + return count; + +} + +void +BookmarkListForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status) +{ + AppLogDebug("BookmarkListForm::OnListViewContextItemStateChanged int index %d, int elementId %d, Tizen::Ui::Controls::ListContextItemStatus status %d",index,elementId,status); + + String deleteText = CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"); + deleteText.Append(L"? "); + int timeOut = 25000; + result r = E_SUCCESS; + + switch(elementId) + { + case IDA_CONTEXT_ITEM_FOLDER_EDIT: + { + ArrayList* pArgList = null; + String* pEdit = null; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index)); + if (pBookMark != null && pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER) + { + pArgList = new(std::nothrow) ArrayList(); + if (pArgList != null) + { + pEdit= new(std::nothrow) String(CommonUtil::GetString(L"IDS_BR_HEADER_EDIT_FOLDER")); + pArgList->Construct(); + pArgList->Add(*new(std::nothrow) BookmarkData(*pBookMark)); + pArgList->Add(*pEdit); + if ( pSceneManager != null) + { + result r; + r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_BOOKMARK_FOLDER), pArgList); + } + + if (pArgList != null) + { + delete pArgList; + pArgList = null; + } + if(IsFailed(r)) + { + AppLogDebug("BookmarkListForm::OnListViewContextItemStateChanged GoForward failed %s",GetErrorMessage(r)); + return; + } + } + } + + } + break; + + case IDA_CONTEXT_ITEM_FOLDER_DELETE: + case IDA_CONTEXT_ITEM_DELETE: + { + __pConfirmationPopup = new(std::nothrow) ConfirmationPopup(); + __pConfirmationPopup->Initialize(); + __pConfirmationPopup->RemoveActionListener(*this); + __pConfirmationPopup->AddActionListener(*this); + __pConfirmationPopup->setMessage(deleteText); + __pConfirmationPopup->Show(); + __selectedindex = index; + } + break; + + case IDA_CONTEXT_ITEM_EDIT: + { + ArrayList* pArgList = null; + SceneManager* pSceneManager = SceneManager::GetInstance(); + BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index)); + if (pBookMark!= null && pBookMark->GetBookmarkType() == BOOKMARK_TYPE_URL) + { + AppLogDebug("ID_CONTEXT_ITEM_SITE_1 BOOKMARK_TYPE_URL"); + pArgList = new(std::nothrow) ArrayList(); + if (pArgList != null) + { + pArgList->Construct(); + pArgList->Add(*new(std::nothrow) String(L"1")); + pArgList->Add(*new(std::nothrow) BookmarkData(*pBookMark)); + if ( pSceneManager != null) + { + result r; + r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ADD_BOOKMARK), pArgList); + if (pArgList != null) + { + delete pArgList; + pArgList = null; + } + if(IsFailed(r)) + { + AppLogDebug("BookmarkListForm::OnListViewContextItemStateChanged GoForward failed %s",GetErrorMessage(r)); + return; + } + } + } + } + } + break; + case IDA_CONTEXT_ITEM_SHARE: + { + AppLogDebug("OnListViewContextItemStateChanged Share"); + + BookmarkData* pBookmark = dynamic_cast(__pData->GetAt(index)); + if (pBookmark != null) + { + ShareInfo* pShareInfo = new(std::nothrow) ShareInfo(); + pShareInfo->SetPageTitle(pBookmark->GetBookmarkTitle()); + pShareInfo->SetPageUrl(pBookmark->GetUrl()); + pShareInfo->SetImageAttached(false); + __pPopUp->RemoveAllShareInfo(); + __pPopUp->AddShareInfo(pShareInfo); + } + + if (__pPopUp != null) + { + __pPopUp->SetShowState(true); + __pPopUp->Show(); + } + } + break; + default: + break; + } + +} + +void +BookmarkListForm::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) +{ + +} + +void +BookmarkListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) +{ + AppLogDebug("BookmarkListForm::OnListViewItemStateChanged"); + + result r = E_FAILURE; + ArrayList *pArgList = null; + SceneManager* pSceneManager = SceneManager::GetInstance(); + BookmarkData* pBookmark = dynamic_cast< BookmarkData* >(__pData->GetAt(index)); + + if ( pBookmark == NULL ) + { + return; + } + + switch (pBookmark->GetBookmarkType()) + { + case BOOKMARK_TYPE_FOLDER: + + __parentID = pBookmark->GetBookmarkId(); + AppLogDebug("BOOKMARK_TYPE_FOLDER parent ID is %ls",__parentID.GetPointer()); + + listView.UpdateList(); + if (listView.GetItemCount() == 0) + { + GetFooter()->SetItemEnabled(1,false); + } + else + { + GetFooter()->SetItemEnabled(1,true); + } + GetFooter()->SetItemEnabled(2,false); + GetFooter()->Invalidate(true); + __pSearchBar->HideKeypad(); + __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL); + __pSearchBar->SetShowState(false); + __pSearchBar->Invalidate(true); + __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pListview->GetWidth() ,GetClientAreaBounds().height); + break; + + case BOOKMARK_TYPE_URL: + + pArgList = new(std::nothrow) ArrayList(); + if (pArgList != null) + { + r = pArgList->Construct(); + TryCatch(!IsFailed(r), L"BookmarkListForm::OnListViewItemStateChanged pArgList Construct failed %s", GetErrorMessage(r)); + + AppLogDebug("bookmark url = %ls",pBookmark->GetUrl().GetPointer()); + r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo()); + pArgList->Add(*new(std::nothrow) String(pBookmark->GetUrl())); + + if (pSceneManager != null) + { + AppLogDebug("pSceneManager exists"); + String prevSceneId; + MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(prevSceneId); + r = pSceneManager->GoBackward(BackwardSceneTransition(prevSceneId), pArgList); + TryCatch(!IsFailed(r), L"BookmarkListForm::OnListViewItemStateChanged pArgList Construct failed %s", GetErrorMessage(r)); + } + delete pArgList; + } + break; + + default: + break; + } + + return; + CATCH: + if(pArgList) + { + pArgList->RemoveAll(true); + delete pArgList; + } + +} + +void +BookmarkListForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction) +{ + + +} + +void +BookmarkListForm::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index) +{ + +} + +void +BookmarkListForm::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode) +{ + result r = E_FAILURE; + if (mode == SEARCH_BAR_MODE_NORMAL) + { + __pSearchListView->SetShowState(false); + __pListview->SetShowState(true); + Invalidate(true); + __searchBookmark = false; + r = __pListview->UpdateList(); + TryCatch( !IsFailed(r),,"BookmarkListForm::OnSearchBarModeChanged Update list failed %s",GetErrorMessage(r)); + CATCH:return; + } + else + { + __pSearchListView->SetShowState(true); + __pSearchListView->SetEnabled(false); + __pListview->SetShowState(false); + if(__pSearchBar) + { + __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight())); + __pSearchBar->SetText(L""); + } + r = __pListview->UpdateList(); + __pSearchListView->UpdateList(); + } +} + +void +BookmarkListForm::OnKeypadWillOpen(Tizen::Ui::Control& source) +{ + Footer* pFooter = GetFooter(); + pFooter->SetShowState(false); + __pSearchListView->SetEnabled(false); +} + +void +BookmarkListForm::OnKeypadOpened(Tizen::Ui::Control& source) +{ + +} + +void +BookmarkListForm::OnKeypadClosed(Tizen::Ui::Control& source) +{ + if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchBookmark == false) + { + + __pSearchListView->SetEnabled(true); + } + GetFooter()->SetShowState(true); + Invalidate(true); +} + +void +BookmarkListForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction) +{ + AppLog("BookmarkListForm::OnKeypadActionPerformed %d",keypadAction); + if (__pSearchBar != null) + { + __pSearchBar->HideKeypad(); + } + + if ( __pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH) + { + if (__pSearchBar->GetText().GetLength() == 0) + { + return; + } + __searchBookmark = true; + __pListview->SetShowState(false); + __pSearchListView->SetEnabled(true); + __pSearchListView->SetShowState(true); + __pSearchListView->UpdateList(); + + } + Invalidate(true); +} + +void +BookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("BookmarkListForm::OnSceneActivatedN called"); + + __searchBookmark = false; + + GetHeader()->SetItemSelected(0); + GetHeader()->Invalidate(true); + + /* if (previousSceneId != IDSCN_HISTORY_LIST && previousSceneId != IDSCN_CREATE_BOOKMARK_FOLDER && previousSceneId != IDSCN_EDIT_BOOKMARK_LIST) + { + __previousSceneId = previousSceneId; + }*/ + + if (__pListview != null) + { + __pListview->UpdateList(); + } + + return; +} + +void +BookmarkListForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + AppLog("BookmarkListForm::OnOrientationChanged start"); + + if (__pListview) + { + if(__pSearchBar->GetShowState()) + { + __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetHeight(),GetClientAreaBounds().width ,GetClientAreaBounds().height - __pSearchBar->GetY() - __pSearchBar->GetHeight()); + } + else + { + __pListview->SetBounds(__pListview->GetX(),0,GetClientAreaBounds().width ,GetClientAreaBounds().height); + } + __pListview->UpdateList(); + } + + if (__pSearchListView && __pListview) + { + AppLog("__pListview->GetBounds() %d, %d, %d, %d",__pListview->GetBounds().x,__pListview->GetBounds().y,__pListview->GetBounds().width,__pListview->GetBounds().height); + __pSearchListView->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height -__pSearchBar->GetHeight()); + + if( __searchBookmark == false) + { + __pSearchListView->UpdateList(); + } + + } + + if (__pSearchListView && __pData != null ) + { + if (__parentID != DEFAULT_VALUE_PARENTID) + { + AppLog("BookmarkListForm::OnOrientationChanged parent id true"); + __pSearchBar->SetShowState(false); + __pSearchBar->Invalidate(true); + } + else + { + AppLog("BookmarkListForm::OnOrientationChanged parent id false1"); + if(__pSearchBar->GetShowState() == false) + { + AppLog("BookmarkListForm::OnOrientationChanged parent id false2"); + __pSearchBar->SetShowState(true); + __pSearchBar->Invalidate(true); + } + } + __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight())); + } + + + Invalidate(true); +} + +void +BookmarkListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + if (__pData != null) + { + __pData->RemoveAll(true); + delete __pData; + __pData = null; + } + __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL); + return; +} + diff --git a/src/IntBookmarkPresentationModel.cpp b/src/IntBookmarkPresentationModel.cpp new file mode 100644 index 0000000..3c8c772 --- /dev/null +++ b/src/IntBookmarkPresentationModel.cpp @@ -0,0 +1,1031 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntBookmarkPresentationModel.cpp + *@brief: Used to define BookmarkPresentationModel + */ + +#include +#include "IntBookmarkData.h" +#include "IntBookmarkPresentationModel.h" +#include "IntTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Io; +using namespace Tizen::Locales; +using namespace Tizen::System; + +extern const wchar_t* BOOKMARK_URL_TABLE; +extern const wchar_t* BOOKMARK_FOLDER_TABLE; +extern const wchar_t* DEFAULT_VALUE_PARENTID ; + +BookmarkPresentationModel* BookmarkPresentationModel::__pBookmarkPresentationModel = null; + +BookmarkPresentationModel::BookmarkPresentationModel(void) +{ + +} + +BookmarkPresentationModel::~BookmarkPresentationModel(void) +{ + +} + +BookmarkPresentationModel::BookmarkPresentationModel(const BookmarkPresentationModel& settingModelObj) +{ + +} + +BookmarkPresentationModel& BookmarkPresentationModel::operator=(const BookmarkPresentationModel& settingModelObj) +{ + return *this; +} + +result +BookmarkPresentationModel::Construct(void) +{ + result r = E_SUCCESS; + r = PresentationModelBase::Initialize(); + TryCatch( !IsFailed(r),,"Failed to intitialize bookmarkPresentation Model %s",GetErrorMessage(r)); + CATCH: return r; +} + +void +BookmarkPresentationModel::CreateInstance(void) +{ + if (__pBookmarkPresentationModel == null) + __pBookmarkPresentationModel = new(std::nothrow) BookmarkPresentationModel(); + result r = __pBookmarkPresentationModel->Construct(); + if (IsFailed(r)) + { + delete __pBookmarkPresentationModel; + __pBookmarkPresentationModel = null; + return; + } + std::atexit(DestroyInstance); +} + + +void BookmarkPresentationModel::DestroyInstance(void) +{ + if (__pBookmarkPresentationModel) + { + delete __pBookmarkPresentationModel; + __pBookmarkPresentationModel = null; + } +} + + +BookmarkPresentationModel* +BookmarkPresentationModel::GetInstance(void) +{ + if(__pBookmarkPresentationModel == null) + { + CreateInstance(); + } + return __pBookmarkPresentationModel; +} + +result +BookmarkPresentationModel::SaveFolder(BookmarkData& bookmark) +{ + result r = E_FAILURE; + String bookmarkFolderTable(BOOKMARK_FOLDER_TABLE); + String query; + String columnNames; + int resultCount = -1; + int rowId = -1; + DateTime dt; + String bookmarkId; + String bookmarkTitle = bookmark.GetBookmarkTitle(); + bookmarkTitle.Replace(L"'", L"''"); + + PresentationModelBase::GetCurrentDateTime(dt); + if (bookmark.GetBookmarkId() == "") + { + columnNames.Append(L"TITLE, "); + columnNames.Append(L"CREATED_TIME, "); + columnNames.Append(L"MODIFIED_TIME"); + + query.Append(L"INSERT INTO "); + query.Append(bookmarkFolderTable); + query.Append("("); + query.Append(columnNames); + query.Append(") "); + query.Append("VALUES("); + query.Append("'"); + query.Append(bookmarkTitle); + query.Append("', "); + query.Append("'"); + query.Append(dt.ToString()); + query.Append("', "); + query.Append("'"); + query.Append(dt.ToString()); + query.Append("')"); + } + else + { + query.Append(L"UPDATE "); + query.Append(bookmarkFolderTable); + query.Append(" SET TITLE = "); + query.Append("'"); + query.Append(bookmarkTitle); + query.Append("'"); + query.Append(", MODIFIED_TIME = "); + query.Append("'"); + query.Append(dt.ToString()); + query.Append("'"); + query.Append(" WHERE ID = "); + query.Append(bookmark.GetBookmarkId()); + } + + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::SaveFolder query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + + r = GetLastInsertedId(bookmarkFolderTable, rowId); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::SaveFolder GetLastInsertedId failed %s",GetErrorMessage(r)); + + if (rowId < 0) + return E_FAILURE; + + bookmarkId.Append(rowId); + + //Set the generated ID to Bookmark + bookmark.SetBookmarkId(bookmarkId); + + CATCH: return r; +} + +result +BookmarkPresentationModel::SaveBookmark(BookmarkData& bookmark) +{ + + result r = E_FAILURE; + String bookmarkTable(BOOKMARK_URL_TABLE); + String query; + String columnNames; + String attachment; + int resultCount = -1; + int rowId = -1; + DateTime dt; + String bookmarkId; + String bookmarkTitle = bookmark.GetBookmarkTitle(); + bookmarkTitle.Replace(L"'", L"''"); + String bookmarkUrl = bookmark.GetUrl(); + bookmarkUrl.Replace(L"'", L"''"); + + + PresentationModelBase::GetCurrentDateTime(dt); + if (bookmark.GetBookmarkId() == "") + { + columnNames.Append(L"TITLE, "); + columnNames.Append(L"URL, "); + columnNames.Append(L"PARENT_BOOKMARK_ID, "); + columnNames.Append(L"CREATED_TIME, "); + columnNames.Append(L"MODIFIED_TIME, "); + columnNames.Append(L"ICON_PATH, "); + columnNames.Append(L"FAVICON_ID"); + + query.Append(L"INSERT INTO "); + query.Append(bookmarkTable); + query.Append("("); + query.Append(columnNames); + query.Append(") "); + query.Append("VALUES("); + query.Append("'"); + query.Append(bookmarkTitle); + query.Append("', "); + query.Append("'"); + query.Append(bookmarkUrl); + query.Append("', "); + query.Append(bookmark.GetParentId()); + query.Append(", "); + query.Append("'"); + query.Append(dt.ToString()); + query.Append("', "); + query.Append("'"); + query.Append(dt.ToString()); + query.Append("', "); + query.Append("'"); + query.Append(bookmark.GetIconPath()); + query.Append("'"); + query.Append(", "); + query.Append("'"); + query.Append(bookmark.GetFaviconId()); + query.Append("'"); + query.Append(")"); + } + else + { + query.Append(L"UPDATE "); + query.Append(bookmarkTable); + query.Append(" SET TITLE = "); + query.Append("'"); + query.Append(bookmarkTitle); + query.Append("'"); + query.Append(", URL = "); + query.Append("'"); + query.Append(bookmarkUrl); + query.Append("'"); + query.Append(", PARENT_BOOKMARK_ID = "); + query.Append(bookmark.GetParentId()); + query.Append(", MODIFIED_TIME = "); + query.Append("'"); + query.Append(dt.ToString()); + query.Append("'"); + query.Append(", ICON_PATH = "); + query.Append("'"); + query.Append(bookmark.GetIconPath()); + query.Append("'"); + query.Append(", FAVICON_ID = "); + query.Append("'"); + query.Append(bookmark.GetFaviconId()); + query.Append("'"); + query.Append(" WHERE ID = "); + query.Append(bookmark.GetBookmarkId()); + } + + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::SaveBookmark query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + + r = GetLastInsertedId(bookmarkTable, rowId); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::SaveBookmark GetLastInsertedId failed %s",GetErrorMessage(r)); + + if (rowId < 0) + return E_FAILURE; + + bookmarkId.Append(rowId); + + //Set the generated ID to Bookmark + bookmark.SetBookmarkId(bookmarkId); + + CATCH: return r; +} + +result +BookmarkPresentationModel::DeleteFolder(int folderId) +{ + result r = E_SUCCESS; + String query; + String bookmarkFolderTable(BOOKMARK_FOLDER_TABLE); + int resultCount = -1; + + if (folderId < 1) + { + return E_INVALID_ARG; + } + + //strQuery.Format(MAX_DB_QUERY_SIZE, L"DELETE FROM %ls WHERE ID = %d", strBookmarkTable.GetPointer(), bookmarkId); + query.Append(L"DELETE FROM "); + query.Append(bookmarkFolderTable); + query.Append(" WHERE ID = "); + query.Append(folderId); + + r = BookmarkPresentationModel::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteBookmark query failed %s",GetErrorMessage(r)); + r = BookmarkPresentationModel::CommitDb(); + DeleteBookmarkByFolderId(folderId); + + CATCH: return r; +} + +result +BookmarkPresentationModel::DeleteBookmark(int bookmarkId) +{ + result r = E_SUCCESS; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + int resultCount = -1; + + if (bookmarkId < 1) + { + return E_INVALID_ARG; + } + + //strQuery.Format(MAX_DB_QUERY_SIZE, L"DELETE FROM %ls WHERE ID = %d", strBookmarkTable.GetPointer(), bookmarkId); + query.Append(L"DELETE FROM "); + query.Append(bookmarkTable); + query.Append(" WHERE ID = "); + query.Append(bookmarkId); + + r = BookmarkPresentationModel::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteBookmark query failed %s",GetErrorMessage(r)); + r = BookmarkPresentationModel::CommitDb(); + + CATCH: return r; +} + +result +BookmarkPresentationModel::DeleteBookmarkByFolderId(int folderId) +{ + result r = E_SUCCESS; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + int resultCount = -1; + + if (folderId < 1) + { + return E_INVALID_ARG; + } + + //strQuery.Format(MAX_DB_QUERY_SIZE, L"DELETE FROM %ls WHERE ID = %d", strBookmarkTable.GetPointer(), bookmarkId); + query.Append(L"DELETE FROM "); + query.Append(bookmarkTable); + query.Append(" WHERE PARENT_BOOKMARK_ID = "); + query.Append(folderId); + + r = BookmarkPresentationModel::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteBookmark query failed %s",GetErrorMessage(r)); + r = BookmarkPresentationModel::CommitDb(); + + CATCH: return r; +} + + +result +BookmarkPresentationModel::GetFolderBookmarkCount(const String& parentID, int& Count) +{ + result r = E_SUCCESS; + int bookmarkCount = 0; + int folderCount = 0; + r = GetBookmarkCount(parentID,bookmarkCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetBookmarkCount query failed %s",GetErrorMessage(r)); + + r = GetFolderCount(parentID,folderCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetBookmarkCount query failed %s",GetErrorMessage(r)); + Count = folderCount+ bookmarkCount; + return E_SUCCESS; + CATCH: + return r; +} + +result +BookmarkPresentationModel::GetBookmarkCount(const String& parentID, int& bookmarkCount) +{ + int count = -1; + int intVal = -1; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + + //query.Format(MAX_DB_QUERY_SIZE, L"SELECT COUNT(ID) FROM %ls WHERE PARENT_ID = %ls", strTable.GetPointer(),notebookId.GetPointer()); + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(bookmarkTable); + query.Append(" WHERE PARENT_BOOKMARK_ID = "); + query.Append(parentID); + + + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetBookmarkCount query failed %s",GetErrorMessage(r)); + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DbIsNextRowPresent query failed %s",GetErrorMessage(r)); + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, intVal); + if (IsFailed(r)) + { + AppLogDebug("Error:BookmarkPresentationModel::GetColumn:%s", GetErrorMessage(r)); + return r; + } + } + bookmarkCount = intVal; + AppLog("Count:%d", bookmarkCount); + + CATCH: return r; +} + +result +BookmarkPresentationModel::GetFolderCount(const String& parentID, int& folderCount) +{ + int count = -1; + int intVal = -1; + String query; + String bookmarkFolderTable(BOOKMARK_FOLDER_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + + if (parentID.CompareTo(DEFAULT_VALUE_PARENTID) != 0) + { + folderCount = 0; + return E_SUCCESS; + } + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(bookmarkFolderTable); + + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetFolderCount query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, intVal); + } + folderCount = intVal; + + CATCH: return r; +} + +result +BookmarkPresentationModel::GetFoldersBookmarks(const String& parentID, int startIndex, int limit, ArrayList& pBookmarkList) +{ + ArrayList arrayList; + arrayList.Construct(); + GetFolder(parentID,startIndex,limit,arrayList); + for(int index = arrayList.GetCount()-1; index >= 0; index--) + { + pBookmarkList.Add(*arrayList.GetAt(index)); + } + arrayList.RemoveAll(false); + GetBookmark(parentID,startIndex,limit,arrayList); + for(int index = arrayList.GetCount()-1; index >= 0; index--) + { + pBookmarkList.Add(*arrayList.GetAt(index)); + } + return E_SUCCESS; +} + +result +BookmarkPresentationModel::GetBookmark(const String& parentID, int startIndex, int limit, ArrayList& pBookmarkList) +{ + int count = -1; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + result r = E_FAILURE; + + query.Append(L"SELECT * FROM "); + query.Append(bookmarkTable); + query.Append(" WHERE PARENT_BOOKMARK_ID = "); + query.Append(parentID); + + //Append LIMIT + if (limit > 0) + { + query.Append(" LIMIT "); + query.Append(limit); + + //Append OFFESET + if (startIndex >= 0) + { + query.Append(" OFFSET "); + query.Append(startIndex); + } + } + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetBookmark query failed %s",GetErrorMessage(r)); + + r = CreateBookmarkList(count, pBookmarkList); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::CreateBookmarkList failed %s",GetErrorMessage(r)); + + CATCH: return r; +} + +result +BookmarkPresentationModel::GetFolder(const String& parentID, int startIndex, int limit, ArrayList& folderList) +{ + int count = -1; + String query; + String bookmarkFolderTable(BOOKMARK_FOLDER_TABLE); + result r = E_FAILURE; + + if (parentID.CompareTo(DEFAULT_VALUE_PARENTID ) != 0) + { + return E_SUCCESS; + } + query.Append(L"SELECT * FROM "); + query.Append(bookmarkFolderTable); + + + //Append LIMIT + if (limit > 0) + { + query.Append(" LIMIT "); + query.Append(limit); + + //Append OFFESET + if (startIndex >= 0) + { + query.Append(" OFFSET "); + query.Append(startIndex); + } + } + + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetFolder query failed %s",GetErrorMessage(r)); + + r = CreateFolderList(count, folderList); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::CreateBookmarkList failed %s",GetErrorMessage(r)); + + CATCH: return r; +} + +result +BookmarkPresentationModel::GetSearchFolderBookmarkCount(int& searchBookmarkCount, String& text) +{ + int searchUrlCount = 0; + int searchFolderCount = 0; + GetSearchBookmarkCount(searchUrlCount,text); + GetSearchFolderCount(searchFolderCount,text); + searchBookmarkCount = searchUrlCount + searchFolderCount; + return E_SUCCESS; +} + +result +BookmarkPresentationModel::GetSearchBookmarkCount(int& searchBookmarkCount, String& text) +{ + + int count = -1; + int intVal = -1; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + text.Replace(L"'", L"''"); + + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(bookmarkTable); + query.Append(L" WHERE (TITLE LIKE '%"); + query.Append(text); + query.Append("%')"); + query.Append(" OR "); + query.Append(L"(URL LIKE '%"); + query.Append(text); + query.Append("%')"); + + r = BookmarkPresentationModel::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchBookmarkCount query failed %s",GetErrorMessage(r)); + + r = BookmarkPresentationModel::DbIsNextRowPresent(nextRowPresent); + + if (nextRowPresent == true) + { + r = BookmarkPresentationModel::GetColumn(0, intVal); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetColumn failed %s",GetErrorMessage(r)); + } + searchBookmarkCount = intVal; + + CATCH: return r; +} + + +result +BookmarkPresentationModel::GetSearchFolderCount(int& searchFolderCount, String& text) +{ + + int count = -1; + int intVal = -1; + String query; + String bookmarkFolderTable(BOOKMARK_FOLDER_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + text.Replace(L"'", L"''"); + + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(bookmarkFolderTable); + query.Append(L" WHERE (TITLE LIKE '%"); + query.Append(text); + query.Append("%')"); + + r = BookmarkPresentationModel::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchBookmarkCount query failed %s",GetErrorMessage(r)); + + r = BookmarkPresentationModel::DbIsNextRowPresent(nextRowPresent); + + if (nextRowPresent == true) + { + r = BookmarkPresentationModel::GetColumn(0, intVal); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetColumn failed %s",GetErrorMessage(r)); + } + searchFolderCount = intVal; + + CATCH: return r; +} + + +result +BookmarkPresentationModel::GetSearchFoldersBookmarks(int startIndex, int limit, ArrayList& pFolderList, String& text) +{ + ArrayList arrayList; + arrayList.Construct(); + GetSearchFolder(startIndex, limit, arrayList,text); + for(int index = arrayList.GetCount()-1; index >= 0; index--) + { + pFolderList.Add(*arrayList.GetAt(index)); + } + arrayList.RemoveAll(false); + GetSearchBookmark(startIndex, limit, arrayList,text); + for(int index = arrayList.GetCount()-1; index >= 0; index--) + { + pFolderList.Add(*arrayList.GetAt(index)); + } + return E_SUCCESS; +} + +result +BookmarkPresentationModel::GetSearchBookmark(int startIndex, int limit, ArrayList& pBookmarkList, String& text) +{ + int count = -1; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + result r = E_FAILURE; + + text.Replace(L"'", L"''"); + query.Append(L"SELECT * FROM "); + query.Append(bookmarkTable); + query.Append(L" WHERE (TITLE LIKE '%"); + query.Append(text); + query.Append("%')"); + query.Append(" OR "); + query.Append(L"(URL LIKE '%"); + query.Append(text); + query.Append("%')"); + //Append LIMIT + if (limit > 0) + { + query.Append(" LIMIT "); + query.Append(limit); + + //Append OFFESET + if (startIndex >= 0) + { + query.Append(" OFFSET "); + query.Append(startIndex); + } + } + + r = BookmarkPresentationModel::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchBookmark query failed %s",GetErrorMessage(r)); + + r = CreateBookmarkList(count, pBookmarkList); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::CreateBookmarkList failed %s",GetErrorMessage(r)); + + CATCH: return r; +} + +result +BookmarkPresentationModel::GetSearchFolder(int startIndex, int limit, ArrayList& pFolderList, String& text) +{ + int count = -1; + String query; + String bookmarkFolderTable(BOOKMARK_FOLDER_TABLE); + result r = E_FAILURE; + text.Replace(L"'", L"''"); + + query.Append(L"SELECT * FROM "); + query.Append(bookmarkFolderTable); + query.Append(L" WHERE (TITLE LIKE '%"); + query.Append(text); + query.Append("%')"); + + //Append LIMIT + if (limit > 0) + { + query.Append(" LIMIT "); + query.Append(limit); + + //Append OFFESET + if (startIndex >= 0) + { + query.Append(" OFFSET "); + query.Append(startIndex); + } + } + + r = BookmarkPresentationModel::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchBookmark query failed %s",GetErrorMessage(r)); + + r = CreateFolderList(count, pFolderList); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::CreateBookmarkList failed %s",GetErrorMessage(r)); + + CATCH: return r; +} + +result +BookmarkPresentationModel::CreateFolderList(int bookmarkCount, ArrayList& folderList) +{ + BookmarkData* pBookmark = null; + int intVal = -1; + String value; + DateTime dateValue; + result r = E_FAILURE; + String bookmarkId; + String parentId; + String faviconId; + DateTime createdTime; + DateTime modifiedTime; + String iconPath; + bool nextRowPresent = false; + + if (bookmarkCount < 1) + { + return E_SUCCESS; + } + + for (int l_bookmarkCount = 0; l_bookmarkCount < bookmarkCount; l_bookmarkCount++) + { + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + if (IsFailed(r)) + return r; + if (nextRowPresent == true) + { + pBookmark = new(std::nothrow) BookmarkData; + if (pBookmark) + { + for (int columnCount = 0; columnCount < MAX_NOTE_TABLE_COLUMN; columnCount++) + { + + switch (columnCount) + { + case 0: + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal > 0) + { + bookmarkId.Clear(); + bookmarkId.Append(intVal); + if (bookmarkId.GetLength() > 0) + pBookmark->SetBookmarkId(bookmarkId); + } + + } + break; + + case 1: + r = PresentationModelBase::GetColumn(columnCount, value); + if (!IsFailed(r)) + { + pBookmark->SetBookmarkTitle(value); + } + break; + + case 2: + r = PresentationModelBase::GetColumn(columnCount, dateValue); + if (!IsFailed(r)) + { + createdTime = dateValue; + pBookmark->SetCreatedTime(createdTime); + } + break; + + case 3: + r = PresentationModelBase::GetColumn(columnCount, dateValue); + if (!IsFailed(r)) + { + modifiedTime = dateValue; + pBookmark->SetModifiedTime(modifiedTime); + } + break; + default: + break; + } + + } + + r = folderList.Add(*pBookmark); + if (IsFailed(r)) + { + delete pBookmark; + return r; + } + } + } + } + return r; +} + +result +BookmarkPresentationModel::CreateBookmarkList(int bookmarkCount, ArrayList& bookmarkList) +{ + BookmarkData* pBookmark = null; + int intVal = -1; + String value; + DateTime dateValue; + result r = E_FAILURE; + String bookmarkId; + String parentId; + String faviconId; + DateTime createdTime; + DateTime modifiedTime; + String iconPath; + bool nextRowPresent = false; + + if (bookmarkCount < 1) + { + return E_SUCCESS; + } + + for (int l_bookmarkCount = 0; l_bookmarkCount < bookmarkCount; l_bookmarkCount++) + { + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + if (IsFailed(r)) + return r; + if (nextRowPresent == true) + { + pBookmark = new(std::nothrow) BookmarkData; + if (pBookmark) + { + for (int columnCount = 0; columnCount < MAX_NOTE_TABLE_COLUMN; columnCount++) + { + + switch (columnCount) + { + case 0: + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal > 0) + { + bookmarkId.Clear(); + bookmarkId.Append(intVal); + if (bookmarkId.GetLength() > 0) + pBookmark->SetBookmarkId(bookmarkId); + } + + } + break; + + case 1: + r = PresentationModelBase::GetColumn(columnCount, value); + if (!IsFailed(r)) + { + pBookmark->SetBookmarkTitle(value); + } + break; + + case 2: + r = PresentationModelBase::GetColumn(columnCount, value); + if (!IsFailed(r)) + { + pBookmark->SetUrl(value); + } + break; + + case 3: + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal > 0) + { + parentId.Clear(); + parentId.Append(intVal); + if (parentId.GetLength() > 0) + pBookmark->SetParentId(parentId); + } + } + break; + + case 4: + r = PresentationModelBase::GetColumn(columnCount, dateValue); + if (!IsFailed(r)) + { + createdTime = dateValue; + pBookmark->SetCreatedTime(createdTime); + } + break; + + case 5: + r = PresentationModelBase::GetColumn(columnCount, dateValue); + if (!IsFailed(r)) + { + modifiedTime = dateValue; + pBookmark->SetModifiedTime(modifiedTime); + } + break; + + case 6: + r = PresentationModelBase::GetColumn(columnCount, value); + if (!IsFailed(r)) + { + iconPath = value; + pBookmark->SetIconPath(iconPath); + } + break; + case 7: + + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal >= 0) + { + faviconId.Clear(); + faviconId.Append(intVal); + if (faviconId.GetLength() > 0) + { + pBookmark->SetFaviconId(faviconId); + } + } + } + break; + + default: + break; + } + + } + + r = bookmarkList.Add(*pBookmark); + if (IsFailed(r)) + { + delete pBookmark; + return r; + } + } + } + } + return r; +} + +result +BookmarkPresentationModel::DoesBookmarkExist(const Tizen::Base::String& Url, bool &exist, const String& parentId, bool checkParentId) +{ + int bookmarkCount = -1; + int intVal = -1; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + int count = 0; + + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(bookmarkTable); + query.Append(" WHERE URL = '"); + query.Append(Url); + if(checkParentId == true) + { + query.Append(L"' AND PARENT_BOOKMARK_ID = '"); + query.Append(parentId); + } + query.Append("'"); + + AppLog("BookmarkPresentationModel::DoesBookmarkExist query is %S",query.GetPointer()); + + r = PresentationModelBase::ExecuteQuery(query, bookmarkCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DoesBookmarkExist query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, intVal); + } + count = intVal; + + if (count == 0) + { + exist = false; + } + else + { + exist = true ; + } + + CATCH: return r; +} + +result +BookmarkPresentationModel::DeleteBookmark(const Tizen::Base::String& url) +{ + result r = E_SUCCESS; + String query; + String bookmarkTable(BOOKMARK_URL_TABLE); + int resultCount = -1; + + query.Append(L"DELETE FROM "); + query.Append(bookmarkTable); + query.Append(" WHERE URL = '"); + query.Append(url); + query.Append(L"'"); + + r = BookmarkPresentationModel::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteBookmark query failed %s",GetErrorMessage(r)); + + r = BookmarkPresentationModel::CommitDb(); + + CATCH: return r; +} diff --git a/src/IntBrightnessForm.cpp b/src/IntBrightnessForm.cpp new file mode 100644 index 0000000..ed02f4d --- /dev/null +++ b/src/IntBrightnessForm.cpp @@ -0,0 +1,290 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet IntBrightness class +/*@file: IntBrightness.cpp + *@brief: This class defines IntBrightness used to change the brightness + * + */ + +#include +#include +#include +#include "IntBrightnessForm.h" +#include "IntCommonLib.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSceneRegister.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +const int IDA_AUTOBTN_CLICKED = 101; +const int IDA_MANUALBTN_CLICKED = 102; + +BrightnessForm::BrightnessForm(void) +{ + __manualBrightness = true; + __pBrightnessSlider = null; + __pLabel = null; +} + +BrightnessForm::~BrightnessForm(void) +{ + +} + +bool +BrightnessForm::Initialize() +{ + Form::Construct(L"IDL_BRIGHTNESS"); + + return true; +} + +result +BrightnessForm::OnInitializing(void) +{ + result r = E_FAILURE; + WindowInfo* pWindowInfo = null; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager != null) + { + r = pSceneManager->AddSceneEventListener(IDSCN_BRIGHTNESS, *this); + if (IsFailed(r)) + { + AppLogException("OnInitialized failed with %s", GetErrorMessage(r)); + return r; + } + } + AddOrientationEventListener(*this); + SetFormBackEventListener(this); + + __pLabel = static_cast< Label* >(GetControl(L"IDC_LABEL", true)); + + pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo(); + if (pWindowInfo != null && pWindowInfo->pWebCanvasBitmap != null && __pLabel != null) + { + int labelWidth = __pLabel->GetWidth(); + int labelHeigth = __pLabel->GetHeight(); + + if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + labelWidth = pWindowInfo->pWebCanvasBitmap->GetWidth() * labelHeigth / pWindowInfo->pWebCanvasBitmap->GetHeight(); + __pLabel->SetBounds(__pLabel->GetX() + (__pLabel->GetWidth() - labelWidth)/2, __pLabel->GetY(), labelWidth, labelHeigth); + } + else + { + labelHeigth = pWindowInfo->pWebCanvasBitmap->GetHeight() * labelWidth / pWindowInfo->pWebCanvasBitmap->GetWidth(); + __pLabel->SetBounds(__pLabel->GetX(), __pLabel->GetY() + (__pLabel->GetHeight() - labelHeigth)/2, labelWidth, labelHeigth); + } + __pLabel->SetBackgroundBitmap(*pWindowInfo->pWebCanvasBitmap); + } + + AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry(); + String sliderKey("SliderValue"); + String tabKey("TabButton"); + int sliderValue = 10; + int tabValue = 1; + + r = pAppRegistry->Get(sliderKey, sliderValue); + if (r == E_KEY_NOT_FOUND) + { + pAppRegistry->Add(sliderKey, sliderValue); + pAppRegistry->Set(sliderKey,sliderValue); + } + + r = pAppRegistry->Get(tabKey, tabValue); + if (r == E_KEY_NOT_FOUND) + { + pAppRegistry->Add(tabKey, tabValue); + pAppRegistry->Set(tabKey,tabValue); + } + r = pAppRegistry->Save(); + if (IsFailed(r)) + { + // Failed to save data to registry + AppLogDebug("OnInitialized failed to save data to registry with %s", GetErrorMessage(r)); + return E_FAILURE; + } + + + __pBrightnessSlider = static_cast< Slider* >(GetControl(L"IDC_FONT_SLIDER", true)); + if (__pBrightnessSlider == null) + { + return E_FAILURE; + } + __pBrightnessSlider->SetRange(1,10); + __pBrightnessSlider->AddSliderEventListener(*this); + + GetFooter()->AddActionEventListener(*this); + return r; +} + +void +BrightnessForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + result r = E_FAILURE; + AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry(); + String sliderKey("SliderValue"); + String tabKey("TabButton"); + int sliderValue = 0; + int tabValue = 0; + + r = pAppRegistry->Get(sliderKey, sliderValue); + r = pAppRegistry->Get(tabKey, tabValue); + + AppLog("BrightnessForm tab value is %d",tabValue); + AppLog("BrightnessForm slider value is %d",sliderValue); + + if(tabValue == 0) + { + __pBrightnessSlider->SetEnabled(false); + __pBrightnessSlider->Invalidate(true); + } + else + { + __pBrightnessSlider->SetEnabled(true); + AppLog("BatteryLvl %d",PowerManager::GetScreenBrightness()); + __pBrightnessSlider->SetValue(PowerManager::GetScreenBrightness()); + __pBrightnessSlider->Invalidate(true); + } + + GetFooter()->SetItemSelected(tabValue); + + __pBrightnessSlider->SetRange(1,10); +// __pBrightnessSlider->SetValue(sliderValue); + + + AppLog("slider value is %d",PowerManager::GetScreenBrightness()); + + Invalidate(true); + +} + +void +BrightnessForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLog("slider value is %d",PowerManager::GetScreenBrightness()); + __pBrightnessSlider->SetValue(PowerManager::GetScreenBrightness()); + Invalidate(true); +} + +void +BrightnessForm::OnSliderBarMoved(Slider& source, int value) +{ + AppLog("coming to OnSliderBarMoved"); + if (__manualBrightness == true) + { + PowerManager::SetScreenBrightness(value); + } +} + +void +BrightnessForm::OnFormBackRequested(Form& source) +{ + + result r = E_FAILURE; + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager != null) + { + // save the slider value + // save the tab button + AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry(); + String sliderKey("SliderValue"); + String tabKey("TabButton"); + int sliderValue = __pBrightnessSlider->GetValue(); + r = pAppRegistry->Set(sliderKey,sliderValue); + FooterItemStatus footerStatus; + GetFooter()->GetItemStatus(0,footerStatus); + if (footerStatus == FOOTER_ITEM_STATUS_SELECTED) + { + r = pAppRegistry->Set(tabKey,0); + } + else + { + r = pAppRegistry->Set(tabKey,1); + } + pAppRegistry->Save(); + r = pSceneManager->GoBackward(BackwardSceneTransition()); + if(IsFailed(r)) + { + AppLogException("OnFormBackRequested failed with %s", GetErrorMessage(r)); + } + } + +} + +void +BrightnessForm::OnActionPerformed(const Control& source, int actionId) +{ + switch (actionId) + { + case IDA_AUTOBTN_CLICKED: + __manualBrightness = false; +// __pBrightnessSlider->SetValue(6); +// __pBrightnessSlider->SetShowState(false); + PowerManager::SetScreenBrightness(6); + __pBrightnessSlider->SetEnabled(false); + __pBrightnessSlider->Invalidate(true); + break; + case IDA_MANUALBTN_CLICKED: + PowerManager::SetScreenBrightness(__pBrightnessSlider->GetValue()); + //__pBrightnessSlider->SetValue(__pBrightnessSlider->GetValue()); + __pBrightnessSlider->SetEnabled(true); + __pBrightnessSlider->SetShowState(true); + __pBrightnessSlider->Invalidate(true); + + __manualBrightness = true; + break; + default: + break; + } +} + +void +BrightnessForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) +{ + WindowInfo* pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo(); + + if (pWindowInfo != null) + { + if(pWindowInfo->pWebCanvasBitmap != null) + { + int labelWidth = __pLabel->GetWidth(); + int labelHeigth = __pLabel->GetHeight(); + + if(orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + labelWidth = pWindowInfo->pWebCanvasBitmap->GetWidth() * labelHeigth / pWindowInfo->pWebCanvasBitmap->GetHeight(); + __pLabel->SetBounds(__pLabel->GetX() + (__pLabel->GetWidth() - labelWidth)/2, __pLabel->GetY(), labelWidth, labelHeigth); + } + else + { + labelHeigth = pWindowInfo->pWebCanvasBitmap->GetHeight() * labelWidth / pWindowInfo->pWebCanvasBitmap->GetWidth(); + __pLabel->SetBounds(__pLabel->GetX(), __pLabel->GetY() + (__pLabel->GetHeight() - labelHeigth)/2, labelWidth, labelHeigth); + } + Invalidate(true); + } + } +} diff --git a/src/IntCommonLib.cpp b/src/IntCommonLib.cpp new file mode 100644 index 0000000..e8ca548 --- /dev/null +++ b/src/IntCommonLib.cpp @@ -0,0 +1,197 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntCommonUtil.cpp + *@brief: To define the common method of Internet application + */ + +#include +#include +#include "IntCommonLib.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Media; + +CommonBitmapTable CommonUtil::__commonBitmapTable[] = { + + // -------- End of table ----------------------------------------------------- + { + NULL, 0, L"", -1, -1 + } // DO NOT REPLACE THIS LINE +}; + +String +CommonUtil::GetString(const String& resourceId) +{ + + result r = E_SUCCESS; + String tmpString; + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + + if (!pAppResource) + { + tmpString = "(Error)"; + return tmpString; + } + + r = pAppResource->GetString(resourceId, tmpString); + + TryCatch( !IsFailed(r),,"CommonUtil::GetString ,pAppResource->GetString Failed %s",GetErrorMessage(r)); + return tmpString; + + CATCH: + tmpString = "(Error)"; + return tmpString; +} + +Bitmap* +CommonUtil::GetBitmapN(const String& path, const int width, const int height) +{ + Bitmap* pBitmap = null; + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + + if (pAppResource == null) + { + return null; + } + + if (path == null) + { + return null; + } + + if (width <= 0 || height <= 0) + { + return null; + } + + AppLogDebug("Calling Decode method for image %ls", path.GetPointer()); + pBitmap = pAppResource->GetBitmapN(path, BITMAP_PIXEL_FORMAT_ARGB8888); + AppLogDebug("Image Decoded successfully"); + + if (pBitmap == null) + { + return null; + } + + if (width > 0 && height > 0) + { + pBitmap->Scale(Dimension(width, height)); + } + + return pBitmap; +} + + +Bitmap* +CommonUtil::GetBitmap(uint id) +{ + AppLogDebug("CommonUtil::GetBitmap entered"); + + Bitmap* pBitmap = null; + + if (__commonBitmapTable[id].ptr) + { + pBitmap = __commonBitmapTable[id].ptr; + AppLogDebug("found already used bitmap pointer"); + } + else + { + AppLogDebug("Not found #%d bitmap data in cache. Start loading...\n", (int) id); + pBitmap = GetBitmapN(__commonBitmapTable[id].filename, + __commonBitmapTable[id].width, + __commonBitmapTable[id].height); + if (pBitmap == NULL) + { + AppLogDebug("Error: Failed to load #%d bitmap.\n", (int) id); + return null; + } + + __commonBitmapTable[id].ptr = pBitmap; + } + + __commonBitmapTable[id].refcount++; + AppLogDebug("CommonUtil::GetBitmap exit"); + return pBitmap; +} + +Bitmap* +CommonUtil::GetNinepatchedBitmapN(const String& strPath, const int width, const int height) +{ + Bitmap* pBmp = UiApp::GetInstance()->GetAppResource()->GetBitmapN(strPath); + + if (pBmp == NULL) + { + AppLogDebug("Couldn't create bitmap %ls error(%s)",strPath.GetPointer(),GetErrorMessage(GetLastResult())); + return null; + } + + Bitmap* pBitmap = null; + result r = E_SUCCESS; + + Canvas* pCanvas = new(std::nothrow) Canvas(); + TryCatch(pCanvas != null, , "Canvas new Fail."); + r = pCanvas->Construct(Rectangle(0,0,width, height)); + TryCatch(r == E_SUCCESS, , "Canvas Construct Fail."); + + r = pCanvas->DrawNinePatchedBitmap(Rectangle(0,0,width, height), *pBmp); + + if (r != E_SUCCESS) + { + AppLogDebug("DrawNinePatchedBitmap Error %ls", GetErrorMessage(r)); + pCanvas->DrawBitmap(Rectangle(0,0,width, height), *pBmp); + } + + pBitmap = new(std::nothrow) Bitmap(); + TryCatch(pBitmap != null, , "Bitmap new Fail."); + + r = pBitmap->Construct(*pCanvas, Rectangle(0,0,width, height)); + TryCatch(r == E_SUCCESS, , "Bitmap Construct Fail."); + + if ( pBmp != NULL) + { + delete pBmp; + } + + if (pCanvas != NULL) + { + delete pCanvas; + } + + return pBitmap; + + CATCH: + if (pBmp != NULL) + { + delete pBmp; + } + + if (pCanvas != NULL) + { + delete pCanvas; + } + + if (pBitmap != NULL) + { + delete pBitmap; + } + + return null; +} diff --git a/src/IntConfirmationPopup.cpp b/src/IntConfirmationPopup.cpp new file mode 100644 index 0000000..659d3f6 --- /dev/null +++ b/src/IntConfirmationPopup.cpp @@ -0,0 +1,109 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +/* + * IntConfirmationPopup.cpp + *@file: IntConfirmationPopup.cpp + *@brief: Common popup to show delete confirmation + */ + +#include +#include + +#include "IntCommonLib.h" +#include "IntConfirmationPopup.h" +#include "IntHistoryPresentationModel.h" +#include "IntSettingPresentationModel.h" + + +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui; +// +//static const int IDA_BUTTON_NO = 1000; +//static const int IDA_BUTTON_YES = 1001; + + +ConfirmationPopup::ConfirmationPopup(void) +{ + __pPopupText = null; + __pYesButton = null; + __pNoButton = null; +} + +ConfirmationPopup::~ConfirmationPopup(void) +{ + +} + +bool +ConfirmationPopup::Initialize(void) +{ + Button* pYesButton = null; + Button* pNoButton = null; + Popup::Construct(L"IDL_CONFIRMATION_POPUP"); + + __pYesButton = static_cast< Button* >(GetControl(L"IDC_BOTTOM_BUTTON1", true)); + if (__pYesButton) + { + __pYesButton->SetActionId(IDA_BUTTON_YES); + } + + __pNoButton = static_cast< Button* >(GetControl(L"IDC_BOTTOM_BUTTON2", true)); + if (__pNoButton) + { + __pNoButton->SetActionId(IDA_BUTTON_NO); + } + + __pPopupText = static_cast< Label* >(GetControl(L"IDC_CONFIRMATION_LABEL", true)); + + return true; +} + +result +ConfirmationPopup::OnTerminating(void) +{ + return E_SUCCESS; +} + +void +ConfirmationPopup::setMessage(String& str) +{ + __message = str; + __pPopupText->SetText(str); +} + +String +ConfirmationPopup::GetMessage(void) +{ + return __message; +} + +void +ConfirmationPopup::AddActionListener(IActionEventListener& listener) +{ + __pYesButton->AddActionEventListener(listener); + __pNoButton->AddActionEventListener(listener); +} + +void +ConfirmationPopup::RemoveActionListener(IActionEventListener& listener) +{ + __pYesButton->RemoveActionEventListener(listener); + __pNoButton->RemoveActionEventListener(listener); +} diff --git a/src/IntCreateBookmarkFolderForm.cpp b/src/IntCreateBookmarkFolderForm.cpp new file mode 100644 index 0000000..957ec7b --- /dev/null +++ b/src/IntCreateBookmarkFolderForm.cpp @@ -0,0 +1,478 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: IntCreateBookmarkFolderForm + *@brief: This class creates Bookmark folder + * + */ + +#include +#include +#include "IntBookmarkPresentationModel.h" +#include "IntBookmarkData.h" +#include "IntCommonLib.h" +#include "IntCreateBookmarkFolderForm.h" +#include "IntSceneRegister.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + + +const int CreateBookmarkFolderForm::IDA_BUTTON_DONE = 101; +const int CreateBookmarkFolderForm::IDA_BUTTON_CANCEL = 102; + +CreateBookmarkFolderForm::CreateBookmarkFolderForm(void) +: __pFolderTitle(null) +, __pMsgBox(null) +, __modalMsgBoxResult(0) +, __pBookmark(null) +, __ret(false) +{ + +} + +CreateBookmarkFolderForm::~CreateBookmarkFolderForm(void) +{ + +} + +bool +CreateBookmarkFolderForm::Initialize(void) +{ + result r = Construct(L"IDL_CREATE_BOOKMARK_FOLDER"); + AppLogDebug("CreateBookmarkFolderForm Construct returned %s",GetErrorMessage(r)); + return true; +} + +result +CreateBookmarkFolderForm::OnInitializing(void) +{ + // Add your initialization code here + + result r = E_SUCCESS; + Header* pHeader = null; + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + pSceneManager->AddSceneEventListener(IDSCN_CREATE_BOOKMARK_FOLDER, *this); + + __pFolderTitle = static_cast< EditField* >(GetControl(L"IDC_EDITFIELD_FOLDER_TITLE")); + + if (__pFolderTitle == null) + { + return E_FAILURE; + } + + __pFolderTitle->AddKeypadEventListener(*this); + __pFolderTitle->AddTextEventListener(*this); + __pFolderTitle->SetOverlayKeypadCommandButtonVisible(false); + + pHeader = GetHeader(); + + if (pHeader != NULL) + { + pHeader->AddActionEventListener(*this); + } + + return r; +} + +result +CreateBookmarkFolderForm::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +void +CreateBookmarkFolderForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + AppLogDebug("CreateBookmarkFolderForm::OnSceneActivatedN"); + + result r = E_SUCCESS; + __previousScene = previousSceneId; + bool flag = false; + ArrayList folderList; + String parentID = "-1"; + String title ; + String folderTitle ; + int count = 0; + int foldercount = 0; + int counter = 0; + __ret = false; + + String pStr = CommonUtil::GetString(L"IDS_BR_HEADER_EDIT_FOLDER"); + + String folder01 = CommonUtil::GetString(L"IDS_BR_BODY_FOLDER"); + folder01.Append(L"_"); + + String* pEvent = null; + if (pArgs != NULL) + { + pEvent = dynamic_cast(pArgs->GetAt(1)); + } + + if (pEvent != null) + { + if (pEvent->CompareTo(pStr) == 0) + { + __ret = true; + } + delete pEvent; + } + + Header* pHeader = GetHeader(); + + if (pHeader != null) + { + if (previousSceneId ==IDSCN_EDIT_BOOKMARK_LIST || __ret == true) + { + pHeader->SetTitleText(CommonUtil::GetString(L"IDS_BR_HEADER_EDIT_FOLDER")); + } + else + { + pHeader->SetTitleText(CommonUtil::GetString(L"IDS_BR_SK3_CREATE_FOLDER")); + } + } + + if (__pFolderTitle == NULL) + { + return; + } + + if (previousSceneId == IDSCN_EDIT_BOOKMARK_LIST || __ret == true) + { + if (__pBookmark != NULL ) + { + delete __pBookmark; + __pBookmark = null; + } + + if ( pArgs != NULL ) + { + __pBookmark = dynamic_cast(pArgs->GetAt(0)); + } + + if (__pBookmark != null) + { + __pFolderTitle->SetText(__pBookmark->GetBookmarkTitle()); + __pFolderTitle->SetFocus(); + __pFolderTitle->ShowKeypad(); + } + } + else + { + __pFolderTitle->SetText(folder01); + __pFolderTitle->SetFocus(); + __pFolderTitle->ShowKeypad(); + + r = BookmarkPresentationModel::GetInstance()->GetFolderCount(parentID, foldercount); // to get count of existing folders + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetInstance()->GetFolderCount failed %s",GetErrorMessage(r)); + + r = BookmarkPresentationModel::GetInstance()->GetFolder(parentID, 0, foldercount, folderList); // to get list of existing folders + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetInstance()->GetFolder failed %s",GetErrorMessage(r)); + + while (true) // to provide user with unique folder title when he creates a new(std::nothrow) folder + { // to generate folder with default name of type Folder_## + flag = false ; + title = L""; + count = 0; + counter++; + title.Append(folder01); + + if (counter/10 == 0) + { + title.Append(0); + } + + title.Append(counter); + + for (count = 0;count < foldercount ; count++) + { + BookmarkData* pBookmark = dynamic_cast(folderList.GetAt(count)); + folderTitle = L""; + if ( pBookmark != NULL) + { + folderTitle = pBookmark->GetBookmarkTitle(); + } + + if (title.Equals(folderTitle,false) == true) + { + flag = true; // if flag is true folder title already exists + break; // break from for loop + } + + } // end of for loop + + if ( flag == false) + { + __pFolderTitle->SetText(title); // if flag is false folder title is unique + break; // break from while loop + } + + } // end of while loop + } + + CATCH: + + folderList.RemoveAll(true); + return; +} + +void +CreateBookmarkFolderForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + if (__pBookmark) + { + delete __pBookmark; + __pBookmark= null; + } +} + +void +CreateBookmarkFolderForm::OnActionPerformed(const Control& source, int actionId) +{ + int count = 0; + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return; + } + + switch (actionId) + { + case IDA_BUTTON_CANCEL: + { + result r; + if (__pFolderTitle != NULL) + { + __pFolderTitle->Clear(); + __pFolderTitle->HideKeypad(); + } + + r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + AppLogDebug("SCENE_ADD_BOOKMARK error = %s",GetErrorMessage(r)); + TryCatch(!IsFailed(r),L"BookmarkPresentationModel::GetFolderCount failed %s",GetErrorMessage(r)); + + } + break; + + case IDA_BUTTON_DONE: + { + result r = E_SUCCESS; + bool flag = false; + ArrayList folderList; + String parentID = "-1"; + int foldercount = 0; + String title; + String folderTitle; + folderTitle = __pFolderTitle->GetText(); + folderTitle.Trim(); + + r = BookmarkPresentationModel::GetInstance()->GetFolderCount(parentID, foldercount); + TryCatch( !IsFailed(r),,"BookmarkPresentationModel::GetInstance()->GetFolderCount failed %s",GetErrorMessage(r)); + + r = BookmarkPresentationModel::GetInstance()->GetFolder(parentID, 0, foldercount, folderList); + TryCatch( !IsFailed(r),,"BookmarkPresentationModel::GetInstance()->GetFolder failed %s",GetErrorMessage(r)); + + // To check if folder with same name exists + for (count = 0; count < foldercount; count++) + { + BookmarkData* pBookmark = dynamic_cast< BookmarkData* >(folderList.GetAt(count)); + if ( pBookmark == NULL ) + { + return; + } + title = pBookmark->GetBookmarkTitle(); + title.Trim(); + + if (folderTitle.Equals(title, false) == true) + { + flag = true; + break; + } + } + + if (flag == true && ( __ret == true || __previousScene == IDSCN_EDIT_BOOKMARK_LIST)) + { + SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + folderList.RemoveAll(true); + return; + } + + if (flag == true) + { + String message = " Folder already exists "; + CreateMessage(message); // Message alert saying Folder already exists + } + else + { + if (__previousScene == IDSCN_EDIT_BOOKMARK_LIST || __ret == true ) + { + __pBookmark->SetBookmarkTitle(folderTitle); + BookmarkPresentationModel::GetInstance()->SaveFolder(*__pBookmark); + + r = SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + AppLogDebug("SCENE_ADD_BOOKMARK error = %s",GetErrorMessage(r)); + + } + else + { + ArrayList* pArgList = null; + pArgList = new(std::nothrow) ArrayList(); + if (pArgList != null) + { + pArgList->Construct(); + pArgList->Add(*new(std::nothrow) String(L"2")); + } + + BookmarkData bookmark; + bookmark.SetBookmarkTitle(folderTitle); + BookmarkPresentationModel::GetInstance()->SaveFolder(bookmark); + result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT),pArgList); + AppLogDebug("SCENE_ADD_BOOKMARK error = %s",GetErrorMessage(r)); + if (pArgList != null) + { + pArgList->RemoveAll(true); + delete pArgList; + } + TryCatch( !IsFailed(r),L"BookmarkPresentationModel::GetFolder failed %s",GetErrorMessage(r)); + } + + } + + folderList.RemoveAll(true); + } + break; + + default: + break; + } + + CATCH: return; +} + +void +CreateBookmarkFolderForm::OnKeypadActionPerformed(Control& source, KeypadAction keypadAction) +{ + +} + +void +CreateBookmarkFolderForm::OnKeypadClosed(Control& source) +{ + +} + +void +CreateBookmarkFolderForm::OnKeypadOpened(Control& source) +{ + +} + +void +CreateBookmarkFolderForm::OnKeypadWillOpen(Control& source) +{ + +} + +void +CreateBookmarkFolderForm::OnTextValueChanged(const Control& source) +{ + String title = L""; + Header* pHeader = GetHeader(); + + if (pHeader == NULL) + { + return; + } + + if (__pFolderTitle == NULL) + { + return; + } + + title = __pFolderTitle->GetText(); + title.Trim(); + + // To disable done button when folder title edit-field is empty + if (__pFolderTitle && title.GetLength() == 0) + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, false); + } + else + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, true); + } + pHeader->Invalidate(true); + return; +} + +void +CreateBookmarkFolderForm::OnTextValueChangeCanceled(const Control& source) +{ + +} + +void +CreateBookmarkFolderForm::CreateMessage(String& msg) +{ + + if (__pMsgBox != null) + { + delete __pMsgBox; + __pMsgBox = null; + __modalMsgBoxResult = 0; + } + + __pMsgBox = new(std::nothrow) MessageBox; + + if (__pMsgBox != null) + { + __pMsgBox->Construct(L"", msg, MSGBOX_STYLE_OK, 3000); + } + + if (__pMsgBox != null) + { + __pMsgBox->ShowAndWait(__modalMsgBoxResult); + if(__pFolderTitle != null) + __pFolderTitle->SetFocus(); + /*if (__modalMsgBoxResult == MSGBOX_RESULT_OK) + { + AppLog("CreateBookmarkFolderForm::CreateMessage MSGBOX_RESULT_OK"); + if (__pMsgBox != null) + { + delete __pMsgBox; + __pMsgBox = null; + } + }*/ + if (__pMsgBox != null) + { + delete __pMsgBox; + __pMsgBox = null; + } + __modalMsgBoxResult = 0; + } + + return; +} diff --git a/src/IntDefaultCustomItem.cpp b/src/IntDefaultCustomItem.cpp new file mode 100644 index 0000000..dc024ce --- /dev/null +++ b/src/IntDefaultCustomItem.cpp @@ -0,0 +1,87 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: IntDefaultCustomItem + *@brief: + * + */ + +#include +#include "IntDefaultCustomItem.h" +#include "IntTypes.h" + +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; + +const int DefaultCustomItem::IDA_FORMAT_STRING = 101; + +DefaultCustomItem::DefaultCustomItem(void) +{ + __width = 0; + __height = 0; + __text = L""; +} + +DefaultCustomItem::~DefaultCustomItem(void) +{ + +} + +result +DefaultCustomItem::Construct(int width, int height) +{ + result r = E_FAILURE; + __width = width; + __height = height; + const Dimension dim(width, height); + r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL); + return r; + +} + +void +DefaultCustomItem::SetText(String& text) +{ + __text = text; +} + +String +DefaultCustomItem::GetText(void) +{ + return __text; +} + + +result +DefaultCustomItem::Make(void) +{ + result r = E_SUCCESS; + const Color pressedTextColor = Color(249, 249, 249); + const int textSize = 40; + const int x_Margin_Element = 26; + const int y_Margin_Element = 26; + const int width_Element = __width - 60; + + r = AddElement(Rectangle(x_Margin_Element, y_Margin_Element, width_Element,60), IDA_FORMAT_STRING, __text, textSize, CUSTOM_COLOR_TRANSPARENT, pressedTextColor, pressedTextColor, true); + TryCatch( !IsFailed(r),,"DefaultCustomItem::Make %s",GetErrorMessage(r)); + + SetElementSelectionEnabled(IDA_FORMAT_STRING, true); + + CATCH:return r; +} diff --git a/src/IntDropDownCustomItem.cpp b/src/IntDropDownCustomItem.cpp new file mode 100644 index 0000000..43265d0 --- /dev/null +++ b/src/IntDropDownCustomItem.cpp @@ -0,0 +1,199 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +/* + *@file: IntDropDownCustomItem + *@brief: To create Drop Down custom item + * + */ + +#include +#include + +#include "IntDropDownCustomItem.h" +#include "IntTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; + +static const wchar_t* IDB_LIST_EXPAND_CLOSED = L"00_circle_button_Expand_closed.png"; +static const wchar_t* IDB_LIST_EXPAND_CLOSED_PRESS = L"00_list_expand_closed_press.png"; +static const wchar_t* IDB_LIST_EXPAND_OPENED = L"00_circle_button_Expand_open.png"; +static const wchar_t* IDB_LIST_EXPAND_OPENED_PRESS = L"00_list_expand_opened_press.png"; + +const int DropDownCustomItem::IDA_FORMAT_BITMAP = 101; +const int DropDownCustomItem::IDA_FORMAT_MAIN_STRING = 102; +const int DropDownCustomItem::IDA_FORMAT_SUB_STRING = 103; +const int DropDownCustomItem::IDA_FORMAT_DROPPER = 104; + + +DropDownCustomItem::DropDownCustomItem(void) +{ + __width = 0; + __height = 0; + __mainText = L""; + __subText = L""; + __currentState = DROP_DOWN__ITEM_STATE_CLOSED; +} + +DropDownCustomItem::~DropDownCustomItem(void) +{ + +} + +result +DropDownCustomItem::Construct(int width) +{ + result r = E_SUCCESS; + __width = width; + __height = 140; + Dimension dim(__width, __height); + r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL); + return r; +} + +void +DropDownCustomItem::SetMainText(const Tizen::Base::String& text) +{ + __mainText = text; +} + +String +DropDownCustomItem::GetMainText(void) +{ + return __mainText; +} + +void +DropDownCustomItem::SetSubText(const Tizen::Base::String& text) +{ + __subText = text; +} + +String +DropDownCustomItem::GetSubText(void) +{ + return __subText; +} + +result +DropDownCustomItem::Make() +{ + AppLogDebug("DropDownCustomItem::Make entered"); + result r = E_FAILURE; + EnrichedText* pMainEnText = null; + EnrichedText* pSubEnText = null; + TextElement* pMainTextElement = null; + TextElement* pSubTextElement = null; + Font mainTextFont; + Font subTextFont; + Tizen::Graphics::Bitmap* pDropperBitmapNormal = null; + Tizen::Graphics::Bitmap* pDropperBitmapPressed = null; + + pMainEnText = new(std::nothrow) EnrichedText(); + r = pMainEnText->Construct(Dimension(__width - 80, 54)); + if(IsFailed(r)) + { + delete pMainEnText; + return E_FAILURE; + } + + pMainTextElement = new(std::nothrow) TextElement(); + pMainTextElement->Construct(__mainText); + + mainTextFont.Construct(FONT_STYLE_BOLD, 44); + + Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT; + pMainTextElement->SetFont(mainTextFont); + pMainTextElement->SetTextColor(CUSTOM_COLOR_TRANSPARENT); + pMainEnText->Add(*pMainTextElement); + + pSubEnText = new(std::nothrow) EnrichedText(); + r = pSubEnText->Construct(Dimension(__width - 80, 42)); + if(IsFailed(r)) + { + pMainEnText->RemoveAll(true); + delete pMainEnText; + delete pSubEnText; + return E_FAILURE; + } + + pSubTextElement = new(std::nothrow) TextElement(); + pSubTextElement->Construct(__subText); + + + subTextFont.Construct(FONT_STYLE_PLAIN, 32); + + pSubTextElement->SetFont(subTextFont); + pSubTextElement->SetTextColor(CUSTOM_COLOR_GREY); + pSubEnText->Add(*pSubTextElement); + + r = AddElement(Rectangle(26, 22, __width - 126, 54), IDA_FORMAT_MAIN_STRING, *pMainEnText); + r = AddElement(Rectangle(26, 76, __width - 126, 42), IDA_FORMAT_SUB_STRING, *pSubEnText); + if(IsFailed(r)) + { + pMainEnText->RemoveAll(true); + pSubEnText->RemoveAll(true); + delete pMainEnText; + delete pSubEnText; + return E_FAILURE; + } + AppResource* pAppResource = UiApp::GetInstance()->GetAppResource(); + if (pAppResource) + { + if (GetCurState() == DROP_DOWN__ITEM_STATE_CLOSED) + { + pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED, BITMAP_PIXEL_FORMAT_ARGB8888); + pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); + } + else + { + pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED, BITMAP_PIXEL_FORMAT_ARGB8888); + pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); + } + + AddElement(Rectangle(__width - 95, (__height - 74) / 2, 74, 74), IDA_FORMAT_DROPPER, *pDropperBitmapNormal, pDropperBitmapPressed, pDropperBitmapNormal); + delete pDropperBitmapNormal; + delete pDropperBitmapPressed; + } + + SetElementSelectionEnabled(IDA_FORMAT_MAIN_STRING, true); + SetElementSelectionEnabled(IDA_FORMAT_SUB_STRING, true); + SetElementSelectionEnabled(IDA_FORMAT_DROPPER, true); + + pSubEnText->RemoveAllTextElements(true); + pMainEnText->RemoveAllTextElements(true); + + delete pMainEnText; + delete pSubEnText; + + return E_SUCCESS; +} + +DropDownItemState +DropDownCustomItem::GetCurState(void) +{ + return __currentState; +} + +void +DropDownCustomItem::SetCurState(DropDownItemState state) +{ + __currentState = state; +} diff --git a/src/IntEditBookmarkListForm.cpp b/src/IntEditBookmarkListForm.cpp new file mode 100644 index 0000000..13189b2 --- /dev/null +++ b/src/IntEditBookmarkListForm.cpp @@ -0,0 +1,836 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: EditBookmarkListForm + *@brief: This class defines EditBookmarkListForm used to edit the bookmark + * + */ + +#include +#include + +#include "IntBookmarkData.h" +#include "IntBookmarkPresentationModel.h" +#include "IntCommonLib.h" +#include "IntEditBookmarkListForm.h" +#include "IntFaviconManager.h" +#include "IntNotificationPanel.h" +#include "IntSceneRegister.h" +#include "IntTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const wchar_t* IDB_ICON_FOLDER_OPEN = L"I01_icon_folder_open.png"; +static const wchar_t* IDB_ITEM = L"edit_item.png"; +static const wchar_t* IDB_RIGHT_ARROW = L"I01_right_arrow.png"; + + +const int EditBookmarkListForm::IDA_BUTTON_CHECKED = 101; +const int EditBookmarkListForm::IDA_TABBAR_ITEM_1 = 102; +const int EditBookmarkListForm::IDA_TABBAR_ITEM_2 = 103; +const int EditBookmarkListForm::IDA_DELETEITEM_CLICKED = 104; +const int EditBookmarkListForm::IDA_SHAREITEM_CLICKED = 105; +const int EditBookmarkListForm::IDA_CANCELITEM_CLICKED = 106; +const int EditBookmarkListForm::IDA_FORMAT_FOLDER = 107; +const int EditBookmarkListForm::IDA_FORMAT_SITE = 108; +const int EditBookmarkListForm::IDA_FORMAT_ICON = 109; +const int EditBookmarkListForm::IDA_FORMAT_BITMAP = 110; +const int EditBookmarkListForm::IDA_BUTTON_UNCHECKED = 111; +const int EditBookmarkListForm::IDA_FORMAT_URL = 112; + + + +EditBookmarkListForm::EditBookmarkListForm(void) +{ + __pListview = null; + __pData = null; + __pTimer = null; + __parentID = L"-1"; + __pInfoPanel = null; + __pInfoLabel = null; + __selectedItemCount = 0; + __pCheckButton = null; + __pConfirmationPopup = null; +} + +EditBookmarkListForm::~EditBookmarkListForm(void) +{ + if (__pData != null) + { + __pData->RemoveAll(true); + delete __pData; + } +} + +bool +EditBookmarkListForm::Initialize(void) +{ + Construct(L"IDL_EDIT_BOOKMARK_LIST"); + + return true; +} +result +EditBookmarkListForm::OnInitializing(void) +{ + result r = E_SUCCESS; + + Rectangle rc = GetClientAreaBounds(); + String selected = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED"); + + // Setup back event listener + SetFormBackEventListener(this); + AddOrientationEventListener(*this); + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager != null) + { + pSceneManager->AddSceneEventListener(IDSCN_EDIT_BOOKMARK_LIST, *this); + } + + Header* pHeader = GetHeader(); + + if (pHeader == NULL) + { + return E_FAILURE; + } + pHeader->SetTitleText(CommonUtil::GetString(L"IDS_BR_HEADER_EDIT_BOOKMARK"));; + + __pCheckButton = static_cast< CheckButton* >(GetControl( + L"IDC_SELECT_CHECKBUTTON", true)); + + if (__pCheckButton == null) + { + return E_FAILURE; + } + + __pCheckButton->SetActionId(IDA_BUTTON_CHECKED, IDA_BUTTON_UNCHECKED); + __pCheckButton->AddActionEventListener(*this); + + __pListview = static_cast< ListView* >(GetControl("IDC_LISTVIEW1")); + + if (__pListview == null) + { + return E_FAILURE; + } + +// __pListview->SetBounds(__pListview->GetX(), __pListview->GetY(), __pListview->GetWidth(), rc.height - 112 - 48); + __pListview->AddFastScrollListener(*this); + __pListview->AddListViewItemEventListener(*this); + __pListview->SetItemProvider(*this); + + + __pInfoPanel = static_cast< Panel* >(GetControl( + L"IDC_INFO_PANEL", true)); + + if (__pInfoPanel == null) + { + return E_FAILURE; + } + +// __pInfoPanel->SetBounds(Rectangle(0,rc.height - 48, rc.width, 48)); + + //SetControlAlwaysOnTop(*__pInfoPanel, true); + + __pInfoLabel = static_cast< Label* >(GetControl( + L"IDC_INFO_LABEL", true)); + + if (__pInfoLabel == null) + { + return E_FAILURE; + } + +// __pInfoLabel->SetBounds(Rectangle(0,0,rc.width, 48)); + selected.Append(L"(0)"); + __pInfoLabel->SetText(selected); + + __pInfoLabel->SetTextConfig(32,LABEL_TEXT_STYLE_BOLD); + //__pInfoLabel->SetBackgroundColor(CUSTOM_COLOR_INFO_LABEL); + __pInfoLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE); + __pInfoLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER); + GetFooter()->SetItemEnabled(0,false); + GetFooter()->AddActionEventListener(*this); + __pTimer = new (std::nothrow) Timer(); + __pTimer->Construct(*this); + return r; +} + +void +EditBookmarkListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + result r = E_SUCCESS; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + switch (actionId) + { + case IDA_DELETEITEM_CLICKED: + { + String labelString; + int count = 0; + if(__pListview == null) + { + return; + } + for (int count = 0;count < __pListview->GetItemCount();count++) + { + if (__pListview->IsItemChecked(count)) + { + int id = 0; + String bookmarkId; + BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(count)); + if (pBookMark == null) + { + return; + } + bookmarkId = pBookMark->GetBookmarkId(); + Integer::Parse(bookmarkId,id); + + if (pBookMark->GetBookmarkType() == BOOKMARK_TYPE_URL) + { + r = BookmarkPresentationModel::GetInstance()->DeleteBookmark(id); + TryCatch( r == E_SUCCESS,,"EditBookmarkListForm::OnActionPerformed BookmarkPresentationModel::GetInstance()->DeleteBookmark failed %s",GetErrorMessage(r)); + } + else + { + r = BookmarkPresentationModel::GetInstance()->DeleteFolder(id); + TryCatch( r == E_SUCCESS,,"EditBookmarkListForm::OnActionPerformed BookmarkPresentationModel::GetInstance()->DeleteBookmark failed %s",GetErrorMessage(r)); + } + } + } + + if (__pListview != null) + { + count = __pListview->GetItemCount(); + + for(int index = 0; index < count ; index ++) + { + if(__pListview->IsItemChecked(index) == true ) + { + __pListview->SetItemChecked(index,false); + } + } + + __pCheckButton->SetSelected(false); + __pListview->UpdateList(); + + if ( __pListview->GetItemCount() == 0) + { + __pCheckButton->SetShowState(false); + __pCheckButton->Invalidate(true); + if (__pInfoPanel != null) + { + __pInfoPanel->SetShowState(false); + } + r = __pListview->SetBounds(__pListview->GetX(), 0, __pListview->GetWidth(), GetClientAreaBounds().height); + if (IsFailed(r)) + { + return; + } + + + } + } + GetFooter()->SetItemEnabled(0,false); + GetFooter()->Invalidate(true); + labelString.Append(CommonUtil::GetString(L"IDS_COM_OPT_SELECTED")); + labelString.Append(L"(0)"); + + if (__pInfoPanel != null) + { + __pInfoLabel->SetText(labelString); + __pInfoPanel->Draw(); + __pInfoPanel->Show(); + } + + NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this); + String notification = CommonUtil::GetString(L"IDS_BR_POP_DELETED"); + pNotification->SetText(notification); + pNotification->ShowNotification(); + + + if( __pListview->GetItemCount() == 0) + { + __pTimer->Start(1000); + } + } + break; + case IDA_CANCELITEM_CLICKED: + { + if ( __pTimer != NULL) + { + __pTimer->Cancel(); + } + if(pSceneManager != NULL) + { + r = pSceneManager->GoBackward(BackwardSceneTransition()); + } + if (IsFailed(r)) + { + AppLogDebug("EditBookmarkListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r)); + return; + } + } + break; + case IDA_BUTTON_CHECKED: + { + String labelString; + bool flag = false; + + for (int count = 0;count < __pListview->GetItemCount();count++) + { + __pListview->SetItemChecked(count,true); + } + + GetFooter()->SetItemEnabled(0,true); + GetFooter()->Invalidate(true); + + labelString.Append(CommonUtil::GetString(L"IDS_COM_OPT_SELECTED")); + labelString.Append(L"("); + labelString.Append(__pListview->GetItemCount()); + labelString.Append(L")"); + + __pInfoLabel->SetText(labelString); + __pInfoPanel->Draw(); + __pInfoPanel->Show(); + + __pListview->Invalidate(true); + } + break; + case IDA_BUTTON_UNCHECKED: + { + String labelString = L""; + + for (int count = 0;count < __pListview->GetItemCount();count++) + { + __pListview->SetItemChecked(count,false); + } + + labelString.Append(CommonUtil::GetString(L"IDS_COM_OPT_SELECTED")); + labelString.Append(L"(0)"); + __pInfoLabel->SetText(labelString); + __pInfoPanel->Draw(); + __pInfoPanel->Show(); + + __pListview->Invalidate(true); + + GetFooter()->SetItemEnabled(0,false); + GetFooter()->Invalidate(true); + } + break; + default: + break; + } + + CATCH: return ; +} + +ListItemBase* +EditBookmarkListForm::CreateItem(int index, int itemWidth) +{ + result r = E_SUCCESS; + ListAnnexStyle style = LIST_ANNEX_STYLE_MARK; + CustomItem* pItem = null; + BookmarkData* pBookMark = null; + Bitmap* pBitmap = null; + String bitmapId; + const int x_Margin_Url = 104; + const int y_Margin_Url = 70; + const int height_Url = 40; + const int width_Url = GetClientAreaBounds().width - 104 - 120 - 16; + const int itemHeight = 112; + const int textSize = 32; + const int width_Title = GetClientAreaBounds().width - 104 - 120 - 16; + + pItem = new(std::nothrow) CustomItem(); + if (pItem == null) + { + return null; + } + pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index)); + if (pBookMark == null) + { + delete pItem; + pItem = null; + return null; + } + if (pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER) + { + r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style); + TryCatch( r == E_SUCCESS,,"EditBookmarkListForm::CreateItem contruct item failed %s",GetErrorMessage(r)); + + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_FOLDER_OPEN); + + if (pBitmap != null) + { + pItem->AddElement(Rectangle(16, 26, 60, 60), IDA_FORMAT_ICON, *pBitmap, null); + delete pBitmap; + } + + pItem->AddElement(Rectangle(92, 8, width_Title/*__pListview->GetWidth() - 92 - 80*/, 112), IDA_FORMAT_FOLDER, pBookMark->GetBookmarkTitle(), true); + + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ITEM); + + if (pBitmap != null) + { + pItem->AddElement(Rectangle(__pListview->GetWidth() - 92 - 64, 20, 60, 60), IDA_FORMAT_BITMAP, *pBitmap, null, null); + delete pBitmap; + } + } + else + { + r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128), style); + TryCatch( r == E_SUCCESS,,"EditBookmarkListForm::CreateItem contruct item failed %s",GetErrorMessage(r)); + + bitmapId = pBookMark->GetFaviconId(); + pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId); + + if (pBitmap == null) + { + pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN(); + } + + pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null); + delete pBitmap; + + pItem->AddElement(Rectangle(104, 10, width_Title, itemHeight - height_Url), IDA_FORMAT_SITE, pBookMark->GetBookmarkTitle(), true); + pItem->AddElement(Rectangle(x_Margin_Url, y_Margin_Url, width_Url, height_Url), IDA_FORMAT_URL, pBookMark->GetUrl(),textSize,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true); + + //pBitmap = AppResource::GetInstance()->GetBitmapN("I01_picker_arrow_right.png"); + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_RIGHT_ARROW); + if (pBitmap != null) + { + pItem->AddElement(Rectangle(__pListview->GetWidth() - 92 - 68, 32, 64, 64), IDA_FORMAT_BITMAP, *pBitmap, null, null); + delete pBitmap; + } + } + return pItem; + + CATCH: + delete pItem; + pItem = null; + return NULL; +} + +bool +EditBookmarkListForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth) +{ + delete pItem; + pItem = null; + return true; +} + +int +EditBookmarkListForm::GetItemCount(void) +{ + int count = 0; + result r = E_SUCCESS; + + BookmarkPresentationModel::GetInstance()->GetFolderBookmarkCount(__parentID, count); + + if (__pData != NULL) + { + __pData->RemoveAll(true); + delete __pData; + __pData = NULL ; + + } + __pData = new(std::nothrow) ArrayList(); + + if (__pData == null) + { + return 0; + } + + r = __pData->Construct(); + + TryCatch( r == E_SUCCESS,,"EditBookmarkListForm::GetItemCount __pData->Construct() failed %s",GetErrorMessage(r)); + + BookmarkPresentationModel::GetInstance()->GetFoldersBookmarks(__parentID, 0, count, *__pData); + + if ( count == 0) + { + if(__pCheckButton != null) + { + __pCheckButton->SetShowState(false); + } + if(__pInfoPanel != null) + { + __pInfoPanel->SetShowState(false); + } + __pListview->SetBounds(__pListview->GetX(), 0, __pListview->GetWidth(), GetClientAreaBounds().height); + + } + else + { + if(__pCheckButton != null) + { + __pCheckButton->SetShowState(true); + } + if(__pInfoPanel != null) + { + __pInfoPanel->SetShowState(true); + } + if(__pCheckButton != null && __pInfoPanel != null) + __pListview->SetBounds(__pListview->GetX(), __pListview->GetY(), __pListview->GetWidth(), GetClientAreaBounds().height - __pCheckButton->GetHeight() - __pInfoPanel->GetHeight()); + + } + if(__pCheckButton != null) + { + __pCheckButton->Invalidate(true); + } + if(__pInfoPanel != null) + { + __pInfoPanel->Invalidate(false); + } + + return count; + + CATCH: + __pData->RemoveAll(true); + delete __pData; + __pData = null; + return 0; +} + +void +EditBookmarkListForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status) +{ + +} + +void +EditBookmarkListForm::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) +{ + +} + +void +EditBookmarkListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) +{ + String labelString; + __selectedItemCount = 0; + result r = E_SUCCESS; + + switch (elementId) + { + case IDA_FORMAT_BITMAP: + { + ArrayList* pArgList = null; + SceneManager* pSceneManager = SceneManager::GetInstance(); + BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index)); + + if(pBookMark == NULL) + { + return; + } + if (__pListview->IsItemChecked(index) == true) + { + __pListview->SetItemChecked(index, false); + } + else + { + __pListview->SetItemChecked(index, true); + } + + if (pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER) + { + pArgList = new(std::nothrow) ArrayList(); + + if (pArgList != null) + { + pArgList->Construct(); + pArgList->Add(*new(std::nothrow) BookmarkData(*pBookMark)); + if ( pSceneManager != null) + { + result r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_BOOKMARK_FOLDER, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList); + } + + if (pArgList != null) + { + pArgList->RemoveAll(false); + delete pArgList; + pArgList = null; + } + if(IsFailed(r)) + { + AppLogDebug("BookmarkListForm::CreateItem Construct failed %s",GetErrorMessage(r)); + return; + } + + } + } + else + { + pArgList = new(std::nothrow) ArrayList(); + + if (pArgList != null) + { + pArgList->Construct(); + pArgList->Add(*new(std::nothrow) String(L"1")); + pArgList->Add(*new(std::nothrow) BookmarkData(*pBookMark)); + if ( pSceneManager != null) + { + result r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ADD_BOOKMARK, SCENE_TRANSITION_ANIMATION_TYPE_NONE), pArgList); + } + if (pArgList != null) + { + pArgList->RemoveAll(false); + delete pArgList; + pArgList = null; + } + if(IsFailed(r)) + { + AppLogDebug("BookmarkListForm::CreateItem Construct failed %s",GetErrorMessage(r)); + return; + } + } + } + } + break; + + default: + { + int count = 0; + bool flag = false; + + int itemCount = __pListview->GetItemCount(); + for (int count = 0;count < itemCount ; count++) + { + if (__pListview->IsItemChecked(count)) + { + __selectedItemCount++; + } + } + + //labelString.Append(__selectedItemCount); + labelString.Append(CommonUtil::GetString(L"IDS_COM_OPT_SELECTED")); + labelString.Append(L"("); + labelString.Append(__selectedItemCount); + labelString.Append(L")"); + __pInfoLabel->SetText(labelString); + __pInfoPanel->Draw(); + __pInfoPanel->Show(); + BookmarkPresentationModel::GetInstance()->GetFolderBookmarkCount(L"-1",count); + if (__selectedItemCount == count) + { + __pCheckButton->SetSelected(true); + } + else + { + __pCheckButton->SetSelected(false); + } + + itemCount = __pListview->GetItemCount(); + for (int count = 0;count < itemCount ;count++) + { + if (__pListview->IsItemChecked(count)) + { + flag = true; + break; + } + } + + if (flag == true) + { + GetFooter()->SetItemEnabled(0,true); + } + else + { + GetFooter()->SetItemEnabled(0,false); + } + + GetFooter()->Invalidate(true); + + } + break; + } +} + +void +EditBookmarkListForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction) +{ + +} + +void +EditBookmarkListForm::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index) +{ + +} +void +EditBookmarkListForm::OnListViewItemReordered(Tizen::Ui::Controls::ListView& listView, int indexFrom, int indexTo) +{ + +} + +void +EditBookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + result r = E_FAILURE; + String labelString ; + int count = 0; + + if (pArgs != null) + { + __parentID.Clear(); + String* pStr = dynamic_cast(pArgs->GetAt(0)); + if(pStr == null) + { + return; + } + __parentID.Append(pStr->GetPointer()); + } + + __selectedItemCount = 0; + + labelString.Append(CommonUtil::GetString(L"IDS_COM_OPT_SELECTED")); + labelString.Append(L"("); + labelString.Append(__selectedItemCount); + labelString.Append(L")"); + __pInfoLabel->SetText(labelString); + + count = __pListview->GetItemCount(); + + for(int index = 0 ; index < count ; index++) + { + if(__pListview->IsItemChecked(index) == true) + { + __pListview->SetItemChecked(index,false); + } + } + + __pListview->UpdateList(); + __pCheckButton->SetSelected(false); + GetFooter()->SetItemEnabled(0,false); + GetFooter()->Invalidate(true); + + __pInfoPanel->Draw(); + __pInfoPanel->Show(); + + Invalidate(true); + +} + +void +EditBookmarkListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + +} + +void +EditBookmarkListForm::OnFormBackRequested(Form& source) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if ( __pTimer != NULL) + { + __pTimer->Cancel(); + } + + if (pSceneManager != null) + { + //pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + result r = pSceneManager->GoBackward(BackwardSceneTransition()); + if(IsFailed(r)) + { + AppLogDebug("BookmarkListForm::CreateItem Construct failed %s",GetErrorMessage(r)); + return; + } + + } + GetFooter()->Invalidate(true); +} + + +void EditBookmarkListForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + int itemCount = 0; + ArrayList* pCheckedItems = NULL ; + + if (__pListview != null) + { + AppLog("the list Y axis is %d", __pListview->GetY()); + pCheckedItems = new(std::nothrow) ArrayList(); + pCheckedItems->Construct(); + if ( __pListview->GetItemCount() == 0) + { + __pCheckButton->SetShowState(false); + __pInfoPanel->SetShowState(false); + __pListview->SetBounds(0, __pListview->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height -__pListview->GetY()); + + } + else + { + __pCheckButton->SetShowState(true); + __pInfoPanel->SetShowState(true); + __pListview->SetBounds(__pListview->GetX(), __pListview->GetY(), __pListview->GetWidth(), GetClientAreaBounds().height - __pCheckButton->GetHeight() - __pInfoPanel->GetHeight()); + + } + __pCheckButton->Invalidate(true); + + itemCount = __pListview->GetItemCount(); + + for (int count = 0;count < itemCount ; count++) + { + + if (__pListview->IsItemChecked(count)) + { + pCheckedItems->Add(* new Integer(count)); + } + } + + __pListview->UpdateList(); + + for (int count = 0;count < itemCount ;count++) + { + if (pCheckedItems->Contains(* new Integer(count)) == true) + { + __pListview->SetItemChecked(count, true); + } + } + if ( pCheckedItems != NULL ) + { + pCheckedItems->RemoveAll(true); + delete pCheckedItems; + } + Invalidate(true); + } +} + +void +EditBookmarkListForm::OnTimerExpired(Timer& timer) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if ( pSceneManager != NULL) + { + result r = pSceneManager->GoBackward(BackwardSceneTransition()); + if(IsFailed(r)) + { + AppLogDebug("EditBookmarkListForm::OnTimerExpired GoBackward failed %s",GetErrorMessage(r)); + } + } +} diff --git a/src/IntEditHistoryListForm.cpp b/src/IntEditHistoryListForm.cpp new file mode 100644 index 0000000..57c0929 --- /dev/null +++ b/src/IntEditHistoryListForm.cpp @@ -0,0 +1,1159 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntEditHistoryListForm + *@brief: This class defines EditHistoryListForm used to edit the history scene + * + */ + +#include +#include +#include "IntCommonLib.h" +#include "IntEditHistoryListForm.h" +#include "IntFaviconManager.h" +#include "IntHistoryPresentationModel.h" +#include "IntNotificationPanel.h" +#include "IntSceneRegister.h" +#include "IntTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Locales; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +const int EditHistoryListForm::IDA_TABBAR_ITEM_1 = 101; +const int EditHistoryListForm::IDA_TABBAR_ITEM_2 = 102; +const int EditHistoryListForm::IDA_BUTTON_NEXT_FORM = 103; +const int EditHistoryListForm::IDA_FORMAT_ICON = 104; +const int EditHistoryListForm::IDA_FORMAT_TITLE = 105; +const int EditHistoryListForm::IDA_FORMAT_URL = 106; +const int EditHistoryListForm::IDA_SELECT_ALL_CHECKED = 107; +const int EditHistoryListForm::IDA_SELECT_ALL_UNCHECKED = 108; +const int EditHistoryListForm::IDA_DELETE_HISTORY = 109; +const int EditHistoryListForm::IDA_CANCEL = 110; + + +EditHistoryListForm::EditHistoryListForm(void) +:__pListView(null) +,__pGroupData(null) +,__pTimer(null) +,__pSelectAllCheck(null) +,__pSelectedLabel(null) +,__selectedCount(0) +,__isNoHistoryPresent(true) +{ +} + +EditHistoryListForm::~EditHistoryListForm(void) +{ + AppLog("EditHistoryListForm::~EditHistoryListForm called"); + + if (__pGroupData != null) + { + AppLog("removing __pGroupData"); + __pGroupData->RemoveAll(true); + delete __pGroupData; + } +} + +bool +EditHistoryListForm::Initialize(void) +{ + Construct(L"IDL_EDIT_HISTORY_LIST"); + + return true; +} + +result +EditHistoryListForm::OnInitializing(void) +{ + result r = E_SUCCESS; + + SetFormBackEventListener(this); + + AppLogDebug("EditHistoryListForm::OnInitializing"); + SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER); + + Header* pHeader = GetHeader(); + + if (pHeader == NULL) + { + return E_FAILURE; + } + + pHeader->SetTitleText(CommonUtil::GetString("IDS_BR_SK_DELETE_ABB")); + + GetFooter()->AddActionEventListener(*this); + AddOrientationEventListener(*this); + + SceneManager::GetInstance()->AddSceneEventListener(IDSCN_EDIT_HISTORY_LIST, *this); + __pSelectedLabel = static_cast< Label* >(GetControl(L"IDC_LABEL1")); + + if (__pSelectedLabel == null) + { + return E_FAILURE; + } + String selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED") + "(0)"; + __pSelectedLabel->SetText(selectedText); + + __pSelectAllCheck = static_cast< CheckButton* >(GetControl(L"IDC_SELECT_ALL",true)); + + if (__pSelectAllCheck != null) + { + __pSelectAllCheck->SetActionId(IDA_SELECT_ALL_CHECKED, IDA_SELECT_ALL_UNCHECKED); + __pSelectAllCheck->AddActionEventListener(*this); + } + else + { + return E_FAILURE; + } + + __pListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1")); + if( __pListView != NULL) + { + __pListView->SetItemProvider(*this); + __pListView->AddGroupedListViewItemEventListener(*this); + } + else + { + return E_FAILURE; + } + + __pTimer = new (std::nothrow) Timer(); + r = __pTimer->Construct(*this); + + return r; +} + +result +EditHistoryListForm::OnTerminating(void) +{ + result r = E_SUCCESS; + + return r; +} + +void +EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + String selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED"); + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return; + } + + switch (actionId) + { + case IDA_TABBAR_ITEM_1: + { + result r = pSceneManager->GoBackward(BackwardSceneTransition()); + if (IsFailed(r)) + { + AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r)); + return; + } + } + + break; + case IDA_SELECT_ALL_CHECKED: + { + int selectedCount = 0; + for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++) + { + GroupItemClass* pGClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if(pGClass == null) + { + continue; + } + for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++) + { + selectedCount++; + __pListView->SetItemChecked(groupIndex,itemIndex,true); + } + } + selectedText.Append(L"("); + selectedText.Append(selectedCount); + selectedText.Append(L")"); + __selectedCount = selectedCount; + + __pSelectedLabel->SetText(selectedText); + __pSelectedLabel->Invalidate(true); + + GetFooter()->SetItemEnabled(0, true); + GetFooter()->Invalidate(true); + + __pListView->Invalidate(true); + + } + break; + case IDA_SELECT_ALL_UNCHECKED: + { + for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++) + { + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if(pGroupItemClass == null) + { + continue; + } + for (int itemIndex = 0 ; itemIndex < pGroupItemClass->__pData->GetCount() ; itemIndex ++) + { + __pListView->SetItemChecked(groupIndex,itemIndex,false); + } + } + selectedText.Append(L"(0)"); + __pSelectedLabel->SetText(selectedText); + __selectedCount = 0; + __pSelectedLabel->Invalidate(true); + + GetFooter()->SetItemEnabled(0, false); + GetFooter()->Invalidate(true); + + __pListView->Invalidate(true); + } + break; + case IDA_DELETE_HISTORY: + { + + ArrayList* pArrayList = new(std::nothrow) ArrayList(); + int itemCount = 0; + int count = 0; + int groupCount = 0; + int counter = 0; + pArrayList->Construct(); + for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++) + { + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + + if (pGroupItemClass == null || pGroupItemClass->__pData == null) + { + AppLogDebug(" pGroupItemClass || __pData is null"); + continue; + } + itemCount = pGroupItemClass->__pData->GetCount(); + for (int itemIndex = 0 ; itemIndex < itemCount ; itemIndex++) + { + bool ret = __pListView->IsItemChecked(groupIndex,itemIndex); + if (ret == false) + { + continue; + } + AppLog("deleting history for groupId %d, item %d",groupIndex,itemIndex); + int hisId = -1; + History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex)); + if(pHistory == null) + { + continue; + } + pArrayList->Add(*new(std::nothrow) String(pHistory->GetHistoryId())); + + } + } + + HistoryPresentationModel::GetInstance()->DeleteMultipleHistory(pArrayList); + + if (pArrayList != null) + { + pArrayList->RemoveAll(true); + delete pArrayList; + } + + if(__pGroupData != null) + { + groupCount = __pGroupData->GetCount(); + + for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ ) + { + counter = __pListView->GetItemCountAt(groupIndex); + + for(int index = 0 ; index < counter ; index++) + { + if(__pListView->IsItemChecked( groupIndex,index ) == true) + { + __pListView->SetItemChecked(groupIndex,index,false); + } + } + } + } + + + + __pSelectAllCheck->SetSelected(false); + + GetFooter()->SetItemEnabled(0,false); + GetFooter()->Invalidate(true); + selectedText.Append(L"(0)"); + __pSelectedLabel->SetText(selectedText); + __selectedCount = 0; + __pSelectedLabel->Invalidate(true); + if (__pListView != null) + { + __pListView->UpdateList(); + } + + NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this); + String notification = CommonUtil::GetString(L"IDS_BR_POP_DELETED"); + pNotification->SetText(notification); + pNotification->ShowNotification(); + } + break; + case IDA_CANCEL: + { + if( __pTimer != NULL) + { + __pTimer->Cancel(); + } + result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + if (IsFailed(r)) + { + AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r)); + return; + } + + } + break; + + default: + break; + } +} + +void +EditHistoryListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return; + } + + result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + if (IsFailed(r)) + { + AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r)); + return; + } +} + +GroupItem* +EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth) +{ + AppLogDebug("EditHistoryListForm::CreateGroupItem"); + result r = E_FAILURE; + + int strMonth = 0; + String text; + GroupItem* pItem = null; + int count = 0; + + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if(pGroupItemClass == null) + return null; + pItem = new(std::nothrow) GroupItem(); + + if (pItem == null) + { + return null; + } + + if ( pGroupItemClass->__pData == null || pGroupItemClass->__pData->GetCount() == 0) + { + r = pItem->Construct(Dimension(itemWidth, 0)); + } + else + { + r = pItem->Construct(Dimension(itemWidth, 48)); + } + + text = pGroupItemClass->__titleText; + text.Append(L" ("); + + int dayOfWeek = 0 ; + if (pGroupItemClass->__titleText == L"Today" || pGroupItemClass->__titleText == L"Yesterday") + { + Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); + if (pGregorianCalendar != NULL) + { + pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->__startTime.GetYear()); + pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->__startTime.GetMonth()); + pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->__startTime.GetDay()); + dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK); + + if (pGregorianCalendar != NULL) + { + delete pGregorianCalendar; + } + } + } + switch(dayOfWeek) + { + case 1: + text.Append(L"Sun"); + break; + case 2: + text.Append(L"Mon"); + break; + case 3: + text.Append(L"Tue"); + break; + case 4: + text.Append(L"Wed"); + break; + case 5: + text.Append(L"Thu"); + break; + case 6: + text.Append(L"Fri"); + break; + case 7: + text.Append(L"Sat"); + break; + default: + break; + } + text.Append(L", "); + + String month = L""; + + if (pGroupItemClass->__titleText != L"Older") + { + text.Append(pGroupItemClass->__startTime.GetDay()); + text.Append(L". "); + strMonth = pGroupItemClass->__startTime.GetMonth(); + month = GetMonth(strMonth); + text.Append(month); + } + else + { + text.Append(L"~ "); + } + + if (pGroupItemClass->__titleText == L"Last week" || pGroupItemClass->__titleText == L"Two weeks ago" || pGroupItemClass->__titleText == L"Three weeks ago" || pGroupItemClass->__titleText == L"Four weeks ago" || pGroupItemClass->__titleText == L"Last month" || pGroupItemClass->__titleText == L"Older") + { + text.Append(L" - "); + text.Append(pGroupItemClass->__endTime.GetDay()); + text.Append(L". "); + strMonth = pGroupItemClass->__endTime.GetMonth(); + month = GetMonth(strMonth); + text.Append(month); + } + + text.Append(L".)"); + AppLogDebug("startTime day = %d month = %d year = %d",pGroupItemClass->__startTime.GetDay(),pGroupItemClass->__startTime.GetMonth(),pGroupItemClass->__startTime.GetYear()); + + pItem->SetElement(text, null); + pItem->SetTextSize(32); + + return pItem; +} + +ListItemBase* +EditHistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth) +{ + AppLogDebug("EditHistoryListForm::CreateItem"); + result r = E_FAILURE; + const int bookmarkBtnWidth = 64; + String bitmapId; + if (__pGroupData == null) + { + return null; + } + + CustomItem* pItem = new(std::nothrow) CustomItem(); + if ( pItem == NULL) + { + return null ; + } + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + + if (pGroupItemClass == null) + { + delete pItem; + return null; + } + + History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex)); + if ( pHistory == NULL ) + { + delete pItem; + return null; + } + Bitmap* pBitmap = null; + + r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128), LIST_ANNEX_STYLE_MARK); + + bitmapId = pHistory->GetFaviconId(); + + pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId); + if (pBitmap == null) + { + pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN(); + } + + if (pBitmap != null) + { + pItem->AddElement(Rectangle(16, 26, 60, 60), IDA_FORMAT_ICON, *pBitmap, null); + delete pBitmap; + } + r = pItem->AddElement(Rectangle(92, 4, GetClientAreaBounds().width - 96 - 32 -64 -32, 60), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), 44,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true); + if (IsFailed(r)) + { + delete pItem; + AppLogException("CreateItem failed with %s", GetErrorMessage(r)); + return null; + } + + pItem->AddElement(Rectangle(92, 68, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 52), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true); + + return pItem; +} + +bool +EditHistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth) +{ + + AppLogDebug("EditHistoryListForm::DeleteGroupItem"); + + if (__pGroupData == null) + { + return false; + } + + delete pItem; + pItem = null; + + return true; + +} + +bool +EditHistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth) +{ + + if (__pGroupData == null) + { + return false; + } + + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if (pGroupItemClass == null) + { + return false; + } + + delete pItem; + pItem = null; + return true; +} + +int +EditHistoryListForm::GetGroupCount(void) +{ + AppLogDebug("EditHistoryListForm::GetGroupCount"); + + __isNoHistoryPresent = true; + + CreateGroupItems(); + + int count = 0; + HistoryPresentationModel::GetInstance()->GetHistoryCount(count); + if(count == 0) + { + __isNoHistoryPresent = false; + AppLogDebug("the value of isNoHistoryPresent %d",__isNoHistoryPresent); + __pTimer->Start(1000); + __pSelectAllCheck->SetShowState(false); + __pSelectedLabel->SetShowState(false); + } + else + { + __isNoHistoryPresent = true; + __pSelectAllCheck->SetShowState(true); + __pSelectedLabel->SetShowState(true); + } + __pSelectAllCheck->Invalidate(true); + __pSelectedLabel->Invalidate(false); + GetFooter()->Invalidate(true); + + if (__pGroupData != null) + { + AppLogDebug("GetGroupCount returning %d",__pGroupData->GetCount()); + count = __pGroupData->GetCount(); + } + else + { + AppLogDebug("GetGroupCount returning 0"); + count = 0; + } + + return count; +} + +int +EditHistoryListForm::GetItemCount(int groupIndex) +{ + AppLogDebug("EditHistoryListForm::GetItemCount"); + result r = E_FAILURE; + int count = 0; + + if (__pGroupData == null) + { + AppLogDebug("EditHistoryListForm::GetItemCount returning 0"); + return 0; + } + + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + + if (pGroupItemClass == null) + { + AppLogDebug("EditHistoryListForm::GetItemCount returning 0"); + return 0; + } + + + r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime,count); + + if ( r != E_SUCCESS) + { + AppLogDebug("EditHistoryListForm::GetItemCount returning 0"); + return 0; + } + + if (pGroupItemClass->__pData != null) + { + pGroupItemClass->__pData->RemoveAll(true); + delete pGroupItemClass->__pData; + } + pGroupItemClass->__pData = new(std::nothrow) Collection::ArrayList(); + pGroupItemClass->__pData->Construct(); + AppLog("Starttime %ls endtime %ls",pGroupItemClass->__startTime.ToString().GetPointer(),pGroupItemClass->__endTime.ToString().GetPointer()); + HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime, 0, count, *pGroupItemClass->__pData); + AppLogDebug("Count = %d ", count); + + if (__pGroupData == null) + { + AppLogDebug("EditHistoryListForm::GetItemCount returning 0"); + return 0; + } + + + + if (pGroupItemClass == null || pGroupItemClass->__pData == null) + { + AppLogDebug("EditHistoryListForm::GetItemCount returning 0"); + return 0; + } + else + { + AppLogDebug("EditHistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->__pData->GetCount(),groupIndex,pGroupItemClass->__titleText.GetPointer()); + return pGroupItemClass->__pData->GetCount(); + } +} + +void +EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) +{ + AppLogDebug("EditHistoryListForm::OnSceneActivatedN"); + int groupCount = 0; + int count = 0; + + if(__pGroupData != null) + { + groupCount = __pGroupData->GetCount(); + + for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ ) + { + count = __pListView->GetItemCountAt(groupIndex); + + for(int index = 0 ; index < count ; index++) + { + if(__pListView->IsItemChecked( groupIndex,index ) == true) + { + __pListView->SetItemChecked(groupIndex,index,false); + } + } + } + } + if (__pListView != null) + { + __pListView->UpdateList(); + } + __pSelectAllCheck->SetSelected(false); + + GetFooter()->SetItemEnabled(0, false); + Invalidate(true); +} + +void +EditHistoryListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId) +{ + AppLogDebug("EditHistoryListForm::OnSceneDeactivated"); +} + +void +EditHistoryListForm::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status) +{ + +} + +void +EditHistoryListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status) +{ + AppLogDebug("EditHistoryListForm::OnGroupedListViewItemStateChanged entered"); + String selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED"); + bool flag = false; + + if (status == LIST_ITEM_STATUS_UNCHECKED) + { + __selectedCount--; + } + else + { + __selectedCount++; + } + + if (__selectedCount == 0) + { + GetFooter()->SetItemEnabled(0,false); + } + else + { + GetFooter()->SetItemEnabled(0,true); + } + GetFooter()->Invalidate(true); + + selectedText.Append(L"("); + selectedText.Append(__selectedCount); + selectedText.Append(L")"); + + __pSelectedLabel->SetText(selectedText); + __pSelectedLabel->Invalidate(true); + + if (status == LIST_ITEM_STATUS_UNCHECKED) + { + __pSelectAllCheck->SetSelected(false); + } + else if (status == LIST_ITEM_STATUS_CHECKED && __pSelectAllCheck->IsSelected() == false && __pGroupData != null) + { + int itemCount = __pGroupData->GetCount(); + for (int groupIndex = 0 ; groupIndex < itemCount ; groupIndex ++) + { + GroupItemClass* pGClass = (dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex))); + if(pGClass == null) + { + continue; + } + for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++) + { + bool ret = __pListView->IsItemChecked(groupIndex,itemIndex); + + if (ret == false) + { + __pSelectAllCheck->SetSelected(false); + return; + } + } + } + __pSelectAllCheck->SetSelected(true); + } + +} + +void +EditHistoryListForm::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction) +{ + +} + +String +EditHistoryListForm::GetMonth(int month) +{ + String monthValue; + switch (month) + { + case 1: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));; + break; + case 2: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));; + break; + case 3: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));; + break; + case 4: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));; + break; + case 5: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));; + break; + case 6: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));; + break; + case 7: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));; + break; + case 8: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));; + break; + case 9: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));; + break; + case 10: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));; + break; + case 11: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));; + break; + case 12: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));; + break; + default: + break; + } + + return monthValue; +} + +void +EditHistoryListForm::CreateGroupItems(void) +{ + AppLogDebug("EditHistoryListForm::createGroupItems entered"); + if (__pGroupData != null) + { + __pGroupData->RemoveAll(true); + delete __pGroupData; + __pGroupData = null; + } + + if (__pGroupData == null) + { + __pGroupData = new(std::nothrow) Collection::ArrayList(); + __pGroupData->Construct(); + } + + DateTime currentTime; + + HistoryPresentationModel::GetCurrentDateTime(currentTime); + GroupItemClass* pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY"); + pGroupItemClass->__endTime = currentTime; + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + __pGroupData->Add(*pGroupItemClass); + int dayOfWeek = 0; + Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); + + if (pGregorianCalendar != NULL) + { + pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear()); + pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth()); + pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay()); + dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK); + delete pGregorianCalendar; + } + + + switch(dayOfWeek) + { + case SUNDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 6 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case MONDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 7 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case TUESDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1); + __pGroupData->Add(*pGroupItemClass); + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 8 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case WEDNESDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 9 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case THURSDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 10 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case FRIDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 11 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case SATURDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 5 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 5 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 12 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + default: + break; + } + int day = currentTime.GetDay(); + switch(day/7) + { + case 2: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = L"Two weeks ago"; + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case 3: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = L"Two weeks ago"; + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = L"Three weeks ago"; + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + __pGroupData->Add(*pGroupItemClass); + break; + + case 4: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = L"Two weeks ago"; + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = L"Three weeks ago"; + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + __pGroupData->Add(*pGroupItemClass); + break; + default: + break; + } + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + pGroupItemClass->__endTime.AddDays(-1); + pGroupItemClass->__startTime.SetValue(currentTime.GetYear(), 1, 1); + pGroupItemClass->__startTime.AddMonths(currentTime.GetMonth() - 1 - 1); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER"); + pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),1, 1); + pGroupItemClass->__endTime.AddMonths(currentTime.GetMonth() - 2); + pGroupItemClass->__endTime.AddDays(-1); + pGroupItemClass->__startTime.SetValue(0, 0, 0); + __pGroupData->Add(*pGroupItemClass); +} + +void EditHistoryListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus) +{ + if (__pListView != null) + { + __pListView->UpdateList(); + } +} + +void +EditHistoryListForm::OnTimerExpired(Timer& timer) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if ( pSceneManager != NULL) + { + pSceneManager->GoBackward(BackwardSceneTransition()); + } +} diff --git a/src/IntEditHomePageForm.cpp b/src/IntEditHomePageForm.cpp new file mode 100644 index 0000000..c5808fe --- /dev/null +++ b/src/IntEditHomePageForm.cpp @@ -0,0 +1,282 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet EditHomePageForm class +/*@file: EditHomePageForm.h + *@brief: Allow user to set any page as Home page. + * + */ + +#include +#include + +#include "IntBookmarkData.h" +#include "IntCommonLib.h" +#include "IntEditHomePageForm.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSceneRegister.h" +#include "IntSettingPresentationModel.h" + + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +const int EditHomePageForm::IDA_BUTTON_DONE = 101; +const int EditHomePageForm::IDA_BUTTON_CANCEL = 102; + +EditHomePageForm::EditHomePageForm(void) +:__pUrlEditField(null) +, __pMsgBox(null) +, __modalMsgBoxResult(0) +{ + +} + +EditHomePageForm::~EditHomePageForm(void) +{ + +} + +bool +EditHomePageForm::Initialize(void) +{ + Construct(L"IDL_EDIT_HOME_PAGE"); + SetOrientation(ORIENTATION_AUTOMATIC); + return true; +} + +result +EditHomePageForm::OnInitializing(void) +{ + result r = E_SUCCESS; + SetFormBackEventListener(this); + SceneManager* pSceneManager = SceneManager::GetInstance(); + AppAssert(pSceneManager); + pSceneManager->AddSceneEventListener(IDSCN_EDIT_HOMEPAGE_VIEW, *this); + + GetHeader()->AddActionEventListener(*this); + + __pUrlEditField = static_cast(GetControl(L"IDC_EDITFIELD")); + if (__pUrlEditField != null) + { + __pUrlEditField->AddTextEventListener(*this); + __pUrlEditField->SetOverlayKeypadCommandButtonVisible(false); + } + return r; +} + +result +EditHomePageForm::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +void +EditHomePageForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + if (__pUrlEditField != null) + { + String favURL = SettingPresentationModel::GetInstance()->GetFavoriteUrl(); + AppLogDebug("EditHomePageForm::OnSceneActivatedN favURL %ls",favURL.GetPointer()); + __pUrlEditField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteUrl()); + __pUrlEditField->SetFocus(); + __pUrlEditField->SetCursorPosition(__pUrlEditField->GetTextLength()); + __pUrlEditField->ShowKeypad(); + __pUrlEditField->Invalidate(true); + } + + Invalidate(true); + + return; +} + +void +EditHomePageForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + +} + +void +EditHomePageForm::OnFormBackRequested(Form& source) +{ + +} + +void +EditHomePageForm::OnActionPerformed(const Control& source, int actionId) +{ + ArrayList* pArgList = null; + pArgList = new(std::nothrow) ArrayList(); + switch(actionId) + { + case IDA_BUTTON_DONE: + { + pArgList->Add(*new(std::nothrow) String(CommonUtil::GetString(L"IDS_BR_SK_DONE"))); + String urlText = __pUrlEditField->GetText(); + AppLogDebug("set url text is %ls",urlText.GetPointer()); + + bool ret = false; + bool flag = false; + String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"); + String secondPattern(L"^[A-Za-z0-9\.\+-:#@%/;$~?]+\\.[A-Za-z0-9\+-=:#@%/;$~()_?\\\.&]{2,}$"); // URL of type abc.com (i.e without protocol in front of it) + RegularExpression firstRegex; + RegularExpression secondRegex; + + firstRegex.Construct(firstPattern, REGEX_CASELESS); + secondRegex.Construct(secondPattern, REGEX_CASELESS); + + Uri uri; + uri.SetUri(urlText); + urlText = uri.GetEncodedString(); + + // Match + ret = firstRegex.Match(urlText, false); // This returns true value + flag = secondRegex.Match(urlText, false); // Checks whether URL typed is of type abc.com (i.e without protocol in front of it) + + + if (ret == true) + { + //valid Url + SettingPresentationModel::GetInstance()->SetHomepage(urlText); + SettingPresentationModel::GetInstance()->SetFavoriteValue(urlText); + result r = SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(), pArgList); + TryCatch(!IsFailed(r), "EditHomePageForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r)); + } + else + { + if (flag == true) + { + String validUrl; + validUrl = L"http://"; + validUrl.Append(urlText); + // save Url + SettingPresentationModel::GetInstance()->SetHomepage(validUrl); + SettingPresentationModel::GetInstance()->SetFavoriteValue(validUrl); + result r = SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(), pArgList); + TryCatch(!IsFailed(r), "EditHomePageForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r)); + } + else + { + // show pop up , not a valid URL + String msg = CommonUtil::GetString(L"IDS_BR_POP_INVALIDADDRESS"); + CreateMessage(msg); + } + } + + break; + } + case IDA_BUTTON_CANCEL: + { + pArgList->Add(*new(std::nothrow) String(CommonUtil::GetString(L"IDS_BR_SK_CANCEL"))); + result r = SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(), pArgList); + TryCatch(!IsFailed(r), "EditHomePageForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r)); + break; + } + default: + break; + } + + CATCH: + pArgList->RemoveAll(true); + delete pArgList; + return; +} + +void +EditHomePageForm::OnTextValueChanged(const Control& source) +{ + String title ; + Header* pHeader = GetHeader(); + + if (pHeader == NULL) + { + return; + } + + if (__pUrlEditField == NULL) + { + return; + } + + title = __pUrlEditField->GetText(); + title.Trim(); + + // To disable done button when folder title edit-field is empty + if (__pUrlEditField && title.IsEmpty() == true) + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, false); + } + else + { + pHeader->SetButtonEnabled(BUTTON_POSITION_LEFT, true); + } + pHeader->Invalidate(true); + return; +} + +void +EditHomePageForm::OnTextValueChangeCanceled(const Control& source) +{ + return; +} + +void +EditHomePageForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) +{ + return; +} + +void +EditHomePageForm::CreateMessage(String& message) +{ + + if (__pMsgBox != null) + { + delete __pMsgBox; + __pMsgBox = null; + __modalMsgBoxResult = 0; + } + + __pMsgBox = new(std::nothrow) MessageBox; + if (__pMsgBox != null) + { + __pMsgBox->Construct(L"", message, MSGBOX_STYLE_OK, 3000); + } + + if (__pMsgBox != null) + { + __pMsgBox->ShowAndWait(__modalMsgBoxResult); + if (__modalMsgBoxResult == MSGBOX_RESULT_OK) + { + if (__pMsgBox != null) + { + delete __pMsgBox; + __pMsgBox = null; + } + } + __modalMsgBoxResult = 0; + } + + return; +} diff --git a/src/IntFaviconManager.cpp b/src/IntFaviconManager.cpp new file mode 100644 index 0000000..6a016a6 --- /dev/null +++ b/src/IntFaviconManager.cpp @@ -0,0 +1,332 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntFaviconManager.cpp + *@brief: Provides functionalities to handle/maintain Browser Favicon. + */ + +#include +#include "IntTypes.h" +#include "IntFaviconManager.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Media; + +const wchar_t* FAVICON_DATA_TABLE = L"FaviconData"; +static const wchar_t* IDB_ICON_DEFAULT_FAVICON = L"I01_icon_default_favicon.png"; +FaviconManager* FaviconManager::__pFaviconManagerInstance = null; + +Bitmap* FaviconManager::__pDefaultBitmap = null; + +FaviconManager::FaviconManager(void) +{ + +} + +FaviconManager::~FaviconManager(void) +{ + +} + +FaviconManager::FaviconManager(const FaviconManager& settingModelObj) +{ + +} + +FaviconManager& FaviconManager::operator=(const FaviconManager& settingModelObj) +{ + return *this; +} + +result +FaviconManager::Construct(void) +{ + result r = E_SUCCESS; + r = PresentationModelBase::Initialize(); + TryCatch( !IsFailed(r),,"FaviconManager::Initialize failed %s",GetErrorMessage(r)); + + CATCH: return r; +} + +void +FaviconManager::CreateInstance(void) +{ + if (__pFaviconManagerInstance == null) + __pFaviconManagerInstance = new(std::nothrow) FaviconManager(); + result r = __pFaviconManagerInstance->Construct(); + if (IsFailed(r)) + { + delete __pFaviconManagerInstance; + __pFaviconManagerInstance = null; + return; + } + std::atexit(DestroyInstance); + +} + +void FaviconManager::DestroyInstance(void) +{ + if (__pFaviconManagerInstance) + { + delete __pFaviconManagerInstance; + __pFaviconManagerInstance = null; + } +} + + +FaviconManager* +FaviconManager::GetInstance(void) +{ + if (__pFaviconManagerInstance == null) + { + CreateInstance(); + } + return __pFaviconManagerInstance; + +} + + +String +FaviconManager::GenerateFileName(void) +{ + AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry(); + String keyCount("FileCount"); + String fileName = UiApp::GetInstance()->GetAppRootPath() + "data/favicons/"; + result r = E_SUCCESS; + int keyValue = 1; + if ( pAppRegistry == NULL ) + { + return NULL; + } + r = pAppRegistry->Get(keyCount, keyValue); + + if (r == E_KEY_NOT_FOUND) + { + keyValue = 1; + pAppRegistry->Add(keyCount, keyValue); + } + else + { + keyValue++; + pAppRegistry->Set(keyCount, keyValue); + } + + fileName.Append(keyValue); + pAppRegistry->Save(); + + return fileName; +} + +void +FaviconManager::SaveBitmapToFile(Bitmap& bitmap, String& filePath) +{ + + result r; + Image image; + + image.Construct(); + r = image.EncodeToFile(bitmap, Tizen::Media::IMG_FORMAT_PNG, filePath, true); + + TryCatch( !IsFailed(r),,"FaviconManager::SaveBitmapToFile %s",GetErrorMessage(r)); + + CATCH: return ; +} + +String +FaviconManager::SaveFavicon(Tizen::Graphics::Bitmap& bitmap, String& url) +{ + AppLogDebug("FaviconManager::SaveFavicon"); + + result r = E_FAILURE; + String faviconTable = FAVICON_DATA_TABLE; + String query; + String columnNames; + String attachment; + int resultCount = -1; + int length = -1; + DateTime dt; + int faviconID = -1; + String faviconId; + String filePath ; + bool nextRowPresent = false; + + columnNames.Append(L"URL, "); + columnNames.Append(L"FILE_PATH"); + + //strQuery.Append(L"SELECT FILE_PATH FROM strFaviconTable WHERE URL= 'strURL'"); + query.Clear(); + //strQuery.Format(MAX_DB_QUERY_SIZE, L"SELECT COUNT(ID) FROM %ls WHERE NOTEBOOK_ID = %ls", strTable.GetPointer(),notebookId.GetPointer()); + query.Append(L"SELECT ID, FILE_PATH FROM "); + query.Append(faviconTable); + query.Append(" WHERE URL LIKE "); + query.Append("'"); + query.Append(url); + query.Append("'"); + r = PresentationModelBase::ExecuteQuery(query, resultCount); + AppLogDebug("FaviconManager: nResultCount %d",resultCount); + + if (resultCount < 1) + { + filePath = GenerateFileName(); + if (url.EndsWith(L".gif")) + { + filePath.Append(L".gif"); + } + else if (url.EndsWith(L".ico")) + { + filePath.Append(L".ico"); + } + else if (url.EndsWith(L".png")) + { + filePath.Append(L".png"); + } + query.Clear(); + //@Append() is replaced with Format() for improving performance + //strQuery.Format(MAX_DB_QUERY_SIZE, L"INSERT INTO %ls(%ls) VALUES('%ls', '%ls', '%ls', %ls, '%ls', '%ls', %d, %d, '%ls')", strNoteTable.GetPointer(),strColumnNames.GetPointer(), note.GetNoteTitle().GetPointer(), notePlaintext.GetPointer(), noteEncodedHtml.GetPointer(), note.GetNotebookId().GetPointer(), dt.ToString().GetPointer(), dt.ToString().GetPointer(), note.IsFavorite(), note.IsLocked(), strAttachment.GetPointer()); + query.Append(L"INSERT INTO "); + query.Append(faviconTable); + query.Append("("); + query.Append(columnNames); + query.Append(") "); + query.Append("VALUES("); + query.Append("'"); + query.Append(url); + query.Append("'"); + query.Append(", "); + query.Append("'"); + query.Append(filePath); + query.Append("')"); + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"FaviconManager::SaveFavicon query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + TryCatch( r == E_SUCCESS,,"FaviconManager::SaveFavicon CommitDb failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::GetLastInsertedId(faviconTable, faviconID); + TryCatch( r == E_SUCCESS,,"FaviconManager::SaveFavicon GetLastInsertedId failed %s",GetErrorMessage(r)); + + faviconId.Append(faviconID); + + if (faviconId.GetLength() < 0) + { + AppLogDebug("FaviconManager::length is less than 0"); + } + + } + else + { + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + TryCatch( r == E_SUCCESS,,"FaviconManager::SaveFavicon DbIsNextRowPresent failed %s",GetErrorMessage(r)); + + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, faviconID); + TryCatch( r == E_SUCCESS,,"FaviconManager::SaveFavicon GetColumn failed %s",GetErrorMessage(r)); + + faviconId.Append(faviconID); + + if (faviconId.GetLength() < 0) + { + AppLogDebug("FaviconManager::length is less than 0"); + } + r = PresentationModelBase::GetColumn(1, filePath); + TryCatch( r == E_SUCCESS,,"FaviconManager::SaveFavicon GetColumn failed %s",GetErrorMessage(r)); + } + + } + + SaveBitmapToFile(bitmap,filePath); + AppLogDebug("FaviconManager::SaveFavicon: %ls, %ls , %ls", url.GetPointer(),filePath.GetPointer(), faviconId.GetPointer()); + + CATCH: return faviconId; + } + +Bitmap* +FaviconManager::GetFaviconN(Tizen::Base::String& favicon_Id) +{ + int count = -1; + int length = -1; + String query; + String table = FAVICON_DATA_TABLE; + result r = E_FAILURE; + bool nextRowPresent = false; + String fileName ; + Image image; + Bitmap* pFaviconBitmap = null; + + image.Construct(); + + //query.Format(MAX_DB_QUERY_SIZE, L"SELECT * FROM %ls WHERE NOTEBOOK_ID = %ls", strTable.GetPointer(),notebookId.GetPointer()); + query.Append(L"SELECT FILE_PATH FROM "); + query.Append(table); + query.Append(L" WHERE ID= "); + query.Append("'"); + query.Append(favicon_Id); + query.Append("'"); + + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"FaviconManager::GetFavicon ExecuteQuery failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + TryCatch( r == E_SUCCESS,,"FaviconManager::GetFavicon DbIsNextRowPresent failed %s",GetErrorMessage(r)); + + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, fileName); + TryCatch( r == E_SUCCESS,,"FaviconManager::GetFavicon GetColumn failed %s",GetErrorMessage(r)); + + } + + if (fileName.EndsWith(L".gif")) + { + pFaviconBitmap = image.DecodeN(fileName, BITMAP_PIXEL_FORMAT_ARGB8888); + } + else if (fileName.EndsWith(L".ico")) + { + pFaviconBitmap = image.DecodeN(fileName, BITMAP_PIXEL_FORMAT_ARGB8888); + } + else if (fileName.EndsWith(L".png")) + { + pFaviconBitmap = image.DecodeN(fileName, BITMAP_PIXEL_FORMAT_R8G8B8A8); + } + + return pFaviconBitmap; + + CATCH: return null; +} + +Bitmap* +FaviconManager::GetDefaultFaviconN() +{ + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + + if ( pAppResource == NULL ) + { + return null; + } + + __pDefaultBitmap = pAppResource->GetBitmapN(IDB_ICON_DEFAULT_FAVICON); + return __pDefaultBitmap; +} + diff --git a/src/IntFontManager.cpp b/src/IntFontManager.cpp new file mode 100644 index 0000000..1ed8c5c --- /dev/null +++ b/src/IntFontManager.cpp @@ -0,0 +1,170 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntFontManager.cpp + *@brief: This header file contains the definitions of the FontManager class. + */ + +#include "IntFontManager.h" + +using namespace Tizen::Base; +using namespace Tizen::Graphics; + +FontTable fontTable[] = { + //FONT_GT34 + { + NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN, 34 + }, + //FONT_GT32 + { + NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 32 + }, + //FONT_GT30 + { + NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 30 + }, + //FONT_GT26 + { + NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 26 + }, + //FONT_GT20 + { + NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 20 + }, + //FONT_GT14 + { + NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 14 + }, + + //FONT_GP40 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 40 + }, + //FONT_GP38 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 38 + }, + //FONT_GP36 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 36 + }, + //FONT_GP34 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 34 + }, + //FONT_GP30 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 30 + }, + //FONT_GP26 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 26 + }, + //FONT_GP24 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 24 + }, + //FONT_GP18 + { + NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 18 + }, + + //FONT_GS30 + { + NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 30 + }, + //FONT_GS34 + { + NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 34 + }, + + // end of font table ---------- + { + NULL, L"", FONT_STYLE_PLAIN, 0 + } +}; + +void +FontManager::CreateFont(FontId fontValue) +{ + Font* pFont = null; + if (fontValue < 0 || fontValue >= MAX_FONT) + { + return; + } + + if (fontTable[fontValue].pInstance) + { + return; + } + + if (fontTable[fontValue].fontName.GetLength() <= 0) + { + return; + } + + pFont = new(std::nothrow) Font(); + // If pFont is null then return + if (pFont == NULL) + { + return; + } + + pFont->Construct( /*g_FontTable[fontid].fontName,*/ + fontTable[fontValue].fontStyle, + fontTable[fontValue].fontSize); + + fontTable[fontValue].pInstance = pFont; + return; +} + +Font* +FontManager::GetFont(FontId fontValue) +{ + if (fontValue < 0 || fontValue >= MAX_FONT) + { + return NULL; + } + + //Check for the existence of fontValue in fontTable and if its not null then call CreateFont(fontValue) + + if (fontTable[fontValue].pInstance == null) + { + CreateFont(fontValue); + } + + return fontTable[fontValue].pInstance; + +} + +void +FontManager::ReleaseFonts(void) +{ + int maxCount = 0; + + for (maxCount = 0; maxCount < MAX_FONT; maxCount++) + { + //delete if instance exists in fontTable + if (fontTable[maxCount].pInstance) + { + delete fontTable[maxCount].pInstance; + fontTable[maxCount].pInstance = NULL; + } + } + return; +} diff --git a/src/IntFormFactory.cpp b/src/IntFormFactory.cpp new file mode 100644 index 0000000..cdb7498 --- /dev/null +++ b/src/IntFormFactory.cpp @@ -0,0 +1,208 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntFormFactory.cpp + *@brief: FormFactory class helps in creating appropriate forms with a specified form ID. + * It Should be derived from Tizen::Ui::Scenes::IFormFactory class + */ + +#include "IntAddBookmarkForm.h" +#include "IntBookmarkListForm.h" +#include "IntBrightnessForm.h" +#include "IntCreateBookmarkFolderForm.h" +#include "IntEditBookmarkListForm.h" +#include "IntEditHistoryListForm.h" +#include "IntEditHomePageForm.h" +#include "IntHistoryListForm.h" +#include "IntMainForm.h" +#include "IntMultipleWindowForm.h" +#include "IntReaderFontSizeForm.h" +#include "IntFormFactory.h" +#include "IntSettingForm.h" + +using namespace Tizen::Base; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +const wchar_t* IDL_FORM_MAIN_VIEW_SCENE = L"FormMainMenu"; +const wchar_t* IDL_FORM_BOOKMARK_LIST_SCENE = L"BooKmarkList"; +const wchar_t* IDL_FORM_HISTORY_LIST_SCENE = L"HistoryList"; +const wchar_t* IDL_FORM_EDIT_HISTORY_LIST_SCENE = L"EditHistoryList"; +const wchar_t* IDL_FORM_SETTINGS_CLEAR_PRIVATE_DATA_SCENE = L"SettingsClearPrivateData"; +const wchar_t* IDL_FORM_MULTIPLE_WINDOW_SCENE = L"MultipleWindow"; +const wchar_t* IDL_FORM_SETTINGS_SCENE = L"Settings"; +const wchar_t* IDL_FORM_ADD_BOOKMARK_SCENE = L"AddBookmark"; +const wchar_t* IDL_FORM_ARTICLE_READER_SCENE = L"ArticleReader"; +const wchar_t* IDL_FORM_EDIT_BOOKMARK_LIST_SCENE = L"EditBookmarkList"; +const wchar_t* IDL_FORM_FIND_WORD_SCENE = L"FindWord"; +const wchar_t* IDL_FORM_CREATE_BOOKMARK_FOLDER_SCENE = L"CreateBookmarkFolder"; +const wchar_t* IDL_FORM_FONT_SIZE_SCENE = L"FontSize"; +const wchar_t* IDL_FORM_EDIT_HOME_PAGE_SCENE = L"EditHomePage"; +const wchar_t* IDL_FORM_BRIGHTNESS_SCENE = L"Brightness"; + +FormFactory::FormFactory(void) +{ + +} + +FormFactory::~FormFactory(void) +{ + +} + +Form* +FormFactory::CreateFormN(const String& formId, const SceneId& sceneId) +{ + AppLog("FormFactory createForm"); + + Tizen::Ui::Controls::Form* pNewForm = null; + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if ( pSceneManager == null) + { + return null; + } + + if (formId.Contains(IDL_FORM_MAIN_VIEW_SCENE) == true) + { + MainForm* pForm = new(std::nothrow) MainForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pSceneManager->AddSceneEventListener(sceneId, *pForm); + pNewForm = pForm; + } + else if (formId == IDL_FORM_BOOKMARK_LIST_SCENE) + { + BookmarkListForm* pForm = new(std::nothrow) BookmarkListForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == IDL_FORM_HISTORY_LIST_SCENE) + { + HistoryListForm* pForm = new(std::nothrow) HistoryListForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == IDL_FORM_EDIT_HISTORY_LIST_SCENE) + { + EditHistoryListForm* pForm = new(std::nothrow) EditHistoryListForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + + else if (formId == IDL_FORM_MULTIPLE_WINDOW_SCENE) + { + MultipleWindowForm* pForm = new(std::nothrow) MultipleWindowForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == IDL_FORM_SETTINGS_SCENE) + { + SettingForm* pForm = new(std::nothrow) SettingForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == IDL_FORM_ADD_BOOKMARK_SCENE) + { + AddBookmarkForm* pForm = new(std::nothrow) AddBookmarkForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + + else if (formId == IDL_FORM_EDIT_BOOKMARK_LIST_SCENE) + { + EditBookmarkListForm* pForm = new(std::nothrow) EditBookmarkListForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + + else if (formId == IDL_FORM_CREATE_BOOKMARK_FOLDER_SCENE) + { + CreateBookmarkFolderForm* pForm = new(std::nothrow) CreateBookmarkFolderForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + + else if (formId == IDL_FORM_FONT_SIZE_SCENE) + { + ReaderFontSizeForm* pForm = new(std::nothrow) ReaderFontSizeForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == IDL_FORM_EDIT_HOME_PAGE_SCENE) + { + EditHomePageForm* pForm = new(std::nothrow) EditHomePageForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + else if (formId == IDL_FORM_BRIGHTNESS_SCENE) + { + BrightnessForm* pForm = new(std::nothrow) BrightnessForm(); + if (pForm == null) + { + return null; + } + pForm->Initialize(); + pNewForm = pForm; + } + AppLogDebug("FormFactory createForm exit"); + return pNewForm; +} diff --git a/src/IntHistory.cpp b/src/IntHistory.cpp new file mode 100644 index 0000000..634e369 --- /dev/null +++ b/src/IntHistory.cpp @@ -0,0 +1,210 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntHistory.cpp + *@brief: Used to define History + */ + +#include "IntHistoryData.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::System; +using namespace Tizen::Locales; +using namespace Tizen::Media; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; + +History::History(void) + : __historyId("") + , __historyTitle("") + , __historyUrl("") + , __iconPath("") + ,__bookmarkId(L"") + ,__faviconId(L"") + , __visitedCount(0) + , __pThumbnail(null) + , __thumbnailPath("") +{ + AppLog("History::History(void)"); + __visitedTime.SetValue(0,0,0); +} + +History::History(const History& hs) +{ + AppLog("History::History(const History& hs)"); + __historyId = hs.__historyId; + __historyTitle = hs.__historyTitle; + __historyUrl = hs.__historyUrl; +} + +History::~History(void) +{ + if(__pThumbnail != null) + { + delete __pThumbnail; //TODO To get this reviewed + } + AppLog("History::~History()"); +} + +History& +History::operator =(const History& rhs) +{ + if (this != &rhs) + { + __historyId = rhs.__historyId; + __historyTitle = rhs.__historyTitle; + __historyUrl = rhs.__historyUrl; + } + return *this; +} + +String +History::GetHistoryId(void) const +{ + return __historyId; +} + +String +History::GetHistoryTitle(void) const +{ + return __historyTitle; +} + +String +History::GetHistoryUrl(void) const +{ + return __historyUrl; +} + +DateTime +History::GetVisitedTime(void) const +{ + return __visitedTime; +} + +String +History::GetHistoryIconPath(void) const +{ + return __iconPath; +} + +String +History::GetFaviconId(void) const +{ + return __faviconId; +} + +String +History::GetBookmarkId(void) const +{ + return __bookmarkId; +} + +int +History::GetVisitedCount(void) const +{ + return __visitedCount; +} + +Bitmap* +History::GetThumbnail(void) const +{ + return __pThumbnail; +} + +String +History::GetThumbnailPath(void) const +{ + return __thumbnailPath; +} + +void +History::SetHistoryId(const String& strHistoryId) +{ + __historyId = strHistoryId; + return; +} + +void +History::SetHistoryTitle(String& strHistoryTitle) +{ + strHistoryTitle.Trim(); + __historyTitle = strHistoryTitle; + return; +} + +void +History::SetHistoryUrl(const String& strHistoryUrl) +{ + __historyUrl = strHistoryUrl; + return; +} + +void +History::SetVisitedTime(const DateTime& strVisitedTime) +{ + __visitedTime = strVisitedTime; + return; +} + +void +History::SetIconPath(const String& strFilePath) +{ + __iconPath = strFilePath; + return; +} + +void +History::SetFaviconId(const String& strFaviconId) +{ + __faviconId = strFaviconId; +} + +void +History::SetBookmarkId(const String& bookmarkId) +{ + __bookmarkId = bookmarkId; +} + +void +History::SetVisitedCount(int& visitedCount) +{ + __visitedCount = visitedCount; +} + +void +History::SetThumbnail(Bitmap* thumbnail) +{ + //TODO To get this reviewed + if(__pThumbnail != thumbnail && __pThumbnail != null) { + delete __pThumbnail; + } + __pThumbnail = thumbnail; +} + +void +History::SetThumbnailPath(String& thumbnailPath) +{ + __thumbnailPath = thumbnailPath; +} diff --git a/src/IntHistoryListForm.cpp b/src/IntHistoryListForm.cpp new file mode 100644 index 0000000..94915c3 --- /dev/null +++ b/src/IntHistoryListForm.cpp @@ -0,0 +1,1836 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet HistoryListForm class +/*@file: HistoryListForm.cpp + *@brief: This class defines HistoryListForm used define history + * + */ + +#include +#include +#include "IntBookmarkData.h" +#include "IntBookmarkPresentationModel.h" +#include "IntCommonLib.h" +#include "IntFaviconManager.h" +#include "IntHistoryListForm.h" +#include "IntHistoryPresentationModel.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSceneRegister.h" +#include "IntTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Graphics; +using namespace Tizen::Locales; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png"; +static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png"; +static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png"; +static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png"; + + +const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101; +const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102; +const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103; +const int HistoryListForm::IDA_FORMAT_ICON = 104; +const int HistoryListForm::IDA_FORMAT_TITLE = 105; +const int HistoryListForm::IDA_FORMAT_URL = 106; +const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107; + + +HistoryListForm::HistoryListForm(void) +{ + __pGroupedListView =null; + __pSearchListView = null; + __pSearchBar = null; + __pGroupData = null; + __pSearchedData = null ; + __searchHistory = false; + __isNoHistoryPresent = true; +} + +HistoryListForm::~HistoryListForm(void) +{ + if (__pGroupData != null) + { + __pGroupData->RemoveAll(true); + delete __pGroupData; + } +} + +bool +HistoryListForm::Initialize(void) +{ + Construct(L"IDL_HISTORY_LIST"); + + return true; +} + +result +HistoryListForm::OnInitializing(void) +{ + AppLog("HistoryListForm::OnInitializing"); + result r = E_SUCCESS; + SceneManager* pSceneManager = null; + HeaderItem bookmark; + HeaderItem history; + Header *pHeader = GetHeader(); + Bitmap *pIconBitmap = null; + AppResource* pAppResource = UiApp::GetInstance()->GetAppResource(); + const Color brown = Color(32, 32, 32, 0xFF); + + // Setup back event listener + SetFormBackEventListener(this); + + GetHeader()->AddActionEventListener(*this); + GetFooter()->AddActionEventListener(*this); + + AddOrientationEventListener(*this); + pSceneManager = SceneManager::GetInstance(); + if (pSceneManager != null) + { + pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this); + } + + if (pAppResource == null) + { + return E_FAILURE; + } + + __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1")); + if (__pGroupedListView == null) + { + return E_FAILURE; + } + r = __pGroupedListView->SetItemProvider(*this); + if (IsFailed(r)) + { + return r; + } + + + __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1")); + if (__pSearchBar == null) + { + return E_FAILURE; + } + __pSearchListView = new(std::nothrow) GroupedListView(); + if (__pSearchListView == null) + { + return E_FAILURE; + } + __pGroupedListView->AddGroupedListViewItemEventListener(*this); + r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY())); + if (IsFailed(r)) + { + return r; + } + r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false); + if (IsFailed(r)) + { + return r; + } + r = __pSearchListView->SetItemProvider(*this); + if (IsFailed(r)) + { + return r; + } + r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND")); + + if (IsFailed(r)) + { + return r; + } + + __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK)); + __pSearchListView->AddGroupedListViewItemEventListener(*this); + r = __pSearchListView->SetShowState(false); + if (IsFailed(r)) + { + return r; + } + + + __pSearchBar->AddSearchBarEventListener(*this); + __pSearchBar->AddKeypadEventListener(*this); + r = __pSearchBar->SetContent(__pSearchListView); + + if (pHeader != null) + { + pHeader->SetStyle(HEADER_STYLE_TAB); + bookmark.Construct(IDA_TABBAR_ITEM_1); + String strbookmark; + pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark); + bookmark.SetText(strbookmark); + pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS); + bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap); + bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap); + pHeader->AddItem(bookmark); + + if (pIconBitmap) + { + delete pIconBitmap; + } + + + history.Construct(IDA_TABBAR_ITEM_2); + String strhistory; + pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory); + history.SetText(strhistory); + pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY); + history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap); + history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap); + pHeader->AddItem(history); + pHeader->SetItemSelected(1); + + if (pIconBitmap != NULL) + { + delete pIconBitmap; + } + } + + return r; +} + +result +HistoryListForm::OnTerminating(void) +{ + result r = E_SUCCESS; + + return r; +} + +void +HistoryListForm::OnActionPerformed(const Control& source, int actionId) +{ + AppLog("HistoryListForm::OnActionPerformed"); + result r = E_FAILURE; + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + switch (actionId) + { + case IDA_EDIT_HISTORY_LIST_FORM: + { + AppLog("ID_EDIT_HISTORY_LIST_FORM entered"); + r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)); + if (IsFailed(r)) + { + return; + } + } + break; + case IDA_TABBAR_ITEM_1: + { + result r = GetHeader()->SetItemSelected(1); + AppLog("SetItemSelected result %s",GetErrorMessage(r)); + GetHeader()->Invalidate(true); + r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); + if (IsFailed(r)) + { + return; + } + } + break; + default: + break; + } +} + +void +HistoryListForm::OnFormBackRequested(Form& source) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + result r = pSceneManager->GoBackward(BackwardSceneTransition()); + if(IsFailed(r)) + { + AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r)); + } +} + +GroupItem* +HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth) +{ + result r = E_FAILURE; + int strMonth = 0; + String text(L""); + DateTime endTime; + DateTime startTime; + int count = 0; + GroupItem* pItem = null; + GroupItemClass* pGroupItemClass = null; + + String weeksAgo2 = L""; + weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2); + + String weeksAgo3 = L""; + weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3); + + String weeksAgo4 = L""; + weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4); + + pItem = new(std::nothrow) GroupItem(); + if (pItem == null) + { + return null; + } + pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + + if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0) + { + AppLog("CreateGroupItem :: if history is null"); + r = pItem->Construct(Dimension(itemWidth, 0)); + return pItem; + } + else + { + r = pItem->Construct(Dimension(itemWidth, 48)); + } + text = pGroupItemClass->GetTitleText(); + + if (__searchHistory == false) + { + String month = L""; + text.Append(L" ("); + if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY")) + { + int dayOfWeek = 0; + Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); + if ( pGregorianCalendar != NULL) + { + r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear()); + if (IsFailed(r)) + { + if( pItem != null) + { + delete pItem; + } + delete pGregorianCalendar; + return null; + } + r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth()); + if (IsFailed(r)) + { + if( pItem != null) + { + delete pItem; + } + delete pGregorianCalendar; + return null; + } + r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay()); + if (IsFailed(r)) + { + if( pItem != null) + { + delete pItem; + } + delete pGregorianCalendar; + return null; + } + dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK); + + delete pGregorianCalendar; + + } + switch(dayOfWeek) + { + case SUNDAY: + text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN")); + break; + case MONDAY: + text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON")); + break; + case TUESDAY: + text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE")); + break; + case WEDNESDAY: + text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED")); + break; + case THURSDAY: + text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU")); + break; + case FRIDAY: + text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI")); + break; + case SATURDAY: + text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT")); + break; + default: + break; + } + text.Append(L", "); + } + + if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER")) + { + text.Append(pGroupItemClass->GetStartTime().GetDay()); + text.Append(L". "); + strMonth = pGroupItemClass->GetStartTime().GetMonth(); + month = GetMonth(strMonth); + text.Append(month); + } + else + { + text.Append(L"~ "); + } + + + + if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2 + || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER")) + { + text.Append(L" - "); + text.Append(pGroupItemClass->GetEndTime().GetDay()); + text.Append(L". "); + strMonth = pGroupItemClass->GetEndTime().GetMonth(); + month = GetMonth(strMonth); + text.Append(month); + } + text.Append(L".)"); + } + + r = pItem->SetElement(text, null); + if (IsFailed(r)) + { + delete pItem; + AppLogDebug("Failed with %s", GetErrorMessage(r)); + return null; + } + r = pItem->SetTextSize(32); + if (IsFailed(r)) + { + delete pItem; + return null; + } + + return pItem; +} + +ListItemBase* +HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth) +{ + AppLog("HistoryListForm::CreateItem"); + result r = E_FAILURE; + History* pHistory = null; + Bitmap* pBitmap = null; + GroupItemClass* pGroupItemClass = null; + CustomItem* pItem = new(std::nothrow) CustomItem(); + int bookmarkBtnWidth = 0; + Bitmap* pBookmarkBitmap = null; + String bitmapId; + + if (pItem == null) + { + return null; + } + pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if (pGroupItemClass == null) + { + delete pItem; + return null; + } + pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex)); + if (pHistory == null) + { + delete pItem; + return null; + } + r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL); + if (IsFailed(r)) + { + delete pItem; + return null; + } + + bitmapId = pHistory->GetFaviconId() ; + + pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId); + + if (pBitmap == null) + { + pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN(); + } + if (pBitmap != null) + { + r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null); + delete pBitmap; + if (IsFailed(r)) + { + delete pItem; + AppLogException("CreateItem failed with %s", GetErrorMessage(r)); + return null; + } + } + if (pHistory->GetBookmarkId().GetLength()>0) + { + pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP); + } + else + { + pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP); + } + bookmarkBtnWidth = 64; + + + r = pItem->AddElement(Rectangle(104, 10, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 60), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), 44,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true); + TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r)); + + if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT) + r = pItem->AddElement(Rectangle(104, 70, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true); + else + r = pItem->AddElement(Rectangle(104, 70, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true); + TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r)); + if ( pBookmarkBitmap != null) + { + r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap); + TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r)); + delete pBookmarkBitmap; + } + return pItem; + + CATCH: + delete pItem; + delete pBookmarkBitmap; + return null; +} + +bool +HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth) +{ + + // delete pItem; + // pItem = null; + return false; +} + +bool +HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth) +{ + AppLog("HistoryListForm::DeleteItem"); + result r = E_FAILURE; + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if (pGroupItemClass == null) + { + return false; + } + + // if (pGroupItemClass->__pData != null) + // { + // r = pGroupItemClass->__pData->RemoveAt(itemIndex); + // if (IsFailed(r)) + // { + // return false; + // } + // } + + delete pItem; + pItem = null; + return true; +} + +int +HistoryListForm::GetGroupCount(void) +{ + __isNoHistoryPresent = true; + CreateGroupItems(); + if (__pGroupData != null) + { + if (__searchHistory == false) + { + int count = 0; + HistoryPresentationModel::GetInstance()->GetHistoryCount(count); + if (count == 0) + { + return 0; + } + return __pGroupData->GetCount(); + } + else + { + int count = 0; + String searchText = __pSearchBar->GetText(); + result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, searchText); + if(count) + return 1; + else + return 0; + } + } + else + { + return 0; + } +} + +int +HistoryListForm::GetItemCount(int groupIndex) +{ + result r = E_FAILURE; + int count = 0; + DateTime endTime; + DateTime startTime; + String text; + + GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if (pGroupItemClass == null) + { + return null; + } + if (__searchHistory == false) + { + startTime = pGroupItemClass->GetStartTime(); + endTime = pGroupItemClass->GetEndTime(); + r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count); + } + else + { + text = __pSearchBar->GetText(); + r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,text); + if(count == 0) + { + return count; + } + } + if (IsFailed(r)) + { + return 0; + } + + ArrayList* pData = new(std::nothrow) ArrayList(); + if (pData == null) + { + return 0; + } + r = pData->Construct(); + + if (IsFailed(r)) + { + delete pData; + return 0; + } + + if (__searchHistory == false) + { + startTime = pGroupItemClass->GetStartTime(); + endTime = pGroupItemClass->GetEndTime(); + AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer()); + r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData); + } + else + { + text = __pSearchBar->GetText() ; + r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,text ); + } + if (IsFailed(r)) + { + delete pData; + return 0; + } + pGroupItemClass->SetHistoryData(pData); + + + if (__isNoHistoryPresent == true && count == 0) + { + __isNoHistoryPresent = true; + GetFooter()->SetItemEnabled(0, false); + } + else + { + __isNoHistoryPresent = false; + GetFooter()->SetItemEnabled(0, true); + } + // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null) + { + delete pData; + return 0; + } + else + { + AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer()); + return pGroupItemClass->GetHistoryData()->GetCount(); + } +} + +void +HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + + GetHeader()->SetItemSelected(1); + + AppLog("HistoryListForm::OnSceneActivatedN called"); + //GetHeader()->Invalidate(true); + if (__pGroupData == null) + { + __pGroupData = new(std::nothrow) ArrayList(); + __pGroupData->Construct(); + } + if (__pGroupedListView != null) + { + __pGroupedListView->UpdateList(); + __pGroupedListView->Invalidate(true); + } + if (__isNoHistoryPresent == true) + { + GetFooter()->SetItemEnabled(0, false); + } + else + { + GetFooter()->SetItemEnabled(0, true); + } + + int count = 0; + HistoryPresentationModel::GetInstance()->GetHistoryCount(count); + if (count == 0) + { + __pSearchBar->SetShowState(false); + __pSearchBar->Invalidate(true); + } + else + { + __pSearchBar->SetShowState(true); + __pSearchBar->Invalidate(true); + } + + // if (__isNoHistoryPresent == true) + // { + // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png")); + // __pGroupedListView->UpdateList(); + // } + + result r = GetHeader()->SetItemSelected(2); + if (IsFailed(r)) + { + AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r)); + return; + } + + Invalidate(true); + +} + +void +HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + AppLog("HistoryListForm::OnSceneDeactivated"); + __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL); +} + +void +HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status) +{ + +} + +void +HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status) +{ + GroupItemClass* pGroupItemClass = null; + History* pHistory = null; + AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status); + if (elementId == IDA_FORMAT_BOOKMARK) + { + String toggledUrl = L""; + AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK"); + pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if (pGroupItemClass == null) + { + return; + } + pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex)); + if (pHistory == null) + { + return; + } + toggledUrl = pHistory->GetHistoryUrl(); + + AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer()); + if (pHistory->GetBookmarkId().GetLength() > 0) + { + AppLog("Already added to bookmark so will be removed"); + String bookmarkId = L""; + int id = 0; + + bookmarkId = pHistory->GetBookmarkId(); + Integer::Parse(bookmarkId,id); + BookmarkPresentationModel::GetInstance()->DeleteBookmark(id); + pHistory->SetBookmarkId(L""); + //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY); + + for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++) + { + pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex)); + if (pGroupItemClass == null) + { + continue; + } + for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++) + { + pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index)); + if (pHistory == null) + { + continue; + } + if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0) + { + pHistory->SetBookmarkId(L""); + AppLog("Already added to bookmark so will be removed"); + String bookmarkId = L""; + int id = 0; + + bookmarkId = pHistory->GetBookmarkId(); + Integer::Parse(bookmarkId,id); + BookmarkPresentationModel::GetInstance()->DeleteBookmark(id); + pHistory->SetBookmarkId(L""); + //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY); + + for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++) + { + pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex)); + if (pGroupItemClass == null) + { + continue; + } + for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++) + { + pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index)); + if (pHistory == null) + { + continue; + } + if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0) + { + pHistory->SetBookmarkId(L""); + //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + } + + //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + } + listView.UpdateList(); + + } + else + { + AppLog("Adding history to bookmark"); + result r = E_FAILURE; + BookmarkData pBookmark; + + String bookmarkTitle = pHistory->GetHistoryTitle(); + + pBookmark.SetBookmarkTitle(bookmarkTitle); + pBookmark.SetUrl(pHistory->GetHistoryUrl()); + pBookmark.SetFaviconId(pHistory->GetFaviconId()); + + r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark); + if (!IsFailed(r)) + { + AppLog("History added to bookmark with ID %ls",pBookmark.GetBookmarkId().GetPointer()); + pHistory->SetBookmarkId(pBookmark.GetBookmarkId()); + } + + listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY); + + for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++) + { + pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex)); + if (pGroupItemClass == null) + { + continue; + } + for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++) + { + pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index)); + if (pHistory == null) + { + continue; + } + if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0) + { + pHistory->SetBookmarkId(pBookmark.GetBookmarkId()); + //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } + } + listView.UpdateList(); + } + } + else + { + + pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)); + if (pGroupItemClass == null) + { + return; + } + + History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex)); + if (pHistory1 == null) + { + return; + } + SceneManager* pSceneManager = SceneManager::GetInstance(); + ArrayList *pArgList = null; + result r = E_SUCCESS; + pArgList = new(std::nothrow) ArrayList(); + if (pArgList != null) + { + r = pArgList->Construct(); + if (IsFailed(r)) + { + delete pArgList; + return; + } + + r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo()); + r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl())); + if (IsFailed(r)) + { + delete pArgList; + return; + } + + + } + + String scneId = L""; + MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId); + + if (pSceneManager != null) + { + AppLog("pSceneManager exists"); + r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList); + if(pArgList) + { + pArgList->RemoveAll(false); + delete pArgList; + } + if (IsFailed(r)) + { + return; + } + } + } + +} + +void +HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction) +{ + +} + +void +HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode) +{ + result r = E_FAILURE; + if (mode == SEARCH_BAR_MODE_NORMAL) + { + // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT); + r = __pSearchListView->SetShowState(false); + if (IsFailed(r)) + { + return; + } + r = __pGroupedListView->SetShowState(true); + if (IsFailed(r)) + { + return; + } + __pSearchListView->SetEnabled(true); + GetFooter()->SetShowState(true); + Invalidate(true); + __searchHistory = false; + r = __pGroupedListView->UpdateList(); + if (__isNoHistoryPresent == true) + { + GetFooter()->SetItemEnabled(0, false); + } + else + { + GetFooter()->SetItemEnabled(0, true); + } + + if (IsFailed(r)) + { + return; + } + } + else + { + // __pSearchListView->SetEnabled(false); + r = __pSearchListView->SetShowState(true); + if (IsFailed(r)) + { + return; + } + __pSearchListView->SetEnabled(false); + r = __pSearchListView->UpdateList(); + if (IsFailed(r)) + { + return; + } + r = __pGroupedListView->SetShowState(false); + if (IsFailed(r)) + { + return; + } + if(__pSearchBar != null) + { + __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight())); + } + Footer* pFooter = GetFooter(); + pFooter->SetShowState(false); + } +} + +String +HistoryListForm::GetMonth(int month) +{ + String monthValue = L""; + switch (month) + { + case JANUARY: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN")); + break; + case FEBRUARY: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB")); + break; + case MARCH: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR")); + break; + case APRIL: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR")); + break; + case MAY: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY")); + break; + case JUNE: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN")); + break; + case JULY: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL")); + break; + case AUGUST: + monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG")); + break; + case SEPTEMBER: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP")); + break; + case OCTOBER: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT")); + break; + case NOVEMBER: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV")); + break; + case DECEMBER: + monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC")); + break; + default: + break; + } + + + return monthValue; +} + +void +HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction) +{ + result r = E_FAILURE; + if (__pSearchBar != null) + { + __pSearchBar->HideKeypad(); + } + + if (keypadAction == KEYPAD_ACTION_SEARCH) + { + __pSearchListView->SetEnabled(true); + __searchHistory = true; + r = __pGroupedListView->SetShowState(false); + if (IsFailed(r)) + { + return; + } + r = __pSearchListView->SetShowState(true); + if (IsFailed(r)) + { + return; + } + r= __pSearchListView->UpdateList(); + if (__isNoHistoryPresent == true) + { + GetFooter()->SetItemEnabled(0, false); + } + else + { + GetFooter()->SetItemEnabled(0, true); + } + if (IsFailed(r)) + { + return; + } + } + else + { + __searchHistory = false; + } + Invalidate(true); +} + +void +HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) +{ + result r = E_FAILURE; + if (__pGroupedListView != null) + { + if(__pSearchBar != null &&__pSearchBar->GetShowState()) + r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY())); + else if(__pSearchBar != null) + r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY())); + if (IsFailed(r)) + { + return; + } + __pGroupedListView->UpdateList(); + + if (__pSearchListView != null) + { + r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight())); + if (IsFailed(r)) + { + return; + } + + if ( __searchHistory == false) + { + __pSearchListView->UpdateList(); + } + + if(__pSearchBar != null) + __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight())); + } + + } + + if (__isNoHistoryPresent == true) + { + GetFooter()->SetItemEnabled(0, false); + } + else + { + GetFooter()->SetItemEnabled(0, true); + } +} + +void +HistoryListForm::OnKeypadWillOpen(Control& source) +{ + GetFooter()->SetShowState(false); + __pSearchListView->SetEnabled(false); +} + +void +HistoryListForm::OnKeypadOpened(Control& source) +{ + +} + +void +HistoryListForm::OnKeypadClosed(Control& source) +{ + if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false) + { +// __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL); + __pSearchListView->SetEnabled(true); + } + GetFooter()->SetShowState(true); + Invalidate(true); +} + +void +HistoryListForm::CreateGroupItems() +{ + result r = E_FAILURE; + DateTime currentTime; + DateTime dateTime; + GroupItemClass* pGroupItemClass = null; + String titleText; + + String weeksAgo2 = L""; + weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2); + + String weeksAgo3 = L""; + weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3); + + if (__pGroupData != null) + { + __pGroupData->RemoveAll(true); + delete __pGroupData; + __pGroupData = null; + } + __pGroupData = new(std::nothrow) ArrayList(); + if (__pGroupData == null) + { + return; + } + r = __pGroupData->Construct(); + if (IsFailed(r)) + { + delete __pGroupData; + __pGroupData = null; + return; + } + if (__searchHistory == true) + { + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS"); + pGroupItemClass->SetTitleText(titleText); + r = __pGroupData->Add(*pGroupItemClass); + if (IsFailed(r)) + { + return; + } + } + else + { + Calendar* pGregorianCalendar = null; + int dayOfWeek = 0; + int day = 0; + HistoryPresentationModel::GetCurrentDateTime(currentTime); + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY"); + pGroupItemClass->SetTitleText(titleText); + pGroupItemClass->SetEndTime(currentTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + + pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); + if ( pGregorianCalendar != NULL ) + { + pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear()); + pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth()); + pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay()); + dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK); + delete pGregorianCalendar; + } + switch(dayOfWeek) + { + case SUNDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 6 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + break; + case MONDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 7 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + break; + case TUESDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 8 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + break; + case WEDNESDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 9 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + break; + case THURSDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 10 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + break; + case FRIDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 4 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 4 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 11 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + break; + case SATURDAY: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay()); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 1 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 3 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 4 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 4 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 5 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 5 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 12 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + break; + + default: + break; + } + day = currentTime.GetDay(); + switch(day/7) + { + case 2: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + + pGroupItemClass->SetTitleText(weeksAgo2); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8) + { + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + String weeksAgo3 = L""; + weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3); + pGroupItemClass->SetTitleText(weeksAgo3); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + } + break; + case 3: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + pGroupItemClass->SetTitleText(weeksAgo2); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + + pGroupItemClass->SetTitleText(weeksAgo3); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8) + { + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + } + break; + case 4: + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + pGroupItemClass->SetTitleText(weeksAgo2); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + pGroupItemClass->SetTitleText(weeksAgo3); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8) + { + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + } + break; + default: + break; + } + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1); + dateTime.AddDays(-1); + pGroupItemClass->SetEndTime(dateTime); + dateTime.SetValue(currentTime.GetYear(), 1, 1); + dateTime.AddMonths(currentTime.GetMonth() - 1 - 1); + pGroupItemClass->SetStartTime(dateTime); + __pGroupData->Add(*pGroupItemClass); + + pGroupItemClass = new(std::nothrow) GroupItemClass(); + if (pGroupItemClass == null) + { + return; + } + titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER"); + pGroupItemClass->SetTitleText(titleText); + dateTime.SetValue(currentTime.GetYear(),1, 1); + dateTime.AddMonths(currentTime.GetMonth() - 2); + dateTime.AddDays(-1); + pGroupItemClass->SetEndTime(dateTime); + DateTime dateTime2; + dateTime2.SetValue(0, 0, 0); + pGroupItemClass->SetStartTime(dateTime2); + __pGroupData->Add(*pGroupItemClass); + } +} + +GroupItemClass::GroupItemClass() +{ + __pData = null; +} + +GroupItemClass& +GroupItemClass::operator =(const GroupItemClass& rhs) +{ + if (this != &rhs) + { + __pData = rhs.__pData; + } + return *this; +} + +GroupItemClass::GroupItemClass(const GroupItemClass& groupItem) +{ + __pData = groupItem.__pData; +} + +GroupItemClass::~GroupItemClass() +{ + if (__pData) + { + __pData->RemoveAll(true); + delete __pData; + } +} + +void +GroupItemClass::SetStartTime(DateTime& startTime) +{ + __startTime = startTime; +} + +void +GroupItemClass::SetEndTime(DateTime& endTime) +{ + __endTime = endTime; +} + +void +GroupItemClass::SetTitleText(String& titleText) +{ + __titleText = titleText; +} + +void +GroupItemClass::SetHistoryData(ArrayList* pData) +{ + __pData = pData; +} + +DateTime +GroupItemClass::GetStartTime(void) +{ + return __startTime; +} + +DateTime +GroupItemClass::GetEndTime(void) +{ + return __endTime; +} + +String +GroupItemClass::GetTitleText(void) +{ + return __titleText; +} + +ArrayList* +GroupItemClass::GetHistoryData(void) +{ + return __pData; +} diff --git a/src/IntHistoryPresentationModel.cpp b/src/IntHistoryPresentationModel.cpp new file mode 100644 index 0000000..fa15b99 --- /dev/null +++ b/src/IntHistoryPresentationModel.cpp @@ -0,0 +1,1023 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + + +//!Internet +/*@file: IntHistoryPresentationModel.cpp + *@brief: Provides functionalities to handle/maintain Browser History. + */ + +#include +#include "IntHistoryData.h" +#include "IntHistoryPresentationModel.h" +#include "IntTypes.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Locales; +using namespace Tizen::Media; +using namespace Tizen::System; + +extern const wchar_t* HISTORY_DATA_TABLE; +extern const wchar_t* BOOKMARK_URL_TABLE; + +HistoryPresentationModel* HistoryPresentationModel::__pHistoryPresentationModel = null; + +void HistoryPresentationModel::CreateInstance(void) +{ + if (__pHistoryPresentationModel == null) + __pHistoryPresentationModel = new(std::nothrow) HistoryPresentationModel(); + result r = __pHistoryPresentationModel->Construct(); + if (IsFailed(r)) + { + delete __pHistoryPresentationModel; + __pHistoryPresentationModel = null; + return; + } + std::atexit(DestroyInstance); +} + + +HistoryPresentationModel* HistoryPresentationModel::GetInstance(void) +{ + if (__pHistoryPresentationModel == null) + { + CreateInstance(); + } + return __pHistoryPresentationModel; + +} + +void HistoryPresentationModel::DestroyInstance(void) +{ + if (__pHistoryPresentationModel) + { + delete __pHistoryPresentationModel; + __pHistoryPresentationModel = null; + } +} + +HistoryPresentationModel::HistoryPresentationModel(void) +{ + +} + +HistoryPresentationModel::~HistoryPresentationModel(void) +{ + +} + +HistoryPresentationModel::HistoryPresentationModel(const HistoryPresentationModel& historyModelObj) +{ + +} + +HistoryPresentationModel& HistoryPresentationModel::operator=(const HistoryPresentationModel& historyModelObj) +{ + return *this; +} + +result +HistoryPresentationModel::Construct(void) +{ + result r = E_SUCCESS; + r = PresentationModelBase::Initialize(); + TryCatch( !IsFailed(r),,"Failed to initialize HistoryPresentationModel Model %s",GetErrorMessage(r)); + + CATCH: return r; + +} + +result +HistoryPresentationModel::SaveHistory(History& history) +{ + AppLog("HistoryPresentationModel::saveHistory"); + result r = E_FAILURE; + String historyTable(HISTORY_DATA_TABLE); + String query; + String columnNames; + String attachment; + int resultCount = -1; + int rowId = -1; + DateTime date; + String historyId; + int urlCount = 0; + ArrayList* pMostVisitedSites = null; + bool isAlreadyExist = false; + bool isEligibleForMostVisitedSites = true; + int i; + String thumbnailPath; + int todaysCount = 0; + DateTime todayStart; + DateTime todayEnd; + SystemTime::GetCurrentTime(todayStart); + SystemTime::GetCurrentTime(todayEnd); + todayStart.SetValue(todayStart.GetYear(), todayStart.GetMonth(), todayStart.GetDay(), 0,0,0); + todayEnd.SetValue(todayStart.GetYear(), todayStart.GetMonth(), todayStart.GetDay(), 23,59,59); + + ArrayList* pTodaysList = new(std::nothrow) ArrayList(); + pTodaysList->Construct(); + GetHistoryCountWithTimeRange(todayStart, todayEnd, todaysCount); + GetHistoryWithTimeRange(todayStart, todayEnd, 0, todaysCount, *pTodaysList); + + for(int count = 0; count < todaysCount; count++) + { + History *pHistoryItem = dynamic_cast(pTodaysList->GetAt(count)); + if(pHistoryItem != null && pHistoryItem->GetHistoryUrl().CompareTo(history.GetHistoryUrl()) == 0) + { + history.SetHistoryId(pHistoryItem->GetHistoryId()); + break; + } + } + + pMostVisitedSites = new(std::nothrow) ArrayList(); + pMostVisitedSites->Construct(); + String historyTitle = history.GetHistoryTitle(); + historyTitle.Replace(L"'", L"''"); + + String historyUrl = history.GetHistoryUrl(); + historyUrl.Replace(L"'", L"''"); + + PresentationModelBase::GetCurrentDateTime(date); + GetMostVisitedSites(*pMostVisitedSites); + GetUrlCount(historyUrl, urlCount); + for (i = 0; i < pMostVisitedSites->GetCount(); i++) + { + History* pHistory = static_cast< History* >(pMostVisitedSites->GetAt(i)); + if (pHistory != null && pHistory->GetHistoryUrl().CompareTo(historyUrl) == 0) + { + isAlreadyExist = true; + break; + } + if ( pHistory != null && urlCount >= pHistory->GetVisitedCount()) + { + isEligibleForMostVisitedSites = true; + } + else + { + isEligibleForMostVisitedSites = false; + } + } + + if (pMostVisitedSites->GetCount() < 9 || (isAlreadyExist == false && isEligibleForMostVisitedSites == true && history.GetThumbnail() != null)) + { + AppLog("HistoryPresentationModel::SaveHistory coming here"); + + thumbnailPath = GenerateFileName(); + AppLog("generating file path and url %ls, %ls",thumbnailPath.GetPointer(),historyUrl.GetPointer()); + Image* pImage = new(std::nothrow) Image(); + pImage->Construct(); + result r = pImage->EncodeToFile(*history.GetThumbnail(), IMG_FORMAT_JPG, thumbnailPath, true); + delete pImage; + if(IsFailed(r)) + { + AppLogDebug("PresentationModelBase::saveHistory -(%s)\n", GetErrorMessage(r)); + return r; + } + } + delete pMostVisitedSites; + pMostVisitedSites = NULL ; + + if (history.GetHistoryId() == "") + { + columnNames.Append(L"TITLE, "); + columnNames.Append(L"URL, "); + columnNames.Append(L"VISITED_TIME, "); + columnNames.Append(L"ICON_PATH, "); + columnNames.Append(L"FAVICON_ID, "); + columnNames.Append(L"THUMBNAIL_PATH"); + + query.Append(L"INSERT INTO "); + query.Append(historyTable); + query.Append("("); + query.Append(columnNames); + query.Append(") "); + query.Append("VALUES("); + query.Append("'"); + query.Append(historyTitle); + query.Append("'"); + query.Append(", "); + query.Append("'"); + query.Append(historyUrl); + query.Append("', "); + query.Append("DateTime("); + query.Append("'"); + query.Append(GetStringFromDate(date)); + query.Append("'), "); + query.Append("'"); + query.Append(history.GetHistoryIconPath()); + query.Append("'"); + query.Append(", "); + query.Append("'"); + query.Append(history.GetFaviconId()); + query.Append("'"); + query.Append(", "); + query.Append("'"); + query.Append(thumbnailPath); + query.Append("'"); + query.Append(")"); + } + else + { + query.Append(L"UPDATE "); + query.Append(historyTable); + query.Append(" SET TITLE = "); + query.Append("'"); + query.Append(historyTitle); + query.Append("'"); + query.Append(", URL = "); + query.Append("'"); + query.Append(historyUrl); + query.Append("'"); + query.Append(", VISITED_TIME = "); + query.Append("DateTime("); + query.Append("'"); + query.Append(GetStringFromDate(date)); + query.Append("')"); + query.Append(", ICON_PATH = "); + query.Append("'"); + query.Append(history.GetHistoryIconPath()); + query.Append("'"); + query.Append(", "); + query.Append("'"); + query.Append(history.GetFaviconId()); + query.Append("'"); + query.Append(", "); + query.Append("'"); + query.Append(thumbnailPath); + query.Append("'"); + query.Append(" WHERE ID = "); + query.Append(history.GetHistoryId()); + } + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::SaveHistory query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + + r = GetLastInsertedId(historyTable, rowId); + if (IsFailed(r)) + { + AppLogDebug("PresentationModelBase::saveHistory -(%s)\n", GetErrorMessage(r)); + return r; + } + if (rowId < 0) + return E_FAILURE; + + historyId.Append(rowId); + if (historyId.GetLength() < 0) + { + return E_FAILURE; + } + //Set the generated ID to History + history.SetHistoryId(historyId); + + CATCH: return r; +} +result +HistoryPresentationModel::DeleteMultipleHistory(ArrayList* pHistoryIdList) +{ + result r = E_FAILURE; + String query; + String historyTable = HISTORY_DATA_TABLE; + int resultCount = -1; + + if (pHistoryIdList == null) + { + return E_FAILURE; + } + + query.Append(L"DELETE FROM "); + query.Append(historyTable); + query.Append(" WHERE"); + for(int index = 0; index <= pHistoryIdList->GetCount()-2; index++) + { + query.Append(" ID = "); + String* hisId = static_cast(pHistoryIdList->GetAt(index)); + query.Append(*hisId); + query.Append(" OR "); + } + query.Append(" ID = "); + String* hisId = static_cast(pHistoryIdList->GetAt(pHistoryIdList->GetCount()-1)); + if(hisId == null) + { + return E_FAILURE; + } + query.Append(*hisId); + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteHistory GetLastInsertedId failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + + CATCH: return r; +} + +result +HistoryPresentationModel::DeleteHistory(const int historyId) +{ + result r = E_FAILURE; + String query; + String historyTable = HISTORY_DATA_TABLE; + int resultCount = -1; + + if (historyId < 1) + { + return E_INVALID_ARG; + } + + query.Append(L"DELETE FROM "); + query.Append(historyTable); + query.Append(" WHERE ID = "); + query.Append(historyId); + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteHistory GetLastInsertedId failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + + CATCH: return r; +} + +result +HistoryPresentationModel::DeleteHistory(String& historyUrl) +{ + result r = E_FAILURE; + String query; + String historyTable = HISTORY_DATA_TABLE; + int resultCount = -1; + + query.Append(L"DELETE FROM "); + query.Append(historyTable); + query.Append(" WHERE URL = '"); + query.Append(historyUrl); + query.Append("'"); + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::DeleteHistory GetLastInsertedId failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + + CATCH: return r; +} + +result +HistoryPresentationModel::ClearHistory(void) +{ + result r = E_FAILURE; + String query; + String historyTable = HISTORY_DATA_TABLE; + int resultCount = -1; + + query.Append(L"DELETE FROM "); + query.Append(historyTable); + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::ClearHistory GetLastInsertedId failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::CommitDb(); + + CATCH: return r; +} + +result +HistoryPresentationModel::GetHistoryCount(int& historyCount) +{ + int count = -1; + int intVal = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(historyTable); + + r = PresentationModelBase::ExecuteQuery(query, count); + AppLog("the count is %d", count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryCount query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + if (IsFailed(r) != null) + return r; + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, intVal); + if (IsFailed(r) != null) + { + AppLogDebug("Error:PresentationModelBase::GetColumn:%s", GetErrorMessage(r)); + return r; + } + } + historyCount = intVal; + + CATCH: return r; +} + +result +HistoryPresentationModel::GetHistoryCountWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime, int& historyCount) +{ + + int count = -1; + int intVal = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(historyTable); + query.Append(" WHERE VISITED_TIME >= "); + query.Append("DateTime("); + query.Append("'"); + query.Append(GetStringFromDate(startTime)); + query.Append("')"); + query.Append(" AND VISITED_TIME <= "); + query.Append("DateTime("); + query.Append("'"); + query.Append(GetStringFromDate(endTime)); + query.Append("')"); + + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryCountWithTimeRange query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + if (IsFailed(r)) + return r; + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, intVal); + if (IsFailed(r)) + { + AppLogDebug("Error:PresentationModelBase::DbGetColumn:%s", GetErrorMessage(r)); + return r; + } + } + historyCount = intVal; + + CATCH: return r; +} + +result +HistoryPresentationModel::GetHistory(const int startIndex,const int limit, ArrayList& pHistoryList) +{ + + int count = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + + query.Append(L"SELECT"); + query.Append(historyTable); + query.Append(L".*, "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L".ID "); + query.Append(L"FROM "); + query.Append(historyTable); + query.Append(L", "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L" WHERE "); + query.Append(historyTable); + query.Append(L".URL "); + query.Append(L"IN"); + query.Append(L"("); + query.Append(L"SELECT"); + query.Append(historyTable); + query.Append(L".URL "); + query.Append(L"FROM "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L" LEFT JOIN "); + query.Append(historyTable); + query.Append(L"ON"); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L".URL = "); + query.Append(historyTable); + query.Append(L".URL "); + query.Append(" ORDER BY"); + query.Append(historyTable); + query.Append(L".VISITED_TIME DESC"); + query.Append(")"); + query.Append(" GROUP BY "); + query.Append(historyTable); + query.Append(L".URL "); + query.Append(" ORDER BY"); + query.Append(L"COUNT("); + query.Append(historyTable); + query.Append(L".URL) DESC "); + + + //Append LIMIT + if (limit > 0) + { + query.Append(" LIMIT "); + query.Append(limit); + + //Append OFFESET + if (startIndex >= 0) + { + query.Append(" OFFSET "); + query.Append(startIndex); + } + } + + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistory query failed %s",GetErrorMessage(r)); + + r = CreateHistoryList(count, pHistoryList); + if (IsFailed(r)) + { + AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r)); + } + CATCH: return r; +} + +result +HistoryPresentationModel::CreateHistoryList(int historyCount, ArrayList& historyList, int maxCount) +{ + + History* pHistory = null; + int intVal = -1; + String stringVal; + DateTime dateVal; + result r = E_FAILURE; + String historyId; + String faviconId; + String bookmarkId; + int visitedCount; + DateTime visitedTime; + String iconPath; + String thumbnailPath; + bool nextRowPresent = false; + Image image; + Bitmap* pThumnailBitmap = null; + + image.Construct(); + if (historyCount < 1) + { + return E_SUCCESS; + } + + for (int Count = 0; (maxCount == -1 && Count < historyCount ) || (maxCount != -1 && Count < maxCount && Count < historyCount); Count++) + { + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + if (IsFailed(r)) + { + return E_SUCCESS; + } + if (nextRowPresent == true) + { + pHistory = new(std::nothrow) History; + if (pHistory) + { + for (int columnCount = 0; columnCount < MAX_NOTE_TABLE_COLUMN; columnCount++) + { + + switch (columnCount) + { + case HISTORY_ID: + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal > 0) + { + historyId.Clear(); + historyId.Append(intVal); + if (historyId.GetLength() > 0) + { + pHistory->SetHistoryId(historyId); + } + } + + } + break; + + case HISTORY_TITLE: + r = PresentationModelBase::GetColumn(columnCount, stringVal); + if (!IsFailed(r)) + { + pHistory->SetHistoryTitle(stringVal); + } + break; + + case HISTORY_URL: + r = PresentationModelBase::GetColumn(columnCount, stringVal); + if (!IsFailed(r)) + { + pHistory->SetHistoryUrl(stringVal); + } + break; + + case HISTORY_VISITED_TIME: + r = PresentationModelBase::GetColumn(columnCount, dateVal); + if (!IsFailed(r)) + { + visitedTime = dateVal; + pHistory->SetVisitedTime(visitedTime); + } + break; + + case HISTORY_ICON_PATH: + r = PresentationModelBase::GetColumn(columnCount, stringVal); + if (!IsFailed(r)) + { + iconPath = stringVal; + pHistory->SetIconPath(iconPath); + } + break; + + case HISTORY_FAVICONID: + + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal >= 0) + { + faviconId.Clear(); + faviconId.Append(intVal); + if (faviconId.GetLength() > 0) + { + pHistory->SetFaviconId(faviconId); + } + } + } + break; + case HISTORY_THUMBNAIL: + r = PresentationModelBase::GetColumn(columnCount, stringVal); + if (!IsFailed(r)) + { + + thumbnailPath = stringVal; + pThumnailBitmap = image.DecodeN(thumbnailPath, BITMAP_PIXEL_FORMAT_RGB565); + if (pThumnailBitmap != null) + { + pHistory->SetThumbnail(pThumnailBitmap); + pHistory->SetThumbnailPath(thumbnailPath); + } + } + break; + case HISTORY_BOOKMARK_ID: + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal > 0) + { + bookmarkId.Clear(); + bookmarkId.Append(intVal); + if (bookmarkId.GetLength() > 0) + { + pHistory->SetBookmarkId(bookmarkId); + } + } + + } + break; + case HISTORY_VISITED_COUNT: + r = PresentationModelBase::GetColumn(columnCount, intVal); + if (!IsFailed(r)) + { + if (intVal > 0) + { + pHistory->SetVisitedCount(intVal); + + } + + } + break; + + default: + break; + } + + } + r = historyList.Add(*pHistory); + + if (IsFailed(r)) + { + delete pHistory; + return r; + } + } + } + } + return E_SUCCESS; +} + +result +HistoryPresentationModel::GetSearchHistory(const int startIndex,const int limit, ArrayList& pHistoryList, String& text) +{ + text.Replace(L"'", L"''"); + + int count = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + + query.Append(L"SELECT "); + query.Append(historyTable); + query.Append(L".*, "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L".ID "); + query.Append(L"FROM "); + query.Append(historyTable); + query.Append(L" LEFT JOIN "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L" ON "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L".URL = "); + query.Append(historyTable); + query.Append(L".URL "); + query.Append(L" WHERE ("); + query.Append(historyTable); + query.Append(L".TITLE LIKE '%"); + query.Append(text); + query.Append("%')"); + query.Append(" OR "); + query.Append(L"("); + query.Append(historyTable); + query.Append(L".URL LIKE '%"); + query.Append(text); + query.Append("%')"); + query.Append(" ORDER BY VISITED_TIME DESC"); + + //Append LIMIT + if (limit > 0) + { + query.Append(" LIMIT "); + query.Append(limit); + + //Append OFFESET + if (startIndex >= 0) + { + query.Append(" OFFSET "); + query.Append(startIndex); + } + } + + r = HistoryPresentationModel::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistory query failed %s",GetErrorMessage(r)); + + r = CreateHistoryList(count, pHistoryList); + if (IsFailed(r)) + { + AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r)); + } + CATCH: return r; +} + +result +HistoryPresentationModel::GetSearchHistoryCount(int& historyCount, String& text) +{ + int count = -1; + int intVal = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + + text.Replace(L"'", L"''"); + query.Append(L"SELECT COUNT(ID) FROM "); + query.Append(historyTable); + query.Append(L" WHERE (TITLE LIKE '%"); + query.Append(text); + query.Append("%')"); + query.Append(" OR "); + query.Append(L"(URL LIKE '%"); + query.Append(text); + query.Append("%')"); + + r = HistoryPresentationModel::ExecuteQuery(query, count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetSearchHistoryCount query failed %s",GetErrorMessage(r)); + + r = HistoryPresentationModel::DbIsNextRowPresent(nextRowPresent); + if (IsFailed(r) != null) + return r; + if (nextRowPresent == true) + { + r = HistoryPresentationModel::GetColumn(0, intVal); + if (IsFailed(r) != null) + { + AppLogDebug("Error:HistoryPresentationModel::DbGetColumn:%s", GetErrorMessage(r)); + return r; + } + } + historyCount = intVal; + + CATCH: return r; +} + +result +HistoryPresentationModel::GetHistoryWithTimeRange(Tizen::Base::DateTime& startTime, Tizen::Base::DateTime& endTime,const int startIndex,const int limit, ArrayList& pHistoryList) +{ + int count = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + + query.Append(L"SELECT "); + query.Append(historyTable); + query.Append(L".*, "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L".ID "); + query.Append(L"FROM "); + query.Append(historyTable); + query.Append(L" LEFT JOIN "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L" ON "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L".URL = "); + query.Append(historyTable); + query.Append(L".URL "); + query.Append(" WHERE "); + query.Append(historyTable); + query.Append(L".VISITED_TIME >= "); + query.Append("DateTime("); + query.Append("'"); + query.Append(GetStringFromDate(startTime)); + query.Append("')"); + query.Append(" AND "); + query.Append(historyTable); + query.Append(L".VISITED_TIME <= "); + query.Append("DateTime("); + query.Append("'"); + query.Append(GetStringFromDate(endTime)); + query.Append("')"); + query.Append(" ORDER BY VISITED_TIME DESC"); + + //Append LIMIT + if (limit > 0) + { + query.Append(" LIMIT "); + query.Append(limit); + + //Append OFFESET + if (startIndex >= 0) + { + query.Append(" OFFSET "); + query.Append(startIndex); + } + } + + r = HistoryPresentationModel::ExecuteQuery(query, count); + AppLog("the count is %d",count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryWithTimeRange query failed %s",GetErrorMessage(r)); + + r = CreateHistoryList(count, pHistoryList); + if (IsFailed(r)) + { + AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r)); + } + + CATCH: return r; +} + +result +HistoryPresentationModel::GetMostVisitedSites(ArrayList& pHistoryList) +{ + + int count = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + + + //query = L"SELECT *, COUNT(URL) AS NOS FROM HistoryData GROUP BY URL ORDER BY NOS DESC"; + query = L"SELECT HistoryData.*, Bookmark.ID, COUNT(HistoryData.URL) AS NOS FROM HistoryData LEFT JOIN Bookmark ON Bookmark.URL = HistoryData.URL WHERE HistoryData.URL != '' GROUP BY HistoryData.URL ORDER BY NOS DESC"; + + r = HistoryPresentationModel::ExecuteQuery(query, count); + AppLog("the count is %d",count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryWithTimeRange query failed %s",GetErrorMessage(r)); + + r = CreateHistoryList(count, pHistoryList, 9); + if (IsFailed(r)) + { + AppLogDebug("Error:CreateNoteList:failed:%s", GetErrorMessage(r)); + } + + CATCH: return r; +} + +result +HistoryPresentationModel::GetUrlCount(const String& Url, int& historyCount) +{ + int count = -1; + int intVal = -1; + String query; + String historyTable(HISTORY_DATA_TABLE); + result r = E_FAILURE; + bool nextRowPresent = false; + + query.Append(L"SELECT COUNT(URL) FROM "); + query.Append(historyTable); + query.Append(L" WHERE URL = "); + query.Append("'"); + query.Append(Url); + query.Append("'"); + + r = PresentationModelBase::ExecuteQuery(query, count); + AppLog("the count is %d", count); + TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetHistoryCount query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::DbIsNextRowPresent(nextRowPresent); + if (IsFailed(r)) + return r; + if (nextRowPresent == true) + { + r = PresentationModelBase::GetColumn(0, intVal); + if (IsFailed(r)) + { + AppLogDebug("Error:PresentationModelBase::GetColumn:%s", GetErrorMessage(r)); + return r; + } + } + historyCount = intVal; + + CATCH: return r; +} + +String +HistoryPresentationModel::GenerateFileName(void) +{ + AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry(); + if ( pAppRegistry == NULL ) + { + return NULL ; + } + String keyCount("ThumbnailCount"); + String fileName = UiApp::GetInstance()->GetAppRootPath() + "/data/Thumbnail/thumbnails"; + result r = E_SUCCESS; + int keyValue = 1; + r = pAppRegistry->Get(keyCount, keyValue); + + if (r == E_KEY_NOT_FOUND) + { + keyValue = 1; + pAppRegistry->Add(keyCount, keyValue); + } + else + { + keyValue++; + pAppRegistry->Set(keyCount, keyValue); + } + + fileName.Append(keyValue); + fileName.Append(".jpg"); + pAppRegistry->Save(); + + return fileName; +} + +String +HistoryPresentationModel::GetStringFromDate(DateTime& date) +{ + String dateFormat = L""; + dateFormat.Append(date.GetYear()); + dateFormat.Append('-'); + if(date.GetMonth() < 10) + { + dateFormat.Append('0'); + } + dateFormat.Append(date.GetMonth()); + dateFormat.Append('-'); + if(date.GetDay() < 10) + { + dateFormat.Append('0'); + } + dateFormat.Append(date.GetDay()); + dateFormat.Append(' '); + if(date.GetHour() < 10) + { + dateFormat.Append('0'); + } + dateFormat.Append(date.GetHour()); + dateFormat.Append(':'); + if(date.GetMinute() < 10) + { + dateFormat.Append('0'); + } + dateFormat.Append(date.GetMinute()); + dateFormat.Append(':'); + if(date.GetSecond() < 10) + { + dateFormat.Append('0'); + } + dateFormat.Append(date.GetSecond()); + return dateFormat; +} diff --git a/src/IntInternetApp.cpp b/src/IntInternetApp.cpp new file mode 100644 index 0000000..87683e9 --- /dev/null +++ b/src/IntInternetApp.cpp @@ -0,0 +1,312 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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.tizenopensource.org/license +// +// 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. +// + +//!Internet +/*@file: Internet.cpp + *@brief: provides basic features necessary to define an UiApp. + */ + +#include "IntBookmarkData.h" +#include "IntBookmarkPresentationModel.h" +#include "IntCommonLib.h" +#include "IntFaviconManager.h" +#include "IntHistoryPresentationModel.h" +#include "IntInternetApp.h" +#include "IntMainFrame.h" +#include "IntMainForm.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSceneRegister.h" +#include "IntSettingPresentationModel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::System; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +InternetApp::InternetApp(void) +: __pMultiWindowManager(NULL),__pNewWindowInfo(null) +{ + +} + +InternetApp::~InternetApp(void) +{ + if (__pNewWindowInfo != NULL) + { + delete __pNewWindowInfo; + __pNewWindowInfo = NULL; + } +} + +UiApp* +InternetApp::CreateInstance(void) +{ + // Create the instance through the constructor. + return new(std::nothrow) InternetApp(); +} + +void +InternetApp::ShowPopup(String& pTitle, String& pText) +{ + MessageBox messageBox; + messageBox.Construct(pTitle, pText,MSGBOX_STYLE_OK,3000); + int modalResult = 0; + + messageBox.ShowAndWait(modalResult); + switch (modalResult) + { + case MSGBOX_RESULT_OK: + { + + } + break; + default: + break; + } +} + +bool +InternetApp::OnAppInitializing(AppRegistry& appRegistry) +{ + AppLog("ABC::Internet::OnAppInitializing entered"); + AppControlProviderManager* pAppMgr = AppControlProviderManager::GetInstance(); + if (pAppMgr != null) + { + result r = pAppMgr->SetAppControlProviderEventListener(this); + AppLogDebug("SetAppControlProviderEventListener result %s",GetErrorMessage(r)); + } + return true; +} + +bool +InternetApp::OnAppInitialized(void) +{ + result r = E_SUCCESS; + + String title1 = L"URL1"; + String title2 = L"URL2"; + String folder1 = L"Folder 1"; + String strSite1 = "Site 1"; + + BookmarkPresentationModel::GetInstance(); + HistoryPresentationModel::GetInstance(); + FaviconManager::GetInstance(); + SettingPresentationModel::GetInstance(); + +// MultipleWindowPresentationModel::GetInstance(); + + __pMultiWindowManager = MultipleWindowPresentationModel::GetInstance(); + AppLogDebug("window count %d",__pMultiWindowManager->GetAllWindowArrayList()->GetCount()); + + // Goto the first scene. + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + AppLogDebug("pSceneManager is null returning"); + return false; + } + // Create a Frame + MainFrame* pSceneManagementFrame = new(std::nothrow) MainFrame(); + pSceneManagementFrame->Construct(); + pSceneManagementFrame->SetName(L"SceneManagement"); + AddFrame(*pSceneManagementFrame); + + String homePage = SettingPresentationModel::GetInstance()->GetHomepage(); + if (homePage == CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES") || homePage == CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE")) + { + homePage = L""; + } + else if (homePage == CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE")) + { + AppLog("InternetApp::OnAppInitialized homaepage = userhomepage"); + homePage = SettingPresentationModel::GetInstance()->GetFavoriteUrl(); + AppLog("InternetApp::OnAppInitialized fav URL = %ls ",homePage.GetPointer()); + } + + if (__pNewWindowInfo == null)//if the application is launched normally + { + __pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(homePage); + } + + if (__pNewWindowInfo == null) + { + return false; + } + + ArrayList* pArgList = new(std::nothrow) ArrayList(); + pArgList->Construct(); + pArgList->Add(*__pNewWindowInfo); + /* + * The GoForward call cannot be moved into the MainFrame::OnInitializing + * because when the application is launched from the appcontol, the data(URL) + * is not available for Mainframe, and we cannot pass the url information to + * the Mainframe because logically MainFrame should not know the URL information. + */ + if (E_SUCCESS != pSceneManager->GoForward(ForwardSceneTransition(__pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList)) + { + AppLogDebug("CustomAppControl::OnAppInitializing Result = %s", GetLastResult()); + delete pArgList; + __pNewWindowInfo = null; + return false; + } + + delete pArgList; + pArgList = null; + __pNewWindowInfo = null; + + return true; +} + +bool +InternetApp::OnAppWillTerminate(void) +{ + return true; +} + + +bool +InternetApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) +{ + AppLogDebug("Internet::OnAppTerminating"); + + return true; +} + +void +InternetApp::OnForeground(void) +{ + +} + +void +InternetApp::OnBackground(void) +{ + +} + +void +InternetApp::OnLowMemory(void) +{ + +} + +void +InternetApp::OnBatteryLevelChanged(BatteryLevel batteryLevel) +{ + +} + +void +InternetApp::OnScreenOn(void) +{ + +} + +void +InternetApp::OnScreenOff(void) +{ + // TODO: + // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device + // to enter the sleep mode to save the battery. + // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a + // callback before the device enters the sleep mode. + // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one. +} +void +InternetApp::OnAppControlRequestReceived(RequestId reqId, const String &operationId, const String* pUriScheme, const String *pDataType, const IMap *pArgs) +{ + AppLogDebug("ABC::Internet::OnAppControlRequestReceivedN entered %ls",operationId.GetPointer()); + + if (operationId.CompareTo(L"http://tizen.org/appcontrol/operation/view") == 0) + { + String urlData; + if (pUriScheme) + { + urlData = *pUriScheme; + } + else + { + int argCount = pArgs->GetCount(); + AppLog("argCount == %d", argCount); + + IList *pValues = pArgs->GetValuesN(); + if(pValues == null) + { + AppLog("pValues == null"); + return; + } + + String url = L"url"; + String* pUrl = dynamic_cast(const_cast(pArgs->GetValue(url))); + if(pUrl == null) + { + delete pValues; + AppLog("pUrl == null"); + return; + } + urlData = *pUrl; + } + AppLog("URL received %ls", urlData.GetPointer()); + + if (__pNewWindowInfo == null) + { + __pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(urlData, true); + } + if (__pNewWindowInfo == null) + { + if (MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9) + { + String strTitle = L"Maximum Limit Reached"; + String strText = L"cannot open more than 9 windows"; + ShowPopup(strTitle, strText); + } + return; + } + if (__pMultiWindowManager != null && __pMultiWindowManager->GetAllWindowArrayList()->GetCount() != 0) + { + //if the application is running in background and it receives an appcontrol request it will launch a new(std::nothrow) window here, + //otherwise appcontrol request will be handled by OnAppInitialized method + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + + ArrayList* pArgList = new(std::nothrow) ArrayList(); + pArgList->Construct(); + pArgList->Add(*__pNewWindowInfo); + + if (E_SUCCESS != pSceneManager->GoForward(ForwardSceneTransition(__pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList)) + { + AppLogDebug("CustomAppControl::OnAppInitializing Result = %s", GetLastResult()); + delete pArgList; + __pNewWindowInfo = null; + return; + } + + delete pArgList; + + __pNewWindowInfo = null; + } + } + AppLogDebug("ABC::Internet::OnAppControlRequestReceivedN Exit"); + return; +} + diff --git a/src/IntInternetEntry.cpp b/src/IntInternetEntry.cpp new file mode 100644 index 0000000..f4ec79e --- /dev/null +++ b/src/IntInternetEntry.cpp @@ -0,0 +1,72 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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 contains the Tizen application entry point. + */ +#include "IntInternetApp.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +_EXPORT_ int OspMain(int argc, char* pArgv[]); +#ifdef _PROFILE +extern void start_profile(void); +extern void end_profile(void); +#else +#define start_profile() +#define end_profile() +#endif + +/** + * The entry function of Tizen application called by the operating system. + */ +int +OspMain(int argc, char* pArgv[]) +{ + result r = E_SUCCESS; + + AppLogDebug("Application started."); + ArrayList* pArgs = new(std::nothrow) ArrayList(); + pArgs->Construct(); + for (int i = 0; i < argc; i++) + pArgs->Add(*(new(std::nothrow) String(pArgv[i]))); + + start_profile(); + r = Tizen::App::UiApp::Execute(InternetApp::CreateInstance, pArgs); + if (IsFailed(r)) + { + AppLogException("Application execution failed-[%s].", GetErrorMessage(r)); + r &= 0x0000FFFF; + } + end_profile(); + + pArgs->RemoveAll(true); + delete pArgs; + pArgs = null; + AppLogDebug("Application finished."); + + return static_cast< int >(r); +} +#ifdef __cplusplus +} +#endif // __cplusplus diff --git a/src/IntMainForm.cpp b/src/IntMainForm.cpp new file mode 100644 index 0000000..fd019da --- /dev/null +++ b/src/IntMainForm.cpp @@ -0,0 +1,3572 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet MainForm class +/*@file: MainForm.cpp + *@brief: The %MainForm provides the common functionalities for the Main View of the Browser including the addressbar, + * loading,handling events etc. + */ + +#include +#include +#include +#include +#include + +#include "IntBookmarkData.h" +#include "IntBookmarkPresentationModel.h" +#include "IntCommonLib.h" +#include "IntFaviconManager.h" +#include "IntMainForm.h" +#include "IntNotificationPanel.h" +#include "IntSceneRegister.h" +#include "IntSettingPresentationModel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Base::Utility; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Locales; +using namespace Tizen::Media; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Content; +using namespace Tizen::Ui::Scenes; +using namespace Tizen::System; +using namespace Tizen::Web; +using namespace Tizen::Web::Controls; + +static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png"; +static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png"; +static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png"; +static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK_PRESS = L"I01_search_list_icon_favorite_press.png"; +static const wchar_t* IDB_CONTRLBAR_ICON_MORE = L"I01_icon_more.png"; +static const wchar_t* IDB_CONTRLBAR_ICON_MORE_PRESS = L"I01_icon_more_press.png"; +static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW = L"I01_icon_plus.png"; +static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS = L"I01_icon_plus_press.png"; +static const wchar_t* IDB_CONTROLBAR_ICON_CREATE_DISABLE = L"I01_controlbar_icon_create_disable.png"; +static const wchar_t* IDB_BUTTON_ON = L"00_button_on.png"; +static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png"; +static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png"; +static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png"; + +const int IDA_BACKBTN_CLICKED = 101; +const int IDA_BOOKMARKBTN_CLICKED = 102; +const int IDA_MOREBTN_CLICKED = 103; +const int IDA_MULTIWINDOWBTN_CLICKED = 104; +const int IDA_NEWWINDOWBTN_CLICKED = 105; +const int IDA_FORWARD_CLICKED = 106; +const int IDA_ADDTOBOOKMARK_CLICKED = 107; +const int IDA_SHARE_CLICKED = 108; +const int IDA_FINDONPAGE_CLICKED = 109; +const int IDA_PRIVATEON_CLICKED = 110; +const int IDA_SETTINGS_CLICKED = 111; +const int IDA_READER_CLOSE_CLICKED = 112; +const int IDA_SMALLFONT_BTN_CLICKED = 113; +const int IDA_LARGEFONT_BTN_CLICKED = 114; +const int IDA_BRIGHTNESS_BTN_CLICKED = 115; +const int IDA_FINDWORD_SEARCH_CLICKED = 201; +const int IDA_FINDWORD_NEXT_CLICKED = 202; +const int IDA_FINDWORD_PREV_CLICKED = 203; +const int IDA_FINDWORD_CLEAR_CLICKED = 204; +const int IDA_FINDWORD_CANCEL_CLICKED = 205; + +const int IDA_COPY_IMAGE_CLICKED = 206; +const int IDA_VIEW_IMAGE_CLICKED = 207; +const int IDA_SAVE_IMAGE_CLICKED = 208; +const int IDA_SHARE_IMAGE_CLICKED = 209; + +const int IDA_COPY_TEXT_CLICKED = 210; +const int IDA_PASTE_TEXT_CLICKED = 211; +const int IDA_FIND_TEXT__CLICKED = 212; +const int IDA_SHARE_TEXT_CLICKED = 213; +const int DEFAULT_PROGRESS_PERCENTAGE = 10; + +const int MainForm::IDA_FORMAT_BITMAP = 500; +const int MainForm::IDA_FORMAT_DELETE_BITMAP = 501; +const int MainForm::IDA_FORMAT_TITLE_STRING = 502; +const int MainForm::IDA_FORMAT_URL_STRING = 503; +const int MainForm::IDA_CONTEXT_ITEM_DELETE = 504; + +MainForm::MainForm(void) +{ + __pAddressbar = null; + // __pMostVisitedSitesPanel = null; + __pMostVisitedListView = null; + __pFooterPanel = null; + __pHitElementResult = null; + __pWindowInfo = null; + __pWebViewer = null; + __pImageMenu = null; + __pMenu = null; + __pFindWordControl = null; + __pFindWordPanel = null; + __pFindWordBgLabel = null; + __pFindWordEditField = null; + __pFindWordClear = null; + __pFindWordCountLabel = null; + __pFindWordNext = null; + __pFindWordPrev = null; + __previousZoomLevel = 1.0; + __pSaveImage = null; + __currentSearchStr = L""; + __currentSelectedStr = L""; + __maxOccurrances = 0; + __currentWordIndex = 0; + __distanceMoved = 0; + __isLoaded = false; + __inputEventToBeSupressed = false; + __touchPoint1 = Point(-1,-1); + __touchPoint2 = Point(-1,-1); + __pWebReader = null; + // __pReaderPopup = null; + __pReaderData = null; + __pPopUp = null; + __pReaderCloseBtn = null; + __pNewWindowButton = null; + __pMoreButton = null; + __pMultiWindowButton = null; + __pArticleReaderPanel = null; + __pBlankPanel = null; + __pArticleReaderLabel = null; + __webControlHeight = 0; + __prevAddressBarMode = ADDRESSBAR_MODE_INVALID; + __curAddressBarMode = ADDRESSBAR_MODE_INVALID; + __pMostVisitedSites = null; +} + +MainForm::~MainForm(void) +{ + SettingPresentationModel::GetInstance()->RemoveSettingsEventListener(*this); + + if(__pAddressbar) + { + __pAddressbar->SetAddressbarEventListener(null); + } + if (__pReaderData != null) + { + delete __pReaderData; + __pReaderData = null; + } + + if (__pPopUp != null) + { + delete __pPopUp; + __pPopUp = null; + } + String* pSelectedScene = NULL; + Object* pValue = NULL; + MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue); + pSelectedScene = (String*) pValue; + + /*if (pSelectedScene != null) + { + delete pSelectedScene; + } + MultiWindowPresentationModel::SetValue(SELECTED_SCENE_ID, null);*/ +} + +bool +MainForm::Initialize(void) +{ + Construct(L"IDL_FORM"); + return true; +} + +result +MainForm::OnInitializing(void) +{ + const int WIDTH_CONTEXT_MENU_BUTTON = 336; + const int HEIGHT_CONTEXT_MENU_BUTTON = 72; + + Panel* pFooterPanel = null; + + __pSaveImage = new Image(); + __pSaveImage->Construct(); + + // Setup back event listener + SettingPresentationModel::GetInstance()->AddSettingsEventListener(*this); + SceneManager::GetInstance()->AddSceneEventListener(IDSCN_MAIN_VIEW, *this); + AddOrientationEventListener(*this); + AppLogDebug(" MainForm::OnInitializing ended"); + if (__pMostVisitedSites == null) + { + __pMostVisitedSites = new(std::nothrow) ArrayList(); + __pMostVisitedSites->Construct(); + } + HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites); + + __pItemContext= new(std::nothrow) ListContextItem(); + __pItemContext->Construct(); + Bitmap* pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", WIDTH_CONTEXT_MENU_BUTTON,HEIGHT_CONTEXT_MENU_BUTTON); + Bitmap* pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", WIDTH_CONTEXT_MENU_BUTTON, HEIGHT_CONTEXT_MENU_BUTTON); + + if (pBitmapNormal != null && pBitmapPressed != null) + { + __pItemContext->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed); + } + + if (pBitmapNormal != null) + { + delete pBitmapNormal; + } + + if (pBitmapPressed != null) + { + delete pBitmapPressed; + } + + return E_SUCCESS; +} + +result +MainForm::InitAddressbar(void) +{ + AppLogDebug("MainForm::InitAddressbar entered"); + + result r = E_SUCCESS; + + if (__pAddressbar != null) + { + return E_SUCCESS; + } + __pAddressbar = new(std::nothrow) Addressbar(); + AppLog("MainForm::InitAddressbar GetClientAreaBounds().width %d",GetClientAreaBounds().width); + r = __pAddressbar->Initialize(Tizen::Graphics::Rectangle(0, 0, GetClientAreaBounds().width, 82)); + if (r != E_SUCCESS) + { + AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r)); + return r; + } + __pAddressbar->SetAddressbarEventListener(this); + AddControl(*__pAddressbar); + __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight())); + SetControlAlwaysOnTop(*__pAddressbar, true); + __adressPanelPosition = __pAddressbar->GetPosition(); + + AppLogDebug("MainForm::InitAddressbar exit"); + + return E_SUCCESS; +} + +result +MainForm::CreateReaderPanel(void) +{ + AppLogDebug("CreateReaderPanel() width %d",GetClientAreaBounds().width); + result r = E_FAILURE; + WebSetting settings; + Button *pSmallFontBtn = null; + Button *pLargeFontBtn = null; + + __pBlankPanel = new (std::nothrow) Panel(); + __pBlankPanel->Construct(L"IDL_BLANK_PANEL"); + + __pArticleReaderPanel = new (std::nothrow) Panel(); + __pArticleReaderPanel->Construct(L"IDL_ARTICLE_READER"); + + __pReaderCloseBtn = static_cast(__pArticleReaderPanel->GetControl(L"IDC_CLOSE_READER",true)); + if (__pReaderCloseBtn) + { + AppLogDebug("CreateReaderPanel() 6"); + __pReaderCloseBtn->AddActionEventListener(*this); + __pReaderCloseBtn->SetActionId(IDA_READER_CLOSE_CLICKED); + } + + __pWebReader = new (std::nothrow) Web(); + __pWebReader->Construct(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2)); + + settings.SetInputStyle(INPUT_STYLE_OVERLAY); + settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize()); + + r = __pWebReader->SetSetting(settings); + if (IsFailed(r)) + AppLogDebug("Web setting add failed with %s", GetErrorMessage(r)); + + + __pArticleReaderLabel = new Label(); + __pArticleReaderLabel->Construct(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()),L""); + + __pBlankPanel->AddControl(*__pArticleReaderLabel); + __pBlankPanel->AddControl(*__pArticleReaderPanel); + AddControl(*__pBlankPanel); + + __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height); + __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight()); + __pArticleReaderLabel->SetBounds(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()); + + __pArticleReaderPanel->AddControl(*__pWebReader); + __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2)); + Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()); + Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()); + + if (pBitmap != null && pSrcBitmap != null) + { + pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight())); + } + __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap); + + pSmallFontBtn = static_cast(__pArticleReaderPanel->GetControl(L"IDC_SMALL_FONT",true)); + if (pSmallFontBtn) + { + pSmallFontBtn->AddActionEventListener(*this); + pSmallFontBtn->SetActionId(IDA_SMALLFONT_BTN_CLICKED); + } + + pLargeFontBtn = static_cast(__pArticleReaderPanel->GetControl(L"IDC_LARGE_FONT",true)); + if (pLargeFontBtn) + { + pLargeFontBtn->AddActionEventListener(*this); + pLargeFontBtn->SetActionId(IDA_LARGEFONT_BTN_CLICKED); + } + + + if (pBitmap != null) + { + delete pBitmap; + pBitmap = null; + } + if (pSrcBitmap != null) + { + delete pSrcBitmap; + pSrcBitmap = null; + } + + SetControlAlwaysOnTop(*__pBlankPanel, true); + //__pBlankPanel->SetControlAlwaysAtBottom(*__pArticleReaderPanel, true); + Invalidate(true); + + return E_SUCCESS; +} + +result +MainForm::InitWebControl() +{ + AppLogDebug("MainForm::InitWebControl enter"); + result r = E_SUCCESS; + AppLogDebug("InitWebControl"); + + if (__pAddressbar == null || __pFooterPanel == null) + return E_FAILURE; + + const int Y_WEBCONTROL_POSITION = __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12; + __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight(); + if (__pMostVisitedListView) + { + __pMostVisitedListView->SetShowState(false); + } + if (__pWebViewer != null) + { + AppLogDebug("Already initialized"); + return E_SUCCESS; + } + __pWebViewer = new(std::nothrow) Web(); + if(__pWebViewer == NULL) + { + AppLogDebug("Initialization failed"); + return E_FAILURE; + } + r = __pWebViewer->Construct(Rectangle(0, Y_WEBCONTROL_POSITION, GetClientAreaBounds().width,__webControlHeight)); + + if (IsFailed(r)) + { + AppLogDebug("Web construct failed with %s", GetErrorMessage(r)); + return r; + } + else + { + r = AddControl(*__pWebViewer); + + if (IsFailed(r)) + { + AppLogDebug("Web addcontrol failed with %s", GetErrorMessage(r)); + return r; + } + __webControlPosition = __pWebViewer->GetPosition(); + r = __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings()); + if (IsFailed(r)) + { + AppLogDebug("Web setting add failed with %s", GetErrorMessage(r)); + return r; + } + + __pWebViewer->SetLoadingListener(this); + __pWebViewer->SetWebUiEventListener(this); + __pWebViewer->SetWebKeypadEventListener(this); + __pWebViewer->SetFocus(); + __pWebViewer->AddTouchEventListener(*this); + + __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled()); + __pWebViewer->SetTextSearchListener(this); + } + + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight)); + AppLogDebug("MainForm :before return"); + Invalidate(true); + AppLogDebug("MainForm::InitWebControl Exit"); + + return r; +} + +void +MainForm::SetJavascriptEnabled() +{ + WebSetting settings = __pWebViewer->GetSetting(); + settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled()); + __pWebViewer->SetSetting(settings); +} + +void +MainForm::SetImageLoadEnabled() +{ + WebSetting settings = __pWebViewer->GetSetting(); + settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled()); + __pWebViewer->SetSetting(settings); +} + +result +MainForm::InitFooter(void) +{ + AppLogDebug("MainForm::InitFooter entered"); + Button* pBackButton = null; + Button* pBookmarkButton = null; + Button* pMultiWindowButton = null; + Bitmap *pIconBitmap = null; + Bitmap *pBGBitmap = null; + Label *pBGLabel = null; + + if (__pFooterPanel == null) + { + __pFooterPanel = static_cast< Panel* >(GetControl(L"IDC_FOOTER_PANEL", true)); + } + + if (__pFooterPanel == null) + { + return E_FAILURE; + } + + SetControlAlwaysOnTop(*__pFooterPanel, true); + + __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true)); + + if ( __pMultiWindowButton == NULL ) + { + return E_FAILURE; + } + + pBackButton = static_cast< Button* >(GetControl(L"IDC_PAGEBACK_BUTTON", true)); + + if ( pBackButton == NULL ) + { + return E_FAILURE; + } + + pBookmarkButton = static_cast< Button* >(GetControl(L"IDC_BOOKMARK_BUTTON", true)); + + if ( pBookmarkButton == NULL ) + { + return E_FAILURE; + } + + __pMoreButton = static_cast(GetControl(L"IDC_MORE_BUTTON",true)); + + if ( __pMoreButton == NULL ) + { + return E_FAILURE; + } + + __pNewWindowButton = static_cast< Button* >(GetControl(L"IDC_NEW_WINDOW",true)); + + if ( __pNewWindowButton == NULL ) + { + return E_FAILURE; + } + + if (__pMultiWindowButton != null) + { + Bitmap* pBitmap = null; + Bitmap* pPressedBitmap = null; + String imagePath = "I01_toolbar_icon_windows_manager_0"; + String pressedImagePath = "I01_toolbar_icon_windows_manager_0"; + int totalCount = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount(); + imagePath.Append(totalCount); + imagePath.Append(".png"); + + pressedImagePath.Append(totalCount); + pressedImagePath.Append("_press.png"); + + pBitmap = AppResource::GetInstance()->GetBitmapN(imagePath); + pPressedBitmap = AppResource::GetInstance()->GetBitmapN(pressedImagePath); + if ( pBitmap == null ) + { + return E_FAILURE; + } + + Point startPoint = Point((__pMultiWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pMultiWindowButton->GetHeight() - pBitmap->GetHeight())/2); + if (pBitmap != null) + { + __pMultiWindowButton->SetNormalBitmap(startPoint, *pBitmap); + __pMultiWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap); + + delete pBitmap; + } + + __pMultiWindowButton->AddActionEventListener(*this); + __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED); + } + + + if (pBackButton) + { + Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BTN_BACK); + Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BTN_BACK_PRESS); + if (pBitmap != null) + { + // pBitmap->Scale(Dimension(56,56)); + + Point startPoint((pBackButton->GetWidth() - pBitmap->GetWidth())/2,(pBackButton->GetHeight() - pBitmap->GetHeight())/2 ); + AppLog("startPoint %d,%d pBitmap width height %d %d",startPoint.x,startPoint.y,pBitmap->GetWidth(),pBitmap->GetHeight()); + pBackButton->SetNormalBitmap(startPoint, *pBitmap); + pBackButton->SetPressedBitmap(startPoint, *pPressedBitmap); + delete pBitmap; + } + pBackButton->AddActionEventListener(*this); + pBackButton->SetActionId(IDA_BACKBTN_CLICKED); + } + + if (pBookmarkButton) + { + Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_BOOKMARK); + Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_BOOKMARK_PRESS); + if (pBitmap != null) + { + Point startPoint((pBookmarkButton->GetWidth() - pBitmap->GetWidth())/2,(pBookmarkButton->GetHeight() - pBitmap->GetHeight())/2 ); + pBookmarkButton->SetNormalBitmap(startPoint, *pBitmap); + pBookmarkButton->SetPressedBitmap(startPoint, *pPressedBitmap); + delete pBitmap; + } + pBookmarkButton->AddActionEventListener(*this); + pBookmarkButton->SetActionId(IDA_BOOKMARKBTN_CLICKED); + } + + if (__pMoreButton) + { + Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE); + Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE_PRESS); + if (pBitmap != null) + { + Point startPoint((__pMoreButton->GetWidth() - pBitmap->GetWidth())/2,(__pMoreButton->GetHeight() - pBitmap->GetHeight())/2 ); + __pMoreButton->SetNormalBitmap(startPoint, *pBitmap); + __pMoreButton->SetPressedBitmap(startPoint, *pPressedBitmap); + + delete pBitmap; + } + __pMoreButton->AddActionEventListener(*this); + __pMoreButton->SetActionId(IDA_MOREBTN_CLICKED); + + } + + + if (__pNewWindowButton) + { + Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_NEW_WINDOW); + Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS); + if (pBitmap != null) + { + Point startPoint((__pNewWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pNewWindowButton->GetHeight() - pBitmap->GetHeight())/2 ); + __pNewWindowButton->SetNormalBitmap(startPoint, *pBitmap); + __pNewWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap); + delete pBitmap; + } + __pNewWindowButton->AddActionEventListener(*this); + __pNewWindowButton->SetActionId(IDA_NEWWINDOWBTN_CLICKED); + __pNewWindowButton->SetEnabled(true); + // __pNewWindowButton->Invalidate(true); + } + + AppLog("checkingwindow count %d",MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount()); + + if (__pNewWindowButton != null && MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9) + { + Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTROLBAR_ICON_CREATE_DISABLE); + if (pBitmap != null) + { + Point startPoint = Point((__pNewWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pNewWindowButton->GetHeight() - pBitmap->GetHeight())/2 ); + __pNewWindowButton->SetDisabledBitmap(startPoint,*pBitmap); + delete pBitmap; + } + __pNewWindowButton->SetEnabled(false); + } + + // __pFooterPanel->Invalidate(true); + AppLogDebug("MainForm::InitFooter exit"); + return E_SUCCESS; +} + + +result +MainForm::InitContextMenu(Point& p) +{ + result r = E_SUCCESS; + bool isPrivateBrowsing = false; + Bitmap* pBitmap = null; + + if (__pMenu != null) + { + __pMenu->SetAnchorPosition(p); + __pMenu->Invalidate(true); + return r; + } + + __pMenu = new(std::nothrow) ContextMenu(); + r = __pMenu->Construct(p, CONTEXT_MENU_STYLE_LIST); + TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r)); + + isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn(); + + + if (isPrivateBrowsing == true) + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON); + } + else + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF); + } + + if ( pBitmap != NULL) + { + __pMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY"), IDA_PRIVATEON_CLICKED,*pBitmap); + delete pBitmap; + } + r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED); + r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED); + __pMenu->SetMaxVisibleItemsCount(3); + __pMenu->SetShowState(false); + __pMenu->AddActionEventListener(*this); + SetControlAlwaysOnTop(*__pMenu, true); + + CATCH: + return r; +} + +result MainForm::InitImageContextMenu(Tizen::Graphics::Point p) +{ + result r = E_SUCCESS; + + AppLog("MainForm::InitImageContextMenu clicked on image"); + if (__pImageMenu != null) + { + delete __pImageMenu; + __pImageMenu = null; + } + + p.y = p.y + __pAddressbar->GetHeight() + 12; + __pImageMenu = new (std::nothrow) ContextMenu(); + r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST); + TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r)); + + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE"),IDA_COPY_IMAGE_CLICKED); + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_VIEW_IMAGE"),IDA_VIEW_IMAGE_CLICKED); + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_SAVE_IMAGE_CLICKED); + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_DLNA_BODY_SHARE_IMAGE_ABB"),IDA_SHARE_IMAGE_CLICKED); + __pImageMenu->SetMaxVisibleItemsCount(4); + __pImageMenu->AddActionEventListener(*this); + SetControlAlwaysOnTop(*__pImageMenu, true); + + CATCH: return r; +} + +result MainForm::InitSelectTextContextMenu(Tizen::Graphics::Point p, bool pasteOption, bool onlyPasteOption = false) +{ + result r = E_SUCCESS; + + AppLog("MainForm::InitSelectTextContextMenu clicked on text"); + if (__pImageMenu != null) + { + delete __pImageMenu; + __pImageMenu = null; + } + p.y = p.y + __pAddressbar->GetHeight() + 12; + __pImageMenu = new (std::nothrow) ContextMenu(); + r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID); + TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r)); + + if(onlyPasteOption == false) + { + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED); + } + if (pasteOption || onlyPasteOption) + { + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED); + } + if(onlyPasteOption == false) + { + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED); + r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED); + } + + __pImageMenu->SetMaxVisibleItemsCount(3); + __pImageMenu->AddActionEventListener(*this); + SetControlAlwaysOnTop(*__pImageMenu, true); + + CATCH: return r; + +} + +result +MainForm::InitFindWordPanel(void) +{ + result r = E_SUCCESS; + Bitmap *pIconBitmap = null; + + if (__pFindWordPanel != null) + { + AppLogDebug("Findword panel already initialized"); + if (__pFindWordBgLabel != null) + { + Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight()); + if (pBitmap != null) + { + AppLogDebug("InitFindWordPanel: Coming here"); + __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap); + delete pBitmap; + } + } + return r; + } + + __pFindWordPanel = static_cast(GetControl(L"IDC_FIND_ON_PAGE_PANEL")); + if (__pFindWordPanel == null) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + + __pFindWordControl = new (std::nothrow) Panel(); + r = __pFindWordControl->Construct(L"IDL_FIND_ON_PAGE"); + if (IsFailed(r)) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + __pFindWordPanel->AddControl(*__pFindWordControl); + __pFindWordControl->SetBounds(0,0, __pFindWordPanel->GetWidth(), __pFindWordPanel->GetHeight()); + SetControlAlwaysOnTop(*__pFindWordPanel,true); + __pFindWordPanel->SetShowState(false); + __pFindWordPanel->Invalidate(false); + + __pFindWordBgLabel = static_cast(__pFindWordControl->GetControl(L"IDC_LABEL1", true)); + if (__pFindWordBgLabel != null) + { + Panel* pPanel1 = static_cast(__pFindWordControl->GetControl(L"IDC_PANEL1", true)); + Rectangle pRect = pPanel1->GetBounds(); + pRect.x = pRect.y = 0; + __pFindWordBgLabel->SetBounds(pRect); + Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight()); + if (pBitmap != null) + { + AppLogDebug("InitFindWordPanel: Coming here"); + __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap); + delete pBitmap; + } + else + { + AppLogDebug("InitFindWordPanel: shouldn't Come here"); + } + } + + Button* pfindWordCancel = null; + pfindWordCancel = static_cast(__pFindWordControl->GetControl(L"IDC_FIND_CANCEL", true)); + if (pfindWordCancel == null) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + pfindWordCancel->SetActionId(IDA_FINDWORD_CANCEL_CLICKED); + pfindWordCancel->AddActionEventListener(*this); + + __pFindWordClear = static_cast(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR", true)); + if (__pFindWordClear == null) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + + __pFindWordClear->SetActionId(IDA_FINDWORD_CLEAR_CLICKED); + __pFindWordClear->AddActionEventListener(*this); + + __pFindWordNext = static_cast(__pFindWordControl->GetControl(L"IDC_FIND_NEXT", true)); + if (__pFindWordNext == null) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + + __pFindWordNext->SetActionId(IDA_FINDWORD_NEXT_CLICKED); + __pFindWordNext->AddActionEventListener(*this); + + __pFindWordPrev = static_cast(__pFindWordControl->GetControl(L"IDC_FIND_PREV", true)); + if (__pFindWordPrev == null) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + + __pFindWordPrev->SetActionId(IDA_FINDWORD_PREV_CLICKED); + __pFindWordPrev->AddActionEventListener(*this); + + __pFindWordNext->SetEnabled(false); + __pFindWordPrev->SetEnabled(false); + + __pFindWordCountLabel = static_cast(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL", true)); + if (__pFindWordCountLabel == null) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + + __pFindWordEditField = static_cast(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD", true)); + if (__pFindWordEditField == null) + { + AppLogException("There is some problem in the xml file. Please check."); + return E_FAILURE; + } + __pFindWordEditField->AddTextEventListener(*this); + __pFindWordEditField->AddKeypadEventListener(*this); + __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false); + + return r; +} + +ListItemBase* +MainForm::CreateItem (int index, int itemWidth) +{ + Rectangle listImageRect; + Rectangle pagetTitleRect; + Rectangle pageURLRect; + Rectangle deleteImageRect; + String pageTitle(L""); + String pageURL(L""); + result r = E_SUCCESS; + Bitmap* pListIconImage = null; + + + History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index)); + if(pHistory == null) + { + return null; + } + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + if ( pAppResource == NULL ) + { + return null; + } + ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; + + CustomItem* pItem = new(std::nothrow) CustomItem(); + pageTitle = pHistory->GetHistoryTitle(); + pageURL = pHistory->GetHistoryUrl(); + + if (pageURL.GetLength() == 0) + { + String nourl; + pAppResource->GetString(L"IDS_BR_BODY_ABOUT_C_BLANK", nourl); + pageURL = L"<"+ nourl +">"; + + } + + Rectangle screenBounds = GetBounds(); + if (pItem != null) + { + r = pItem->Construct(Dimension(itemWidth, 128), style); + } + if (IsFailed(r)) + { + delete pItem; + return NULL; + } + + if (pHistory->GetFaviconId().GetLength() > 0) + { + String bitmapId = pHistory->GetFaviconId(); + Bitmap* pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId); + + if ( pBitmap != NULL) + { + pListIconImage = new Bitmap(); + pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight())); + delete pBitmap; + } + } + + if(pListIconImage == null) + { + pListIconImage = pAppResource->GetBitmapN(L"I01_icon_default_favicon.png"); + } + + if ( pListIconImage != NULL) + { + listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28,72, 72); + pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 60); + pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 48); + + + if (pItem != null && pListIconImage != NULL) + { + pItem->AddElement(listImageRect, IDA_FORMAT_BITMAP, *pListIconImage, null, null); + } + } + + if (pageTitle.CompareTo(L"") != 0) + { + if (pItem != null) + { + pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, pageTitle, 44, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, true); + } + } + + if (pageURL.CompareTo(L"") != 0) + { + if (pItem != null) + { + pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true); + } + } + + + if ( __pItemContext!= NULL) + { + if (pItem != null) + { + pItem->SetContextItem(__pItemContext); + } + } + if( pListIconImage != NULL) + { + delete pListIconImage; + pListIconImage = null; + } + + return pItem; +} + +bool +MainForm::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth) +{ + delete pItem; + return true; +} + +int +MainForm::GetItemCount (void) +{ + if(__pMostVisitedSites != null) + { + __pMostVisitedSites->RemoveAll(true); + } + HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites); + if(__pMostVisitedSites != null) + { + return __pMostVisitedSites->GetCount(); + } + else + return 0; +} + +void +MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state) +{ + History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index)); + String url = pHistory->GetHistoryUrl(); + HistoryPresentationModel::GetInstance()->DeleteHistory(url); + __pMostVisitedListView->UpdateList(); +} + +void +MainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) +{ + History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index)); + String url = pHistory->GetHistoryUrl(); + if (url != null) + { + LoadUrl(url); + } +} + +void +MainForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction) +{ + +} + +result +MainForm::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +void +MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + result r = E_SUCCESS; + + AppLogDebug("Clicked : %d", actionId); + switch (actionId) + { + case IDA_BACKBTN_CLICKED: + { + if (__pWebViewer && __pWebViewer->CanGoBack()) + { + __pWebViewer->GoBack(); + } + else + { + UiApp* pApp = null; + pApp = UiApp::GetInstance(); + if (pApp != null) + { + r = pApp->Terminate(); + if (IsFailed(r)) + { + AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r)); + return; + } + } + } + } + break; + + case IDA_FORWARD_CLICKED: + if (__pWebViewer == null) + return; + + if (__pWebViewer->CanGoForward()) + { + __pWebViewer->GoForward(); + } + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + break; + + case IDA_FINDONPAGE_CLICKED: + { + AppLogDebug("MainForm::OnActionPerformed findword clicked"); + __currentSearchStr.Clear(); + + InitFindWordPanel(); + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + + __adressPanelPosition.y = 0; + + if (__pAddressbar != null && __pWebViewer != NULL) + { + __webControlPosition.y = __pAddressbar->GetHeight() - 12; + __pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight()); + __pAddressbar->Invalidate(true); + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight)); + __pWebViewer->Invalidate(true); + } + + ShowFindWordPanel(true); + } + break; + case IDA_PRIVATEON_CLICKED: + { + result r = E_SUCCESS; + int itemIndex = 0; + bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn(); + Bitmap* pBitmap = null; + if (isPrivateBrowsing == true) + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF); + if (IsFailed(r)) + { + AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r)); + return ; + } + + if (__pWebViewer != NULL) + { + __pWebViewer->SetPrivateBrowsingEnabled(false); + } + + SettingPresentationModel::GetInstance()->SetPrivateOn(false); + + if (__pAddressbar != null) + { + __pAddressbar->UpdateFaviconBitmap(false); + } + + } + else + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON); + if (IsFailed(r)) + { + AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r)); + return ; + } + + if (__pWebViewer != NULL) + { + __pWebViewer->SetPrivateBrowsingEnabled(true); + } + + SettingPresentationModel::GetInstance()->SetPrivateOn(true); + + if (__pAddressbar != null) + { + __pAddressbar->UpdateFaviconBitmap(true); + } + } + + + itemIndex = __pMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED); + r = __pMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY"),IDA_PRIVATEON_CLICKED,*pBitmap); + AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex); + __pMenu->Invalidate(true); + + if ( pBitmap != NULL ) + { + delete pBitmap; + } + + } + break; + case IDA_SETTINGS_CLICKED: + { + + ArrayList* pArgList = new(std::nothrow) ArrayList(); + if (pArgList) + { + pArgList->Construct(); + pArgList->Add(*__pWindowInfo); + SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SETTINGS), pArgList); + } + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + if (pArgList != null) + { + delete pArgList; + pArgList = null; + } + + } + break; + + case IDA_ADDTOBOOKMARK_CLICKED: + { + + if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL) + { + int bookmarkCount=0; + bool exist = false; + String url=L""; + url=__pWindowInfo->pageUrl; + result r = E_SUCCESS; + Bitmap* pBitmap = null; + r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist); + + if (IsFailed(r)) + { + return; + } + if ( exist == true) + { + String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_REMOVED"); + BookmarkPresentationModel::GetInstance()->DeleteBookmark(url); + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP); + + NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this); + if (pNotification != null) + { + pNotification->SetText(message); + pNotification->SetPositionDiff(__pFooterPanel->GetHeight()); + pNotification->ShowNotification(); + } + } + else + { + String title=__pWindowInfo->pageTitle; + String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_ADDED"); + BookmarkData* pBookmark=new (std::nothrow) BookmarkData(); + + pBookmark->SetBookmarkTitle(title); + pBookmark->SetUrl(url); + String id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl); + pBookmark->SetFaviconId(id); + r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark); + delete pBookmark; + + NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this); + if(pNotification != null) + { + pNotification->SetText(message); + pNotification->SetPositionDiff(__pFooterPanel->GetHeight()); + pNotification->ShowNotification(); + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP); + } + } + if (pBitmap != null) + { + r = __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); + delete pBitmap; + } + } + __pMenu->Invalidate(true); + + } + break; + case IDA_SHARE_CLICKED: + { + if(__pPopUp != null) + { + delete __pPopUp; + __pPopUp = null; + } + __pPopUp = new(std::nothrow) SharePopup(); + __pPopUp->Initialize(); + if (__pWindowInfo != null) + { + ShareInfo* pShareInfo = new(std::nothrow) ShareInfo(); + pShareInfo->SetPageTitle(__pWindowInfo->pageTitle); + pShareInfo->SetPageUrl(__pWindowInfo->pageUrl); + pShareInfo->SetImageAttached(false); + __pPopUp->RemoveAllShareInfo(); + __pPopUp->AddShareInfo(pShareInfo); + } + __pPopUp->SetShowState(true); + __pPopUp->Show(); + } + break; + case IDA_BOOKMARKBTN_CLICKED: + + AppLogDebug("ONACTION_PERFORMED:IDA_BOOKMARKBTN_CLICKED"); + SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_NONE)); + break; + + case IDA_MOREBTN_CLICKED: + { + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 1"); + Point p = Point(__pMoreButton->GetX() + __pMoreButton->GetWidth() / 2, GetClientAreaBounds().y + GetClientAreaBounds().height - __pMoreButton->GetHeight()); + AppLog("Anchot pos: %d %d", p.x, p.y); + InitContextMenu(p); + if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL) + { + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 2"); + int bookmarkCount=0; + bool exist = false; + String url=L""; + url=__pWindowInfo->pageUrl; + result r = E_SUCCESS; + Bitmap* pBitmap = null; + + r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist); + if (IsFailed(r)) + { + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed"); + return; + } + if ( exist == true) + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP); + } + else + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP); + } + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3"); + + if (__pMenu->GetItemCount() == 6) + { + r = __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); + } + else + { + r = __pMenu->InsertItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); + } + + if (IsFailed(r)) + { + AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r)); + delete pBitmap; + return ; + } + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4"); + if (__pMenu->GetItemCount() != 6) + { + __pMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED); + __pMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED); + __pMenu->SetMaxVisibleItemsCount(6); + } + if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE) + { + AppLog(" Orientation landscape"); + __pMenu->SetMaxVisibleItemsCount(5); + } + else + { + AppLog(" Orientation potrait"); + __pMenu->SetMaxVisibleItemsCount(6); + } + + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5"); + delete pBitmap; + } + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end"); + __pMenu->SetShowState(true); + __pMenu->Invalidate(true); + __pMenu->Show(); + } + + break; + + case IDA_MULTIWINDOWBTN_CLICKED: + { + result r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MULTIPLE_WINDOW, SCENE_TRANSITION_ANIMATION_TYPE_NONE)); + AppLog("IDA_MULTIWINDOWBTN_CLICKED result %s",GetErrorMessage(r)); + } + break; + + case IDA_NEWWINDOWBTN_CLICKED: + { + WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(); + + if (pNewWindowInfo == null) + { + return; + } + result r = E_SUCCESS; + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == NULL) + { + return; + } + ArrayList* pArgList = new(std::nothrow) ArrayList(); + if (pArgList == NULL) + { + return; + } + r = pArgList->Construct(); + if (r == E_SUCCESS) + { + pArgList->Add(*pNewWindowInfo); + r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList); + } + delete pArgList; + pArgList = null; + if (IsFailed(r)) + { + AppLogDebug("MainForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r)); + return; + } + } + break; + case IDA_SMALLFONT_BTN_CLICKED: + { + WebSetting setting = __pWebReader->GetSetting(); + setting.SetFontSize(15); + __pWebReader->SetSetting(setting); + } + break; + case IDA_LARGEFONT_BTN_CLICKED: + { + WebSetting setting = __pWebReader->GetSetting(); + setting.SetFontSize(25); + __pWebReader->SetSetting(setting); + } + break; + case IDA_READER_CLOSE_CLICKED: + { + if (__pArticleReaderPanel != null && __pBlankPanel != null) + { + //__pArticleReaderPanel->SetShowState(false); + //__pArticleReaderPanel->Show(); + RemoveControl(*__pBlankPanel); + //RemoveControl(*__pArticleReaderPanel); + __pArticleReaderPanel = null; + __pBlankPanel = null; + __pArticleReaderLabel = null; + } + if (__pAddressbar) + __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE); + } + break; + case IDA_FINDWORD_CANCEL_CLICKED: + { + __currentSearchStr = L""; + __currentWordIndex = 0; + __maxOccurrances = 0; + __pFindWordCountLabel->SetText(L" "); + __pFindWordEditField->SetText(L""); + __pFindWordNext->SetEnabled(false); + __pFindWordPrev->SetEnabled(false); + __pFindWordCountLabel->SetShowState(false); + __pWebViewer->SearchText(L"aaaabbbbcccc",true); + ShowFindWordPanel(false); + } + break; + case IDA_FINDWORD_SEARCH_CLICKED: + { + __currentSearchStr = __pFindWordEditField->GetText(); + if (__currentSearchStr.GetLength() > 0) + { + StartWordSearch(); + } + else + { + AppLogDebug("Enter something"); + } + } + break; + case IDA_FINDWORD_CLEAR_CLICKED: + { + __pFindWordCountLabel->SetText(L""); + __pFindWordCountLabel->SetShowState(false); + __pFindWordEditField->SetText(L""); + __pFindWordNext->SetEnabled(false); + __pFindWordPrev->SetEnabled(false); + __pFindWordPanel->Invalidate(true); + } + break; + case IDA_FINDWORD_NEXT_CLICKED: + { + FindNextWord(true); + } + break; + case IDA_FINDWORD_PREV_CLICKED: + { + FindNextWord(false); + } + break; + case IDA_BRIGHTNESS_BTN_CLICKED: + { + AppLogDebug("IDA_BRIGHTNESS_BTN_CLICKED"); + SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BRIGHTNESS, SCENE_TRANSITION_ANIMATION_TYPE_NONE)); + } + break; + case IDA_COPY_IMAGE_CLICKED: + { + AppLogDebug("IDA_COPY_IMAGE_CLICKED"); + AppLogDebug("IDA_COPY_IMAGE_CLICKED"); + ClipboardItem item; + const Bitmap* pBitmap = null; + if (__pHitElementResult != null) + { + pBitmap = __pHitElementResult->GetImage(); + } + + String resourcePath = App::GetInstance()->GetAppResourcePath(); + item.Construct(CLIPBOARD_DATA_TYPE_IMAGE , *pBitmap); + + // copying the item to clipboard + Clipboard* pClipboard = Clipboard::GetInstance(); + if (pClipboard != null) + { + pClipboard->CopyItem(item); + } + } + break; + case IDA_VIEW_IMAGE_CLICKED: + { + AppLogDebug("IDA_VIEW_IMAGE_CLICKED"); + WindowInfo* pNewWindowInfo = null; + if (__pHitElementResult != null) + { + String srcUrl = __pHitElementResult->GetAttributeValue(L"src"); + AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer()); + LoadUrl(srcUrl); + + } + } + break; + case IDA_SAVE_IMAGE_CLICKED: + { + AppLogDebug("IDA_SAVE_IMAGE_CLICKED"); + const Bitmap* pSaveBitmap = null; + String imageName = GetImagePath(); + AppLog("Content manager image name %ls",imageName.GetPointer()); + String imagePath; + imagePath.Clear(); + imagePath.Append(imageName); + imagePath.Format(100, L"%ls/Downloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer()); + AppLog("Content manager image path %ls",imagePath.GetPointer()); + if (__pHitElementResult != null) + { + pSaveBitmap = __pHitElementResult->GetImage(); + } + ByteBuffer* pBuffer = __pSaveImage->EncodeToBufferN(*pSaveBitmap, IMG_FORMAT_JPG); + + if(pBuffer) + { + UpdateImageContent(pBuffer, imageName); + delete pBuffer; + NotificationPanel *pNotification = new NotificationPanel(*this); + String msg; + AppResource::GetInstance()->GetString("IDS_COM_SK_SAVE", msg); + msg.Append(imagePath); + if (pNotification != null) + { + pNotification->SetText(msg); + pNotification->SetPositionDiff(__pFooterPanel->GetHeight()); + pNotification->ShowNotification(); + } + } + else + { + int __modalMsgBoxResult; + MessageBox* pMsgBox = new MessageBox(); + pMsgBox->Construct(CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),MSGBOX_STYLE_OK,3000); + pMsgBox->ShowAndWait(__modalMsgBoxResult); + delete pMsgBox; + pMsgBox = null; + __modalMsgBoxResult = 0; + } + } + break; + case IDA_SHARE_IMAGE_CLICKED: + { + AppLogDebug("IDA_SHARE_IMAGE_CLICKED"); + if (__pPopUp != null) + { + delete __pPopUp; + __pPopUp = null; + } + __pPopUp = new(std::nothrow) SharePopup(); + __pPopUp->Initialize(); + if (__pHitElementResult != null) + { + const Bitmap* pSaveBitmap = null; + String imageName = GetImagePath(); + AppLog("Content manager image name %ls",imageName.GetPointer()); + String imagePath; + imagePath.Clear(); + imagePath.Append(imageName); + imagePath.Format(100, L"%lsDownloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer()); + AppLog("Content manager image path %ls",imagePath.GetPointer()); + if (__pHitElementResult != null) + { + pSaveBitmap = __pHitElementResult->GetImage(); + } + __pSaveImage->EncodeToFile(*pSaveBitmap, IMG_FORMAT_JPG, imagePath, true); + + String srcUrl = __pHitElementResult->GetAttributeValue(L"src"); + AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer()); + + ShareInfo* pShareInfo = new(std::nothrow) ShareInfo(); + pShareInfo->SetPageTitle(L""); + pShareInfo->SetPageUrl(srcUrl); + pShareInfo->SetImageAttached(true); + pShareInfo->SetImagePath(imagePath); + __pPopUp->RemoveAllShareInfo(); + __pPopUp->AddShareInfo(pShareInfo); + __pPopUp->SetShowState(true); + __pPopUp->Show(); + } + } + break; + case IDA_FIND_TEXT__CLICKED: + { + AppLogDebug("MainForm::OnActionPerformed find word clicked"); + __currentSearchStr.Clear(); + __currentSearchStr.Append(__currentSelectedStr); + InitFindWordPanel(); + if(__pMenu != null) + { + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + } + + __adressPanelPosition.y = 0; + + if (__pAddressbar != null && __pWebViewer != NULL) + { + __webControlPosition.y = __pAddressbar->GetHeight() - 12; + __pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight()); + __pAddressbar->Invalidate(true); + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight)); + __pWebViewer->Invalidate(true); + } + + ShowFindWordPanel(true); + if (__currentSearchStr.GetLength() > 0) + { + StartWordSearch(); + } + else + { + AppLogDebug("Enter something"); + } + + } + break; + case IDA_SHARE_TEXT_CLICKED: + { + AppLogDebug("IDA_SHARE_TEXT_CLICKED"); + if(__pPopUp != null) + { + delete __pPopUp; + __pPopUp = null; + } + __pPopUp = new(std::nothrow) SharePopup(); + __pPopUp->Initialize(); + if (__pHitElementResult != null) + { + ShareInfo* pShareInfo = new(std::nothrow) ShareInfo(); + pShareInfo->SetPageTitle(L""); + pShareInfo->SetPageUrl(__currentSelectedStr); + pShareInfo->SetImageAttached(false); + __pPopUp->RemoveAllShareInfo(); + __pPopUp->AddShareInfo(pShareInfo); + __pPopUp->SetShowState(true); + __pPopUp->Show(); + } + } + break; + case IDA_COPY_TEXT_CLICKED: + { + // need to implement + //__currentSelectedStr + // Sets data to a clip board item + ClipboardItem item; + String resourcePath = App::GetInstance()->GetAppResourcePath(); + item.Construct(CLIPBOARD_DATA_TYPE_TEXT, __currentSelectedStr); + + // copying the item to clipboard + Clipboard* pClipboard = Clipboard::GetInstance(); + if (pClipboard != null) + { + pClipboard->CopyItem(item); + } + } + break; + case IDA_PASTE_TEXT_CLICKED: + { + Clipboard* pClipboard = Clipboard::GetInstance(); + + if(pClipboard == null) + { + return; + } + // Retrieves a latest item + ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML); + + if(pItem == null) + { + return; + } + //Gets data from the clipboard item + String* pString = dynamic_cast(pItem->GetData()); + + if (pString != null) + { + String idElement = __pHitElementResult->GetAttributeValue(L"id"); + AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer()); + String script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } insertAtCursor("; + script.Append(idElement); + script.Append(","); + script.Append("\""); + script.Append(*pString); + script.Append("\");"); + AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer()); + String* pStr = __pWebViewer->EvaluateJavascriptN(script); + delete pStr; + } + delete pItem; + } + break; + default: + break; + } +} + +void +MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) +{ + + UiApp* pApp = UiApp::GetInstance(); + if (pApp == null) + { + return; + } + pApp->Terminate(); +} + +void +MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) +{ + String* pSelectedScene = NULL; + Object* pValue = NULL; + String* pUrl = null; + MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue); + pSelectedScene = (String*) pValue; + + if (pSelectedScene != null) + { + delete pSelectedScene; + } + MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null); + String* selectedSceneID = new(std::nothrow) String(currentSceneId); + AppLogDebug("current scene id is %ls", currentSceneId.GetPointer()); + AppLogDebug("selected scene id is %ls", currentSceneId.GetPointer()); + + // setting the current scene ID + MultipleWindowPresentationModel::GetInstance()->SetCurrentSceneID(currentSceneId); + + MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, (Object*) selectedSceneID); + + if(pArgs != null && pArgs->GetCount() > 0 && pArgs->GetCount() == 2) + { + __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0)); + // if(__pWindowInfo == null) + { + pUrl = dynamic_cast< String* >(pArgs->GetAt(1)); + } + } + else if ( pArgs != null && pArgs->GetCount() == 1) + { + __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0)); + } + + InitFooter(); + InitAddressbar(); + + if(__pWebViewer != null) + { + __pWebViewer->Resume(); + } + + if(pUrl != null && pUrl->GetLength() > 0) + { + LoadUrl(*pUrl); + } + else if(__pWindowInfo != null) + { + if(__pWindowInfo->pageUrl.GetLength() > 0 && previousSceneId != IDSCN_MULTIPLE_WINDOW && previousSceneId != IDSCN_MULTIPLE_WINDOW_GRID && previousSceneId != IDSCN_BOOKMARK_VIEW && previousSceneId != IDSCN_SETTINGS && previousSceneId != IDSCN_MAIN_VIEW) + { + LoadUrl(__pWindowInfo->pageUrl); + } + else if (__pWindowInfo->isJavascriptInitiated == true) + { + AppLog("Called"); + InitWebControl(); + __pWindowInfo->pCurrentWeb = __pWebViewer; + } + } + + String homePage = SettingPresentationModel::GetInstance()->GetHomepage(); + AppLog("Homepage Value in Onsceneactivated is %ls",homePage.GetPointer()); + if(homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0) + { + InitMostVisitedSitesView(GetOrientationStatus()); + } + + if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST)) + { + String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0)); + + if (pBookmarkUrl == null) + return; + AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer()); + __pAddressbar->SetUrl(*pBookmarkUrl); + + if (__pWebViewer != null && homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE")) != 0) + __pWebViewer->LoadUrl(*pBookmarkUrl); + delete pBookmarkUrl; + } + + bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn(); + Bitmap* pBitmap = null; + if (isPrivateBrowsing == true) + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON); + + if (__pWebViewer != null) + { + __pWebViewer->SetPrivateBrowsingEnabled(true); + } + + if (__pAddressbar != null) + { + __pAddressbar->UpdateFaviconBitmap(true); + } + + } + else + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF); + + if (__pWebViewer != null) + { + __pWebViewer->SetPrivateBrowsingEnabled(false); + } + + if (__pAddressbar != null) + { + __pAddressbar->UpdateFaviconBitmap(false); + } + } + + if (__pMenu != null && __pMenu->GetItemCount() == 3) + { + __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY"),IDA_PRIVATEON_CLICKED,*pBitmap); + } + else if (__pMenu != null ) + { + __pMenu->SetItemAt(3,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY"),IDA_PRIVATEON_CLICKED,*pBitmap); + } + + if (pBitmap != null) + { + delete pBitmap; + } + + AppLog("ABC: OnSceneActivatedN started exit"); + +} + +void +MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId) +{ + Canvas* pWebCanvas = null; + if (__pWebViewer != null) + { + pWebCanvas = __pWebViewer->GetCanvasN(); + __pWebViewer->Pause(); + + } + if (pWebCanvas == null) + { + return; + } + if (__pWindowInfo != null) + { + if (__pWindowInfo->pWebCanvasBitmap != null) + { + delete __pWindowInfo->pWebCanvasBitmap; + } + __pWindowInfo->pWebCanvasBitmap = new(std::nothrow) Bitmap(); + result r = __pWindowInfo->pWebCanvasBitmap->Construct(*pWebCanvas,Rectangle(0,0,pWebCanvas->GetBounds().width,pWebCanvas->GetBounds().height)); + AppLog("Bitmap Construction result %s",GetErrorMessage(r)); + } + Bitmap* pBitmap = GetCapturedBitmapN(); + AppLog("Coming here"); + Canvas* pCanvas = new(std::nothrow) Canvas(); + pCanvas->Construct(GetClientAreaBounds()); + if(pBitmap != null) + { + pCanvas->DrawBitmap(Point(0,0),*pBitmap); + delete pBitmap; + } + if(__pWebViewer != null && __pWindowInfo != null) + pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap); + + WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap(); + WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight())); + delete pCanvas; + AppLog("Coming here"); +} + +bool +MainForm::OnHttpAuthenticationRequestedN(const Tizen::Base::String& host, + const Tizen::Base::String& realm, + const Tizen::Web::Controls::AuthenticationChallenge& authentication) +{ + return false; +} + +void +MainForm::OnHttpAuthenticationCanceled(void) +{ +} + +void +MainForm::OnLoadingStarted(void) +{ + AppLogDebug("MainForm::OnLoadingStarted entered"); + __isLoaded = true; + if(__pAddressbar == NULL) + { + return; + } + Bitmap* pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN(); + __pAddressbar->SetFaviconBitmap(*pBitmap); + delete pBitmap; + if (__adressPanelPosition.y < (0 - __pAddressbar->GetHeight() + 12)) + { + // updating the address bar position with respect to web control + __adressPanelPosition.y = 0 - __pAddressbar->GetHeight() + 12; //-12 is for the progress label + __distanceMoved = 0; + MoveUiControls(); + } + + __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING); + if (__pWebViewer) + { + AppLog("MainForm::OnLoadingStarted __pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer()); + __pAddressbar->SetUrl(__pWebViewer->GetUrl()); + if (__pWindowInfo != NULL) + { + __pWindowInfo->pageUrl = __pWebViewer->GetUrl(); + } + __pAddressbar->Invalidate(true); + } + +} + +void +MainForm::OnLoadingCanceled(void) +{ + +} + + +void +MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source) +{ + if(__pAddressbar != null) + { + OnAddressBarKeypadOpened(*__pAddressbar); + } +} + +void +MainForm::OnKeypadClosed(Tizen::Ui::Control& source){ + if(__pAddressbar != null) + { + OnAddressBarKeypadClosed(*__pAddressbar); + } +} + +void +MainForm::OnLoadingErrorOccurred(LoadingErrorType error, + const Tizen::Base::String& reason) +{ + AppLogDebug("Error: %d, %ls", error, reason.GetPointer()); +} + +void +MainForm::OnLoadingCompleted(void) +{ + DateTime date; + result r = E_SUCCESS; + + if (__pWebViewer == null) + { + return; + } + + if (__pAddressbar == null) + { + return; + } + if (__pWebViewer->CanGoForward()) + { + __pAddressbar->SetForwardButtonEnabled(true); + } + else + { + __pAddressbar->SetForwardButtonEnabled(false); + } + + if (__pWebViewer->CanGoBack()) + { + __pAddressbar->SetBackButtonEnabled(true); + } + else + { + __pAddressbar->SetBackButtonEnabled(false); + } + if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT) + { + __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE); + + __pAddressbar->UpdateProgress(0); + } + + AppLog("PrivateBrowsing %d",__pWebViewer->IsPrivateBrowsingEnabled()); + bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn(); + if (isPrivateBrowsing == false) + { + History* pHistory = new(std::nothrow) History; + + HistoryPresentationModel::GetCurrentDateTime(date); + if(__pWindowInfo) + { + pHistory->SetHistoryTitle(__pWindowInfo->pageTitle); + AppLogDebug("MainForm::OnLoadingCompleted pagetitle = %ls", __pWindowInfo->pageTitle.GetPointer()); + + pHistory->SetHistoryUrl(__pWindowInfo->pageUrl); + AppLogDebug("MainForm::OnLoadingCompleted pageUrl = %ls", __pWindowInfo->pageUrl.GetPointer()); + } + pHistory->SetVisitedTime(date); + String id = ""; + if(__pWindowInfo) + id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl); + pHistory->SetFaviconId(id); + Canvas* pCanvas = __pWebViewer->GetCanvasN(); + Bitmap* pBitmap = new(std::nothrow) Bitmap(); + if ( pCanvas != null && pCanvas != null && pBitmap != null) + { + pBitmap->Construct(*pCanvas, pCanvas->GetBounds()); + pBitmap->Scale(Dimension(pBitmap->GetWidth()/4, pBitmap->GetHeight()/4)); + pHistory->SetThumbnail(pBitmap); + } + HistoryPresentationModel::GetInstance()->SaveHistory(*pHistory); + delete pHistory; + } + else + { + return; + } + if (__pWindowInfo && __pWindowInfo->faviconUrl == "") + { + // temperary fixed (webpage can be not loaded) + UpdateFavicon(); + } +} + +void +MainForm::OnEstimatedProgress(int progress) +{ + AppLogDebug("MainForm::OnEstimatedProgress entered"); + if (progress < DEFAULT_PROGRESS_PERCENTAGE) + progress = DEFAULT_PROGRESS_PERCENTAGE; + if(__pAddressbar) + __pAddressbar->UpdateProgress(progress); +} + +void +MainForm::OnUrlSubmitted(Addressbar& addBar) +{ + String url = addBar.GetUrl(); + LoadUrl(url); + __pFooterPanel->SetShowState(true); + __pFooterPanel->Invalidate(true); + RequestRedraw(true); +} + +void +MainForm::LoadUrl(String& url) +{ + AppLogDebug("MainForm::LoadUrl enter"); + + if (url.CompareTo(L"") == 0) + { + return; + } + if(__pFooterPanel != null) + { + __pFooterPanel->SetShowState(true); + __pFooterPanel->Invalidate(true); + } + InitWebControl(); + + bool ret = false; + bool flag = false; + + String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"); + String secondPattern(L"^[A-Za-z0-9\.\+-:#@%/;$~?]+\\.[A-Za-z0-9\+-=:#@%/;$~()_?\\\.&]{2,}$"); // URL of type abc.com (i.e without protocol in front of it) + + RegularExpression firstRegex; + RegularExpression secondRegex; + + firstRegex.Construct(firstPattern, REGEX_CASELESS); + secondRegex.Construct(secondPattern, REGEX_CASELESS); + + // Match + ret = firstRegex.Match(url, false); // This returns true value + flag = secondRegex.Match(url, false); // Checks whether URL typed is of type abc.com (i.e without protocol in front of it) + + if (ret == true && __pWebViewer != null) + { + __pWebViewer->LoadUrl(url); + } + else if(__pWebViewer != null) + { + String tempUrl = L"http://"; + tempUrl.Append(url); + + if (flag == true) + { + __pWebViewer->LoadUrl(tempUrl); + } + else + { + __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(url)); + } + } + if (__pAddressbar != null) + { + __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING); + } + + AppLogDebug("MainForm::LoadUrl exit"); + + return; + +} + +void +MainForm::OnStopClicked(Addressbar& addBar) +{ + AppLogDebug("MainForm::OnStopClicked called"); + if (__pWebViewer) + { + __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE); + __pWebViewer->StopLoading(); + RequestRedraw(true); + } +} + +void +MainForm::OnReaderClicked(const Addressbar& addBar) +{ + int bodyWidth = ((double)(GetClientAreaBounds().width))*0.73; + + CreateReaderPanel(); + AppLogDebug("MainScene::OnReaderClicked entered"); + + + /*if (__pArticleReaderPanel) + { + AppLogDebug("showstate true for reader panel"); + __pArticleReaderPanel->SetShowState(true); + __pArticleReaderPanel->Show(); + }*/ + int xPos = __pArticleReaderPanel->GetX(); + int yPos = __pArticleReaderPanel->GetY(); + AppLog("OnReaderClicked() xPos = %d",xPos); + AppLog("OnReaderClicked() yPos = %d",yPos); + + if (__pReaderData == null) + { + return; + } + + String loadData = L"\ + \ + \ + \ + \ + "); + AppLogDebug("data->GetLength %d",__pReaderData->GetLength()); + loadData.Append(*__pReaderData); + loadData.Append(L""); + + ByteBuffer buf ; + buf.Construct(loadData.GetLength()); + AppLogDebug("data->GetLength %d",loadData.GetLength()); + for (int z=0;zLoadData(L"",buf,L"text/html"); + AppLogDebug("LoadData result %s",GetErrorMessage(GetLastResult())); + } + else + { + AppLogDebug("cannot LoadData __pWebReader is null"); + } + +} + +void +MainForm::OnBackClicked(const Addressbar& addBar) +{ + if (__pWebViewer == null) + return; + + if (__pWebViewer->CanGoBack()) + { + __pWebViewer->GoBack(); + } + +} + +void +MainForm::OnForwardClicked(const Addressbar& addBar) +{ + if (__pWebViewer == null) + return; + + if (__pWebViewer->CanGoForward()) + { + __pWebViewer->GoForward(); + } +} + +void +MainForm::OnAddressCancelledClicked(const Addressbar& addBar) +{ + __pFooterPanel->SetShowState(true); + __pFooterPanel->Invalidate(false); +} + +void +MainForm::OnAddressBarModeChanged(const Addressbar& addBar) +{ + __prevAddressBarMode = __curAddressBarMode; + + if (__pAddressbar != null) + { + __curAddressBarMode = __pAddressbar->GetAddressbarMode(); + } + + if (__curAddressBarMode == ADDRESSBAR_MODE_EDIT) + { + __adressPanelPosition.y = 0; + if (__pAddressbar != null) + { + __webControlPosition.y = __pAddressbar->GetHeight() - 12; + __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight())); + __pAddressbar->Invalidate(true); + } + if (__pWebViewer != null) + { + __pWebViewer->StopLoading(); + + } + + } + if (__pWebViewer != null) + { + if(__pFooterPanel->GetShowState() == false) + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height)); + else + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight)); + __pWebViewer->Invalidate(true); + } +} + +void +MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar) +{ + + if(__pFooterPanel != null) + { + String homePage = SettingPresentationModel::GetInstance()->GetHomepage(); + if (homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0) + { + InitMostVisitedSitesView(GetOrientationStatus()); + } + __pFooterPanel->SetShowState(true); + __pFooterPanel->Invalidate(false); + } + + + + //AppLogDebug("MainForm::OnAddressBarKeypadClosed enterd"); + + if (__pWebViewer != null && __pFooterPanel != null) + { + AppLog("MainForm::OnAddressBarKeypadClosed GetClientAreaBounds().height %d ", GetClientAreaBounds().height); + __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight(); + + if(__pFooterPanel->GetShowState() == false) + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height)); + else + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight)); + __pWebViewer->Invalidate(false); + //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight)); + } + +} + +void +MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar) +{ + __pFooterPanel->SetShowState(false); + __pFooterPanel->Invalidate(false); +} + +void +MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar) +{ + __pFooterPanel->SetShowState(false); + __pFooterPanel->Invalidate(false); +} + +void +MainForm::OnPageTitleReceived(const Tizen::Base::String& title) +{ + if (__pWindowInfo) + { + __pWindowInfo->pageTitle = title; + if (__pWebViewer != null) + { + __pWindowInfo->pageUrl = __pWebViewer->GetUrl(); + } + } + if (__pAddressbar != null && __pWebViewer != null) + { + __pAddressbar->SetUrl(__pWebViewer->GetUrl()); + __pAddressbar->UpdateFaviconBitmap(SettingPresentationModel::GetInstance()->GetPrivateOn()); + __pAddressbar->Invalidate(true); + } + +} + +void +MainForm::UpdateFavicon(void) +{ + bool urlImageType = false; + String *tempPath = __pWebViewer->EvaluateJavascriptN(L"var getFavicon = function() { var favicon = '/favicon.ico'; var nodeList = document.getElementsByTagName('link'); if(nodeList) { for (var i = 0; i < nodeList.length; i++) { if ((nodeList[i].getAttribute('rel') == 'icon')||(nodeList[i].getAttribute('rel') == 'shortcut icon')) { favicon = nodeList[i].getAttribute('href'); } } } return favicon; }; getFavicon();"); + Bitmap* pBitmap = null; + + if (tempPath && tempPath->GetLength() > 0 && tempPath->CompareTo(L"undefined") != 0) + { + if (__pWindowInfo != null) + { + Uri url; + url.SetUri(*tempPath); + if (url.GetHost().GetLength() == 0) + { + Uri webUrl; + webUrl.SetUri(__pWebViewer->GetUrl()); + result r = url.SetHost(webUrl.GetHost()); + if(IsFailed(r)) + { + delete tempPath; + return; + } + } + if (url.GetScheme().GetLength() == 0) + { + Uri webUrl; + webUrl.SetUri(__pWebViewer->GetUrl()); + url.SetScheme(webUrl.GetScheme()); + } + __pWindowInfo->faviconUrl = url.ToString(); + + pBitmap = __pWebViewer->GetFaviconN(); + + if (pBitmap != null) + { + if (__pWindowInfo->pFavicon != NULL) + { + // delete __pWindowInfo->pFavicon; + __pWindowInfo->pFavicon = null; + } + __pWindowInfo->pFavicon = new(std::nothrow) Bitmap(); + __pWindowInfo->pFavicon->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight())); + //bool isPrivateBrowsing = __pWebViewer->IsPrivateBrowsingEnabled(); + + __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon); + + FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl); + } + else if(__pWindowInfo->pFavicon != null) + { + __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon); + } + else + { + __pAddressbar->SetFaviconBitmap(*FaviconManager::GetInstance()->GetDefaultFaviconN()); + } + + AppLogDebug("Favicon download requested: url: %ls", url.ToString().GetPointer()); + } + delete tempPath; + } + else + { + delete tempPath; + AppLogDebug("Error occured: %s", GetErrorMessage(GetLastResult())); + } + +} + + +bool +MainForm::OnLoadingRequested(const Tizen::Base::String& url, + Tizen::Web::Controls::WebNavigationType type) +{ + if (__pWebViewer && __pAddressbar) + { + AppLog("__pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer()); + __pAddressbar->SetUrl(__pWebViewer->GetUrl()); + __pAddressbar->UpdateProgress(DEFAULT_PROGRESS_PERCENTAGE); + + if (__pWindowInfo) + { + __pWindowInfo->pageTitle = CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK"); + __pWindowInfo->pageUrl = __pWebViewer->GetUrl(); + __pWindowInfo->faviconUrl = ""; + __pWindowInfo->faviconFilePath = ""; + + if (__pWindowInfo->pFavicon != NULL) + { + // delete __pWindowInfo->pFavicon; + __pWindowInfo->pFavicon = null ; + } + __pWindowInfo->pFavicon = FaviconManager::GetInstance()->GetDefaultFaviconN(); + + } + + __pAddressbar->Invalidate(true); + } + return false; +} + +DecisionPolicy +MainForm::OnWebDataReceived(const Tizen::Base::String& mime, + const Tizen::Net::Http::HttpHeader& httpHeader) +{ + return Tizen::Web::Controls::WEB_DECISION_CONTINUE; +} + + +void +MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint) +{ + AppLog("MainForm::OnWebPageBlockSelected"); + + if (__pHitElementResult != null) + { + delete __pHitElementResult; + __pHitElementResult = null; + } + + if (__pWebViewer != null) + { + AppLog("MainForm::OnWebPageBlockSelected web not null"); + __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint); + } + + if (__pHitElementResult == null) + { + return; + } + + if (__pHitElementResult->HasImage() != true) + { + String tagName = __pHitElementResult->GetTagName(); + String type = __pHitElementResult->GetAttributeValue("type"); + + __currentSelectedStr.Clear(); + __currentSelectedStr = __pWebViewer->GetTextFromBlock(); + + if ((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0) + { + AppLog("MainForm::OnWebPageBlockSelected show paste option"); + + InitSelectTextContextMenu(startPoint,true); + __pImageMenu->SetShowState(true); + __pImageMenu->Show(); + __pImageMenu->Invalidate(true); + } + else if (__pHitElementResult->HasUrl() == true || __currentSelectedStr.GetLength() > 0) + { + AppLog("MainForm::OnWebPageBlockSelected no paste option"); + + if(__pHitElementResult->GetUrl().GetLength() > 0) + { + __currentSelectedStr.Clear(); + __currentSelectedStr = __pHitElementResult->GetUrl(); + } + InitSelectTextContextMenu(startPoint,false); + __pImageMenu->SetShowState(true); + __pImageMenu->Show(); + __pImageMenu->Invalidate(true); + } + + AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer()); + AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer()); + AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer()); + } +} + +void +MainForm::OnWebPageShowRequested(Tizen::Web::Controls::Web& source) +{ + +} + +Web* +MainForm::OnWebWindowCreateRequested(void) +{ + WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(); + + if (pNewWindowInfo == null) + { + return null; + } + result r = E_SUCCESS; + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == NULL) + { + return null; + } + ArrayList* pArgList = new(std::nothrow) ArrayList(); + if (pArgList == NULL) + { + return null; + } + r = pArgList->Construct(); + if (r == E_SUCCESS) + { + pNewWindowInfo->isJavascriptInitiated = true; + pArgList->Add(*pNewWindowInfo); + r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList); + delete pArgList; + if (IsFailed(r)) + { + AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r)); + return null; + } + } else { + delete pArgList; + } + + return pNewWindowInfo->pCurrentWeb; +} + +void +MainForm::RelayoutControls(bool showAddressbar) +{ + if (showAddressbar == false) + { + __pAddressbar->SetShowState(false); + __pWebViewer->SetBounds(__pWebViewer->GetX(), 0, __pWebViewer->GetWidth(), __webControlHeight); + __pFooterPanel->SetBounds(__pFooterPanel->GetX(), GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight()); + } + else + { + __pAddressbar->SetShowState(true); + __pWebViewer->SetBounds(__pWebViewer->GetX(), __pWebViewer->GetY(), __pWebViewer->GetWidth(), __webControlHeight); + __pFooterPanel->SetBounds(__pFooterPanel->GetX(), GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight()); + } + RequestRedraw(true); +} + +void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed) +{ + if (__pFindWordPanel == null) + { + return; + } + if (show == true) + { + InitFindWordPanel(); + __pFindWordEditField->SetText(__currentSearchStr); + //__pFindWordCountLabel->SetText(L""); + __pFindWordCountLabel->SetShowState(false); + + } + + AppLog("MainForm::ShowFindWordPanel %d",show); + if (show && !isTouchPressed) + { + if (__pFindWordEditField) + __pFindWordEditField->ShowKeypad(); + } + else + { + if (__pFindWordEditField) + __pFindWordEditField->HideKeypad(); + } + + if (__pAddressbar != null) + { + __pAddressbar->SetShowState(!show); + __pAddressbar->Invalidate(true); + } + if (__pFindWordPanel != null) + { + __pFindWordPanel->SetShowState(show); + __pFindWordPanel->Invalidate(true); + } + Invalidate(true); +} + +void +MainForm::StartWordSearch() +{ + //Get the count of occurances of the word in the current page + __maxOccurrances = 0; + __currentWordIndex = 0; + + __pFindWordPrev->SetEnabled(false); + String *pCountStr = null; + __pWebViewer->SearchTextAllAsync(__currentSearchStr, false); + /*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/" + __currentSearchStr + "/gi).length;"); + if (pCountStr != null) + { + Integer::Parse(*pCountStr, 10, __maxOccurrances); + delete pCountStr; + } + + AppLogDebug("'%ls' is found %d times", __currentSearchStr.GetPointer(), __maxOccurrances); + */ + +} + +void MainForm::OnTextFound(int totalCount, int currentOrdinal) +{ + AppLog("MainForm::OnTextFound totalCount %d",totalCount); + AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal); + + if(totalCount == -1 || totalCount == 0) + { + return; + } + + __maxOccurrances = totalCount; + __currentWordIndex = currentOrdinal; + + //Reset the UI controls as per the maxOccurrance value + if (totalCount <= 0) + { + AppLog("Word not found"); + //Show error notification to user + __pFindWordNext->SetEnabled(false); + __pFindWordCountLabel->SetText(L""); + __pFindWordNext->Invalidate(false); + __pFindWordPrev->Invalidate(false); + __pFindWordCountLabel->Invalidate(false); + return; + } + + if (totalCount == 1) + { + __pFindWordNext->SetEnabled(false); + } + else + { + __pFindWordNext->SetEnabled(true); + } + + String countStr = L""; + countStr.Append(__currentWordIndex); + countStr.Append(L"/"); + countStr.Append(__maxOccurrances); + __pFindWordCountLabel->SetText(countStr); + __pFindWordCountLabel->SetShowState(true); + __pFindWordCountLabel->Invalidate(false); + + //FindNextWord(true); + //Update the controls + __pFindWordNext->Invalidate(false); + __pFindWordPrev->Invalidate(false); + __pFindWordCountLabel->Invalidate(false); +} + +void +MainForm::FindNextWord(bool next) +{ + if (next == true) + { + if (__pWebViewer->SearchText(__currentSearchStr, true) == true) + { + if(__currentWordIndex < __maxOccurrances) + { + __currentWordIndex++; + } + } + } + else + { + if (__pWebViewer->SearchText(__currentSearchStr, false) == true) + { + if(__currentWordIndex > 0) + { + __currentWordIndex--; + } + } + } + + String countStr = L""; + countStr.Append(__currentWordIndex); + countStr.Append(L"/"); + countStr.Append(__maxOccurrances); + __pFindWordCountLabel->SetText(countStr); + __pFindWordCountLabel->SetShowState(true); + __pFindWordCountLabel->Invalidate(false); + if (__currentWordIndex >= __maxOccurrances) + { + __pFindWordNext->SetEnabled(false); + } + else + { + __pFindWordNext->SetEnabled(true); + } + if (__currentWordIndex <= 0) + { + __pFindWordPrev->SetEnabled(false); + } + else + { + __pFindWordPrev->SetEnabled(true); + } + __pFindWordPrev->Invalidate(false); + __pFindWordNext->Invalidate(false); + __pFindWordCountLabel->Invalidate(false); + __pFindWordPanel->Invalidate(true); +} +void +MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source) +{ + OnAddressBarKeypadOpened(*__pAddressbar); +} + +void +MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source) +{ + + if (__pWebViewer != null && __pFooterPanel != null) + { + AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height); + __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight(); + + if(__pFooterPanel->GetShowState() == false) + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height)); + else + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight)); + + //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight)); + } +} + +void +MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source) +{ + OnAddressBarKeypadClosed(*__pAddressbar); +} + +void +MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo) +{ + Control* temp = const_cast< Control* >(&source); + Header* pHeader = dynamic_cast< Header* >(temp); + if (pHeader != null) + { + //Header double - clicked + AppLog("Header double clicked"); + } + if(__pFindWordPanel) + { + AppLog("MainForm::OnTouchPressed %d",__pFindWordPanel->GetShowState()); + ShowFindWordPanel(__pFindWordPanel->GetShowState(), true); + } + + + AppLog("MainScene::OnTouchDoublePressed"); + bool isReaderEnabled = SettingPresentationModel::GetInstance()->IsRunReaderEnabled(); + if (isReaderEnabled == true) + { + if (__pReaderData) + { + delete __pReaderData; + __pReaderData = null; + } + String filePath = Tizen::App::UiApp::GetInstance()->GetAppRootPath(); + filePath.Append(L"data/reader.js"); + File file; + char buffer[10]; + char buffer2[5]; + int i; + int readCnt; + result r = E_SUCCESS; + FileAttributes attr; + + File::GetAttributes(filePath,attr); + // Creates file + r = file.Construct(filePath, L"r+"); + if (IsFailed(r)) + { + AppLogDebug("File construct failed with %s", GetErrorMessage(r)); + return; + } + char* pScript = new(std::nothrow) char[attr.GetFileSize()+1]; + if(pScript == null) + { + AppLogDebug("Memory allocation for file failed %s", GetErrorMessage(r)); + return; + } + file.Read(pScript,attr.GetFileSize()); + + AppLogDebug("scipt length %d",strlen(pScript)); + String strScript = L""; + strScript.Append(pScript); + __pReaderData = __pWebViewer->EvaluateJavascriptN(strScript); + if (!__pReaderData) + { + AppLog("MainScene::data is null Error :%s",GetErrorMessage(GetLastResult())); + return; + } + AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer()); + if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0) + { + __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER); + } + delete[] pScript; + } +} + +void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) +{ + AppLog("MainForm::OnTouchLongPressed"); + + if (__pHitElementResult != null) + { + delete __pHitElementResult; + __pHitElementResult = null; + } + + if (__pWebViewer != null) + { + AppLog("MainForm::OnTouchLongPressed web not null"); + __pHitElementResult = __pWebViewer->GetElementByPointN(currentPosition); + } + + if (__pHitElementResult == null) + { + return; + } + + if (__pHitElementResult->HasImage() == true) + { + InitImageContextMenu(currentPosition); + __pImageMenu->SetShowState(true); + __pImageMenu->Show(); + __pImageMenu->Invalidate(true); + } + else + { + String tagName = __pHitElementResult->GetTagName(); + String type = __pHitElementResult->GetAttributeValue("type"); + String value = __pHitElementResult->GetAttributeValue(L"value"); + String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML"); + + __currentSelectedStr.Clear(); + __currentSelectedStr = __pWebViewer->GetTextFromBlock(); + + if (((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0) && value.GetLength() == 0 && innerHtml.GetLength() == 0) + { + AppLog("MainForm::OnWebPageBlockSelected show paste option"); + + InitSelectTextContextMenu(currentPosition,true, true); + __pImageMenu->SetShowState(true); + __pImageMenu->Show(); + __pImageMenu->Invalidate(true); + } + __pWebViewer->SetBlockSelectionPosition(currentPosition); + + } + __inputEventToBeSupressed = true; +} + +void +MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) +{ + AppLog("MainForm::OnTouchReleased"); + + HitElementResult* pHitElement = __pWebViewer->GetElementByPointN(currentPosition); + if(pHitElement != null && pHitElement->HasUrl() == true && __inputEventToBeSupressed == true) + { + __pWebViewer->ConsumeInputEvent(); + delete pHitElement; + } + __inputEventToBeSupressed = false; +} + +void +MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus) +{ + int widthContextItem = 0; + int heightContextItem = 72; + + + if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) + { + widthContextItem = 800; + } + else + { + widthContextItem = 336; + } + + if( __pItemContext != NULL) + { + delete __pItemContext; + __pItemContext = null; + + } + __pItemContext= new(std::nothrow) ListContextItem(); + __pItemContext->Construct(); + Bitmap* pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", widthContextItem,heightContextItem); + Bitmap* pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", widthContextItem, heightContextItem); + + if (pBitmapNormal != null && pBitmapPressed != null) + { + __pItemContext->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed); + } + + if (pBitmapNormal != null) + { + delete pBitmapNormal; + } + + if (pBitmapPressed != null) + { + delete pBitmapPressed; + } + + + if (__pFindWordPanel != null && __pFindWordPanel->GetShowState() == true) + { + __pFindWordPanel->SetBounds(0,0,GetClientAreaBounds().width,__pFindWordPanel->GetHeight()); + __pFindWordControl->SetBounds(0,0, __pFindWordPanel->GetWidth(), __pFindWordPanel->GetHeight()); + __pFindWordControl->SetShowState(true); + __pFindWordControl->Invalidate(true); + __pFindWordPanel->SetShowState(true); + __pFindWordPanel->Invalidate(true); + } + + if (__pWebViewer != null && __pFooterPanel != null) + { + AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height); + __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight(); + + if(__pFooterPanel->GetShowState() == false) + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height)); + else + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight)); + + //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight)); + } + if (__pAddressbar != null) + { + __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight())); + __pAddressbar->SetAddressbarMode(__pAddressbar->GetAddressbarMode()); + __pAddressbar->UpdateFaviconBitmap(SettingPresentationModel::GetInstance()->GetPrivateOn()); + } + if (__pFindWordBgLabel != null) + { + // __pFindWordBgLabel->SetSize(GetClientAreaBounds().width,GetClientAreaBounds().height); + Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight()); + if (pBitmap != null) + { + __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap); + delete pBitmap; + } + } + if (__pFooterPanel /*&& __pFooterPanel->GetShowState() == true*/) + { + AppLog("__pFooterPanel->GetShowState() is true"); + InitFooter(); + } + InitAddressbar(); + + if(__pMoreButton && __pMenu) + { + Point p = Point(__pMoreButton->GetX() + __pMoreButton->GetWidth() / 2, GetBounds().height - __pMoreButton->GetHeight()); + __pMenu->SetAnchorPosition(p); + __pMenu->Invalidate(true); + } + + if (__pFooterPanel) + { + __pFooterPanel->Invalidate(true); + } + String homePage = SettingPresentationModel::GetInstance()->GetHomepage(); + if (homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0) + { + InitMostVisitedSitesView(orientationStatus); + } + + AppLog("OnOrientationChanged 0"); + if (__pArticleReaderPanel != null) + { + + if (__pArticleReaderPanel->GetShowState() == true) + { + __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight()); + + if (__pBlankPanel != null) + __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height); + + if (__pWebReader != null) + { + __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight() - 96)); + } + Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()); + Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()); + + if ( pBitmap != null && pSrcBitmap != null) + { + AppLog("CreateReaderPanel ninepatchbitmap found"); + pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight())); + } + + __pArticleReaderLabel->SetBounds(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight())); + __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap); + if (pBitmap != null) + { + delete pBitmap; + pBitmap = null; + } + if (pSrcBitmap != null) + { + delete pSrcBitmap; + pSrcBitmap = null; + } + } + } + Invalidate(true); + if(__pAddressbar != null) + { + __pAddressbar->OrientationChanged(); + } +} + +void +MainForm::OnSettingsChange(int settingvalue) +{ + AppLogDebug("MainForm::OnSettingsChange entered"); + if (__pWebViewer == null) + { + AppLogDebug("Webviewer is not initialized yet."); + return; + } + if (settingvalue == (int) REGISTRY_SETTING_DEFAULT_VIEW) + { + WebSetting settings = __pWebViewer->GetSetting(); + if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0) + { + settings.SetAutoFittingEnabled(true); + } + else if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_READABLE")) == 0) + { + settings.SetAutoFittingEnabled(false); + } + __pWebViewer->SetSetting(settings); + } + else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT) + { + WebSetting settings = __pWebViewer->GetSetting(); + settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled()); + __pWebViewer->SetSetting(settings); + } + else if (settingvalue == (int) REGISTRY_SETTING_DISPLAY_IMAGES) + { + WebSetting settings = __pWebViewer->GetSetting(); + settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled()); + __pWebViewer->SetSetting(settings); + } + else if (settingvalue == (int) REGISTRY_SETTING_BLOCK_POPUP) + { + WebSetting settings = __pWebViewer->GetSetting(); + settings.SetJavaScriptPopupEnabled(SettingPresentationModel::GetInstance()->IsBlockPopUp()); + __pWebViewer->SetSetting(settings); + } + else if (settingvalue == (int) REGISTRY_SETTING_ACCEPT_COOKIES) + { + if (__pWebViewer) + { + __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled()); + } + } + + else if (settingvalue == (int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS) + { + WebSetting settings = __pWebViewer->GetSetting(); + if (SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled() == true) + { + settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM); + } + else + { + settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE); + } + __pWebViewer->SetSetting(settings); + } + else if (settingvalue == (int) REGISTRY_SETTING_READER_FONT_SIZE) + { + if (__pWebReader) + { + AppLogDebug("IntMainForm fontsize Changed to %d",SettingPresentationModel::GetInstance()->GetReaderFontSize()); + WebSetting settings = __pWebReader->GetSetting(); + settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize()); + __pWebReader->SetSetting(settings); + } + } +} + +void +MainForm::OnSettingsReset() +{ + if (__pWebViewer) + { + __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled()); + __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings()); + } +} + +void +MainForm::OnClearCache() +{ + result r = E_SUCCESS; + + if (__pWebViewer != NULL) + { + r = __pWebViewer->ClearCache(); + if (r == E_SUCCESS) + { + AppLogDebug("Cache cleared success"); + } + else + { + AppLogDebug("Cache cleared fail"); + } + } +} + +void +MainForm::OnClearCookie() +{ + result r = E_SUCCESS; + + if (__pWebViewer != NULL) + { + __pWebViewer->ClearCookie(); + } + if (r == E_SUCCESS) + { + AppLogDebug("Cookie cleared success"); + } + else + { + AppLogDebug("Cache cleared fail"); + } +} + +double +MainForm::findDistance(int x1,int y1,int x2, int y2) +{ + int deltaX = Math::Abs(x2 - x1); + int deltaY = Math::Abs(y2 - y1); + double num = deltaX*deltaX + deltaY*deltaY; + + if (num >= 0) + { + double x = num; + int i; + for (i = 0; i < 20; i++) + { + x = (((x*x)+ num)/(2*x)); + } + return num; + } + else + { + return 0.0; + } +} + +void +MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) +{ + if(__pFindWordPanel) + { + AppLog("MainForm::OnTouchPressed %d",__pFindWordPanel->GetShowState()); + ShowFindWordPanel(__pFindWordPanel->GetShowState(), true); + } + + if (__pFindWordEditField != null) + { +// __pWebViewer->SearchText(L"aaaabbbbcccc",true); +// __pFindWordEditField->HideKeypad(); + } + + Touch touch; + IList* pList = null; + pList = touch.GetTouchInfoListN(source); + + if (pList != null) + { + int count = pList->GetCount(); + if (count == 1) + { + TouchInfo* pTouchInfo = static_cast(pList->GetAt(0)); + __touchPoint1 = pTouchInfo->position; + + if (__pAddressbar != null) + { + if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && __pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING) + { + if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT) + { + __pAddressbar->SaveAddressbarEditText(); + } + __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE); + } + + __pAddressbar->Invalidate(true); + } + } + else if (count == 2) + { + AppLogDebug("MainForm::OnTouchPressed count is two"); + TouchInfo* pTouchInfo = static_cast(pList->GetAt(0)); + __touchPoint1 = pTouchInfo->position; + + pTouchInfo = static_cast(pList->GetAt(1)); + __touchPoint2 = pTouchInfo->position; + } + } + if( pList != NULL) + + { + pList->RemoveAll(true); + delete pList; + } + return; +} + +void +MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) +{ + AppLog("Start MainForm::OnTouchMoved MoveUiControls"); + if(__pFindWordPanel) + { + AppLog("MainForm::OnTouchPressed %d",__pFindWordPanel->GetShowState()); + ShowFindWordPanel(__pFindWordPanel->GetShowState(), true); + } + + if (__pFindWordEditField != null) + { + __pFindWordEditField->HideKeypad(); + } + + if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT) + { + return; + } + static int Count=0; + Touch touch; + IList* pList = null; + pList = touch.GetTouchInfoListN(source); + + if (pList != null) + { + int count = pList->GetCount(); + if (count == 1) + { + AppLogDebug("MainForm::OnTouchMoved count 1"); + TouchInfo* pTouchInfo = static_cast(pList->GetAt(0)); + + if( pTouchInfo == NULL ) + { + return; + } + pTouchInfo->position.y += __pWebViewer->GetY(); + AppLog("MainForm::OnTouchMoved MoveUiControls %d,%d",pTouchInfo->position.x,pTouchInfo->position.y); + + if (__isLoaded == false) + return; + + __distanceMoved = pTouchInfo->position.y - __touchPoint1.y; + __touchPoint1 = pTouchInfo->position; + + // move the address bar and web control according to distance moved + MoveUiControls(); + } + else if (count == 2) + { + AppLogDebug("MainForm::OnTouchMoved count 2"); + + if(Count == 10) + { + TouchInfo* pTouchInfo = static_cast(pList->GetAt(0)); + + if( pTouchInfo == NULL ) + { + return; + } + Point firstPoint = pTouchInfo->position; + + pTouchInfo = static_cast(pList->GetAt(1)); + if( pTouchInfo == NULL ) + { + return; + } + Point secondPoint = pTouchInfo->position; + + if (__touchPoint1 == Point(-1,-1) || __touchPoint2 == Point(-1,-1)) + { + __touchPoint1 = firstPoint; + __touchPoint2 = secondPoint; + delete pList; + return; + } + + int currX1 = firstPoint.x; + int currY1 = firstPoint.y; + int currX2 = secondPoint.x; + int currY2 = secondPoint.y; + + double prevDist = findDistance(__touchPoint1.x,__touchPoint1.y,__touchPoint2.x,__touchPoint2.y); + double dist = findDistance(currX1, currY1, currX2, currY2); + __distanceMoved = prevDist - dist; + + __touchPoint1 = firstPoint; + __touchPoint2 = secondPoint; + MoveUiControls(); + Count = 0; + } + } + Count++; + delete pList; + } + +} + +void +MainForm::MoveUiControls() +{ + __adressPanelPosition.y = __adressPanelPosition.y + __distanceMoved; + if(__pAddressbar == NULL) + { + return; + } + + if (__adressPanelPosition.y > 0) + { + __adressPanelPosition.y = 0; + __webControlPosition.y = __pAddressbar->GetHeight() - 12; + } + else if (__adressPanelPosition.y < (0-(__pAddressbar->GetHeight() - 12))) // -12 is for the progress label + { + __adressPanelPosition.y = 0-(__pAddressbar->GetHeight() - 12); + __webControlPosition.y = 0; + // result r = __pWebViewer->SetScrollEnabled(true); + // AppLog("letmetestscrollenabled true %s pos %d,%d",GetErrorMessage(r),__adressPanelPosition.x,__adressPanelPosition.y); + } + else + { + // result r = __pWebViewer->SetScrollEnabled(false); + // __pWebViewer->Invalidate(true); + // AppLog("letmetestscrollenabled false %s pos %d,%d",GetErrorMessage(r),__adressPanelPosition.x,__adressPanelPosition.y); + __webControlPosition.y = __adressPanelPosition.y + (__pAddressbar->GetHeight() - 12); + } + + AppLogDebug("__adressPanelPosition.y = %d, __webControlPosition.y = %d", __adressPanelPosition.y, __webControlPosition.y); + + __pAddressbar->SetBounds(0,__adressPanelPosition.y,__pAddressbar->GetWidth(),__pAddressbar->GetHeight()); + __pAddressbar->Invalidate(false); + + if (__pWebViewer != NULL) + { + if(__pFooterPanel->GetShowState() == true) + __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight(); + else + __webControlHeight = GetClientAreaBounds().height; + __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight)); + __pWebViewer->Invalidate(false); + } +} + +void +MainForm::OnTextValueChanged (const Tizen::Ui::Control &source) +{ + if (__pFindWordEditField != null) + { + __currentSearchStr = __pFindWordEditField->GetText(); + __pFindWordNext->SetEnabled(false); + __pFindWordPrev->SetEnabled(false); + __pFindWordNext->Invalidate(true); + __pFindWordPrev->Invalidate(true); + __pFindWordCountLabel->SetText(""); + __pFindWordCountLabel->SetShowState(false); + __pFindWordCountLabel->Invalidate(true); + } + AppLog("__currentSearchStr %ls",__currentSearchStr.GetPointer()); + if (__currentSearchStr.GetLength() > 0) + { + StartWordSearch(); + } + else + { + AppLogDebug("Enter something"); + } +} + +result +MainForm::InitMostVisitedSitesPanel(Tizen::Ui::OrientationStatus orientationStatus) +{ + return E_SUCCESS; + +} + +result +MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatus) +{ + if(__pWebViewer != null) + return E_SUCCESS; + + AppLog("MainForm::InitMostVisitedSitesView"); + result r = E_SUCCESS; + + + if (__pWebViewer != null && __pMostVisitedListView != null) + { + return E_SUCCESS; + } + + if (__pMostVisitedListView != null) + { + RemoveControl(*__pMostVisitedListView); + } + if(__pMostVisitedSites != null) + { + __pMostVisitedSites->RemoveAll(true); + } + + HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites); + + __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight(); + __pMostVisitedListView = new(std::nothrow) ListView(); + if(__pFooterPanel->GetShowState() == false) + { + r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight() , GetClientAreaBounds().width, GetClientAreaBounds().height),true,false); + } + else + { + r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight() , GetClientAreaBounds().width, __webControlHeight),true,false); + } + + if (r != E_SUCCESS) + { + delete __pMostVisitedListView; + AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r)); + return r; + } + __pMostVisitedListView->SetItemProvider(*this); + __pMostVisitedListView->AddListViewItemEventListener(*this); + // __pMostVisitedListView->SetBackgroundColor(Color(0,0,0)); + __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RECENTLY_VISITED_SITES")); + AddControl(*__pMostVisitedListView); + AppLog("__pMostVisitedSitesPanel addcontrol %s",GetErrorMessage(r)); + if(__pFooterPanel->GetShowState() == false) + __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() + 14)); + else + __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14)); + + __pMostVisitedListView->UpdateList(); + // __pMostVisitedSitesPanel->Invalidate(true); + + // Invalidate(true); + return E_SUCCESS; + +} + +String +MainForm::GetImagePath(void) +{ + + String str; + String formattedTime; + DateTime currentTime; + LocaleManager localManager; + SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime); + + localManager.Construct(); + Locale locale = localManager.GetSystemLocale(); + //Locale locale(LANGUAGE_ENG, COUNTRY_US); + + // Get date formatter + DateTimeFormatter* pTimeFormatter = DateTimeFormatter::CreateDateTimeFormatterN(locale, DATE_TIME_STYLE_DEFAULT); + + if (pTimeFormatter) + { + pTimeFormatter->Format(currentTime, formattedTime); + } + + AppLog("current time stamp is %ls", formattedTime.GetPointer()); + String delim(L" :"); + StringTokenizer strTok(formattedTime, delim); + String token; + String imageName; + String str1("GMT+00"); + while (strTok.HasMoreTokens()) + { + strTok.GetNextToken(token); // Osp, StringTokenizer, Sample, code + if(token.Equals(str1)) + break; + AppLog("token is %ls", token.GetPointer()); + imageName.Append(token); + } + return imageName; + +} + +void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName) +{ + result r = E_FAILURE; + AppLog("Content manager 1"); + ContentId contentId; + ContentManager contentManager; + r = contentManager.Construct(); + if(IsFailed(r)) + { + AppLog("Content manager update content result %s" ,GetErrorMessage(r)); + return; + } + Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Downloads/"; + contentPath.Append(imageName); + contentPath.Append(".jpg"); + contentId = contentManager.CreateContent(*aBuffer, contentPath); + AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult())); +} diff --git a/src/IntMainFrame.cpp b/src/IntMainFrame.cpp new file mode 100644 index 0000000..cc7f5a1 --- /dev/null +++ b/src/IntMainFrame.cpp @@ -0,0 +1,57 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet InternetFrame class +/*@file: IntInternetFrame.cpp + *@brief: Internet Frame + */ + +#include "IntMainFrame.h" +#include "IntSceneRegister.h" + +using namespace Tizen::Base; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; + +MainFrame::MainFrame(void) +{ +// SetBackgroundColor(Tizen::Graphics::Color(255,255,255)); +} + +MainFrame::~MainFrame(void) +{ +} + +result +MainFrame::OnInitializing(void) +{ + result r = E_SUCCESS; + + // SceneManagement initializing + SceneRegister::RegisterAllScenes(); + + + return r; +} + +result +MainFrame::OnTerminating(void) +{ + result r = E_SUCCESS; + + return r; +} diff --git a/src/IntMultipleWindowForm.cpp b/src/IntMultipleWindowForm.cpp new file mode 100644 index 0000000..133968c --- /dev/null +++ b/src/IntMultipleWindowForm.cpp @@ -0,0 +1,611 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet MultipleWindowForm class +/*@file: MultipleWindowForm.cpp + *@brief: The MultipleWindowForm provides multiple instance of mainscenes and displays them in a Listview + * + */ + +#include +#include + +#include "IntCommonLib.h" +#include "IntConfirmationPopup.h" +#include "IntMainForm.h" +#include "IntMultipleWindowForm.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntSceneRegister.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + + +MultipleWindowForm::MultipleWindowForm(void) +: __pList(null) +, __pListIconImage(null) +, __pListDeleteImage(null) +{ +} + +MultipleWindowForm::~MultipleWindowForm(void) +{ + if (__pListIconImage) + { + delete __pListIconImage; + __pListIconImage = null; + } + if (__pListDeleteImage) + { + delete __pListDeleteImage; + __pListDeleteImage = null; + } +} + +bool +MultipleWindowForm::Initialize(void) +{ + result r = E_SUCCESS; + + r = Construct(L"IDL_MULTIPLE_WINDOW"); + if (r == E_SUCCESS) + { + return true; + } + else + { + return false; + } +} + +result +MultipleWindowForm::OnInitializing(void) +{ + result r = E_SUCCESS; + FooterItem closeButton; + FooterItem newButton; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return E_FAILURE; + } + + Footer* pFooter = GetFooter(); + + if (pFooter == NULL) + { + return E_FAILURE; + } + + SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER); + + r = pSceneManager->AddSceneEventListener(IDSCN_MULTIPLE_WINDOW, *this); + + // Setup back event listener + SetFormBackEventListener(this); + pFooter->AddActionEventListener(*this); + + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + + if (pAppResource) + { + __pListIconImage = pAppResource->GetBitmapN(L"ListIcon.png"); + __pListDeleteImage = pAppResource->GetBitmapN(L"deleteIcon.png"); + } + + __pList = static_cast< ListView* >(GetControl(L"IDC_LISTVIEW")); + + if (__pList != null) + { + __pList->SetItemProvider(*this); + __pList->AddListViewItemEventListener(*this); + } + + AddOrientationEventListener(*this); +// r = pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); + r = closeButton.Construct(IDA_BUTTON_CLOSEALL); + r = closeButton.SetText(CommonUtil::GetString(L"IDS_BR_CLOSE_ALL")); + r = pFooter->AddItem(closeButton); + r = newButton.Construct(IDA_BUTTON_NEW); + r = newButton.SetText(CommonUtil::GetString(L"IDS_BR_SK1_NEW_WINDOW")); + r = pFooter->AddItem(newButton); + + return r; +} + +void +MultipleWindowForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + if (MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9) + { + GetFooter()->SetItemEnabled(1,false); + } + else + { + GetFooter()->SetItemEnabled(1,true); + } + if (__pList) + { + __pList->UpdateList(); + } + GetFooter()->Invalidate(true); + return; +} + +void +MultipleWindowForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + if (__pListIconImage) + { + delete __pListIconImage; + __pListIconImage = NULL; + } + return; +} + +result +MultipleWindowForm::OnTerminating(void) +{ + result r = E_SUCCESS; + + if (__pListIconImage) + { + delete __pListIconImage; + __pListIconImage = NULL; + } + if (__pListDeleteImage) + { + delete __pListDeleteImage; + __pListDeleteImage = NULL; + } + + return r; +} + +void +MultipleWindowForm::OnActionPerformed(const Control& source, int actionId) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return; + } + + String closeWarning = CommonUtil::GetString(L"IDS_BR_CLOSE_ALL_WINDOWS_Q"); + + switch (actionId) + { + case IDA_BUTTON_NEW: + { + WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(); + + if (pNewWindowInfo == null) + { + return; + } + result r = E_SUCCESS; + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == NULL) + { + return; + } + ArrayList* pArgList = new(std::nothrow) ArrayList(); + if (pArgList == NULL) + { + return; + } + pArgList->Construct(); + + pArgList->Add(*pNewWindowInfo); + r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList); + if (pArgList != null) + { + delete pArgList; + pArgList = null; + } + if(IsFailed(r)) + { + AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r)); + return; + } + } + break; + + case IDA_BUTTON_BACK: + { + String* pSelectedScene = NULL; + Object* value = NULL; + MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value); + pSelectedScene = (String*) value; + + if (pSelectedScene) + { + result r = pSceneManager->GoBackward(BackwardSceneTransition(*pSelectedScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE)); + delete pSelectedScene; + pSelectedScene = null; + if(IsFailed(r)) + { + AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r)); + return; + } + } + } + break; + + case IDA_BUTTON_CLOSEALL: + { + __pConfirmationPopup = new(std::nothrow) ConfirmationPopup(); + __pConfirmationPopup->Initialize(); + __pConfirmationPopup->RemoveActionListener(*this); + __pConfirmationPopup->AddActionListener(*this); + __pConfirmationPopup->setMessage(closeWarning); + __pConfirmationPopup->Show(); + + } + break; + case IDA_CONFIRMATION_NO: + { + __pConfirmationPopup->SetShowState(false); + __pConfirmationPopup->Show(); + } + break; + case IDA_CONFIRMATION_YES: + { + ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList(); + if (pAllWindowList == NULL) + { + return; + } + int totalCount = pAllWindowList->GetCount(); + + for (int count = 0; count < totalCount; count++) + { + WindowInfo* pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count)); + SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID); + } + pAllWindowList->RemoveAll(true); + WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewScene(); + + if (pNewWindowInfo == null) + { + return; + } + result r = E_SUCCESS; + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == NULL) + { + return; + } + ArrayList* pArgList = new(std::nothrow) ArrayList(); + if (pArgList == NULL) + { + return; + } + r = pArgList->Construct(); + if (r == E_SUCCESS) + { + pArgList->Add(*pNewWindowInfo); + result r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList); + if (pArgList != null) + { + delete pArgList; + pArgList = null; + } + if(IsFailed(r)) + { + AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r)); + return; + } + } + __pConfirmationPopup->SetShowState(false); + __pConfirmationPopup->Show(); + } + break; + default: + break; + } + +} + +void +MultipleWindowForm::OnFormBackRequested(Form& source) +{ + + String* pSelectedScene = NULL; + Object* value = NULL; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + + MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value); + pSelectedScene = (String*) value; + if (pSelectedScene != NULL) + { + result r = pSceneManager->GoBackward(BackwardSceneTransition(*pSelectedScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE)); +// delete pSelectedScene; + if(IsFailed(r)) + { + AppLogDebug("MultipleWindowForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r)); + return; + } + } + return; +} + +void +MultipleWindowForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state) +{ + return; +} + +void +MultipleWindowForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status) +{ + result r = E_SUCCESS; + ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList(); + int count = 0; + + if (elementId == IDA_FORMAT_DELETE_BITMAP) + { + // get current scene ID and check if it is matching with deleted scene id + WindowInfo* pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(index)); + String* pSelectedScene = NULL; + Object* pValue = NULL; + + if (pWindowInfo) + { + SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID); + MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue); + pSelectedScene = (String*) pValue; + pAllWindowList->RemoveAt(index, true); + if (pSelectedScene->CompareTo(pWindowInfo->sceneID) == 0) + { + //set current scene id to last scene id + int totalCount = pAllWindowList->GetCount() - 1; + WindowInfo* pLastIndexWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(totalCount)); + if (pLastIndexWindowInfo != NULL) + { + String* pSelectedSceneID = new(std::nothrow) String(pLastIndexWindowInfo->sceneID); + if (pSelectedSceneID != NULL) + { + MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, (Object*) pSelectedSceneID); + + } + } + } + } + + count = MultipleWindowPresentationModel::GetInstance()->GetInstance()->GetAllWindowArrayList()->GetCount(); + + if (count >= 9) + { + GetFooter()->SetItemEnabled(1,false); + } + else + { + GetFooter()->SetItemEnabled(1,true); + } + + if ( count <= 1) + { + GetFooter()->SetItemEnabled(0,false); + } + + GetFooter()->Invalidate(true); + __pList->RefreshList(index, LIST_REFRESH_TYPE_ITEM_REMOVE); + __pList->UpdateList(); + } + else if(elementId == IDA_FORMAT_BITMAP || elementId == IDA_FORMAT_TITLE_STRING + || elementId == IDA_FORMAT_URL_STRING || elementId == -1) + { + + // launch the browser + WindowInfo* pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(index)); + if (pWindowInfo == NULL) + { + return; + } + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == NULL) + { + return; + } + ArrayList* pArgList = new(std::nothrow) ArrayList(); + if (pArgList == NULL) + { + return; + } + r = pArgList->Construct(); + if (IsFailed(r)) + { + return; + } + pArgList->Add(*pWindowInfo); + result r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList); + + if (r == E_SUCCESS) + { + AppLogDebug("go forward success"); + } + else + { + AppLogDebug("go forward failed"); + } + if (pArgList != null) + { + delete pArgList; + pArgList = null; + } + + } + + return; +} + +void +MultipleWindowForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction) +{ + return; +} + +void +MultipleWindowForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) +{ + return; +} + +ListItemBase* +MultipleWindowForm::CreateItem(int index, int itemWidth) +{ + Rectangle listImageRect; + Rectangle pagetTitleRect; + Rectangle pageURLRect; + Rectangle deleteImageRect; + String pageTitle(L""); + String pageURL(L""); + result r = E_SUCCESS; + int width = 72; + + AppResource* pAppResource = Application::GetInstance()->GetAppResource(); + ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; + ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList(); + + if (pAllWindowList == null) + { + return null; + } + WindowInfo* pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(index)); + if(pWindowInfo == null) + { + return NULL; + } + CustomItem* pItem = new(std::nothrow) CustomItem(); + pageTitle = pWindowInfo->pageTitle; + pageURL = pWindowInfo->pageUrl; + if (pageURL.GetLength() == 0) + { + String nourl; + pAppResource->GetString(L"IDS_BR_BODY_ABOUT_C_BLANK", nourl); + pageURL = L"<"+ nourl +">"; + } + + Rectangle screenBounds = GetBounds(); + r = pItem->Construct(Dimension(itemWidth, 128), style); + if (IsFailed(r)) + { + return NULL; + } + + if (pWindowInfo->pFavicon) + { + + if( __pListIconImage != NULL) + { + delete __pListIconImage; + __pListIconImage = null; + } + + __pListIconImage = new Bitmap(); + __pListIconImage->Construct(*(pWindowInfo->pFavicon),Rectangle(0,0,pWindowInfo->pFavicon->GetWidth(),pWindowInfo->pFavicon->GetHeight())); + } + else + { + if( __pListIconImage != NULL) + { + delete __pListIconImage; + __pListIconImage = null; + } + + __pListIconImage = pAppResource->GetBitmapN(L"I01_icon_default_favicon.png"); + } + AppLog("deleteimg %d %d",__pListDeleteImage->GetWidth(),__pListDeleteImage->GetHeight()); + + listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28,width, 72); + pagetTitleRect.SetBounds(listImageRect.x + width + 16,10, screenBounds.width - 2 * width - 64, 60); + pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * width - 120, 48); + deleteImageRect.SetBounds(screenBounds.width - __pListDeleteImage->GetWidth() - 24, (128 - __pListDeleteImage->GetHeight() - 8)/2, __pListDeleteImage->GetWidth() + 8, __pListDeleteImage->GetHeight() + 8); + pItem->AddElement(listImageRect, IDA_FORMAT_BITMAP, *__pListIconImage, null, null); + + if (pageTitle.CompareTo(L"") != 0) + { + pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, pageTitle, 44, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, true); + } + + if (pageURL.CompareTo(L"") != 0) + { + pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true); + } + + if (pAllWindowList) + { + if (pAllWindowList->GetCount() > 1) + { + pItem->AddElement(deleteImageRect, IDA_FORMAT_DELETE_BITMAP, *__pListDeleteImage, null, null); + pItem->SetElementSelectionEnabled(IDA_FORMAT_DELETE_BITMAP, true); + } + } + return pItem; +} + +bool +MultipleWindowForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth) +{ + delete pItem; + pItem = null; + return true; +} + +int +MultipleWindowForm::GetItemCount(void) +{ + ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList(); + int windowCount = 0; + + if (pAllWindowList != null) + { + windowCount = pAllWindowList->GetCount(); + } + if (windowCount < 2) + { + GetFooter()->SetItemEnabled(0, false); + } + else + { + GetFooter()->SetItemEnabled(0, true); + } + GetFooter()->Invalidate(true); + return windowCount; +} + +void +MultipleWindowForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) +{ + if (__pList) + { + __pList->UpdateList(); + } +} diff --git a/src/IntMultipleWindowPresentationModel.cpp b/src/IntMultipleWindowPresentationModel.cpp new file mode 100644 index 0000000..4b7afb6 --- /dev/null +++ b/src/IntMultipleWindowPresentationModel.cpp @@ -0,0 +1,261 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet MultipleWindowScene class +/*@file: IntMultipleWindowScene.cpp + *@brief: The MultipleWindowScene provides multiple instance of mainscenes and displays them in a Listview + * + */ +#include + +#include "IntCommonLib.h" +#include "IntMultipleWindowPresentationModel.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +MultipleWindowPresentationModel* MultipleWindowPresentationModel::__pMultiWindowManager = NULL; +ArrayList* MultipleWindowPresentationModel::__pAllWindowList = NULL; +HashMapT< Key, Object* > MultipleWindowPresentationModel::__keyAndValues; +int WindowInfo::__windowId = 0; +String MultipleWindowPresentationModel::__currentSceneId = L"" ; +WindowInfo* MultipleWindowPresentationModel::__pCurWindowInfo = null; +Bitmap* WindowInfo::pFormCanvasBitmap = null; + +WindowInfo::WindowInfo(void) +{ + __windowId++; + ID = __windowId; + sceneID.Clear(); + sceneID.Append(IDSCN_MAIN_VIEW); + sceneID.Append(ID); + formID.Clear(); + formID.Append(IDL_FORM_MAIN_VIEW_SCENE); + formID.Append(ID); + isAppcontrolTriggered = false; + isJavascriptInitiated = false; + faviconFilePath = ""; + faviconUrl = ""; + pageUrl = L""; + pFavicon = FaviconManager::GetInstance()->GetDefaultFaviconN(); + pCurrentWeb = null; + pWebCanvasBitmap = null; + pFormCanvasBitmap = null; +} + +WindowInfo::~WindowInfo(void) +{ +// if ( pFavicon != NULL) +// { +// delete pFavicon; +// pFavicon = null; +// } +} + +MultipleWindowPresentationModel::MultipleWindowPresentationModel(void) +{ + +} + +MultipleWindowPresentationModel::~MultipleWindowPresentationModel(void) +{ + if (__pAllWindowList) + { + delete __pAllWindowList; + __pAllWindowList = NULL; + } + __keyAndValues.RemoveAll(); +} + +void +MultipleWindowPresentationModel::CreateInstance(void) +{ + if (__pMultiWindowManager == NULL) + { + __pMultiWindowManager = new(std::nothrow) MultipleWindowPresentationModel(); + result r = __pMultiWindowManager->Construct(); + if(IsFailed(r)) + { + delete __pMultiWindowManager; + __pMultiWindowManager = null; + } + } +} + +MultipleWindowPresentationModel* +MultipleWindowPresentationModel::GetInstance(void) +{ + if (__pMultiWindowManager == NULL) + { + CreateInstance(); + } + return __pMultiWindowManager; +} + + +void +MultipleWindowPresentationModel::DestroyInstance(void) +{ + if (__pMultiWindowManager) + { + delete __pMultiWindowManager; + __pMultiWindowManager = null; + } +} + +result +MultipleWindowPresentationModel::Construct(void) +{ + result r = E_SUCCESS; + __pAllWindowList = new(std::nothrow) ArrayList(); + r = __pAllWindowList->Construct(); + if(IsFailed(r)) + { + return r; + } + r = __keyAndValues.Construct(); + if(IsFailed(r)) + { + return r; + } + return E_SUCCESS; +} + +void +MultipleWindowPresentationModel::UnInitialize(void) +{ + AppLogDebug(" MultiWindowManager::Denitialize"); + return; +} + +result +MultipleWindowPresentationModel::AddWindoInfo(WindowInfo* pWindowInfo) +{ + result r = E_FAILURE; + + if (pWindowInfo != NULL) + { + r = __pAllWindowList->Add(*pWindowInfo); + } + + return r; +} + +ArrayList* +MultipleWindowPresentationModel::GetAllWindowArrayList(void) +{ + return __pAllWindowList; +} + +result +MultipleWindowPresentationModel::GetValue(Key key, Object** value) +{ + result r = E_FAILURE; + bool containKey = false; + + AppLogDebug("Workspace::GetValue"); + r = __keyAndValues.ContainsKey(key, containKey); + TryCatch(!IsFailed(r),,"ContainsKey failed %s",GetErrorMessage(r)); + + if (containKey == true) + r = __keyAndValues.GetValue(key, *value); + + CATCH: + return r; +} + +result +MultipleWindowPresentationModel::SetValue(Key key, Object* value) +{ + result r = E_FAILURE; + bool containKey = false; + + r = __keyAndValues.ContainsKey(key, containKey); + TryCatch(!IsFailed(r),,"ContainsKey failed %s",GetErrorMessage(r)); + + if (containKey == false) + r = __keyAndValues.Add(key, value); + else + r = __keyAndValues.SetValue(key, value); + + CATCH: + return r; +} + +WindowInfo* +MultipleWindowPresentationModel::CreateNewMainViewScene(const String& Url, bool isAppControlTriggered) +{ + + if (GetInstance()->GetAllWindowArrayList()->GetCount() >= 9) + { + return null; + } + WindowInfo* pWindowInfo = new(std::nothrow) WindowInfo(); + if (pWindowInfo == NULL) + { + return null; + } + pWindowInfo->pageTitle = CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK"); + pWindowInfo->pageUrl = Url; + pWindowInfo->isAppcontrolTriggered = isAppControlTriggered; + MultipleWindowPresentationModel::GetInstance()->AddWindoInfo(pWindowInfo); + SceneRegister::RegisterNewMainView(pWindowInfo->sceneID, pWindowInfo->formID); + + return pWindowInfo; +} + + +void +MultipleWindowPresentationModel::SetCurrentSceneID(const String& currentSceneId) +{ + + __currentSceneId.Clear(); + __currentSceneId.Append(currentSceneId); + for (int index = 0; index < GetInstance()->GetAllWindowArrayList()->GetCount(); index ++) + { + WindowInfo* pWindowInfo = static_cast< WindowInfo* >(GetInstance()->GetAllWindowArrayList()->GetAt(index)); + + if ( pWindowInfo == NULL ) + { + return; + } + + if (pWindowInfo->sceneID.CompareTo(__currentSceneId) == 0) + { + __pCurWindowInfo = pWindowInfo; + } + } + + return ; +} + +void +MultipleWindowPresentationModel::GetCurrentSceneId(String& currentSceneId) +{ + currentSceneId = __currentSceneId; + return ; +} + +WindowInfo* +MultipleWindowPresentationModel::GetActiveWindowInfo() +{ + return __pCurWindowInfo; +} + diff --git a/src/IntNotificationPanel.cpp b/src/IntNotificationPanel.cpp new file mode 100644 index 0000000..a8778a4 --- /dev/null +++ b/src/IntNotificationPanel.cpp @@ -0,0 +1,114 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +// !Internet +/*@file: IntNotification.cpp + *@brief: This defines the behaviour of the Notification Class + * + */ + +#include +#include + +#include "IntNotificationPanel.h" +#include "IntSceneRegister.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + + +NotificationPanel::NotificationPanel(Form& aForm) +:__pTimer(null) +,__pLabel(null) +,__form(aForm) +,__position(0) +{ + Construct("IDL_NOTIFICATION_PANEL"); +} + +NotificationPanel::~NotificationPanel() +{ + if (__pTimer) + { + __pTimer->Cancel(); + delete __pTimer; + } +} + +void +NotificationPanel::SetText(Tizen::Base::String& message) +{ + __pLabel = static_cast(GetControl(L"IDC_NOTIFICATION_LABEL")); + if (__pLabel == null) + { + return; + } + __pLabel->SetText(message); +} + +void +NotificationPanel::OnTimerExpired(Tizen::Base::Runtime::Timer& timer) +{ + SetShowState(false); + Invalidate(true); +} + +void +NotificationPanel::ShowNotification(void) +{ + SceneManager* pSceneManager = null; + if ( __pLabel != NULL) + { + AddControl(*__pLabel); + __pLabel->SetBackgroundColor(CUSTOM_COLOR_INFO_LABEL); + } + __form.AddControl(*this); + + SceneId sceneId = pSceneManager->GetInstance()->GetCurrentSceneId(); + + if (sceneId == IDSCN_EDIT_HISTORY_LIST || sceneId == IDSCN_EDIT_BOOKMARK_LIST /*|| sceneId == IDSCN_SETTINGS*/) + { + SetPosition(0,__form.GetClientAreaBounds().height - GetHeight()); + SetSize(__form.GetWidth(),GetHeight()); + } + else + { + // Since there is a footer panel for the Main form need to subtract __position which is equal to footer panel height. + SetPosition(0,__form.GetClientAreaBounds().height -__position - GetHeight()); + } + Invalidate(true); + + __pTimer = new (std::nothrow) Timer; + if (__pTimer != NULL) + { + __pTimer->Construct(*this); + __pTimer->Start(2000); + } + +} + +void +NotificationPanel::SetPositionDiff(int pos) +{ + __position = pos ; +} diff --git a/src/IntPresentationModelBase.cpp b/src/IntPresentationModelBase.cpp new file mode 100644 index 0000000..be8a44c --- /dev/null +++ b/src/IntPresentationModelBase.cpp @@ -0,0 +1,595 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntPresentationModelBase.cpp + *@brief: Defines the database/storage functions. + */ + +#include +#include + +#include "IntPresentationModelBase.h" +#include "IntTypes.h" + +const wchar_t* BOOKMARK_URL_TABLE = L"Bookmark"; +const wchar_t* BOOKMARK_FOLDER_TABLE = L"BookmarkFolder"; +const wchar_t* HISTORY_DATA_TABLE = L"HistoryData"; + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Io; +using namespace Tizen::Locales; +using namespace Tizen::System; + +Database* PresentationModelBase::__pDataBase = null; +DbEnumerator* PresentationModelBase::__pDbEnum = null; +DbStatement* PresentationModelBase::__pDbStatement = null; +bool PresentationModelBase::__isBeginTransaction = false; + +String PresentationModelBase::DB_FILE_PATH = L"/data/bookmark.db" ; +const int PresentationModelBase::MAX_DB_QUERY_SIZE = 21474836; +const int PresentationModelBase::QUERY_TYPE_LENGTH = 6; + +PresentationModelBase::PresentationModelBase(void) +{ + +} + +PresentationModelBase::~PresentationModelBase(void) +{ + +} + +result +PresentationModelBase::Initialize(void) +{ + result r = E_FAILURE; + + r = PresentationModelBase::OpenDb(); + + return r; +} + +result +PresentationModelBase::UnInitialize(void) +{ + result r = E_FAILURE; + + r = PresentationModelBase::CloseDb(); + + return r; +} + +result +PresentationModelBase::OpenDb(void) +{ + result r = E_FAILURE; + + if (__pDataBase != null) + { + if (__pDbEnum != null) + { + delete __pDbEnum; + __pDbEnum = null; + } + if (__pDbStatement != null) + { + delete __pDbStatement; + __pDbStatement = null; + } + return r; + } + __pDataBase = new(std::nothrow) Database(); + if (null == __pDataBase) + { + return E_OUT_OF_MEMORY; + } + String dbName = App::GetInstance()->GetAppRootPath() + DB_FILE_PATH; + + r = __pDataBase->Construct(dbName, true); + if (IsFailed(r)) + { + AppLogDebug("DB construction failed:%s", GetErrorMessage(r)); + delete __pDataBase; + __pDataBase = null; + return r; + } + __isBeginTransaction = false; + if (File::IsFileExist(dbName)) + { + r = InitializeDBTables(); + if (IsFailed(r)) + { + delete __pDataBase; + __pDataBase = null; + return r; + } + } + return r; +} + +result +PresentationModelBase::CloseDb(void) +{ + if (__pDbEnum != null) + { + delete __pDbEnum; + __pDbEnum = null; + } + if (__pDbStatement != null) + { + delete __pDbStatement; + __pDbStatement = null; + } + if (__pDataBase != null) + { + delete __pDataBase; + __pDataBase = null; + } + + __isBeginTransaction = false; + + return E_SUCCESS; +} + +result +PresentationModelBase::CreateDBTables(BrowserDbTableTypes tableType) +{ + result r = E_FAILURE; + String query; + int resultCount = -1; + + switch (tableType) + { + case DB_TYPE_BOOKMARKURLS: + { + query.Append(L"CREATE TABLE IF NOT EXISTS "); + query.Append(BOOKMARK_URL_TABLE); + query.Append(L" ( ID INTEGER PRIMARY KEY AUTOINCREMENT, TITLE TEXT, URL TEXT, PARENT_BOOKMARK_ID INTEGER DEFAULT -1, CREATED_TIME DATETIME, MODIFIED_TIME DATETIME, ICON_PATH TEXT, FAVICON_ID INTEGER)"); + break; + } + case DB_TYPE_BOOKMARKFOLDERS: + { + query.Append(L"CREATE TABLE IF NOT EXISTS "); + query.Append(BOOKMARK_FOLDER_TABLE); + query.Append(L" ( ID INTEGER PRIMARY KEY AUTOINCREMENT, TITLE TEXT, CREATED_TIME DATETIME, MODIFIED_TIME DATETIME)"); + break; + } + + case DB_TYPE_HISTORYDATA: + { + query.Append(L"CREATE TABLE IF NOT EXISTS "); + query.Append(HISTORY_DATA_TABLE); + query.Append(L" ( ID INTEGER PRIMARY KEY AUTOINCREMENT, TITLE TEXT, URL TEXT, VISITED_TIME DATETIME, ICON_PATH TEXT, FAVICON_ID INTEGER, THUMBNAIL_PATH TEXT)"); + break; + } + + case DB_TYPE_FAVICON: + { + query.Append(L"CREATE TABLE IF NOT EXISTS FaviconData ( ID INTEGER PRIMARY KEY AUTOINCREMENT, URL TEXT, FILE_PATH TEXT )"); + break; + } + + default: + { + AppLogDebug("PresentationModelBase::CreateDBTables: Table Type:%d is invalid", tableType); + break; + } + + } + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch(!IsFailed(r),,"PresentationModelBase::CreateDBTables query failed %s",GetErrorMessage(r)); + + CATCH: return r; +} + +result +PresentationModelBase::InitializeDBTables(void) +{ + result r = E_FAILURE; + + for (register int nDbTblIndex = DB_TYPE_INVALID + 1; nDbTblIndex < DB_TYPE_MAX; nDbTblIndex++) + { + r = CreateDBTables((BrowserDbTableTypes) nDbTblIndex); + TryCatch(!IsFailed(r),,"PresentationModelBase::InitializeDBTables failed %s",GetErrorMessage(r)); + } + + CATCH: return r; +} + +result +PresentationModelBase::DropDBTables(void) +{ + result r = E_FAILURE; + String query; + int resultCount = -1; + + for (register int tableIndex = DB_TYPE_INVALID + 1; tableIndex < DB_TYPE_MAX; tableIndex++) + { + switch (tableIndex) + { + case DB_TYPE_BOOKMARKURLS: + { + query.Clear(); + query.Format(MAX_DB_QUERY_SIZE, L"DROP TABLE IF EXISTS Bookmark"); + break; + } + case DB_TYPE_BOOKMARKFOLDERS: + { + query.Clear(); + query.Format(MAX_DB_QUERY_SIZE, L"DROP TABLE IF EXISTS BookmarkFolder"); + break; + } + + case DB_TYPE_HISTORYDATA: + { + query.Clear(); + query.Format(MAX_DB_QUERY_SIZE, L"DROP TABLE IF EXISTS HistoryData"); + break; + } + + case DB_TYPE_FAVICON: + { + query.Clear(); + query.Format(MAX_DB_QUERY_SIZE, L"DROP TABLE IF EXISTS FaviconData"); + break; + } + + default: + { + AppLogDebug("PresentationModelBase::CreateDBTables: Table Type:%d is invalid", tableIndex); + break; + } + + } + + r = PresentationModelBase::ExecuteQuery(query, resultCount); + TryCatch( !IsFailed(r),,"PresentationModelBase::DropDBTables query failed %s",GetErrorMessage(r)); + } + + CATCH: return r; +} + +result +PresentationModelBase::ExecuteQuery(const String& formatQuery, int& count) +{ + AppLogDebug("Query: %ls", formatQuery.GetPointer()); + + result r = E_FAILURE; + String queryType; + + if (__pDataBase == null) + { + return E_INIT_FAILED; + } + + if (__pDbEnum != null) + { + delete __pDbEnum; + __pDbEnum = null; + } + + if (__pDbStatement != null) + { + delete __pDbStatement; + __pDbStatement = null; + } + + +#if defined(FBK_DB_QUERY_LOG) + { + File file; + file.Construct(L"/Home/Query.txt", "a+", true); + file.Write(formatQuery); + file.Write(String("\r\n")); + } +#endif + + r = formatQuery.SubString(0, QUERY_TYPE_LENGTH, queryType); + if (r == E_SUCCESS) + { + if (queryType == "SELECT") + { + __pDbEnum = __pDataBase->QueryN(formatQuery); + r = GetLastResult(); + if (IsFailed(r)) + { + AppLogException("Failed Database::QueryN(). (error: %s, query: %ls)", GetErrorMessage(r), formatQuery.GetPointer()); + return r; + } + count = 0; + + if (__pDbEnum != null) + { + while (__pDbEnum->MoveNext() == E_SUCCESS) + { + count++; + } + __pDbEnum->Reset(); + } + + } + else + { + if (__isBeginTransaction == false && + (queryType == L"INSERT" || queryType == L"UPDATE" || queryType == L"DELETE")) + { + r = __pDataBase->BeginTransaction(); + if (IsFailed(r)) + { + AppLogException("Failed Database::BeginTransaction() . (error: %s)", GetErrorMessage(r)); + return r; + } + + __isBeginTransaction = true; + } + + r = __pDataBase->ExecuteSql(formatQuery, false); + if (IsFailed(r)) + { + AppLogException("Failed Database::ExecuteSql(). (error: %s, query: %ls)", GetErrorMessage(r), formatQuery.GetPointer()); + return r; + } + count = 0; + } + } + + return r; +} + +result +PresentationModelBase::DbIsNextRowPresent(bool& nextRowpresent) +{ + result r = E_FAILURE; + + if (null == __pDataBase || null == __pDbEnum) + { + if (__pDbEnum == null) + { + AppLogException("PresentationModelBase : pdbenum is null"); + } + if (__pDataBase == null) + { + AppLogException("PresentationModelBase : __pDataBase is null"); + } + return E_OUT_OF_MEMORY; + } + r = __pDbEnum->MoveNext(); + if (IsFailed(r)) + { + nextRowpresent = false; + return r; + } + nextRowpresent = true; + return r; +} + +result +PresentationModelBase::IsNullColumn(int index, bool& isColumNull) +{ + if (null == __pDataBase || null == __pDbEnum) + { + return E_DATABASE; + } + isColumNull = (__pDbEnum->GetColumnType(index) == DB_COLUMNTYPE_NULL ? true : false); + + return E_SUCCESS; +} + +result +PresentationModelBase::GetColumn(int index, String& stringValue) +{ + result r = E_FAILURE; + DbColumnType columnType; + + if (null == __pDataBase || null == __pDbEnum) + { + return E_OUT_OF_MEMORY; + } + // Find column type + columnType = __pDbEnum->GetColumnType(index); + + //if column type is null then assign empty string and return + if (columnType == DB_COLUMNTYPE_NULL) + { + stringValue = ""; + return E_SUCCESS; + } + //Get String value + r = __pDbEnum->GetStringAt(index, stringValue); + if (IsFailed(r)) + { + AppLogDebug("GetStringAt: Failed"); + return r; + } + return r; +} + +result +PresentationModelBase::GetColumn(int index, int& intValue) +{ + result r = E_FAILURE; + DbColumnType columnType; + + if (null == __pDataBase || null == __pDbEnum) + { + return E_OUT_OF_MEMORY; + } + // Find column type + columnType = __pDbEnum->GetColumnType(index); + + //if column type is null then assign empty string and return + if (columnType == DB_COLUMNTYPE_NULL) + { + intValue = 0; + return E_SUCCESS; + } + //Get String value + r = __pDbEnum->GetIntAt(index, intValue); + TryCatch(!IsFailed(r),,"GetIntAt:failed %s",GetErrorMessage(r)); + + CATCH: + return r; +} + +result +PresentationModelBase::GetColumn(int index, DateTime& dateValue) +{ + result r = E_FAILURE; + DbColumnType nType; + + if (null == __pDataBase || null == __pDbEnum) + { + AppLogDebug("__pDataBase or __pDbEnum is null"); + return E_OUT_OF_MEMORY; + } + // Find column type + nType = __pDbEnum->GetColumnType(index); + //if column type is null then assign empty string and return + if (nType == DB_COLUMNTYPE_NULL) + { + return E_SUCCESS; + } + //Get String value + r = __pDbEnum->GetDateTimeAt(index, dateValue); + if (IsFailed(r)) + { + AppLogDebug("GetDateTimeAt: Failed"); + return r; + } + + return r; +} + +result +PresentationModelBase::GetColumn(int index, double& doubleValue) +{ + result r = E_FAILURE; + DbColumnType columnType; + + if (null == __pDataBase || null == __pDbEnum) + { + return E_OUT_OF_MEMORY; + } + // Find column type + columnType = __pDbEnum->GetColumnType(index); + + //if column type is null then assign empty string and return + if (columnType == DB_COLUMNTYPE_NULL) + { + doubleValue = 0.0; + return E_SUCCESS; + } + //Get String value + r = __pDbEnum->GetDoubleAt(index, doubleValue); + if (IsFailed(r)) + { + AppLogDebug("GetDateTimeAt: Failed"); + return r; + } + + return r; +} + +result +PresentationModelBase::RollbackDb() +{ + result r = E_FAILURE; + + if (__pDataBase != null && __isBeginTransaction == true) + { + r = __pDataBase->RollbackTransaction(); + if (IsFailed(r)) + { + return r; + } + __isBeginTransaction = false; + } + return r; +} + +result +PresentationModelBase::CommitDb() +{ + + result r = E_FAILURE; + + if (__pDataBase != null && __isBeginTransaction == true) + { + r = __pDataBase->CommitTransaction(); + TryCatch(!IsFailed(r),,"PresentationModelBase::Commit Transaction:failed %s",GetErrorMessage(r)); + + __isBeginTransaction = false; + } + + CATCH: + return r; +} + +result +PresentationModelBase::GetLastInsertedId(String& tableName, int& rowId) +{ + String query; + result r = E_FAILURE; + int count = -1; + bool nextRowpresent = false; + + query.Append(L"SELECT last_insert_rowid() FROM "); + query.Append(tableName); + + r = PresentationModelBase::ExecuteQuery(query, count); + TryCatch(!IsFailed(r),,"PresentationModelBase::GetLastInsertedId query failed %s",GetErrorMessage(r)); + + r = PresentationModelBase::DbIsNextRowPresent(nextRowpresent); + + if (nextRowpresent == true) + { + r = PresentationModelBase::GetColumn(0, rowId); + if (IsFailed(r)) + { + AppLogDebug("PresentationModelBase::GetLstInsertedId -(%s)\n", GetErrorMessage(r)); + return r; + } + } + CATCH: return r; +} + +bool +PresentationModelBase::GetCurrentDateTime(DateTime& dt) +{ + DateTime dtNow; + LocaleManager localManager; + result r = E_FAILURE; + TimeZone tz; + + r = SystemTime::GetCurrentTime(UTC_TIME, dtNow); + if (IsFailed(r)) + { + return false; + } + localManager.Construct(); + tz = localManager.GetSystemTimeZone(); + dt = tz.UtcTimeToWallTime(dtNow); + + return true; +} + + diff --git a/src/IntRadioCustomItem.cpp b/src/IntRadioCustomItem.cpp new file mode 100644 index 0000000..8376786 --- /dev/null +++ b/src/IntRadioCustomItem.cpp @@ -0,0 +1,120 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet RadioCustomItem class +/*@file: RadioCustomItem.cpp + *@brief: The RadioCustomItem + */ +#include +#include + +#include "IntRadioCustomItem.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; + +static const wchar_t* IDB_BUTTON_RADIO_PRESS2 = L"00_button_radio_selected.png"; +static const wchar_t* IDB_BUTTON_RADIO_PRESS1 = L"00_button_radio.png"; + +const int RadioCustomItem::IDA_FORMAT_STRING = 500; +const int RadioCustomItem::IDA_FORMAT_RADIO_BUTTON = 501; + +RadioCustomItem::RadioCustomItem(void) +{ + __width = 0; + __height = 0; + __text = L""; + __isSelected = false; +} + +RadioCustomItem::~RadioCustomItem(void) +{ + +} + +result +RadioCustomItem::Construct(int width, int height) +{ + result r = E_FAILURE; + + __width = width; + __height = height; + const Dimension dim(width, height); + r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL); + + return r; +} + +void +RadioCustomItem::SetText(Tizen::Base::String& text) +{ + __text = text; +} + +String +RadioCustomItem::GetText(void) +{ + return __text; +} + +result +RadioCustomItem::Make(void) +{ + result r = E_FAILURE; + Color textColor = CUSTOM_COLOR_LISTVIEW_TEXT2; + Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT; + Bitmap* pBitmap = null; + + if (__isSelected == true) + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_RADIO_PRESS2); + } + else + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_RADIO_PRESS1); + } + + if ( pBitmap != NULL) + { + AddElement(Rectangle(26, (__height-pBitmap->GetHeight())/2, pBitmap->GetWidth(), pBitmap->GetHeight()), IDA_FORMAT_RADIO_BUTTON, *pBitmap, null); + AppLogDebug("RadioCustomItem::the text is %ls",__text.GetPointer()); + + r = AddElement(Rectangle(26 + pBitmap->GetWidth() + 10, 5, __width - 26 - 10 - pBitmap->GetWidth(), __height), IDA_FORMAT_STRING, __text, 40, textColor, textColor, textColor, true); + delete pBitmap; + } + TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r)); + + r = SetElementSelectionEnabled(IDA_FORMAT_STRING, true); + TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r)); + + CATCH: + return r; +} + +void +RadioCustomItem::SetSelected(bool selectedValue) +{ + __isSelected = selectedValue; +} + +bool +RadioCustomItem::GetSelected(void) +{ + return __isSelected; +} diff --git a/src/IntReaderFontSizeForm.cpp b/src/IntReaderFontSizeForm.cpp new file mode 100644 index 0000000..0e50df2 --- /dev/null +++ b/src/IntReaderFontSizeForm.cpp @@ -0,0 +1,163 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet IntFontSize class +/*@file: IntFontSize.cpp + *@brief: This class defines IntFontSize used to change the font size + * + */ + +#include +#include + +#include "IntCommonLib.h" +#include "IntReaderFontSizeForm.h" +#include "IntSceneRegister.h" +#include "IntSettingPresentationModel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + + +ReaderFontSizeForm::ReaderFontSizeForm(void) +{ + __pFontSlider = null; + __pFontValue = null; +} + +ReaderFontSizeForm::~ReaderFontSizeForm(void) +{ + +} + +bool +ReaderFontSizeForm::Initialize(void) +{ + Form::Construct(L"IDL_FONT_SIZE"); + + return true; +} + +result +ReaderFontSizeForm::OnInitializing(void) +{ + result r = E_SUCCESS; + + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager != null) + { + r = pSceneManager->AddSceneEventListener(IDSCN_FONT_SIZE, *this); + TryCatch(!IsFailed(r),,"AddSceneEventListener failed with error %s",GetErrorMessage(r)); + } + + SetFormBackEventListener(this); + + r = GetHeader()->SetTitleText(CommonUtil::GetString(L"IDS_BR_BODY_FONT_SIZE")); + TryCatch(!IsFailed(r),,"OnInitialized failed with %s",GetErrorMessage(r)); + + __pFontSlider = static_cast< Slider* >(GetControl( + L"IDC_FONT_SLIDER", true)); + if (__pFontSlider == null) + { + return E_FAILURE; + } + __pFontSlider->AddSliderEventListener(*this); + + r = __pFontSlider->SetBounds(Rectangle(0, 10, GetClientAreaBounds().width, 120)); + TryCatch(!IsFailed(r),,"OnInitialized failed with %s",GetErrorMessage(r)); + + r = __pFontSlider->SetRange(10, 30); + TryCatch(!IsFailed(r),,"OnInitialized failed with %s",GetErrorMessage(r)); + + GetFooter()->AddActionEventListener(*this); + + CATCH: + return r; +} + +void +ReaderFontSizeForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + __pFontValue = dynamic_cast(pArgs->GetAt(0)); + + if (__pFontValue == null) + { + return; + } + + if (__pFontSlider != null && __pFontValue != null) + { + __pFontSlider->SetValue(__pFontValue->ToInt()); + } + return; +} + +void +ReaderFontSizeForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + return; +} + +void +ReaderFontSizeForm::OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value) +{ + *__pFontValue = value; + return; +} + +void +ReaderFontSizeForm::OnFormBackRequested(Form& source) +{ + result r = E_FAILURE; + SceneManager* pSceneManager = SceneManager::GetInstance(); + ArrayList *pArgList = new(std::nothrow) ArrayList(); + + if (pArgList != null) + { + r = pArgList->Construct(); + TryCatch(!IsFailed(r),,"OnFormBackRequested failed with %s",GetErrorMessage(r)); + + SettingPresentationModel::GetInstance()->SetReaderFontSize(__pFontValue->ToInt()); + TryCatch(!IsFailed(r),,"OnFormBackRequested failed with %s",GetErrorMessage(r)); + + if (pSceneManager != null) + { + r = pSceneManager->GoBackward(BackwardSceneTransition()); + TryCatch(!IsFailed(r), "ReaderFontSizeForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r)); + } + } + + CATCH: + + if( pArgList != NULL) + { + delete pArgList; + } + + return; +} + +void +ReaderFontSizeForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + +} diff --git a/src/IntSceneRegister.cpp b/src/IntSceneRegister.cpp new file mode 100644 index 0000000..bb924f8 --- /dev/null +++ b/src/IntSceneRegister.cpp @@ -0,0 +1,127 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntSceneRegister.cpp + *@brief: This header file contains the declarations of the %lsceneRegister class. + * + */ + +#include + +#include "IntSceneRegister.h" +#include "IntFormFactory.h" + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Ui::Scenes; + +const wchar_t* IDSCN_MAIN_VIEW = L"ScnMainMenu"; +const wchar_t* IDSCN_BOOKMARK_VIEW = L"ScnBookmark"; +const wchar_t* IDSCN_HISTORY_LIST = L"ScnHistory"; +const wchar_t* IDSCN_FIND_WORD = L"ScnFindWord"; +const wchar_t* IDSCN_EDIT_HISTORY_LIST = L"ScnEditHistory"; +const wchar_t* IDSCN_SETTINGS_CLEAR_PRIVATE_DATA = L"ScnSettingsClearPrivateData"; +const wchar_t* IDSCN_MULTIPLE_WINDOW = L"ScnMultipleWindow"; +const wchar_t* IDSCN_MULTIPLE_WINDOW_GRID = L"ScnMultipleWindowGrid"; +const wchar_t* IDSCN_SETTINGS = L"ScnSettings"; +const wchar_t* IDSCN_ADD_BOOKMARK = L"ScnAddBookmark"; +const wchar_t* IDSCN_ARTICLE_READER = L"ScnArticleReader"; +const wchar_t* IDSCN_EDIT_BOOKMARK_LIST = L"ScnEditBookmarkList"; +const wchar_t* IDSCN_CREATE_BOOKMARK_FOLDER = L"ScnCreateBookmarkFolder"; +const wchar_t* IDSCN_FONT_SIZE = L"ScnFontSize"; +const wchar_t* IDSCN_EDIT_HOMEPAGE_VIEW = L"ScnEditHomePage"; +const wchar_t* IDSCN_BRIGHTNESS = L"ScnBrightness"; + +SceneRegister::SceneRegister(void) +{ + +} + +SceneRegister::~SceneRegister(void) +{ + +} + +void +SceneRegister::RegisterAllScenes(void) +{ + static const wchar_t* PANEL_BLANK = L""; + static FormFactory formFactory; + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return; + } + pSceneManager->RegisterFormFactory(formFactory); + + pSceneManager->RegisterScene(IDSCN_BOOKMARK_VIEW, IDL_FORM_BOOKMARK_LIST_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_HISTORY_LIST, IDL_FORM_HISTORY_LIST_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_FIND_WORD, IDL_FORM_FIND_WORD_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_EDIT_HISTORY_LIST, IDL_FORM_EDIT_HISTORY_LIST_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_SETTINGS_CLEAR_PRIVATE_DATA, IDL_FORM_SETTINGS_CLEAR_PRIVATE_DATA_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_MULTIPLE_WINDOW, IDL_FORM_MULTIPLE_WINDOW_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_SETTINGS, IDL_FORM_SETTINGS_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_ADD_BOOKMARK, IDL_FORM_ADD_BOOKMARK_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_ARTICLE_READER, IDL_FORM_ARTICLE_READER_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_EDIT_BOOKMARK_LIST, IDL_FORM_EDIT_BOOKMARK_LIST_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_CREATE_BOOKMARK_FOLDER, IDL_FORM_CREATE_BOOKMARK_FOLDER_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_FONT_SIZE, IDL_FORM_FONT_SIZE_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_EDIT_HOMEPAGE_VIEW, IDL_FORM_EDIT_HOME_PAGE_SCENE, PANEL_BLANK); + pSceneManager->RegisterScene(IDSCN_BRIGHTNESS, IDL_FORM_BRIGHTNESS_SCENE, PANEL_BLANK); +} + +result +SceneRegister::RegisterNewMainView(const Tizen::Base::String& sceneID, const Tizen::Base::String& FormID) +{ + result r = E_SUCCESS; + static const wchar_t* PANEL_BLANK = L""; + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return E_FAILURE; + } + + r = pSceneManager->RegisterScene(sceneID, FormID, PANEL_BLANK); + + if (GetLastResult() != E_SUCCESS) + { + AppLogDebug("fail Not registered"); + } + else + { + AppLogDebug("success registered"); + } + return r; +} + +result +SceneRegister::DestroyAndUnRegisterScene(const String& sceneID) +{ + result r = E_SUCCESS; + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return E_FAILURE; + } + pSceneManager->UnregisterScene(sceneID); + pSceneManager->DestroyScene(sceneID); + return r; +} diff --git a/src/IntSettingClearPrivateDataForm.cpp b/src/IntSettingClearPrivateDataForm.cpp new file mode 100644 index 0000000..ebed252 --- /dev/null +++ b/src/IntSettingClearPrivateDataForm.cpp @@ -0,0 +1,338 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet SettingsClearPrivateDataForm class +/*@file: IntSettingsClearPrivateDataForm.cpp + *@brief: The SettingsClearPrivateDataForm used to create private data scene + * + */ + +#include +#include +#include "IntSettingClearPrivateDataForm.h" +#include "IntSceneRegister.h" +#include "IntHistoryPresentationModel.h" +#include "IntSettingPresentationModel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +const int SettingsClearPrivateDataForm::IDA_FORMAT_TITLE_STRING = 101; +const int SettingsClearPrivateDataForm::IDA_BUTTON_DELETE = 102; +const int SettingsClearPrivateDataForm::IDA_BUTTON_CANCEL = 103; + +SettingsClearPrivateDataForm::SettingsClearPrivateDataForm() + : __pList(null) + , __clearItem(5) +{ +} + +SettingsClearPrivateDataForm::~SettingsClearPrivateDataForm() +{ +} + +bool +SettingsClearPrivateDataForm::Initialize(void) +{ + Construct(L"IDL_SETTINGS_CLEAR_PRIVATE_DATA"); + //SetBackgroundColor(Color::GetColor(COLOR_ID_BLACK)); + return true; +} + +result +SettingsClearPrivateDataForm::OnInitializing(void) +{ + result r = E_SUCCESS; + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return E_FAILURE; + } + + Footer* pFooter = GetFooter(); + + if ( pFooter == null) + { + return E_FAILURE; + } + FooterItem deleteButton; + FooterItem cancelButton; + + SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER); + + r = pSceneManager->AddSceneEventListener(IDSCN_SETTINGS_CLEAR_PRIVATE_DATA, *this); + + // Setup back event listener + SetFormBackEventListener(this); + pFooter->AddActionEventListener(*this); + + __pList = static_cast< ListView* >(GetControl(L"IDC_CLEAR_LISTVIEW")); + if (__pList != null) + { + __pList->SetItemProvider(*this); + __pList->AddListViewItemEventListener(*this); + } + + AddOrientationEventListener(*this); + + pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON); + deleteButton.Construct(IDA_BUTTON_DELETE); + deleteButton.SetText(L"Delete"); + + pFooter->AddItem(deleteButton); + cancelButton.Construct(IDA_BUTTON_CANCEL); + cancelButton.SetText(L"Cancel"); + + pFooter->AddItem(cancelButton); + pFooter->SetItemEnabled(0, false); + return r; +} + +result +SettingsClearPrivateDataForm::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +void +SettingsClearPrivateDataForm::OnActionPerformed(const Control& source, int actionId) +{ + Footer* pFooter = GetFooter(); + if ( pFooter == NULL ) + { + return; + } + + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + switch (actionId) + { + case IDA_BUTTON_DELETE: + { + AppLog("Delete button is called"); + if (__pList) + { + if (__pList->IsItemChecked(0) || __pList->IsItemChecked(1) || __pList->IsItemChecked(2) || __pList->IsItemChecked(3) || __pList->IsItemChecked(4)) + { + pFooter->SetItemEnabled(0, true); + pFooter->Invalidate(true); + + // Delete the specific index setting + if (__pList->IsItemChecked(0) == true) + { + // clear all private data + AppLog("Clear all private data"); + HistoryPresentationModel::GetInstance()->ClearHistory(); + SettingPresentationModel::GetInstance()->ClearCache(); + SettingPresentationModel::GetInstance()->ClearCookie(); + } + if (__pList->IsItemChecked(1) == true) + { + // clear History + AppLog("Clear all History data"); + HistoryPresentationModel::GetInstance()->ClearHistory(); + } + if (__pList->IsItemChecked(2) == true) + { + // clear cache + AppLog("Clear all cache data"); + SettingPresentationModel::GetInstance()->ClearCache(); + } + if (__pList->IsItemChecked(3) == true) + { + // clear cookie + AppLog("Clear all cookie data"); + SettingPresentationModel::GetInstance()->ClearCookie(); + } + else if (__pList->IsItemChecked(4) == true) + { + // clear saved ID and password + AppLog("Clear saved ID and password"); + } + } + else + { + pFooter->SetItemEnabled(0, false); + pFooter->Invalidate(true); + } + } + SceneManager::GetInstance()->GoBackward(BackwardSceneTransition()); + } + break; + + case IDA_BUTTON_CANCEL: + { + AppLog("cancel button is called"); + SceneManager::GetInstance()->GoBackward(BackwardSceneTransition()); + } + break; + + default: + break; + } +} + +void +SettingsClearPrivateDataForm::OnFormBackRequested(Form& source) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_SETTINGS, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT)); +} + +void +SettingsClearPrivateDataForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) +{ + if (__pList) + { + __pList->UpdateList(); + } + return; +} + +void +SettingsClearPrivateDataForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + return; +} + +void +SettingsClearPrivateDataForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state) +{ + return; +} + +void +SettingsClearPrivateDataForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status) +{ + + bool checkstatus = __pList->IsItemChecked(index); + + if (index == 0) + { + if (!checkstatus) + { + __pList->SetItemChecked(0, false); + __pList->SetItemChecked(1, false); + __pList->SetItemChecked(2, false); + __pList->SetItemChecked(3, false); + __pList->SetItemChecked(4, false); + } + else + { + __pList->SetItemChecked(0, true); + __pList->SetItemChecked(1, true); + __pList->SetItemChecked(2, true); + __pList->SetItemChecked(3, true); + __pList->SetItemChecked(4, true); + } + } + if (__pList->IsItemChecked(0) || __pList->IsItemChecked(1) || __pList->IsItemChecked(2) || __pList->IsItemChecked(3) || __pList->IsItemChecked(4)) + { + GetFooter()->SetItemEnabled(0, true); + GetFooter()->Invalidate(true); + } + else + { + GetFooter()->SetItemEnabled(0, false); + GetFooter()->Invalidate(true); + } + return; +} + +void +SettingsClearPrivateDataForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction) +{ + return; +} + +void +SettingsClearPrivateDataForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) +{ + return; +} + +ListItemBase* +SettingsClearPrivateDataForm::CreateItem(int index, int itemWidth) +{ + Rectangle pagetTitleRect; + CustomItem* pItem = new(std::nothrow) CustomItem(); + ListAnnexStyle style = LIST_ANNEX_STYLE_MARK; + pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style); + Rectangle screenBounds = GetBounds(); + + pagetTitleRect.SetBounds(screenBounds.x + 15, 38, screenBounds.width - 10, 40); + + if (index == 0) + { + pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, L"Select all", 38, Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), true); + } + else if (index == 1) + { + pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, L"History", 38, Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), true); + } + else if (index == 2) + { + pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, L"Cache", 38, Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), true); + } + else if (index == 3) + { + pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, L"Cookie", 38, Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), true); + } + else if (index == 4) + { + pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, L"Saved ID and password", 38, Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), Color::GetColor(COLOR_ID_BLACK), true); + } + + return pItem; +} + +bool +SettingsClearPrivateDataForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth) +{ + delete pItem; + pItem = null; + return true; +} + +int +SettingsClearPrivateDataForm::GetItemCount(void) +{ + return __clearItem; +} + +void +SettingsClearPrivateDataForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) +{ + if (__pList) + { + __pList->UpdateList(); + } + return; +} diff --git a/src/IntSettingForm.cpp b/src/IntSettingForm.cpp new file mode 100644 index 0000000..704e39a --- /dev/null +++ b/src/IntSettingForm.cpp @@ -0,0 +1,996 @@ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet SettingForm class +/*@file: IntSettingForm.cpp + *@brief: The SettingForm + */ + +#include +#include +#include + +#include "IntCommonLib.h" +#include "IntConfirmationPopup.h" +#include "IntDefaultCustomItem.h" +#include "IntDropDownCustomItem.h" +#include "IntHistoryPresentationModel.h" +#include "IntMultipleWindowPresentationModel.h" +#include "IntNotificationPanel.h" +#include "IntRadioCustomItem.h" +#include "IntSceneRegister.h" +#include "IntSettingForm.h" +#include "IntSettingPresentationModel.h" +#include "IntSettingToggleCustomItem.h" + + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +//static const int IDA_CONFIRMATION_NO = 1000; +//static const int IDA_CONFIRMATION_YES = 1001; + +static const wchar_t* IDB_EDIT_BACKGROUND = L"EditBackground.png"; + +SettingForm::SettingForm(void) +: __fontValue(0),__pResetPopup(null),__pWindowInfo(null) , __pConfirmationPopup(null) +{ + __currentURL = L""; + __pList = null; + InitializeSettingValues(); +} + +SettingForm::~SettingForm(void) +{ + if (pGroupItemCount) + { + delete[] pGroupItemCount; + pGroupItemCount = null; + } +} + +void +SettingForm::InitializeSettingValues(void) +{ + AppLog("SettingForm::InitializeSettingValues homepage %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer()); + groupCount = 5; + pGroupItemCount = new(std::nothrow) int[5]; + pGroupItemCount[0] = 5; //Homepage + pGroupItemCount[1] = 6; //Page content settings + pGroupItemCount[2] = 5; //Private and Security + pGroupItemCount[3] = 4; //Search + pGroupItemCount[4] = 1; //Website settings and Reset + + for (int iter = (int) SETTING_INVALID + 1; iter < (int) SETTING_MAX; iter++) + { + settingInfo[iter].isSelected = false; + } + + AppLogDebug("image display %d", (int) SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled()); + settingInfo[SETTING_HOMEPAGE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE"); + settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage(); + settingInfo[SETTING_HOMEPAGE_TITLE].itemType = ITEM_TYPE_DROPDOWN; + + settingInfo[SETTING_CURRENT_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CURRENT_PAGE"); + settingInfo[SETTING_CURRENT_PAGE].subText = L""; + settingInfo[SETTING_CURRENT_PAGE].itemType = ITEM_TYPE_RADIO; + + settingInfo[SETTING_BLANK_PAGE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE"); + settingInfo[SETTING_BLANK_PAGE].subText = L""; + settingInfo[SETTING_BLANK_PAGE].itemType = ITEM_TYPE_RADIO; + if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE")) == 0) + { + settingInfo[SETTING_BLANK_PAGE].isSelected = true; + } + + settingInfo[SETTING_MOST_VISITED_SITE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES"); + settingInfo[SETTING_MOST_VISITED_SITE].subText = L""; + settingInfo[SETTING_MOST_VISITED_SITE].itemType = ITEM_TYPE_RADIO; + if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0) + { + settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true; + } + WindowInfo* pWindowInfo = null; + String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl(); + AppLog("SettingForm::OnSceneActivatedN check1"); + + settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org"; + if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0) + { + SettingPresentationModel::GetInstance()->SetFavoriteValue(L"http://www.tizen.org"); + } + settingInfo[SETTING_FAVORITE_URL].subText = L""; + settingInfo[SETTING_FAVORITE_URL].itemType = ITEM_TYPE_RADIO; + + if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE")) == 0) + { + settingInfo[SETTING_FAVORITE_URL].isSelected = true; + } + + settingInfo[SETTING_DEFAULT_VIEW_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_DEFAULT_VIEW"); + settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText = SettingPresentationModel::GetInstance()->GetDefaultView(); + settingInfo[SETTING_DEFAULT_VIEW_TITLE].itemType = ITEM_TYPE_DROPDOWN; + + settingInfo[SETTING_FIT_TO_WIDTH].titleText = CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH"); + settingInfo[SETTING_FIT_TO_WIDTH].subText = L""; + settingInfo[SETTING_FIT_TO_WIDTH].itemType = ITEM_TYPE_RADIO; + settingInfo[SETTING_FIT_TO_WIDTH].isSelected = !(String::Compare(settingInfo[SETTING_FIT_TO_WIDTH].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText)); + + settingInfo[SETTING_READABLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_READABLE"); + settingInfo[SETTING_READABLE].subText = L""; + settingInfo[SETTING_READABLE].itemType = ITEM_TYPE_RADIO; + settingInfo[SETTING_READABLE].isSelected = !(String::Compare(settingInfo[SETTING_READABLE].titleText, settingInfo[SETTING_DEFAULT_VIEW_TITLE].subText)); + + settingInfo[SETTING_RUN_JAVASCRIPT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RUN_JAVASCRIPT"); + settingInfo[SETTING_RUN_JAVASCRIPT].subText = L""; + settingInfo[SETTING_RUN_JAVASCRIPT].itemType = ITEM_TYPE_TOGGLE; + settingInfo[SETTING_RUN_JAVASCRIPT].isSelected = SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled(); + + settingInfo[SETTING_DISPLAY_IMAGES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_DISPLAY_IMAGES"); + settingInfo[SETTING_DISPLAY_IMAGES].subText = L""; + settingInfo[SETTING_DISPLAY_IMAGES].itemType = ITEM_TYPE_TOGGLE; + settingInfo[SETTING_DISPLAY_IMAGES].isSelected = SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled(); + + settingInfo[SETTING_BLOCK_POPUP].titleText = CommonUtil::GetString(L"IDS_BR_BODY_BLOCK_POP_UPS_ABB"); + settingInfo[SETTING_BLOCK_POPUP].subText = L""; + settingInfo[SETTING_BLOCK_POPUP].itemType = ITEM_TYPE_TOGGLE; + settingInfo[SETTING_BLOCK_POPUP].isSelected = !SettingPresentationModel::GetInstance()->IsBlockPopUp(); + + settingInfo[SETTING_CLEAR_CACHE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_CACHE"); + settingInfo[SETTING_CLEAR_CACHE].subText = L""; + settingInfo[SETTING_CLEAR_CACHE].itemType = ITEM_TYPE_NORMAL; + + settingInfo[SETTING_CLEAR_HISTORY].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_HISTORY"); + settingInfo[SETTING_CLEAR_HISTORY].subText = L""; + settingInfo[SETTING_CLEAR_HISTORY].itemType = ITEM_TYPE_NORMAL; + + settingInfo[SETTING_SHOW_SECURITY_WARNINGS].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SHOW_SECURITY_WARNINGS"); + settingInfo[SETTING_SHOW_SECURITY_WARNINGS].subText = L""; + settingInfo[SETTING_SHOW_SECURITY_WARNINGS].itemType = ITEM_TYPE_TOGGLE; + settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected = SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled(); + + settingInfo[SETTING_ACCEPT_COOKIES].titleText = CommonUtil::GetString(L"IDS_BR_BODY_ACCEPT_COOKIES"); + settingInfo[SETTING_ACCEPT_COOKIES].subText = L""; + settingInfo[SETTING_ACCEPT_COOKIES].itemType = ITEM_TYPE_TOGGLE; + settingInfo[SETTING_ACCEPT_COOKIES].isSelected = SettingPresentationModel::GetInstance()->IsCookiesEnabled(); + + settingInfo[SETTING_CLEAR_COOKIE_DATA].titleText = CommonUtil::GetString(L"IDS_BR_BODY_CLEAR_ALL_COOKIE_DATA"); + settingInfo[SETTING_CLEAR_COOKIE_DATA].subText = CommonUtil::GetString(L"IDS_BR_HEADER_COOKIES"); + settingInfo[SETTING_CLEAR_COOKIE_DATA].itemType = ITEM_TYPE_NORMAL; + + settingInfo[SETTING_SEARCH_ENGINE_TITLE].titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_ENGINE"); + settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText = SettingPresentationModel::GetInstance()->GetSearchEngine(); + settingInfo[SETTING_SEARCH_ENGINE_TITLE].itemType = ITEM_TYPE_DROPDOWN; + + settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText = CommonUtil::GetString(L"IDS_BR_BODY_YAHOO"); + settingInfo[SETTING_SEARCH_ENGINE_YAHOO].subText = L""; + settingInfo[SETTING_SEARCH_ENGINE_YAHOO].itemType = ITEM_TYPE_RADIO; + settingInfo[SETTING_SEARCH_ENGINE_YAHOO].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText)); + + settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText = CommonUtil::GetString(L"IDS_BR_BODY_NAVER"); + settingInfo[SETTING_SEARCH_ENGINE_NAVER].subText = L""; + settingInfo[SETTING_SEARCH_ENGINE_NAVER].itemType = ITEM_TYPE_RADIO; + settingInfo[SETTING_SEARCH_ENGINE_NAVER].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText)); + + settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText = CommonUtil::GetString(L"IDS_COM_BODY_GOOGLE"); + settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].subText = L""; + settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].itemType = ITEM_TYPE_RADIO; + settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].isSelected = !(String::Compare(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText, settingInfo[SETTING_SEARCH_ENGINE_TITLE].subText)); + + settingInfo[SETTING_RESET_TO_DEFAULT].titleText = CommonUtil::GetString(L"IDS_BR_BODY_RESET_TO_DEFAULT"); + settingInfo[SETTING_RESET_TO_DEFAULT].subText = L""; + settingInfo[SETTING_RESET_TO_DEFAULT].itemType = ITEM_TYPE_NORMAL; +} + +bool +SettingForm::Initialize(void) +{ + result r = E_FAILURE; + + r = Construct(L"IDL_SETTING_FORM"); + if (IsFailed(r)) + { + return false; + } + return true; +} + +result +SettingForm::OnInitializing(void) +{ + result r = E_FAILURE; + Footer* pFooter = NULL; + SceneManager* pSceneManager = NULL; + + __pList = static_cast< GroupedListView* >(GetControl(L"IDC_SETTING_LIST")); + if ( __pList != NULL ) + { + + r = __pList->SetItemProvider(*this); + TryCatch(!IsFailed(r),,"setItemProvider failed with error %s",GetErrorMessage(r)); + __pList->AddGroupedListViewItemEventListener(*this); + } + + pFooter = GetFooter(); + if (pFooter) + { + AppLogDebug("setting back button"); + pFooter->SetBackButtonEnabled(true); + SetFormBackEventListener(this); + } + pSceneManager = SceneManager::GetInstance(); + if (pSceneManager != null) + { + r = pSceneManager->AddSceneEventListener(IDSCN_SETTINGS, *this); + TryCatch(!IsFailed(r),,"AddSceneEventListener failed with error %s",GetErrorMessage(r)); + } + AddOrientationEventListener(*this); + + CATCH: + return r; +} + +void +SettingForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status) +{ + +} + +void +SettingForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status) +{ + int effectiveIndex = 0; + SettingPresentationModel* pSettingMgr = SettingPresentationModel::GetInstance(); + + if (pSettingMgr == null) + return; + + for (int i = 0; i < groupIndex; i++) + effectiveIndex = effectiveIndex + pGroupItemCount[i]; + effectiveIndex = effectiveIndex + itemIndex; + + if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN) + { + AppLogDebug("refreshing data child count is %d", settingInfo[effectiveIndex].childCount); + if (settingInfo[effectiveIndex].isOpen == false) + { + settingInfo[effectiveIndex].isOpen = true; + settingInfo[effectiveIndex].childCount = 0; + for (int iter = effectiveIndex + 1; iter < SETTING_MAX; iter++) + { + if (settingInfo[iter].itemType == ITEM_TYPE_RADIO) + settingInfo[effectiveIndex].childCount++; + else + break; + } + listView.UpdateList(); + } + else + { + settingInfo[effectiveIndex].isOpen = false; + listView.UpdateList(); + } + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO) + { + int parentIndex = 0; + for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--) + { + if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN) + break; + } + settingInfo[parentIndex].subText = settingInfo[effectiveIndex].titleText; + + for (int iter = 0; iter < settingInfo[parentIndex].childCount; iter++) + { + if (parentIndex + iter + 1 != effectiveIndex) + { + AppLogDebug("long effectiveIndex %d set to false", itemIndex - (effectiveIndex - parentIndex) + iter + 1); + settingInfo[parentIndex + iter + 1].isSelected = false; + } + else + { + AppLogDebug("effectiveIndex %d set to true", effectiveIndex); + settingInfo[effectiveIndex].isSelected = true; + } + if (effectiveIndex == SETTING_CURRENT_PAGE) + { + settingInfo[SETTING_CURRENT_PAGE].isSelected = false; + settingInfo[SETTING_FAVORITE_URL].isSelected = true; + } + //listView.RefreshList(groupIndex, itemIndex - (effectiveIndex - parentIndex) + iter + 1, LIST_REFRESH_TYPE_ITEM_MODIFY); + } +// listView.UpdateList(); + //listView.ScrollToItem(groupIndex, itemIndex, LIST_SCROLL_ITEM_ALIGNMENT_TOP); + Invalidate(true); + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE) + { + if (settingInfo[effectiveIndex].isSelected == true) + { + settingInfo[effectiveIndex].isSelected = false; + } + else + { + settingInfo[effectiveIndex].isSelected = true; + } +// listView.RefreshList(groupIndex, itemIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); + if(__pList != null) + { + __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected); + } + } + + switch (effectiveIndex) + { + case SETTING_CURRENT_PAGE: + //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText); + AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer()); + if (__currentURL.CompareTo(L"") != 0) + { + AppLog("setting current page currentURL is =%ls",__currentURL.GetPointer()); + SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE")); + SettingPresentationModel::GetInstance()->SetFavoriteValue(__currentURL); + settingInfo[SETTING_FAVORITE_URL].titleText = __currentURL; +// listView.RefreshList(groupIndex, effectiveIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); + listView.UpdateList(); + } + break; + case SETTING_BLANK_PAGE: + //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_BLANK_PAGE].titleText); + SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE")); + AppLog("GetHomepage() %ls",SettingPresentationModel::GetInstance()->GetHomepage().GetPointer()); + listView.UpdateList(); + + break; + case SETTING_MOST_VISITED_SITE: + SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_MOST_VISITED_SITE].titleText); + listView.UpdateList(); + break; + + case SETTING_FAVORITE_URL: + //SettingPresentationModel::GetInstance()->SetHomepage(settingInfo[SETTING_FAVORITE_URL].titleText); + SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EDIT_HOMEPAGE_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)); + break; + + case SETTING_FIT_TO_WIDTH: + SettingPresentationModel::GetInstance()->SetDefaultView(settingInfo[SETTING_FIT_TO_WIDTH].titleText); + listView.UpdateList(); + break; + + case SETTING_READABLE: + SettingPresentationModel::GetInstance()->SetDefaultView(settingInfo[SETTING_READABLE].titleText); + listView.UpdateList(); + break; + + case SETTING_RUN_JAVASCRIPT: + SettingPresentationModel::GetInstance()->SetRunJavascriptEnabled(settingInfo[SETTING_RUN_JAVASCRIPT].isSelected); + break; + + case SETTING_DISPLAY_IMAGES: + SettingPresentationModel::GetInstance()->SetDisplayImagesEnabled(settingInfo[SETTING_DISPLAY_IMAGES].isSelected); + break; + + case SETTING_BLOCK_POPUP: + SettingPresentationModel::GetInstance()->SetBlockPopUp(!settingInfo[SETTING_BLOCK_POPUP].isSelected); + break; + + case SETTING_CLEAR_CACHE: + ClearCache(); + break; + + case SETTING_CLEAR_HISTORY: + ClearHistory(); + break; + + case SETTING_SHOW_SECURITY_WARNINGS: + SettingPresentationModel::GetInstance()->SetSecurityWarningsEnabled(settingInfo[SETTING_SHOW_SECURITY_WARNINGS].isSelected); + break; + + case SETTING_ACCEPT_COOKIES: + SettingPresentationModel::GetInstance()->SetCookiesEnabled(settingInfo[SETTING_ACCEPT_COOKIES].isSelected); + break; + + case SETTING_CLEAR_COOKIE_DATA: + ClearCookie(); + break; + + case SETTING_SEARCH_ENGINE_YAHOO: + SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_YAHOO].titleText); + listView.UpdateList(); + break; + + case SETTING_SEARCH_ENGINE_NAVER: + SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_NAVER].titleText); + listView.UpdateList(); + break; + + case SETTING_SEARCH_ENGINE_GOOGLE: + SettingPresentationModel::GetInstance()->SetSearchEngine(settingInfo[SETTING_SEARCH_ENGINE_GOOGLE].titleText); + listView.UpdateList(); + break; + + case SETTING_RESET_TO_DEFAULT: + //OpenResetPopup(); + ResetToDefault(); + break; + + default: + break; + } +} + +void +SettingForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction) +{ + +} + +GroupItem* +SettingForm::CreateGroupItem(int groupIndex, int itemWidth) +{ + result r = E_FAILURE; + String text(L""); + GroupItem* pItem = null; + const Color ITEM_TEXT_COLOR = CUSTOM_COLOR_SETTINGS_GROUPTITLE; + + pItem = new(std::nothrow) GroupItem(); + if (pItem == null) + { + return null; + } + r = pItem->Construct(Dimension(itemWidth, 46)); + if (IsFailed(r)) + { + delete pItem; + return null; + } + + switch (groupIndex) + { + case 0: + text = CommonUtil::GetString(L"IDS_BR_BODY_HOMEPAGE"); // IDS_HOMEPAGE + settingInfo[SETTING_HOMEPAGE_TITLE].subText = SettingPresentationModel::GetInstance()->GetHomepage(); + break; + + case 1: + text = CommonUtil::GetString(L"IDS_BR_MBODY_PAGE_CONTENT_SETTINGS"); // IDS_BR_MBODY_PAGE_CONTENT_SETTINGS + break; + + case 2: + text = CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"); // IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB + break; + + case 3: + text = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH"); // IDS_BR_BODY_SEARCH + break; + + case 4: + text = L""; + break; + + default: + break; + } + + pItem->SetElement(text, null); + + AppLogDebug("background color set result %s", GetErrorMessage(r)); + + pItem->SetTextColor(ITEM_TEXT_COLOR); + return pItem; +} + +ListItemBase* +SettingForm::CreateItem(int groupIndex, int itemIndex, int itemWidth) +{ + AppLog("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d ", groupIndex, itemIndex, itemWidth); + + result r = E_SUCCESS; + int effectiveIndex = 0; + const Color ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_BACKGROUND; + const Color ITEM_RADIO_ITEM_BACKGROUND_COLOR = CUSTOM_COLOR_SETTINGS_LISTITEM_RADIO_BACKGROUND; + + for (int i = 0; i < groupIndex; i++) + effectiveIndex = effectiveIndex + pGroupItemCount[i]; + effectiveIndex = effectiveIndex + itemIndex; + AppLogDebug("SettingForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex); + + if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE) + { + SettingToggleCustomItem* pItem = new(std::nothrow) SettingToggleCustomItem(); + r = pItem->Construct(itemWidth, 112); + if (IsFailed(r)) + { + delete pItem; + return null; + } +/* + Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112); + Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112); + + if (pNormalBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap); + delete pNormalBackgroundBitmap; + } + + if (pPressedBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap); + delete pPressedBackgroundBitmap; + }*/ + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR); + if(__pList != null) + { + __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected); + } + + pItem->SetText(settingInfo[effectiveIndex].titleText); + + //if (pBitmap != null) + // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null); + + pItem->Make(); +// if (__pList) +// { +// __pList->SetItemChecked(groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected); +// AppLog("asdasda %s %d,%d-> %d",GetErrorMessage(r),groupIndex, itemIndex, settingInfo[effectiveIndex].isSelected); +// } + return pItem; + + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN) + { + DropDownCustomItem* pItem = new(std::nothrow) DropDownCustomItem(); + r = pItem->Construct(itemWidth); + if (IsFailed(r)) + { + delete pItem; + return null; + } + +/* Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,128); + Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112); + + if (pNormalBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap); + delete pNormalBackgroundBitmap; + } + + if (pPressedBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap); + delete pPressedBackgroundBitmap; + }*/ + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR); + + pItem->SetMainText(settingInfo[effectiveIndex].titleText); + pItem->SetSubText(settingInfo[effectiveIndex].subText); + if (settingInfo[effectiveIndex].isOpen) + { + pItem->SetCurState(DROP_DOWN_ITEM_STATE_OPENED); + } + else + { + pItem->SetCurState(DROP_DOWN__ITEM_STATE_CLOSED); + } + r = pItem->Make(); + // if (pBitmap != null) + // pItem->AddElement(Rectangle(0, 0, 10, 128), IDA_LIST_LEFT_SIDE_MARGIN_DROPDOWN, *pBitmap, null); + + if (IsFailed(r)) + { + delete pItem; + return null; + } + + return pItem; + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO) + { + + + RadioCustomItem* pItem = new(std::nothrow) RadioCustomItem(); + int parentIndex = 0; + for (parentIndex = effectiveIndex; parentIndex > SETTING_INVALID; parentIndex--) + { + if (settingInfo[parentIndex].itemType == ITEM_TYPE_DROPDOWN) + break; + } + if (settingInfo[parentIndex].isOpen == false || (__isCurrentPageDisable == true && groupIndex == 0 && itemIndex == 1)) + { + r = pItem->Construct(itemWidth, 0); + AppLogDebug("construct with height 0 %s", GetErrorMessage(r)); + return pItem; + } + else + { + pItem->Construct(itemWidth, 112); + } +/* + Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112); + Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112); + + if (pNormalBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap); + delete pNormalBackgroundBitmap; + } + + if (pPressedBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap); + delete pPressedBackgroundBitmap; + }*/ + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_RADIO_ITEM_BACKGROUND_COLOR); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_RADIO_ITEM_BACKGROUND_COLOR); + + + pItem->SetText(settingInfo[effectiveIndex].titleText); + AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected); + + //if (pBitmap != null) + // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null); + + pItem->SetSelected(settingInfo[effectiveIndex].isSelected); + pItem->Make(); + + return pItem; + } + else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_NORMAL) + { + DefaultCustomItem* pItem = new(std::nothrow) DefaultCustomItem(); + + r = pItem->Construct(itemWidth, 112); + if (IsFailed(r)) + { + delete pItem; + return null; + } + +/* + Bitmap* pNormalBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG9,itemWidth,112); + Bitmap* pPressedBackgroundBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_LIST_GROUP_BG_PRESS9,itemWidth,112); + + if (pNormalBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_NORMAL,pNormalBackgroundBitmap); + delete pNormalBackgroundBitmap; + } + + if (pPressedBackgroundBitmap != NULL) + { + pItem->SetBackgroundBitmap(LIST_ITEM_DRAWING_STATUS_PRESSED,pPressedBackgroundBitmap); + delete pPressedBackgroundBitmap; + }*/ + + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL,ITEM_BACKGROUND_COLOR); + pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_PRESSED,ITEM_BACKGROUND_COLOR); + + pItem->SetText(settingInfo[effectiveIndex].titleText); + + //if (pBitmap != null) + // pItem->AddElement(Rectangle(0, 0, 10, 112), IDA_LIST_LEFT_SIDE_MARGIN, *pBitmap, null); + + r = pItem->Make(); + if (IsFailed(r)) + { + delete pItem; + return null; + } + return pItem; + } + else + { + return null; + } +} + +bool +SettingForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth) +{ + delete pItem; + pItem = null; + return true; +} + +bool +SettingForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth) +{ + delete pItem; + pItem = null; + return true; +} + +int +SettingForm::GetGroupCount(void) +{ + return groupCount; +} + +int +SettingForm::GetItemCount(int groupIndex) +{ + AppLog(" SettingForm::GetItemCount --> groupIndex : %d,", groupIndex); + return pGroupItemCount[groupIndex]; +} + +void +SettingForm::OnFormBackRequested(Form& source) +{ + String* pSelectedScene = NULL; + Object* value = NULL; + MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value); + pSelectedScene = (String*) value; + if (pSelectedScene) + { + SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(*pSelectedScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE)); +// delete pSelectedScene; +// pSelectedScene = null; + } +} + +void +SettingForm::OnActionPerformed(const Control& source, int actionId) +{ + switch (actionId) + { + case IDA_BUTTON_NO: + if(__pConfirmationPopup) + { + __pConfirmationPopup->SetShowState(false); + __pConfirmationPopup->Show(); + delete __pConfirmationPopup; + __pConfirmationPopup = null; + } + break; + + case IDA_BUTTON_YES: + if(__pConfirmationPopup) + { + String message = L""; + __pConfirmationPopup->SetShowState(false); + __pConfirmationPopup->Show(); + if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO")) + { + message = CommonUtil::GetString(L"IDS_BR_POP_DELETED"); + SettingPresentationModel::GetInstance()->ClearCookie(); + } + else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q")) + { + message = CommonUtil::GetString(L"IDS_BR_POP_DELETED"); + SettingPresentationModel::GetInstance()->ClearCache(); + } + else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q")) + { + message = CommonUtil::GetString(L"IDS_BR_POP_DELETED"); + HistoryPresentationModel::GetInstance()->ClearHistory(); + } + else if (__pConfirmationPopup->GetMessage() == CommonUtil::GetString(L"IDS_BR_POP_RESET_ALL_SETTINGS_TO_DEFAULT_Q")) + { + message = CommonUtil::GetString(L"IDS_BR_SK_DONE"); + SettingPresentationModel::GetInstance()->ResetRegistry(); + InitializeSettingValues(); + if(__pList != null) + { + __pList->UpdateList(); + } + } + delete __pConfirmationPopup; + __pConfirmationPopup = null; + + NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this); + pNotification->SetText(message); + pNotification->SetPositionDiff(0); + pNotification->ShowNotification(); + } + break; + + default: + break; + } +} + +void +SettingForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) +{ + Rectangle rect = GetClientAreaBounds(); + if(__pList == null) + { + return; + } + __pList->SetBounds(rect); + __pList->UpdateList(); +} + +SettingForm::SettingItemInfo::SettingItemInfo(void) +{ + titleText = L""; + subText = L""; + childCount = 0; + isOpen = false; + isSelected = false ; +} +void +SettingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) +{ + WindowInfo* pWindowInfo = null; + String curUrl = SettingPresentationModel::GetInstance()->GetFavoriteUrl(); + + pWindowInfo = MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo(); + + if (previousSceneId == IDSCN_EDIT_HOMEPAGE_VIEW) + { + if (pArgs != null) + { + String* pValue = NULL; + pValue = dynamic_cast(pArgs->GetAt(0)); + if( pValue != NULL ) + { + if (pValue->CompareTo(L"Done") == 0) + { + SettingPresentationModel::GetInstance()->SetHomepage(CommonUtil::GetString(L"IDS_BR_BODY_USER_HOMEPAGE")); + } + else if (pValue->CompareTo(L"Cancel") == 0) + { + String homePage = SettingPresentationModel::GetInstance()->GetHomepage(); + if (homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0) + { + settingInfo[SETTING_MOST_VISITED_SITE].isSelected = true; + settingInfo[SETTING_BLANK_PAGE].isSelected = false; + settingInfo[SETTING_CURRENT_PAGE].isSelected = false; + settingInfo[SETTING_FAVORITE_URL].isSelected = false; + + } + else if (homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE")) == 0) + { + settingInfo[SETTING_MOST_VISITED_SITE].isSelected = false; + settingInfo[SETTING_BLANK_PAGE].isSelected = true; + settingInfo[SETTING_CURRENT_PAGE].isSelected = false; + settingInfo[SETTING_FAVORITE_URL].isSelected = false; + } + } + } + } + } + + if (pWindowInfo != null) + { + __currentURL.Clear(); + __currentURL.Append(pWindowInfo->pageUrl); + AppLog("current url is %ls",__currentURL.GetPointer()); + + if (SettingPresentationModel::GetInstance()->GetFavoriteUrl().CompareTo(L"") == 0) + { + if (pWindowInfo->pageUrl.CompareTo(L"") == 0) + { + //settingInfo[SETTING_FAVORITE_URL].titleText = CommonUtil::GetString(L"IDS_SET_HOMEPAGE"); + settingInfo[SETTING_FAVORITE_URL].titleText = L"http://www.tizen.org"; + } + else + { + settingInfo[SETTING_FAVORITE_URL].titleText = pWindowInfo->pageUrl; + } + } + else + { + settingInfo[SETTING_FAVORITE_URL].titleText = SettingPresentationModel::GetInstance()->GetFavoriteUrl(); + } + } + + if (__pList != null) + { + __pList->UpdateList(); + if (pWindowInfo && pWindowInfo->pageUrl.CompareTo(L"") == 0) + { + __isCurrentPageDisable = true; + AppLog("set item enabled is false"); + __pList->SetItemEnabled(0, 1, false); + } + else + { + __isCurrentPageDisable = false; + AppLog("set item enabled is true"); + __pList->SetItemEnabled(0, 1, true); + } + for(int grpindex = 0; grpindex < groupCount; grpindex++) + { + for(int index = 0; index < *(pGroupItemCount+groupCount); index++) + { + int effectiveIndex = 0; + for (int i = 0; i < grpindex; i++) + effectiveIndex = effectiveIndex + pGroupItemCount[i]; + effectiveIndex = effectiveIndex + index; + + if(effectiveIndex >= SETTING_MAX) + { + continue; + } + if(settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE || settingInfo[effectiveIndex].itemType == ITEM_TYPE_RADIO ) + { + __pList->SetItemChecked(grpindex, index, settingInfo[effectiveIndex].isSelected); + } + } + } + } + return; +} + +void +SettingForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId) +{ + return; +} + +void +SettingForm::ClearHistory(void) +{ + String message = CommonUtil::GetString(L"IDS_BR_BODY_DELETE_BROWSER_HISTORY_Q"); + __pConfirmationPopup = new(std::nothrow) ConfirmationPopup(); + __pConfirmationPopup->Initialize(); + __pConfirmationPopup->RemoveActionListener(*this); + __pConfirmationPopup->AddActionListener(*this); + __pConfirmationPopup->setMessage(message); + __pConfirmationPopup->Show(); +} + +void +SettingForm::ClearCache(void) +{ + String message = CommonUtil::GetString(L"IDS_BR_POP_DELETE_LOCALLY_CACHED_CONTENT_AND_DATABASES_Q"); + __pConfirmationPopup = new(std::nothrow) ConfirmationPopup(); + __pConfirmationPopup->Initialize(); + __pConfirmationPopup->RemoveActionListener(*this); + __pConfirmationPopup->AddActionListener(*this); + __pConfirmationPopup->setMessage(message); + __pConfirmationPopup->Show(); +} + +void +SettingForm::ClearCookie(void) +{ + String message = CommonUtil::GetString(L"IDS_BR_POP_EMPTY_COOKIE_POPUP_BNO"); + __pConfirmationPopup = new(std::nothrow) ConfirmationPopup(); + __pConfirmationPopup->Initialize(); + __pConfirmationPopup->RemoveActionListener(*this); + __pConfirmationPopup->AddActionListener(*this); + __pConfirmationPopup->setMessage(message); + __pConfirmationPopup->Show(); +} + +void +SettingForm::ResetToDefault() +{ + String message = CommonUtil::GetString(L"IDS_BR_POP_RESET_ALL_SETTINGS_TO_DEFAULT_Q"); + __pConfirmationPopup = new(std::nothrow) ConfirmationPopup(); + __pConfirmationPopup->Initialize(); + __pConfirmationPopup->RemoveActionListener(*this); + __pConfirmationPopup->AddActionListener(*this); + __pConfirmationPopup->setMessage(message); + __pConfirmationPopup->Show(); +} diff --git a/src/IntSettingPresentationModel.cpp b/src/IntSettingPresentationModel.cpp new file mode 100644 index 0000000..341748b --- /dev/null +++ b/src/IntSettingPresentationModel.cpp @@ -0,0 +1,681 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet +/*@file: IntSettingsPresentationModel.cpp + *@brief: Used to define SettingsManager + */ + +#include +#include "IntCommonLib.h" +#include "IntSettingPresentationModel.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Io; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Web::Controls; + +SettingPresentationModel* SettingPresentationModel::__pSettingsPresentationModel = null; + +SettingPresentationModel::SettingPresentationModel(void) +{ + __listenerList.Construct(); + SetDefaultValues(); + __isPrivateOn = false; +} + +SettingPresentationModel::SettingPresentationModel(const SettingPresentationModel& settingModelObj) +{ + +} + +SettingPresentationModel& SettingPresentationModel::operator=(const SettingPresentationModel& settingModelObj) +{ + return *this; +} + +SettingPresentationModel::~SettingPresentationModel(void) +{ + +} + +void +SettingPresentationModel::SetDefaultValues(void) +{ + //__homePage = CommonUtil::GetString(L"IDS_EMPTY_PAGE"); + __homePage = CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES"); + __defaultViewLevel = CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH"); // IDS_FIT_TO_WIDTH + __runJsEnabled = true; + __displayImages = true; + __html5Videos = true; + __wordWrap = true; + __blockPopUp = true; + __rememberFormData = false; + __rememberPassword = false; + __cookies = true; + __savePassword = CommonUtil::GetString(L"IDS_BR_BODY_ALWAYS_ASK"); // IDS_ALWAYS_ASK + __securityWarnings = true; + __searchEngine = CommonUtil::GetString(L"IDS_BR_BODY_YAHOO"); // L"Yahoo"; + __caseSensitive = false; + __runReader = true; + __fontSize = 24; + + __setting.SetInputStyle(INPUT_STYLE_OVERLAY); + __setting.SetAutoImageLoadEnabled(__displayImages); + __setting.SetJavascriptEnabled(__runJsEnabled); + __setting.SetJavaScriptPopupEnabled(__blockPopUp); + + if (__securityWarnings == true) + { + __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM); + } + else + { + __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE); + } +} + +void +SettingPresentationModel::CreateInstance(void) +{ + if (__pSettingsPresentationModel == null) + __pSettingsPresentationModel = new(std::nothrow) SettingPresentationModel(); + result r = __pSettingsPresentationModel->Construct(); + if (IsFailed(r)) + { + delete __pSettingsPresentationModel; + __pSettingsPresentationModel = null; + return; + } + std::atexit(DestroyInstance); +} + +SettingPresentationModel* +SettingPresentationModel::GetInstance(void) +{ + if (__pSettingsPresentationModel == null) + { + CreateInstance(); + } + return __pSettingsPresentationModel; +} + +void +SettingPresentationModel::DestroyInstance(void) +{ + if (__pSettingsPresentationModel) + { + delete __pSettingsPresentationModel; + __pSettingsPresentationModel = null; + } +} + +result +SettingPresentationModel::LoadRegistry(void) +{ + AppLog("SettingPresentationModel::LoadRegistry entered"); + result r = E_FAILURE; + + SetDefaultValues(); + for (int settingValueName = REGISTRY_SETTING_HOMEPAGE; settingValueName < MAX_REGISTRY_SETTING; settingValueName++) + { + r = AppRegistry::GetInstance()->Get(__entry[settingValueName], __values[settingValueName]); + if (r != E_SUCCESS && r != E_KEY_NOT_FOUND) + { + AppLog("Registry Load failed with result %s settingValueName %d", GetErrorMessage(r),settingValueName); + return r; + } + } + if (__values[REGISTRY_SETTING_HOMEPAGE].CompareTo(L"") != 0) + { + __homePage = __values[REGISTRY_SETTING_HOMEPAGE]; + AppLog("homepage Loading from registry %ls",__homePage.GetPointer()); + } + if (__values[REGISTRY_SETTING_DEFAULT_VIEW].CompareTo(L"") != 0) + { + __defaultViewLevel = __values[REGISTRY_SETTING_DEFAULT_VIEW]; + } + if (__values[REGISTRY_SETTING_RUN_JAVASCRIPT].CompareTo(L"") != 0) + { + __runJsEnabled = Boolean::Parse(__values[REGISTRY_SETTING_RUN_JAVASCRIPT], false); + AppLogDebug("LoadRegistry __runJsEnabled %d",__runJsEnabled); + } + if (__values[REGISTRY_SETTING_DISPLAY_IMAGES].CompareTo(L"") != 0) + { + __displayImages = Boolean::Parse(__values[REGISTRY_SETTING_DISPLAY_IMAGES], false); + AppLogDebug("LoadRegistry __displayImages %d",__displayImages); + } + if (__values[REGISTRY_SETTING_HTML5_VIDEOS].CompareTo(L"") != 0) + { + __html5Videos = Boolean::Parse(__values[REGISTRY_SETTING_HTML5_VIDEOS], false); + AppLogDebug("LoadRegistry __html5Videos %d",__html5Videos); + } + if (__values[REGISTRY_SETTING_WORD_WRAPPING].CompareTo(L"") != 0) + { + __wordWrap = Boolean::Parse(__values[REGISTRY_SETTING_WORD_WRAPPING], false); + AppLogDebug("LoadRegistry __wordWrap %d",__wordWrap); + } + if (__values[REGISTRY_SETTING_BLOCK_POPUP].CompareTo(L"") != 0) + { + __blockPopUp = Boolean::Parse(__values[REGISTRY_SETTING_BLOCK_POPUP], false); + AppLogDebug("LoadRegistry __blockPopUp %d",__blockPopUp); + } + if (__values[REGISTRY_SETTING_ACCEPT_COOKIES].CompareTo(L"") != 0) + { + __cookies = Boolean::Parse(__values[REGISTRY_SETTING_ACCEPT_COOKIES], false); + AppLogDebug("LoadRegistry __cookies %d",__cookies); + } + if (__values[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD].CompareTo(L"") != 0) + { + __savePassword = __values[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD]; + } + if (__values[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS].CompareTo(L"") != 0) + { + __securityWarnings = Boolean::Parse(__values[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS], false); + AppLogDebug("LoadRegistry __securityWarnings %d",__securityWarnings); + } + if (__values[REGISTRY_SETTING_SEARCH_ENGINE].CompareTo(L"") != 0) + { + __searchEngine = __values[REGISTRY_SETTING_SEARCH_ENGINE]; + } + if (__values[REGISTRY_SETTING_CASE_SENSITIVE].CompareTo(L"") != 0) + { + __caseSensitive = Boolean::Parse(__values[REGISTRY_SETTING_CASE_SENSITIVE], false); + AppLogDebug("LoadRegistry __caseSensitive %d",__caseSensitive); + } + if (__values[REGISTRY_SETTING_RUN_READER].CompareTo(L"") != 0) + { + __runReader = Boolean::Parse(__values[REGISTRY_SETTING_RUN_READER], false); + AppLogDebug("LoadRegistry __runReader %d",__runReader); + } + if (__values[REGISTRY_SETTING_READER_FONT_SIZE].CompareTo(L"") != 0) + { + Integer::Parse(__values[REGISTRY_SETTING_READER_FONT_SIZE], (int&)__fontSize); + } + if (__values[REGISTRY_SETTING_REMEMBER_FORM_DATA].CompareTo(L"") != 0) + { + __rememberFormData = Boolean::Parse(__values[REGISTRY_SETTING_REMEMBER_FORM_DATA], false); + AppLogDebug("LoadRegistry form data %d",__rememberFormData); + } + if (__values[REGISTRY_SETTING_REMEMBER_PASSWORD].CompareTo(L"") != 0) + { + __rememberPassword = Boolean::Parse(__values[REGISTRY_SETTING_REMEMBER_PASSWORD], false); + AppLogDebug("LoadRegistry form password %d",__rememberPassword); + } + // + for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++) + { + AppLogDebug("registry loaded value :%ls at index %d", __values[index].GetPointer(), index); + } + __setting.SetInputStyle(INPUT_STYLE_OVERLAY); + __setting.SetAutoImageLoadEnabled(__displayImages); + __setting.SetJavascriptEnabled(__runJsEnabled); + __setting.SetJavaScriptPopupEnabled(__blockPopUp); + + if (__securityWarnings == true) + { + __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM); + } + else + { + __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE); + } + __favouriteURL.Clear(); + __favouriteURL = L""; + r = AppRegistry::GetInstance()->Get(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], __favouriteURL); + AppLog("__favouriteURL taken from registry is %ls",__favouriteURL.GetPointer()); + + if (r != E_SUCCESS && r != E_KEY_NOT_FOUND) + { + AppLogDebug("Registry Load failed with result %s", GetErrorMessage(r)); + return r; + } + + return E_SUCCESS; +} + +result +SettingPresentationModel::ResetRegistry(void) +{ + result r = E_FAILURE; + + AppLogDebug("SettingsManager::ResetRegistry"); + for (int index = REGISTRY_SETTING_INVALID+1; index < MAX_REGISTRY_SETTING; index++) + { + r = AppRegistry::GetInstance()->Remove(__entry[index]); + AppLogDebug("Registry Remove result %s",GetErrorMessage(r)); + } + + AppRegistry::GetInstance()->Save(); + + for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++) + { + __values[index] = L""; + } + + SetDefaultValues(); + for (int index = 0; index < __listenerList.GetCount(); index++) + { + ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index)); + if (pSettingsListener) + pSettingsListener->OnSettingsReset(); + } + + return E_SUCCESS; +} + +void +SettingPresentationModel::ClearCache(void) +{ + for (int index = 0; index < __listenerList.GetCount(); index++) + { + ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index)); + if (pSettingsListener) + pSettingsListener->OnClearCache(); + } +} + +void +SettingPresentationModel::ClearCookie(void) +{ + for (int index = 0; index < __listenerList.GetCount(); index++) + { + ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index)); + if (pSettingsListener) + pSettingsListener->OnClearCookie(); + } +} + +result +SettingPresentationModel::Construct(void) +{ + result r = E_FAILURE; + + for (int index = REGISTRY_SETTING_HOMEPAGE; index < MAX_REGISTRY_SETTING; index++) + { + __values[index] = L""; + } + + __entry[REGISTRY_SETTING_HOMEPAGE] = L"homePage"; + __entry[REGISTRY_SETTING_DEFAULT_VIEW] = L"defaultViewLevel"; + __entry[REGISTRY_SETTING_RUN_JAVASCRIPT] = L"runJs"; + __entry[REGISTRY_SETTING_DISPLAY_IMAGES] = L"displayImages"; + __entry[REGISTRY_SETTING_HTML5_VIDEOS] = L"html5Videos"; + __entry[REGISTRY_SETTING_WORD_WRAPPING] = L"wordWrap"; + __entry[REGISTRY_SETTING_BLOCK_POPUP] = L"blockPopUp"; + __entry[REGISTRY_SETTING_ACCEPT_COOKIES] = L"cookies"; + __entry[REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD] = L"savePassword"; + __entry[REGISTRY_SETTING_SHOW_SECURITY_WARNINGS] = L"securityWarnings"; + __entry[REGISTRY_SETTING_SEARCH_ENGINE] = L"searchEngine"; + __entry[REGISTRY_SETTING_CASE_SENSITIVE] = L"caseSensitive"; + __entry[REGISTRY_SETTING_RUN_READER] = L"runReader"; + __entry[REGISTRY_SETTING_READER_FONT_SIZE] = L"fontSize"; + __entry[REGISTRY_SETTING_FAVORITE_URL_VALUE] = L"Favourite"; + __entry[REGISTRY_SETTING_REMEMBER_FORM_DATA] = L"formData"; + __entry[REGISTRY_SETTING_REMEMBER_PASSWORD] = L"rememberPassword"; + + r = LoadRegistry(); + return E_SUCCESS; +} + +result +SettingPresentationModel::SetValue(const int settingValueName, const String& val) +{ + result r = E_FAILURE; + + AppLogDebug("SettingsManager::SetValue settingValueName:%d val %ls", settingValueName, val.GetPointer()); + if (__values[settingValueName] == L"") + { + AppLogDebug("adding the new (std::nothrow) entry into registry"); + r = AppRegistry::GetInstance()->Add(__entry[settingValueName], val); + } + else + { + AppLogDebug("modifying entry into registry"); + r = AppRegistry::GetInstance()->Set(__entry[settingValueName], val); + } + TryCatch(!IsFailed(r),,"Adding into registry failed %s",GetErrorMessage(r)); + + r = AppRegistry::GetInstance()->Save(); + TryCatch(!IsFailed(r),,"Save Failed with error %s",GetErrorMessage(r)); + + for (int index = 0; index < __listenerList.GetCount(); index++) + { + ISettingChangeEventListener* pSettingsListener = static_cast< ISettingChangeEventListener* >(__listenerList.GetAt(index)); + if (pSettingsListener) + pSettingsListener->OnSettingsChange(settingValueName); + } + + __values[settingValueName] = val; + + CATCH: + return r; + +} + +result +SettingPresentationModel::SetFavoriteValue(const Tizen::Base::String& val) +{ + result r = E_FAILURE; + + if (__favouriteURL == L"") + r = AppRegistry::GetInstance()->Add(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], val); + else + r = AppRegistry::GetInstance()->Set(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], val); + TryCatch(!IsFailed(r),,"registry set failed with error %s",GetErrorMessage(r)); + r = AppRegistry::GetInstance()->Save(); + TryCatch(!IsFailed(r),,"registry set failed with error %s",GetErrorMessage(r)); + __favouriteURL.Clear(); + __favouriteURL.Append(val); + + CATCH: + return r; +} + +String +SettingPresentationModel::GetFavoriteUrl(void) +{ + __favouriteURL.Clear(); + __favouriteURL = L""; + AppRegistry::GetInstance()->Get(__entry[REGISTRY_SETTING_FAVORITE_URL_VALUE], __favouriteURL); + + return __favouriteURL; +} + +void +SettingPresentationModel::AddSettingsEventListener(const ISettingChangeEventListener& listener) +{ + __listenerList.Add(listener); +} + +void +SettingPresentationModel::RemoveSettingsEventListener(ISettingChangeEventListener& listener) +{ + __listenerList.Remove(listener, false); +} + +void +SettingPresentationModel::SetHomepage(const String& homePage) +{ + __homePage.Clear(); + __homePage.Append(homePage); + AppLog("SettingPresentationModel::SetHomepage %ls",__homePage.GetPointer()); + SetValue((int) REGISTRY_SETTING_HOMEPAGE, __homePage); +} + +String +SettingPresentationModel::GetHomepage(void) +{ + return __homePage; +} + +void +SettingPresentationModel::SetDefaultView(const String& viewLevel) +{ + __defaultViewLevel = viewLevel; + //CommonUtil::GetString(L"IDS_FIT_TO_WIDTH") + if (__defaultViewLevel.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0) + { + __setting.SetAutoFittingEnabled(true); + } + else if (__defaultViewLevel.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_READABLE")) == 0) + { + __setting.SetAutoFittingEnabled(false); + } + + SetValue((int) REGISTRY_SETTING_DEFAULT_VIEW, viewLevel); +} + +String +SettingPresentationModel::GetDefaultView(void) +{ + return __defaultViewLevel; +} + +void +SettingPresentationModel::SetRunJavascriptEnabled(bool runJsEnabled) +{ + __runJsEnabled = runJsEnabled; + SetValue((int) REGISTRY_SETTING_RUN_JAVASCRIPT, Boolean::ToString(runJsEnabled)); + __setting.SetJavascriptEnabled(runJsEnabled); +} + +bool +SettingPresentationModel::IsRunJavascriptEnabled(void) +{ + return __runJsEnabled; +} + +void +SettingPresentationModel::SetDisplayImagesEnabled(bool displayImages) +{ + __displayImages = displayImages; + SetValue((int) REGISTRY_SETTING_DISPLAY_IMAGES, Boolean::ToString(displayImages)); + __setting.SetAutoImageLoadEnabled(__displayImages); +} + +bool +SettingPresentationModel::IsDisplayImagesEnabled(void) +{ + return __displayImages; +} + +void +SettingPresentationModel::SetHtml5VideosEnabled(bool html5Videos) +{ + __html5Videos = html5Videos; + SetValue((int) REGISTRY_SETTING_HTML5_VIDEOS, Boolean::ToString(html5Videos)); +} + +bool +SettingPresentationModel::IsHtml5VideosEnabled(void) +{ + return __html5Videos; +} + +void +SettingPresentationModel::SetWordWrapEnabled(bool wordWrap) +{ + __wordWrap = wordWrap; + SetValue((int) REGISTRY_SETTING_WORD_WRAPPING, Boolean::ToString(wordWrap)); +} + +bool +SettingPresentationModel::IsWordWrapEnabled(void) +{ + return __wordWrap; +} + +void +SettingPresentationModel::SetBlockPopUp(bool blockPopUp) +{ + __blockPopUp = blockPopUp; + SetValue((int) REGISTRY_SETTING_BLOCK_POPUP, Boolean::ToString(blockPopUp)); + __setting.SetJavaScriptPopupEnabled(__blockPopUp); +} + +bool +SettingPresentationModel::IsBlockPopUp(void) +{ + return __blockPopUp; +} + +void +SettingPresentationModel::SetCookiesEnabled(bool cookiesEnabled) +{ + __cookies = cookiesEnabled; + SetValue((int) REGISTRY_SETTING_ACCEPT_COOKIES, Boolean::ToString(cookiesEnabled)); +} + +bool +SettingPresentationModel::IsCookiesEnabled(void) +{ + return __cookies; +} + +void +SettingPresentationModel::SetRememberFormData(bool formData) +{ + __rememberFormData = formData; + SetValue((int) REGISTRY_SETTING_REMEMBER_FORM_DATA, Boolean::ToString(__rememberFormData)); +} + +bool +SettingPresentationModel::IsRememberFormData(void) +{ + return __rememberFormData; +} + +void SettingPresentationModel::SetRememberPassword(bool rememberPassword) +{ + __rememberPassword = rememberPassword; + SetValue((int) REGISTRY_SETTING_REMEMBER_PASSWORD, Boolean::ToString(__rememberPassword)); +} + +bool SettingPresentationModel::IsRememberPassword(void) +{ + return __rememberPassword; +} + +void +SettingPresentationModel::SetSavePassword(const String& savePassword) +{ + __savePassword = savePassword; + SetValue((int) REGISTRY_SETTING_AUTOSAVE_ID_PASSWORD, savePassword); +} + +String +SettingPresentationModel::GetSavePassword(void) +{ + return __savePassword; +} + +void +SettingPresentationModel::SetSecurityWarningsEnabled(bool securityWarnings) +{ + __securityWarnings = securityWarnings; + SetValue((int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS, Boolean::ToString(securityWarnings)); + if (__securityWarnings == true) + { + __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM); + } + else + { + __setting.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE); + } +} + +bool +SettingPresentationModel::IsSecurityWarningsEnabled(void) +{ + return __securityWarnings; +} + +void +SettingPresentationModel::SetSearchEngine(const String& searchEngine) +{ + __searchEngine = searchEngine; + SetValue((int) REGISTRY_SETTING_SEARCH_ENGINE, searchEngine); +} + +String +SettingPresentationModel::GetSearchEngine(void) +{ + return __searchEngine; +} + +void +SettingPresentationModel::SetCaseSensitiveEnabled(bool caseSensitive) +{ + __caseSensitive = caseSensitive; + SetValue((int) REGISTRY_SETTING_CASE_SENSITIVE, Boolean::ToString(caseSensitive)); +} + +bool +SettingPresentationModel::IsCaseSensitiveEnabled(void) +{ + return __caseSensitive; +} + +void +SettingPresentationModel::SetRunReaderEnabled(bool runReader) +{ + __runReader = runReader; + SetValue((int) REGISTRY_SETTING_RUN_READER, Boolean::ToString(runReader)); +} + +bool +SettingPresentationModel::IsRunReaderEnabled(void) +{ + return __runReader; +} + +void +SettingPresentationModel::SetReaderFontSize(int fontSize) +{ + __fontSize = fontSize; + SetValue((int) REGISTRY_SETTING_READER_FONT_SIZE, Integer::ToString(__fontSize)); +} + +int +SettingPresentationModel::GetReaderFontSize(void) +{ + return __fontSize; +} + +String +SettingPresentationModel::GetSearchUrl(const String& searchText) +{ + String searchStr = L""; + if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_YAHOO")) == 0) + { + searchStr.Append(L"http://search.yahoo.com/search?p="); + searchStr.Append(searchText); + } + else if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_NAVER")) == 0) + { + searchStr.Append(L"http://search.naver.com/search.naver?query="); + searchStr.Append(searchText); + } + else if (GetSearchEngine().CompareTo(CommonUtil::GetString(L"IDS_COM_BODY_GOOGLE")) == 0) + { + searchStr.Append(L"http://www.google.com/search?q="); + searchStr.Append(searchText); + } + return searchStr; +} + +Tizen::Web::Controls::WebSetting& +SettingPresentationModel::GetWebSettings(void) +{ + return __setting; +} + +void +SettingPresentationModel::SetPrivateOn(bool isPrivateOn) +{ + __isPrivateOn = isPrivateOn; + return; +} + +bool +SettingPresentationModel::GetPrivateOn(void) +{ + return __isPrivateOn; +} diff --git a/src/IntSettingToggleCustomItem.cpp b/src/IntSettingToggleCustomItem.cpp new file mode 100644 index 0000000..6258922 --- /dev/null +++ b/src/IntSettingToggleCustomItem.cpp @@ -0,0 +1,85 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +//!Internet SettingToggleCustomItem class +/*@file: SettingToggleCustomItem.cpp + *@brief: The SettingToggleCustomItem + * + */ + +#include + +#include "IntSettingToggleCustomItem.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Graphics; +using namespace Tizen::Ui::Controls; + +static const int IDA_FORMAT_STRING = 101; + +SettingToggleCustomItem::SettingToggleCustomItem(void) +{ + __text = L""; + __width = 0 ; + __height = 0 ; +} + +SettingToggleCustomItem::~SettingToggleCustomItem(void) +{ + +} + +result +SettingToggleCustomItem::Construct(int width, int height) +{ + result r = E_FAILURE; + + __width = width; + __height = height; + const Dimension dim(width, height); + r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_ONOFF_SLIDING); + + return r; +} + +void +SettingToggleCustomItem::SetText(Tizen::Base::String& text) +{ + __text = text; +} + +String +SettingToggleCustomItem::GetText(void) +{ + return __text; +} + +result +SettingToggleCustomItem::Make(void) +{ + const Color textColor = CUSTOM_COLOR_TRANSPARENT; + const Color pressedTextColor = CUSTOM_COLOR_TRANSPARENT; + const int X_Margin = 26; + const int Y_Margin = 26; + const int textSize = 40; + + AddElement(Rectangle(X_Margin, Y_Margin, __width - 60, 60), IDA_FORMAT_STRING, __text, textSize, textColor, pressedTextColor, pressedTextColor, true); + SetElementSelectionEnabled(IDA_FORMAT_STRING, false); + + return E_SUCCESS; +} diff --git a/src/IntSharePopup.cpp b/src/IntSharePopup.cpp new file mode 100644 index 0000000..3e1c97a --- /dev/null +++ b/src/IntSharePopup.cpp @@ -0,0 +1,412 @@ +// + +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +/* + * IntSharePopUp.cpp + *@file: IntSharePopup.cpp + *@brief: Share Popup for sharing bookmark via message, email etc + */ + +#include +#include +#include +#include + +#include "IntCommonLib.h" +#include "IntSharePopup.h" + +using namespace Tizen::App; +using namespace Tizen::Io; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Graphics; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + +const int SharePopup::IDA_CANCEL_BUTTON = 101; +const int SharePopup::ID_FORMAT_MESSAGE_STRING = 500; +const int SharePopup::ID_FORMAT_EMAIL_STRING = 501; +const int SharePopup::ID_FORMAT_FACEBOOK_STRING = 502; +const int SharePopup::ID_FORMAT_TWITTER_STRING = 503; + +ShareInfo:: ShareInfo(void) +{ + isImageAttached = false; +} + +ShareInfo:: ~ShareInfo(void) +{ + +} + +void +ShareInfo::SetPageTitle(Tizen::Base::String aPageTitle) +{ + __pageTitle.Clear(); + __pageTitle.Append(aPageTitle); +} + +void +ShareInfo::SetPageUrl(Tizen::Base::String aPageURL) +{ + __pageURL.Clear(); + __pageURL.Append(aPageURL); +} + +Tizen::Base::String +ShareInfo::GetPageTitle(void) +{ + return __pageTitle; +} + +Tizen::Base::String +ShareInfo::GetPageURL(void) +{ + return __pageURL; +} + +void +ShareInfo::SetImageAttached(bool imageAttached) +{ + isImageAttached = imageAttached; +} + +bool +ShareInfo::GetImageAttached() +{ + return isImageAttached; +} + +void +ShareInfo::SetImagePath(Tizen::Base::String aImagePath) +{ + __imagePath.Clear(); + __imagePath.Append(aImagePath); +} + +Tizen::Base::String +ShareInfo::GetImagePath(void) +{ + return __imagePath; +} + +SharePopup::SharePopup(void) +:__pList(null),__pShareList(null) +{ + +} + +SharePopup::~SharePopup(void) +{ + +} + +bool +SharePopup::Initialize(void) +{ + Button* pCancelButton = null; + + Popup::Construct(L"IDL_SHARE_POPUP"); + SetName(L"CommonPopup"); + + __pShareList = new(std::nothrow) ArrayList(); + __pShareList->Construct(); + + __pList = static_cast(GetControl(L"IDC_POPUP_LIST")); + if (__pList == null) + { + return false; + } + + __pList->SetItemProvider(*this); + __pList->AddListViewItemEventListener(*this); + + pCancelButton = static_cast< Button* >(GetControl(L"IDC_BUTTON", true)); + if (pCancelButton) + { + pCancelButton->AddActionEventListener(*this); + pCancelButton->SetActionId(IDA_CANCEL_BUTTON); + } + + return true; +} + +result +SharePopup::OnTerminating(void) +{ + result r = E_SUCCESS; + return r; +} + +void +SharePopup::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + switch(actionId) + { + case IDA_CANCEL_BUTTON: + { + Popup::SetShowState(false); + Popup::Show(); + } + break; + default: + break; + } + return; +} + +void +SharePopup::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state) +{ + return; +} + +void +SharePopup::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) +{ + switch (index) + { + case 0: + { + Popup::SetShowState(false); + Popup::Show(); + // share via message + StartMessageAppControl(); + } + break; + case 1: + { + Popup::SetShowState(false); + Popup::Show(); + // share via email + StartEmailAppControl(); + } + break; + default: + break; + } +} + +void +SharePopup::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction) +{ + return; +} + +void +SharePopup::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) +{ + return; +} + +Tizen::Ui::Controls::ListItemBase* +SharePopup::CreateItem(int index, int itemWidth) +{ + result r = E_FAILURE; + ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL; + int textSize = 35; + int elementHeight = 50; + int listItemWidth = 112; + + CustomItem* pItem = new(std::nothrow) CustomItem(); + r = pItem->Construct(Dimension(GetClientAreaBounds().width, listItemWidth), style); + if (IsFailed(r)) + { + AppLogDebug("Create Item Failed with error %s", GetErrorMessage(r)); + delete pItem; + return null; + } + + switch(index) + { + case 0: + { + AppLogDebug("SharePopUp CreateItem 0"); + // IDS_SHARE_VIA_MESSAGE + pItem->AddElement(Rectangle(0,0, GetClientAreaBounds().width, listItemWidth), ID_FORMAT_MESSAGE_STRING, CommonUtil::GetString(L"IDS_BR_OPT_SHARE_VIA_MESSAGES"), true); + } + break; + case 1: + { + AppLogDebug("SharePopUp CreateItem 1"); + // IDS_SHARE_VIA_EMAIL + pItem->AddElement(Rectangle(0, 0, GetClientAreaBounds().width, listItemWidth), ID_FORMAT_EMAIL_STRING, CommonUtil::GetString(L"IDS_BR_OPT_SHARE_VIA_EMAIL"), true); + } + break; + default: + break; + } + return pItem; +} + +bool +SharePopup::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth) +{ + return true; +} + +int +SharePopup::GetItemCount(void) +{ + return 2; +} + +result +SharePopup::AddShareInfo(ShareInfo* pShareInfo) +{ + result r = E_FAILURE; + + if (__pShareList != NULL) + { + r = __pShareList->Add(*pShareInfo); + } + return r; +} + +void SharePopup::RemoveAllShareInfo() +{ + __pShareList->RemoveAll(); +} + +void +SharePopup::StartEmailAppControl(void) +{ + HashMap extraData; + ShareInfo* pShareInfo = null; + result r = E_FAILURE; + bool imageAttachment = false; + + extraData.Construct(); + + if (__pShareList != null) + { + pShareInfo = dynamic_cast(__pShareList->GetAt(0)); + if (pShareInfo != null) + { + String testURL = pShareInfo->GetPageURL(); + AppLogDebug("getpageURL getpageURL is %ls", testURL.GetPointer()); + } + } + + String textVal; + + if (pShareInfo != null) + { + textVal.Append(pShareInfo->GetPageTitle()); + textVal.Append(L" <"); + AppLog("share info url is %ls",pShareInfo->GetPageURL().GetPointer()); + textVal.Append(pShareInfo->GetPageURL().GetPointer()); + textVal.Append(L">"); + } + + String subjectKey = L"subject"; + String subjectVal = L""; + String textKey = L"text"; + + String toKey = L"to"; + String toVal = L""; + String ccKey = L"cc"; + String ccVal = L""; + String bccKey = L"bcc"; + String bccVal = L""; + String attachKey = L"attachments"; + String attachVal; + if (pShareInfo != null) + { + imageAttachment = pShareInfo->GetImageAttached(); + if (imageAttachment) + { + attachVal = pShareInfo->GetImagePath(); + AppLog("SharePopup::StartEmailAppControl imagePath is %S",attachVal.GetPointer()); + } + else + { + attachVal = L""; + } + } + + extraData.Add(&subjectKey, &subjectVal); + extraData.Add(&textKey, &textVal); + extraData.Add(&toKey, &toVal); + extraData.Add(&ccKey, &ccVal); + extraData.Add(&bccKey, &bccVal); + extraData.Add(&attachKey, &attachVal); + + AppControl* pAc = AppManager::FindAppControlN(L"tizen.email", L"http://tizen.org/appcontrol/operation/compose"); + if (pAc) + { + pAc->Start(null, null, &extraData, null); + delete pAc; + } + if (pShareInfo != null) + { + delete pShareInfo; + } +} + +void +SharePopup::StartMessageAppControl(void) +{ + HashMap extraData; + ShareInfo* pShareInfo = null; + + extraData.Construct(); + + if (__pShareList != null) + { + pShareInfo = dynamic_cast(__pShareList->GetAt(0)); + if (pShareInfo != null) + { + String testURL = pShareInfo->GetPageURL(); + AppLogDebug("getpageURL getpageURL is %ls", testURL.GetPointer()); + } + } + + String textVal; + + if (pShareInfo != null) + { + textVal.Append(pShareInfo->GetPageTitle()); + textVal.Append(L" <"); + AppLog("share info url is %ls",pShareInfo->GetPageURL().GetPointer()); + textVal.Append(pShareInfo->GetPageURL().GetPointer()); + textVal.Append(L">"); + } + String typeKey = L"type"; + String typeVal = L"SMS"; + String textKey = L"text"; + extraData.Add(&typeKey, &typeVal); + extraData.Add(&textKey, &textVal); + AppControl* pAc = AppManager::FindAppControlN(L"tizen.messages", L"http://tizen.org/appcontrol/operation/compose"); + if (pAc) + { + pAc->Start(null, null, &extraData, null); + delete pAc; + } + if (pShareInfo != null) + { + delete pShareInfo; + } + +} + +void +SharePopup::OnAppControlCompleted(const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::Collection::IList* pResultList) +{ + +}