mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 08:12:28 +00:00
Interims commit. Broken. Doesn compile
This commit is contained in:
Submodule KeePassKit updated: 9d55d3370e...01c0baf945
@@ -205,7 +205,6 @@
|
||||
4CA0B2FC15BCAF8600654E32 /* MPSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0B2FB15BCAF8600654E32 /* MPSettingsWindowController.m */; };
|
||||
4CA0E3A7176FAF99004D18CB /* MPDocumentQueryService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */; };
|
||||
4CA2335A176DBFE100F0B6AC /* MPLockDaemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */; };
|
||||
4CA2E2DB17BCDA8300714076 /* NSString+Placeholder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA2E2DA17BCDA8300714076 /* NSString+Placeholder.m */; };
|
||||
4CAC614317AD319200023F9E /* KPKTestXmlParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAC614217AD319200023F9E /* KPKTestXmlParsing.m */; };
|
||||
4CAD747B15B887FD00104512 /* DDXMLElementAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD745715B887FD00104512 /* DDXMLElementAdditions.m */; };
|
||||
4CAD747C15B887FD00104512 /* NSString+DDXML.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD745A15B887FD00104512 /* NSString+DDXML.m */; };
|
||||
@@ -706,8 +705,6 @@
|
||||
4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentQueryService.m; sourceTree = "<group>"; };
|
||||
4CA23358176DBFE100F0B6AC /* MPLockDaemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLockDaemon.h; sourceTree = "<group>"; };
|
||||
4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPLockDaemon.m; sourceTree = "<group>"; };
|
||||
4CA2E2D917BCDA8300714076 /* NSString+Placeholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Placeholder.h"; sourceTree = "<group>"; };
|
||||
4CA2E2DA17BCDA8300714076 /* NSString+Placeholder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Placeholder.m"; sourceTree = "<group>"; };
|
||||
4CAAFDD51787AED60013FCF9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
4CAC614117AD319200023F9E /* KPKTestXmlParsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTestXmlParsing.h; sourceTree = "<group>"; };
|
||||
4CAC614217AD319200023F9E /* KPKTestXmlParsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestXmlParsing.m; sourceTree = "<group>"; };
|
||||
@@ -1417,14 +1414,9 @@
|
||||
4C89F525182FB4C50069C73C /* Autotype */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4C90757B18A42E7A00E598DA /* Commands */,
|
||||
4CEE46DB181C301D006BF1E5 /* MPAutotypeDaemon.h */,
|
||||
4CEE46DC181C301D006BF1E5 /* MPAutotypeDaemon.m */,
|
||||
4CE2961318429AA5005F01CE /* MPAutotypeKeyPress.h */,
|
||||
4CE2961418429AA5005F01CE /* MPAutotypeKeyPress.m */,
|
||||
4C89F522182FB4740069C73C /* MPAutotypeCommand.h */,
|
||||
4C89F523182FB4740069C73C /* MPAutotypeCommand.m */,
|
||||
4CE296171842A166005F01CE /* MPAutotypePaste.h */,
|
||||
4CE296181842A166005F01CE /* MPAutotypePaste.m */,
|
||||
4CC87EA11847FDDA005AA18D /* MPAutotypeParser.h */,
|
||||
4CC87EA21847FDDA005AA18D /* MPAutotypeParser.m */,
|
||||
4CD2B9041849424B0051B395 /* MPAutotypeContext.h */,
|
||||
@@ -1433,6 +1425,19 @@
|
||||
name = Autotype;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4C90757B18A42E7A00E598DA /* Commands */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4CE2961318429AA5005F01CE /* MPAutotypeKeyPress.h */,
|
||||
4CE2961418429AA5005F01CE /* MPAutotypeKeyPress.m */,
|
||||
4C89F522182FB4740069C73C /* MPAutotypeCommand.h */,
|
||||
4C89F523182FB4740069C73C /* MPAutotypeCommand.m */,
|
||||
4CE296171842A166005F01CE /* MPAutotypePaste.h */,
|
||||
4CE296181842A166005F01CE /* MPAutotypePaste.m */,
|
||||
);
|
||||
name = Commands;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4CA0B2F115BCAEE600654E32 /* View Controller */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1618,8 +1623,6 @@
|
||||
4C8A173C1790AA41008B5C17 /* NSData+Keyfile.m */,
|
||||
4C055E72179620BF00BD2BAB /* NSString+Reference.h */,
|
||||
4C055E73179620BF00BD2BAB /* NSString+Reference.m */,
|
||||
4CA2E2D917BCDA8300714076 /* NSString+Placeholder.h */,
|
||||
4CA2E2DA17BCDA8300714076 /* NSString+Placeholder.m */,
|
||||
4C1842C1179B69E600E2F5BC /* NSData+HashedData.h */,
|
||||
4C1842C2179B69E700E2F5BC /* NSData+HashedData.m */,
|
||||
4C6366AA17AF1E0100AAF17D /* NSColor+KeePassKit.h */,
|
||||
@@ -2237,7 +2240,6 @@
|
||||
4C57AE1417BA422B00CA4F34 /* MPSegmentedContextCell.m in Sources */,
|
||||
4C68456A17BC21DD00FCDBFC /* KPKAutotype.m in Sources */,
|
||||
4C68456D17BC227B00FCDBFC /* KPKWindowAssociation.m in Sources */,
|
||||
4CA2E2DB17BCDA8300714076 /* NSString+Placeholder.m in Sources */,
|
||||
4C6C72C417C01E4200768849 /* NSMutableData+KeePassKit.m in Sources */,
|
||||
4CE2961518429AA5005F01CE /* MPAutotypeKeyPress.m in Sources */,
|
||||
4C0104BB17C37BFC00173EF3 /* KPKLegacyHeaderUtility.m in Sources */,
|
||||
|
||||
@@ -14,7 +14,9 @@ extern NSString *const kMPAutotypeSymbolAlt;
|
||||
extern NSString *const kMPAutotypeSymbolEnter;
|
||||
extern NSString *const kMPAutptypeCommandEnter;
|
||||
|
||||
@class KPKEntry;
|
||||
extern uint16_t const kMPUnknownKeyCode;
|
||||
|
||||
@class MPAutotypeContext;
|
||||
|
||||
/**
|
||||
* The Autotype command reperesent a capsualted Action that was determined by interpreting
|
||||
@@ -23,16 +25,24 @@ extern NSString *const kMPAutptypeCommandEnter;
|
||||
*/
|
||||
@interface MPAutotypeCommand : NSObject
|
||||
|
||||
@property (readonly, copy) NSString *commandString;
|
||||
@property (readonly, strong) MPAutotypeContext *context;
|
||||
/**
|
||||
* Determines the Keycode for the given keyboard layout for the supplied character
|
||||
* Retrieves the string representation with the current keyboard mapping for the keycode
|
||||
*
|
||||
* @param uchrHeader The KeyboardLayout
|
||||
* @param character The Character that needs to be pressed
|
||||
*
|
||||
* @return Key code in the supplied keyboard layout
|
||||
* @param keyCode The virutal keycode to be pressed
|
||||
* @return NSString containing the current mapping for the keyCode
|
||||
*/
|
||||
- (CGKeyCode)keyCodeForKeyboard:(const UCKeyboardLayout *)uchrHeader character:(NSString *)character;
|
||||
+ (NSString *)stringForKey:(CGKeyCode)keyCode;
|
||||
|
||||
/**
|
||||
* Determines the keyCode (if possible) for the charater
|
||||
*
|
||||
* @param character NSString with a single character to be transformed
|
||||
* @return virtual Keycode for the supplied string. If none is found, kMPUnkonwKeyCode is returned
|
||||
*/
|
||||
+ (CGKeyCode)keyCodeForCharacter:(NSString *)character;
|
||||
|
||||
- (id)initWithContext:(MPAutotypeContext *)context;
|
||||
/**
|
||||
* Sends a KeyPress Event with the supplied modifier flags and Keycode
|
||||
* Any existing modifiers will be disabled for this event. If the user
|
||||
@@ -51,6 +61,6 @@ extern NSString *const kMPAutptypeCommandEnter;
|
||||
/**
|
||||
* Exectues the Autotype Command. This will be called by the autotype daemon.
|
||||
*/
|
||||
- (void)executeWithEntry:(KPKEntry *)entry;
|
||||
- (void)execute;
|
||||
|
||||
@end
|
||||
|
||||
@@ -41,61 +41,136 @@ NSString *const kMPAutotypeCommandNumlock = @"{NUMLOCK}";
|
||||
NSString *const kMPAutotypeCommandPrintScreen = @"{PRTSC}";
|
||||
NSString *const kMPAutotypeCommandScrollLock = @"{SCROLLLOCK}";
|
||||
NSString *const kMPAutotypeCommandF1 = @"{F1}";
|
||||
|
||||
uint16_t const kMPUnknownKeyCode = UINT16_MAX;
|
||||
|
||||
/*
|
||||
Tab {TAB}
|
||||
Enter {ENTER} or ~
|
||||
Arrow Up {UP}
|
||||
Arrow Down {DOWN}
|
||||
Arrow Left {LEFT}
|
||||
Arrow Right {RIGHT}
|
||||
Insert {INSERT} or {INS}
|
||||
Delete {DELETE} or {DEL}
|
||||
Enter {ENTER} or ~
|
||||
Arrow Up {UP}
|
||||
Arrow Down {DOWN}
|
||||
Arrow Left {LEFT}
|
||||
Arrow Right {RIGHT}
|
||||
Insert {INSERT} or {INS}
|
||||
Delete {DELETE} or {DEL}
|
||||
|
||||
Home {HOME}
|
||||
End {END}
|
||||
Page Up {PGUP}
|
||||
Page Down {PGDN}
|
||||
Backspace {BACKSPACE}, {BS} or {BKSP}
|
||||
Break {BREAK}
|
||||
Caps-Lock {CAPSLOCK}
|
||||
Escape {ESC}
|
||||
Windows Key {WIN} (equ. to {LWIN})
|
||||
Windows Key: left, right {LWIN}, {RWIN}
|
||||
Apps / Menu {APPS}
|
||||
Help {HELP}
|
||||
Numlock {NUMLOCK}
|
||||
Print Screen {PRTSC}
|
||||
Scroll Lock {SCROLLLOCK}
|
||||
F1 - F16 {F1} - {F16}
|
||||
Numeric Keypad + {ADD}
|
||||
Numeric Keypad - {SUBTRACT}
|
||||
Numeric Keypad * {MULTIPLY}
|
||||
Numeric Keypad / {DIVIDE}
|
||||
Numeric Keypad 0 to 9 {NUMPAD0} to {NUMPAD9}
|
||||
Shift +
|
||||
Ctrl ^
|
||||
Alt %
|
||||
+ {+}
|
||||
^ {^}
|
||||
% {%}
|
||||
~ {~}
|
||||
(, ) {(}, {)}
|
||||
End {END}
|
||||
Page Up {PGUP}
|
||||
Page Down {PGDN}
|
||||
Backspace {BACKSPACE}, {BS} or {BKSP}
|
||||
Break {BREAK}
|
||||
Caps-Lock {CAPSLOCK}
|
||||
Escape {ESC}
|
||||
Windows Key {WIN} (equ. to {LWIN})
|
||||
Windows Key: left, right {LWIN}, {RWIN}
|
||||
Apps / Menu {APPS}
|
||||
Help {HELP}
|
||||
Numlock {NUMLOCK}
|
||||
Print Screen {PRTSC}
|
||||
Scroll Lock {SCROLLLOCK}
|
||||
F1 - F16 {F1} - {F16}
|
||||
Numeric Keypad + {ADD}
|
||||
Numeric Keypad - {SUBTRACT}
|
||||
Numeric Keypad * {MULTIPLY}
|
||||
Numeric Keypad / {DIVIDE}
|
||||
Numeric Keypad 0 to 9 {NUMPAD0} to {NUMPAD9}
|
||||
Shift +
|
||||
Ctrl ^
|
||||
Alt %
|
||||
+ {+}
|
||||
^ {^}
|
||||
% {%}
|
||||
~ {~}
|
||||
(, ) {(}, {)}
|
||||
[, ] {[}, {]}
|
||||
{, } {{}, {}}
|
||||
*/
|
||||
|
||||
|
||||
@implementation MPAutotypeCommand
|
||||
|
||||
+ (NSString *)stringForKey:(CGKeyCode)keyCode {
|
||||
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
|
||||
CFDataRef layoutData = TISGetInputSourceProperty(currentKeyboard,kTISPropertyUnicodeKeyLayoutData);
|
||||
CFRelease(currentKeyboard);
|
||||
|
||||
const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData);
|
||||
/*
|
||||
Fallback for non-unicode Keyboards taken from to SRKeyCodeTransformer.m
|
||||
Copyright 2006-2007 Contributors. All rights reserved.
|
||||
License: BSD
|
||||
Contributors: David Dauer, Jesper, Jamie Kirkpatrick
|
||||
*/
|
||||
if(!keyboardLayout) {
|
||||
currentKeyboard = TISCopyCurrentASCIICapableKeyboardLayoutInputSource();
|
||||
layoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
|
||||
CFRelease(currentKeyboard);
|
||||
}
|
||||
|
||||
UInt32 keysDown = 0;
|
||||
UniChar chars[4];
|
||||
UniCharCount realLength;
|
||||
|
||||
UCKeyTranslate(keyboardLayout,
|
||||
keyCode,
|
||||
kUCKeyActionDisplay,
|
||||
0,
|
||||
LMGetKbdType(),
|
||||
kUCKeyTranslateNoDeadKeysBit,
|
||||
&keysDown,
|
||||
sizeof(chars) / sizeof(chars[0]),
|
||||
&realLength,
|
||||
chars);
|
||||
|
||||
return CFBridgingRelease(CFStringCreateWithCharacters(kCFAllocatorDefault, chars, 1));
|
||||
}
|
||||
|
||||
+ (CGKeyCode)keyCodeForCharacter:(NSString *)character {
|
||||
static NSMutableDictionary *keyboardCodeDictionary;
|
||||
|
||||
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
|
||||
NSString *localizedName = CFBridgingRelease(TISGetInputSourceProperty(currentKeyboard, kTISPropertyLocalizedName));
|
||||
|
||||
if(keyboardCodeDictionary == nil) {
|
||||
/* Input source should not change that much while we are running */
|
||||
keyboardCodeDictionary = [[NSMutableDictionary alloc] initWithCapacity:2];
|
||||
}
|
||||
NSDictionary *charToCodeDict = keyboardCodeDictionary[localizedName];
|
||||
if(nil == keyboardCodeDictionary[localizedName]) {
|
||||
/* We need 128 places for this dict */
|
||||
charToCodeDict = [[NSMutableDictionary alloc] initWithCapacity:128];
|
||||
|
||||
/* Loop through every keycode (0 - 127) to find its current mapping. */
|
||||
for(CGKeyCode keyCode = 0; keyCode < 128; ++keyCode) {
|
||||
NSString *string = [self stringForKey:keyCode];
|
||||
if(string != nil) {
|
||||
((NSMutableDictionary *)charToCodeDict)[string] = @(keyCode);
|
||||
}
|
||||
}
|
||||
keyboardCodeDictionary[localizedName] = [[NSDictionary alloc] initWithDictionary:charToCodeDict];
|
||||
}
|
||||
/* Add mapping */
|
||||
/* Generate table of keycodes and characters. */
|
||||
|
||||
NSString *singleCharacter = [[character substringToIndex:1] lowercaseString];
|
||||
if(charToCodeDict[singleCharacter]) {
|
||||
return [charToCodeDict[singleCharacter] integerValue];
|
||||
}
|
||||
return kMPUnknownKeyCode;
|
||||
}
|
||||
|
||||
- (void)sendPressKey:(CGKeyCode)keyCode modifierFlags:(CGEventFlags)flags {
|
||||
CGEventRef pressKey = CGEventCreateKeyboardEvent (NULL, keyCode, YES);
|
||||
CGEventRef releaseKey = CGEventCreateKeyboardEvent (NULL, keyCode, NO);
|
||||
|
||||
/* The modifer Masks might be set, reset them */
|
||||
CGEventSetFlags(pressKey,0);
|
||||
CGEventSetFlags(releaseKey, 0);
|
||||
/* Set the modifiers to the ones we want */
|
||||
CGEventSetFlags(pressKey,flags);
|
||||
CGEventSetFlags(releaseKey, flags);
|
||||
|
||||
/* Send the event */
|
||||
CGEventPost(kCGSessionEventTap, pressKey);
|
||||
CGEventPost(kCGSessionEventTap, releaseKey);
|
||||
|
||||
@@ -103,104 +178,15 @@ Alt %
|
||||
CFRelease(releaseKey);
|
||||
}
|
||||
|
||||
/*
|
||||
cody by Joe Turner http://www.cocoabuilder.com/archive/cocoa/242992-detect-keyboard-layout-for-cgkeycodes.html#243168
|
||||
*/
|
||||
- (CGKeyCode)keyCodeForKeyboard:(const UCKeyboardLayout *)uchrHeader character:(NSString *)character {
|
||||
if ([character isEqualToString:@"RETURN"]) return kVK_Return;
|
||||
if ([character isEqualToString:@"TAB"]) return kVK_Tab;
|
||||
if ([character isEqualToString:@"SPACE"]) return kVK_Space;
|
||||
if ([character isEqualToString:@"DELETE"]) return kVK_Delete;
|
||||
if ([character isEqualToString:@"ESCAPE"]) return kVK_Escape;
|
||||
if ([character isEqualToString:@"F5"]) return kVK_F5;
|
||||
if ([character isEqualToString:@"F6"]) return kVK_F6;
|
||||
if ([character isEqualToString:@"F7"]) return kVK_F7;
|
||||
if ([character isEqualToString:@"F3"]) return kVK_F3;
|
||||
if ([character isEqualToString:@"F8"]) return kVK_F8;
|
||||
if ([character isEqualToString:@"F9"]) return kVK_F9;
|
||||
if ([character isEqualToString:@"F11"]) return kVK_F11;
|
||||
if ([character isEqualToString:@"F13"]) return kVK_F13;
|
||||
if ([character isEqualToString:@"F16"]) return kVK_F16;
|
||||
if ([character isEqualToString:@"F14"]) return kVK_F14;
|
||||
if ([character isEqualToString:@"F10"]) return kVK_F10;
|
||||
if ([character isEqualToString:@"F12"]) return kVK_F12;
|
||||
if ([character isEqualToString:@"F15"]) return kVK_F15;
|
||||
if ([character isEqualToString:@"HELP"]) return kVK_Help;
|
||||
if ([character isEqualToString:@"HOME"]) return kVK_Home;
|
||||
if ([character isEqualToString:@"PAGE UP"]) return kVK_PageUp;
|
||||
if ([character isEqualToString:@"FORWARD DELETE"]) return kVK_ForwardDelete;
|
||||
if ([character isEqualToString:@"F4"]) return kVK_F4;
|
||||
if ([character isEqualToString:@"END"]) return kVK_End;
|
||||
if ([character isEqualToString:@"F2"]) return kVK_F2;
|
||||
if ([character isEqualToString:@"PAGE DOWN"]) return kVK_PageDown;
|
||||
if ([character isEqualToString:@"F1"]) return kVK_F1;
|
||||
if ([character isEqualToString:@"LEFT"]) return kVK_LeftArrow;
|
||||
if ([character isEqualToString:@"RIGHT"]) return kVK_RightArrow;
|
||||
if ([character isEqualToString:@"DOWN"]) return kVK_DownArrow;
|
||||
if ([character isEqualToString:@"UP"]) return kVK_UpArrow;
|
||||
|
||||
UTF16Char theCharacter = [character characterAtIndex:0];
|
||||
long i, j, k;
|
||||
unsigned char *uchrData = (unsigned char *)uchrHeader;
|
||||
UCKeyboardTypeHeader *uchrTable = uchrHeader->keyboardTypeList;
|
||||
BOOL found = NO;
|
||||
UInt16 virtualKeyCode;
|
||||
|
||||
for (i = 0; i < (uchrHeader->keyboardTypeCount) && !found; i++) {
|
||||
UCKeyToCharTableIndex *uchrKeyIX;
|
||||
UCKeyStateRecordsIndex *stateRecordsIndex;
|
||||
|
||||
if (uchrTable[i].keyStateRecordsIndexOffset != 0 ) {
|
||||
stateRecordsIndex = (UCKeyStateRecordsIndex *) (((unsigned char*)uchrData) + (uchrTable[i].keyStateRecordsIndexOffset));
|
||||
|
||||
if ((stateRecordsIndex->keyStateRecordsIndexFormat) != kUCKeyStateRecordsIndexFormat) {
|
||||
stateRecordsIndex = NULL;
|
||||
- (void)sendPasteKeyCode {
|
||||
CGKeyCode keyCode = [MPAutotypeCommand keyCodeForCharacter:@"V"];
|
||||
if(keyCode == kMPUnknownKeyCode) {
|
||||
return; // We did not find a mapping for "V"
|
||||
}
|
||||
}
|
||||
else {
|
||||
stateRecordsIndex = NULL;
|
||||
}
|
||||
|
||||
uchrKeyIX = (UCKeyToCharTableIndex *)(((unsigned char *)uchrData) + (uchrTable[i].keyToCharTableIndexOffset));
|
||||
|
||||
if (kUCKeyToCharTableIndexFormat == (uchrKeyIX-> keyToCharTableIndexFormat)) {
|
||||
for (j = 0; j < (uchrKeyIX->keyToCharTableCount) && !found; j++) {
|
||||
UCKeyOutput *keyToCharData = (UCKeyOutput *) ( ((unsigned char*)uchrData) + (uchrKeyIX->keyToCharTableOffsets[j]) );
|
||||
|
||||
for (k = 0; k < (uchrKeyIX->keyToCharTableSize) && !found; k++) {
|
||||
if (((keyToCharData[k]) & kUCKeyOutputTestForIndexMask) == kUCKeyOutputStateIndexMask) {
|
||||
long theIndex = (kUCKeyOutputGetIndexMask & keyToCharData[k]);
|
||||
|
||||
if (stateRecordsIndex != NULL && theIndex <= stateRecordsIndex-> keyStateRecordCount) {
|
||||
UCKeyStateRecord *theStateRecord = (UCKeyStateRecord *) (((unsigned char *) uchrData) + (stateRecordsIndex-> keyStateRecordOffsets[theIndex]));
|
||||
|
||||
if ((theStateRecord->stateZeroCharData) == theCharacter) {
|
||||
virtualKeyCode = k;
|
||||
found = YES;
|
||||
}
|
||||
} else {
|
||||
if ((keyToCharData[k]) == theCharacter) {
|
||||
virtualKeyCode = k;
|
||||
found = YES;
|
||||
}
|
||||
}
|
||||
} else if (((keyToCharData[k]) & kUCKeyOutputTestForIndexMask) == kUCKeyOutputSequenceIndexMask) {
|
||||
} else if ( (keyToCharData[k]) == 0xFFFE || (keyToCharData[k]) == 0xFFFF ) {
|
||||
} else {
|
||||
if ((keyToCharData[k]) == theCharacter) {
|
||||
virtualKeyCode = k;
|
||||
found = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (CGKeyCode)virtualKeyCode;
|
||||
[self sendPressKey:keyCode modifierFlags:kCGEventFlagMaskCommand];
|
||||
}
|
||||
|
||||
- (void)executeWithEntry:(KPKEntry *)entry {
|
||||
- (void)execute {
|
||||
NSAssert(NO, @"Not Implemented");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
else {
|
||||
self.entry = entry;
|
||||
NSError *error;
|
||||
NSRegularExpression *regexp = [[NSRegularExpression alloc] initWithPattern:@"\\{([a-z]+) ?([0-9]*)\\}" options:NSRegularExpressionCaseInsensitive error:&error];
|
||||
NSRegularExpression *regexp = [[NSRegularExpression alloc] initWithPattern:@"\\{([a-z]+)?([0-9]*)\\}" options:NSRegularExpressionCaseInsensitive error:&error];
|
||||
if(regexp) {
|
||||
[regexp enumerateMatchesInString:sequence options:0 range:NSMakeRange(0, [sequence length]) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
|
||||
NSRange commandRange = [result rangeAtIndex:1];
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import "MPPasteBoardController.h"
|
||||
#import "MPDocument.h"
|
||||
#import "MPDocument+Autotype.h"
|
||||
#import "MPAutotypeCommand.h"
|
||||
|
||||
#import "KPKEntry.h"
|
||||
|
||||
@@ -34,7 +35,11 @@ NSString *const kMPApplciationNameKey = @"applicationName";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)didPressHotKey {
|
||||
- (void)exectureAutotypeForEntry:(KPKEntry *)entry withWindowTitle:(NSString *)title {
|
||||
NSAssert(NO,@"Not Implemented");
|
||||
}
|
||||
|
||||
- (void)_didPressHotKey {
|
||||
// copy items to pasteboard
|
||||
NSArray *documents = [NSApp orderedDocuments];
|
||||
MPDocument *currentDocument = nil;
|
||||
@@ -91,7 +96,7 @@ NSString *const kMPApplciationNameKey = @"applicationName";
|
||||
[[DDHotKeyCenter sharedHotKeyCenter] registerHotKeyWithKeyCode:kVK_ANSI_M
|
||||
modifierFlags:(NSCommandKeyMask | NSAlternateKeyMask )
|
||||
target:self
|
||||
action:@selector(didPressHotKey)
|
||||
action:@selector(_didPressHotKey)
|
||||
object:nil];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,8 @@
|
||||
//
|
||||
|
||||
#import "MPAutotypeParser.h"
|
||||
|
||||
#import "MPAutotypeCommand.h"
|
||||
|
||||
#import "NSString+Placeholder.h"
|
||||
|
||||
@implementation MPAutotypeParser
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import "MPAutotypePaste.h"
|
||||
#import "MPPasteBoardController.h"
|
||||
|
||||
#import "NSString+Placeholder.h"
|
||||
#import "NSString+Commands.h"
|
||||
|
||||
@implementation MPAutotypePaste
|
||||
|
||||
|
||||
Reference in New Issue
Block a user