summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-08-24 09:56:34 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-08-24 09:56:34 (GMT)
commita28db67043f46fb9fc6536af9786fd77d2e346b3 (patch)
treece3a70a8deef96c3bd3496afda0834c09339b432 /src
parent6d2a500a32fd3e0536420708c845bbb2799c92d1 (diff)
parent898cba2245b6fafa3820b44203442fedd9f7ed73 (diff)
downloadQt-a28db67043f46fb9fc6536af9786fd77d2e346b3.zip
Qt-a28db67043f46fb9fc6536af9786fd77d2e346b3.tar.gz
Qt-a28db67043f46fb9fc6536af9786fd77d2e346b3.tar.bz2
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Conflicts: src/corelib/io/qfilesystemwatcher_symbian.cpp
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian.cpp3
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp7
-rw-r--r--src/corelib/kernel/qcore_symbian_p.cpp31
-rw-r--r--src/corelib/kernel/qcore_symbian_p.h3
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp23
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h7
-rw-r--r--src/gui/kernel/qclipboard_s60.cpp6
7 files changed, 42 insertions, 38 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp
index a80344e..1d60752 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian.cpp
+++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp
@@ -44,7 +44,6 @@
#include "qfileinfo.h"
#include "qdebug.h"
#include "private/qcore_symbian_p.h"
-#include "private/qcoreapplication_p.h"
#include <QDir>
#ifndef QT_NO_FILESYSTEMWATCHER
@@ -274,7 +273,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory
QMutexLocker locker(&mutex);
QString nativeDir(QDir::toNativeSeparators(directoryPath));
TPtrC ptr(qt_QString2TPtrC(nativeDir));
- currentEvent = new QNotifyChangeEvent(QCoreApplicationPrivate::fsSession(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive));
+ currentEvent = new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive));
syncCondition.wakeOne();
}
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 143bc6c..a7919d3 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -62,7 +62,6 @@
# include <f32file.h>
# include <pathinfo.h>
# include "private/qcore_symbian_p.h"
-# include "private/qcoreapplication_p.h"
#endif
#include <errno.h>
#if !defined(QWS) && defined(Q_OS_MAC)
@@ -405,7 +404,7 @@ bool QFSFileEngine::copy(const QString &newName)
{
#if defined(Q_OS_SYMBIAN)
Q_D(QFSFileEngine);
- RFs& rfs = QCoreApplicationPrivate::fsSession();
+ RFs rfs = qt_s60GetRFs();
CFileMan* fm = NULL;
QString oldNative(QDir::toNativeSeparators(d->filePath));
TPtrC oldPtr(qt_QString2TPtrC(oldNative));
@@ -630,7 +629,7 @@ QFileInfoList QFSFileEngine::drives()
QFileInfoList ret;
#if defined(Q_OS_SYMBIAN)
TDriveList driveList;
- RFs &rfs = QCoreApplicationPrivate::fsSession();
+ RFs rfs = qt_s60GetRFs();
TInt err = rfs.DriveList(driveList);
if (err == KErrNone) {
for (char i = 0; i < KMaxDrives; i++) {
@@ -682,7 +681,7 @@ bool QFSFileEnginePrivate::isSymlink() const
static bool _q_isSymbianHidden(const QString &path, bool isDir)
{
bool retval = false;
- RFs rfs = QCoreApplicationPrivate::fsSession();
+ RFs rfs = qt_s60GetRFs();
QFileInfo fi(path);
QString absPath = fi.absoluteFilePath();
if (isDir && absPath.at(absPath.size()-1) != QChar('/')) {
diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp
index a7d2694..957b92c 100644
--- a/src/corelib/kernel/qcore_symbian_p.cpp
+++ b/src/corelib/kernel/qcore_symbian_p.cpp
@@ -175,5 +175,36 @@ Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal)
return qt_s60_plugin_resolver()->resolve(ordinal);
}
+/*!
+\internal
+Provides global access to a shared RFs.
+*/
+class QS60RFsSession
+{
+public:
+ QS60RFsSession() {
+ qt_symbian_throwIfError(iFs.Connect());
+ qt_symbian_throwIfError(iFs.ShareProtected());
+ }
+
+ ~QS60RFsSession() {
+ iFs.Close();
+ }
+
+ RFs& GetRFs() {
+ return iFs;
+ }
+
+private:
+
+ RFs iFs;
+};
+
+Q_GLOBAL_STATIC(QS60RFsSession, qt_s60_RFsSession);
+
+Q_CORE_EXPORT RFs& qt_s60GetRFs()
+{
+ return qt_s60_RFsSession()->GetRFs();
+}
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h
index fab7254..6d3616f 100644
--- a/src/corelib/kernel/qcore_symbian_p.h
+++ b/src/corelib/kernel/qcore_symbian_p.h
@@ -58,6 +58,7 @@
#include <qstring.h>
#include <qrect.h>
#include <qhash.h>
+#include <f32file.h>
QT_BEGIN_HEADER
@@ -142,6 +143,8 @@ enum S60PluginFuncOrdinals
Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal);
+Q_CORE_EXPORT RFs& qt_s60GetRFs();
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index ead363c..6d88d92 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -271,12 +271,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv)
qt_application_thread_id = QThread::currentThreadId();
#endif
-#ifdef Q_OS_SYMBIAN
- if(KErrNone != fileServerSession.Connect())
- qFatal("FATAL: QCoreApplicationPrivate can't connect to file server");
- fileServerSession.ShareProtected(); //makes the handle ok for multithreading and IPC
-#endif
-
// note: this call to QThread::currentThread() may end up setting theMainThread!
if (QThread::currentThread() != theMainThread)
qWarning("WARNING: QApplication was not created in the main() thread.");
@@ -284,9 +278,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv)
QCoreApplicationPrivate::~QCoreApplicationPrivate()
{
-#ifdef Q_OS_SYMBIAN
- fileServerSession.Close();
-#endif
if (threadData) {
#ifndef QT_NO_THREAD
void *data = &threadData->tls;
@@ -825,18 +816,6 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
return receiver->event(event);
}
-#ifdef Q_OS_SYMBIAN
-/*!\internal
-
- Accessor for shared global file server session
- */
-RFs QCoreApplicationPrivate::fileServerSession;
-RFs& QCoreApplicationPrivate::fsSession()
-{
- return fileServerSession;
-}
-#endif
-
/*!
Returns true if an application object has not been created yet;
otherwise returns false.
@@ -2192,7 +2171,7 @@ QStringList QCoreApplication::libraryPaths()
if (tempPath.at(tempPath.length() - 1) != QChar('\\')) {
tempPath += QChar('\\');
}
- RFs& fs = QCoreApplicationPrivate::fsSession();
+ RFs& fs = qt_s60GetRFs();
TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
TFindFile finder(fs);
TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 1adb837..6c30ce8 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -90,10 +90,6 @@ public:
static QString macMenuBarName();
#endif
-#ifdef Q_OS_SYMBIAN
- static RFs& fsSession();
-#endif
-
static QThread *theMainThread;
static QThread *mainThread();
static bool checkInstance(const char *method);
@@ -126,9 +122,6 @@ public:
static uint attribs;
static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
-#ifdef Q_OS_SYMBIAN
- static RFs fileServerSession; //this should be moved into a symbian file engine if/when one is written
-#endif
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp
index 26ea844..9a2629c 100644
--- a/src/gui/kernel/qclipboard_s60.cpp
+++ b/src/gui/kernel/qclipboard_s60.cpp
@@ -49,7 +49,7 @@
#include "qbuffer.h"
#include "qwidget.h"
#include "qevent.h"
-#include "private/qapplication_p.h"
+#include "private/qcore_symbian_p.h"
#include <QtDebug>
// Symbian's clipboard
@@ -194,7 +194,7 @@ const QMimeData* QClipboard::mimeData(Mode mode) const
if (d)
{
TRAPD(err,{
- RFs& fs = QCoreApplicationPrivate::fsSession();
+ RFs fs = qt_s60GetRFs();
CClipboard* cb = CClipboard::NewForReadingLC(fs);
Q_ASSERT(cb);
RStoreReadStream stream;
@@ -220,7 +220,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode)
if (d)
{
TRAPD(err,{
- RFs& fs = QCoreApplicationPrivate::fsSession();
+ RFs fs = qt_s60GetRFs();
CClipboard* cb = CClipboard::NewForWritingLC(fs);
RStoreWriteStream stream;
TStreamId stid = stream.CreateLC(cb->Store());