diff --git a/src/main/system/system.ts b/src/main/system/system.ts index c8d160d..afb1cad 100644 --- a/src/main/system/system.ts +++ b/src/main/system/system.ts @@ -25,7 +25,7 @@ const useSystem = memo(() => { await powerOffByDbus(interactive) } - const showOpenDialog = ipcHandle(async (ev, options: OpenDialogOptions) => { + const openFile = ipcHandle(async (ev, options: OpenDialogOptions) => { const result = await dialog.showOpenDialog( BrowserWindow.fromWebContents(ev.sender) ?? raiseError(() => new ReferenceError('Invalid window')), options @@ -61,12 +61,12 @@ const useSystem = memo(() => { }) ipcMain.handle('system:powerOff', ipcProxy(powerOff)) - ipcMain.handle('system:showOpenDialog', showOpenDialog) + ipcMain.handle('system:openFile', openFile) ipcMain.handle('system:saveFile', saveFile) return { powerOff - } satisfies Omit + } satisfies Omit }) export default useSystem diff --git a/src/preload/api.d.ts b/src/preload/api.d.ts index f2faf82..c99f3df 100644 --- a/src/preload/api.d.ts +++ b/src/preload/api.d.ts @@ -159,7 +159,7 @@ export interface SystemApi { /** Powers off the system. */ readonly powerOff: (interactive?: boolean) => Promise /** Shows the open file dialog. */ - readonly showOpenDialog: (options: OpenDialogOptions) => Promise + readonly openFile: (options: OpenDialogOptions) => Promise /** Shows the save file dialog to save a file. */ readonly saveFile: (file: File, options: SaveDialogOptions) => Promise } diff --git a/src/preload/plugins/system.ts b/src/preload/plugins/system.ts index 0e8b72d..378e65e 100644 --- a/src/preload/plugins/system.ts +++ b/src/preload/plugins/system.ts @@ -10,9 +10,9 @@ type SaveFileMain = (file: FileData, options: SaveDialogOptions) => Promise { const ipc = useIpc() - const showOpenDialogMain: ShowOpenDialogMain = ipc.useInvoke('system:showOpenDialog') - async function showOpenDialog(options: OpenDialogOptions) { - const files = await showOpenDialogMain(options) + const openFileMain: ShowOpenDialogMain = ipc.useInvoke('system:openFile') + async function openFile(options: OpenDialogOptions) { + const files = await openFileMain(options) if (files == null) return null return files.map(({ path, buffer, type }) => new File([buffer], basename(path), { type })) @@ -31,7 +31,7 @@ const useSystemApi = () => { return { powerOff: ipc.useInvoke('system:powerOff'), - showOpenDialog, + openFile, saveFile } satisfies SystemApi } diff --git a/src/renderer/components/FileUploadDialog.vue b/src/renderer/components/FileUploadDialog.vue deleted file mode 100644 index a1c4589..0000000 --- a/src/renderer/components/FileUploadDialog.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - diff --git a/src/renderer/components/InputDialog.vue b/src/renderer/components/InputDialog.vue index 73de101..2656421 100644 --- a/src/renderer/components/InputDialog.vue +++ b/src/renderer/components/InputDialog.vue @@ -50,7 +50,7 @@ const { t } = useI18n() const confirmLabel = computed(() => props.confirmButton ?? t('common.confirm')) const cancelLabel = computed(() => props.cancelButton ?? t('common.cancel')) -const isVisible = useVModel(props, 'visible') +const isVisible = useVModel(props, 'visible', emit, { passive: true, defaultValue: false }) // HACK: Always use cancelChanges since updateValue will dismiss the dialog after updating the original. watch(isVisible, (value) => { @@ -129,7 +129,7 @@ const disableConfirm = computed(() => props.mandatory && !is.nonEmptyString(inne