Files
Local-Cursor/internal/app/quit_dialog.go
FuDie0915 db73cf5a39 chore: import Local-Cursor v1.1.8 source snapshot
Includes the current working directory changes. Historical commits and release binaries are excluded to limit Gitea storage.
Source base: d7515973fbfd6dd2001fa156c483455b8081c7cb
2026-11-10 01:24:28 +08:00

26 lines
979 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 退出联动确认对话框:Cursor 未退出时询问用户是否同步关闭。
package app
import (
"github.com/wailsapp/wails/v3/pkg/application"
)
// showQuitConfirmDialog 显示确认对话框,返回用户是否确认退出并关闭 Cursor。
// 注意:Wails Windows 实现按 MessageBox 返回值(Yes/No)匹配按钮标签,
// 因此按钮标签必须使用 "Yes"/"No" 才能触发回调。
func showQuitConfirmDialog(app *application.App) bool {
confirmed := false
dialog := app.Dialog.Question()
dialog.SetTitle("退出 Local-Cursor")
dialog.SetMessage("检测到 Cursor 正在运行。\n退出 Local-Cursor 将同步关闭所有 Cursor 进程,是否确定?")
yesButton := dialog.AddButton("Yes").OnClick(func() {
confirmed = true
})
yesButton.SetAsDefault()
noButton := dialog.AddButton("No")
noButton.SetAsCancel()
dialog.Show()
// Windows 实现中 MessageBox 为模态调用,Show() 返回时回调已执行。
return confirmed
}