diff --git a/main.js b/main.js index cc64f60..d5857be 100644 --- a/main.js +++ b/main.js @@ -33,7 +33,7 @@ function createWindow () { } // Create the browser window. - mainWindow = new BrowserWindow(mainWindowOptions) + app.mainWindow = mainWindow = new BrowserWindow(mainWindowOptions) mainWindow.maximize(); // and load the index.html of the app. diff --git a/modules/menu-service.js b/modules/menu-service.js index 4e18122..ae51dd5 100644 --- a/modules/menu-service.js +++ b/modules/menu-service.js @@ -3,6 +3,7 @@ */ const {app, Menu, MenuItem, BrowserWindow} = require('electron') const settingsService = require(__dirname + '/../modules/settings-service') +const prompt = require('electron-prompt'); const menuService = {} @@ -31,6 +32,26 @@ menuService.createMenu = () => { settingsService.set('minimizeOnClose', converse.getMenuItemById('minimize-on-close').checked); } }, + { + label: 'Connection Manager...', + click: () => { + let currentValue = settingsService.get('connectionManager') || ''; + prompt({ + title: 'Connection manager' + , label: 'Connection manager URL:' + , value: currentValue + , resizable: true + , width: 620 + , height: 180 + }, app.mainWindow).then(function (newValue) { + if (newValue !== null && newValue !== currentValue) { + settingsService.set('connectionManager', newValue === '' ? null : newValue); + app.mainWindow.reload() + } + }).catch(function (ex) { + }); + } + }, { type: 'separator', }, diff --git a/package.json b/package.json index df26507..74f270b 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "electron-settings": "^4.0.2", "github-buttons": "^2.8.0", "keytar": "^7.3.0", - "open-iconic": "^1.1.1" + "open-iconic": "^1.1.1", + "electron-prompt": "^1.7.0" }, "build": { "appId": "com.denry.converse-desktop",