2
0

Type selection for Mac.

[ADDED]     Mac: Type selection for site passwords.
[UPDATED]   Type changing refactored to be OS independant.
This commit is contained in:
Maarten Billemont 2013-06-15 01:39:24 -04:00
parent 08d3d9ad30
commit b2345da9f3
7 changed files with 421 additions and 122 deletions

View File

@ -27,6 +27,7 @@ typedef enum {
- (UbiquityStoreManager *)storeManager; - (UbiquityStoreManager *)storeManager;
- (void)addElementNamed:(NSString *)siteName completion:(void (^)(MPElementEntity *element))completion; - (void)addElementNamed:(NSString *)siteName completion:(void (^)(MPElementEntity *element))completion;
- (MPElementEntity *)changeElement:(MPElementEntity *)element inContext:(NSManagedObjectContext *)context toType:(MPElementType)type;
- (MPImportResult)importSites:(NSString *)importedSitesString - (MPImportResult)importSites:(NSString *)importedSitesString
askImportPassword:(NSString *(^)(NSString *userName))importPassword askImportPassword:(NSString *(^)(NSString *userName))importPassword
askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword; askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword;

View File

@ -426,6 +426,38 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
}]; }];
} }
- (MPElementEntity *)changeElement:(MPElementEntity *)element inContext:(NSManagedObjectContext *)context toType:(MPElementType)type {
if ([element.algorithm classOfType:type] == element.typeClass)
element.type = type;
else {
// Type requires a different class of element. Recreate the element.
MPElementEntity *newElement
= [NSEntityDescription insertNewObjectForEntityForName:[element.algorithm classNameOfType:type]
inManagedObjectContext:context];
newElement.type = type;
newElement.name = element.name;
newElement.user = element.user;
newElement.uses = element.uses;
newElement.lastUsed = element.lastUsed;
newElement.version = element.version;
newElement.loginName = element.loginName;
[context deleteObject:element];
[context saveToStore];
NSError *error;
if (![context obtainPermanentIDsForObjects:@[ newElement ] error:&error])
err(@"Failed to obtain a permanent object ID after changing object type: %@", error);
element = newElement;
}
[[NSNotificationCenter defaultCenter] postNotificationName:MPElementUpdatedNotification object:element.objectID];
return element;
}
- (MPImportResult)importSites:(NSString *)importedSitesString - (MPImportResult)importSites:(NSString *)importedSitesString
askImportPassword:(NSString *(^)(NSString *userName))importPassword askImportPassword:(NSString *(^)(NSString *userName))importPassword
askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword { askUserPassword:(NSString *(^)(NSString *userName, NSUInteger importCount, NSUInteger deleteCount))userPassword {

View File

@ -395,6 +395,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
otherButton:nil informativeTextWithFormat: otherButton:nil informativeTextWithFormat:
@"Begin by selecting or creating your user from the status menu (●●●|) next to the clock."] @"Begin by selecting or creating your user from the status menu (●●●|) next to the clock."]
runModal]; runModal];
[self.statusView popUpMenu];
return; return;
} }

View File

@ -8,15 +8,14 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@interface MPPasswordWindowController : NSWindowController<NSTextFieldDelegate> @interface MPPasswordWindowController : NSWindowController<NSTextFieldDelegate, NSComboBoxDelegate>
@property(nonatomic, weak) IBOutlet NSTextField *siteField; @property(nonatomic, weak) IBOutlet NSTextField *siteField;
@property(nonatomic, weak) IBOutlet NSTextField *contentField; @property(nonatomic, weak) IBOutlet NSTextField *contentField;
@property(nonatomic, weak) IBOutlet NSTextField *tipField; @property(nonatomic, weak) IBOutlet NSTextField *tipField;
@property(nonatomic, weak) IBOutlet NSComboBox *typeField;
@property(nonatomic, weak) IBOutlet NSView *contentContainer; @property(nonatomic, weak) IBOutlet NSView *contentContainer;
@property(nonatomic, weak) IBOutlet NSProgressIndicator *progressView; @property(nonatomic, weak) IBOutlet NSProgressIndicator *progressView;
@property(nonatomic, weak) IBOutlet NSTextField *userLabel; @property(nonatomic, weak) IBOutlet NSTextField *userLabel;
- (IBAction)reload:(id)sender;
@end @end

View File

@ -14,6 +14,7 @@
#define MPAlertUnlockMP @"MPAlertUnlockMP" #define MPAlertUnlockMP @"MPAlertUnlockMP"
#define MPAlertIncorrectMP @"MPAlertIncorrectMP" #define MPAlertIncorrectMP @"MPAlertIncorrectMP"
#define MPAlertCreateSite @"MPAlertCreateSite" #define MPAlertCreateSite @"MPAlertCreateSite"
#define MPAlertChangeType @"MPAlertChangeType"
@interface MPPasswordWindowController() @interface MPPasswordWindowController()
@ -74,6 +75,7 @@
addObserverForName:MPSignedOutNotification object:nil queue:nil usingBlock:^(NSNotification *note) { addObserverForName:MPSignedOutNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
_activeElementOID = nil; _activeElementOID = nil;
[self.siteField setStringValue:@""]; [self.siteField setStringValue:@""];
[self.typeField deselectItemAtIndex:[self.typeField indexOfSelectedItem]];
[self trySiteWithAction:NO]; [self trySiteWithAction:NO];
[self ensureLoadedAndUnlockedOrCloseIfLoggedOut:YES]; [self ensureLoadedAndUnlockedOrCloseIfLoggedOut:YES];
}]; }];
@ -155,6 +157,7 @@
self.content = @""; self.content = @"";
[self.siteField setStringValue:@""]; [self.siteField setStringValue:@""];
[self.typeField deselectItemAtIndex:[self.typeField indexOfSelectedItem]];
[self.tipField setStringValue:@""]; [self.tipField setStringValue:@""];
NSAlert *alert = [NSAlert alertWithMessageText:@"Master Password is locked." NSAlert *alert = [NSAlert alertWithMessageText:@"Master Password is locked."
@ -173,11 +176,6 @@
return unlocked; return unlocked;
} }
- (IBAction)reload:(id)sender {
[[MPMacAppDelegate get].storeManager reloadStore];
}
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
if (contextInfo == MPAlertIncorrectMP) { if (contextInfo == MPAlertIncorrectMP) {
@ -267,6 +265,68 @@
break; break;
} }
} }
if (contextInfo == MPAlertChangeType) {
switch (returnCode) {
case NSAlertDefaultReturn: {
MPElementType type = [self selectedType];
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
MPElementEntity *activeElement = [self activeElementInContext:context];
_activeElementOID = [[MPMacAppDelegate get] changeElement:activeElement inContext:context
toType:type].objectID;
[context saveToStore];
dispatch_async( dispatch_get_main_queue(), ^{
[self trySiteWithAction:NO];
} );
}];
break;
}
default:
break;
}
}
}
- (MPElementType)selectedType {
if (self.typeField.indexOfSelectedItem == 0)
return MPElementTypeGeneratedMaximum;
if (self.typeField.indexOfSelectedItem == 1)
return MPElementTypeGeneratedLong;
if (self.typeField.indexOfSelectedItem == 2)
return MPElementTypeGeneratedMedium;
if (self.typeField.indexOfSelectedItem == 3)
return MPElementTypeGeneratedBasic;
if (self.typeField.indexOfSelectedItem == 4)
return MPElementTypeGeneratedShort;
if (self.typeField.indexOfSelectedItem == 5)
return MPElementTypeGeneratedPIN;
if (self.typeField.indexOfSelectedItem == 6)
return MPElementTypeStoredPersonal;
if (self.typeField.indexOfSelectedItem == 7)
return MPElementTypeStoredDevicePrivate;
wrn(@"Unsupported type selected: %li, assuming Long.", self.typeField.indexOfSelectedItem);
return MPElementTypeGeneratedLong;
}
- (void)comboBoxSelectionDidChange:(NSNotification *)notification {
if (notification.object == self.typeField) {
if ([self.typeField indexOfSelectedItem] < 0)
return;
MPElementEntity *activeElement = [self activeElementForThread];
MPElementType selectedType = [self selectedType];
if (!activeElement || activeElement.type == selectedType || !(selectedType & MPElementTypeClassGenerated))
return;
[[NSAlert alertWithMessageText:@"Change Password Type" defaultButton:@"Change Password"
alternateButton:@"Cancel" otherButton:nil
informativeTextWithFormat:@"Changing the password type for this site will cause the password to change.\n"
@"You will need to update your account with the new password."]
beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:MPAlertChangeType];
}
} }
- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words - (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words
@ -291,7 +351,6 @@
_activeElementOID = ((NSManagedObject *)[siteResults objectAtIndex:0]).objectID; _activeElementOID = ((NSManagedObject *)[siteResults objectAtIndex:0]).objectID;
for (MPElementEntity *element in siteResults) for (MPElementEntity *element in siteResults)
[mutableResults addObject:element.name]; [mutableResults addObject:element.name];
//[mutableResults addObject:query]; // For when the app should be able to create new sites.
} }
else else
_activeElementOID = nil; _activeElementOID = nil;
@ -396,7 +455,9 @@
[self.progressView startAnimation:nil]; [self.progressView startAnimation:nil];
[self.backgroundQueue addOperationWithBlock:^{ [self.backgroundQueue addOperationWithBlock:^{
BOOL actionHandled = NO; BOOL actionHandled = NO;
NSString *content = [[self activeElementForThread].content description]; MPElementEntity *activeElement = [self activeElementForThread];
NSString *content = [activeElement.content description];
NSString *typeName = [activeElement typeShortName];
if (!content) if (!content)
content = @""; content = @"";
@ -415,6 +476,7 @@
[[NSOperationQueue mainQueue] addOperationWithBlock:^{ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self setContent:content]; [self setContent:content];
[self.progressView stopAnimation:nil]; [self.progressView stopAnimation:nil];
[self.typeField selectItemWithObjectValue:typeName];
self.tipField.alphaValue = 1; self.tipField.alphaValue = 1;
if (actionHandled) if (actionHandled)

View File

@ -12,6 +12,8 @@
</object> </object>
<array key="IBDocument.IntegratedClassDependencies"> <array key="IBDocument.IntegratedClassDependencies">
<string>IBNSLayoutConstraint</string> <string>IBNSLayoutConstraint</string>
<string>NSComboBox</string>
<string>NSComboBoxCell</string>
<string>NSCustomObject</string> <string>NSCustomObject</string>
<string>NSCustomView</string> <string>NSCustomView</string>
<string>NSProgressIndicator</string> <string>NSProgressIndicator</string>
@ -56,6 +58,141 @@
<reference key="NSNextResponder" ref="258451033"/> <reference key="NSNextResponder" ref="258451033"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews"> <array class="NSMutableArray" key="NSSubviews">
<object class="NSComboBox" id="599228032">
<reference key="NSNextResponder" ref="1072816887"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{288, 131}, {115, 26}}</string>
<reference key="NSSuperview" ref="1072816887"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="139778114"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSComboBoxCell" key="NSCell" id="412656964">
<int key="NSCellFlags">342884416</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="909078752">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSPlaceholderString"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="599228032"/>
<bool key="NSDrawsBackground">YES</bool>
<int key="NSTextBezelStyle">1</int>
<object class="NSColor" key="NSBackgroundColor" id="75022320">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
<object class="NSColor" key="NSColor" id="750216721">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="918660940">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor" id="714751679">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
<int key="NSVisibleItemCount">5</int>
<bool key="NSHasVerticalScroller">YES</bool>
<array class="NSMutableArray" key="NSPopUpListData">
<string>Maximum</string>
<string>Long</string>
<string>Medium</string>
<string>Basic</string>
<string>Short</string>
<string>PIN</string>
<string>Personal</string>
<string>Device</string>
</array>
<reference key="NSDelegate" ref="599228032"/>
<object class="NSComboTableView" key="NSTableView" id="847503045">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{13, 21}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:24</string>
<bool key="NSEnabled">YES</bool>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSControlAllowsExpansionToolTips">YES</bool>
<array class="NSMutableArray" key="NSTableColumns">
<object class="NSTableColumn">
<double key="NSWidth">10</double>
<double key="NSMinWidth">10</double>
<double key="NSMaxWidth">1000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
<int key="NSCellFlags">75497472</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">12</double>
<int key="NSfFlags">16</int>
</object>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
</object>
<reference key="NSTextColor" ref="750216721"/>
</object>
<object class="NSTextFieldCell" key="NSDataCell">
<int key="NSCellFlags">338690112</int>
<int key="NSCellFlags2">1024</int>
<reference key="NSSupport" ref="909078752"/>
<reference key="NSControlView" ref="847503045"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor" id="516674465">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlBackgroundColor</string>
<object class="NSColor" key="NSColor" id="131605477">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<reference key="NSTextColor" ref="918660940"/>
</object>
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
<reference key="NSTableView" ref="847503045"/>
</object>
</array>
<double key="NSIntercellSpacingWidth">3</double>
<double key="NSIntercellSpacingHeight">2</double>
<reference key="NSBackgroundColor" ref="516674465"/>
<object class="NSColor" key="NSGridColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">gridColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<double key="NSRowHeight">19</double>
<string key="NSAction">tableViewAction:</string>
<int key="NSTvFlags">-765427712</int>
<reference key="NSDelegate" ref="412656964"/>
<reference key="NSDataSource" ref="412656964"/>
<reference key="NSTarget" ref="412656964"/>
<int key="NSColumnAutoresizingStyle">1</int>
<int key="NSDraggingSourceMaskForLocal">15</int>
<int key="NSDraggingSourceMaskForNonLocal">0</int>
<bool key="NSAllowsTypeSelect">YES</bool>
<int key="NSTableViewDraggingDestinationStyle">0</int>
<int key="NSTableViewGroupRowStyle">1</int>
</object>
<bool key="NSButtonBordered">NO</bool>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
<object class="NSTextField" id="642967193"> <object class="NSTextField" id="642967193">
<reference key="NSNextResponder" ref="1072816887"/> <reference key="NSNextResponder" ref="1072816887"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
@ -88,10 +225,7 @@
<int key="NSColorSpace">6</int> <int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string> <string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string> <string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor"> <reference key="NSColor" ref="131605477"/>
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object> </object>
<object class="NSColor" key="NSTextColor" id="980321139"> <object class="NSColor" key="NSTextColor" id="980321139">
<int key="NSColorSpace">1</int> <int key="NSColorSpace">1</int>
@ -136,10 +270,10 @@
<object class="NSTextField" id="402376051"> <object class="NSTextField" id="402376051">
<reference key="NSNextResponder" ref="1072816887"/> <reference key="NSNextResponder" ref="1072816887"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
<string key="NSFrame">{{140, 133}, {200, 22}}</string> <string key="NSFrame">{{80, 133}, {200, 22}}</string>
<reference key="NSSuperview" ref="1072816887"/> <reference key="NSSuperview" ref="1072816887"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="139778114"/> <reference key="NSNextKeyView" ref="599228032"/>
<string key="NSReuseIdentifierKey">_NS:9</string> <string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="961966865"> <object class="NSTextFieldCell" key="NSCell" id="961966865">
@ -155,23 +289,12 @@
<string key="NSCellIdentifier">_NS:9</string> <string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="402376051"/> <reference key="NSControlView" ref="402376051"/>
<int key="NSTextBezelStyle">1</int> <int key="NSTextBezelStyle">1</int>
<object class="NSColor" key="NSBackgroundColor"> <reference key="NSBackgroundColor" ref="75022320"/>
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor"> <object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int> <int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string> <string key="NSCatalogName">System</string>
<string key="NSColorName">textColor</string> <string key="NSColorName">textColor</string>
<object class="NSColor" key="NSColor" id="714751679"> <reference key="NSColor" ref="714751679"/>
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object> </object>
</object> </object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool> <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
@ -316,6 +439,14 @@
</object> </object>
<int key="connectionID">215</int> <int key="connectionID">215</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">typeField</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="599228032"/>
</object>
<int key="connectionID">263</int>
</object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">delegate</string> <string key="label">delegate</string>
@ -332,6 +463,14 @@
</object> </object>
<int key="connectionID">188</int> <int key="connectionID">188</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="599228032"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">265</int>
</object>
</array> </array>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects"> <array key="orderedObjects">
@ -443,11 +582,43 @@
<int key="objectID">143</int> <int key="objectID">143</int>
<reference key="object" ref="1072816887"/> <reference key="object" ref="1072816887"/>
<array class="NSMutableArray" key="children"> <array class="NSMutableArray" key="children">
<object class="IBNSLayoutConstraint" id="409712688">
<reference key="firstItem" ref="599228032"/>
<int key="firstAttribute">11</int>
<int key="relation">0</int>
<reference key="secondItem" ref="402376051"/>
<int key="secondAttribute">11</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1072816887"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">2</int>
</object>
<object class="IBNSLayoutConstraint" id="871913200">
<reference key="firstItem" ref="599228032"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="402376051"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">8</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1072816887"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="671970801"> <object class="IBNSLayoutConstraint" id="671970801">
<reference key="firstItem" ref="104294954"/> <reference key="firstItem" ref="104294954"/>
<int key="firstAttribute">9</int> <int key="firstAttribute">9</int>
<int key="relation">0</int> <int key="relation">0</int>
<reference key="secondItem" ref="402376051"/> <reference key="secondItem" ref="642967193"/>
<int key="secondAttribute">9</int> <int key="secondAttribute">9</int>
<float key="multiplier">1</float> <float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant"> <object class="IBLayoutConstant" key="constant">
@ -539,38 +710,6 @@
<float key="scoringTypeFloat">29</float> <float key="scoringTypeFloat">29</float>
<int key="contentType">3</int> <int key="contentType">3</int>
</object> </object>
<object class="IBNSLayoutConstraint" id="884917592">
<reference key="firstItem" ref="402376051"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="642967193"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">8</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1072816887"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="310034208">
<reference key="firstItem" ref="642967193"/>
<int key="firstAttribute">9</int>
<int key="relation">0</int>
<reference key="secondItem" ref="402376051"/>
<int key="secondAttribute">9</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1072816887"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">2</int>
</object>
<object class="IBNSLayoutConstraint" id="645313537"> <object class="IBNSLayoutConstraint" id="645313537">
<reference key="firstItem" ref="642967193"/> <reference key="firstItem" ref="642967193"/>
<int key="firstAttribute">3</int> <int key="firstAttribute">3</int>
@ -587,6 +726,38 @@
<float key="scoringTypeFloat">29</float> <float key="scoringTypeFloat">29</float>
<int key="contentType">3</int> <int key="contentType">3</int>
</object> </object>
<object class="IBNSLayoutConstraint" id="232766502">
<reference key="firstItem" ref="402376051"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="1072816887"/>
<int key="secondAttribute">5</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">80</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1072816887"/>
<int key="scoringType">3</int>
<float key="scoringTypeFloat">9</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="884917592">
<reference key="firstItem" ref="402376051"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="642967193"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">8</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="1072816887"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="566883659"> <object class="IBNSLayoutConstraint" id="566883659">
<reference key="firstItem" ref="139778114"/> <reference key="firstItem" ref="139778114"/>
<int key="firstAttribute">3</int> <int key="firstAttribute">3</int>
@ -638,8 +809,9 @@
<reference ref="49669222"/> <reference ref="49669222"/>
<reference ref="642967193"/> <reference ref="642967193"/>
<reference ref="139778114"/> <reference ref="139778114"/>
<reference ref="402376051"/>
<reference ref="104294954"/> <reference ref="104294954"/>
<reference ref="402376051"/>
<reference ref="599228032"/>
</array> </array>
<reference key="parent" ref="258451033"/> <reference key="parent" ref="258451033"/>
</object> </object>
@ -696,6 +868,7 @@
<int key="objectID">182</int> <int key="objectID">182</int>
<reference key="object" ref="402376051"/> <reference key="object" ref="402376051"/>
<array class="NSMutableArray" key="children"> <array class="NSMutableArray" key="children">
<reference ref="961966865"/>
<object class="IBNSLayoutConstraint" id="102475933"> <object class="IBNSLayoutConstraint" id="102475933">
<reference key="firstItem" ref="402376051"/> <reference key="firstItem" ref="402376051"/>
<int key="firstAttribute">7</int> <int key="firstAttribute">7</int>
@ -712,15 +885,9 @@
<float key="scoringTypeFloat">9</float> <float key="scoringTypeFloat">9</float>
<int key="contentType">1</int> <int key="contentType">1</int>
</object> </object>
<reference ref="961966865"/>
</array> </array>
<reference key="parent" ref="1072816887"/> <reference key="parent" ref="1072816887"/>
</object> </object>
<object class="IBObjectRecord">
<int key="objectID">186</int>
<reference key="object" ref="102475933"/>
<reference key="parent" ref="402376051"/>
</object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">185</int> <int key="objectID">185</int>
<reference key="object" ref="961966865"/> <reference key="object" ref="961966865"/>
@ -782,11 +949,6 @@
<reference key="object" ref="645313537"/> <reference key="object" ref="645313537"/>
<reference key="parent" ref="1072816887"/> <reference key="parent" ref="1072816887"/>
</object> </object>
<object class="IBObjectRecord">
<int key="objectID">219</int>
<reference key="object" ref="310034208"/>
<reference key="parent" ref="1072816887"/>
</object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">221</int> <int key="objectID">221</int>
<reference key="object" ref="884917592"/> <reference key="object" ref="884917592"/>
@ -818,10 +980,64 @@
<reference key="parent" ref="1072816887"/> <reference key="parent" ref="1072816887"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">239</int> <int key="objectID">240</int>
<reference key="object" ref="599228032"/>
<array class="NSMutableArray" key="children">
<reference ref="412656964"/>
<object class="IBNSLayoutConstraint" id="108775515">
<reference key="firstItem" ref="599228032"/>
<int key="firstAttribute">7</int>
<int key="relation">0</int>
<nil key="secondItem"/>
<int key="secondAttribute">0</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">112</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="599228032"/>
<int key="scoringType">3</int>
<float key="scoringTypeFloat">9</float>
<int key="contentType">1</int>
</object>
</array>
<reference key="parent" ref="1072816887"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">241</int>
<reference key="object" ref="412656964"/>
<reference key="parent" ref="599228032"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">254</int>
<reference key="object" ref="108775515"/>
<reference key="parent" ref="599228032"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">256</int>
<reference key="object" ref="671970801"/> <reference key="object" ref="671970801"/>
<reference key="parent" ref="1072816887"/> <reference key="parent" ref="1072816887"/>
</object> </object>
<object class="IBObjectRecord">
<int key="objectID">258</int>
<reference key="object" ref="102475933"/>
<reference key="parent" ref="402376051"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">260</int>
<reference key="object" ref="871913200"/>
<reference key="parent" ref="1072816887"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">261</int>
<reference key="object" ref="232766502"/>
<reference key="parent" ref="1072816887"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">262</int>
<reference key="object" ref="409712688"/>
<reference key="parent" ref="1072816887"/>
</object>
</array> </array>
</object> </object>
<dictionary class="NSMutableDictionary" key="flattenedProperties"> <dictionary class="NSMutableDictionary" key="flattenedProperties">
@ -832,15 +1048,17 @@
<reference ref="865006730"/> <reference ref="865006730"/>
<reference ref="831384658"/> <reference ref="831384658"/>
<reference ref="566883659"/> <reference ref="566883659"/>
<reference ref="645313537"/>
<reference ref="310034208"/>
<reference ref="884917592"/> <reference ref="884917592"/>
<reference ref="232766502"/>
<reference ref="645313537"/>
<reference ref="63384401"/> <reference ref="63384401"/>
<reference ref="602857839"/> <reference ref="602857839"/>
<reference ref="314583816"/> <reference ref="314583816"/>
<reference ref="451791256"/> <reference ref="451791256"/>
<reference ref="289992556"/> <reference ref="289992556"/>
<reference ref="671970801"/> <reference ref="671970801"/>
<reference ref="871913200"/>
<reference ref="409712688"/>
</array> </array>
<boolean value="NO" key="143.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> <boolean value="NO" key="143.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="143.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="143.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -857,7 +1075,7 @@
<reference key="181.IBViewIntegration.shadowColor" ref="444840817"/> <reference key="181.IBViewIntegration.shadowColor" ref="444840817"/>
<real value="1" key="181.IBViewIntegration.shadowOffsetHeight"/> <real value="1" key="181.IBViewIntegration.shadowOffsetHeight"/>
<real value="0.0" key="181.IBViewIntegration.shadowOffsetWidth"/> <real value="0.0" key="181.IBViewIntegration.shadowOffsetWidth"/>
<array class="NSMutableArray" key="182.IBNSViewMetadataConstraints"> <array key="182.IBNSViewMetadataConstraints">
<reference ref="102475933"/> <reference ref="102475933"/>
</array> </array>
<boolean value="NO" key="182.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> <boolean value="NO" key="182.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
@ -874,7 +1092,6 @@
<real value="0.0" key="183.IBViewIntegration.shadowOffsetWidth"/> <real value="0.0" key="183.IBViewIntegration.shadowOffsetWidth"/>
<string key="184.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="184.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="185.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="185.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="186.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="187.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="187.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="199.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="199.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="200.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="200.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -889,7 +1106,6 @@
<real value="0.0" key="216.IBViewIntegration.shadowOffsetWidth"/> <real value="0.0" key="216.IBViewIntegration.shadowOffsetWidth"/>
<string key="217.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="217.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="218.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="218.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="219.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES" key="22.IBNSWindowAutoPositionCentersHorizontal"/> <boolean value="YES" key="22.IBNSWindowAutoPositionCentersHorizontal"/>
<boolean value="YES" key="22.IBNSWindowAutoPositionCentersVertical"/> <boolean value="YES" key="22.IBNSWindowAutoPositionCentersVertical"/>
<string key="22.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="22.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -906,7 +1122,28 @@
<string key="231.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="231.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="237.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="237.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="238.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="238.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="239.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <array class="NSMutableArray" key="240.IBNSViewMetadataConstraints">
<reference ref="108775515"/>
</array>
<boolean value="NO" key="240.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="240.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<array key="241.IBComboBoxObjectValuesKey.objectValues">
<string>Maximum</string>
<string>Long</string>
<string>Medium</string>
<string>Basic</string>
<string>Short</string>
<string>PIN</string>
<string>Personal</string>
<string>Device</string>
</array>
<string key="241.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="254.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="256.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="258.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="260.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="261.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="262.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="96.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> <boolean value="NO" key="96.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="96.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="96.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary> </dictionary>
@ -914,30 +1151,20 @@
<nil key="activeLocalization"/> <nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/> <dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">239</int> <int key="maxID">265</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions"> <array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">MPPasswordWindowController</string> <string key="className">MPPasswordWindowController</string>
<string key="superclassName">NSWindowController</string> <string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">reload:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">reload:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">reload:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<dictionary class="NSMutableDictionary" key="outlets"> <dictionary class="NSMutableDictionary" key="outlets">
<string key="contentContainer">NSView</string> <string key="contentContainer">NSView</string>
<string key="contentField">NSTextField</string> <string key="contentField">NSTextField</string>
<string key="progressView">NSProgressIndicator</string> <string key="progressView">NSProgressIndicator</string>
<string key="siteField">NSTextField</string> <string key="siteField">NSTextField</string>
<string key="tipField">NSTextField</string> <string key="tipField">NSTextField</string>
<string key="typeField">NSComboBox</string>
<string key="userLabel">NSTextField</string> <string key="userLabel">NSTextField</string>
</dictionary> </dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
@ -961,6 +1188,10 @@
<string key="name">tipField</string> <string key="name">tipField</string>
<string key="candidateClassName">NSTextField</string> <string key="candidateClassName">NSTextField</string>
</object> </object>
<object class="IBToOneOutletInfo" key="typeField">
<string key="name">typeField</string>
<string key="candidateClassName">NSComboBox</string>
</object>
<object class="IBToOneOutletInfo" key="userLabel"> <object class="IBToOneOutletInfo" key="userLabel">
<string key="name">userLabel</string> <string key="name">userLabel</string>
<string key="candidateClassName">NSTextField</string> <string key="candidateClassName">NSTextField</string>

View File

@ -789,35 +789,8 @@
@"If you continue, the password for this site will change. " @"If you continue, the password for this site will change. "
@"You will need to update your account's old password to the new one." @"You will need to update your account's old password to the new one."
do:^BOOL(MPElementEntity *activeElement, NSManagedObjectContext *context) { do:^BOOL(MPElementEntity *activeElement, NSManagedObjectContext *context) {
if ([activeElement.algorithm classOfType:type] == activeElement.typeClass) _activeElementOID = [[MPiOSAppDelegate get] changeElement:activeElement inContext:context
activeElement.type = type; toType:type].objectID;
else {
// Type requires a different class of element. Recreate the element.
MPElementEntity *newElement
= [NSEntityDescription insertNewObjectForEntityForName:[activeElement.algorithm classNameOfType:type]
inManagedObjectContext:context];
newElement.type = type;
newElement.name = activeElement.name;
newElement.user = activeElement.user;
newElement.uses = activeElement.uses;
newElement.lastUsed = activeElement.lastUsed;
newElement.version = activeElement.version;
newElement.loginName = activeElement.loginName;
[context deleteObject:activeElement];
[context saveToStore];
NSError *error;
if (![context obtainPermanentIDsForObjects:@[ newElement ] error:&error])
err(@"Failed to obtain a permanent object ID after changing object type: %@", error);
_activeElementOID = newElement.objectID;
activeElement = newElement;
}
[[NSNotificationCenter defaultCenter]
postNotificationName:MPElementUpdatedNotification object:activeElement.objectID];
return YES; return YES;
}]; }];
} }