From bf8dd69eaba6bf823e3405616af2e14f5aaacdec Mon Sep 17 00:00:00 2001 From: Alberto Pastor Date: Fri, 15 Mar 2013 10:18:56 +0000 Subject: [PATCH] Bug 828732 - Showing an error msg when adding to an existing contact and the list is empty Dialer displaying action menu unless success on the activity --- .../contacts/js/contacts_list.js | 21 +++++++++++++++++++ .../locales/contacts.en-US.properties | 3 +++ 2 files changed, 24 insertions(+) diff --git a/apps/communications/contacts/js/contacts_list.js b/apps/communications/contacts/js/contacts_list.js index 6fd52dbe86db..14a192d9250b 100644 --- a/apps/communications/contacts/js/contacts_list.js +++ b/apps/communications/contacts/js/contacts_list.js @@ -558,6 +558,13 @@ contacts.List = (function() { }; var toggleNoContactsScreen = function cl_toggleNoContacs(show) { + if (show && ActivityHandler.currentlyHandling) { + var actName = ActivityHandler.activityName; + if (actName == 'pick' || actName == 'update') { + showNoContactsAlert(); + return; + } + } if (show && !ActivityHandler.currentlyHandling) { noContacts.classList.remove('hide'); return; @@ -565,6 +572,20 @@ contacts.List = (function() { noContacts.classList.add('hide'); }; + var showNoContactsAlert = function showNoContactsAlert() { + var msg = _('noContactsActivity'); + var noObject = { + title: _('ok'), + isDanger: false, + callback: function onNoClicked() { + ConfirmDialog.hide(); + ActivityHandler.postCancel(); + } + }; + + ConfirmDialog.show(null, msg, noObject); + }; + function addToFavoriteList(favorite) { var container = headers['favorites']; container.appendChild(favorite); diff --git a/apps/communications/contacts/locales/contacts.en-US.properties b/apps/communications/contacts/locales/contacts.en-US.properties index 1435caf9a11e..4b77f0b98437 100644 --- a/apps/communications/contacts/locales/contacts.en-US.properties +++ b/apps/communications/contacts/locales/contacts.en-US.properties @@ -21,6 +21,9 @@ no_phones = No phones no_email = No email removePhotoConfirm = Remove contact picture? loadingContacts = Loading contacts… +# LOCALIZATION NOTE(noContactsActivity): Shown when using the context menu to add +# a number from your call list to a contact, and your contacts list is empty. +noContactsActivity = Cannot add to contact as your contact list is empty # Contact fields noName = No name