Added warning image to FixAutotypeDialog to indicate possible MacPass corruptions

This commit is contained in:
michael starke
2014-03-30 14:11:26 +02:00
parent e8a0e0f0a3
commit 3d8c0acf64
6 changed files with 83 additions and 22 deletions

View File

@@ -14,9 +14,12 @@
#import "KPKAutotype.h"
#import "KPKWindowAssociation.h"
#import "MPIconHelper.h"
NSString *const kMPAutotypeCell = @"AutotypeCell";
NSString *const kMPTitleCell = @"TitleCell";
NSString *const kMPIsDefaultCell = @"IsDefaultCell";
NSString *const kMPIconCell = @"IconCell";
/* Helper Categries */
@@ -63,6 +66,10 @@ NSString *const kMPIsDefaultCell = @"IsDefaultCell";
[super windowDidLoad];
}
- (void)dealloc {
[self.window orderOut:self];
}
#pragma mark -
#pragma mark Properties
@@ -139,18 +146,28 @@ NSString *const kMPIsDefaultCell = @"IsDefaultCell";
}
return association.keystrokeSequence;
}
else if([[tableColumn identifier] isEqualToString:kMPIsDefaultCell]) {
else {
BOOL isDefault = NO;
NSString *keystrokeSequence;
if(entry) {
isDefault = entry.autotype.hasDefaultKeystrokeSequence;
keystrokeSequence = entry.autotype.defaultKeystrokeSequence;
}
else if( group ) {
isDefault = group.hasDefaultAutotypeSequence;
keystrokeSequence = group.defaultAutoTypeSequence;
}
else {
isDefault = association.hasDefaultKeystrokeSequence;
keystrokeSequence = association.keystrokeSequence;
}
if([[tableColumn identifier] isEqualToString:kMPIsDefaultCell]) {
return isDefault ? @"Yes" : @"No";
}
else if( [[tableColumn identifier] isEqualToString:kMPIconCell]) {
BOOL isWrongFormat = (NSOrderedSame == [@"{TAB}{USERNAME}{TAB}{PASSWORD}{ENTER}" compare:keystrokeSequence options:NSCaseInsensitiveSearch]);
return (isWrongFormat && !isDefault) ? [MPIconHelper icon:MPIconWarning] : nil;
}
return isDefault ? @"Yes" : @"No";
}
return nil;
}
@@ -182,6 +199,16 @@ NSString *const kMPIsDefaultCell = @"IsDefaultCell";
return [item isKindOfClass:[KPKGroup class]];
}
#pragma mark -
#pragma mark MenuItem Validation
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
if(!([menuItem action] == @selector(clearAutotype:))) {
return NO;
}
return ([[self.tableView selectedRowIndexes] count] > 0);
}
#pragma mark -
#pragma mark Data accessors