diff --git a/MacPass/Base.lproj/WorkflowPreferences.xib b/MacPass/Base.lproj/WorkflowPreferences.xib index 76c1ef40..f8cfc1d5 100644 --- a/MacPass/Base.lproj/WorkflowPreferences.xib +++ b/MacPass/Base.lproj/WorkflowPreferences.xib @@ -1,8 +1,8 @@ - + - + @@ -173,7 +173,7 @@ - + diff --git a/MacPass/MPAutotypeCandidateSelectionViewController.m b/MacPass/MPAutotypeCandidateSelectionViewController.m index 34d186d0..2c7b96a0 100644 --- a/MacPass/MPAutotypeCandidateSelectionViewController.m +++ b/MacPass/MPAutotypeCandidateSelectionViewController.m @@ -34,7 +34,6 @@ @property (strong) IBOutlet NSTableView *contextTableView; @property (strong) IBOutlet NSTextField *messageTextField; @property (strong) IBOutlet NSImageView *targetApplicationImageView; - @end @implementation MPAutotypeCandidateSelectionViewController @@ -45,13 +44,24 @@ - (void)viewDidLoad { [super viewDidLoad]; - NSString *template = NSLocalizedString(@"AUTOTYPE_CANDIDATE_SELECTION_WINDOW_MESSAGE_%@", "Message text in the autotype selection window. Placeholder is %1 - windowTitle"); - self.messageTextField.stringValue = [NSString stringWithFormat:template, self.environment.windowTitle]; + self.selectAutotypeContextButton.enabled = NO; + NSRunningApplication *targetApplication = [NSRunningApplication runningApplicationWithProcessIdentifier:self.environment.pid]; if(nil != targetApplication) { self.targetApplicationImageView.image = targetApplication.icon; } + + NSString *template = @""; + if(self.candidates.count > 1) { + template = NSLocalizedString(@"AUTOTYPE_CANDIDATE_SELECTION_WINDOW_MESSAGE_%@_%@", "Message text in the autotype selection window. Placeholder is %1 - applicationName, %2 windowTitle"); + self.messageTextField.stringValue = [NSString stringWithFormat:template, targetApplication.localizedName, self.environment.windowTitle]; + } + else { + template = NSLocalizedString(@"AUTOTYPE_CANDIDATE_CONFIRMATION_WINDOW_MESSAGE_%@_%@", "Message text in the autotype confirmation window. Placeholder is %1 - applicationName, %2 windowTitle"); + self.messageTextField.stringValue = [NSString stringWithFormat:template, targetApplication.localizedName, self.environment.windowTitle]; + } + NSNotification *notification = [NSNotification notificationWithName:NSTableViewSelectionDidChangeNotification object:self.contextTableView]; [self tableViewSelectionDidChange:notification]; } @@ -96,5 +106,4 @@ [MPAutotypeDaemon.defaultDaemon cancelAutotypeContextSelectionForEnvironment:self.environment]; } - @end diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m index 0fbce36c..367e3810 100644 --- a/MacPass/MPAutotypeDaemon.m +++ b/MacPass/MPAutotypeDaemon.m @@ -289,10 +289,15 @@ static MPAutotypeDaemon *_sharedInstance; [autotypeCandidates addObjectsFromArray:contexts]; } } + + BOOL isGlobalAutotype = (environment.preferredEntry == nil); + BOOL alwaysShowCandidateSelection = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection]; - if(autotypeCandidates.count <= 1) { - return autotypeCandidates.lastObject; + /* if we have only one candidate and do not need to show the windows, return only the last candiadate */ + if(autotypeCandidates.count <= 1 && !(isGlobalAutotype && alwaysShowCandidateSelection)) { + return autotypeCandidates.lastObject; } + /* otherwise show the candidate selection window */ [self _presentCandiadates:autotypeCandidates forEnvironment:environment]; return nil; // Nothing to do, we get called back by the window } diff --git a/MacPass/MPSettingsHelper.h b/MacPass/MPSettingsHelper.h index 05baf6e1..c898b8c3 100644 --- a/MacPass/MPSettingsHelper.h +++ b/MacPass/MPSettingsHelper.h @@ -69,7 +69,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchTitle; // APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchURL; // Autotype lookup includes entry URL APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchHost; // Autotype lookup includes host part of entry URL APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchTags; // Autotype lookup includes tags for entries -APPKIT_EXTERN NSString *const kMPSettingsKeyAutotpyeHideMissingPermissionsWarning; +APPKIT_EXTERN NSString *const kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection; // If YES, will always display then candidate selection window befor perfoming an Autotype /* Search */ APPKIT_EXTERN NSString *const kMPSettingsKeyEntrySearchFilterContext; diff --git a/MacPass/MPSettingsHelper.m b/MacPass/MPSettingsHelper.m index e9e0c920..3402811b 100644 --- a/MacPass/MPSettingsHelper.m +++ b/MacPass/MPSettingsHelper.m @@ -26,68 +26,68 @@ #import "MPEntrySearchContext.h" #import "DDHotKey+MacPassAdditions.h" // Default hotkey; -NSString *const kMPSettingsKeyPasteboardClearTimeout = @"ClipboardClearTimeout"; -NSString *const kMPSettingsKeyClearPasteboardOnQuit = @"ClearClipboardOnQuit"; -NSString *const kMPSettingsKeyPreventUniversalClipboard = @"PreventUniversalClipboard"; -NSString *const kMPSettingsKeyBrowserBundleId = @"BrowserBundleId"; -NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch"; -NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch = @"ReopenLastDatabaseOnLaunch"; -NSString *const kMPSettingsKeyQuitOnLastWindowClose = @"QuitOnLastWindowClose"; -NSString *const kMPSettingsKeyFileChangeStrategy = @"FileChangeStrategy"; -NSString *const kMPSettingsKeyEnableAutosave = @"EnableAutosave"; -NSString *const kMPSettingsKeyLockOnSleep = @"LockOnSleep"; -NSString *const kMPSettingskeyLockOnLogout = @"LockOnLogout"; -NSString *const kMPSettingskeyLockOnScreenSleep = @"LockOnScreenSleep"; -NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut"; -NSString *const kMPSettingsKeyShowInspector = @"ShowInspector"; -NSString *const kMPSettingsKeyEntryTableSortDescriptors = @"EntryTableSortDescriptors"; +NSString *const kMPSettingsKeyPasteboardClearTimeout = @"ClipboardClearTimeout"; +NSString *const kMPSettingsKeyClearPasteboardOnQuit = @"ClearClipboardOnQuit"; +NSString *const kMPSettingsKeyPreventUniversalClipboard = @"PreventUniversalClipboard"; +NSString *const kMPSettingsKeyBrowserBundleId = @"BrowserBundleId"; +NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch"; +NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch = @"ReopenLastDatabaseOnLaunch"; +NSString *const kMPSettingsKeyQuitOnLastWindowClose = @"QuitOnLastWindowClose"; +NSString *const kMPSettingsKeyFileChangeStrategy = @"FileChangeStrategy"; +NSString *const kMPSettingsKeyEnableAutosave = @"EnableAutosave"; +NSString *const kMPSettingsKeyLockOnSleep = @"LockOnSleep"; +NSString *const kMPSettingskeyLockOnLogout = @"LockOnLogout"; +NSString *const kMPSettingskeyLockOnScreenSleep = @"LockOnScreenSleep"; +NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut"; +NSString *const kMPSettingsKeyShowInspector = @"ShowInspector"; +NSString *const kMPSettingsKeyEntryTableSortDescriptors = @"EntryTableSortDescriptors"; + +NSString *const kMPSettingsKeyLegacyHideTitle = @"LegacyHideTitle"; +NSString *const kMPSettingsKeyLegacyHideUsername = @"LegacyHideUsername "; +NSString *const kMPSettingsKeyLegacyHidePassword = @"LegacyHidePassword"; +NSString *const kMPSettingsKeyLegacyHideNotes = @"LegacyHideNotes"; +NSString *const kMPSettingsKeyLegacyHideURL = @"LegacyHideURL"; -NSString *const kMPSettingsKeyLegacyHideTitle = @"LegacyHideTitle"; -NSString *const kMPSettingsKeyLegacyHideUsername = @"LegacyHideUsername "; -NSString *const kMPSettingsKeyLegacyHidePassword = @"LegacyHidePassword"; -NSString *const kMPSettingsKeyLegacyHideNotes = @"LegacyHideNotes"; -NSString *const kMPSettingsKeyLegacyHideURL = @"LegacyHideURL"; +NSString *const kMPSettingsKeyLastDatabasePath = @"LastDatabasePath"; +NSString *const kMPSettingsKeyRememberKeyFilesForDatabases = @"RememberKeyFilesForDatabases"; +NSString *const kMPSettingsKeyRememeberdKeysForDatabases = @"RememeberdKeysForDatabases"; -NSString *const kMPSettingsKeyLastDatabasePath = @"LastDatabasePath"; -NSString *const kMPSettingsKeyRememberKeyFilesForDatabases = @"RememberKeyFilesForDatabases"; -NSString *const kMPSettingsKeyRememeberdKeysForDatabases = @"RememeberdKeysForDatabases"; +NSString *const kMPSettingsKeySendCommandForControlKey = @"SendCommandKeyForControlKey"; +NSString *const kMPSettingsKeyEnableGlobalAutotype = @"EnableGlobalAutotype"; +NSString *const kMPSettingsKeyGlobalAutotypeKeyDataKey = @"GlobalAutotypeKeyDataKey"; +NSString *const kMPSettingsKeyDefaultGlobalAutotypeSequence = @"DefaultGlobalAutotypeSequence"; +NSString *const kMPSettingsKeyAutotypeMatchTitle = @"AutotypeMatchTitle"; +NSString *const kMPSettingsKeyAutotypeMatchURL = @"AutotypeMatchURL"; +NSString *const kMPSettingsKeyAutotypeMatchHost = @"AutotypeMatchHost"; +NSString *const kMPSettingsKeyAutotypeMatchTags = @"AutotypeMatchTags"; +NSString *const kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection = @"GloablAutotypeAlwaysShowCandidateSelection"; -NSString *const kMPSettingsKeySendCommandForControlKey = @"SendCommandKeyForControlKey"; -NSString *const kMPSettingsKeyEnableGlobalAutotype = @"EnableGlobalAutotype"; -NSString *const kMPSettingsKeyGlobalAutotypeKeyDataKey = @"GlobalAutotypeKeyDataKey"; -NSString *const kMPSettingsKeyDefaultGlobalAutotypeSequence = @"DefaultGlobalAutotypeSequence"; -NSString *const kMPSettingsKeyAutotypeMatchTitle = @"AutotypeMatchTitle"; -NSString *const kMPSettingsKeyAutotypeMatchURL = @"AutotypeMatchURL"; -NSString *const kMPSettingsKeyAutotypeMatchHost = @"AutotypeMatchHost"; -NSString *const kMPSettingsKeyAutotypeMatchTags = @"AutotypeMatchTags"; -NSString *const kMPSettingsKeyAutotpyeHideMissingPermissionsWarning = @"AutotpyeHideMissingPermissionsWarning"; +NSString *const kMPSettingsKeyEntrySearchFilterContext = @"EntrySearchFilterContext"; -NSString *const kMPSettingsKeyEntrySearchFilterContext = @"EntrySearchFilterContext"; +NSString *const kMPSettingsKeyEnableQuicklookPreview = @"EnableQuicklookPreview"; -NSString *const kMPSettingsKeyEnableQuicklookPreview = @"EnableQuicklookPreview"; +NSString *const kMPSettingsKeyCopyGeneratedPasswordToClipboard = @"CopyGeneratedPasswordToClipboard"; -NSString *const kMPSettingsKeyCopyGeneratedPasswordToClipboard = @"CopyGeneratedPasswordToClipboard"; +NSString *const kMPSettingsKeyDefaultPasswordLength = @"DefaultPasswordLength"; +NSString *const kMPSettingsKeyPasswordCharacterFlags = @"PasswordCharacterFlags"; +NSString *const kMPSettingsKeyPasswordEnsureOccurance = @"PasswordEnsureOccurance"; +NSString *const kMPSettingsKeyPasswordUseCustomString = @"PasswordUseCustomString"; +NSString *const kMPSettingsKeyPasswordCustomString = @"PasswordCustomString"; -NSString *const kMPSettingsKeyDefaultPasswordLength = @"DefaultPasswordLength"; -NSString *const kMPSettingsKeyPasswordCharacterFlags = @"PasswordCharacterFlags"; -NSString *const kMPSettingsKeyPasswordEnsureOccurance = @"PasswordEnsureOccurance"; -NSString *const kMPSettingsKeyPasswordUseCustomString = @"PasswordUseCustomString"; -NSString *const kMPSettingsKeyPasswordCustomString = @"PasswordCustomString"; +NSString *const kMPSettingsKeyPasswordDefaultsForEntry = @"PasswordDefaultsForEntry"; -NSString *const kMPSettingsKeyPasswordDefaultsForEntry = @"PasswordDefaultsForEntry"; +NSString *const kMPSettingsKeyDoubleClickURLAction = @"DoubleClickURLAction"; +NSString *const kMPSettingsKeyDoubleClickTitleAction = @"DoubleClickTitleAction"; +NSString *const kMPSettingsKeyUpdatePasswordOnTemplateEntries = @"UpdatePasswordOnTemplateEntries"; +NSString *const kMPSettingsKeyHideAfterCopyToClipboard = @"HideAfterCopyToClipboard"; -NSString *const kMPSettingsKeyDoubleClickURLAction = @"DoubleClickURLAction"; -NSString *const kMPSettingsKeyDoubleClickTitleAction = @"DoubleClickTitleAction"; -NSString *const kMPSettingsKeyUpdatePasswordOnTemplateEntries = @"UpdatePasswordOnTemplateEntries"; -NSString *const kMPSettingsKeyHideAfterCopyToClipboard = @"HideAfterCopyToClipboard"; +NSString *const kMPSettingsKeyLoadUnsecurePlugins = @"LoadUnsecurePlugins"; +NSString *const kMPSettingsKeyLoadIncompatiblePlugins = @"LoadIncompatiblePlugins"; +NSString *const kMPSettingsKeyDisabledPlugins = @"DisabledPlugins"; +NSString *const kMPSettingsKeyHideIncopatiblePluginsWarning = @"HideIncopatiblePluginsWarning"; +NSString *const kMPSettingsKeyAllowRemoteFetchOfPluginRepository = @"AllowRemoteFetchOfPluginRepository"; -NSString *const kMPSettingsKeyLoadUnsecurePlugins = @"LoadUnsecurePlugins"; -NSString *const kMPSettingsKeyLoadIncompatiblePlugins = @"LoadIncompatiblePlugins"; -NSString *const kMPSettingsKeyDisabledPlugins = @"DisabledPlugins"; -NSString *const kMPSettingsKeyHideIncopatiblePluginsWarning = @"HideIncopatiblePluginsWarning"; -NSString *const kMPSettingsKeyAllowRemoteFetchOfPluginRepository = @"AllowRemoteFetchOfPluginRepository"; - -NSString *const kMPSettingsKeyFaviconDownloadMethod = @"FaviconDownloadMethod"; +NSString *const kMPSettingsKeyFaviconDownloadMethod = @"FaviconDownloadMethod"; /* Deprecated */ NSString *const kMPDeprecatedSettingsKeyRememberKeyFilesForDatabases = @"kMPSettingsKeyRememberKeyFilesForDatabases"; @@ -167,7 +167,8 @@ NSString *const kMPDepricatedSettingsKeyAutotypeHideAccessibiltyWarning = @"Au kMPSettingsKeyQuitOnLastWindowClose: @NO, kMPSettingsKeyEnableAutosave: @YES, kMPSettingsKeyHideAfterCopyToClipboard: @NO, - kMPSettingsKeyFaviconDownloadMethod: @(MPFaviconDownloadMethodDirect) // Download directly from host + kMPSettingsKeyFaviconDownloadMethod: @(MPFaviconDownloadMethodDirect), // Download directly from host + kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection: @NO }; }); return standardDefaults;