28 |
28 |
29 // This function handles when an app calls QDesktopServices.openUrl when the browser is already started |
29 // This function handles when an app calls QDesktopServices.openUrl when the browser is already started |
30 MCoeMessageObserver::TMessageResponse BrowserMainAppUiS60::HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8 &aMessageParameters) |
30 MCoeMessageObserver::TMessageResponse BrowserMainAppUiS60::HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8 &aMessageParameters) |
31 { |
31 { |
32 QString url = QString::fromUtf8((const char *)aMessageParameters.Ptr(), aMessageParameters.Length()); |
32 QString url = QString::fromUtf8((const char *)aMessageParameters.Ptr(), aMessageParameters.Length()); |
33 qDebug() << "BrowserMainAppUiS60::HandleMessageL " << |
33 //qDebug() << "BrowserMainAppUiS60::HandleMessageL " << |
34 QString::fromUtf16(aMessageUid.Name().Ptr(), aMessageUid.Name().Length()) << ", " << url; |
34 // QString::fromUtf16(aMessageUid.Name().Ptr(), aMessageUid.Name().Length()) << ", " << url; |
35 // I have no idea if the browser is thread-safe and what will happen when it receives this signal when it's in the middle of something else - mm |
35 // I have no idea if the browser is thread-safe and what will happen when it receives this signal when it's in the middle of something else - mm |
36 GinebraBrowser *urlHandler = ((BrowserMainApplicationS60 *)Application())->UrlHandler(); |
36 GinebraBrowser *urlHandler = ((BrowserMainApplicationS60 *)Application())->UrlHandler(); |
37 if (urlHandler != 0) { |
37 if (urlHandler != 0) { |
38 urlHandler->queueOpenUrl(url); |
38 urlHandler->queueOpenUrl(url); |
39 } |
39 } |
56 // } |
56 // } |
57 |
57 |
58 // These functions handle when an app calls QDesktopServices.openUrl when the browser isn't already started |
58 // These functions handle when an app calls QDesktopServices.openUrl when the browser isn't already started |
59 TBool BrowserMainAppUiS60::ProcessCommandParametersL(TApaCommand aCommand,TFileName& aFilename) |
59 TBool BrowserMainAppUiS60::ProcessCommandParametersL(TApaCommand aCommand,TFileName& aFilename) |
60 { |
60 { |
61 qDebug() << "BrowserMainAppUiS60:: ProcessCmdParms2 - " << aCommand << ", " << QString::fromUtf16(aFilename.Ptr(), aFilename.Length()); |
61 //qDebug() << "BrowserMainAppUiS60:: ProcessCmdParms2 - " << aCommand << ", " << QString::fromUtf16(aFilename.Ptr(), aFilename.Length()); |
62 // ((RealBrowserApp *)QApplication::instance())->setInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
62 // ((RealBrowserApp *)QApplication::instance())->setInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
63 ((BrowserMainApplicationS60 *)Application())->SetInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
63 ((BrowserMainApplicationS60 *)Application())->SetInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
64 return ETrue; |
64 return ETrue; |
65 } |
65 } |
66 |
66 |
67 TBool BrowserMainAppUiS60::ProcessCommandParametersL(TApaCommand aCommand,TFileName& aFilename, const TDesC8& aTail) |
67 TBool BrowserMainAppUiS60::ProcessCommandParametersL(TApaCommand aCommand,TFileName& aFilename, const TDesC8& aTail) |
68 { |
68 { |
69 qDebug() |
69 //qDebug() |
70 << "BrowserMainAppUiS60:: ProcessCmdParms3 - " << aCommand << ", " |
70 // << "BrowserMainAppUiS60:: ProcessCmdParms3 - " << aCommand << ", " |
71 << QString::fromUtf16(aFilename.Ptr(), aFilename.Length()) << ", " |
71 // << QString::fromUtf16(aFilename.Ptr(), aFilename.Length()) << ", " |
72 << QString::fromUtf8((const char*)aTail.Ptr(), aTail.Length()); |
72 // << QString::fromUtf8((const char*)aTail.Ptr(), aTail.Length()); |
73 ((BrowserMainApplicationS60 *)Application())->SetInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
73 ((BrowserMainApplicationS60 *)Application())->SetInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
74 // ((RealBrowserApp *)QApplication::instance())->setInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
74 // ((RealBrowserApp *)QApplication::instance())->setInitialUrl(QString::fromUtf16(aFilename.Ptr(), aFilename.Length())); |
75 return ETrue; |
75 return ETrue; |
76 } |
76 } |
77 |
77 |
91 // TFileName name; |
91 // TFileName name; |
92 // aFile.FullName(name); |
92 // aFile.FullName(name); |
93 // qDebug() << "BrowserMainDocumentS60::OpenFileL fs - " << QString::fromUtf16(name.Ptr(), name.Length()); |
93 // qDebug() << "BrowserMainDocumentS60::OpenFileL fs - " << QString::fromUtf16(name.Ptr(), name.Length()); |
94 // } |
94 // } |
95 |
95 |
96 static const TUid KUidBrowserMainApplicationS60 = { 0x1000BEEF }; |
|
97 |
|
98 BrowserMainApplicationS60* BrowserMainApplicationS60::Instance() |
|
99 { |
|
100 BrowserMainApplicationS60* pInstance = static_cast<BrowserMainApplicationS60 *>(CCoeEnv::Static(KUidBrowserMainApplicationS60)); |
|
101 if (!pInstance) { |
|
102 pInstance = new (ELeave) BrowserMainApplicationS60; |
|
103 } |
|
104 return pInstance; |
|
105 } |
|
106 |
|
107 CApaDocument *BrowserMainApplicationS60::CreateDocumentL() |
96 CApaDocument *BrowserMainApplicationS60::CreateDocumentL() |
108 { |
97 { |
109 // qDebug() << "BrowserMainApplicationS60::CreateDocumentL"; |
98 // qDebug() << "BrowserMainApplicationS60::CreateDocumentL"; |
110 return new (ELeave) BrowserMainDocumentS60(*this); |
99 return new (ELeave) BrowserMainDocumentS60(*this); |
111 } |
100 } |
112 |
101 |
113 BrowserMainApplicationS60::BrowserMainApplicationS60() : QS60MainApplication(), CCoeStatic( KUidBrowserMainApplicationS60 ), urlHandler(0) |
102 BrowserMainApplicationS60::BrowserMainApplicationS60() : QS60MainApplication(), urlHandler(0) |
114 { |
103 { |
115 // CApaCommandLine* commandLine = 0; |
104 // CApaCommandLine* commandLine = 0; |
116 // TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine); |
105 // TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine); |
117 // qDebug() << "BrowserMainApplicationS60 - " << QString::fromUtf16(commandLine->DocumentName().Ptr(), commandLine->DocumentName().Length()); |
106 // qDebug() << "BrowserMainApplicationS60 - " << QString::fromUtf16(commandLine->DocumentName().Ptr(), commandLine->DocumentName().Length()); |
118 // qDebug() << "BrowserMainApplicationS60"; |
107 // qDebug() << "BrowserMainApplicationS60"; |