forked from qt-creator/qt-creator
QmlJS: Fix QUrl completion with Qt 4.8.
QUrl no longer treats scheme-less urls as local files. Change-Id: Ie219985d653a692937ff9a5ebbafc455cd3dca13 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -856,9 +856,20 @@ bool QmlJSCompletionAssistProcessor::completeFileName(const QString &relativeBas
|
||||
bool QmlJSCompletionAssistProcessor::completeUrl(const QString &relativeBasePath, const QString &urlString)
|
||||
{
|
||||
const QUrl url(urlString);
|
||||
QString fileName = url.toLocalFile();
|
||||
QString fileName;
|
||||
if (url.isLocalFile()) {
|
||||
fileName = url.toLocalFile();
|
||||
// should not trigger completion on 'file://'
|
||||
if (fileName.isEmpty())
|
||||
return false;
|
||||
} else if (url.scheme().isEmpty()) {
|
||||
// don't trigger completion while typing a scheme
|
||||
if (urlString.endsWith(QLatin1String(":/")))
|
||||
return false;
|
||||
fileName = urlString;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return completeFileName(relativeBasePath, fileName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user