mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 17:32:17 +00:00
Temporarily disabled drag and drop until it's working properly
Fixed issues with clearing the trash
This commit is contained in:
@@ -32,6 +32,5 @@ APPKIT_EXTERN NSString *const MPEntryNotesUndoableKey;
|
||||
- (void)deleteUndoable;
|
||||
- (void)moveToGroupUndoable:(KdbGroup *)group atIndex:(NSUInteger)index;
|
||||
- (void)moveToTrashUndoable:(KdbGroup *)trash atIndex:(NSUInteger)index;
|
||||
- (void)restoreFromTrashUndoable:(KdbGroup *)group atIndex:(NSUInteger)index;
|
||||
|
||||
@end
|
||||
|
||||
@@ -52,14 +52,22 @@ if(![[self undoManager] isUndoing]) {\
|
||||
|
||||
- (void)setTitleUndoable:(NSString *)title {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(setTitleUndoable:) object:self.title];
|
||||
MPSetActionName(@"SET_TITLE", "Set Title");
|
||||
|
||||
if(![[self undoManager] isUndoing]) {
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"SET_TITLE", "Set Title")];
|
||||
}
|
||||
|
||||
[self setLastModificationTime:[NSDate date]];
|
||||
[self setTitle:title];
|
||||
}
|
||||
|
||||
- (void)setUsernameUndoable:(NSString *)username {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(setUsernameUndoable:) object:self.username];
|
||||
MPSetActionName(@"SET_USERNAME", "Undo set username");
|
||||
|
||||
if(![[self undoManager] isUndoing]) {
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"SET_USERNAME", "Undo set username")];
|
||||
}
|
||||
|
||||
[self setLastModificationTime:[NSDate date]];
|
||||
[self setUsername:username];
|
||||
}
|
||||
@@ -67,6 +75,11 @@ if(![[self undoManager] isUndoing]) {\
|
||||
- (void)setPasswordUndoable:(NSString *)password {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(setPasswordUndoable:) object:self.password];
|
||||
MPSetActionName(@"SET_PASSWORT", "Undo set password");
|
||||
|
||||
if(![[self undoManager] isUndoing]) {
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"SET_TITLE", "Set Title")];
|
||||
}
|
||||
|
||||
[self setLastModificationTime:[NSDate date]];
|
||||
[self setPassword:password];
|
||||
}
|
||||
@@ -74,6 +87,11 @@ if(![[self undoManager] isUndoing]) {\
|
||||
- (void)setUrlUndoable:(NSString *)url {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(setUrlUndoable:) object:self.url];
|
||||
MPSetActionName(@"SET_URL", "Undo set URL");
|
||||
|
||||
if(![[self undoManager] isUndoing]) {
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"SET_TITLE", "Set Title")];
|
||||
}
|
||||
|
||||
[self setLastModificationTime:[NSDate date]];
|
||||
[self setUrl:url];
|
||||
}
|
||||
@@ -81,6 +99,11 @@ if(![[self undoManager] isUndoing]) {\
|
||||
- (void)setNotesUndoable:(NSString *)notes {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(setNotesUndoable:) object:self.notes];
|
||||
MPSetActionName(@"SET_NOTES", "Set Notes");
|
||||
|
||||
if(![[self undoManager] isUndoing]) {
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"SET_TITLE", "Set Title")];
|
||||
}
|
||||
|
||||
[self setLastModificationTime:[NSDate date]];
|
||||
[self setNotes:notes];
|
||||
}
|
||||
@@ -94,39 +117,24 @@ if(![[self undoManager] isUndoing]) {\
|
||||
return; // We're not in our parents entries list
|
||||
}
|
||||
[[[self undoManager] prepareWithInvocationTarget:self.parent] addEntryUndoable:self atIndex:oldIndex];
|
||||
MPSetActionName(@"DELETE_ENTRY", "Delete Entry");
|
||||
|
||||
if(![[self undoManager] isUndoing]) {
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"DELETE_ENTRY", "Set Title")];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"" object:self userInfo:nil];
|
||||
[self.parent removeObjectFromEntriesAtIndex:oldIndex];
|
||||
}
|
||||
|
||||
- (void)moveToGroupUndoable:(KdbGroup *)group atIndex:(NSUInteger)index {
|
||||
if(!group || !self.parent) {
|
||||
return; // Nothing to be moved about
|
||||
}
|
||||
NSUInteger oldIndex = [self.parent.entries indexOfObject:self];
|
||||
if(oldIndex == NSNotFound) {
|
||||
return; // Not found in entries of parent!
|
||||
}
|
||||
[[[self undoManager] prepareWithInvocationTarget:self] moveToGroupUndoable:self.parent atIndex:oldIndex];
|
||||
MPSetActionName(@"MOVE_ENTRY", "Move Entry")
|
||||
[self.parent removeObjectFromEntriesAtIndex:oldIndex];
|
||||
[group insertObject:self inEntriesAtIndex:index];
|
||||
[self _moveToGroup:group atIndex:index actionName:NSLocalizedString(@"MOVE_ENTRY", "Move Group")];
|
||||
}
|
||||
|
||||
- (void)moveToTrashUndoable:(KdbGroup *)trash atIndex:(NSUInteger)index {
|
||||
if(!trash || !self.parent) {
|
||||
return; // Nothing to be moved about
|
||||
}
|
||||
NSUInteger oldIndex = [self.parent.entries indexOfObject:self];
|
||||
if(oldIndex == NSNotFound) {
|
||||
return; // Not found in entries of parent!
|
||||
}
|
||||
[[[self undoManager] prepareWithInvocationTarget:self] restoreFromTrashUndoable:self.parent atIndex:oldIndex];
|
||||
MPSetActionName(@"MOVE_ENTRY_TO_TRASH", "Move Entryo to Trash")
|
||||
[self.parent removeObjectFromEntriesAtIndex:oldIndex];
|
||||
[trash insertObject:self inEntriesAtIndex:index];
|
||||
[self _moveToGroup:trash atIndex:index actionName:NSLocalizedString(@"MOVE_ENTRY_TO_TRASH", "Move Entryo to Trash")];
|
||||
}
|
||||
|
||||
- (void)restoreFromTrashUndoable:(KdbGroup *)group atIndex:(NSUInteger)index {
|
||||
- (void)_moveToGroup:(KdbGroup *)group atIndex:(NSUInteger)index actionName:(NSString *)name {
|
||||
if(!group || !self.parent) {
|
||||
return; // Nothing to be moved about
|
||||
}
|
||||
@@ -134,11 +142,16 @@ if(![[self undoManager] isUndoing]) {\
|
||||
if(oldIndex == NSNotFound) {
|
||||
return; // Not found in entries of parent!
|
||||
}
|
||||
[[[self undoManager] prepareWithInvocationTarget:self] moveToTrashUndoable:self.parent atIndex:oldIndex];
|
||||
MPSetActionName(@"RESTORE_ENTRY", "Restore Entry from Trash")
|
||||
[[[self undoManager] prepareWithInvocationTarget:self] _moveToGroup:self.parent atIndex:oldIndex actionName:name];
|
||||
|
||||
if(![[self undoManager] isUndoing]) {
|
||||
[[self undoManager] setActionName:name];
|
||||
}
|
||||
|
||||
[self.parent removeObjectFromEntriesAtIndex:oldIndex];
|
||||
[group insertObject:self inEntriesAtIndex:index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -24,13 +24,12 @@
|
||||
}
|
||||
|
||||
- (void)clear {
|
||||
for(KdbGroup *group in self.groups) {
|
||||
[group clear];
|
||||
NSUInteger index = [self.groups indexOfObject:group];
|
||||
NSUInteger groupCount = [_groups count];
|
||||
for(NSInteger index = (groupCount - 1); index > -1; index--) {
|
||||
[self removeObjectFromGroupsAtIndex:index];
|
||||
}
|
||||
for(KdbEntry *entry in self.entries) {
|
||||
NSUInteger index = [self.entries indexOfObject:entry];
|
||||
NSUInteger entryCount = [_entries count];
|
||||
for(NSInteger index = (entryCount - 1); index > -1; index--) {
|
||||
[self removeObjectFromEntriesAtIndex:index];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,8 +408,14 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
#pragma mark Actions
|
||||
|
||||
- (void)emptyTrash:(id)sender {
|
||||
for(KdbEntry *entry in [self.trash childEntries]) {
|
||||
[[self undoManager] removeAllActionsWithTarget:entry];
|
||||
}
|
||||
for(KdbGroup *group in [self.trash childGroups]) {
|
||||
[[self undoManager] removeAllActionsWithTarget:group];
|
||||
}
|
||||
|
||||
[self.trash clear];
|
||||
// TODO: Notify that entries should be deslected
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
|
||||
|
||||
@@ -124,7 +124,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
[self.entryTable setDoubleAction:@selector(_columnDoubleClick:)];
|
||||
[self.entryTable setTarget:self];
|
||||
[self.entryTable setFloatsGroupRows:NO];
|
||||
[self.entryTable registerForDraggedTypes:@[MPPasteBoardType]];
|
||||
//[self.entryTable registerForDraggedTypes:@[MPPasteBoardType]];
|
||||
[self _setupEntryMenu];
|
||||
|
||||
NSTableColumn *parentColumn = [self.entryTable tableColumns][0];
|
||||
|
||||
@@ -64,7 +64,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
[_outlineView setMenu:[self _contextMenu]];
|
||||
[_outlineView setAllowsEmptySelection:YES];
|
||||
[_outlineView setFloatsGroupRows:NO];
|
||||
[_outlineView registerForDraggedTypes:@[ MPPasteBoardType ]];
|
||||
//[_outlineView registerForDraggedTypes:@[ MPPasteBoardType ]];
|
||||
[_outlineView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES];
|
||||
[_bottomBar setBorderType:HNHBorderTop];
|
||||
[_addGroupButton setAction:[MPActionHelper actionOfType:MPActionAddGroup]];
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2331</string>
|
||||
<string>2335</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
Reference in New Issue
Block a user