Hi there, Below is a QtMoko patch (for the Arora submodule) for hyperlink viewing - i.e. so that touching on a hyperlink in, say, an email causes Arora to pop up and show the corresponding web page.
I imagine a very similar patch could be applied to Yberbrowser, but I still mostly use Arora, so haven't looked at that in detail. Also I don't know what happens if there are two installed apps that both provide the WebAccess service. Slightly related is this story about tel: URLs in web pages with telephone "numbers" that are actually dangerous USSD requests, and some Android phones automatically executing those requests: http://nakedsecurity.sophos.com/2012/09/26/are-android-phones-facing-a-remote-wipe-hacking-pandemic On the GTA04, with QtMoko: - USSD requests in general are implemented; e.g. typing *#06# into the dialer will cause your IMEI to pop up. This happens immediately after the second #, without any call button press. - The Arora browser doesn't seem to understand tel: URLs at all, so the patch below isn't exposing any new danger (unless/until Arora might be enhanced to support tel: URLs). - I don't know if the dialer would execute a USSD request without confirmation if the request came from another application, instead of being typed into the dialer. - I don't know if the GTA04 has any dangerous USSD codes! Does anyone know about the last two points? Regards, Neil
>From a3784d5e4107cbc460139bc3ded8fe0cde76b9ec Mon Sep 17 00:00:00 2001 From: Neil Jerram <n...@ossau.homelinux.net> Date: Sun, 16 Sep 2012 23:42:19 +0100 Subject: [PATCH] arora - Provide the Qtopia "WebAccess" service This makes clicking on links in email work - both when Arora is already running, and when there isn't already any web browser running (in which case Arora is started automatically). --- .gitignore | 2 +- src/browserapplication.cpp | 29 +++++++++++++++++++++++++++++ src/qbuild.pro | 6 ++++++ src/services/WebAccess/arora | 2 ++ src/webservice.h | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/services/WebAccess/arora create mode 100644 src/webservice.h diff --git a/.gitignore b/.gitignore index b101154..a8bea3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -arora +/arora Arora.app Makefile .DS_Store diff --git a/src/browserapplication.cpp b/src/browserapplication.cpp index cc8bd1f..5585971 100644 --- a/src/browserapplication.cpp +++ b/src/browserapplication.cpp @@ -83,9 +83,23 @@ #include <qwebsettings.h> #include <QtopiaApplication> +#include <QtopiaAbstractService> #include <qdebug.h> +#include "webservice.h" + +void WebAccessService::openURL(QString url) +{ + emit openUrl(url); +} + +void WebAccessService::openSecureURL(QString url) +{ + // XXX make sure this is a secure url + emit openUrl(url); +} + DownloadManager *BrowserApplication::s_downloadManager = 0; HistoryManager *BrowserApplication::s_historyManager = 0; NetworkAccessManager *BrowserApplication::s_networkAccessManager = 0; @@ -152,6 +166,10 @@ BrowserApplication::BrowserApplication(int &argc, char **argv) this, SLOT(lastWindowClosed())); #endif + QObject *service = new WebAccessService(this); + connect(service, SIGNAL(openUrl(const QString &)), + this, SLOT(messageRecieved(const QString &))); + #ifndef AUTOTESTS QTimer::singleShot(0, this, SLOT(postLaunch())); #endif @@ -455,6 +473,17 @@ BrowserMainWindow *BrowserApplication::newMainWindow() m_mainWindows.prepend(browser); setMainWidget(browser); // showMainWidget(); + + // Calling showMainWidget() a second time is the magic sauce that + // is needed for Qtopia not to kill Arora after it has processed a + // request for the WebAccess service. When servicing a + // QtopiaServiceRequest requires _launching_ a new application - + // i.e. because a suitable application isn't already running - + // Qtopia's default behaviour is to close the launched application + // again as soon as it appears to have processed that request. + // For a web browser, we clearly don't want that. + showMainWidget(); + // browser->show(); return browser; } diff --git a/src/qbuild.pro b/src/qbuild.pro index 4db82b6..7e39289 100644 --- a/src/qbuild.pro +++ b/src/qbuild.pro @@ -93,6 +93,7 @@ HEADERS += \ tabwidget.h \ toolbarsearch.h \ webactionmapper.h \ + webservice.h \ webview.h \ webviewsearch.h \ xbel.h @@ -151,3 +152,8 @@ SOURCES += \ utils/rotate.cpp #----------------------------------------------- + +# Install service registration +service.files=services/WebAccess/arora +service.path=/services/WebAccess +INSTALLS+=service diff --git a/src/services/WebAccess/arora b/src/services/WebAccess/arora new file mode 100644 index 0000000..f99c0fd --- /dev/null +++ b/src/services/WebAccess/arora @@ -0,0 +1,2 @@ +[Standard] +Version=100 diff --git a/src/webservice.h b/src/webservice.h new file mode 100644 index 0000000..d164a68 --- /dev/null +++ b/src/webservice.h @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** This file was largely copied from examples/webviewer/webviewer.cpp +** in the QtMoko distribution. But given that it has so few lines of +** code, and that that code simply implements what standard Qtopia +** documentation says for a Qtopia service, I don't think it has to +** inherit that file's copyright and license. For the same reasons, +** we don't declare any specific copyright and license for this file. +** +****************************************************************************/ + +#ifndef WEBSERVICE_H +#define WEBSERVICE_H + +#include <qobject.h> +#include <qtopiaabstractservice.h> +#include <qstring.h> + +class WebAccessService : public QtopiaAbstractService +{ + Q_OBJECT + +public: + WebAccessService(QObject* parent) : QtopiaAbstractService("WebAccess",parent) + { + publishAll(); + } + +signals: + void openUrl(const QString &); + +public slots: + void openURL(QString); + void openSecureURL(QString); +}; + +#endif -- 1.7.10.4
_______________________________________________ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community