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
|
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(
|
const RunResult stat = runInShell(
|
||||||
{"stat", {"-L", "-c", "%f %Y %s", filePath.path()}, OsType::OsTypeLinux});
|
{"stat", {"-L", "-c", "%f %Y %s", filePath.path()}, OsType::OsTypeLinux});
|
||||||
return FileUtils::filePathInfoFromTriple(QString::fromLatin1(stat.stdOut));
|
return FileUtils::filePathInfoFromTriple(QString::fromLatin1(stat.stdOut));
|
||||||
|
|||||||
@@ -403,21 +403,25 @@ static QUrl filePathToQUrl(const FilePath &filePath)
|
|||||||
|
|
||||||
void prepareNonNativeDialog(QFileDialog &dialog)
|
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
|
// Checking QFileDialog::itemDelegate() seems to be the only way to determine
|
||||||
// whether the dialog is native or not.
|
// whether the dialog is native or not.
|
||||||
if (dialog.itemDelegate()) {
|
if (dialog.itemDelegate()) {
|
||||||
FilePaths sideBarPaths;
|
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()) {
|
for (const QUrl &url : dialog.sidebarUrls()) {
|
||||||
FilePath path = qUrlToFilePath(url);
|
FilePath path = qUrlToFilePath(url);
|
||||||
if (!path.needsDevice() || path.exists())
|
if (isValidSideBarPath(path))
|
||||||
sideBarPaths.append(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()) {
|
for (const FilePath &path : FSEngine::registeredDeviceRoots()) {
|
||||||
if (!sideBarPaths.contains(path) && path.exists())
|
if (!sideBarPaths.contains(path) && isValidSideBarPath(path))
|
||||||
sideBarPaths.append(path);
|
sideBarPaths.append(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ bool FSEngineImpl::open(QIODevice::OpenMode openMode)
|
|||||||
createCacheData);
|
createCacheData);
|
||||||
bool exists = (data.filePathInfo.fileFlags & QAbstractFileEngine::ExistsFlag);
|
bool exists = (data.filePathInfo.fileFlags & QAbstractFileEngine::ExistsFlag);
|
||||||
|
|
||||||
|
if (data.filePathInfo.fileFlags & QAbstractFileEngine::DirectoryType)
|
||||||
|
return false;
|
||||||
|
|
||||||
g_filePathInfoCache.invalidate(m_filePath);
|
g_filePathInfoCache.invalidate(m_filePath);
|
||||||
|
|
||||||
ensureStorage();
|
ensureStorage();
|
||||||
|
|||||||
Submodule src/shared/qbs updated: 106316f632...03b0537a79
@@ -374,24 +374,38 @@ def addBranchWildcardToRoot(rootNode):
|
|||||||
return rootNode[:pos] + " [[]*[]]" + rootNode[pos:]
|
return rootNode[:pos] + " [[]*[]]" + rootNode[pos:]
|
||||||
|
|
||||||
def openDocument(treeElement):
|
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:
|
try:
|
||||||
|
parentIndex = None
|
||||||
selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Projects")
|
selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Projects")
|
||||||
navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView")
|
navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView")
|
||||||
try:
|
|
||||||
item = waitForObjectItem(navigator, treeElement, 3000)
|
for i, t in enumerate(treePathElements):
|
||||||
except:
|
indices = dumpIndices(navigator.model(), parentIndex)
|
||||||
treeElement = addBranchWildcardToRoot(treeElement)
|
foundT = False
|
||||||
item = waitForObjectItem(navigator, treeElement)
|
for index in indices:
|
||||||
expected = str(item.text).split("/")[-1]
|
iText = str(index.text)
|
||||||
for _ in range(2):
|
if (iText == t
|
||||||
# Expands items as needed what might make scrollbars appear.
|
or (i == 0 and re.match(t + " [[].+[]]", iText) is not None)):
|
||||||
# These might cover the item to click.
|
foundT = True
|
||||||
# In this case, do it again to hit the item then.
|
parentIndex = index
|
||||||
doubleClickItem(navigator, treeElement, 5, 5, 0, Qt.LeftButton)
|
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")
|
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
|
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
|
return False
|
||||||
except:
|
except:
|
||||||
t,v = sys.exc_info()[:2]
|
t,v = sys.exc_info()[:2]
|
||||||
|
|||||||
Reference in New Issue
Block a user