diff options
author | mread <qt-info@nokia.com> | 2011-01-07 11:07:08 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2011-02-10 12:26:33 (GMT) |
commit | f29b95cef0441958050c86d3544cdfde32e9e62e (patch) | |
tree | 1020798e76164f3597b34cf590d3d5b3f06191ae /src/gui/s60framework/qs60maindocument.cpp | |
parent | 977638104d091dd8780f4d1bee79bf014d6a2fe9 (diff) | |
download | Qt-f29b95cef0441958050c86d3544cdfde32e9e62e.zip Qt-f29b95cef0441958050c86d3544cdfde32e9e62e.tar.gz Qt-f29b95cef0441958050c86d3544cdfde32e9e62e.tar.bz2 |
Using QFile open by RFile and take ownership of handle
QFileOpenEvent's open method now opens the QFile with an RFile handle if
possible. It takes a duplicate of the handle and transfers ownership to
the QFile, so that the QFile can be used many times and outside of the
lifetime of the QFileOpenEvent.
Task-number: QTBUG-15015
Reviewed-by: Shane Kearns
Diffstat (limited to 'src/gui/s60framework/qs60maindocument.cpp')
-rw-r--r-- | src/gui/s60framework/qs60maindocument.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index d53aac1..37bd55f 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -113,10 +113,12 @@ CEikAppUi *QS60MainDocument::CreateAppUiL() */ CFileStore *QS60MainDocument::OpenFileL(TBool /*aDoOpen*/, const TDesC &aFilename, RFs &/*aFs*/) { - QCoreApplication* app = QCoreApplication::instance(); - QString qname = qt_TDesC2QString(aFilename); - QFileOpenEvent* event = new QFileOpenEvent(qname); - app->postEvent(app, event); + QT_TRYCATCH_LEAVING( { + QCoreApplication* app = QCoreApplication::instance(); + QString qname = qt_TDesC2QString(aFilename); + QFileOpenEvent* event = new QFileOpenEvent(qname); + app->postEvent(app, event); + }) return 0; } @@ -125,8 +127,12 @@ CFileStore *QS60MainDocument::OpenFileL(TBool /*aDoOpen*/, const TDesC &aFilenam */ void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) { - QCoreApplication* app = QCoreApplication::instance(); - QFileOpenEvent* event = new QFileOpenEvent(aFile); + QT_TRYCATCH_LEAVING( { + QCoreApplication* app = QCoreApplication::instance(); + QFileOpenEvent* event = new QFileOpenEvent(aFile); + app->postEvent(app, event); + aFileStore = 0; + }) } QT_END_NAMESPACE |