Fix QDesktopServices::openUrl when there is no windowmanager integration

Change-Id: I51da06261acfb193a59db34bc2dd25e3452fce8d
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Giulio Camuffo 2015-08-20 14:47:36 +02:00
parent 0b71d61d37
commit eb1fe81b7d
2 changed files with 19 additions and 14 deletions

View File

@ -127,28 +127,33 @@ QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
{
if (isInitialized()) {
QByteArray data = url.toString().toUtf8();
Q_ASSERT(isInitialized());
QByteArray data = url.toString().toUtf8();
static const int chunkSize = 128;
while (!data.isEmpty()) {
QByteArray chunk = data.left(chunkSize);
data = data.mid(chunkSize);
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
}
static const int chunkSize = 128;
while (!data.isEmpty()) {
QByteArray chunk = data.left(chunkSize);
data = data.mid(chunkSize);
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
}
}
bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url)
{
openUrl_helper(url);
return true;
if (isInitialized()) {
openUrl_helper(url);
return true;
}
return QGenericUnixServices::openUrl(url);
}
bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url)
{
openUrl_helper(url);
return true;
if (isInitialized()) {
openUrl_helper(url);
return true;
}
return QGenericUnixServices::openDocument(url);
}
}

View File

@ -38,7 +38,7 @@
#include <QtCore/QScopedPointer>
#include <wayland-client.h>
#include <qpa/qplatformservices.h>
#include <QtPlatformSupport/private/qgenericunixservices_p.h>
#include <QtWaylandClient/private/qwayland-windowmanager.h>
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
@ -52,7 +52,7 @@ class QWaylandDisplay;
class QWaylandWindowManagerIntegrationPrivate;
class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QPlatformServices, public QtWayland::qt_windowmanager
class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowManagerIntegration : public QObject, public QGenericUnixServices, public QtWayland::qt_windowmanager
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)