summaryrefslogtreecommitdiff
path: root/src/gui/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/util')
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp162
-rw-r--r--src/gui/util/util.pri19
2 files changed, 97 insertions, 84 deletions
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index d1eeeae115..47b0cbe825 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -45,27 +45,29 @@
#include <qurl.h>
#include <private/qcore_symbian_p.h>
-#include <txtrich.h> // CRichText
#include <f32file.h> // TDriveUnit etc
-#include <eikenv.h> // CEikonEnv
-#include <apgcli.h> // RApaLsSession
-#include <apgtask.h> // TApaTaskList, TApaTask
-#include <rsendas.h> // RSendAs
-#include <rsendasmessage.h> // RSendAsMessage
+#include <pathinfo.h> // PathInfo
+#ifndef USE_SCHEMEHANDLER
#ifdef Q_WS_S60
// This flag changes the implementation to use S60 CDcoumentHandler
-// instead of apparch when opening the files
+// instead of apparc when opening the files
#define USE_DOCUMENTHANDLER
#endif
-// copied from miutset.h, so we don't get a dependency into the app layer
-const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592
+#include <txtrich.h> // CRichText
+#include <eikenv.h> // CEikonEnv
+#include <apgcli.h> // RApaLsSession
+#include <apgtask.h> // TApaTaskList, TApaTask
+#include <rsendas.h> // RSendAs
+#include <rsendasmessage.h> // RSendAsMessage
-#include <pathinfo.h> // PathInfo
#ifdef USE_DOCUMENTHANDLER
-# include <DocumentHandler.h> // CDocumentHandler
-# include <AknServerApp.h>
+#include <DocumentHandler.h> // CDocumentHandler
+#include <AknServerApp.h>
+#endif
+#else // USE_SCHEMEHANDLER
+#include <schemehandler.h>
#endif
QT_BEGIN_NAMESPACE
@@ -74,6 +76,10 @@ _LIT(KCacheSubDir, "Cache\\");
_LIT(KSysBin, "\\Sys\\Bin\\");
_LIT(KBrowserPrefix, "4 " );
_LIT(KFontsDir, "z:\\resource\\Fonts\\");
+
+#ifndef USE_SCHEMEHANDLER
+// copied from miutset.h, so we don't get a dependency into the app layer
+const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592
const TUid KUidBrowser = { 0x10008D39 };
template<class R>
@@ -132,7 +138,6 @@ private:
Q_GLOBAL_STATIC(QS60DocumentHandler, qt_s60_documenthandler);
#endif
-
static void handleMailtoSchemeLX(const QUrl &url)
{
// this function has many intermingled leaves and throws. Qt and Symbian objects do not have
@@ -150,12 +155,10 @@ static void handleMailtoSchemeLX(const QUrl &url)
QStringList ccs = cc.split(QLatin1String(","), QString::SkipEmptyParts);
QStringList bccs = bcc.split(QLatin1String(","), QString::SkipEmptyParts);
-
RSendAs sendAs;
User::LeaveIfError(sendAs.Connect());
QAutoClose<RSendAs> sendAsCleanup(sendAs);
-
CSendAsAccounts* accounts = CSendAsAccounts::NewL();
CleanupStack::PushL(accounts);
sendAs.AvailableAccountsL(KUidMsgTypeSMTP, *accounts);
@@ -244,42 +247,6 @@ static bool handleOtherSchemes(const QUrl &url)
return err ? false : true;
}
-static TDriveUnit exeDrive()
-{
- RProcess me;
- TFileName processFileName = me.FileName();
- TDriveUnit drive(processFileName);
- return drive;
-}
-
-static TDriveUnit writableExeDrive()
-{
- TDriveUnit drive = exeDrive();
- if(drive.operator TInt() == EDriveZ)
- return TDriveUnit(EDriveC);
- return drive;
-}
-
-static TPtrC writableDataRoot()
-{
- TDriveUnit drive = exeDrive();
- switch(drive.operator TInt()){
- case EDriveC:
- return PathInfo::PhoneMemoryRootPath();
- break;
- case EDriveE:
- return PathInfo::MemoryCardRootPath();
- break;
- case EDriveZ:
- // It is not possible to write on ROM drive ->
- // return phone mem root path instead
- return PathInfo::PhoneMemoryRootPath();
- break;
- default:
- return PathInfo::PhoneMemoryRootPath();
- break;
- }
-}
static void openDocumentL(const TDesC& aUrl)
{
@@ -304,13 +271,44 @@ static void openDocumentL(const TDesC& aUrl)
#endif
}
-#ifdef USE_SCHEMEHANDLER
+static bool launchWebBrowser(const QUrl &url)
+{
+ if (!url.isValid())
+ return false;
+
+ if (url.scheme() == QLatin1String("mailto")) {
+ return handleMailtoScheme(url);
+ }
+ return handleOtherSchemes( url );
+}
+
+static bool openDocument(const QUrl &file)
+{
+ if (!file.isValid())
+ return false;
+
+ QString filePath = file.toLocalFile();
+ filePath = QDir::toNativeSeparators(filePath);
+ TPtrC filePathPtr(qt_QString2TPtrC(filePath));
+ TRAPD(err, openDocumentL(filePathPtr));
+ return err ? false : true;
+}
+
+#else //USE_SCHEMEHANDLER
// The schemehandler component only exist in private SDK. This implementation
// exist here just for convenience in case that we need to use it later on
// The schemehandle based implementation is not yet tested.
// The biggest advantage of schemehandler is that it can handle
// wide range of schemes and is extensible by plugins
+static void handleUrlL(const TDesC& aUrl)
+{
+ CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl);
+ CleanupStack::PushL(schemeHandler);
+ schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode
+ CleanupStack::PopAndDestroy();
+}
+
static bool handleUrl(const QUrl &url)
{
if (!url.isValid())
@@ -322,13 +320,6 @@ static bool handleUrl(const QUrl &url)
return err ? false : true;
}
-static void handleUrlL(const TDesC& aUrl)
-{
- CSchemeHandler* schemeHandler = CSchemeHandler::NewL(aUrl);
- CleanupStack::PushL(schemeHandler);
- schemeHandler->HandleUrlStandaloneL(); // Process the Url in standalone mode
- CleanupStack::PopAndDestroy();
-}
static bool launchWebBrowser(const QUrl &url)
{
return handleUrl(url);
@@ -336,31 +327,48 @@ static bool launchWebBrowser(const QUrl &url)
static bool openDocument(const QUrl &file)
{
- return handleUrl(url);
+ return handleUrl(file);
}
-#endif
-static bool launchWebBrowser(const QUrl &url)
-{
- if (!url.isValid())
- return false;
+#endif //USE_SCHEMEHANDLER
- if (url.scheme() == QLatin1String("mailto")) {
- return handleMailtoScheme(url);
- }
- return handleOtherSchemes( url );
+// Common functions to all implementations
+
+static TDriveUnit exeDrive()
+{
+ RProcess me;
+ TFileName processFileName = me.FileName();
+ TDriveUnit drive(processFileName);
+ return drive;
}
-static bool openDocument(const QUrl &file)
+static TDriveUnit writableExeDrive()
{
- if (!file.isValid())
- return false;
+ TDriveUnit drive = exeDrive();
+ if(drive.operator TInt() == EDriveZ)
+ return TDriveUnit(EDriveC);
+ return drive;
+}
- QString filePath = file.toLocalFile();
- filePath = QDir::toNativeSeparators(filePath);
- TPtrC filePathPtr(qt_QString2TPtrC(filePath));
- TRAPD(err, openDocumentL(filePathPtr));
- return err ? false : true;
+static TPtrC writableDataRoot()
+{
+ TDriveUnit drive = exeDrive();
+ switch(drive.operator TInt()){
+ case EDriveC:
+ return PathInfo::PhoneMemoryRootPath();
+ break;
+ case EDriveE:
+ return PathInfo::MemoryCardRootPath();
+ break;
+ case EDriveZ:
+ // It is not possible to write on ROM drive ->
+ // return phone mem root path instead
+ return PathInfo::PhoneMemoryRootPath();
+ break;
+ default:
+ return PathInfo::PhoneMemoryRootPath();
+ break;
+ }
}
QString QDesktopServices::storageLocation(StandardLocation type)
diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri
index bea520e3b4..d1c4ff812c 100644
--- a/src/gui/util/util.pri
+++ b/src/gui/util/util.pri
@@ -43,12 +43,17 @@ embedded {
}
symbian {
- LIBS += -lsendas2 -letext -lapmime -lplatformenv
- contains(QT_CONFIG, s60) {
- contains(CONFIG, is_using_gnupoc) {
- LIBS += -lcommonui
- } else {
- LIBS += -lCommonUI
+ LIBS += -letext -lplatformenv
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ LIBS += -lsendas2 -lapmime
+ contains(QT_CONFIG, s60) {
+ contains(CONFIG, is_using_gnupoc) {
+ LIBS += -lcommonui
+ } else {
+ LIBS += -lCommonUI
+ }
}
+ } else {
+ DEFINES += USE_SCHEMEHANDLER
}
-}
+} \ No newline at end of file