mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-24 01:49:20 +00:00
32 lines
683 B
Objective-C
32 lines
683 B
Objective-C
//
|
|
// MPAutotypeSpecialKey.m
|
|
// MacPass
|
|
//
|
|
// Created by Michael Starke on 24/11/13.
|
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
|
//
|
|
|
|
#import "MPAutotypeKeyPress.h"
|
|
#import "MPKeyMapper.h"
|
|
|
|
@implementation MPAutotypeKeyPress
|
|
|
|
- (void)execute {
|
|
if(![self isValid]) {
|
|
return; // no valid command. Stop.
|
|
}
|
|
CGKeyCode mappedKey = [self _transformKeyCode];
|
|
[self sendPressKey:mappedKey modifierFlags:self.modifierMask];
|
|
}
|
|
|
|
- (BOOL)isValid {
|
|
return ([self _transformKeyCode] != kMPUnknownKeyCode);
|
|
}
|
|
|
|
- (CGKeyCode)_transformKeyCode {
|
|
NSString *key = [MPKeyMapper stringForKey:self.keyCode];
|
|
return [MPKeyMapper keyCodeForCharacter:key];
|
|
}
|
|
|
|
@end
|