[CallLog] updated CallLog sources
authorPiotr Dabrowski <p.dabrowski2@samsung.com>
Fri, 23 Aug 2013 12:57:29 +0000 (14:57 +0200)
committerPiotr Dabrowski <p.dabrowski2@samsung.com>
Fri, 23 Aug 2013 12:57:29 +0000 (14:57 +0200)
Change-Id: I31ca8595a3ab676c4da45a95c9634679d87de772

config.xml
js/app.js
js/app.model.js
js/app.ui.js
templates/callItemRow.tpl
templates/callView.tpl

index b2a6165..52176a9 100644 (file)
@@ -3,7 +3,8 @@
        <tizen:application id="1I49ZSFY56.CallLog" package="1I49ZSFY56" required_version="2.2"/>
        <content src="index.html"/>
        <icon src="icon.png"/>
-       <name>Call log</name>
+       <name>Call Log</name>
+       <feature name="http://tizen.org/feature/screen.size.all"/>
        <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
        <tizen:privilege name="http://tizen.org/privilege/callhistory.read"/>
        <tizen:privilege name="http://tizen.org/privilege/callhistory.write"/>
index b005fb4..e58ca9d 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -140,20 +140,17 @@ var App = null;
                        tizen.application.launchAppControl(
                                appControl,
                                null,
-                               function () {
-                                       app.ui.unlockOptionButtons();
-                               },
+                               null,
                                function (e) {
                                        console.error('Message launch error: ', e);
                                        self.ui.showErrorPopup('Message service is unavailable');
+                                       app.ui.unlockOptionButtons();
                                },
                                {
-                                       onsuccess: function () {
-                                               app.ui.unlockOptionButtons();
-                                       },
                                        onfailure: function (er) {
                                                console.error('Message service launch error: ', er);
                                                self.ui.showErrorPopup('Message service is unavailable');
+                                               app.ui.unlockOptionButtons();
                                        }
                                }
                        );
index dddc6ee..42c3c64 100644 (file)
@@ -54,10 +54,27 @@ 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')
-                               );
+                       var filter = null, success;
+                       if (phoneNumber) {
+                               filter = new tizen.AttributeFilter('remoteParties.remoteParty', 'EXACTLY', phoneNumber);
+                               success = onSuccess;
+                       } else {
+                               success = function (calls) {
+                                       onSuccess(calls.filter(function (element) {
+                                               if(!element.remoteParties[0].remoteParty) {
+                                                       return element;
+                                               }
+                                       }));
+                               };
+                       }
+
+                       tizen.callhistory.find(success,
+                                       function (e) {
+                                               console.error(e);
+                                       },
+                                       filter,
+                                       new tizen.SortMode('startTime', 'DESC')
+                                       );
                },
 
                /**
index be0fbe9..d2a35d0 100644 (file)
@@ -97,7 +97,8 @@ function Ui(contacts) {
                                app.showCallHistory();
                        });
 
-                       $(".ui-scrollview-view").listview();
+                       //original code, do not remove until web-ui release; N_SE-48946
+                       //$(".ui-scrollview-view").listview();
 
                        $('#historyForCallerView').on('tap', '.ui-btn-back', function (event) {
                                event.preventDefault();
@@ -134,7 +135,8 @@ function Ui(contacts) {
                                        .fadeOut(200);
                        });
 
-                       $('.selectAllBox').children().on('tap', function () {
+                       $('.selectAllBox').children().on('click', function () {
+                               $('.selectAllBox input[type=checkbox]').trigger('click');
                                self.selectAll();
                                self.selectAllDetailsEach();
                        });
@@ -144,10 +146,12 @@ function Ui(contacts) {
                        });
 
                        $('#calllogList').on('click', '.call', function onCalllogEntryClick(event) {
-                               if ($(this).data('entries')[0].remoteParties[0].remoteParty !== "") {
-                                       app.showHistoryForCaller($(this).data('entries')[0].remoteParties[0].remoteParty);
-                                       $.mobile.changePage('#historyForCallerView');
-                               }
+                               var remoteParty = $(this)
+                                       .data('entries')[0]
+                                       .remoteParties[0]
+                                       .remoteParty;
+                               app.showHistoryForCaller(remoteParty);
+                               $.mobile.changePage('#historyForCallerView');
                        });
 
                        $('#smsActionBtn').on('tap', function (event) {
@@ -211,8 +215,6 @@ function Ui(contacts) {
                                        } else if ($.mobile.activePage.attr('id') === 'callView') {
                                                        tizen.application.getCurrentApplication().exit();
                                        } else {
-                                               $('.ui-listview-filter .ui-input-text').val('');
-                                               $('.ui-listview-filter .ui-input-text').trigger('change');
                                                history.back();
                                        }
                                }
@@ -459,24 +461,33 @@ function Ui(contacts) {
                                dayLog = groupsOfDays[i];
                                tempLength = dayLog.entries.length;
                                entryShortDate = this.helpers.getShortDate(dayLog.entries[0].startTime);
-
                                // add date header;
-                               elements.push($(this.templateManager.get('dateRow', {
-                                       'date': today === entryShortDate ? 'Today' : dayLog.date
-                               })).get(0));
+                               //original code, do not remove until web-ui release; N_SE-48946
+//                             elements.push($(this.templateManager.get('dateRow', {
+//                                     'date': today === entryShortDate ? 'Today' : dayLog.date
+//                             })).get(0));
 
                                for (j = 0; j < tempLength; j = j + 1) {
                                        elements.push(this.getCallItemRow(dayLog.entries[j], dayLog.counters[j]));
                                }
                        }
-
                        $('#calllogList')
                                .empty()
                                .append(elements);
 
                        /* workaround solution for not auto refreshing list view*/
-                       setTimeout(function () {
-                               $(".ui-scrollview-view").listview().listview('refresh');
+                       setTimeout(function () {
+                               // original code, do not remove until web-ui release; N_SE-48946
+                               $( "#calllogList" ).listview({
+                                       autodividers: true,
+                                       //filter: true,
+                                       autodividersSelector: function ( li ) {
+                                               console.log("autodividersSelector")
+                                               return $(li).find('.callDate').text() === new Date().toLocaleDateString() 
+                                               ? "Today" : $(li).find('.callDate').text();
+                                       }
+                               }).listview('refresh'); 
+                               $(".ui-li-divider").removeClass().addClass("date");
                        }, 0);
 
                        /* workaround for registering call during working app in removeMode */
@@ -516,6 +527,7 @@ function Ui(contacts) {
                        tpl = this.templateManager.get('callItemRow', {
                                'name': name,
                                'callTime': entry.startTime.toLocaleTimeString(),
+                               'callDate': entry.startTime.toLocaleDateString(),
                                'cssClasses': this.cssClassesForEntry(entry),
                                'uid': entry.uid
                        });
@@ -542,7 +554,7 @@ function Ui(contacts) {
                                        }
                                }
                        }
-                       return name || number || 'Unknown';
+                       return name || number;
                },
 
                /**
@@ -628,6 +640,12 @@ function Ui(contacts) {
                                });
                        }
                        this.addEventsForCallerListCheckboxes();
+                       // lock buttons if unknown caller
+                       if(remoteParty) {
+                               this.unlockOptionButtons();
+                       } else {
+                               this.lockButtons();
+                       }
                },
 
                /**
@@ -679,8 +697,7 @@ function Ui(contacts) {
                                this.updateCallerHeaderAccountId('');
                                this.updateCallerHeaderNumberOfEntries(numberOfEntries);
                        }
-                       $('.contact > .infoContainer > .name')
-                               .html($('<span>').text(name).html());
+                       $('.contact > .infoContainer > .name').html(name);
 
                },
 
index 9ac9821..690d5e5 100644 (file)
@@ -1,6 +1,7 @@
 <li data-filtertext="%name%" class="%cssClasses%">
        <div class="toRemove hidden"><input type="checkbox" /></div>
-       <div class="numberOrName">%name|escape%</div>
+       <div class="numberOrName">%name%</div>
        <div class="iconStatus"></div>
        <div class="callTime">%callTime%</div>
+       <div class="callDate hidden">%callDate%</div>
 </li>
\ No newline at end of file
index 7073de1..1f5a3f3 100644 (file)
@@ -6,6 +6,7 @@
                        <ul data-role="listview"
                                id="calllogList"
                                data-filter="true"
+                               data-autodividers="true"
                                data-position="fixed"
                                data-inset="true">
                        </ul>