diff --git a/MacPass/DocumentSettingsWindow.xib b/MacPass/DocumentSettingsWindow.xib index 2519f4a8..ba46db5a 100644 --- a/MacPass/DocumentSettingsWindow.xib +++ b/MacPass/DocumentSettingsWindow.xib @@ -60,7 +60,7 @@ - + 256 @@ -68,6 +68,7 @@ 268 {{378, 13}, {75, 32}} + _NS:9 YES @@ -95,12 +96,14 @@ 12 {{13, 41}, {441, 246}} + + _NS:9 1 - + 256 @@ -227,7 +230,7 @@ 1 - 100667267 + 67112835 0 @@ -333,7 +336,6 @@ {{10, 33}, {421, 200}} - _NS:11 @@ -624,7 +626,7 @@ - + 256 @@ -632,6 +634,7 @@ 268 {{15, 154}, {149, 18}} + _NS:9 YES @@ -658,6 +661,7 @@ 268 {{15, 55}, {138, 18}} + _NS:9 YES @@ -684,6 +688,7 @@ 268 {{43, 35}, {187, 18}} + _NS:9 YES @@ -710,6 +715,7 @@ 268 {{42, 131}, {94, 17}} + _NS:1535 YES @@ -730,6 +736,7 @@ 268 {{42, 106}, {142, 17}} + _NS:1535 YES @@ -750,6 +757,7 @@ 268 {{187, 101}, {122, 26}} + _NS:9 YES @@ -825,6 +833,7 @@ 268 {{189, 129}, {96, 22}} + _NS:9 YES @@ -846,6 +855,7 @@ 268 {{290, 126}, {19, 27}} + _NS:1099 YES @@ -860,8 +870,79 @@ NO + + + 268 + {{187, 54}, {122, 26}} + + + _NS:9 + YES + + -2076180416 + 2048 + + _NS:9 + + 109199360 + 129 + + + 400 + 75 + + + Item 1 + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + OtherViews + + + + + Item 2 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + Item 3 + + 1048576 + 2147483647 + + + _popUpItemAction: + + + + + + 1 + YES + YES + 2 + + NO + {{10, 33}, {421, 200}} + + Advanced @@ -869,20 +950,22 @@ - + 0 YES YES - + {467, 293} + + - {{0, 0}, {1920, 1058}} + {{0, 0}, {2560, 1418}} {10000000000000, 10000000000000} YES @@ -1370,6 +1453,54 @@ 24 2 + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 4 + 0 + + 4 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + 6 @@ -1617,6 +1748,7 @@ + @@ -2594,6 +2726,62 @@ + + 678 + + + + + + + + 679 + + + + + + + + 680 + + + + + + + + + + 681 + + + + + 682 + + + + + 683 + + + + + 685 + + + + + 686 + + + + + 687 + + + @@ -2663,6 +2851,9 @@ + + + @@ -2812,14 +3003,103 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin - 677 + 687 + + + + + MPDocumentSettingsWindowController + NSWindowController + + saveChanges: + id + + + saveChanges: + + saveChanges: + id + + + + NSTextView + NSTextField + NSPathControl + NSTextField + NSButton + NSButton + NSButton + NSButton + NSButton + + + + databaseDescriptionTextView + NSTextView + + + databaseNameTextField + NSTextField + + + keyfilePathControl + NSPathControl + + + passwordTextField + NSTextField + + + protectNotesCheckButton + NSButton + + + protectPasswortCheckButton + NSButton + + + protectTitleCheckButton + NSButton + + + protectURLCheckButton + NSButton + + + protectUserNameCheckButton + NSButton + + + + IBProjectSource + ./Classes/MPDocumentSettingsWindowController.h + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + - 0 IBCocoaFramework YES diff --git a/MacPass/KdbGroup+MPTreeTools.h b/MacPass/KdbGroup+MPTreeTools.h index 5b64b4a2..9f9581ec 100644 --- a/MacPass/KdbGroup+MPTreeTools.h +++ b/MacPass/KdbGroup+MPTreeTools.h @@ -15,7 +15,9 @@ - (NSArray *)childGroups; /* Returns all entries under this group and it's subgroups */ - (NSArray *)childEntries; - +/* Returns the entry with the UUID */ - (KdbEntry *)entryForUUID:(UUID *)uuid; +/* Returns the group with the UUID */ +- (KdbGroup *)groupForUUID:(UUID *)uuid; @end \ No newline at end of file diff --git a/MacPass/KdbGroup+MPTreeTools.m b/MacPass/KdbGroup+MPTreeTools.m index 157e174c..5f7e8a29 100644 --- a/MacPass/KdbGroup+MPTreeTools.m +++ b/MacPass/KdbGroup+MPTreeTools.m @@ -34,6 +34,18 @@ NSArray *filterdEntries = [childEntries filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { return [uuid isEqual:(UUID *)[evaluatedObject uuid]]; }]]; + NSAssert([filterdEntries count] <= 1, @"UUID hast to be unique"); return [filterdEntries lastObject]; } + +- (KdbGroup *)groupForUUID:(UUID *)uuid { + NSArray *childGroups = [self childGroups]; + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { + return [uuid isEqual:(UUID *)[evaluatedObject uuid]]; + }]; + NSArray *filteredGroups = [childGroups filteredArrayUsingPredicate:predicate]; + NSAssert([filteredGroups count] <= 1, @"UUID hast to be unique"); + return [filteredGroups lastObject]; +} + @end \ No newline at end of file diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index 28139e86..9a549a1c 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -55,6 +55,7 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; Returns the entry for the given UUID, nil if none was found */ - (KdbEntry *)findEntry:(UUID *)uuid; +- (KdbGroup *)findGroup:(UUID *)uuid; /* Return the Binary for the given BinaryRef. nil if none was found */ diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index fb4e17e2..79678129 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -50,6 +50,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; @property (assign) BOOL readOnly; @property (retain) NSURL *lockFileURL; +@property (readonly, assign, nonatomic) KdbGroup *recyleBin; +@property (readonly) BOOL useRecylceBin; @end @@ -213,6 +215,10 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; return [self.root entryForUUID:uuid]; } +- (KdbGroup *)findGroup:(UUID *)uuid { + return [self.root groupForUUID:uuid]; +} + - (Binary *)binaryForRef:(BinaryRef *)binaryRef { if(self.version != MPDatabaseVersion4) { return nil; @@ -250,6 +256,20 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } } +- (BOOL)useRecylceBin { + if(self.treeV4) { + return self.treeV4.recycleBinEnabled; + } + return NO; +} + +- (KdbGroup *)recyleBin { + if(self.useRecylceBin) { + return [self findGroup:self.treeV4.recycleBinUuid]; + } + return nil; +} + #pragma mark Data manipulation - (KdbEntry *)createEntry:(KdbGroup *)parent { if(!parent) { @@ -296,7 +316,12 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; return; // No changes } [[[self undoManager] prepareWithInvocationTarget:self] moveGroup:group toGroup:group.parent index:oldIndex]; - [[self undoManager] setActionName:@"MOVE_GROUP"]; + if(self.recyleBin == target) { + [[self undoManager] setActionName:@"DELETE_GROUP"]; + } + else { + [[self undoManager] setActionName:@"MOVE_GROUP"]; + } [group.parent removeObjectFromGroupsAtIndex:oldIndex]; if(index < 0 || index > [target.groups count] ) { index = [target.groups count]; @@ -362,6 +387,17 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; if(NSNotFound == index) { return; // No object found } + /* + Cleaning the recyclebin is not undoable + So we do this in a separate action + */ + if(self.useRecylceBin) { + if(!self.recyleBin) { + [self _createRecylceBin]; + } + [self moveGroup:group toGroup:self.recyleBin index:[self.recyleBin.groups count]]; + return; // Done! + } [[[self undoManager] prepareWithInvocationTarget:self] group:group addGroup:aGroup atIndex:index]; [[self undoManager] setActionName:NSLocalizedString(@"UNDO_DELETE_GROUP", @"Delete Group Undo")]; [group removeObjectFromGroupsAtIndex:index]; @@ -392,4 +428,15 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } } +- (void)_createRecylceBin { + if(self.version == MPDatabaseVersion3) { + // create backup? + } + else if(self.version == MPDatabaseVersion4) { + + } + else { + } +} + @end diff --git a/MacPass/MPOutlineViewController.m b/MacPass/MPOutlineViewController.m index 32b04517..d7478f10 100644 --- a/MacPass/MPOutlineViewController.m +++ b/MacPass/MPOutlineViewController.m @@ -85,7 +85,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; _bindingEstablished = YES; } NSTreeNode *node = [_outlineView itemAtRow:0]; - [_outlineView expandItem:node expandChildren:NO]; + [_outlineView expandItem:node expandChildren:YES]; } #pragma makr Notifications diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist index fc75ed49..ddabc9f1 100644 --- a/MacPass/MacPass-Info.plist +++ b/MacPass/MacPass-Info.plist @@ -48,7 +48,7 @@ CFBundleSignature ???? CFBundleVersion - 1556 + 1560 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright