Add QWindowSystemInterface::handleFileOpen(const QUrl&)

In some cases, the call to handleFileOpen may receive a non local URL.
With previous API, there was no way to pass it to other layers. With
this change, any platform plugin creating this event can directly pass
a URL.

Change-Id: Ibd7299ad6c09527e1db979840bd67726882efb9b
Reviewed-by: Jose Dapena Paz <jdapena@igalia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
bb10
José Dapena Paz 2013-01-08 20:17:05 +01:00 committed by The Qt Project
parent bfa1584162
commit 9b90ab9914
4 changed files with 14 additions and 4 deletions

View File

@ -1674,10 +1674,10 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
void QGuiApplicationPrivate::processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e)
{
if (e->fileName.isEmpty())
if (e->url.isEmpty())
return;
QFileOpenEvent event(e->fileName);
QFileOpenEvent event(e->url);
QGuiApplication::sendSpontaneousEvent(qApp, &event);
}

View File

@ -575,6 +575,12 @@ void QWindowSystemInterface::handleFileOpenEvent(const QString& fileName)
QGuiApplicationPrivate::processWindowSystemEvent(&e);
}
void QWindowSystemInterface::handleFileOpenEvent(const QUrl &url)
{
QWindowSystemInterfacePrivate::FileOpenEvent e(url);
QGuiApplicationPrivate::processWindowSystemEvent(&e);
}
void QWindowSystemInterface::handleTabletEvent(QWindow *w, ulong timestamp, bool down, const QPointF &local, const QPointF &global,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,

View File

@ -158,6 +158,7 @@ public:
static void handleThemeChange(QWindow *tlw);
static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url);
static void handleTabletEvent(QWindow *w, ulong timestamp, bool down, const QPointF &local, const QPointF &global,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,

View File

@ -285,9 +285,12 @@ public:
class FileOpenEvent : public WindowSystemEvent {
public:
FileOpenEvent(const QString& fileName)
: WindowSystemEvent(FileOpen), fileName(fileName)
: WindowSystemEvent(FileOpen), url(QUrl::fromLocalFile(fileName))
{ }
QString fileName;
FileOpenEvent(const QUrl &url)
: WindowSystemEvent(FileOpen), url(url)
{ }
QUrl url;
};
class TabletEvent : public InputEvent {