mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-19 03:49:21 +00:00
Added warning image to FixAutotypeDialog to indicate possible MacPass corruptions
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user