Update breadcrumbs when root directory changes.

This commit is contained in:
2026-02-01 18:23:44 -05:00
parent a5bed9ed2c
commit 4cc43916cb
3 changed files with 35 additions and 39 deletions

View File

@@ -68,7 +68,12 @@ SplitView {
height: navigationView.height
// Path to the directory opened in the file explorer.
originalRootDirectory: root.projectDir
rootDirectory: root.projectDir
onRootDirectoryChanged: {
console.log(clideTreeView.rootDirectory)
breadCrumb.text = clideTreeView.rootDirectory
}
}
}
}

View File

@@ -14,25 +14,21 @@ TreeView {
property int lastIndex: -1
required property string rootDirectory
required property string originalRootDirectory
property string rootDirectory
signal fileClicked(string filePath)
rootIndex: FileSystem.rootIndex
rootIndex: FileSystem.setDirectory(fileSystemTreeView.rootDirectory)
leftMargin: 5
boundsBehavior: Flickable.StopAtBounds
boundsMovement: Flickable.StopAtBounds
clip: true
Component.onCompleted: {
FileSystem.rootIndex = FileSystem.setDirectory(fileSystemTreeView.rootDirectory)
}
// The delegate represents a single entry in the filesystem.
delegate: TreeViewDelegate {
id: treeDelegate
indentation: 6
indentation: 8
implicitWidth: fileSystemTreeView.width > 0 ? fileSystemTreeView.width : 250
implicitHeight: 25
@@ -125,8 +121,7 @@ TreeView {
fileSystemTreeView.fileClicked(treeDelegate.filePath)
break;
case Qt.RightButton:
if (treeDelegate.hasChildren)
contextMenu.popup();
contextMenu.popup();
break;
}
}
@@ -136,16 +131,17 @@ TreeView {
id: contextMenu
Action {
text: qsTr("Set as root index")
enabled: treeDelegate.hasChildren
onTriggered: {
console.log("Setting directory: " + treeDelegate.filePath)
FileSystem.rootIndex = FileSystem.setDirectory(treeDelegate.filePath)
console.log("Setting new root directory: " + treeDelegate.filePath)
fileSystemTreeView.rootDirectory = treeDelegate.filePath
}
}
Action {
text: qsTr("Reset root index")
onTriggered: {
console.log("Reset root index")
FileSystem.rootIndex = FileSystem.setDirectory(fileSystemTreeView.rootDirectory)
console.log("Resetting root directory: " + fileSystemTreeView.originalRootDirectory)
fileSystemTreeView.rootDirectory = fileSystemTreeView.originalRootDirectory
}
}
}