Fixed missing binding to enable trahs in settings tab

Updated copy/drag and drop to changed KeePassKit
This commit is contained in:
michael starke
2013-12-20 19:50:23 +01:00
parent aa52079664
commit 37f7f8123a
6 changed files with 11 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment defaultVersion="1080" identifier="macosx"/> <deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>

View File

@@ -184,6 +184,7 @@
} }
- (void)_setupAdvancedTab:(KPKTree *)tree { - (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.enableRecycleBinCheckButton bind:NSValueBinding toObject:self withKeyPath:@"trashEnabled" options:nil];
[self.selectRecycleBinGroupPopUpButton bind:NSEnabledBinding toObject:self withKeyPath:@"trashEnabled" options:nil]; [self.selectRecycleBinGroupPopUpButton bind:NSEnabledBinding toObject:self withKeyPath:@"trashEnabled" options:nil];
[self _updateTrashFolders:tree]; [self _updateTrashFolders:tree];

View File

@@ -48,6 +48,7 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
@property (strong, readonly, nonatomic) KPKTree *tree; @property (strong, readonly, nonatomic) KPKTree *tree;
@property (nonatomic, weak, readonly) KPKGroup *root; @property (nonatomic, weak, readonly) KPKGroup *root;
@property (nonatomic, weak) KPKGroup *trash; @property (nonatomic, weak) KPKGroup *trash;
@property (nonatomic, readonly) BOOL useTrash;
@property (nonatomic, weak) KPKGroup *templates; @property (nonatomic, weak) KPKGroup *templates;
@property (nonatomic, strong, readonly) KPKCompositeKey *compositeKey; @property (nonatomic, strong, readonly) KPKCompositeKey *compositeKey;

View File

@@ -73,7 +73,6 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
@property (strong) NSURL *lockFileURL; @property (strong) NSURL *lockFileURL;
@property (nonatomic, assign) BOOL isAllowedToStoreKeyFile; @property (nonatomic, assign) BOOL isAllowedToStoreKeyFile;
@property (readonly) BOOL useTrash;
@property (strong) IBOutlet NSView *warningView; @property (strong) IBOutlet NSView *warningView;
@property (weak) IBOutlet NSImageView *warningViewImage; @property (weak) IBOutlet NSImageView *warningViewImage;
@@ -325,6 +324,10 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
return nil; return nil;
} }
- (BOOL)useTrash {
return self.tree.metaData.recycleBinEnabled;
}
- (KPKGroup *)templates { - (KPKGroup *)templates {
static KPKGroup *_templates = nil; static KPKGroup *_templates = nil;
BOOL templateValid = [_templates.uuid isEqual:self.tree.metaData.entryTemplatesGroup]; BOOL templateValid = [_templates.uuid isEqual:self.tree.metaData.entryTemplatesGroup];
@@ -404,10 +407,6 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
return self.tree.allGroups; return self.tree.allGroups;
} }
- (BOOL)useTrash {
return self.tree.metaData.recycleBinEnabled;
}
- (BOOL)isItemTrashed:(id)item { - (BOOL)isItemTrashed:(id)item {
BOOL validItem = [item isKindOfClass:[KPKEntry class]] || [item isKindOfClass:[KPKGroup class]]; BOOL validItem = [item isKindOfClass:[KPKEntry class]] || [item isKindOfClass:[KPKGroup class]];
if(!item) { if(!item) {
@@ -540,7 +539,7 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
if(entryUUID) { if(entryUUID) {
KPKEntry *templateEntry = [self findEntry:entryUUID]; KPKEntry *templateEntry = [self findEntry:entryUUID];
if(templateEntry && self.selectedGroup) { if(templateEntry && self.selectedGroup) {
KPKEntry *copy = [templateEntry copyWithTitle:templateEntry.title options:0]; KPKEntry *copy = [templateEntry copyWithTitle:templateEntry.title];
[self.selectedGroup addEntry:copy]; [self.selectedGroup addEntry:copy];
[self.selectedGroup.undoManager setActionName:NSLocalizedString(@"ADD_TREMPLATE_ENTRY", "")]; [self.selectedGroup.undoManager setActionName:NSLocalizedString(@"ADD_TREMPLATE_ENTRY", "")];
} }

View File

@@ -365,7 +365,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
- (void)_updateContextBar { - (void)_updateContextBar {
MPDocument *document = [[self windowController] document]; MPDocument *document = [[self windowController] document];
if(![self.contextBarViewController hasFilter]) { 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) { if(showTrash) {
[self _showTrashBar]; [self _showTrashBar];
} }

View File

@@ -143,7 +143,7 @@
KPKGroup *targetGroup = (KPKGroup *)targetItem; KPKGroup *targetGroup = (KPKGroup *)targetItem;
if(draggedGroup) { if(draggedGroup) {
if(copyItem || (nil == self.localDraggedGroup) ) { if(copyItem || (nil == self.localDraggedGroup) ) {
draggedGroup = [draggedGroup copyWithName:nil options:0]; draggedGroup = [draggedGroup copyWithName:nil];
[targetGroup addGroup:draggedGroup atIndex:index]; [targetGroup addGroup:draggedGroup atIndex:index];
[targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_GROUP", "")]; [targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_GROUP", "")];
return YES; return YES;
@@ -159,7 +159,7 @@
} }
else if(draggedEntry) { else if(draggedEntry) {
if(copyItem || (nil == self.localDraggedEntry)) { if(copyItem || (nil == self.localDraggedEntry)) {
draggedEntry = [draggedEntry copyWithTitle:nil options:0]; draggedEntry = [draggedEntry copyWithTitle:nil];
[targetGroup addEntry:draggedEntry atIndex:index]; [targetGroup addEntry:draggedEntry atIndex:index];
[targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_ENTRY", "")]; [targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_ENTRY", "")];
return YES; return YES;