summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp10
-rw-r--r--src/corelib/io/qiodevice.cpp4
-rw-r--r--src/corelib/io/qprocess.cpp67
-rw-r--r--src/corelib/io/qprocess.h5
-rw-r--r--src/corelib/io/qprocess_p.h3
-rw-r--r--src/corelib/io/qprocess_symbian.cpp17
-rw-r--r--src/corelib/io/qprocess_win.cpp5
-rw-r--r--src/corelib/io/qsettings.cpp6
9 files changed, 87 insertions, 32 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 7c14886..cfb40bc 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -95,6 +95,6 @@ win32 {
SOURCES += io/qfilesystemwatcher_symbian.cpp
HEADERS += io/qfilesystemwatcher_symbian_p.h
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
- contains(QT_CONFIG, s60): LIBS += -lplatformenv
+ LIBS += -lplatformenv
}
}
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 5762d94..9464a97 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -634,13 +634,8 @@ QString QFSFileEngine::homePath()
QString QFSFileEngine::rootPath()
{
#if defined(Q_OS_SYMBIAN)
-# 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 QString();
-# endif
#else
return QLatin1String("/");
#endif
@@ -649,17 +644,12 @@ QString QFSFileEngine::rootPath()
QString QFSFileEngine::tempPath()
{
#if defined(Q_OS_SYMBIAN)
-# ifdef Q_WS_S60
TFileName symbianPath = PathInfo::PhoneMemoryRootPath();
QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath));
temp += QLatin1String( "temp/");
// Just to verify that folder really exist on hardware
QT_MKDIR(QFile::encodeName(temp), 0777);
-# else
-# warning No fallback implementation of QFSFileEngine::tempPath()
- QString temp;
-# endif
#else
QString temp = QFile::decodeName(qgetenv("TMPDIR"));
if (temp.isEmpty())
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index ea60792..26e587d 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1452,7 +1452,7 @@ qint64 QIODevicePrivate::peek(char *data, qint64 maxSize)
return readBytes;
buffer.ungetBlock(data, readBytes);
- pos -= readBytes;
+ *pPos -= readBytes;
return readBytes;
}
@@ -1467,7 +1467,7 @@ QByteArray QIODevicePrivate::peek(qint64 maxSize)
return result;
buffer.ungetBlock(result.constData(), result.size());
- pos -= result.size();
+ *pPos -= result.size();
return result;
}
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index b5e7a97..9bc4063 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1377,6 +1377,50 @@ void QProcess::setStandardOutputProcess(QProcess *destination)
dto->stdinChannel.pipeFrom(dfrom);
}
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+
+/*!
+ \since 4.7
+
+ Returns the additional native command line arguments for the program.
+
+ \note This function is available only on the Windows and Symbian
+ platforms.
+
+ \sa setNativeArguments()
+*/
+QString QProcess::nativeArguments() const
+{
+ Q_D(const QProcess);
+ return d->nativeArguments;
+}
+
+/*!
+ \since 4.7
+ \overload
+
+ Sets additional native command line arguments for the program.
+
+ On operating systems where the system API for passing command line
+ arguments to a subprocess natively uses a single string, one can
+ conceive command lines which cannot be passed via QProcess's portable
+ list-based API. In such cases this function must be used to set a
+ string which is \e appended to the string composed from the usual
+ argument list, with a delimiting space.
+
+ \note This function is available only on the Windows and Symbian
+ platforms.
+
+ \sa nativeArguments()
+*/
+void QProcess::setNativeArguments(const QString &arguments)
+{
+ Q_D(QProcess);
+ d->nativeArguments = arguments;
+}
+
+#endif
+
/*!
If QProcess has been assigned a working directory, this function returns
the working directory that the QProcess will enter before the program has
@@ -1856,7 +1900,7 @@ QByteArray QProcess::readAllStandardError()
}
/*!
- Starts the program \a program in a new process, if one is not already
+ Starts the given \a program in a new process, if none is already
running, passing the command line arguments in \a arguments. The OpenMode
is set to \a mode.
@@ -1866,14 +1910,13 @@ QByteArray QProcess::readAllStandardError()
process, a warning may be printed at the console, and the existing
process will continue running.
- \note Arguments that contain spaces are not passed to the
- process as separate arguments.
-
\note Processes are started asynchronously, which means the started()
and error() signals may be delayed. Call waitForStarted() to make
sure the process has started (or has failed to start) and those signals
have been emitted.
+ \note No further splitting of the arguments is performed.
+
\bold{Windows:} Arguments that contain spaces are wrapped in quotes.
\sa pid(), started(), waitForStarted()
@@ -2079,18 +2122,23 @@ QProcess::ExitStatus QProcess::exitStatus() const
code of the process. Any data the new process writes to the
console is forwarded to the calling process.
- The environment and working directory are inherited by the calling
+ The environment and working directory are inherited from the calling
process.
On Windows, arguments that contain spaces are wrapped in quotes.
+
+ If the process cannot be started, -2 is returned. If the process
+ crashes, -1 is returned. Otherwise, the process' exit code is
+ returned.
*/
int QProcess::execute(const QString &program, const QStringList &arguments)
{
QProcess process;
process.setReadChannelMode(ForwardedChannels);
process.start(program, arguments);
- process.waitForFinished(-1);
- return process.exitCode();
+ if (!process.waitForFinished(-1))
+ return -2;
+ return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
}
/*!
@@ -2105,8 +2153,9 @@ int QProcess::execute(const QString &program)
QProcess process;
process.setReadChannelMode(ForwardedChannels);
process.start(program);
- process.waitForFinished(-1);
- return process.exitCode();
+ if (!process.waitForFinished(-1))
+ return -2;
+ return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
}
/*!
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index f84b855..b07d742 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -148,6 +148,11 @@ public:
void setStandardErrorFile(const QString &fileName, OpenMode mode = Truncate);
void setStandardOutputProcess(QProcess *destination);
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QString nativeArguments() const;
+ void setNativeArguments(const QString &arguments);
+#endif
+
QString workingDirectory() const;
void setWorkingDirectory(const QString &dir);
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 60b7b5a..8b7e3ff 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -181,6 +181,9 @@ public:
QString program;
QStringList arguments;
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QString nativeArguments;
+#endif
QProcessEnvironment environment;
QRingBuffer outputReadBuffer;
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index 92212fe..af657b2 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -219,7 +219,8 @@ static bool qt_rprocess_running(RProcess *proc)
return false;
}
-static void qt_create_symbian_commandline(const QStringList &arguments, QString &commandLine)
+static void qt_create_symbian_commandline(
+ const QStringList &arguments, const QString &nativeArguments, QString &commandLine)
{
for (int i = 0; i < arguments.size(); ++i) {
QString tmp = arguments.at(i);
@@ -243,12 +244,14 @@ static void qt_create_symbian_commandline(const QStringList &arguments, QString
}
}
- // Chop the extra trailing space if any arguments were appended
- if (arguments.size())
+ if (!nativeArguments.isEmpty())
+ commandLine += nativeArguments;
+ else if (!commandLine.isEmpty()) // Chop the extra trailing space if any arguments were appended
commandLine.chop(1);
}
-static TInt qt_create_symbian_process(RProcess **proc, const QString &programName, const QStringList &arguments)
+static TInt qt_create_symbian_process(RProcess **proc,
+ const QString &programName, const QStringList &arguments, const QString &nativeArguments)
{
RProcess *newProc = NULL;
newProc = new RProcess();
@@ -257,7 +260,7 @@ static TInt qt_create_symbian_process(RProcess **proc, const QString &programNam
return KErrNoMemory;
QString commandLine;
- qt_create_symbian_commandline(arguments, commandLine);
+ qt_create_symbian_commandline(arguments, nativeArguments, commandLine);
TPtrC program_ptr(reinterpret_cast<const TText*>(programName.constData()));
TPtrC cmdline_ptr(reinterpret_cast<const TText*>(commandLine.constData()));
@@ -794,7 +797,7 @@ void QProcessPrivate::startProcess()
q, SLOT(_q_processDied()));
}
- TInt err = qt_create_symbian_process(&symbianProcess, program, arguments);
+ TInt err = qt_create_symbian_process(&symbianProcess, program, arguments, nativeArguments);
if (err == KErrNone) {
pid = symbianProcess->Id().Id();
@@ -1030,7 +1033,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
RProcess *newProc = NULL;
- TInt err = qt_create_symbian_process(&newProc, program, arguments);
+ TInt err = qt_create_symbian_process(&newProc, program, arguments, QString());
if (err == KErrNone) {
if (pid)
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index cb25a58..702349f 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -366,6 +366,11 @@ void QProcessPrivate::startProcess()
if (environment.d.constData())
envlist = qt_create_environment(environment.d.constData()->hash);
#endif
+ if (!nativeArguments.isEmpty()) {
+ if (!args.isEmpty())
+ args += QLatin1Char(' ');
+ args += nativeArguments;
+ }
#if defined QPROCESS_DEBUG
qDebug("Creating process");
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 998c7cc..5aa97f9 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2274,9 +2274,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
be different instances of your application running at the same
time or different applications altogether) to read and write to
the same system locations. It uses advisory file locking and a
- smart merging algorithm to ensure data integrity. Changes
- performed by another process aren't visible in the current
- process until sync() is called.
+ smart merging algorithm to ensure data integrity. Note that sync()
+ imports changes made by other processes (in addition to writing
+ the changes from this QSettings).
\section1 Platform-Specific Notes