mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 05:52:58 +00:00
Removed unused Code
This commit is contained in:
@@ -20,4 +20,6 @@
|
|||||||
/* Returns the group with the UUID */
|
/* Returns the group with the UUID */
|
||||||
- (KdbGroup *)groupForUUID:(UUID *)uuid;
|
- (KdbGroup *)groupForUUID:(UUID *)uuid;
|
||||||
|
|
||||||
|
- (BOOL)isAnchestorOfGroup:(KdbGroup *)group;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -49,4 +49,18 @@
|
|||||||
return [filteredGroups lastObject];
|
return [filteredGroups lastObject];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)isAnchestorOfGroup:(KdbGroup *)group {
|
||||||
|
if(group == nil) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
KdbGroup *ancestor = self.parent;
|
||||||
|
while(ancestor.parent) {
|
||||||
|
if(group == self) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
ancestor = ancestor.parent;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -83,7 +83,6 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
|||||||
/*
|
/*
|
||||||
All non-setter undoable actions
|
All non-setter undoable actions
|
||||||
*/
|
*/
|
||||||
- (BOOL)group:(KdbGroup *)group isMoveableToGroup:(KdbGroup *)target;
|
|
||||||
|
|
||||||
/* TODO in UNDO auslagen */
|
/* TODO in UNDO auslagen */
|
||||||
- (void)addStringField:(StringField *)field toEntry:(Kdb4Entry *)entry atIndex:(NSUInteger)index;
|
- (void)addStringField:(StringField *)field toEntry:(Kdb4Entry *)entry atIndex:(NSUInteger)index;
|
||||||
|
|||||||
@@ -347,6 +347,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
|||||||
if(!parent) {
|
if(!parent) {
|
||||||
return nil; // No parent
|
return nil; // No parent
|
||||||
}
|
}
|
||||||
|
if(parent == self.trash) {
|
||||||
|
return nil; // no new Groups in trash
|
||||||
|
}
|
||||||
KdbEntry *newEntry = [self.tree createEntry:parent];
|
KdbEntry *newEntry = [self.tree createEntry:parent];
|
||||||
newEntry.title = NSLocalizedString(@"DEFAULT_ENTRY_TITLE", @"Title for a newly created entry");
|
newEntry.title = NSLocalizedString(@"DEFAULT_ENTRY_TITLE", @"Title for a newly created entry");
|
||||||
if(self.treeV4 && ([self.treeV4.defaultUserName length] > 0)) {
|
if(self.treeV4 && ([self.treeV4.defaultUserName length] > 0)) {
|
||||||
@@ -362,6 +365,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
|||||||
if(!parent) {
|
if(!parent) {
|
||||||
return nil; // no parent!
|
return nil; // no parent!
|
||||||
}
|
}
|
||||||
|
if(parent == self.trash) {
|
||||||
|
return nil; // no new Groups in trash
|
||||||
|
}
|
||||||
KdbGroup *newGroup = [self.tree createGroup:parent];
|
KdbGroup *newGroup = [self.tree createGroup:parent];
|
||||||
newGroup.name = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
newGroup.name = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
||||||
newGroup.image = MPIconFolder;
|
newGroup.image = MPIconFolder;
|
||||||
@@ -385,42 +391,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
|||||||
return newStringField;
|
return newStringField;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)moveGroup:(KdbGroup *)group toGroup:(KdbGroup *)target index:(NSInteger)index {
|
|
||||||
NSInteger oldIndex = [group.parent.groups indexOfObject:group];
|
|
||||||
if(group.parent == target && oldIndex == index) {
|
|
||||||
return; // No changes
|
|
||||||
}
|
|
||||||
[[[self undoManager] prepareWithInvocationTarget:self] moveGroup:group toGroup:group.parent index:oldIndex];
|
|
||||||
if(self.trash == target) {
|
|
||||||
[[self undoManager] setActionName:@"UNDO_DELETE_GROUP"];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
[[self undoManager] setActionName:@"MOVE_GROUP"];
|
|
||||||
}
|
|
||||||
[group.parent removeObjectFromGroupsAtIndex:oldIndex];
|
|
||||||
if(index < 0 || index > [target.groups count] ) {
|
|
||||||
index = [target.groups count];
|
|
||||||
}
|
|
||||||
[target insertObject:group inGroupsAtIndex:index];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)group:(KdbGroup *)group isMoveableToGroup:(KdbGroup *)target {
|
|
||||||
if(target == nil) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
BOOL isMovable = YES;
|
|
||||||
|
|
||||||
KdbGroup *ancestor = target.parent;
|
|
||||||
while(ancestor.parent) {
|
|
||||||
if(ancestor == group) {
|
|
||||||
isMovable = NO;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ancestor = ancestor.parent;
|
|
||||||
}
|
|
||||||
return isMovable;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)deleteEntry:(KdbEntry *)entry {
|
- (void)deleteEntry:(KdbEntry *)entry {
|
||||||
if(self.useTrash) {
|
if(self.useTrash) {
|
||||||
if(!self.trash) {
|
if(!self.trash) {
|
||||||
|
|||||||
@@ -77,8 +77,7 @@
|
|||||||
accepted &= index != NSOutlineViewDropOnItemIndex;
|
accepted &= index != NSOutlineViewDropOnItemIndex;
|
||||||
accepted &= index != [_draggedItem.parent.groups indexOfObject:_draggedItem];
|
accepted &= index != [_draggedItem.parent.groups indexOfObject:_draggedItem];
|
||||||
}
|
}
|
||||||
MPDocument *document = [[[outlineView window] windowController] document];
|
accepted = ![_draggedItem isAnchestorOfGroup:target];
|
||||||
accepted = [document group:_draggedItem isMoveableToGroup:target];
|
|
||||||
if( accepted ) {
|
if( accepted ) {
|
||||||
[_draggedItem moveToGroupUndoable:target atIndex:index];
|
[_draggedItem moveToGroupUndoable:target atIndex:index];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user