diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2010-08-31 07:56:27 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2010-09-07 12:17:10 (GMT) |
commit | b0de175aab06092932077eb1c5fb3f89691b6014 (patch) | |
tree | 234528d2f057de9e213d61f17a611836b952c366 /src/corelib/io/qfileinfo.cpp | |
parent | 8e8743113f642e82bac6ecc055d2d3be8f53d7a6 (diff) | |
download | Qt-b0de175aab06092932077eb1c5fb3f89691b6014.zip Qt-b0de175aab06092932077eb1c5fb3f89691b6014.tar.gz Qt-b0de175aab06092932077eb1c5fb3f89691b6014.tar.bz2 |
QDir and QFileInfo shouldn't lose properties when detaching
For QFileInfo, the caching state was being lost on the different setFile
overloads. QDir::cd and ::makeAbsolute were losing filters and sorting
flags.
QDir issues were introduced with these patches:
"Simplify QDir::cd"
"QDir::makeAbsolute could self-destruct on failure"
Reviewed-by: Prasanth Ullattil
Diffstat (limited to 'src/corelib/io/qfileinfo.cpp')
-rw-r--r-- | src/corelib/io/qfileinfo.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 248b83d..7eca212 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -395,7 +395,9 @@ QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo) */ void QFileInfo::setFile(const QString &file) { + bool caching = d_ptr.constData()->cache_enabled; *this = QFileInfo(file); + d_ptr->cache_enabled = caching; } /*! @@ -411,7 +413,7 @@ void QFileInfo::setFile(const QString &file) */ void QFileInfo::setFile(const QFile &file) { - *this = QFileInfo(file.fileName()); + setFile(file.fileName()); } /*! @@ -427,7 +429,7 @@ void QFileInfo::setFile(const QFile &file) */ void QFileInfo::setFile(const QDir &dir, const QString &file) { - *this = QFileInfo(dir.filePath(file)); + setFile(dir.filePath(file)); } /*! @@ -579,7 +581,7 @@ bool QFileInfo::makeAbsolute() QString absFileName = d_ptr.constData()->getFileName(QAbstractFileEngine::AbsoluteName); // QSharedDataPointer::operator->() will detach. - *this = QFileInfo(absFileName); + setFile(absFileName); return true; } |