feat: 添加"弹出文件管理器窗口"设置项

This commit is contained in:
Baobhan Sith
2025-05-13 08:47:42 +08:00
parent 83e3d8e043
commit e886d13ed3
10 changed files with 133 additions and 5 deletions
@@ -163,7 +163,6 @@ export function useSystemSettings() {
selectedLanguage.value = newVal;
}, { immediate: true });
return {
// Language
selectedLanguage,
@@ -18,6 +18,7 @@ export function useWorkspaceSettings() {
terminalScrollbackLimitNumber,
fileManagerShowDeleteConfirmationBoolean,
terminalEnableRightClickPasteBoolean, // NEW
showPopupFileManagerBoolean, // +++ Import the new getter +++
} = storeToRefs(settingsStore);
// --- Popup Editor ---
@@ -261,6 +262,30 @@ export function useWorkspaceSettings() {
}
};
// --- Popup File Manager ---
const showPopupFileManagerLocal = ref(true);
const showPopupFileManagerLoading = ref(false);
const showPopupFileManagerMessage = ref('');
const showPopupFileManagerSuccess = ref(false);
const handleUpdateShowPopupFileManager = async () => {
showPopupFileManagerLoading.value = true;
showPopupFileManagerMessage.value = '';
showPopupFileManagerSuccess.value = false;
try {
const valueToSave = showPopupFileManagerLocal.value ? 'true' : 'false';
await settingsStore.updateSetting('showPopupFileManager', valueToSave);
showPopupFileManagerMessage.value = t('settings.popupFileManager.success.saved');
showPopupFileManagerSuccess.value = true;
} catch (error: any) {
console.error('更新弹窗文件管理器设置失败:', error);
showPopupFileManagerMessage.value = error.message || t('settings.popupFileManager.error.saveFailed');
showPopupFileManagerSuccess.value = false;
} finally {
showPopupFileManagerLoading.value = false;
}
};
// Watchers to sync local state with store state
watch(showPopupFileEditorBoolean, (newValue) => { popupEditorEnabled.value = newValue; }, { immediate: true });
watch(shareFileEditorTabsBoolean, (newValue) => { shareTabsEnabled.value = newValue; }, { immediate: true });
@@ -272,6 +297,7 @@ export function useWorkspaceSettings() {
watch(terminalScrollbackLimitNumber, (newValue) => { terminalScrollbackLimitLocal.value = newValue; }, { immediate: true });
watch(fileManagerShowDeleteConfirmationBoolean, (newValue) => { fileManagerShowDeleteConfirmationLocal.value = newValue; }, { immediate: true });
watch(terminalEnableRightClickPasteBoolean, (newValue) => { terminalEnableRightClickPasteLocal.value = newValue; }, { immediate: true }); // NEW
watch(showPopupFileManagerBoolean, (newValue) => { showPopupFileManagerLocal.value = newValue; }, { immediate: true }); // +++ Watch for popup file manager +++
return {
@@ -334,5 +360,12 @@ export function useWorkspaceSettings() {
terminalEnableRightClickPasteMessage, // NEW
terminalEnableRightClickPasteSuccess, // NEW
handleUpdateTerminalRightClickPasteSetting, // NEW
// Popup File Manager
showPopupFileManagerLocal,
showPopupFileManagerLoading,
showPopupFileManagerMessage,
showPopupFileManagerSuccess,
handleUpdateShowPopupFileManager,
};
}
@@ -45,6 +45,7 @@ export type WorkspaceEventPayloads = {
// UI Interaction Events
'ui:openLayoutConfigurator': void;
// 'ui:toggleVirtualKeyboard': void; // 如果决定迁移 CommandInputBar 的这个事件
'fileManager:openModalRequest': { sessionId: string }; // 请求打开文件管理器模态框
// Suspended SSH Session Events
'suspendedSession:actionCompleted': void; // Emitted when a resume/remove action is completed