summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfileinfo.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2010-08-31 09:56:27 +0200
committerJoão Abecasis <joao.abecasis@nokia.com>2010-09-07 14:17:10 +0200
commitb0de175aab06092932077eb1c5fb3f89691b6014 (patch)
tree234528d2f057de9e213d61f17a611836b952c366 /src/corelib/io/qfileinfo.cpp
parent8e8743113f642e82bac6ecc055d2d3be8f53d7a6 (diff)
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.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 248b83daad..7eca212463 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;
}