summaryrefslogtreecommitdiffstats
path: root/src/gui/s60framework
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2010-11-05 08:10:14 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2011-02-10 12:26:24 (GMT)
commit01f5c74b8ecddfc192895ccb85c1627467bb6ff5 (patch)
tree387b0690fd6c5ec32d3c6732329ed91a66bffcd0 /src/gui/s60framework
parentabb425e3db6c20c5271788cb1ec4e1fe37b9ea5b (diff)
downloadQt-01f5c74b8ecddfc192895ccb85c1627467bb6ff5.zip
Qt-01f5c74b8ecddfc192895ccb85c1627467bb6ff5.tar.gz
Qt-01f5c74b8ecddfc192895ccb85c1627467bb6ff5.tar.bz2
Generating QFileOpenEvent messages when S60 UI receives OpenFileL
S60 applications can receive OpenFileL requests from other apps in the OpenFileL method of their main document class. This S60 main document class is internal to QtGui, so the request is turned into a QFileOpenEvent for the application to pick up if it want to implenment this service. If an application wants to receive the QFileOpenEvent before UI construction, it should do something like: app->sendPostedEvents(app, QEvent::FileOpen); Task-number: QTBUG-15015 Reviewed-by: Shane Kearns
Diffstat (limited to 'src/gui/s60framework')
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp10
-rw-r--r--src/gui/s60framework/qs60mainappui.h1
-rw-r--r--src/gui/s60framework/qs60maindocument.cpp20
3 files changed, 28 insertions, 3 deletions
diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index b5b8b81..454f90d 100644
--- a/src/gui/s60framework/qs60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -49,6 +49,7 @@
#include <avkon.rsg>
#endif
#include <barsread.h>
+#include <coeutils.h>
#include <qconfig.h>
#include "qs60mainappui.h"
@@ -401,6 +402,15 @@ void QS60MainAppUi::HandleForegroundEventL(TBool aForeground)
QS60MainAppUiBase::HandleForegroundEventL(aForeground);
}
+/*!
+ \internal
+*/
+TBool QS60MainAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/, TFileName &aDocumentName, const TDesC8 &/*aTail*/)
+{
+ // bypass CEikAppUi::ProcessCommandParametersL(..) which modifies aDocumentName, preventing apparc document opening from working.
+ return ConeUtils::FileExists(aDocumentName);
+}
+
#ifndef Q_WS_S60
void QS60StubAknAppUi::HandleViewDeactivation(const TVwsViewId &, const TVwsViewId &) {}
diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h
index ce3b5b0..bf118ff 100644
--- a/src/gui/s60framework/qs60mainappui.h
+++ b/src/gui/s60framework/qs60mainappui.h
@@ -131,6 +131,7 @@ public:
virtual void HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId);
virtual void PrepareToExit();
virtual void HandleTouchPaneSizeChange();
+ virtual TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName &aDocumentName, const TDesC8 &aTail);
protected:
virtual void HandleScreenDeviceChangedL();
diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp
index a8886ac..071aa5b 100644
--- a/src/gui/s60framework/qs60maindocument.cpp
+++ b/src/gui/s60framework/qs60maindocument.cpp
@@ -41,6 +41,8 @@
#include "qs60mainappui.h"
#include "qs60maindocument.h"
+#include "qcoreapplication.h"
+#include "qevent.h"
#include <exception>
@@ -108,9 +110,15 @@ CEikAppUi *QS60MainDocument::CreateAppUiL()
/*!
\internal
*/
-CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs)
+CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &/*aFs*/)
{
- return QS60MainDocumentBase::OpenFileL(aDoOpen, aFilename, aFs);
+ if (aDoOpen) {
+ QCoreApplication* app = QCoreApplication::instance();
+ QString qname((QChar*)aFilename.Ptr(), aFilename.Length());
+ QFileOpenEvent* event = new QFileOpenEvent(qname);
+ app->postEvent(app, event);
+ }
+ return 0;
}
/*!
@@ -118,7 +126,13 @@ CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, R
*/
void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile)
{
- QS60MainDocumentBase::OpenFileL(aFileStore, aFile);
+ QCoreApplication* app = QCoreApplication::instance();
+ TFileName name;
+ aFile.FullName(name);
+ QString qname((QChar*)name.Ptr(), name.Length());
+ QFileOpenEvent* event = new QFileOpenEvent(qname);
+ app->postEvent(app, event);
+ aFileStore = 0;
}
QT_END_NAMESPACE