summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2010-11-05 16:01:58 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2011-02-10 12:26:28 (GMT)
commit5f5e67e39bfc073d65857f6edae1df0db8507edd (patch)
tree34fc4505af0b6802013cd0b8c029a2e95eb28049 /src
parent776a9aeaa8006e789d3f956250876867c350a209 (diff)
downloadQt-5f5e67e39bfc073d65857f6edae1df0db8507edd.zip
Qt-5f5e67e39bfc073d65857f6edae1df0db8507edd.tar.gz
Qt-5f5e67e39bfc073d65857f6edae1df0db8507edd.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qevent.cpp14
-rw-r--r--src/gui/kernel/qevent.h2
2 files changed, 16 insertions, 0 deletions
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<const QFileOpenEventPrivate *>(d)->url;
}
+void QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
+{
+ file.setFileName(f);
+#ifdef Q_OS_SYMBIAN
+ const QFileOpenEventPrivate *priv = reinterpret_cast<const QFileOpenEventPrivate *>(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 <QtCore/qvariant.h>
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
+#include <QtCore/qfile.h>
#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;
};