@@ -8,10 +8,9 @@ import PageService from '@/service/PageService';
88import PreferencesService from '@/service/PreferencesService' ;
99import TrayService from '@/service/TrayService' ;
1010import ViewService from '@/service/ViewService' ;
11- import Dialog , { DialogOptions } from '@/util/modal/Dialog' ;
1211import QuickMenuModal , { QuickMenuItem } from '@/util/modal/QuickMenuModal' ;
1312import SearchEngine from '@ecromaneli/search-engine' ;
14- import { app , BrowserWindow , clipboard , Menu , MenuItemConstructorOptions , shell } from 'electron' ;
13+ import { app , clipboard , Menu , MenuItemConstructorOptions , shell } from 'electron' ;
1514
1615type MenuItem = MenuItemConstructorOptions & { submenu : MenuItemConstructorOptions [ ] } ;
1716
@@ -115,19 +114,7 @@ class MenuService {
115114 windowMenuItems . push ( { label : s . preferences , click : ( ) => PreferencesService . open ( ) } ) ;
116115
117116 menuItems . push ( ...windowMenuItems ) ;
118- menuItems . push ( {
119- label : s . exit , click : ( ) => {
120- const d = AppState . strings . exitDialog ;
121- this . showConfirmationDialog ( {
122- title : d . title ,
123- message : d . message ,
124- confirmBtn : d . confirm ,
125- cancelBtn : AppState . strings . dialog . cancel ,
126- parent : null ,
127- confirmAction : ( ) => app . quit ( ) ,
128- } ) ;
129- } ,
130- } ) ;
117+ menuItems . push ( { label : s . exit , click : ( ) => app . quit ( ) } ) ;
131118
132119 if ( currentPageSubmenu ) {
133120 AppState . viewContextMenu = [
@@ -186,37 +173,6 @@ class MenuService {
186173 }
187174 }
188175
189- private async showConfirmationDialog (
190- data : DialogOptions & {
191- parent : BrowserWindow | null ,
192- confirmBtn ?: string ,
193- cancelBtn ?: string ,
194- confirmAction ?: ( ) => void ,
195- cancelAction ?: ( ) => void ,
196- } ,
197- ) : Promise < void > {
198- const d = AppState . strings . dialog ;
199- const result = await Dialog . show (
200- data . parent ?? null ,
201- {
202- type : data . type || 'question' ,
203- title : data . title || d . confirmation ,
204- message : data . message || d . areYouSure ,
205- buttons : [ data . confirmBtn ?? d . ok , data . cancelBtn ?? d . cancel ] ,
206- defaultId : 1 ,
207- cancelId : 1 ,
208- } ,
209- ) ;
210-
211- setTimeout ( ( ) => {
212- if ( result . response === 0 ) {
213- data . confirmAction && data . confirmAction ( ) ;
214- } else {
215- data . cancelAction && data . cancelAction ( ) ;
216- }
217- } ) ;
218- }
219-
220176 private createPageSubmenu ( page : Page ) : MenuItemConstructorOptions [ ] {
221177 const view = page . view ! ;
222178 const wc = view . webContents ;
0 commit comments