Using new KeePassKit API for Tags

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-09-30 18:55:01 +02:00
parent 6e3af144bc
commit 6d3a021cb6
4 changed files with 50 additions and 2 deletions

View File

@@ -91,8 +91,7 @@
}
/* test for tags */
if(matchTags && !foundMatch) {
NSArray *tags = [entry.tags componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@".:;"]];
for(NSString *tag in tags) {
for(NSString *tag in entry.tags) {
foundMatch = ([windowTitle rangeOfString:tag options:NSCaseInsensitiveSearch].length != 0);
if(foundMatch) {
break;

View File

@@ -0,0 +1,13 @@
//
// MPTagsTokenFieldDelegate.h
// MacPass
//
// Created by Michael Starke on 30/09/15.
// Copyright © 2015 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface MPTagsTokenFieldDelegate : NSObject <NSTokenFieldDelegate>
@end

View File

@@ -0,0 +1,30 @@
//
// MPTagsTokenFieldDelegate.m
// MacPass
//
// Created by Michael Starke on 30/09/15.
// Copyright © 2015 HicknHack Software GmbH. All rights reserved.
//
#import "MPTagsTokenFieldDelegate.h"
@implementation MPTagsTokenFieldDelegate
// Each element in the array should be an NSString or an array of NSStrings.
// substring is the partial string that is being completed. tokenIndex is the index of the token being completed.
// selectedIndex allows you to return by reference an index specifying which of the completions should be selected initially.
// The default behavior is not to have any completions.
//- (nullable NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(nullable NSInteger *)selectedIndex;
// return an array of represented objects you want to add.
// If you want to reject the add, return an empty array.
// returning nil will cause an error.
//- (NSArray *)tokenField:(NSTokenField *)tokenField shouldAddObjects:(NSArray *)tokens atIndex:(NSUInteger)index;
// If you return nil or don't implement these delegate methods, we will assume
// editing string = display string = represented object
//- (nullable NSString *)tokenField:(NSTokenField *)tokenField displayStringForRepresentedObject:(id)representedObject;
//- (nullable NSString *)tokenField:(NSTokenField *)tokenField editingStringForRepresentedObject:(id)representedObject;
//- (id)tokenField:(NSTokenField *)tokenField representedObjectForEditingString: (NSString *)editingString;
@end