summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@nokia.com>2009-04-28 15:37:52 (GMT)
committerMaurice Kalinowski <maurice.kalinowski@nokia.com>2009-04-28 15:39:52 (GMT)
commitbad50f8a2ef285aa9943291400cd322a6ec7af82 (patch)
tree40bec4ba9e2e90772d3e1271aae69af8ecf9ac5b
parentb001ebb06be0b9d43ae0b5011a8d2b0455082d84 (diff)
downloadQt-bad50f8a2ef285aa9943291400cd322a6ec7af82.zip
Qt-bad50f8a2ef285aa9943291400cd322a6ec7af82.tar.gz
Qt-bad50f8a2ef285aa9943291400cd322a6ec7af82.tar.bz2
fix double slash prepending causing troubles on WinCE
Before adding a / to the path one should check if it doesn't end with one already. Otherwise one might get paths like //My Documents on WinCE causing the native call to crash the filesystem service on that system. Reviewed-by: alexis
-rw-r--r--src/gui/dialogs/qfilesystemmodel_p.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/gui/dialogs/qfilesystemmodel_p.h
index 0a1265a..61e8b4c 100644
--- a/src/gui/dialogs/qfilesystemmodel_p.h
+++ b/src/gui/dialogs/qfilesystemmodel_p.h
@@ -164,9 +164,12 @@ public:
QHash<QString, QFileSystemNode *>::const_iterator iterator;
for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
- if (!path.isEmpty())
- iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
- else
+ if (!path.isEmpty()) {
+ if (path.endsWith(QLatin1Char('/')))
+ iterator.value()->updateIcon(iconProvider, path + iterator.value()->fileName);
+ else
+ iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ } else
iterator.value()->updateIcon(iconProvider, iterator.value()->fileName);
}
}
@@ -177,9 +180,12 @@ public:
QHash<QString, QFileSystemNode *>::const_iterator iterator;
for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
- if (!path.isEmpty())
- iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
- else
+ if (!path.isEmpty()) {
+ if (path.endsWith(QLatin1Char('/')))
+ iterator.value()->retranslateStrings(iconProvider, path + iterator.value()->fileName);
+ else
+ iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ } else
iterator.value()->retranslateStrings(iconProvider, iterator.value()->fileName);
}
}