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
This commit is contained in:
25
internal/app/quit_dialog.go
Normal file
25
internal/app/quit_dialog.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// 退出联动确认对话框: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
|
||||
}
|
||||
Reference in New Issue
Block a user