Adapt the implementation of QDesktopService on iOS to Android
Change-Id: I8c2048155c5c065b5cdf7ad4cef9d8a446a0561d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
34f29e5749
commit
dca394096f
@ -42,6 +42,7 @@
|
|||||||
#include <QtCore/qurl.h>
|
#include <QtCore/qurl.h>
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtCore/private/qcore_mac_p.h>
|
#include <QtCore/private/qcore_mac_p.h>
|
||||||
|
#include <QtCore/qscopedvaluerollback.h>
|
||||||
|
|
||||||
#include <QtGui/qdesktopservices.h>
|
#include <QtGui/qdesktopservices.h>
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ bool QIOSServices::openUrl(const QUrl &url)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// avoid recursing back into self
|
||||||
if (url == m_handlingUrl)
|
if (url == m_handlingUrl)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -94,16 +96,12 @@ bool QIOSServices::openDocument(const QUrl &url)
|
|||||||
/* Callback from iOS that the application should handle a URL */
|
/* Callback from iOS that the application should handle a URL */
|
||||||
bool QIOSServices::handleUrl(const QUrl &url)
|
bool QIOSServices::handleUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
QUrl previouslyHandling = m_handlingUrl;
|
QScopedValueRollback<QUrl> rollback(m_handlingUrl, url);
|
||||||
m_handlingUrl = url;
|
|
||||||
|
|
||||||
// FIXME: Add platform services callback from QDesktopServices::setUrlHandler
|
// FIXME: Add platform services callback from QDesktopServices::setUrlHandler
|
||||||
// so that we can warn the user if calling setUrlHandler without also setting
|
// so that we can warn the user if calling setUrlHandler without also setting
|
||||||
// up the matching keys in the Info.plist file (CFBundleURLTypes and friends).
|
// up the matching keys in the Info.plist file (CFBundleURLTypes and friends).
|
||||||
bool couldHandle = QDesktopServices::openUrl(url);
|
return QDesktopServices::openUrl(url);
|
||||||
|
|
||||||
m_handlingUrl = previouslyHandling;
|
|
||||||
return couldHandle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user