- // This is a crude imitation of the code found in module core-ext, which handles the contents
- // in a more sophisticated way. It can't be accessed from JavaME just yet because it relies
- // on URL parsing routines in java.net. This should be somehow worked around: TODO
- // For now, detect URLs in a simple way, and treat everything else as text
- if (text.startsWith("http://") || text.startsWith("https://") || maybeURLWithoutScheme(text)) {
- showYesNo("Open web page?", text);
+ ParsedReaderResult result = ParsedReaderResult.parseReaderResult(text);
+ ParsedReaderResultType type = result.getType();
+ if (type.equals(ParsedReaderResultType.URI)) {
+ String uri = ((URIParsedResult) result).getURI();
+ showOpenURL("Open web page?", uri, uri);
+ } else if (type.equals(ParsedReaderResultType.BOOKMARK)) {
+ String uri = ((BookmarkDoCoMoResult) result).getURI();
+ showOpenURL("Open web page?", uri, uri);
+ } else if (type.equals(ParsedReaderResultType.EMAIL)) {
+ String email = ((EmailDoCoMoResult) result).getTo();
+ showOpenURL("Compose e-mail?", email, "mailto:" + email);
+ } else if (type.equals(ParsedReaderResultType.EMAIL_ADDRESS)) {
+ String email = ((EmailAddressResult) result).getEmailAddress();
+ showOpenURL("Compose e-mail?", email, "mailto:" + email);
+ } else if (type.equals(ParsedReaderResultType.UPC)) {
+ String upc = ((UPCParsedResult) result).getUPC();
+ String uri = "http://www.upcdatabase.com/item.asp?upc=" + upc;
+ showOpenURL("Look up UPC?", upc, uri);