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:
parent
0b71d61d37
commit
eb1fe81b7d
@ -127,28 +127,33 @@ QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const
|
|||||||
|
|
||||||
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
|
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (isInitialized()) {
|
Q_ASSERT(isInitialized());
|
||||||
QByteArray data = url.toString().toUtf8();
|
QByteArray data = url.toString().toUtf8();
|
||||||
|
|
||||||
static const int chunkSize = 128;
|
static const int chunkSize = 128;
|
||||||
while (!data.isEmpty()) {
|
while (!data.isEmpty()) {
|
||||||
QByteArray chunk = data.left(chunkSize);
|
QByteArray chunk = data.left(chunkSize);
|
||||||
data = data.mid(chunkSize);
|
data = data.mid(chunkSize);
|
||||||
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
|
open_url(!data.isEmpty(), QString::fromUtf8(chunk));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url)
|
bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
openUrl_helper(url);
|
if (isInitialized()) {
|
||||||
return true;
|
openUrl_helper(url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return QGenericUnixServices::openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url)
|
bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url)
|
||||||
{
|
{
|
||||||
openUrl_helper(url);
|
if (isInitialized()) {
|
||||||
return true;
|
openUrl_helper(url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return QGenericUnixServices::openDocument(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <QtCore/QScopedPointer>
|
#include <QtCore/QScopedPointer>
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <qpa/qplatformservices.h>
|
#include <QtPlatformSupport/private/qgenericunixservices_p.h>
|
||||||
|
|
||||||
#include <QtWaylandClient/private/qwayland-windowmanager.h>
|
#include <QtWaylandClient/private/qwayland-windowmanager.h>
|
||||||
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
|
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
|
||||||
@ -52,7 +52,7 @@ class QWaylandDisplay;
|
|||||||
|
|
||||||
class QWaylandWindowManagerIntegrationPrivate;
|
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_OBJECT
|
||||||
Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)
|
Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user