Reindented code with Xcode
This commit is contained in:
parent
b1337f11ca
commit
86effa4e2f
|
@ -34,12 +34,12 @@ BOOL appRunning = NO;
|
||||||
|
|
||||||
- (void) applicationWillFinishLaunching:(NSNotification *)notification {
|
- (void) applicationWillFinishLaunching:(NSNotification *)notification {
|
||||||
NSLog(@"applicationWillFinishLaunching");
|
NSLog(@"applicationWillFinishLaunching");
|
||||||
// The following is used to determine is the left or right shift keys were depressed
|
// The following is used to determine is the left or right shift keys were depressed
|
||||||
// as the application was launched. Could be used to display a gui on Application start.
|
// as the application was launched. Could be used to display a gui on Application start.
|
||||||
KeyMap map;
|
KeyMap map;
|
||||||
GetKeys(map);
|
GetKeys(map);
|
||||||
if (KEYMAP_GET(map, kVKC_Shift) || KEYMAP_GET(map, kVKC_rShift))
|
if (KEYMAP_GET(map, kVKC_Shift) || KEYMAP_GET(map, kVKC_rShift))
|
||||||
NSLog(@"Shift or Right Shift");
|
NSLog(@"Shift or Right Shift");
|
||||||
|
|
||||||
userDefaults = [TDNUserDefaults sharedInstance];
|
userDefaults = [TDNUserDefaults sharedInstance];
|
||||||
|
|
||||||
|
@ -88,17 +88,17 @@ BOOL appRunning = NO;
|
||||||
// Call one at a time for each file selected when app is run
|
// Call one at a time for each file selected when app is run
|
||||||
// This is seemingly never called, even when only selecting a single file.
|
// This is seemingly never called, even when only selecting a single file.
|
||||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename {
|
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename {
|
||||||
//NSLog(@"openFile: %@", filename);
|
//NSLog(@"openFile: %@", filename);
|
||||||
|
|
||||||
//[self extractRarWith:filename];
|
//[self extractRarWith:filename];
|
||||||
// [self extractRarUsingUnrarKitWithFilename:filename];
|
// [self extractRarUsingUnrarKitWithFilename:filename];
|
||||||
// Always return YES even if there is an error to avoid dialog indicating unable to
|
// Always return YES even if there is an error to avoid dialog indicating unable to
|
||||||
// handle files of type RAR if the archive is corrupt or part of it is missing
|
// handle files of type RAR if the archive is corrupt or part of it is missing
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *) arrayOfFilenames {
|
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *) arrayOfFilenames {
|
||||||
NSLog(@"openFiles: %@", arrayOfFilenames);
|
NSLog(@"openFiles: %@", arrayOfFilenames);
|
||||||
|
|
||||||
arrayOfFilesToProcess = arrayOfFilenames;
|
arrayOfFilesToProcess = arrayOfFilenames;
|
||||||
|
|
||||||
|
@ -143,40 +143,40 @@ BOOL appRunning = NO;
|
||||||
// Presents a dialog to the user allowing them to Skip a file or overwrite an existing version
|
// Presents a dialog to the user allowing them to Skip a file or overwrite an existing version
|
||||||
// returns YES or NO
|
// returns YES or NO
|
||||||
- (BOOL) shouldFileBeReplaced:(NSString *) filename {
|
- (BOOL) shouldFileBeReplaced:(NSString *) filename {
|
||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
|
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
[alert addButtonWithTitle:@"Overwrite"];
|
[alert addButtonWithTitle:@"Overwrite"];
|
||||||
NSButton * skipButton = [alert addButtonWithTitle:@"Skip"];
|
NSButton * skipButton = [alert addButtonWithTitle:@"Skip"];
|
||||||
[skipButton setKeyEquivalent:@"\e"];
|
[skipButton setKeyEquivalent:@"\e"];
|
||||||
[alert setMessageText:[NSString stringWithFormat:@"Overwrite %@?", filename]];
|
[alert setMessageText:[NSString stringWithFormat:@"Overwrite %@?", filename]];
|
||||||
[alert setInformativeText:[NSString stringWithFormat:@"The file %@ already exists. Do you wish to extract it again, overwriting the original file?", filename]];
|
[alert setInformativeText:[NSString stringWithFormat:@"The file %@ already exists. Do you wish to extract it again, overwriting the original file?", filename]];
|
||||||
[alert setAlertStyle:NSAlertStyleWarning];
|
[alert setAlertStyle:NSAlertStyleWarning];
|
||||||
|
|
||||||
if ([alert runModal] == NSAlertFirstButtonReturn) {
|
if ([alert runModal] == NSAlertFirstButtonReturn) {
|
||||||
result = YES;
|
result = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate to the user that part of the RAR volume is missing.
|
// Indicate to the user that part of the RAR volume is missing.
|
||||||
- (void) alertUserOfMissing:(const char *) volume {
|
- (void) alertUserOfMissing:(const char *) volume {
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
[alert addButtonWithTitle:@"OK"];
|
[alert addButtonWithTitle:@"OK"];
|
||||||
[alert setMessageText:[NSString stringWithFormat:@"Archive part %s is missing.", volume]];
|
[alert setMessageText:[NSString stringWithFormat:@"Archive part %s is missing.", volume]];
|
||||||
[alert setInformativeText:@"Unable to extract all files from RAR archive as part of it is missing"];
|
[alert setInformativeText:@"Unable to extract all files from RAR archive as part of it is missing"];
|
||||||
[alert setAlertStyle:NSAlertStyleCritical];
|
[alert setAlertStyle:NSAlertStyleCritical];
|
||||||
|
|
||||||
[alert runModal];
|
[alert runModal];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a dialog with a custom view with a NSSecureTextField which is displayed
|
// Creates a dialog with a custom view with a NSSecureTextField which is displayed
|
||||||
// to the user so they can provide a password. Returns the entered password or nil
|
// to the user so they can provide a password. Returns the entered password or nil
|
||||||
- (NSString *) requestArchivePassword {
|
- (NSString *) requestArchivePassword {
|
||||||
if (!passwordView) {
|
if (!passwordView) {
|
||||||
|
|
||||||
NSBundle* bundle = [NSBundle bundleForClass:[self class]];
|
NSBundle* bundle = [NSBundle bundleForClass:[self class]];
|
||||||
|
|
||||||
|
@ -185,21 +185,21 @@ BOOL appRunning = NO;
|
||||||
[passwordField setStringValue:@""];
|
[passwordField setStringValue:@""];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString * password = nil;
|
NSString * password = nil;
|
||||||
|
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
[alert addButtonWithTitle:@"OK"];
|
[alert addButtonWithTitle:@"OK"];
|
||||||
[alert addButtonWithTitle:@"Cancel"];
|
[alert addButtonWithTitle:@"Cancel"];
|
||||||
[alert setMessageText:@"Archive Requires a password"];
|
[alert setMessageText:@"Archive Requires a password"];
|
||||||
[alert setInformativeText:@"To extract the contents of this archive a password is required."];
|
[alert setInformativeText:@"To extract the contents of this archive a password is required."];
|
||||||
[alert setAccessoryView:passwordView];
|
[alert setAccessoryView:passwordView];
|
||||||
[alert setAlertStyle:NSAlertStyleWarning];
|
[alert setAlertStyle:NSAlertStyleWarning];
|
||||||
|
|
||||||
if ([alert runModal] == NSAlertFirstButtonReturn) {
|
if ([alert runModal] == NSAlertFirstButtonReturn) {
|
||||||
password = [passwordField stringValue];
|
password = [passwordField stringValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) hideDockIcon: (BOOL) hide {
|
- (void) hideDockIcon: (BOOL) hide {
|
||||||
|
@ -262,8 +262,8 @@ BOOL appRunning = NO;
|
||||||
UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter];
|
UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter];
|
||||||
|
|
||||||
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound)
|
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound)
|
||||||
completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
||||||
// Enable or disable features based on authorization.
|
// Enable or disable features based on authorization.
|
||||||
if (granted) {
|
if (granted) {
|
||||||
// set some flag, that would be used to see if notifications should be posted
|
// set some flag, that would be used to see if notifications should be posted
|
||||||
NSLog(@"Notification Permission Granted");
|
NSLog(@"Notification Permission Granted");
|
||||||
|
|
Loading…
Reference in New Issue