mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 08:12:28 +00:00
Newly created Groups now get shown by expanding theri parent node after creation. Selection not working for now
This commit is contained in:
Submodule KeePassKit updated: 4aaf8d2642...1b5da6d4f6
@@ -23,15 +23,24 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "KPKVersion.h"
|
||||
|
||||
/**
|
||||
* Postes when a new group was added by the document. This is only fired when the user caused this by adding. Undo/Redo does NOT post this
|
||||
* The userInfo dictionary conatins one the added group at MPDocumentGroupKey
|
||||
*/
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidAddGroupNotification;
|
||||
/**
|
||||
* Posted when the used has added a new entry. Not posted on undo/redo.
|
||||
* The userInfo dictionary contains the added entry at MPDocumentEntryKey
|
||||
*/
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidAddEntryNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidRevertNotifiation;
|
||||
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidLockDatabaseNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidUnlockDatabaseNotification;
|
||||
|
||||
FOUNDATION_EXTERN NSString *const MPDocumentCurrentItemChangedNotification;
|
||||
FOUNDATION_EXTERN NSString *const MPDocumentDidAddEntryNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentCurrentItemChangedNotification;
|
||||
|
||||
/* Keys used in userInfo NSDictionaries on notifications */
|
||||
APPKIT_EXTERN NSString *const MPDocumentEntryKey;
|
||||
APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
|
||||
|
||||
@@ -47,13 +47,14 @@
|
||||
#import "NSString+MPPasswordCreation.h"
|
||||
|
||||
NSString *const MPDocumentDidAddGroupNotification = @"com.hicknhack.macpass.MPDocumentDidAddGroupNotification";
|
||||
NSString *const MPDocumentDidAddEntryNotification = @"com.hicknhack.macpass.MPDocumentDidAddEntryNotification";
|
||||
|
||||
NSString *const MPDocumentDidRevertNotifiation = @"com.hicknhack.macpass.MPDocumentDidRevertNotifiation";
|
||||
|
||||
NSString *const MPDocumentDidLockDatabaseNotification = @"com.hicknhack.macpass.MPDocumentDidLockDatabaseNotification";
|
||||
NSString *const MPDocumentDidUnlockDatabaseNotification = @"com.hicknhack.macpass.MPDocumentDidUnlockDatabaseNotification";
|
||||
|
||||
NSString *const MPDocumentCurrentItemChangedNotification = @"com.hicknhack.macpass.MPDocumentCurrentItemChangedNotification";
|
||||
NSString *const MPDocumentDidAddEntryNotification = @"com.hicknhack.macpass.MPDocumentDidAddEntryNotification";
|
||||
|
||||
NSString *const MPDocumentEntryKey = @"MPDocumentEntryKey";
|
||||
NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
@@ -454,7 +455,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
||||
}
|
||||
[parent addEntry:newEntry];
|
||||
[parent.undoManager setActionName:NSLocalizedString(@"ADD_ENTRY", "")];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddEntryNotification object:self];
|
||||
NSDictionary *userInfo = @{ MPDocumentEntryKey: newEntry };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddEntryNotification object:self userInfo:userInfo];
|
||||
return newEntry;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,18 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
|
||||
# pragma mark MPDocument Notifications
|
||||
- (void)_didAddGroup:(NSNotification *)notification {
|
||||
//TODO: find group to expand!
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
KPKGroup *group = userInfo[MPDocumentGroupKey];
|
||||
NSIndexPath *groupIndexPath = [group indexPath];
|
||||
NSTreeNode *groupNode = [[self.treeController arrangedObjects] descendantNodeAtIndexPath:groupIndexPath];
|
||||
[self.outlineView expandItem:groupNode.parentNode];
|
||||
/* TODO: Select created Group
|
||||
NSUInteger row = 0;
|
||||
for(NSUInteger index = 0; index < [groupIndexPath length]; index++ ) {
|
||||
row += [groupIndexPath indexAtPosition:index];
|
||||
}
|
||||
[self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
|
||||
*/
|
||||
}
|
||||
|
||||
- (id)itemUnderMouse {
|
||||
@@ -242,6 +253,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
id representedObject = [item representedObject];
|
||||
if([representedObject isKindOfClass:[KPKGroup class]]) {
|
||||
KPKGroup *group = (KPKGroup *)representedObject;
|
||||
NSLog(@"IndexPath for %@: %@ vs. %@", group.name, [item indexPath], [group indexPath]);
|
||||
group.isExpanded = YES;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user