From 5f5e67e39bfc073d65857f6edae1df0db8507edd Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 5 Nov 2010 16:01:58 +0000 Subject: added an openFile method to QFileOpenEvent An application needs some way to get an open QFile when a QFileOpenEvent contains a Symbian file handle. Rather than exposing that file handle and forcing platform specific code to the application, this method hides the details giving an effective universal method for turning a QFileOpenEvent into an open QFile. Task-number: QTBUG-15015 Reviewed-by: Shane Kearns --- src/gui/kernel/qevent.cpp | 14 ++++++++++++++ src/gui/kernel/qevent.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index f7bc54c..8a67b91 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3098,6 +3098,20 @@ QUrl QFileOpenEvent::url() const return reinterpret_cast(d)->url; } +void QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const +{ + file.setFileName(f); +#ifdef Q_OS_SYMBIAN + const QFileOpenEventPrivate *priv = reinterpret_cast(d); + if (priv->file.SubSessionHandle()) { + // TODO return a QFile opened from the file handle + file.open(flags); + return; + } +#endif + file.open(flags); +} + #ifndef QT_NO_TOOLBAR /*! \internal diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 2f5c486..0499a6d 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -54,6 +54,7 @@ #include #include #include +#include #ifdef Q_OS_SYMBIAN class RFile; @@ -652,6 +653,7 @@ public: inline QString file() const { return f; } QUrl url() const; + void openFile(QFile &file, QIODevice::OpenMode flags) const; private: QString f; }; -- cgit v0.12