summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
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-05-26 07:55:16 (GMT)
commit5839b16a73c36ff7636c13f841d26e6a5e0c5435 (patch)
tree5f9df5fa1b9cd1a45282185ec7a2166565f20984 /src/gui/dialogs
parent682b854872c26d7408d79131217825fb8ddace6a (diff)
downloadQt-5839b16a73c36ff7636c13f841d26e6a5e0c5435.zip
Qt-5839b16a73c36ff7636c13f841d26e6a5e0c5435.tar.gz
Qt-5839b16a73c36ff7636c13f841d26e6a5e0c5435.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
Diffstat (limited to 'src/gui/dialogs')
-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);
}
}