diff --git a/src/app/connect/index.js b/src/app/connect/index.js index 063fbf59964..c8e2a84b432 100644 --- a/src/app/connect/index.js +++ b/src/app/connect/index.js @@ -274,8 +274,10 @@ var ConnectView = View.extend({ this.listenToAndRun(this, 'change:sshTunnelMethod', this.replaceSshTunnelMethodFields.bind(this)); - this.listenToAndRun(app, 'connect-window-focused', + // add event listener to focus event and also check on app launch + ipc.on('app:connect-window-focused', this.onConnectWindowFocused.bind(this)); + this.onConnectWindowFocused(); // always start in NEW_EMPTY state this.dispatch('new connection clicked'); @@ -288,7 +290,9 @@ var ConnectView = View.extend({ * a MongoDB URI was detected. */ autofillFromClipboard: function() { - this.connection = MongoDBConnection.from(this.clipboardText); + this.connection = Connection.from(this.clipboardText); + // don't use "Local" as favorite name, keep field empty + this.connection.name = ''; this.updateForm(); }, diff --git a/src/main/window-manager.js b/src/main/window-manager.js index 13386cfa0d1..73cdf1b13ae 100644 --- a/src/main/window-manager.js +++ b/src/main/window-manager.js @@ -161,6 +161,9 @@ function showConnectWindow() { debug('connect window closed.'); connectWindow = null; }); + connectWindow.on('focus', function() { + connectWindow.webContents.send('app:connect-window-focused'); + }); } function closeConnectWindow() {