Changed back authentication for smc binary to checkSum method (codesign check was causing issues on some mac)

Reset-Feature to reset fans back to factory defaults, delete settings and favorites
This commit is contained in:
Hendrik Holtmann
2014-10-30 16:51:29 +01:00
parent 62059ede9b
commit c78366cebb
18 changed files with 1036 additions and 78 deletions

View File

@ -635,6 +635,46 @@ NSUserDefaults *defaults;
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
}
-(void)performReset
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSString *machinesPath = [[fileManager applicationSupportDirectory] stringByAppendingPathComponent:@"Machines.plist"];
[fileManager removeItemAtPath:machinesPath error:&error];
if (error) {
NSLog(@"Error deleting %@",machinesPath);
}
error = nil;
NSString *domainName = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:domainName];
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Shutdown required",nil)
defaultButton:NSLocalizedString(@"OK",nil) alternateButton:nil otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"Please shutdown your computer now to return to default fan settings.",nil)];
NSModalResponse code=[alert runModal];
if (code == NSAlertDefaultReturn) {
[[NSApplication sharedApplication] terminate:self];
}
}
- (IBAction)resetSettings:(id)sender
{
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Reset Settings",nil)
defaultButton:NSLocalizedString(@"Yes",nil) alternateButton:NSLocalizedString(@"No",nil) otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"Do you want to reset smcFanControl to default settings? Favorites will be deleted and fans will return to default speed.",nil)];
NSModalResponse code=[alert runModal];
if (code == NSAlertDefaultReturn) {
[self performReset];
} else if (code == NSAlertAlternateReturn) {
}
}
- (IBAction)visitHomepage:(id)sender{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.eidac.de/products"]];
}