summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2010-11-05 13:23:38 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2011-02-10 12:26:26 (GMT)
commit776a9aeaa8006e789d3f956250876867c350a209 (patch)
tree6bca826ae8bc13215253538ad0920fc9952e4683
parentedcaa583aa9232f48c92d7c78a7b3e6c71212bc1 (diff)
downloadQt-776a9aeaa8006e789d3f956250876867c350a209.zip
Qt-776a9aeaa8006e789d3f956250876867c350a209.tar.gz
Qt-776a9aeaa8006e789d3f956250876867c350a209.tar.bz2
Added a file handle to QFileOpenEvent on Symbian
QFileOpenEvent needs to tell the recipient what file to open. Normally that is by filename. But on Symbian, some files can only be opened from an already-open file handle that has been passed in. For example data caged files in c:\private or z:\sys. So QFileOpenEvent needs to be able to hold a Symbian file handle so that the recipient can access any file requested of it. Coming soon... a method by which the reciever can access the file without knowing about all this messy file handle stuff going on behind the scenes. Task-number: QTBUG-15015 Reviewed-by: Shane Kearns
-rw-r--r--src/gui/kernel/qevent.cpp28
-rw-r--r--src/gui/kernel/qevent.h7
-rw-r--r--src/gui/kernel/qevent_p.h7
-rw-r--r--src/gui/s60framework/qs60maindocument.cpp17
4 files changed, 46 insertions, 13 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index e7abb47..f7bc54c 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -53,6 +53,10 @@
#include "qgesture.h"
#include "qgesture_p.h"
+#ifdef Q_OS_SYMBIAN
+#include "private/qcore_symbian_p.h"
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -3023,7 +3027,7 @@ QShowEvent::~QShowEvent()
This event is only used to notify the application of a request.
It may be safely ignored.
- \note This class is currently supported for Mac OS X only.
+ \note This class is currently supported for Mac OS X and Symbian only.
*/
/*!
@@ -3049,11 +3053,31 @@ QFileOpenEvent::QFileOpenEvent(const QUrl &url)
f = url.toLocalFile();
}
+#ifdef Q_OS_SYMBIAN
+/*! \internal
+*/
+QFileOpenEvent::QFileOpenEvent(const RFile &fileHandle)
+ : QEvent(FileOpen)
+{
+ TFileName fullName;
+ fileHandle.FullName(fullName);
+ QString file = qt_TDesC2QString(fullName);
+ f = file;
+ QScopedPointer<QFileOpenEventPrivate> priv(new QFileOpenEventPrivate(QUrl::fromLocalFile(file)));
+ qt_symbian_throwIfError(priv->file.Duplicate(fileHandle));
+ d = reinterpret_cast<QEventPrivate *>(priv.take());
+}
+#endif
+
/*! \internal
*/
QFileOpenEvent::~QFileOpenEvent()
{
- delete reinterpret_cast<QFileOpenEventPrivate *>(d);
+ QFileOpenEventPrivate *priv = reinterpret_cast<QFileOpenEventPrivate *>(d);
+#ifdef Q_OS_SYMBIAN
+ priv->file.Close();
+#endif
+ delete priv;
}
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index a7b06f4..2f5c486 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -55,6 +55,10 @@
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
+#ifdef Q_OS_SYMBIAN
+class RFile;
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -641,6 +645,9 @@ class Q_GUI_EXPORT QFileOpenEvent : public QEvent
public:
QFileOpenEvent(const QString &file);
QFileOpenEvent(const QUrl &url);
+#ifdef Q_OS_SYMBIAN
+ QFileOpenEvent(const RFile &fileHandle);
+#endif
~QFileOpenEvent();
inline QString file() const { return f; }
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 3a27023..01af384 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -46,6 +46,10 @@
#include <QtCore/qurl.h>
#include <QtGui/qevent.h>
+#ifdef Q_OS_SYMBIAN
+#include <f32file.h>
+#endif
+
QT_BEGIN_NAMESPACE
//
@@ -176,6 +180,9 @@ public:
}
QUrl url;
+#ifdef Q_OS_SYMBIAN
+ RFile file;
+#endif
};
diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp
index 95effbc..eafbcb0 100644
--- a/src/gui/s60framework/qs60maindocument.cpp
+++ b/src/gui/s60framework/qs60maindocument.cpp
@@ -111,14 +111,12 @@ CEikAppUi *QS60MainDocument::CreateAppUiL()
/*!
\internal
*/
-CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &/*aFs*/)
+CFileStore *QS60MainDocument::OpenFileL(TBool /*aDoOpen*/, const TDesC &aFilename, RFs &/*aFs*/)
{
- if (aDoOpen) {
- QCoreApplication* app = QCoreApplication::instance();
- QString qname = qt_TDesC2QString(aFilename);
- QFileOpenEvent* event = new QFileOpenEvent(qname);
- app->postEvent(app, event);
- }
+ QCoreApplication* app = QCoreApplication::instance();
+ QString qname = qt_TDesC2QString(aFilename);
+ QFileOpenEvent* event = new QFileOpenEvent(qname);
+ app->postEvent(app, event);
return 0;
}
@@ -128,10 +126,7 @@ CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, R
void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile)
{
QCoreApplication* app = QCoreApplication::instance();
- TFileName name;
- aFile.FullName(name);
- QString qname = qt_TDesC2QString(name);
- QFileOpenEvent* event = new QFileOpenEvent(qname);
+ QFileOpenEvent* event = new QFileOpenEvent(aFile);
app->postEvent(app, event);
aFileStore = 0;
}