forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/9.0' into 10.0
Change-Id: I7e171601cd7317b48d5074bbc0ead127813d596c
This commit is contained in:
@@ -1044,6 +1044,19 @@ QByteArray UnixDeviceFileAccess::fileId(const FilePath &filePath) const
|
||||
|
||||
FilePathInfo UnixDeviceFileAccess::filePathInfo(const FilePath &filePath) const
|
||||
{
|
||||
if (filePath.path() == "/") // TODO: Add FilePath::isRoot()
|
||||
{
|
||||
const FilePathInfo r{4096,
|
||||
FilePathInfo::FileFlags(
|
||||
FilePathInfo::ReadOwnerPerm | FilePathInfo::WriteOwnerPerm
|
||||
| FilePathInfo::ExeOwnerPerm | FilePathInfo::ReadGroupPerm
|
||||
| FilePathInfo::ExeGroupPerm | FilePathInfo::ReadOtherPerm
|
||||
| FilePathInfo::ExeOtherPerm | FilePathInfo::DirectoryType
|
||||
| FilePathInfo::LocalDiskFlag | FilePathInfo::ExistsFlag),
|
||||
QDateTime::currentDateTime()};
|
||||
|
||||
return r;
|
||||
}
|
||||
const RunResult stat = runInShell(
|
||||
{"stat", {"-L", "-c", "%f %Y %s", filePath.path()}, OsType::OsTypeLinux});
|
||||
return FileUtils::filePathInfoFromTriple(QString::fromLatin1(stat.stdOut));
|
||||
|
||||
@@ -403,21 +403,25 @@ static QUrl filePathToQUrl(const FilePath &filePath)
|
||||
|
||||
void prepareNonNativeDialog(QFileDialog &dialog)
|
||||
{
|
||||
const auto isValidSideBarPath = [](const FilePath &fp) {
|
||||
return !fp.needsDevice() || fp.hasFileAccess();
|
||||
};
|
||||
|
||||
// Checking QFileDialog::itemDelegate() seems to be the only way to determine
|
||||
// whether the dialog is native or not.
|
||||
if (dialog.itemDelegate()) {
|
||||
FilePaths sideBarPaths;
|
||||
|
||||
// Check existing urls, remove paths that need a device and no longer exist.
|
||||
// Check existing urls, remove paths that need a device and are no longer valid.
|
||||
for (const QUrl &url : dialog.sidebarUrls()) {
|
||||
FilePath path = qUrlToFilePath(url);
|
||||
if (!path.needsDevice() || path.exists())
|
||||
if (isValidSideBarPath(path))
|
||||
sideBarPaths.append(path);
|
||||
}
|
||||
|
||||
// Add all device roots that are not already in the sidebar and exist.
|
||||
// Add all device roots that are not already in the sidebar and valid.
|
||||
for (const FilePath &path : FSEngine::registeredDeviceRoots()) {
|
||||
if (!sideBarPaths.contains(path) && path.exists())
|
||||
if (!sideBarPaths.contains(path) && isValidSideBarPath(path))
|
||||
sideBarPaths.append(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ bool FSEngineImpl::open(QIODevice::OpenMode openMode)
|
||||
createCacheData);
|
||||
bool exists = (data.filePathInfo.fileFlags & QAbstractFileEngine::ExistsFlag);
|
||||
|
||||
if (data.filePathInfo.fileFlags & QAbstractFileEngine::DirectoryType)
|
||||
return false;
|
||||
|
||||
g_filePathInfoCache.invalidate(m_filePath);
|
||||
|
||||
ensureStorage();
|
||||
|
||||
Submodule src/shared/qbs updated: 106316f632...03b0537a79
@@ -374,24 +374,38 @@ def addBranchWildcardToRoot(rootNode):
|
||||
return rootNode[:pos] + " [[]*[]]" + rootNode[pos:]
|
||||
|
||||
def openDocument(treeElement):
|
||||
# split into tree elements
|
||||
treePathElements = re.split(r"(?<!\\)\.", treeElement)
|
||||
# 'unmask' the extension delimiter
|
||||
treePathElements = list(x.replace("\\.", ".") for x in treePathElements)
|
||||
try:
|
||||
parentIndex = None
|
||||
selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Projects")
|
||||
navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView")
|
||||
try:
|
||||
item = waitForObjectItem(navigator, treeElement, 3000)
|
||||
except:
|
||||
treeElement = addBranchWildcardToRoot(treeElement)
|
||||
item = waitForObjectItem(navigator, treeElement)
|
||||
expected = str(item.text).split("/")[-1]
|
||||
for _ in range(2):
|
||||
# Expands items as needed what might make scrollbars appear.
|
||||
# These might cover the item to click.
|
||||
# In this case, do it again to hit the item then.
|
||||
doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton)
|
||||
|
||||
for i, t in enumerate(treePathElements):
|
||||
indices = dumpIndices(navigator.model(), parentIndex)
|
||||
foundT = False
|
||||
for index in indices:
|
||||
iText = str(index.text)
|
||||
if (iText == t
|
||||
or (i == 0 and re.match(t + " [[].+[]]", iText) is not None)):
|
||||
foundT = True
|
||||
parentIndex = index
|
||||
break
|
||||
if not foundT:
|
||||
raise Exception("Failed to get index '%s' (%d)." % (t, i))
|
||||
if not navigator.isExpanded(parentIndex):
|
||||
navigator.scrollTo(parentIndex)
|
||||
rect = navigator.visualRect(parentIndex)
|
||||
doubleClick(navigator, rect.x + 50, rect.y + 5, 0, Qt.LeftButton)
|
||||
# now we should have a full expanded tree up to the requested file
|
||||
rect = navigator.visualRect(parentIndex)
|
||||
doubleClick(navigator, rect.x + 50, rect.y + 5, 0, Qt.LeftButton)
|
||||
mainWindow = waitForObject(":Qt Creator_Core::Internal::MainWindow")
|
||||
if waitFor("str(mainWindow.windowTitle).startswith(expected + ' ')", 5000):
|
||||
if waitFor("str(mainWindow.windowTitle).startswith(treePathElements[-1] + ' ')", 5000):
|
||||
return True
|
||||
test.log("Expected file (%s) was not being opened in openDocument()" % expected)
|
||||
test.log("Expected file (%s) was not being opened in openDocument()" % treePathElements[-1])
|
||||
return False
|
||||
except:
|
||||
t,v = sys.exc_info()[:2]
|
||||
|
||||
Reference in New Issue
Block a user