summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorGuoqing Zhang <guoqing.zhang@nokia.com>2011-04-05 07:49:59 (GMT)
committerGuoqing Zhang <guoqing.zhang@nokia.com>2011-04-05 07:49:59 (GMT)
commit81921596f6083eedb926c214c3e6324ba4b40cab (patch)
tree089f0bbd39c46afbae5e47f8ac990977024bc91c /src/corelib/io
parentebe4edf58728f4dc5cf633ba6fb92dea721b2bdc (diff)
parentc3e903409b96fede96cb4a7b95ba308663c88879 (diff)
downloadQt-81921596f6083eedb926c214c3e6324ba4b40cab.zip
Qt-81921596f6083eedb926c214c3e6324ba4b40cab.tar.gz
Qt-81921596f6083eedb926c214c3e6324ba4b40cab.tar.bz2
Merge remote branch 'qt-master/master'
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdir.cpp15
-rw-r--r--src/corelib/io/qdiriterator.cpp10
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp1
-rw-r--r--src/corelib/io/qfilesystemiterator_p.h5
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp4
-rw-r--r--src/corelib/io/qiodevice.cpp9
-rw-r--r--src/corelib/io/qprocess.cpp49
-rw-r--r--src/corelib/io/qprocess.h4
-rw-r--r--src/corelib/io/qprocess_p.h2
-rw-r--r--src/corelib/io/qresource.cpp6
-rw-r--r--src/corelib/io/qsettings.cpp2
11 files changed, 93 insertions, 14 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 42f1652..166513a 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -196,12 +196,19 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
if (!absoluteDirEntry.isEmpty() || dirEntry.isEmpty())
return;
- if (dirEntry.isRelative()) {
- QFileSystemEntry answer = QFileSystemEngine::absoluteName(dirEntry);
- absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(answer.filePath()), QFileSystemEntry::FromInternalPath());
+ QString absoluteName;
+ if (fileEngine.isNull()) {
+ if (!dirEntry.isRelative()) {
+ absoluteDirEntry = dirEntry;
+ return;
+ }
+
+ absoluteName = QFileSystemEngine::absoluteName(dirEntry).filePath();
} else {
- absoluteDirEntry = dirEntry;
+ absoluteName = fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
}
+
+ absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(absoluteName), QFileSystemEntry::FromInternalPath());
}
/* For sorting */
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index d293791..c7e56bd 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -142,7 +142,9 @@ public:
#endif
QDirIteratorPrivateIteratorStack<QAbstractFileEngineIterator> fileEngineIterators;
+#ifndef QT_NO_FILESYSTEMITERATOR
QDirIteratorPrivateIteratorStack<QFileSystemIterator> nativeIterators;
+#endif
QFileInfo currentFileInfo;
QFileInfo nextFileInfo;
@@ -204,9 +206,11 @@ void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo)
// No iterator; no entry list.
}
} else {
+#ifndef QT_NO_FILESYSTEMITERATOR
QFileSystemIterator *it = new QFileSystemIterator(fileInfo.d_ptr->fileEntry,
filters, nameFilters, iteratorFlags);
nativeIterators << it;
+#endif
}
}
@@ -244,6 +248,7 @@ void QDirIteratorPrivate::advance()
delete it;
}
} else {
+#ifndef QT_NO_FILESYSTEMITERATOR
QFileSystemEntry nextEntry;
QFileSystemMetaData nextMetaData;
@@ -260,6 +265,7 @@ void QDirIteratorPrivate::advance()
nativeIterators.pop();
delete it;
}
+#endif
}
currentFileInfo = nextFileInfo;
@@ -500,7 +506,11 @@ bool QDirIterator::hasNext() const
if (d->engine)
return !d->fileEngineIterators.isEmpty();
else
+#ifndef QT_NO_FILESYSTEMITERATOR
return !d->nativeIterators.isEmpty();
+#else
+ return false;
+#endif
}
/*!
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 1becea5..c9ebaa4 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -176,6 +176,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
#if !defined(Q_OS_MAC) && _POSIX_VERSION < 200809L
// realpath(X,0) is not supported
+ Q_UNUSED(data);
return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath()));
#else
char *ret = 0;
diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h
index 2dc4a9f..fb8bfe6 100644
--- a/src/corelib/io/qfilesystemiterator_p.h
+++ b/src/corelib/io/qfilesystemiterator_p.h
@@ -54,6 +54,9 @@
//
#include <QtCore/qglobal.h>
+
+#ifndef QT_NO_FILESYSTEMITERATOR
+
#include <QtCore/qdir.h>
#include <QtCore/qdiriterator.h>
#include <QtCore/qstringlist.h>
@@ -112,4 +115,6 @@ private:
QT_END_NAMESPACE
+#endif // QT_NO_FILESYSTEMITERATOR
+
#endif // include guard
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 3efdd9e..3d6012b 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -42,6 +42,8 @@
#include "qplatformdefs.h"
#include "qfilesystemiterator_p.h"
+#ifndef QT_NO_FILESYSTEMITERATOR
+
#include <stdlib.h>
#include <errno.h>
@@ -111,3 +113,5 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
}
QT_END_NAMESPACE
+
+#endif // QT_NO_FILESYSTEMITERATOR
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 76e8409..8759f8b 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1628,10 +1628,11 @@ QString QIODevice::errorString() const
\fn qint64 QIODevice::readData(char *data, qint64 maxSize)
Reads up to \a maxSize bytes from the device into \a data, and
- returns the number of bytes read or -1 if an error occurred. If
- there are no bytes to be read, this function should return -1 if
- there can never be more bytes available (for example: socket
- closed, pipe closed, sub-process finished).
+ returns the number of bytes read or -1 if an error occurred.
+
+ If there are no bytes to be read and there can never be more bytes
+ available (examples include socket closed, pipe closed, sub-process
+ finished), this function returns -1.
This function is called by QIODevice. Reimplement this function
when creating a subclass of QIODevice.
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 5035b79..a45225f 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -221,6 +221,24 @@ QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list
return env;
}
+QStringList QProcessEnvironmentPrivate::keys() const
+{
+ QStringList result;
+ QHash<Unit, Unit>::ConstIterator it = hash.constBegin(),
+ end = hash.constEnd();
+ for ( ; it != end; ++it)
+ result << nameToString(it.key());
+ return result;
+}
+
+void QProcessEnvironmentPrivate::insert(const Hash &h)
+{
+ QHash<Unit, Unit>::ConstIterator it = h.constBegin(),
+ end = h.constEnd();
+ for ( ; it != end; ++it)
+ hash.insert(it.key(), it.value());
+}
+
/*!
Creates a new QProcessEnvironment object. This constructor creates an
empty environment. If set on a QProcess, this will cause the current
@@ -396,6 +414,33 @@ QStringList QProcessEnvironment::toStringList() const
return d ? d->toList() : QStringList();
}
+/*!
+ \since 4.8
+
+ Returns a list containing all the variable names in this QProcessEnvironment
+ object.
+*/
+QStringList QProcessEnvironment::keys() const
+{
+ return d ? d->keys() : QStringList();
+}
+
+/*!
+ \overload
+ \since 4.8
+
+ Inserts the contents of \a e in this QProcessEnvironment object. Variables in
+ this object that also exist in \a e will be overwritten.
+*/
+void QProcessEnvironment::insert(const QProcessEnvironment &e)
+{
+ if (!e.d)
+ return;
+
+ // d detaches from null
+ d->insert(e.d->hash);
+}
+
void QProcessPrivate::Channel::clear()
{
switch (type) {
@@ -2235,10 +2280,10 @@ bool QProcess::startDetached(const QString &program)
}
QT_BEGIN_INCLUDE_NAMESPACE
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
-#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) || (defined(Q_OS_MAC) && defined(QT_NO_CORESERVICES))
static char *qt_empty_environ[] = { 0 };
#define environ qt_empty_environ
#elif !defined(Q_OS_WIN)
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index baa67f7..664992f 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -87,6 +87,10 @@ public:
QStringList toStringList() const;
+ QStringList keys() const;
+
+ void insert(const QProcessEnvironment &e);
+
static QProcessEnvironment systemEnvironment();
private:
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index be4f2a0..7bfcb31 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -94,6 +94,8 @@ public:
static QProcessEnvironment fromList(const QStringList &list);
QStringList toList() const;
+ QStringList keys() const;
+ void insert(const Hash &hash);
};
class QProcessPrivate : public QIODevicePrivate
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 0435256..cd8c1a3 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -373,7 +373,7 @@ QResourcePrivate::ensureChildren() const
Constructs a QResource pointing to \a file. \a locale is used to
load a specific localization of a resource data.
- \sa QFileInfo, searchPaths(), setFileName(), setLocale()
+ \sa QFileInfo, QDir::searchPaths(), setFileName(), setLocale()
*/
QResource::QResource(const QString &file, const QLocale &locale) : d_ptr(new QResourcePrivate(this))
@@ -418,7 +418,7 @@ QLocale QResource::locale() const
/*!
Sets a QResource to point to \a file. \a file can either be absolute,
in which case it is opened directly, if relative then the file will be
- tried to be found in searchPaths().
+ tried to be found in QDir::searchPaths().
\sa absoluteFilePath()
*/
@@ -446,7 +446,7 @@ QString QResource::fileName() const
/*!
Returns the real path that this QResource represents, if the resource
- was found via the searchPaths() it will be indicated in the path.
+ was found via the QDir::searchPaths() it will be indicated in the path.
\sa fileName()
*/
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 92f7636..b084ca5 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1004,7 +1004,7 @@ void QConfFileSettingsPrivate::initFormat()
readFunc = 0;
writeFunc = 0;
#if defined(Q_OS_MAC)
- caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : IniCaseSensitivity;
#else
caseSensitivity = IniCaseSensitivity;
#endif