mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 01:12:31 +00:00
Added {CLEARFIELD} to autotype commands. Stubbs for {DELAY X}
This commit is contained in:
@@ -172,6 +172,8 @@
|
|||||||
4C6D1D25178579570014C5A5 /* 48_FolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D24178579570014C5A5 /* 48_FolderTemplate.pdf */; };
|
4C6D1D25178579570014C5A5 /* 48_FolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D24178579570014C5A5 /* 48_FolderTemplate.pdf */; };
|
||||||
4C6D1D27178586CA0014C5A5 /* 99_AddFolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */; };
|
4C6D1D27178586CA0014C5A5 /* 99_AddFolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */; };
|
||||||
4C6D1D2B17858A250014C5A5 /* MacPass.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D2A17858A250014C5A5 /* MacPass.icns */; };
|
4C6D1D2B17858A250014C5A5 /* MacPass.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D2A17858A250014C5A5 /* MacPass.icns */; };
|
||||||
|
4C6F228919A4A7F90012310C /* MPAutotypeClear.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6F228819A4A7F90012310C /* MPAutotypeClear.m */; };
|
||||||
|
4C6F228C19A4AA700012310C /* MPAutotypeDelay.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6F228B19A4AA700012310C /* MPAutotypeDelay.m */; };
|
||||||
4C6FDD2117BC4F4C004AEEC8 /* KPKTestPlaceholder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6FDD2017BC4F4C004AEEC8 /* KPKTestPlaceholder.m */; };
|
4C6FDD2117BC4F4C004AEEC8 /* KPKTestPlaceholder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6FDD2017BC4F4C004AEEC8 /* KPKTestPlaceholder.m */; };
|
||||||
4C701CBC178618A000581B88 /* 12_RemoteTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */; };
|
4C701CBC178618A000581B88 /* 12_RemoteTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */; };
|
||||||
4C70D100179092F200652EE9 /* KPKCompositeKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C70D0FF179092F200652EE9 /* KPKCompositeKey.m */; };
|
4C70D100179092F200652EE9 /* KPKCompositeKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C70D0FF179092F200652EE9 /* KPKCompositeKey.m */; };
|
||||||
@@ -673,6 +675,10 @@
|
|||||||
4C6D1D24178579570014C5A5 /* 48_FolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 48_FolderTemplate.pdf; sourceTree = "<group>"; };
|
4C6D1D24178579570014C5A5 /* 48_FolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 48_FolderTemplate.pdf; sourceTree = "<group>"; };
|
||||||
4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = 99_AddFolderTemplate.pdf; path = Icons/99_AddFolderTemplate.pdf; sourceTree = "<group>"; };
|
4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = 99_AddFolderTemplate.pdf; path = Icons/99_AddFolderTemplate.pdf; sourceTree = "<group>"; };
|
||||||
4C6D1D2A17858A250014C5A5 /* MacPass.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = MacPass.icns; path = "../Assets/App icon/MacPass.icns"; sourceTree = "<group>"; };
|
4C6D1D2A17858A250014C5A5 /* MacPass.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = MacPass.icns; path = "../Assets/App icon/MacPass.icns"; sourceTree = "<group>"; };
|
||||||
|
4C6F228719A4A7F90012310C /* MPAutotypeClear.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeClear.h; sourceTree = "<group>"; };
|
||||||
|
4C6F228819A4A7F90012310C /* MPAutotypeClear.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeClear.m; sourceTree = "<group>"; };
|
||||||
|
4C6F228A19A4AA700012310C /* MPAutotypeDelay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeDelay.h; sourceTree = "<group>"; };
|
||||||
|
4C6F228B19A4AA700012310C /* MPAutotypeDelay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeDelay.m; sourceTree = "<group>"; };
|
||||||
4C6FDD2017BC4F4C004AEEC8 /* KPKTestPlaceholder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestPlaceholder.m; sourceTree = "<group>"; };
|
4C6FDD2017BC4F4C004AEEC8 /* KPKTestPlaceholder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestPlaceholder.m; sourceTree = "<group>"; };
|
||||||
4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 12_RemoteTemplate.pdf; sourceTree = "<group>"; };
|
4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 12_RemoteTemplate.pdf; sourceTree = "<group>"; };
|
||||||
4C70D0FE179092F200652EE9 /* KPKCompositeKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKCompositeKey.h; sourceTree = "<group>"; };
|
4C70D0FE179092F200652EE9 /* KPKCompositeKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKCompositeKey.h; sourceTree = "<group>"; };
|
||||||
@@ -1612,6 +1618,10 @@
|
|||||||
4C89F523182FB4740069C73C /* MPAutotypeCommand.m */,
|
4C89F523182FB4740069C73C /* MPAutotypeCommand.m */,
|
||||||
4CE296171842A166005F01CE /* MPAutotypePaste.h */,
|
4CE296171842A166005F01CE /* MPAutotypePaste.h */,
|
||||||
4CE296181842A166005F01CE /* MPAutotypePaste.m */,
|
4CE296181842A166005F01CE /* MPAutotypePaste.m */,
|
||||||
|
4C6F228719A4A7F90012310C /* MPAutotypeClear.h */,
|
||||||
|
4C6F228819A4A7F90012310C /* MPAutotypeClear.m */,
|
||||||
|
4C6F228A19A4AA700012310C /* MPAutotypeDelay.h */,
|
||||||
|
4C6F228B19A4AA700012310C /* MPAutotypeDelay.m */,
|
||||||
);
|
);
|
||||||
name = Commands;
|
name = Commands;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2330,6 +2340,7 @@
|
|||||||
4C88C66918D9F8D600F43852 /* MPTemporaryFileStorageCenter.m in Sources */,
|
4C88C66918D9F8D600F43852 /* MPTemporaryFileStorageCenter.m in Sources */,
|
||||||
4C245B79176E1E3D0086100E /* HTTPAuthenticationRequest.m in Sources */,
|
4C245B79176E1E3D0086100E /* HTTPAuthenticationRequest.m in Sources */,
|
||||||
4C245B7A176E1E3D0086100E /* HTTPConnection.m in Sources */,
|
4C245B7A176E1E3D0086100E /* HTTPConnection.m in Sources */,
|
||||||
|
4C6F228C19A4AA700012310C /* MPAutotypeDelay.m in Sources */,
|
||||||
4C245B7B176E1E3D0086100E /* HTTPMessage.m in Sources */,
|
4C245B7B176E1E3D0086100E /* HTTPMessage.m in Sources */,
|
||||||
4C3C4EA718D6FEA100153127 /* TTTStringTransformers.m in Sources */,
|
4C3C4EA718D6FEA100153127 /* TTTStringTransformers.m in Sources */,
|
||||||
4C245B7C176E1E3D0086100E /* HTTPServer.m in Sources */,
|
4C245B7C176E1E3D0086100E /* HTTPServer.m in Sources */,
|
||||||
@@ -2338,6 +2349,7 @@
|
|||||||
4C245B7E176E1E3D0086100E /* MultipartMessageHeader.m in Sources */,
|
4C245B7E176E1E3D0086100E /* MultipartMessageHeader.m in Sources */,
|
||||||
4C245B7F176E1E3D0086100E /* MultipartMessageHeaderField.m in Sources */,
|
4C245B7F176E1E3D0086100E /* MultipartMessageHeaderField.m in Sources */,
|
||||||
4C245B80176E1E3D0086100E /* HTTPAsyncFileResponse.m in Sources */,
|
4C245B80176E1E3D0086100E /* HTTPAsyncFileResponse.m in Sources */,
|
||||||
|
4C6F228919A4A7F90012310C /* MPAutotypeClear.m in Sources */,
|
||||||
4C0B038C18E36DA400B9F9C9 /* MPFixAutotypeWindowController.m in Sources */,
|
4C0B038C18E36DA400B9F9C9 /* MPFixAutotypeWindowController.m in Sources */,
|
||||||
4C245B81176E1E3D0086100E /* HTTPDataResponse.m in Sources */,
|
4C245B81176E1E3D0086100E /* HTTPDataResponse.m in Sources */,
|
||||||
4C245B82176E1E3D0086100E /* HTTPDynamicFileResponse.m in Sources */,
|
4C245B82176E1E3D0086100E /* HTTPDynamicFileResponse.m in Sources */,
|
||||||
|
|||||||
14
MacPass/MPAutotypeClear.h
Normal file
14
MacPass/MPAutotypeClear.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// MPAutotypeClear.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 20/08/14.
|
||||||
|
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MPAutotypeCommand.h"
|
||||||
|
|
||||||
|
@interface MPAutotypeClear : MPAutotypeCommand
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
25
MacPass/MPAutotypeClear.m
Normal file
25
MacPass/MPAutotypeClear.m
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// MPAutotypeClear.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 20/08/14.
|
||||||
|
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MPAutotypeClear.h"
|
||||||
|
#import "MPKeyMapper.h"
|
||||||
|
#import <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
@implementation MPAutotypeClear
|
||||||
|
|
||||||
|
- (void)execute {
|
||||||
|
CGKeyCode keyCode = [MPKeyMapper keyCodeForCharacter:@"A"];
|
||||||
|
if(keyCode == kMPUnknownKeyCode) {
|
||||||
|
NSLog(@"Unable to generate key code for 'A'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[self sendPressKey:keyCode modifierFlags:kCGEventFlagMaskCommand];
|
||||||
|
[self sendPressKey:kVK_Delete modifierFlags:0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#import "MPAutotypePaste.h"
|
#import "MPAutotypePaste.h"
|
||||||
#import "MPAutotypeKeyPress.h"
|
#import "MPAutotypeKeyPress.h"
|
||||||
|
#import "MPAutotypeClear.h"
|
||||||
|
#import "MPAutotypeDelay.h"
|
||||||
|
|
||||||
#import "MPAutotypeContext.h"
|
#import "MPAutotypeContext.h"
|
||||||
#import "MPKeyMapper.h"
|
#import "MPKeyMapper.h"
|
||||||
@@ -163,19 +165,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (void)appendCommandForString:(NSString *)commandString toCommands:(NSMutableArray *)commands activeModifer:(CGEventFlags)flags {
|
+ (void)appendCommandForString:(NSString *)commandString toCommands:(NSMutableArray *)commands activeModifer:(CGEventFlags)flags {
|
||||||
if(!commandString) {
|
if(nil == commandString) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* TODO: Test for special Commands */
|
/* TODO: Test for special Commands */
|
||||||
/* TODO: fall back to paste if nothing matches */
|
/* TODO: fall back to paste if nothing matches */
|
||||||
|
|
||||||
|
NSString *delayPrefix = [[NSString alloc] initWithFormat:@"{%@", kKPKAutotypeDelay];
|
||||||
NSNumber *keyCodeNumber = [self keypressCommands][commandString];
|
NSNumber *keyCodeNumber = [self keypressCommands][commandString];
|
||||||
|
|
||||||
if(keyCodeNumber) {
|
if(nil != keyCodeNumber) {
|
||||||
CGKeyCode keyCode = [keyCodeNumber keyCodeValue];
|
CGKeyCode keyCode = [keyCodeNumber keyCodeValue];
|
||||||
[commands addObject:[[MPAutotypeKeyPress alloc] initWithModifierMask:flags keyCode:keyCode]];
|
[commands addObject:[[MPAutotypeKeyPress alloc] initWithModifierMask:flags keyCode:keyCode]];
|
||||||
}
|
}
|
||||||
|
else if([kKPKAutotypeClearField isEqualToString:commandString]) {
|
||||||
|
[commands addObject:[[MPAutotypeClear alloc] init]];
|
||||||
|
}
|
||||||
|
else if([commandString hasPrefix:delayPrefix]){
|
||||||
|
[commands addObject:[[MPAutotypeDelay alloc] initWithDelay:5]];
|
||||||
|
/* TODO: find the delay */
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
[self appendPasteCommandForContent:commandString toCommands:commands];
|
[self appendPasteCommandForContent:commandString toCommands:commands];
|
||||||
}
|
}
|
||||||
|
|||||||
15
MacPass/MPAutotypeDelay.h
Normal file
15
MacPass/MPAutotypeDelay.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// MPAutotypeDelay.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 20/08/14.
|
||||||
|
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MPAutotypeCommand.h"
|
||||||
|
|
||||||
|
@interface MPAutotypeDelay : MPAutotypeCommand
|
||||||
|
|
||||||
|
- (instancetype)initWithDelay:(NSUInteger)delay;
|
||||||
|
|
||||||
|
@end
|
||||||
36
MacPass/MPAutotypeDelay.m
Normal file
36
MacPass/MPAutotypeDelay.m
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// MPAutotypeDelay.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 20/08/14.
|
||||||
|
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MPAutotypeDelay.h"
|
||||||
|
|
||||||
|
@interface MPAutotypeDelay () {
|
||||||
|
@private
|
||||||
|
NSUInteger _delay;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MPAutotypeDelay
|
||||||
|
|
||||||
|
- (id)init {
|
||||||
|
self = [self initWithDelay:0];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (instancetype)initWithDelay:(NSUInteger)delay {
|
||||||
|
self = [super init];
|
||||||
|
if(self) {
|
||||||
|
_delay = delay;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)execute {
|
||||||
|
usleep((useconds_t)(_delay*1000*1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
Reference in New Issue
Block a user