mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 16:22:21 +00:00
Moder Objective-C. Adoping changed KeePassKit API
Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
@@ -256,6 +256,7 @@
|
|||||||
4C80BB6F176DE06F00E5E248 /* HNHScrollDocumentViewAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C80BB6E176DE06F00E5E248 /* HNHScrollDocumentViewAdapter.m */; };
|
4C80BB6F176DE06F00E5E248 /* HNHScrollDocumentViewAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C80BB6E176DE06F00E5E248 /* HNHScrollDocumentViewAdapter.m */; };
|
||||||
4C811C8316ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C811C8216ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m */; };
|
4C811C8316ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C811C8216ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m */; };
|
||||||
4C83814215BF4677001AE468 /* MPDocumentWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C83814115BF4677001AE468 /* MPDocumentWindowController.m */; };
|
4C83814215BF4677001AE468 /* MPDocumentWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C83814115BF4677001AE468 /* MPDocumentWindowController.m */; };
|
||||||
|
4C8775201B70CA4B00069609 /* KPKTestUndo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C87751F1B70CA4B00069609 /* KPKTestUndo.m */; };
|
||||||
4C888C9016EB6C91003D34A1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C888C8E16EB6C91003D34A1 /* Localizable.strings */; };
|
4C888C9016EB6C91003D34A1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C888C8E16EB6C91003D34A1 /* Localizable.strings */; };
|
||||||
4C888C9316EB6F5E003D34A1 /* MPToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C888C9216EB6F5E003D34A1 /* MPToolbarItem.m */; };
|
4C888C9316EB6F5E003D34A1 /* MPToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C888C9216EB6F5E003D34A1 /* MPToolbarItem.m */; };
|
||||||
4C888C9716EB754B003D34A1 /* MPActionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C888C9616EB754B003D34A1 /* MPActionHelper.m */; };
|
4C888C9716EB754B003D34A1 /* MPActionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C888C9616EB754B003D34A1 /* MPActionHelper.m */; };
|
||||||
@@ -854,6 +855,7 @@
|
|||||||
4C811C8216ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPKeyfilePathControlDelegate.m; sourceTree = "<group>"; };
|
4C811C8216ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPKeyfilePathControlDelegate.m; sourceTree = "<group>"; };
|
||||||
4C83814015BF4677001AE468 /* MPDocumentWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocumentWindowController.h; sourceTree = "<group>"; };
|
4C83814015BF4677001AE468 /* MPDocumentWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocumentWindowController.h; sourceTree = "<group>"; };
|
||||||
4C83814115BF4677001AE468 /* MPDocumentWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentWindowController.m; sourceTree = "<group>"; };
|
4C83814115BF4677001AE468 /* MPDocumentWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentWindowController.m; sourceTree = "<group>"; };
|
||||||
|
4C87751F1B70CA4B00069609 /* KPKTestUndo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestUndo.m; sourceTree = "<group>"; };
|
||||||
4C888C8F16EB6C91003D34A1 /* en */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; };
|
4C888C8F16EB6C91003D34A1 /* en */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; };
|
||||||
4C888C9116EB6F5E003D34A1 /* MPToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPToolbarItem.h; sourceTree = "<group>"; };
|
4C888C9116EB6F5E003D34A1 /* MPToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPToolbarItem.h; sourceTree = "<group>"; };
|
||||||
4C888C9216EB6F5E003D34A1 /* MPToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPToolbarItem.m; sourceTree = "<group>"; };
|
4C888C9216EB6F5E003D34A1 /* MPToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPToolbarItem.m; sourceTree = "<group>"; };
|
||||||
@@ -1602,6 +1604,7 @@
|
|||||||
4C59745018B3CE7200C8EBD1 /* KPKTestAutotype.m */,
|
4C59745018B3CE7200C8EBD1 /* KPKTestAutotype.m */,
|
||||||
4C3F25201A3B0C95007DD98B /* KPKTextXMLUtilities.m */,
|
4C3F25201A3B0C95007DD98B /* KPKTextXMLUtilities.m */,
|
||||||
4C4B6E3D1B5E56600082EEF2 /* KPKTestEntryLookup.m */,
|
4C4B6E3D1B5E56600082EEF2 /* KPKTestEntryLookup.m */,
|
||||||
|
4C87751F1B70CA4B00069609 /* KPKTestUndo.m */,
|
||||||
);
|
);
|
||||||
name = KeePassKit;
|
name = KeePassKit;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2534,6 +2537,7 @@
|
|||||||
4C19E503178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m in Sources */,
|
4C19E503178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m in Sources */,
|
||||||
4C305F3C179A19F90082334F /* KPKIconLoading.m in Sources */,
|
4C305F3C179A19F90082334F /* KPKIconLoading.m in Sources */,
|
||||||
4C1842B8179B348600E2F5BC /* KPKTestLegacyLoading.m in Sources */,
|
4C1842B8179B348600E2F5BC /* KPKTestLegacyLoading.m in Sources */,
|
||||||
|
4C8775201B70CA4B00069609 /* KPKTestUndo.m in Sources */,
|
||||||
4C6BC6601A36717E00BDDF3D /* MPDatabaseSearch.m in Sources */,
|
4C6BC6601A36717E00BDDF3D /* MPDatabaseSearch.m in Sources */,
|
||||||
4CFC8743179DFD3E000DFC03 /* KPKTestXmlLoading.m in Sources */,
|
4CFC8743179DFD3E000DFC03 /* KPKTestXmlLoading.m in Sources */,
|
||||||
4C79E80617A9400500AC6CD2 /* KPKTestNSCoding.m in Sources */,
|
4C79E80617A9400500AC6CD2 /* KPKTestNSCoding.m in Sources */,
|
||||||
|
|||||||
@@ -253,12 +253,12 @@
|
|||||||
|
|
||||||
- (void)_updateTrashFolders:(KPKTree *)tree {
|
- (void)_updateTrashFolders:(KPKTree *)tree {
|
||||||
NSMenu *menu = [self _buildTrashTreeMenu:tree];
|
NSMenu *menu = [self _buildTrashTreeMenu:tree];
|
||||||
[self.selectTrashGoupPopUpButton setMenu:menu];
|
self.selectTrashGoupPopUpButton.menu = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_updateTemplateGroup:(KPKTree *)tree {
|
- (void)_updateTemplateGroup:(KPKTree *)tree {
|
||||||
NSMenu *menu = [self _buildTemplateTreeMenu:tree];
|
NSMenu *menu = [self _buildTemplateTreeMenu:tree];
|
||||||
[self.templateGroupPopUpButton setMenu:menu];
|
self.templateGroupPopUpButton.menu = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMenu *)_buildTrashTreeMenu:(KPKTree *)tree {
|
- (NSMenu *)_buildTrashTreeMenu:(KPKTree *)tree {
|
||||||
@@ -267,7 +267,7 @@
|
|||||||
NSMenuItem *selectItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOCREATE_TRASH_FOLDER", @"Menu item for automatic trash creation")
|
NSMenuItem *selectItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AUTOCREATE_TRASH_FOLDER", @"Menu item for automatic trash creation")
|
||||||
action:NULL
|
action:NULL
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[selectItem setEnabled:YES];
|
selectItem.enabled = YES;
|
||||||
[menu insertItem:selectItem atIndex:0];
|
[menu insertItem:selectItem atIndex:0];
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
@@ -279,7 +279,7 @@
|
|||||||
NSMenuItem *selectItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"NO_TEMPLATE_GROUP", @"Menu item to reset the template groups")
|
NSMenuItem *selectItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"NO_TEMPLATE_GROUP", @"Menu item to reset the template groups")
|
||||||
action:NULL
|
action:NULL
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[selectItem setEnabled:YES];
|
selectItem.enabled = YES;
|
||||||
[menu insertItem:selectItem atIndex:0];
|
[menu insertItem:selectItem atIndex:0];
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
@@ -288,7 +288,7 @@
|
|||||||
|
|
||||||
- (NSMenu *)_buildTreeMenu:(KPKTree *)tree preselect:(NSUUID *)uuid {
|
- (NSMenu *)_buildTreeMenu:(KPKTree *)tree preselect:(NSUUID *)uuid {
|
||||||
NSMenu *menu = [[NSMenu alloc] init];
|
NSMenu *menu = [[NSMenu alloc] init];
|
||||||
[menu setAutoenablesItems:NO];
|
menu.autoenablesItems = NO;
|
||||||
for(KPKGroup *group in tree.root.groups) {
|
for(KPKGroup *group in tree.root.groups) {
|
||||||
[self _insertMenuItemsForGroup:group atLevel:0 inMenu:menu preselect:uuid];
|
[self _insertMenuItemsForGroup:group atLevel:0 inMenu:menu preselect:uuid];
|
||||||
}
|
}
|
||||||
@@ -297,14 +297,14 @@
|
|||||||
|
|
||||||
- (void)_insertMenuItemsForGroup:(KPKGroup *)group atLevel:(NSUInteger)level inMenu:(NSMenu *)menu preselect:(NSUUID *)uuid{
|
- (void)_insertMenuItemsForGroup:(KPKGroup *)group atLevel:(NSUInteger)level inMenu:(NSMenu *)menu preselect:(NSUUID *)uuid{
|
||||||
NSMenuItem *groupItem = [[NSMenuItem alloc] init];
|
NSMenuItem *groupItem = [[NSMenuItem alloc] init];
|
||||||
[groupItem setImage:group.iconImage];
|
groupItem.image = group.iconImage;
|
||||||
[groupItem setTitle:group.name];
|
groupItem.title = group.title;
|
||||||
[groupItem setRepresentedObject:group];
|
groupItem.representedObject = group;
|
||||||
[groupItem setEnabled:YES];
|
groupItem.enabled = YES;
|
||||||
if(uuid && [group.uuid isEqual:uuid]) {
|
if(uuid && [group.uuid isEqual:uuid]) {
|
||||||
[groupItem setState:NSOnState];
|
groupItem.state = NSOnState;
|
||||||
}
|
}
|
||||||
[groupItem setIndentationLevel:level];
|
groupItem.indentationLevel = level;
|
||||||
[menu addItem:groupItem];
|
[menu addItem:groupItem];
|
||||||
for(KPKGroup *childGroup in group.groups) {
|
for(KPKGroup *childGroup in group.groups) {
|
||||||
[self _insertMenuItemsForGroup:childGroup atLevel:level + 1 inMenu:menu preselect:uuid];
|
[self _insertMenuItemsForGroup:childGroup atLevel:level + 1 inMenu:menu preselect:uuid];
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
|||||||
return nil; // no new Groups in trash
|
return nil; // no new Groups in trash
|
||||||
}
|
}
|
||||||
KPKGroup *newGroup = [self.tree createGroup:parent];
|
KPKGroup *newGroup = [self.tree createGroup:parent];
|
||||||
newGroup.name = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
newGroup.title = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
||||||
newGroup.iconId = MPIconFolder;
|
newGroup.iconId = MPIconFolder;
|
||||||
[parent addGroup:newGroup];
|
[parent addGroup:newGroup];
|
||||||
NSDictionary *userInfo = @{ MPDocumentGroupKey : newGroup };
|
NSDictionary *userInfo = @{ MPDocumentGroupKey : newGroup };
|
||||||
@@ -615,7 +615,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
|||||||
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];
|
KPKEntry *copy = [templateEntry copyWithTitle:templateEntry.title options:kKPKCopyOptionNone];
|
||||||
[self.selectedGroup addEntry:copy];
|
[self.selectedGroup addEntry:copy];
|
||||||
[self.selectedGroup.undoManager setActionName:NSLocalizedString(@"ADD_TREMPLATE_ENTRY", "")];
|
[self.selectedGroup.undoManager setActionName:NSLocalizedString(@"ADD_TREMPLATE_ENTRY", "")];
|
||||||
}
|
}
|
||||||
@@ -623,7 +623,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)duplicateEntry:(id)sender {
|
- (void)duplicateEntry:(id)sender {
|
||||||
KPKEntry *duplicate = [self.selectedEntry copyWithTitle:nil];
|
KPKEntry *duplicate = [self.selectedEntry copyWithTitle:nil options:kKPKCopyOptionNone];
|
||||||
[self.selectedEntry.parent addEntry:duplicate];
|
[self.selectedEntry.parent addEntry:duplicate];
|
||||||
[self.undoManager setActionName:NSLocalizedString(@"DUPLICATE_ENTRY", "")];
|
[self.undoManager setActionName:NSLocalizedString(@"DUPLICATE_ENTRY", "")];
|
||||||
}
|
}
|
||||||
@@ -751,7 +751,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
|||||||
KPKGroup *trash = [self.tree createGroup:self.tree.root];
|
KPKGroup *trash = [self.tree createGroup:self.tree.root];
|
||||||
BOOL wasEnabled = [self.undoManager isUndoRegistrationEnabled];
|
BOOL wasEnabled = [self.undoManager isUndoRegistrationEnabled];
|
||||||
[self.undoManager disableUndoRegistration];
|
[self.undoManager disableUndoRegistration];
|
||||||
trash.name = NSLocalizedString(@"TRASH", @"Name for the trash group");
|
trash.title = NSLocalizedString(@"TRASH", @"Name for the trash group");
|
||||||
trash.iconId = MPIconTrash;
|
trash.iconId = MPIconTrash;
|
||||||
[self.tree.root addGroup:trash];
|
[self.tree.root addGroup:trash];
|
||||||
if(wasEnabled) {
|
if(wasEnabled) {
|
||||||
|
|||||||
@@ -169,12 +169,12 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
|
|||||||
self.entryTable.autosaveTableColumns = YES;
|
self.entryTable.autosaveTableColumns = YES;
|
||||||
|
|
||||||
|
|
||||||
NSString *parentNameKeyPath = [[NSString alloc] initWithFormat:@"%@.%@", NSStringFromSelector(@selector(parent)), NSStringFromSelector(@selector(name))];
|
NSString *parentTitleKeyPath = [[NSString alloc] initWithFormat:@"%@.%@", NSStringFromSelector(@selector(parent)), NSStringFromSelector(@selector(title))];
|
||||||
|
|
||||||
titleColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(title))ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
titleColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(title))ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||||
userNameColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(username)) ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
userNameColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(username)) ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||||
urlColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(url)) ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
urlColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(url)) ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||||
parentColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:parentNameKeyPath ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
parentColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:parentTitleKeyPath ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||||
modifiedColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:[MPEntryViewController timeInfoModificationTimeKeyPath] ascending:YES selector:@selector(compare:)];
|
modifiedColumn.sortDescriptorPrototype = [NSSortDescriptor sortDescriptorWithKey:[MPEntryViewController timeInfoModificationTimeKeyPath] ascending:YES selector:@selector(compare:)];
|
||||||
|
|
||||||
[parentColumn.headerCell setStringValue:NSLocalizedString(@"GROUP", "")];
|
[parentColumn.headerCell setStringValue:NSLocalizedString(@"GROUP", "")];
|
||||||
@@ -276,15 +276,15 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
|
|||||||
KPKEntry *entry = [self.entryArrayController arrangedObjects][row];
|
KPKEntry *entry = [self.entryArrayController arrangedObjects][row];
|
||||||
NSAssert(entry.parent != nil, @"Entry needs to have a parent");
|
NSAssert(entry.parent != nil, @"Entry needs to have a parent");
|
||||||
|
|
||||||
NSString *parentNameKeyPath = [NSString stringWithFormat:@"%@.%@.%@",
|
NSString *parentTitleKeyPath = [NSString stringWithFormat:@"%@.%@.%@",
|
||||||
NSStringFromSelector(@selector(objectValue)),
|
NSStringFromSelector(@selector(objectValue)),
|
||||||
NSStringFromSelector(@selector(parent)),
|
NSStringFromSelector(@selector(parent)),
|
||||||
NSStringFromSelector(@selector(name))];
|
NSStringFromSelector(@selector(title))];
|
||||||
NSString *parentIconImageKeyPath = [NSString stringWithFormat:@"%@.%@.%@",
|
NSString *parentIconImageKeyPath = [NSString stringWithFormat:@"%@.%@.%@",
|
||||||
NSStringFromSelector(@selector(objectValue)),
|
NSStringFromSelector(@selector(objectValue)),
|
||||||
NSStringFromSelector(@selector(parent)),
|
NSStringFromSelector(@selector(parent)),
|
||||||
NSStringFromSelector(@selector(iconImage))];
|
NSStringFromSelector(@selector(iconImage))];
|
||||||
[view.textField bind:NSValueBinding toObject:view withKeyPath:parentNameKeyPath options:nil];
|
[view.textField bind:NSValueBinding toObject:view withKeyPath:parentTitleKeyPath options:nil];
|
||||||
[view.imageView bind:NSValueBinding toObject:view withKeyPath:parentIconImageKeyPath options:nil];
|
[view.imageView bind:NSValueBinding toObject:view withKeyPath:parentIconImageKeyPath options:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
- (void)_updateBindings {
|
- (void)_updateBindings {
|
||||||
if(self.group) {
|
if(self.group) {
|
||||||
[self.titleTextField bind:NSValueBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(name)) options:nil];
|
[self.titleTextField bind:NSValueBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(title)) options:nil];
|
||||||
[self.expiresCheckButton bind:NSValueBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil];
|
[self.expiresCheckButton bind:NSValueBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil];
|
||||||
[self.expiresCheckButton bind:NSTitleBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expirationDate)) options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
|
[self.expiresCheckButton bind:NSTitleBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expirationDate)) options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
|
||||||
[self.autotypePopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(isAutoTypeEnabled)) options:nil];
|
[self.autotypePopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(isAutoTypeEnabled)) options:nil];
|
||||||
|
|||||||
@@ -285,12 +285,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
[self.itemImageView bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(iconImage)) options:nil];
|
[self.itemImageView bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(iconImage)) options:nil];
|
||||||
[[self.notesTextView enclosingScrollView] setHidden:NO];
|
[[self.notesTextView enclosingScrollView] setHidden:NO];
|
||||||
[self.notesTextView bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(notes)) options:nil];
|
[self.notesTextView bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(notes)) options:nil];
|
||||||
if([item respondsToSelector:@selector(title)]) {
|
|
||||||
[self.itemNameTextField bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(title)) options:nil];
|
[self.itemNameTextField bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(title)) options:nil];
|
||||||
}
|
|
||||||
else if( [item respondsToSelector:@selector(name)]) {
|
|
||||||
[self.itemNameTextField bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(name)) options:nil];
|
|
||||||
}
|
|
||||||
[self.itemImageView setHidden:NO];
|
[self.itemImageView setHidden:NO];
|
||||||
[self.itemNameTextField setHidden:NO];
|
[self.itemNameTextField setHidden:NO];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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];
|
draggedGroup = [draggedGroup copyWithTitle:nil options:kKPKCopyOptionNone];
|
||||||
[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];
|
draggedEntry = [draggedEntry copyWithTitle:nil options:kKPKCopyOptionNone];
|
||||||
[targetGroup addEntry:draggedEntry];
|
[targetGroup addEntry:draggedEntry];
|
||||||
[targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_ENTRY", "")];
|
[targetGroup.undoManager setActionName:NSLocalizedString(@"COPY_ENTRY", "")];
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -216,9 +216,9 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self];
|
view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self];
|
||||||
|
|
||||||
NSString *iconImageKeyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(iconImage))];
|
NSString *iconImageKeyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(iconImage))];
|
||||||
NSString *nameKeyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(name))];
|
NSString *titleKeyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(title))];
|
||||||
[[view imageView] bind:NSValueBinding toObject:item withKeyPath:iconImageKeyPath options:nil];
|
[[view imageView] bind:NSValueBinding toObject:item withKeyPath:iconImageKeyPath options:nil];
|
||||||
[[view textField] bind:NSValueBinding toObject:item withKeyPath:nameKeyPath options:nil];
|
[[view textField] bind:NSValueBinding toObject:item withKeyPath:titleKeyPath options:nil];
|
||||||
|
|
||||||
|
|
||||||
NSString *entriesCountKeyPath = [[NSString alloc] initWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(entries)), @"@count"];
|
NSString *entriesCountKeyPath = [[NSString alloc] initWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(entries)), @"@count"];
|
||||||
|
|||||||
@@ -102,7 +102,7 @@
|
|||||||
|
|
||||||
- (void)testGroupCoding {
|
- (void)testGroupCoding {
|
||||||
KPKGroup *group = [[KPKGroup alloc] init];
|
KPKGroup *group = [[KPKGroup alloc] init];
|
||||||
group.name = @"A Group";
|
group.title = @"A Group";
|
||||||
group.iconId = 50;
|
group.iconId = 50;
|
||||||
group.notes = @"Some notes";
|
group.notes = @"Some notes";
|
||||||
KPKEntry *entry = [[KPKEntry alloc] init];
|
KPKEntry *entry = [[KPKEntry alloc] init];
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
KPKGroup *decodedGroup = [self decode:data ofClass:[KPKGroup class]];
|
KPKGroup *decodedGroup = [self decode:data ofClass:[KPKGroup class]];
|
||||||
|
|
||||||
XCTAssertTrue([group.uuid isEqual:decodedGroup.uuid]);
|
XCTAssertTrue([group.uuid isEqual:decodedGroup.uuid]);
|
||||||
XCTAssertTrue([group.name isEqualToString:decodedGroup.name]);
|
XCTAssertTrue([group.title isEqualToString:decodedGroup.title]);
|
||||||
XCTAssertEqual([group.entries count], [decodedGroup.entries count]);
|
XCTAssertEqual([group.entries count], [decodedGroup.entries count]);
|
||||||
XCTAssertEqual(group.iconId, decodedGroup.iconId);
|
XCTAssertEqual(group.iconId, decodedGroup.iconId);
|
||||||
XCTAssertTrue([group.notes isEqualToString:decodedGroup.notes]);
|
XCTAssertTrue([group.notes isEqualToString:decodedGroup.notes]);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
self.tree = [[KPKTree alloc] init];
|
self.tree = [[KPKTree alloc] init];
|
||||||
|
|
||||||
self.tree.root = [[KPKGroup alloc] init];
|
self.tree.root = [[KPKGroup alloc] init];
|
||||||
self.tree.root.name = @"Root";
|
self.tree.root.title = @"Root";
|
||||||
|
|
||||||
KPKEntry *entry1 = [self.tree createEntry:self.tree.root];
|
KPKEntry *entry1 = [self.tree createEntry:self.tree.root];
|
||||||
KPKEntry *entry2 = [self.tree createEntry:self.tree.root];
|
KPKEntry *entry2 = [self.tree createEntry:self.tree.root];
|
||||||
|
|||||||
100
MacPassTests/KPKTestUndo.m
Normal file
100
MacPassTests/KPKTestUndo.m
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
//
|
||||||
|
// KPKUndo.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 04/08/15.
|
||||||
|
// Copyright (c) 2015 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <XCTest/XCTest.h>
|
||||||
|
|
||||||
|
#import "KPKTree.h"
|
||||||
|
#import "KPKGroup.h"
|
||||||
|
#import "KPKEntry.h"
|
||||||
|
|
||||||
|
@interface KPKTestUndo : XCTestCase <KPKTreeDelegate> {
|
||||||
|
NSUndoManager *_undoManager;
|
||||||
|
KPKTree *_tree;
|
||||||
|
KPKGroup *_groupA, *_groupB;
|
||||||
|
KPKEntry *_entryA, *_entryB;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KPKTestUndo
|
||||||
|
|
||||||
|
- (NSUndoManager *)undoManagerForTree:(KPKTree *)tree {
|
||||||
|
return _undoManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setUp {
|
||||||
|
[super setUp];
|
||||||
|
_undoManager = [[NSUndoManager alloc] init];
|
||||||
|
_tree = [[KPKTree alloc] init];
|
||||||
|
_tree.delegate = self;
|
||||||
|
|
||||||
|
_groupA = [[KPKGroup alloc] init];
|
||||||
|
_groupB = [[KPKGroup alloc] init];
|
||||||
|
_entryA = [[KPKEntry alloc] init];
|
||||||
|
_entryB = [[KPKEntry alloc] init];
|
||||||
|
|
||||||
|
[_undoManager disableUndoRegistration];
|
||||||
|
[_undoManager enableUndoRegistration];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tearDown {
|
||||||
|
_undoManager = nil;
|
||||||
|
[super tearDown];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoCreateEntry {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoCreateGroup {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoCopyEntry {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoCopyGroup {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoMoveEntry {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoMoveGroup {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoDeleteGroupWithoutTrash {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoDeleteEntryWithoutTrash {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoDeleteGroupWithTrash {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoDeleteEntryWithTrash {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoEditEntry {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testUndoRedoEditGroup {
|
||||||
|
XCTFail(@"Missing Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
Reference in New Issue
Block a user