Open properties from context menu

This commit is contained in:
Mikei386
2026-06-23 09:02:19 +02:00
parent 16a195befa
commit dd011bbaa4
5 changed files with 21 additions and 5 deletions
+18 -2
View File
@@ -52,7 +52,6 @@ async function init() {
}
statusText.textContent = `${state.config.roots.length} Root, ${state.config.readOnly ? 'Read-only' : 'Schreibzugriff aktiv'} · ${APP_VERSION}`;
openExplorer(state.config.roots[0].path);
openProperties();
openQueue();
} catch (error) {
statusText.textContent = error.message;
@@ -82,7 +81,18 @@ function openExplorer(initialPath = state.config?.roots?.[0]?.path) {
return win;
}
function openProperties() {
function openProperties(entry = state.selectedEntry) {
if (entry) {
state.selectedEntry = entry;
}
const existing = state.windows.find((item) => item.kind === 'properties');
if (existing) {
focusWindow(existing);
render();
return existing;
}
return createWindow('Eigenschaften', 'properties', {
width: 420,
height: 320,
@@ -510,6 +520,11 @@ async function promptTransfer(win, entry, type) {
await createJob(type, entry.path, `${targetDir.replace(/\/$/, '')}/${entry.name}`, []);
}
function showPropertiesForEntry(win, entry) {
selectEntry(win, entry);
openProperties(entry);
}
function showContextMenu(event, win, entry) {
const rect = workspace.getBoundingClientRect();
state.contextMenu = {
@@ -535,6 +550,7 @@ function renderContextMenu() {
if (entry.type === 'directory') {
actions.push(['Öffnen', () => loadExplorer(win, entry.path)]);
}
actions.push(['Eigenschaften', () => showPropertiesForEntry(win, entry)]);
actions.push(['Umbenennen', () => renameEntry(win, entry)]);
actions.push(['Kopieren nach...', () => promptTransfer(win, entry, 'copy')]);
actions.push(['Verschieben nach...', () => promptTransfer(win, entry, 'move')]);