2
0

Toggle sendInfo through preferences & move user import/export.

This commit is contained in:
Maarten Billemont 2020-04-07 15:30:23 -04:00
parent a91e65f72f
commit b010432796
3 changed files with 81 additions and 51 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16096" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12118"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16096"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@ -12,11 +12,14 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="AMainMenu" systemMenu="main" id="29"/>
<menu title="AMainMenu" systemMenu="main" id="29">
<point key="canvasLocation" x="139" y="155"/>
</menu>
<customObject id="494" customClass="MPMacAppDelegate">
<connections>
<outlet property="createUserItem" destination="757" id="763"/>
<outlet property="deleteUserItem" destination="ZgZ-p2-463" id="smU-PF-mKA"/>
<outlet property="diagnosticsItem" destination="GSN-f0-q7s" id="kns-3O-fu0"/>
<outlet property="hidePasswordsItem" destination="9G7-17-PzY" id="qPX-VT-jVx"/>
<outlet property="lockItem" destination="720" id="726"/>
<outlet property="openAtLoginItem" destination="785" id="788"/>
@ -33,7 +36,7 @@
<items>
<menuItem title="Users" id="755">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Users" id="756">
<menu key="submenu" title="Users" autoenablesItems="NO" id="756">
<items>
<menuItem title="New User" enabled="NO" toolTip="Creating users is not yet supported. Please use the iOS app with iCloud enabled to create users and sites." id="757">
<modifierMask key="keyEquivalentModifierMask"/>
@ -47,6 +50,53 @@
<action selector="deleteUser:" target="494" id="eia-X5-QMc"/>
</connections>
</menuItem>
<menuItem title="Import User..." id="EFK-zt-EvJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="importSites:" target="494" id="CNv-4j-036"/>
</connections>
</menuItem>
<menuItem title="Export User" id="r1P-hr-mh5">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Export User" id="fnk-gK-yCi">
<items>
<menuItem title="Secure Export (recommended)" id="06i-og-eLt">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="exportSitesSecure:" target="494" id="LVH-es-imA"/>
</connections>
</menuItem>
<menuItem title="Your passwords are hidden." enabled="NO" id="ybY-P3-eao">
<attributedString key="attributedTitle">
<fragment content="Your passwords are not visible.">
<attributes>
<font key="NSFont" metaFont="user"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Reveal Passwords" id="fMG-TT-bTn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="exportSitesReveal:" target="494" id="1IW-VT-Oeu"/>
</connections>
</menuItem>
<menuItem title="Handy for backups - keep it in a safe location!" enabled="NO" id="cQu-oR-SUa">
<attributedString key="attributedTitle">
<fragment content="Keep this file secure or delete it when you're done with it!">
<attributes>
<font key="NSFont" metaFont="user"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="759"/>
</items>
</menu>
@ -152,53 +202,23 @@
</attributedString>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Export Sites" id="r1P-hr-mh5">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Export Sites" id="fnk-gK-yCi">
<items>
<menuItem title="Secure Export" id="06i-og-eLt">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="exportSitesSecure:" target="494" id="LVH-es-imA"/>
</connections>
</menuItem>
<menuItem title="Your passwords are not visible." enabled="NO" id="ybY-P3-eao">
<attributedString key="attributedTitle">
<fragment content="Your passwords are not visible.">
<attributes>
<font key="NSFont" size="12" name="Helvetica"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Reveal Passwords" id="fMG-TT-bTn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="exportSitesReveal:" target="494" id="1IW-VT-Oeu"/>
</connections>
</menuItem>
<menuItem title="Keep this file secure or delete it when you're done with it!" enabled="NO" id="cQu-oR-SUa">
<attributedString key="attributedTitle">
<fragment content="Keep this file secure or delete it when you're done with it!">
<attributes>
<font key="NSFont" size="12" name="Helvetica"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Import Sites..." id="EFK-zt-EvJ">
<menuItem title="Diagnostics" id="GSN-f0-q7s">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="importSites:" target="494" id="CNv-4j-036"/>
<action selector="togglePreference:" target="494" id="ZNq-yf-fxg"/>
</connections>
</menuItem>
<menuItem title="Crash and usage information is anonymized and sent to development." enabled="NO" id="WfD-lX-C93">
<attributedString key="attributedTitle">
<fragment content="Save the password in your keychain so you don't need to enter it again.">
<attributes>
<font key="NSFont" size="11" name="Helvetica"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" firstLineHeadIndent="8"/>
</attributes>
</fragment>
</attributedString>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
@ -221,6 +241,7 @@
</connections>
</menuItem>
</items>
<point key="canvasLocation" x="140" y="23"/>
</menu>
</objects>
</document>

View File

@ -34,6 +34,7 @@
@property(nonatomic, weak) IBOutlet NSMenuItem *openAtLoginItem;
@property(nonatomic, weak) IBOutlet NSMenuItem *showFullScreenItem;
@property(nonatomic, weak) IBOutlet NSMenuItem *savePasswordItem;
@property(nonatomic, weak) IBOutlet NSMenuItem *diagnosticsItem;
@property(nonatomic, weak) IBOutlet NSMenuItem *createUserItem;
@property(nonatomic, weak) IBOutlet NSMenuItem *deleteUserItem;
@property(nonatomic, weak) IBOutlet NSMenuItem *usersItem;

View File

@ -29,6 +29,7 @@
#define LOGIN_HELPER_BUNDLE_ID @"com.lyndir.lhunath.MasterPassword.Mac.LoginHelper"
@implementation MPMacAppDelegate
#pragma clang diagnostic push
@ -372,6 +373,8 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
- (IBAction)togglePreference:(id)sender {
if (sender == self.diagnosticsItem)
[MPConfig get].sendInfo = @(self.diagnosticsItem.state != NSOnState);
if (sender == self.hidePasswordsItem)
[MPConfig get].hidePasswords = @(self.hidePasswordsItem.state != NSOnState);
if (sender == self.rememberPasswordItem)
@ -582,10 +585,13 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
- (void)updateUsers {
[[[self.usersItem submenu] itemArray] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if (idx > 2)
[[self.usersItem submenu] removeItem:obj];
}];
BOOL foundSeparator = NO;
for (NSMenuItem *item in [[self.usersItem submenu] itemArray]) {
if (foundSeparator)
[[self.usersItem submenu] removeItem:item];
else if (item.isSeparatorItem)
foundSeparator = YES;
}
NSManagedObjectContext *mainContext = [MPMacAppDelegate managedObjectContextForMainThreadIfReady];
if (!mainContext) {
@ -715,6 +721,8 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
- (void)updateConfigKey:(NSString *)key {
PearlMainQueue( ^{
if (!key || [key isEqualToString:NSStringFromSelector( @selector( sendInfo ) )])
self.diagnosticsItem.state = [[MPConfig get].sendInfo boolValue]? NSOnState: NSOffState;
if (!key || [key isEqualToString:NSStringFromSelector( @selector( hidePasswords ) )])
self.hidePasswordsItem.state = [[MPConfig get].hidePasswords boolValue]? NSOnState: NSOffState;
if (!key || [key isEqualToString:NSStringFromSelector( @selector( rememberLogin ) )])