summaryrefslogtreecommitdiffstats
path: root/src/gui/util
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-11-29 06:39:31 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-11-29 06:39:31 (GMT)
commit4592fc2e481b42bbbe1f59e575ce3c9b9af9c9e4 (patch)
tree9adb0250ed390477e37741de97bede2bae148f7e /src/gui/util
parentf7d66442963e1380a4f2db3d24cb24aa9d5c63ad (diff)
parentbf5571b485420a945e9fdf3bf5b31cfe4c4d482b (diff)
downloadQt-4592fc2e481b42bbbe1f59e575ce3c9b9af9c9e4.zip
Qt-4592fc2e481b42bbbe1f59e575ce3c9b9af9c9e4.tar.gz
Qt-4592fc2e481b42bbbe1f59e575ce3c9b9af9c9e4.tar.bz2
Merge remote branch 'origin/master' into lighthouse-master
Diffstat (limited to 'src/gui/util')
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp180
-rw-r--r--src/gui/util/qundostack.cpp2
-rw-r--r--src/gui/util/util.pri17
3 files changed, 98 insertions, 101 deletions
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index cd023cb..56c2b98 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -45,32 +45,29 @@
#include <qurl.h>
#include <private/qcore_symbian_p.h>
-#include <txtrich.h> // CRichText
#include <f32file.h> // TDriveUnit etc
+#include <pathinfo.h> // PathInfo
+
+#ifndef USE_SCHEMEHANDLER
+#ifdef Q_WS_S60
+// This flag changes the implementation to use S60 CDcoumentHandler
+// instead of apparc when opening the files
+#define USE_DOCUMENTHANDLER
+#endif
+
+#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
-#ifdef Q_WS_S60
-// This flag changes the implementation to use S60 CDcoumentHandler
-// instead of apparch when opening the files
-#define USE_DOCUMENTHANDLER
+#ifdef USE_DOCUMENTHANDLER
+#include <DocumentHandler.h> // CDocumentHandler
+#include <AknServerApp.h>
#endif
-
-// copied from miutset.h, so we don't get a dependency into the app layer
-const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592
-
-#ifdef Q_OS_SYMBIAN
-# include <pathinfo.h> // PathInfo
-# ifdef USE_DOCUMENTHANDLER
-# include <DocumentHandler.h> // CDocumentHandler
-# include <AknServerApp.h>
-# endif
-#else
-# warning CDocumentHandler requires support for S60
-# undef USE_DOCUMENTHANDLER // Fallback to RApaLsSession based implementation
+#else // USE_SCHEMEHANDLER
+#include <schemehandler.h>
#endif
QT_BEGIN_NAMESPACE
@@ -79,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>
@@ -137,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
@@ -155,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);
@@ -249,47 +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();
-#ifdef Q_OS_SYMBIAN
- 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;
- }
-#else
-#warning No fallback implementation of writableDataRoot()
- return 0;
-#endif
-}
static void openDocumentL(const TDesC& aUrl)
{
@@ -314,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())
@@ -332,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);
@@ -346,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)
@@ -395,21 +393,15 @@ QString QDesktopServices::storageLocation(StandardLocation type)
break;
case MusicLocation:
path.Append(writableDataRoot());
-#ifdef Q_OS_SYMBIAN
path.Append(PathInfo::SoundsPath());
-#endif
break;
case MoviesLocation:
path.Append(writableDataRoot());
-#ifdef Q_OS_SYMBIAN
path.Append(PathInfo::VideosPath());
-#endif
break;
case PicturesLocation:
path.Append(writableDataRoot());
-#ifdef Q_OS_SYMBIAN
path.Append(PathInfo::ImagesPath());
-#endif
break;
case TempLocation:
return QDir::tempPath();
diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp
index 919ac3c..04cfca9 100644
--- a/src/gui/util/qundostack.cpp
+++ b/src/gui/util/qundostack.cpp
@@ -441,7 +441,7 @@ bool QUndoStackPrivate::checkUndoLimit()
/*!
Constructs an empty undo stack with the parent \a parent. The
- stack will initally be in the clean state. If \a parent is a
+ stack will initially be in the clean state. If \a parent is a
QUndoGroup object, the stack is automatically added to the group.
\sa push()
diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri
index af6218a..f125f82 100644
--- a/src/gui/util/util.pri
+++ b/src/gui/util/util.pri
@@ -43,12 +43,17 @@ embedded|qpa {
}
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
}
}