summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-01-12 09:35:26 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-01-12 09:38:50 (GMT)
commita1ec686734e105228ff539c0e3bfc7850c66dc04 (patch)
treea394e08f481d13858340ca6c90e21004a10b60d6 /src/gui/dialogs
parent7abb2cfdea14fa71aabcd79635aa8f407ed96186 (diff)
downloadQt-a1ec686734e105228ff539c0e3bfc7850c66dc04.zip
Qt-a1ec686734e105228ff539c0e3bfc7850c66dc04.tar.gz
Qt-a1ec686734e105228ff539c0e3bfc7850c66dc04.tar.bz2
Fix completion in QFileDialog.
Completing under the root directory was "eating" the first letter. On windows under C:\ the completion was not working at all. Task-number: QTBUG-4933 Reviewed-by:janarve Reviewed-by:gabi
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 3c388de..ab44fe7 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -3245,6 +3245,10 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const
QString currentLocation = dirModel->rootPath();
QString path = index.data(QFileSystemModel::FilePathRole).toString();
if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) {
+#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE)
+ if (currentLocation == QDir::separator())
+ return path.mid(currentLocation.length());
+#endif
return path.mid(currentLocation.length() + 1);
}
return index.data(QFileSystemModel::FilePathRole).toString();
@@ -3300,6 +3304,10 @@ QStringList QFSCompleter::splitPath(const QString &path) const
else
dirModel = sourceModel;
QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath());
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ if (currentLocation.endsWith(QLatin1Char(':')))
+ currentLocation.append(sep);
+#endif
if (currentLocation.contains(sep) && path != currentLocation) {
QStringList currentLocationList = splitPath(currentLocation);
while (!currentLocationList.isEmpty()