Updated Private -> RSA
authorji.ji <ji.ji@samsung.com>
Wed, 26 Jun 2013 10:07:52 +0000 (19:07 +0900)
committerji.ji <ji.ji@samsung.com>
Wed, 26 Jun 2013 10:07:52 +0000 (19:07 +0900)
Change-Id: Ib3279cc76d40e47573bbe0f8f923654a25330b71

.project [new file with mode: 0644]
config.xml
css/style.css
js/app.js
js/app.model.js
js/app.ui.js
templates/callView.tpl
templates/callerCallItemRow.tpl
templates/callerHistory.tpl

diff --git a/.project b/.project
new file mode 100644 (file)
index 0000000..467793a
--- /dev/null
+++ b/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>CallLog</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.wst.common.project.facet.core.builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>json.validation.builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.web.jslint.nature.JSLintBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.web.css.nature.CSSBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.wst.validation.validationbuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.web.project.builder.WebBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>json.validation.nature</nature>
+               <nature>org.tizen.web.jslint.nature.JSLintNature</nature>
+               <nature>org.tizen.web.css.nature.CSSNature</nature>
+               <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+               <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+               <nature>org.tizen.web.project.builder.WebNature</nature>
+       </natures>
+</projectDescription>
index 511eac0..dfe8b06 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://sample-web-application.tizen.org/CallLog" version="2.1.0" viewmodes="maximized">
-       <tizen:application id="1I49ZSFY56.CallLog" package="1I49ZSFY56" required_version="2.1"/>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://sample-web-application.tizen.org/CallLog" version="2.2.0" viewmodes="maximized">
+       <tizen:application id="1I49ZSFY56.CallLog" package="1I49ZSFY56" required_version="2.2"/>
        <content src="index.html"/>
        <icon src="icon.png"/>
        <name>CallLog</name>
index 0ca74f9..79009f2 100644 (file)
@@ -38,7 +38,7 @@ li {
 }
 
 .hidden {
-       display: none;
+       display: none !important;
 }
 
 .call .numberOrName {
index cbd1038..ab2a1a6 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -113,7 +113,6 @@ var App = null;
                                        },
                                        onfailure: function (er) {
                                                console.error('Error during call to ' + phoneNumber, er);
-                                               self.ui.showErrorPopup('Call service is unavailable');
                                        }
                                }
                        );
index 55ee141..dddc6ee 100644 (file)
@@ -28,7 +28,8 @@ function Model() {
 
                        var callHistoryListener = {
                                onadded: onSuccessCallback,
-                               onchanged: onSuccessCallback
+                               onchanged: onSuccessCallback,
+                               onremoved: onSuccessCallback
                        };
 
                        tizen.callhistory.addChangeListener(callHistoryListener);
@@ -53,7 +54,6 @@ function Model() {
                 * @param {function} onSuccess Callback
                 */
                getCallHistoryForCaller: function Model_getCallHistoryForCaller(phoneNumber, onSuccess) {
-
                        tizen.callhistory.find(onSuccess, null, // error is ignored
                                new tizen.AttributeFilter('remoteParties.remoteParty', 'EXACTLY', phoneNumber),
                                new tizen.SortMode('startTime', 'DESC')
index e08b242..50da714 100644 (file)
@@ -25,6 +25,8 @@ function Ui(contacts) {
 
                contactsLoaded: null,
 
+               checkedLogs: [],
+
                /**
                 * @type {TemplateManager}
                 */
@@ -78,6 +80,10 @@ function Ui(contacts) {
                addEvents: function Ui_addEvents() {
                        var self = this;
 
+                       $(window).on('softkeyboardchange', function () {
+                               $.mobile.activePage.page('refresh');
+                       });
+
                        $('#callView').on('tap', '.ui-btn-back', app.exit.bind(app));
 
                        $('#callView').on('pagebeforeshow', function () {
@@ -95,7 +101,7 @@ function Ui(contacts) {
                                $('#historyForCallerView .ui-content.ui-scrollview-clip .ui-scrollview-view')
                                        .css('-webkit-transform', 'translate3d(0px, 0px, 0px)');
                                $('#selectAllDetails').on('change', function () {
-                                       self.selectAllDetails();
+                                       self.selectAll();
                                });
                        });
 
@@ -103,6 +109,21 @@ function Ui(contacts) {
                                $('#content').css('top', '160px');
                                $('#header').css('height', '160px');
                                $('#delete-toolbar').css('width', '70px');
+                               $('#callerListContainer')
+                                       .children('.ui-overflow-indicator-top', '.ui-overflow-indicator-bottom')
+                                       .hide();
+                       });
+
+                       $('#callerListContainer').on('scrollstart', function () {
+                               $(this)
+                                       .children('.ui-overflow-indicator-top', '.ui-overflow-indicator-bottom')
+                                       .fadeIn(200);
+                       });
+
+                       $('#callerListContainer').on('scrollstop', function () {
+                               $(this)
+                                       .children('.ui-overflow-indicator-top', '.ui-overflow-indicator-bottom')
+                                       .fadeOut(200);
                        });
 
                        $(window).on('resize', function () {
@@ -177,12 +198,23 @@ function Ui(contacts) {
 
                        $('#errorPopup').on('tap', '#errorPopupOkBtn', this.closeErrorPopup);
 
-                       // workaround fix for N_SE-39520
-                       window.addEventListener('softkeyboardchange', function (e) {
-                               if (e.state === 'off') {
-                                       $.mobile.activePage.page('refresh');
+                       $(window).keyup(function(e){
+                               if (e.which === 13) {
+                                       $('input:focus').blur();
+                               }
+                       });
+
+                       document.addEventListener('tizenhwkey', function(e) {
+                               if (e.keyName == "back") {
+                                       if ($.mobile.activePage.attr('id') === 'callView') {
+                                                       tizen.application.getCurrentApplication().exit();
+                                       } else {
+                                               history.back();
+                                       }
                                }
                        });
+
+                       self.onVisibilityChange();
                },
 
                lockOptionButtons: function () {
@@ -205,36 +237,21 @@ function Ui(contacts) {
                        });
                },
 
-               selectAll: function Ui_selectAll() {
-                       var selectAll = $('#selectAllDetails');
-                       if (selectAll.attr('checked')) {
-                               selectAll
-                                       .attr('checked', false)
-                                       .data('checkboxradio')
-                                       .refresh();
-                       } else {
-                               selectAll
-                                       .attr('checked', true)
-                                       .data('checkboxradio')
-                                       .refresh();
-                       }
-               },
-
-               selectAllDetails: function Ui_selectAllDetails() {
+               selectAll: function () {
                        if ($('#selectAllDetails').attr('checked')) {
-                               $('#selectAllDetails')
-                                       .attr('checked', true)
-                                       .data('checkboxradio')
-                                       .refresh();
+                               this.selectCheckbox($('#selectAllDetails'), true);
                        } else {
-                               $('#selectAllDetails')
-                                       .attr('checked', false)
-                                       .data('checkboxradio')
-                                       .refresh();
+                               this.selectCheckbox($('#selectAllDetails'), false);
                        }
                        this.selectAllDetailsEach();
                },
 
+               selectCheckbox: function (obj, state) {
+                       obj.attr('checked', state)
+                               .data('checkboxradio')
+                               .refresh();
+               },
+
                /**
                 * Returns number of selected call logs
                 * @return {number} length
@@ -244,15 +261,12 @@ function Ui(contacts) {
                },
 
                selectAllDetailsEach: function Ui_selectAllDetailsEach() {
+                       var self = this;
                        $('#forCallerList').find('input').each(function () {
                                if ($('#selectAllDetails').attr('checked')) {
-                                       $(this).attr('checked', true)
-                                               .data('checkboxradio')
-                                               .refresh();
+                                       self.selectCheckbox($(this), true);
                                } else {
-                                       $(this).attr('checked', false)
-                                               .data('checkboxradio')
-                                               .refresh();
+                                       self.selectCheckbox($(this), false);
                                }
                        });
                },
@@ -261,15 +275,11 @@ function Ui(contacts) {
                 * Hides checkboxes
                 */
                hideCheckboxes: function Ui_hideCheckboxes() {
-                       $('#selectAllDetails')
-                               .attr('checked', false)
-                               .data('checkboxradio')
-                               .refresh();
+                       var self = this;
+                       this.selectCheckbox($('#selectAllDetails'), false);
 
                        $('#forCallerList').find('input').each(function () {
-                               $(this).attr('checked', false)
-                                       .data('checkboxradio')
-                                       .refresh();
+                               self.selectCheckbox($(this), false);
                        });
                        this.changeDetailsToRemoveState('hide');
                },
@@ -285,16 +295,11 @@ function Ui(contacts) {
                },
 
                setSelectAllDetails: function Ui_setSelectAllDetails() {
-                       if ($('#forCallerList input[type="checkbox"]').length === $('#forCallerList input[checked="checked"]').length) {
-                               $('#selectAllDetails')
-                                       .attr('checked', true)
-                                       .data('checkboxradio')
-                                       .refresh();
+                       if ($('#forCallerList input[type="checkbox"]').length ===
+                               $('#forCallerList input[checked="checked"]').length) {
+                               this.selectCheckbox($('#selectAllDetails'), true);
                        } else {
-                               $('#selectAllDetails')
-                                       .attr('checked', false)
-                                       .data('checkboxradio')
-                                       .refresh();
+                               this.selectCheckbox($('#selectAllDetails'), false);
                        }
                },
 
@@ -329,10 +334,7 @@ function Ui(contacts) {
                deleteCheckedLogs: function Ui_deleteCheckedLogs(e) {
                        this.closePopup();
 
-                       $('#selectAllDetails')
-                               .attr('checked', false)
-                               .data('checkboxradio')
-                               .refresh();
+                       this.selectCheckbox($('#selectAllDetails'), false);
 
                        $('#forCallerList li.call').each(function () {
                                if ($(this).find('form label').hasClass('ui-checkbox-on')) {
@@ -455,7 +457,9 @@ function Ui(contacts) {
                        /* workaround for registering call during working app in removeMode */
                        if (this.removeMode) {
                                if ($('#selectAllDetails').attr('checked')){
-                                       this.selectAllDetails();
+                                       this.selectAll();
+                                       $('.toRemove, .selectAllBox', $('#historyForCallerView'))
+                                               .removeClass('hidden');
                                }
                                $('#forCallerList .toRemove').show()
                        }
@@ -490,7 +494,8 @@ function Ui(contacts) {
                        tpl = this.templateManager.get('callItemRow', {
                                'name': name,
                                'callTime': entry.startTime.toLocaleTimeString(),
-                               'cssClasses': this.cssClassesForEntry(entry)
+                               'cssClasses': this.cssClassesForEntry(entry),
+                               'uid': entry.uid
                        });
 
                        return $(tpl)
@@ -525,11 +530,11 @@ function Ui(contacts) {
                 * @returns {HTMLElement}
                 */
                getCallerCallLogRow: function Ui_getCallerCallLogRow(entry) {
-
                        return $(this.templateManager.get('callerCallItemRow', {
                                'cssClass': this.cssClassesForEntry(entry),
                                'callTime': entry.startTime.toLocaleTimeString(),
-                               'callDuration': this.helpers.secondsToHours(entry.duration)
+                               'callDuration': this.helpers.secondsToHours(entry.duration),
+                               'uid': entry.uid
                        })).data('entries', [entry]).get(0);
                },
 
@@ -548,6 +553,10 @@ function Ui(contacts) {
 
                        if (len) {
                                this.updateCallerHeader(entries[0], entries.length);
+                       } else {
+                               // if last call log has been removed
+                               this.removedLastLog();
+                               this.app.lastViewedCaller = 0;
                        }
 
                        $('#forCallerList')
@@ -579,6 +588,20 @@ function Ui(contacts) {
 
                        $('#forCallerList').trigger('create');
 
+                       // change to remove mode if it was active before registering call
+                       if (this.removeMode) {
+                               this.removeMode = !this.removeMode;
+                               this.changeDetailsToRemoveState();
+                               // check previous checked entries
+                               this.checkedLogs.forEach(function(logUid){
+                                       var checkbox = $('#forCallerList li.call[data-uid="' + logUid + '"]')
+                                               .find(':checkbox');
+                                       checkbox.attr('checked', true)
+                                               .data('checkboxradio')
+                                               .refresh();
+                               });
+                               this.checkedLogs = [];
+                       }
                        this.addEventsForCallerListCheckboxes();
                },
 
@@ -666,6 +689,20 @@ function Ui(contacts) {
                        scrollView.css("-webkit-transform", "translate3d(0px, -" + scrollView.height() + "px, 0px)");
                },
 
+               onVisibilityChange: function () {
+                       var self = this;
+                       document.addEventListener('webkitvisibilitychange', function () {
+                               if (document.webkitVisibilityState === 'hidden') {
+                                       $('#forCallerList li.call').each(function () {
+                                               if ($(this).find('form label').hasClass('ui-checkbox-on')) {
+                                                       var checkedEntry = $(this).data('entries')[0];
+                                                       self.checkedLogs.push(checkedEntry.uid);
+                                               }
+                                       });
+                               }
+                       });
+               },
+
                /**
                 * WORKAROUND;
                 * Patch for UI, bad refresh scrollView
@@ -677,6 +714,12 @@ function Ui(contacts) {
                                };
                        scrollView.hide();
                        setTimeout(show, 0);
+               },
+
+               removedLastLog: function () {
+                       this.hideCheckboxes();
+                       $(".ui-popup").popup('close');
+                       $.mobile.changePage('#callView');
                }
        };
 
index 40dfdc0..66c20d1 100644 (file)
@@ -1,6 +1,6 @@
        <div data-role="page" id="callView" data-add-back-btn="header">
                <div data-role="header" id="page-header" data-position="fixed">
-                       <h1>CALL LOG</h1>
+                       <h1>Call Log</h1>
                </div>
                <div data-role="content">
                        <ul data-role="listview" id="calllogList" data-filter="true" data-position="fixed" data-inset="true"></ul>
index 6e3dc59..08c6f67 100644 (file)
@@ -1,4 +1,4 @@
-<li class="ui-li-has-multiline call %cssClass%">
+<li class="ui-li-has-multiline call %cssClass%" data-uid="%uid%">
        <div class="toRemove hidden"><form><input type="checkbox" /></form></div>
        <div class="callAllTime">%callTime%</div>
        <div class="iconStatus"></div>
index ec9a3b5..a868ae2 100644 (file)
@@ -13,7 +13,7 @@
                                </div>
                        </div>
                </div>
-               <div data-role="content">
+               <div data-role="content" id="callerListContainer">
                        <div class="selectAllBox">
                                <div class="toRemove">
                                        <input type="checkbox" id="selectAllDetails"/>