diff --git a/MacPass/DatabaseSettingsWindow.xib b/MacPass/DatabaseSettingsWindow.xib index baa08124..e12ec848 100644 --- a/MacPass/DatabaseSettingsWindow.xib +++ b/MacPass/DatabaseSettingsWindow.xib @@ -1,5 +1,5 @@ - + diff --git a/MacPass/MPDatabaseSettingsWindowController.m b/MacPass/MPDatabaseSettingsWindowController.m index 56ea84b5..1ab69812 100644 --- a/MacPass/MPDatabaseSettingsWindowController.m +++ b/MacPass/MPDatabaseSettingsWindowController.m @@ -184,6 +184,7 @@ } - (void)_setupAdvancedTab:(KPKTree *)tree { + [self bind:@"trashEnabled" toObject:tree.metaData withKeyPath:@"recycleBinEnabled" options:nil]; [self.enableRecycleBinCheckButton bind:NSValueBinding toObject:self withKeyPath:@"trashEnabled" options:nil]; [self.selectRecycleBinGroupPopUpButton bind:NSEnabledBinding toObject:self withKeyPath:@"trashEnabled" options:nil]; [self _updateTrashFolders:tree]; diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index e59b1577..30b5aec7 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -48,6 +48,7 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; @property (strong, readonly, nonatomic) KPKTree *tree; @property (nonatomic, weak, readonly) KPKGroup *root; @property (nonatomic, weak) KPKGroup *trash; +@property (nonatomic, readonly) BOOL useTrash; @property (nonatomic, weak) KPKGroup *templates; @property (nonatomic, strong, readonly) KPKCompositeKey *compositeKey; diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index d50263b1..28df5557 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -73,7 +73,6 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { @property (strong) NSURL *lockFileURL; @property (nonatomic, assign) BOOL isAllowedToStoreKeyFile; -@property (readonly) BOOL useTrash; @property (strong) IBOutlet NSView *warningView; @property (weak) IBOutlet NSImageView *warningViewImage; @@ -325,6 +324,10 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { return nil; } +- (BOOL)useTrash { + return self.tree.metaData.recycleBinEnabled; +} + - (KPKGroup *)templates { static KPKGroup *_templates = nil; BOOL templateValid = [_templates.uuid isEqual:self.tree.metaData.entryTemplatesGroup]; @@ -404,10 +407,6 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { return self.tree.allGroups; } -- (BOOL)useTrash { - return self.tree.metaData.recycleBinEnabled; -} - - (BOOL)isItemTrashed:(id)item { BOOL validItem = [item isKindOfClass:[KPKEntry class]] || [item isKindOfClass:[KPKGroup class]]; if(!item) { @@ -540,7 +539,7 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { if(entryUUID) { KPKEntry *templateEntry = [self findEntry:entryUUID]; if(templateEntry && self.selectedGroup) { - KPKEntry *copy = [templateEntry copyWithTitle:templateEntry.title options:0]; + KPKEntry *copy = [templateEntry copyWithTitle:templateEntry.title]; [self.selectedGroup addEntry:copy]; [self.selectedGroup.undoManager setActionName:NSLocalizedString(@"ADD_TREMPLATE_ENTRY", "")]; } diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index baec98b7..89f6db35 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -365,7 +365,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell"; - (void)_updateContextBar { MPDocument *document = [[self windowController] document]; if(![self.contextBarViewController hasFilter]) { - BOOL showTrash = (document.selectedGroup == document.trash || [document isItemTrashed:document.selectedItem]); + BOOL showTrash = document.useTrash && (document.selectedGroup == document.trash || [document isItemTrashed:document.selectedItem]); if(showTrash) { [self _showTrashBar]; } diff --git a/MacPass/MPOutlineDataSource.m b/MacPass/MPOutlineDataSource.m index 1237da2c..2b154453 100644 --- a/MacPass/MPOutlineDataSource.m +++ b/MacPass/MPOutlineDataSource.m @@ -143,7 +143,7 @@ KPKGroup *targetGroup = (KPKGroup *)targetItem; if(draggedGroup) { if(copyItem || (nil == self.localDraggedGroup) ) { - draggedGroup = [draggedGroup copyWithName:nil options:0]; + draggedGroup = [draggedGroup copyWithName:nil]; [targetGroup addGroup:draggedGroup atIndex:index]; [targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_GROUP", "")]; return YES; @@ -159,7 +159,7 @@ } else if(draggedEntry) { if(copyItem || (nil == self.localDraggedEntry)) { - draggedEntry = [draggedEntry copyWithTitle:nil options:0]; + draggedEntry = [draggedEntry copyWithTitle:nil]; [targetGroup addEntry:draggedEntry atIndex:index]; [targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_ENTRY", "")]; return YES;