Skip to content

Commit 5057612

Browse files
committed
Fix manual path entry in file dialog not working (#2352)
When users type a path in the file dialog path bar and click Add without selecting anything in the tree, the path bar text is now used as the selection. Previously, the path bar only navigated the tree view and users had to click items in the tree to select them.
1 parent 95e0cd2 commit 5057612

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/vorta/filedialog.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ def __init__(self, parent=None, window_title='Vorta File Dialog', title='Select
9292
def selected_paths(self):
9393
indexes = self.tree.selectionModel().selectedIndexes()
9494
paths = []
95+
96+
# If no tree selection, use the path bar text as the selection
97+
if not indexes:
98+
path = self.path_bar.text()
99+
if path and os.path.exists(path):
100+
if not os.access(path, os.R_OK):
101+
msg = QMessageBox()
102+
msg.setIcon(QMessageBox.Icon.Warning)
103+
msg.setWindowTitle(self.tr("Permission Denied"))
104+
msg.setText(self.tr(f"You don't have read access to {path}."))
105+
msg.exec()
106+
return []
107+
return [path]
108+
return []
109+
95110
for index in indexes:
96111
if index.column() == 0:
97112
path = self.model.filePath(index)

0 commit comments

Comments
 (0)