summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-08-24 13:58:40 +0300
committerJanne Anttila <janne.anttila@digia.com>2009-08-24 13:58:40 +0300
commitb8ca627021128eff511c891fdb7553c40021528b (patch)
tree9c27a148ff00038c27bda913e6b8ef208faf07ee /src
parent67a4940fb21b3836d79ed0d377d9c2470de39c48 (diff)
parenta28db67043f46fb9fc6536af9786fd77d2e346b3 (diff)
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/io.pri1
-rw-r--r--src/corelib/io/qdir.cpp3
-rw-r--r--src/corelib/io/qfile.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian.cpp83
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian_p.h30
-rw-r--r--src/corelib/io/qfsfileengine.h3
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp97
-rw-r--r--src/corelib/io/qprocess.cpp5
-rw-r--r--src/corelib/io/qprocess_symbian.cpp340
-rw-r--r--src/corelib/io/qtemporaryfile.cpp4
10 files changed, 294 insertions, 274 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index b49554e77..e58e4ad4a 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -89,5 +89,6 @@ win32 {
symbian {
SOURCES += io/qfilesystemwatcher_symbian.cpp
HEADERS += io/qfilesystemwatcher_symbian_p.h
+ contains(QT_CONFIG, s60): LIBS += -lplatformenv
}
}
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index f9a1aca4d..2ab3022a6 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1930,8 +1930,7 @@ QString QDir::currentPath()
Under non-Windows operating systems the \c HOME environment
variable is used if it exists, otherwise the path returned by the
- rootPath() function is used, except in Symbian, where c:\\data is
- returned.
+ rootPath().
\sa home(), currentPath(), rootPath(), tempPath()
*/
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 026c1fd99..93152da83 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -739,7 +739,7 @@ QFile::rename(const QString &newName)
if (error) {
out.remove();
} else {
- fileEngine()->setFileName(newName);
+ fileEngine()->setFileName(newName);
setPermissions(permissions());
unsetError();
setFileName(newName);
diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp
index 730786f5b..1d60752df 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian.cpp
+++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp
@@ -51,22 +51,17 @@
QT_BEGIN_NAMESPACE
-CNotifyChangeEvent* CNotifyChangeEvent::New(RFs &fs, const TDesC& file,
- QSymbianFileSystemWatcherEngine* e, bool aIsDir)
-{
- CNotifyChangeEvent* self = new CNotifyChangeEvent(fs, file, e, aIsDir);
- return self;
-}
-
-CNotifyChangeEvent::CNotifyChangeEvent(RFs &fs, const TDesC& file,
- QSymbianFileSystemWatcherEngine* e, bool aIsDir, TInt aPriority) :
+QNotifyChangeEvent::QNotifyChangeEvent(RFs &fs, const TDesC &file,
+ QSymbianFileSystemWatcherEngine *e, bool aIsDir,
+ TInt aPriority) :
CActive(aPriority),
isDir(aIsDir),
fsSession(fs),
watchedPath(file),
- engine(e)
+ engine(e),
+ failureCount(0)
{
- if(isDir) {
+ if (isDir) {
fsSession.NotifyChange(ENotifyEntry, iStatus, file);
} else {
fsSession.NotifyChange(ENotifyAll, iStatus, file);
@@ -75,33 +70,43 @@ CNotifyChangeEvent::CNotifyChangeEvent(RFs &fs, const TDesC& file,
SetActive();
}
-CNotifyChangeEvent::~CNotifyChangeEvent()
+QNotifyChangeEvent::~QNotifyChangeEvent()
{
Cancel();
}
-void CNotifyChangeEvent::RunL()
+void QNotifyChangeEvent::RunL()
{
- if (iStatus.Int() == KErrNone) {
- if(isDir) {
+ if(iStatus.Int() == KErrNone) {
+ failureCount = 0;
+ } else {
+ qWarning("QNotifyChangeEvent::RunL() - Failed to order change notifications: %d", iStatus.Int());
+ failureCount++;
+ }
+
+ // Re-request failed notification once, but if it won't start working,
+ // we can't do much besides just not request any more notifications.
+ if (failureCount < 2) {
+ if (isDir) {
fsSession.NotifyChange(ENotifyEntry, iStatus, watchedPath);
} else {
fsSession.NotifyChange(ENotifyAll, iStatus, watchedPath);
}
SetActive();
- QT_TRYCATCH_LEAVING(engine->emitPathChanged(this));
- } else {
- qWarning("CNotifyChangeEvent::RunL() - Failed to order change notifications: %d", iStatus.Int());
+
+ if (!failureCount) {
+ QT_TRYCATCH_LEAVING(engine->emitPathChanged(this));
+ }
}
}
-void CNotifyChangeEvent::DoCancel()
+void QNotifyChangeEvent::DoCancel()
{
fsSession.NotifyChangeCancel(iStatus);
}
QSymbianFileSystemWatcherEngine::QSymbianFileSystemWatcherEngine() :
- watcherStarted(false)
+ watcherStarted(false)
{
moveToThread(this);
}
@@ -111,8 +116,8 @@ QSymbianFileSystemWatcherEngine::~QSymbianFileSystemWatcherEngine()
stop();
}
-QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths,
- QStringList *files, QStringList *directories)
+QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList *files,
+ QStringList *directories)
{
QMutexLocker locker(&mutex);
QStringList p = paths;
@@ -141,15 +146,15 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths,
// Use absolute filepath as relative paths seem to have some issues.
QString filePath = fi.absoluteFilePath();
- if(isDir && filePath.at(filePath.size()-1) != QChar(L'/')) {
+ if (isDir && filePath.at(filePath.size() - 1) != QChar(L'/')) {
filePath += QChar(L'/');
}
currentEvent = NULL;
QMetaObject::invokeMethod(this,
- "addNativeListener",
- Qt::QueuedConnection,
- Q_ARG(QString, filePath));
+ "addNativeListener",
+ Qt::QueuedConnection,
+ Q_ARG(QString, filePath));
syncCondition.wait(&mutex);
@@ -160,9 +165,9 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths,
it.remove();
if (isDir)
- directories->append(path);
- else
- files->append(path);
+ directories->append(path);
+ else
+ files->append(path);
}
}
@@ -170,7 +175,8 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &paths,
- QStringList *files, QStringList *directories)
+ QStringList *files,
+ QStringList *directories)
{
QMutexLocker locker(&mutex);
@@ -185,8 +191,8 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path
activeObjectToPath.remove(currentEvent);
QMetaObject::invokeMethod(this,
- "removeNativeListener",
- Qt::QueuedConnection);
+ "removeNativeListener",
+ Qt::QueuedConnection);
syncCondition.wait(&mutex);
@@ -202,18 +208,17 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path
return p;
}
-void QSymbianFileSystemWatcherEngine::emitPathChanged(CNotifyChangeEvent *e)
+void QSymbianFileSystemWatcherEngine::emitPathChanged(QNotifyChangeEvent *e)
{
QMutexLocker locker(&mutex);
QString path = activeObjectToPath.value(e);
QFileInfo fi(path);
- if (e->isDir) {
+ if (e->isDir)
emit directoryChanged(path, !fi.exists());
- } else {
+ else
emit fileChanged(path, !fi.exists());
- }
}
void QSymbianFileSystemWatcherEngine::stop()
@@ -228,9 +233,7 @@ bool QSymbianFileSystemWatcherEngine::startWatcher()
bool retval = true;
if (!watcherStarted) {
-#if defined(Q_OS_SYMBIAN)
setStackSize(0x5000);
-#endif
start();
syncCondition.wait(&mutex);
@@ -255,7 +258,7 @@ void QSymbianFileSystemWatcherEngine::run()
if (errorCode == KErrNone) {
exec();
- foreach(CNotifyChangeEvent* e, activeObjectToPath.keys()) {
+ foreach(QNotifyChangeEvent *e, activeObjectToPath.keys()) {
e->Cancel();
delete e;
}
@@ -270,7 +273,7 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory
QMutexLocker locker(&mutex);
QString nativeDir(QDir::toNativeSeparators(directoryPath));
TPtrC ptr(qt_QString2TPtrC(nativeDir));
- currentEvent = CNotifyChangeEvent::New(qt_s60GetRFs(), 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/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h
index 23aa0863b..f187f507c 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian_p.h
+++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h
@@ -54,12 +54,13 @@
//
#include "qfilesystemwatcher_p.h"
+
+#ifndef QT_NO_FILESYSTEMWATCHER
+
#include "qhash.h"
#include "qmutex.h"
#include "qwaitcondition.h"
-#ifndef QT_NO_FILESYSTEMWATCHER
-
#include <e32base.h>
#include <f32file.h>
@@ -67,14 +68,12 @@ QT_BEGIN_NAMESPACE
class QSymbianFileSystemWatcherEngine;
-class CNotifyChangeEvent : public CActive
+class QNotifyChangeEvent : public CActive
{
public:
- CNotifyChangeEvent(RFs &fsSession, const TDesC& file, QSymbianFileSystemWatcherEngine* engine,
- bool aIsDir, TInt aPriority = EPriorityStandard);
- ~CNotifyChangeEvent();
- static CNotifyChangeEvent* New(RFs &fsSession, const TDesC& file,
- QSymbianFileSystemWatcherEngine* engine, bool aIsDir);
+ QNotifyChangeEvent(RFs &fsSession, const TDesC &file, QSymbianFileSystemWatcherEngine *engine,
+ bool aIsDir, TInt aPriority = EPriorityStandard);
+ ~QNotifyChangeEvent();
bool isDir;
@@ -85,6 +84,8 @@ private:
RFs &fsSession;
TPath watchedPath;
QSymbianFileSystemWatcherEngine *engine;
+
+ int failureCount;
};
class QSymbianFileSystemWatcherEngine : public QFileSystemWatcherEngine
@@ -95,10 +96,9 @@ public:
QSymbianFileSystemWatcherEngine();
~QSymbianFileSystemWatcherEngine();
- QStringList addPaths(const QStringList &paths, QStringList *files,
- QStringList *directories);
+ QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files,
- QStringList *directories);
+ QStringList *directories);
void stop();
@@ -110,17 +110,17 @@ public Q_SLOTS:
void removeNativeListener();
private:
- friend class CNotifyChangeEvent;
- void emitPathChanged(CNotifyChangeEvent *e);
+ friend class QNotifyChangeEvent;
+ void emitPathChanged(QNotifyChangeEvent *e);
bool startWatcher();
- QHash<CNotifyChangeEvent*, QString> activeObjectToPath;
+ QHash<QNotifyChangeEvent*, QString> activeObjectToPath;
QMutex mutex;
QWaitCondition syncCondition;
int errorCode;
bool watcherStarted;
- CNotifyChangeEvent *currentEvent;
+ QNotifyChangeEvent *currentEvent;
};
#endif // QT_NO_FILESYSTEMWATCHER
diff --git a/src/corelib/io/qfsfileengine.h b/src/corelib/io/qfsfileengine.h
index f6db91c46..9be8a4c29 100644
--- a/src/corelib/io/qfsfileengine.h
+++ b/src/corelib/io/qfsfileengine.h
@@ -83,9 +83,6 @@ public:
FileFlags fileFlags(FileFlags type) const;
bool setPermissions(uint perms);
QString fileName(FileName file) const;
-#ifdef Q_OS_SYMBIAN
- QString fileNameSymbian(FileName file) const;
-#endif
uint ownerId(FileOwner) const;
QString owner(FileOwner) const;
QDateTime fileTime(FileTime time) const;
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 4a485bb2a..a7919d31a 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -60,6 +60,7 @@
#if defined(Q_OS_SYMBIAN)
# include <syslimits.h>
# include <f32file.h>
+# include <pathinfo.h>
# include "private/qcore_symbian_p.h"
#endif
#include <errno.h>
@@ -79,9 +80,9 @@ QT_BEGIN_NAMESPACE
static bool isRelativePathSymbian(const QString& fileName)
{
return !(fileName.startsWith(QLatin1Char('/'))
- || (fileName.length() >= 2
- && ((fileName.at(0).isLetter() && fileName.at(1) == QLatin1Char(':'))
- || (fileName.at(0) == QLatin1Char('/') && fileName.at(1) == QLatin1Char('/')))));
+ || (fileName.length() >= 2
+ && ((fileName.at(0).isLetter() && fileName.at(1) == QLatin1Char(':'))
+ || (fileName.at(0) == QLatin1Char('/') && fileName.at(1) == QLatin1Char('/')))));
}
#endif
@@ -579,11 +580,10 @@ QString QFSFileEngine::currentPath(const QString &)
QString QFSFileEngine::homePath()
{
- QString home = QFile::decodeName(qgetenv("HOME"));
#if defined(Q_OS_SYMBIAN)
- if (home.isEmpty())
- home = QLatin1String("C:/Data");
+ QString home = rootPath();
#else
+ QString home = QFile::decodeName(qgetenv("HOME"));
if (home.isNull())
home = rootPath();
#endif
@@ -593,7 +593,13 @@ QString QFSFileEngine::homePath()
QString QFSFileEngine::rootPath()
{
#if defined(Q_OS_SYMBIAN)
- return QLatin1String("C:/");
+# ifdef Q_WS_S60
+ TFileName symbianPath = PathInfo::PhoneMemoryRootPath();
+ return QDir::cleanPath(QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)));
+# else
+# warning No fallback implementation of QFSFileEngine::rootPath()
+ return QLatin1String();
+# endif
#else
return QLatin1String("/");
#endif
@@ -602,8 +608,14 @@ QString QFSFileEngine::rootPath()
QString QFSFileEngine::tempPath()
{
#ifdef Q_OS_SYMBIAN
- QString temp = QDir::currentPath().left(2);
- temp += QLatin1String("/system/temp/");
+# ifdef Q_WS_S60
+ TFileName symbianPath = PathInfo::PhoneMemoryRootPath();
+ QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath));
+ temp += QLatin1String( "temp/");
+# else
+# warning No fallback implementation of QFSFileEngine::tempPath()
+ return QString();
+# endif
#else
QString temp = QFile::decodeName(qgetenv("TMPDIR"));
if (temp.isEmpty())
@@ -793,7 +805,8 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
ret |= ExistsFlag;
#if defined(Q_OS_SYMBIAN)
if (d->filePath == QLatin1String("/")
- || (d->filePath.at(0).isLetter() && d->filePath.mid(1,d->filePath.length()) == QLatin1String(":/")))
+ || (d->filePath.at(0).isLetter()
+ && d->filePath.mid(1,d->filePath.length()) == QLatin1String(":/")))
ret |= RootFlag;
// In Symbian, all symlinks have hidden attribute for some reason;
@@ -822,11 +835,12 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
}
#ifdef Q_OS_SYMBIAN
-QString QFSFileEngine::fileNameSymbian(FileName file) const
+static QString symbianFileName(QAbstractFileEngine::FileName file, const QFSFileEngine *engine,
+ const QFSFileEnginePrivate * const d)
{
- Q_D(const QFSFileEngine);
- if(file == BaseName) {
- int slash = d->filePath.lastIndexOf(QLatin1Char('/'));
+ const QLatin1Char slashChar('/');
+ if(file == QAbstractFileEngine::BaseName) {
+ int slash = d->filePath.lastIndexOf(slashChar);
if(slash == -1) {
int colon = d->filePath.lastIndexOf(QLatin1Char(':'));
if(colon != -1)
@@ -834,42 +848,42 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const
return d->filePath;
}
return d->filePath.mid(slash + 1);
- } else if(file == PathName) {
+ } else if(file == QAbstractFileEngine::PathName) {
if(!d->filePath.size())
return d->filePath;
- int slash = d->filePath.lastIndexOf(QLatin1Char('/'));
+ int slash = d->filePath.lastIndexOf(slashChar);
if(slash == -1) {
if(d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':'))
return d->filePath.left(2);
- return QString::fromLatin1(".");
+ return QLatin1String(".");
} else {
if(!slash)
- return QString::fromLatin1("/");
+ return QLatin1String("/");
if(slash == 2 && d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':'))
slash++;
return d->filePath.left(slash);
}
- } else if(file == AbsoluteName || file == AbsolutePathName) {
+ } else if(file == QAbstractFileEngine::AbsoluteName || file == QAbstractFileEngine::AbsolutePathName) {
QString ret;
- if (!isRelativePath()) {
+ if (!isRelativePathSymbian(d->filePath)) {
if (d->filePath.size() > 2 && d->filePath.at(1) == QLatin1Char(':')
- && d->filePath.at(2) != QLatin1Char('/') || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt
- d->filePath.startsWith(QLatin1Char('/')) // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt
+ && d->filePath.at(2) != slashChar || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt
+ d->filePath.startsWith(slashChar) // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt
) {
ret = QString(QDir::currentPath().left(2) + QDir::fromNativeSeparators(d->filePath));
} else {
ret = d->filePath;
}
} else {
- ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + d->filePath);
+ ret = QDir::cleanPath(QDir::currentPath() + slashChar + d->filePath);
}
// The path should be absolute at this point.
// From the docs :
// Absolute paths begin with the directory separator "/"
// (optionally preceded by a drive specification under Windows).
- if (ret.at(0) != QLatin1Char('/')) {
+ if (ret.at(0) != slashChar) {
Q_ASSERT(ret.length() >= 2);
Q_ASSERT(ret.at(0).isLetter());
Q_ASSERT(ret.at(1) == QLatin1Char(':'));
@@ -878,23 +892,23 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const
ret[0] = ret.at(0).toUpper();
}
- if (file == AbsolutePathName) {
- int slash = ret.lastIndexOf(QLatin1Char('/'));
+ if (file == QAbstractFileEngine::AbsolutePathName) {
+ int slash = ret.lastIndexOf(slashChar);
if (slash < 0)
return ret;
- else if (ret.at(0) != QLatin1Char('/') && slash == 2)
+ else if (ret.at(0) != slashChar && slash == 2)
return ret.left(3); // include the slash
else
return ret.left(slash > 0 ? slash : 1);
}
return ret;
- } else if(file == CanonicalName || file == CanonicalPathName) {
- if (!(fileFlags(ExistsFlag) & ExistsFlag))
+ } else if(file == QAbstractFileEngine::CanonicalName || file == QAbstractFileEngine::CanonicalPathName) {
+ if (!(engine->fileFlags(QAbstractFileEngine::ExistsFlag) & QAbstractFileEngine::ExistsFlag))
return QString();
- QString ret = QFSFileEnginePrivate::canonicalized(fileName(AbsoluteName));
- if (!ret.isEmpty() && file == CanonicalPathName) {
- int slash = ret.lastIndexOf(QLatin1Char('/'));
+ QString ret = QFSFileEnginePrivate::canonicalized(symbianFileName(QAbstractFileEngine::AbsoluteName, engine, d));
+ if (!ret.isEmpty() && file == QAbstractFileEngine::CanonicalPathName) {
+ int slash = ret.lastIndexOf(slashChar);
if (slash == -1)
ret = QDir::fromNativeSeparators(QDir::currentPath());
else if (slash == 0)
@@ -902,7 +916,7 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const
ret = ret.left(slash);
}
return ret;
- } else if(file == LinkName) {
+ } else if(file == QAbstractFileEngine::LinkName) {
if (d->isSymlink()) {
char s[PATH_MAX+1];
int len = readlink(d->nativeFilePath.constData(), s, PATH_MAX);
@@ -912,20 +926,20 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const
if (isRelativePathSymbian(ret)) {
if (!isRelativePathSymbian(d->filePath)) {
- ret.prepend(d->filePath.left(d->filePath.lastIndexOf(QLatin1Char('/')))
- + QLatin1Char('/'));
+ ret.prepend(d->filePath.left(d->filePath.lastIndexOf(slashChar))
+ + slashChar);
} else {
- ret.prepend(QDir::currentPath() + QLatin1Char('/'));
+ ret.prepend(QDir::currentPath() + slashChar);
}
}
ret = QDir::cleanPath(ret);
- if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
+ if (ret.size() > 1 && ret.endsWith(slashChar))
ret.chop(1);
return ret;
}
}
return QString();
- } else if(file == BundleName) {
+ } else if(file == QAbstractFileEngine::BundleName) {
return QString();
}
return d->filePath;
@@ -934,10 +948,10 @@ QString QFSFileEngine::fileNameSymbian(FileName file) const
QString QFSFileEngine::fileName(FileName file) const
{
-#ifdef Q_OS_SYMBIAN
- return fileNameSymbian(file);
-#endif
Q_D(const QFSFileEngine);
+#ifdef Q_OS_SYMBIAN
+ return symbianFileName(file, this, d);
+#else
if (file == BundleName) {
#if !defined(QWS) && defined(Q_OS_MAC)
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, QCFString(d->filePath),
@@ -1071,6 +1085,7 @@ QString QFSFileEngine::fileName(FileName file) const
return QString();
}
return d->filePath;
+#endif // Q_OS_SYMBIAN
}
bool QFSFileEngine::isRelativePath() const
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 057492d6d..764304d6c 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -532,7 +532,7 @@ void QProcessPrivate::Channel::clear()
\snippet doc/src/snippets/process/process.cpp 0
- \section1 Notes for Windows Users
+ \section1 Notes for Windows Users
Some Windows commands (for example, \c dir) are not provided by
separate applications, but by the command interpreter itself.
@@ -2012,9 +2012,6 @@ void QProcess::terminate()
On Windows, kill() uses TerminateProcess, and on Unix and Mac OS X, the
SIGKILL signal is sent to the process.
- \note Killing running processes from other processes will typically
- cause a panic in Symbian due to platform security.
-
\sa terminate()
*/
void QProcess::kill()
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index a8c72d304..5b00ed080 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -100,15 +100,15 @@ class QProcessManager;
// Active object to listen for child process death
-class CProcessActive : public CActive
+class QProcessActive : public CActive
{
public:
- static CProcessActive* construct(QProcess* process,
- RProcess** proc,
- int serial,
- int deathPipe);
+ static QProcessActive *construct(QProcess *process,
+ RProcess **proc,
+ int serial,
+ int deathPipe);
- virtual ~CProcessActive();
+ virtual ~QProcessActive();
void start();
void stop();
@@ -117,32 +117,32 @@ public:
protected:
- // From CActive
+ // Inherited from CActive
void RunL();
TInt RunError(TInt aError);
void DoCancel();
- CProcessActive();
+ QProcessActive();
private:
- QProcess* process;
- RProcess** pproc;
+ QProcess *process;
+ RProcess **pproc;
int serial;
int deathPipe;
bool errorValue;
};
// Active object to communicate synchronously with process manager thread
-class CProcessManagerMediator : public CActive
+class QProcessManagerMediator : public CActive
{
public:
- static CProcessManagerMediator* construct();
+ static QProcessManagerMediator *construct();
- virtual ~CProcessManagerMediator();
+ virtual ~QProcessManagerMediator();
- bool add(CProcessActive* processObserver);
- void remove(CProcessActive* processObserver);
+ bool add(QProcessActive *processObserver);
+ void remove(QProcessActive *processObserver);
void terminate();
protected:
@@ -154,23 +154,28 @@ protected:
ETerminate
};
- // From CActive
+ // Inherited from CActive
void RunL();
TInt RunError(TInt aError);
void DoCancel();
- CProcessManagerMediator();
+ QProcessManagerMediator();
- bool notify(CProcessActive* processObserver, Commands command);
+ bool notify(QProcessActive *processObserver, Commands command);
private:
- CProcessActive* currentObserver;
+ QProcessActive *currentObserver;
Commands currentCommand;
RThread processManagerThread;
};
-// Process manager manages child process death listeners
+// Process manager manages child process death listeners.
+//
+// Note: Because QProcess can be used outside event loop, we cannot be guaranteed
+// an active scheduler exists for us to add our process death listener objects.
+// We can't just install active scheduler on the calling thread, as that would block it
+// if we want to actually use it, so a separate manager thread is required.
class QProcessManager
{
public:
@@ -179,50 +184,55 @@ public:
void startThread();
- TInt run(void* param);
+ TInt run(void *param);
bool add(QProcess *process);
void remove(QProcess *process);
- inline void setMediator(CProcessManagerMediator* newMediator) {mediator = newMediator;};
+ inline void setMediator(QProcessManagerMediator *newMediator) {
+ mediator = newMediator;
+ };
private:
- inline void lock() {managerMutex.Wait();};
- inline void unlock() {managerMutex.Signal();};
+ inline void lock() {
+ managerMutex.Wait();
+ };
+ inline void unlock() {
+ managerMutex.Signal();
+ };
- QMap<int, CProcessActive *> children;
- CProcessManagerMediator* mediator;
+ QMap<int, QProcessActive *> children;
+ QProcessManagerMediator *mediator;
RMutex managerMutex;
bool threadStarted;
RThread managerThread;
};
-static bool qt_rprocess_running(RProcess* proc)
+static bool qt_rprocess_running(RProcess *proc)
{
- if(proc && proc->Handle()) {
+ if (proc && proc->Handle()) {
TExitType et = proc->ExitType();
- if (et == EExitPending) {
+ if (et == EExitPending)
return true;
- }
}
return false;
}
-static void qt_create_symbian_commandline(const QStringList &arguments, QString& commandLine)
+static void qt_create_symbian_commandline(const QStringList &arguments, QString &commandLine)
{
- for (int i=0; i<arguments.size(); ++i) {
+ for (int i = 0; i < arguments.size(); ++i) {
QString tmp = arguments.at(i);
// in the case of \" already being in the string the \ must also be escaped
- tmp.replace( QLatin1String("\\\""), QLatin1String("\\\\\"") );
+ tmp.replace(QLatin1String("\\\""), QLatin1String("\\\\\""));
// escape a single " because the arguments will be parsed
- tmp.replace( QLatin1String("\""), QLatin1String("\\\"") );
+ tmp.replace(QLatin1String("\""), QLatin1String("\\\""));
if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) {
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
QString endQuote(QLatin1String("\""));
int i = tmp.length();
- while (i>0 && tmp.at(i-1) == QLatin1Char('\\')) {
+ while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) {
--i;
endQuote += QLatin1String("\\");
}
@@ -235,12 +245,11 @@ static void qt_create_symbian_commandline(const QStringList &arguments, QString&
static TInt qt_create_symbian_process(RProcess **proc, const QString &programName, const QStringList &arguments)
{
- RProcess* newProc = NULL;
+ RProcess *newProc = NULL;
newProc = new RProcess();
- if (!newProc) {
+ if (!newProc)
return KErrNoMemory;
- }
QString commandLine;
qt_create_symbian_commandline(arguments, commandLine);
@@ -250,31 +259,32 @@ static TInt qt_create_symbian_process(RProcess **proc, const QString &programNam
TInt err = newProc->Create(program_ptr, cmdline_ptr);
- if (err == KErrNotFound){
+ if (err == KErrNotFound) {
// Strip path from program name and try again (i.e. try from default location "\sys\bin")
int index = programName.lastIndexOf(QChar('\\'));
int index2 = programName.lastIndexOf(QChar('/'));
index = qMax(index, index2);
- if(index != -1 && programName.length() >= index){
+ if (index != -1 && programName.length() >= index) {
QString strippedName;
- strippedName = programName.mid(index+1);
- QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Process '%s' not found, try stripped version '%s'", qPrintable(programName), qPrintable(strippedName));
+ strippedName = programName.mid(index + 1);
+ QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Executable '%s' not found, trying stripped version '%s'",
+ qPrintable(programName), qPrintable(strippedName));
TPtrC stripped_ptr(reinterpret_cast<const TText*>(strippedName.constData()));
err = newProc->Create(stripped_ptr, cmdline_ptr);
if (err != KErrNone) {
- QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Unable to create process '%s': %d", qPrintable(strippedName), err);
+ QPROCESS_DEBUG_PRINT("qt_create_symbian_process() Unable to create process '%s': %d",
+ qPrintable(strippedName), err);
}
}
}
- if (err == KErrNone) {
+ if (err == KErrNone)
*proc = newProc;
- } else {
+ else
delete newProc;
- }
return err;
}
@@ -326,19 +336,19 @@ static void qt_create_pipe(int *pipe)
}
// Called from ProcessManagerThread
-CProcessActive* CProcessActive::construct(QProcess* process,
- RProcess** proc,
+QProcessActive *QProcessActive::construct(QProcess *process,
+ RProcess **proc,
int serial,
int deathPipe)
{
QPROCESS_ASSERT((process || proc || *proc),
- EProcessActiveNullParameter,
- "CProcessActive::construct(): process (0x%x), proc (0x%x) or *proc == NULL, not creating an instance", process, proc)
+ EProcessActiveNullParameter,
+ "QProcessActive::construct(): process (0x%x), proc (0x%x) or *proc == NULL, not creating an instance", process, proc)
- CProcessActive* newInstance = new CProcessActive();
+ QProcessActive *newInstance = new QProcessActive();
if (!newInstance) {
- QPROCESS_DEBUG_PRINT("CProcessActive::construct(): Failed to create new instance");
+ QPROCESS_DEBUG_PRINT("QProcessActive::construct(): Failed to create new instance");
} else {
newInstance->process = process;
newInstance->pproc = proc;
@@ -351,29 +361,29 @@ CProcessActive* CProcessActive::construct(QProcess* process,
}
// Called from ProcessManagerThread
-CProcessActive::CProcessActive()
- : CActive(CActive::EPriorityStandard)
+QProcessActive::QProcessActive()
+ : CActive(CActive::EPriorityStandard)
{
// Nothing to do
}
// Called from ProcessManagerThread
-CProcessActive::~CProcessActive()
+QProcessActive::~QProcessActive()
{
process = NULL;
pproc = NULL;
}
// Called from ProcessManagerThread
-void CProcessActive::start()
+void QProcessActive::start()
{
if (qt_rprocess_running(*pproc)) {
CActiveScheduler::Add(this);
(*pproc)->Logon(iStatus);
SetActive();
- QPROCESS_DEBUG_PRINT("CProcessActive::start(): Started monitoring for process exit.");
+ QPROCESS_DEBUG_PRINT("QProcessActive::start(): Started monitoring for process exit.");
} else {
- QPROCESS_DEBUG_PRINT("CProcessActive::start(): Process doesn't exist or is already dead");
+ QPROCESS_DEBUG_PRINT("QProcessActive::start(): Process doesn't exist or is already dead");
// Assume process has already died
qt_native_write(deathPipe, "", 1);
errorValue = true;
@@ -381,56 +391,56 @@ void CProcessActive::start()
}
// Called from ProcessManagerThread
-void CProcessActive::stop()
+void QProcessActive::stop()
{
- QPROCESS_DEBUG_PRINT("CProcessActive::stop()");
+ QPROCESS_DEBUG_PRINT("QProcessActive::stop()");
// Remove this from scheduler (also cancels the request)
Deque();
}
-bool CProcessActive::error()
+bool QProcessActive::error()
{
return errorValue;
}
// Called from ProcessManagerThread
-void CProcessActive::RunL()
+void QProcessActive::RunL()
{
// If this method gets executed, the monitored process has died
// Notify main thread
qt_native_write(deathPipe, "", 1);
- QPROCESS_DEBUG_PRINT("CProcessActive::RunL() sending death notice to %d", deathPipe);
+ QPROCESS_DEBUG_PRINT("QProcessActive::RunL() sending death notice to %d", deathPipe);
}
// Called from ProcessManagerThread
-TInt CProcessActive::RunError(TInt aError)
+TInt QProcessActive::RunError(TInt aError)
{
Q_UNUSED(aError);
// Handle RunL leave (should never happen)
- QPROCESS_ASSERT(0, EProcessActiveRunError, "CProcessActive::RunError(): Should never get here!")
+ QPROCESS_ASSERT(0, EProcessActiveRunError, "QProcessActive::RunError(): Should never get here!")
return 0;
}
// Called from ProcessManagerThread
-void CProcessActive::DoCancel()
+void QProcessActive::DoCancel()
{
- QPROCESS_DEBUG_PRINT("CProcessActive::DoCancel()");
+ QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel()");
if (qt_rprocess_running(*pproc)) {
(*pproc)->LogonCancel(iStatus);
- QPROCESS_DEBUG_PRINT("CProcessActive::DoCancel(): Stopped monitoring for process exit.");
+ QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel(): Stopped monitoring for process exit.");
} else {
- QPROCESS_DEBUG_PRINT("CProcessActive::DoCancel(): Process doesn't exist");
+ QPROCESS_DEBUG_PRINT("QProcessActive::DoCancel(): Process doesn't exist");
}
}
// Called from ProcessManagerThread
-CProcessManagerMediator* CProcessManagerMediator::construct()
+QProcessManagerMediator *QProcessManagerMediator::construct()
{
- CProcessManagerMediator* newInstance = new CProcessManagerMediator;
+ QProcessManagerMediator *newInstance = new QProcessManagerMediator;
TInt err(KErrNone);
newInstance->currentCommand = ENoCommand;
@@ -439,77 +449,77 @@ CProcessManagerMediator* CProcessManagerMediator::construct()
if (newInstance) {
err = newInstance->processManagerThread.Open(newInstance->processManagerThread.Id());
QPROCESS_ASSERT((err == KErrNone),
- EProcessManagerMediatorThreadOpenFailed,
- "CProcessManagerMediator::construct(): Failed to open processManagerThread (err:%d)", err)
+ EProcessManagerMediatorThreadOpenFailed,
+ "QProcessManagerMediator::construct(): Failed to open processManagerThread (err:%d)", err)
} else {
QPROCESS_ASSERT(0,
- EProcessManagerMediatorCreationFailed,
- "CProcessManagerMediator::construct(): Failed to open construct mediator")
+ EProcessManagerMediatorCreationFailed,
+ "QProcessManagerMediator::construct(): Failed to open construct mediator")
}
// Activate mediator
CActiveScheduler::Add(newInstance);
newInstance->iStatus = KRequestPending;
newInstance->SetActive();
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::construct(): new instance successfully created and activated");
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::construct(): new instance successfully created and activated");
return newInstance;
}
// Called from ProcessManagerThread
-CProcessManagerMediator::CProcessManagerMediator()
- : CActive(CActive::EPriorityStandard)
+QProcessManagerMediator::QProcessManagerMediator()
+ : CActive(CActive::EPriorityStandard)
{
// Nothing to do
}
// Called from ProcessManagerThread
-CProcessManagerMediator::~CProcessManagerMediator()
+QProcessManagerMediator::~QProcessManagerMediator()
{
processManagerThread.Close();
- currentCommand = ENoCommand;
+ currentCommand = ENoCommand;
currentObserver = NULL;
}
// Called from main thread
-bool CProcessManagerMediator::add(CProcessActive* processObserver)
+bool QProcessManagerMediator::add(QProcessActive *processObserver)
{
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::add()");
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::add()");
return notify(processObserver, EAdd);
}
// Called from main thread
-void CProcessManagerMediator::remove(CProcessActive* processObserver)
+void QProcessManagerMediator::remove(QProcessActive *processObserver)
{
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::remove()");
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::remove()");
notify(processObserver, ERemove);
}
// Called from main thread
-void CProcessManagerMediator::terminate()
+void QProcessManagerMediator::terminate()
{
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::terminate()");
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::terminate()");
notify(NULL, ETerminate);
}
// Called from main thread
-bool CProcessManagerMediator::notify(CProcessActive* processObserver, Commands command)
+bool QProcessManagerMediator::notify(QProcessActive *processObserver, Commands command)
{
bool success(true);
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): Command: %d, processObserver: 0x%x", command, processObserver);
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Command: %d, processObserver: 0x%x", command, processObserver);
QPROCESS_ASSERT((command == ETerminate || processObserver),
- EProcessManagerMediatorNullObserver,
- "CProcessManagerMediator::Notify(): NULL processObserver not allowed for command: %d", command)
+ EProcessManagerMediatorNullObserver,
+ "QProcessManagerMediator::Notify(): NULL processObserver not allowed for command: %d", command)
QPROCESS_ASSERT(IsActive(),
- EProcessManagerMediatorInactive,
- "CProcessManagerMediator::Notify(): Mediator is not active!")
+ EProcessManagerMediatorInactive,
+ "QProcessManagerMediator::Notify(): Mediator is not active!")
- QPROCESS_ASSERT(iStatus==KRequestPending,
- EProcessManagerMediatorNotPending,
- "CProcessManagerMediator::Notify(): Mediator request not pending!")
+ QPROCESS_ASSERT(iStatus == KRequestPending,
+ EProcessManagerMediatorNotPending,
+ "QProcessManagerMediator::Notify(): Mediator request not pending!")
currentObserver = processObserver;
currentCommand = command;
@@ -519,16 +529,16 @@ bool CProcessManagerMediator::notify(CProcessActive* processObserver, Commands c
processManagerThread.Rendezvous(pmStatus);
// Complete request -> RunL will run in the process manager thread
- TRequestStatus* status = &iStatus;
+ TRequestStatus *status = &iStatus;
processManagerThread.RequestComplete(status, command);
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): Waiting process manager to complete...");
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Waiting process manager to complete...");
User::WaitForRequest(pmStatus);
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): Wait over");
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): Wait over");
if (currentObserver) {
success = !(currentObserver->error());
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::Notify(): success = %d", success);
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::Notify(): success = %d", success);
}
currentObserver = NULL;
@@ -538,25 +548,25 @@ bool CProcessManagerMediator::notify(CProcessActive* processObserver, Commands c
}
// Called from ProcessManagerThread
-void CProcessManagerMediator::RunL()
+void QProcessManagerMediator::RunL()
{
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::RunL(): currentCommand: %d, iStatus: %d", currentCommand, iStatus.Int());
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::RunL(): currentCommand: %d, iStatus: %d", currentCommand, iStatus.Int());
switch (currentCommand) {
- case EAdd:
- currentObserver->start();
- break;
- case ERemove:
- currentObserver->stop();
- break;
- case ETerminate:
- Deque();
- CActiveScheduler::Stop();
- return;
- default:
- QPROCESS_ASSERT(0,
- EProcessManagerMediatorInvalidCmd,
- "CProcessManagerMediator::RunL(): Invalid command!")
- break;
+ case EAdd:
+ currentObserver->start();
+ break;
+ case ERemove:
+ currentObserver->stop();
+ break;
+ case ETerminate:
+ Deque();
+ CActiveScheduler::Stop();
+ return;
+ default:
+ QPROCESS_ASSERT(0,
+ EProcessManagerMediatorInvalidCmd,
+ "QProcessManagerMediator::RunL(): Invalid command!")
+ break;
}
iStatus = KRequestPending;
@@ -567,44 +577,44 @@ void CProcessManagerMediator::RunL()
}
// Called from ProcessManagerThread
-TInt CProcessManagerMediator::RunError(TInt aError)
+TInt QProcessManagerMediator::RunError(TInt aError)
{
Q_UNUSED(aError);
// Handle RunL leave (should never happen)
QPROCESS_ASSERT(0,
- EProcessManagerMediatorRunError,
- "CProcessManagerMediator::RunError(): Should never get here!")
+ EProcessManagerMediatorRunError,
+ "QProcessManagerMediator::RunError(): Should never get here!")
return 0;
}
// Called from ProcessManagerThread
-void CProcessManagerMediator::DoCancel()
+void QProcessManagerMediator::DoCancel()
{
- QPROCESS_DEBUG_PRINT("CProcessManagerMediator::DoCancel()");
- TRequestStatus* status = &iStatus;
+ QPROCESS_DEBUG_PRINT("QProcessManagerMediator::DoCancel()");
+ TRequestStatus *status = &iStatus;
processManagerThread.RequestComplete(status, KErrCancel);
}
Q_GLOBAL_STATIC(QProcessManager, processManager)
-TInt processManagerThreadFunction(TAny* param)
+TInt processManagerThreadFunction(TAny *param)
{
QPROCESS_ASSERT(param,
- EProcessManagerNullParam,
- "processManagerThreadFunction(): NULL param")
+ EProcessManagerNullParam,
+ "processManagerThreadFunction(): NULL param")
- QProcessManager* manager = reinterpret_cast<QProcessManager*>(param);
+ QProcessManager *manager = reinterpret_cast<QProcessManager*>(param);
- CActiveScheduler* scheduler = new CQtActiveScheduler();
+ CActiveScheduler *scheduler = new CQtActiveScheduler();
QPROCESS_ASSERT(scheduler,
- EProcessManagerSchedulerCreationFail,
- "processManagerThreadFunction(): Scheduler creation failed")
+ EProcessManagerSchedulerCreationFail,
+ "processManagerThreadFunction(): Scheduler creation failed")
CActiveScheduler::Install(scheduler);
//Creating mediator also adds it to scheduler and activates it. Failure will panic.
- manager->setMediator(CProcessManagerMediator::construct());
+ manager->setMediator(QProcessManagerMediator::construct());
RThread::Rendezvous(KErrNone);
CActiveScheduler::Start();
@@ -616,13 +626,13 @@ TInt processManagerThreadFunction(TAny* param)
}
QProcessManager::QProcessManager()
- : mediator(NULL), threadStarted(false)
+ : mediator(NULL), threadStarted(false)
{
TInt err = managerMutex.CreateLocal();
QPROCESS_ASSERT(err == KErrNone,
- EProcessManagerMutexCreationFail,
- "QProcessManager::QProcessManager(): Failed to create new managerMutex (err: %d)", err)
+ EProcessManagerMutexCreationFail,
+ "QProcessManager::QProcessManager(): Failed to create new managerMutex (err: %d)", err)
}
QProcessManager::~QProcessManager()
@@ -630,10 +640,10 @@ QProcessManager::~QProcessManager()
QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager()");
// Cancel death listening for all child processes
if (mediator) {
- QMap<int, CProcessActive *>::Iterator it = children.begin();
+ QMap<int, QProcessActive *>::Iterator it = children.begin();
while (it != children.end()) {
// Remove all monitors
- CProcessActive *active = it.value();
+ QProcessActive *active = it.value();
mediator->remove(active);
QPROCESS_DEBUG_PRINT("QProcessManager::~QProcessManager() removed listening for a process");
@@ -647,7 +657,7 @@ QProcessManager::~QProcessManager()
qDeleteAll(children.values());
children.clear();
- managerThread.Close();
+ managerThread.Close();
managerMutex.Close();
}
@@ -664,8 +674,8 @@ void QProcessManager::startThread()
EOwnerProcess);
QPROCESS_ASSERT(err == KErrNone,
- EProcessManagerThreadCreationFail,
- "QProcessManager::startThread(): Failed to create new managerThread (err:%d)", err)
+ EProcessManagerThreadCreationFail,
+ "QProcessManager::startThread(): Failed to create new managerThread (err:%d)", err)
threadStarted = true;
@@ -684,8 +694,8 @@ static QBasicAtomicInt idCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
bool QProcessManager::add(QProcess *process)
{
QPROCESS_ASSERT(process,
- EProcessManagerNullParam,
- "QProcessManager::add(): Failed to add CProcessActive to ProcessManager - NULL process")
+ EProcessManagerNullParam,
+ "QProcessManager::add(): Failed to add QProcessActive to ProcessManager - NULL process")
lock();
@@ -694,19 +704,19 @@ bool QProcessManager::add(QProcess *process)
QPROCESS_DEBUG_PRINT("QProcessManager::add(): serial: %d, deathPipe: %d - %d, symbianProcess: 0x%x", serial, process->d_func()->deathPipe[0], process->d_func()->deathPipe[1], process->d_func()->symbianProcess);
- CProcessActive* newActive =
- CProcessActive::construct(process,
+ QProcessActive *newActive =
+ QProcessActive::construct(process,
&(process->d_func()->symbianProcess),
serial,
process->d_func()->deathPipe[1]);
- if (newActive){
+ if (newActive) {
if (mediator->add(newActive)) {
children.insert(serial, newActive);
unlock();
return true;
} else {
- QPROCESS_DEBUG_PRINT("QProcessManager::add(): Failed to add CProcessActive to ProcessManager");
+ QPROCESS_DEBUG_PRINT("QProcessManager::add(): Failed to add QProcessActive to ProcessManager");
delete newActive;
}
}
@@ -719,13 +729,13 @@ bool QProcessManager::add(QProcess *process)
void QProcessManager::remove(QProcess *process)
{
QPROCESS_ASSERT(process,
- EProcessManagerNullParam,
- "QProcessManager::remove(): Failed to remove CProcessActive from ProcessManager - NULL process")
+ EProcessManagerNullParam,
+ "QProcessManager::remove(): Failed to remove QProcessActive from ProcessManager - NULL process")
lock();
int serial = process->d_func()->serial;
- CProcessActive *active = children.value(serial);
+ QProcessActive *active = children.value(serial);
if (!active) {
unlock();
return;
@@ -825,13 +835,13 @@ bool QProcessPrivate::processStarted()
qint64 QProcessPrivate::bytesAvailableFromStdout() const
{
- // In Symbian, zero bytes are always available
+ // In Symbian, stdout is not supported
return 0;
}
qint64 QProcessPrivate::bytesAvailableFromStderr() const
{
- // In Symbian, zero bytes are always available
+ // In Symbian, stderr is not supported
return 0;
}
@@ -839,7 +849,7 @@ qint64 QProcessPrivate::readFromStdout(char *data, qint64 maxlen)
{
Q_UNUSED(data);
Q_UNUSED(maxlen);
- // In Symbian, zero bytes are always read
+ // In Symbian, stdout is not supported
return 0;
}
@@ -847,7 +857,7 @@ qint64 QProcessPrivate::readFromStderr(char *data, qint64 maxlen)
{
Q_UNUSED(data);
Q_UNUSED(maxlen);
- // In Symbian, zero bytes are always read
+ // In Symbian, stderr is not supported
return 0;
}
@@ -855,14 +865,14 @@ qint64 QProcessPrivate::writeToStdin(const char *data, qint64 maxlen)
{
Q_UNUSED(data);
Q_UNUSED(maxlen);
- // In Symbian, zero bytes are always written
+ // In Symbian, stdin is not supported
return 0;
}
void QProcessPrivate::terminateProcess()
{
- // Not allowed by platform security - will panic kern-exec 46 if process has been started.
- // Works if process is not yet started.
+ // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise.
+ // Always works if process is not yet started.
if (qt_rprocess_running(symbianProcess)) {
symbianProcess->Terminate(0);
} else {
@@ -872,8 +882,8 @@ void QProcessPrivate::terminateProcess()
void QProcessPrivate::killProcess()
{
- // Not allowed by platform security - will panic kern-exec 46 if process has been started.
- // Works if process is not yet started.
+ // Needs PowerMgmt capability if process has been started; will panic kern-exec 46 otherwise.
+ // Always works if process is not yet started.
if (qt_rprocess_running(symbianProcess)) {
symbianProcess->Kill(0);
} else {
@@ -926,9 +936,8 @@ bool QProcessPrivate::waitForFinished(int msecs)
User::WaitForRequest(logonStatus, timerStatus);
QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished() - Wait completed");
- if (timerStatus == KErrNone) {
+ if (timerStatus == KErrNone)
timeoutOccurred = true;
- }
timer.Cancel();
timer.Close();
@@ -941,11 +950,11 @@ bool QProcessPrivate::waitForFinished(int msecs)
QPROCESS_DEBUG_PRINT("QProcessPrivate::waitForFinished(), qt_rprocess_running returned false");
}
- if (timeoutOccurred) {
- processError = QProcess::Timedout;
- q->setErrorString(QLatin1String(QT_TRANSLATE_NOOP(QProcess, "Process operation timed out")));
- return false;
- }
+ if (timeoutOccurred) {
+ processError = QProcess::Timedout;
+ q->setErrorString(QLatin1String(QT_TRANSLATE_NOOP(QProcess, "Process operation timed out")));
+ return false;
+ }
_q_processDied();
@@ -1007,14 +1016,13 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
QPROCESS_DEBUG_PRINT("QProcessPrivate::startDetached()");
Q_UNUSED(workingDirectory);
- RProcess* newProc = NULL;
+ RProcess *newProc = NULL;
TInt err = qt_create_symbian_process(&newProc, program, arguments);
if (err == KErrNone) {
- if (pid) {
+ if (pid)
*pid = (qint64)newProc->Id();
- }
newProc->Resume();
newProc->Close();
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index d76e99bf9..3db05640b 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -515,8 +515,8 @@ QTemporaryFile::QTemporaryFile()
Q_D(QTemporaryFile);
d->templateName = QDir::tempPath() + QLatin1String("/qt_temp.XXXXXX");
#ifdef Q_OS_SYMBIAN
- //Just for verify that folder really exist on hardware
- fileEngine()->mkdir( QDir::tempPath(), true );
+ //Just to verify that folder really exist on hardware
+ fileEngine()->mkdir(QDir::tempPath(), true);
#endif
}