using MacPass code style. Removed auto-open of path control as this annoys if MacPass gets focus

This commit is contained in:
michael starke
2017-10-19 13:23:45 +02:00
parent c605749b9c
commit 873b4cce63

View File

@@ -21,26 +21,25 @@
// //
#import "MPKeyfilePathControlDelegate.h" #import "MPKeyfilePathControlDelegate.h"
@implementation MPKeyfilePathControlDelegate @implementation MPKeyfilePathControlDelegate
- (NSDragOperation)pathControl:(NSPathControl *)pathControl validateDrop:(id<NSDraggingInfo>)info { - (NSDragOperation)pathControl:(NSPathControl *)pathControl validateDrop:(id<NSDraggingInfo>)info {
return NSDragOperationNone; return NSDragOperationNone;
} }
- (void)pathControl:(NSPathControl *)pathControl willDisplayOpenPanel:(NSOpenPanel *)openPanel {
}
- (void)pathControlDidBecomeKey:(NSPathControl *)control { - (void)pathControlDidBecomeKey:(NSPathControl *)control {
if(control.URL) return; // if(control.URL) {
// return;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // }
NSOpenPanel *panel = [NSOpenPanel openPanel]; //
panel.allowedFileTypes = control.allowedTypes; // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if([panel runModal] != NSModalResponseOK) return; // NSOpenPanel *panel = [NSOpenPanel openPanel];
// panel.allowedFileTypes = control.allowedTypes;
control.URL = panel.URL; // if([panel runModal] != NSModalResponseOK) {
}); // return;
// }
// control.URL = panel.URL;
// });
} }
@end @end