Title: [172424] trunk/Source
Revision
172424
Author
[email protected]
Date
2014-08-11 18:04:07 -0700 (Mon, 11 Aug 2014)

Log Message

Improve look and feel of combined service menu..
https://bugs.webkit.org/show_bug.cgi?id=135824
<rdar://problem/17936880>

Reviewed by Tim Horton.
Source/WebCore:


Adding some localizable strings.

* English.lproj/Localizable.strings:

Source/WebKit2:

        
When showing the combined menu, list the phone numbers first,
grouped under a common header, followed by the entries relative
to the services.

* Platform/mac/MenuUtilities.h:
* Platform/mac/MenuUtilities.mm:
(WebKit::menuItemTitleForTelephoneNumberGroup):
(WebKit::menuItemForTelephoneNumber):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172423 => 172424)


--- trunk/Source/WebCore/ChangeLog	2014-08-12 01:00:36 UTC (rev 172423)
+++ trunk/Source/WebCore/ChangeLog	2014-08-12 01:04:07 UTC (rev 172424)
@@ -1,3 +1,15 @@
+2014-08-11  Enrica Casucci  <[email protected]>
+
+        Improve look and feel of combined service menu..
+        https://bugs.webkit.org/show_bug.cgi?id=135824
+        <rdar://problem/17936880>
+
+        Reviewed by Tim Horton.
+
+        Adding some localizable strings.
+
+        * English.lproj/Localizable.strings:
+
 2014-08-11  Jer Noble  <[email protected]>
 
         [iOS] <video> element requests are missing session cookies; sometimes persistant cookies.

Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (172423 => 172424)


--- trunk/Source/WebCore/English.lproj/Localizable.strings	2014-08-12 01:00:36 UTC (rev 172423)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings	2014-08-12 01:04:07 UTC (rev 172424)
@@ -118,6 +118,9 @@
 /* Undo action name */
 "Bold (Undo action name)" = "Bold";
 
+/* menu item title for phone number */
+"Call Using iPhone:" = "Call Using iPhone:";
+
 /* menu item for making a telephone call to a telephone number */
 "Call “%@” Using iPhone" = "Call “%@” Using iPhone";
 

Modified: trunk/Source/WebKit2/ChangeLog (172423 => 172424)


--- trunk/Source/WebKit2/ChangeLog	2014-08-12 01:00:36 UTC (rev 172423)
+++ trunk/Source/WebKit2/ChangeLog	2014-08-12 01:04:07 UTC (rev 172424)
@@ -1,3 +1,22 @@
+2014-08-11  Enrica Casucci  <[email protected]>
+
+        Improve look and feel of combined service menu..
+        https://bugs.webkit.org/show_bug.cgi?id=135824
+        <rdar://problem/17936880>
+
+        Reviewed by Tim Horton.
+        
+        When showing the combined menu, list the phone numbers first,
+        grouped under a common header, followed by the entries relative
+        to the services.
+
+        * Platform/mac/MenuUtilities.h:
+        * Platform/mac/MenuUtilities.mm:
+        (WebKit::menuItemTitleForTelephoneNumberGroup):
+        (WebKit::menuItemForTelephoneNumber):
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::setupServicesMenu):
+
 2014-08-11  Joseph Pecoraro  <[email protected]>
 
         Add Private WKPreferences API for developer extras (show inspector)

Modified: trunk/Source/WebKit2/Platform/mac/MenuUtilities.h (172423 => 172424)


--- trunk/Source/WebKit2/Platform/mac/MenuUtilities.h	2014-08-12 01:00:36 UTC (rev 172423)
+++ trunk/Source/WebKit2/Platform/mac/MenuUtilities.h	2014-08-12 01:04:07 UTC (rev 172424)
@@ -34,6 +34,7 @@
 #if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumberString);
 NSArray *menuItemsForTelephoneNumber(const String& telephoneNumber);
+NSString *menuItemTitleForTelephoneNumberGroup();
 #endif
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm (172423 => 172424)


--- trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm	2014-08-12 01:00:36 UTC (rev 172423)
+++ trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm	2014-08-12 01:04:07 UTC (rev 172424)
@@ -58,6 +58,11 @@
     return [NSString stringWithFormat:WEB_UI_STRING("Call “%@” Using iPhone", "menu item for making a telephone call to a telephone number"), formattedPhoneNumberString(telephoneNumber)];
 }
 
+NSString *menuItemTitleForTelephoneNumberGroup()
+{
+    return WEB_UI_STRING("Call Using iPhone:", "menu item title for phone number");
+}
+
 NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumber)
 {
     NSArray *proposedMenu = [[getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:getDDBinderPhoneNumberKey() service:nil context:nil];
@@ -71,7 +76,7 @@
             continue;
 
         if ([actionObject.actionUTI hasPrefix:@"com.apple.dial"]) {
-            item.title = menuItemTitleForTelephoneNumber(telephoneNumber);
+            item.title = formattedPhoneNumberString(telephoneNumber);
             return item;
         }
     }

Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm (172423 => 172424)


--- trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2014-08-12 01:00:36 UTC (rev 172423)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2014-08-12 01:04:07 UTC (rev 172424)
@@ -407,12 +407,18 @@
     const Vector<String>& selectedTelephoneNumbers = context.selectedTelephoneNumbers();
     if (!selectedTelephoneNumbers.isEmpty()) {
         if (m_servicesMenu)
-            [m_servicesMenu addItem:[NSMenuItem separatorItem]];
+            [m_servicesMenu insertItem:[NSMenuItem separatorItem] atIndex:0];
         else
             m_servicesMenu = adoptNS([[NSMenu alloc] init]);
+        int itemPosition = 0;
+        NSMenuItem *groupEntry = [[NSMenuItem alloc] initWithTitle:menuItemTitleForTelephoneNumberGroup() action:nil keyEquivalent:@""];
+        [groupEntry setEnabled:NO];
+        [m_servicesMenu insertItem:groupEntry atIndex:itemPosition++];
         for (auto& telephoneNumber : selectedTelephoneNumbers) {
-            if (NSMenuItem *item = menuItemForTelephoneNumber(telephoneNumber))
-                [m_servicesMenu addItem:item];
+            if (NSMenuItem *item = menuItemForTelephoneNumber(telephoneNumber)) {
+                [item setIndentationLevel:1];
+                [m_servicesMenu insertItem:item atIndex:itemPosition++];
+            }
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to