This commit is contained in:
Tim Bendt
2025-05-09 08:36:05 -06:00
parent fbb9f875e6
commit e465825f16

View File

@@ -43,6 +43,8 @@ class OneDriveTUI(App):
Binding("q", "quit", "Quit"), Binding("q", "quit", "Quit"),
Binding("r", "refresh", "Refresh"), Binding("r", "refresh", "Refresh"),
Binding("f", "toggle_follow", "Toggle Follow"), Binding("f", "toggle_follow", "Toggle Follow"),
Binding("o", "open_url", "Open URL"),
] ]
def __init__(self): def __init__(self):
@@ -375,6 +377,18 @@ class OneDriveTUI(App):
# Currently just a placeholder for the key binding # Currently just a placeholder for the key binding
self.notify("Toggle follow functionality not implemented yet") self.notify("Toggle follow functionality not implemented yet")
async def action_open_url(self) -> None:
"""Open the web URL of the selected item."""
table = self.query_one("#items_table")
if table.cursor_row is not None:
selected_row = table.get_row_at(table.cursor_row)
if selected_row and len(selected_row) > 4:
web_url = selected_row[4]
if web_url:
self.notify(f"Opening URL: {web_url}")
# Use Textual's built-in open_url method instead of os.system
self.app.open_url(web_url)
async def action_quit(self) -> None: async def action_quit(self) -> None:
"""Quit the application.""" """Quit the application."""
self.exit() self.exit()