Skip to content

Commit

Permalink
add delete confirmation box before delete
Browse files Browse the repository at this point in the history
  • Loading branch information
superoo7 authored and samlhuillier committed May 18, 2024
1 parent 6bd4133 commit e3ac430
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,19 @@ ipcMain.handle("show-context-menu-file-item", (event, file) => {
new MenuItem({
label: "Delete",
click: () => {
console.log(file.path);
event.sender.send("delete-file-listener", file.path);
return dialog
.showMessageBox({
type: "question",
title: "Delete File",
message: `Are you sure you want to delete "${file.name}"?`,
buttons: ["Yes", "No"],
})
.then((confirm) => {
if (confirm.response === 0) {
console.log(file.path);
event.sender.send("delete-file-listener", file.path);
}
});
},
})
);
Expand Down

0 comments on commit e3ac430

Please sign in to comment.