From b28fa785df693bd46895ae9900810daf38c24bfa Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 18 May 2010 16:16:01 +0100 Subject: Provide a string for the case where a file upload control has not had a file attached to it. Requires a frameworks/base change. Change-Id: Ia50d4b8cceb943166198888dad364b09a2dc06a1 --- WebCore/platform/android/FileChooserAndroid.cpp | 6 ++++-- WebCore/platform/android/LocalizedStringsAndroid.cpp | 4 ++-- WebCore/platform/android/PlatformBridge.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'WebCore') diff --git a/WebCore/platform/android/FileChooserAndroid.cpp b/WebCore/platform/android/FileChooserAndroid.cpp index 9e50e67..f2ad3b9 100644 --- a/WebCore/platform/android/FileChooserAndroid.cpp +++ b/WebCore/platform/android/FileChooserAndroid.cpp @@ -27,6 +27,7 @@ #include "FileChooser.h" #include "FileSystem.h" #include "Font.h" +#include "LocalizedStrings.h" #include "StringTruncator.h" namespace WebCore { @@ -34,9 +35,10 @@ namespace WebCore { String FileChooser::basenameForWidth(const Font& font, int width) const { if (!m_filenames.size()) - return String(); + return fileButtonNoFileSelectedLabel(); + String output = pathGetFileName(m_filenames[0]); - return StringTruncator::rightTruncate(output, static_cast(width), font, false); + return StringTruncator::centerTruncate(output, static_cast(width), font, false); } } // namespace WebCore diff --git a/WebCore/platform/android/LocalizedStringsAndroid.cpp b/WebCore/platform/android/LocalizedStringsAndroid.cpp index e0db88d..5ca7fa2 100644 --- a/WebCore/platform/android/LocalizedStringsAndroid.cpp +++ b/WebCore/platform/android/LocalizedStringsAndroid.cpp @@ -48,8 +48,8 @@ String fileButtonChooseFileLabel() String fileButtonNoFileSelectedLabel() { - notImplemented(); - return String(); + return *(PlatformBridge::globalLocalizedName( + PlatformBridge::FileUploadNoFileChosenLabel)); } String contextMenuItemTagInspectElement() diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index cdd22f3..33f8697 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -119,7 +119,8 @@ public: DrawableDir, FileUploadLabel, ResetLabel, - SubmitLabel + SubmitLabel, + FileUploadNoFileChosenLabel }; static String* globalLocalizedName(rawResId resId); -- cgit v1.1