Revision: 14775
http://sourceforge.net/p/skim-app/code/14775
Author: hofman
Date: 2024-12-01 09:53:29 +0000 (Sun, 01 Dec 2024)
Log Message:
-----------
local variable for user defaults
Modified Paths:
--------------
trunk/NSGraphics_SKExtensions.m
trunk/SKMainDocument.m
Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m 2024-11-30 17:30:39 UTC (rev 14774)
+++ trunk/NSGraphics_SKExtensions.m 2024-12-01 09:53:29 UTC (rev 14775)
@@ -177,17 +177,18 @@
NSArray *SKColorEffectFilters(void) {
NSMutableArray *filters = [NSMutableArray array];
CIFilter *filter;
- CGFloat sepia = [[NSUserDefaults standardUserDefaults]
doubleForKey:SKSepiaToneKey];
+ NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+ CGFloat sepia = [sud doubleForKey:SKSepiaToneKey];
if (sepia > 0.0) {
if ((filter = [CIFilter filterWithName:@"CISepiaTone"
keysAndValues:@"inputIntensity", [NSNumber numberWithDouble:fmin(sepia, 1.0)],
nil]))
[filters addObject:filter];
}
- NSColor *white = [[NSUserDefaults standardUserDefaults]
colorForKey:SKWhitePointKey];
+ NSColor *white = [sud colorForKey:SKWhitePointKey];
if (white) {
if ((filter = [CIFilter filterWithName:@"CIWhitePointAdjust"
keysAndValues:@"inputColor", [[CIColor alloc] initWithColor:white], nil]))
[filters addObject:filter];
}
- if (SKHasDarkAppearance() && [[NSUserDefaults standardUserDefaults]
boolForKey:SKInvertColorsInDarkModeKey]) {
+ if (SKHasDarkAppearance() && [sud boolForKey:SKInvertColorsInDarkModeKey])
{
// map the white page background to 45/255, or 30/255 with high
contrast
CGFloat f = [[NSWorkspace sharedWorkspace]
accessibilityDisplayShouldIncreaseContrast] ? 1.9337 : 1.8972;
// This is like CIColorInvert + CIHueAdjust, modified to map white to
dark gray rather than black
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2024-11-30 17:30:39 UTC (rev 14774)
+++ trunk/SKMainDocument.m 2024-12-01 09:53:29 UTC (rev 14775)
@@ -1623,31 +1623,28 @@
#pragma mark Passwords
-- (void)_savePasswordInKeychain:(NSString *)password {
- NSString *fileID = [[[self pdfDocument] fileIDStrings] lastObject] ?:
[pdfData md5String];
- if (fileID) {
- NSString *label = [@"Skim: " stringByAppendingString:[self
displayName]];
- NSString *comment = [[self fileURL] path];
- // try to update the password in an existing item
- SKPasswordStatus status = [SKKeychain updatePassword:password
service:nil account:nil label:label comment:comment
forService:SKPDFPasswordServiceName account:fileID];
- if (status == SKPasswordStatusNotFound) {
- // try to update an item in the old format
- status = [SKKeychain updatePassword:password
service:SKPDFPasswordServiceName account:fileID label:label comment:comment
forService:[@"Skim - " stringByAppendingString:fileID] account:nil];
+- (void)savePasswordInKeychain:(NSString *)password {
+ NSInteger saveOption = [[NSUserDefaults standardUserDefaults]
integerForKey:SKSavePasswordOptionKey];
+ saveOption = [self definitiveOption:saveOption
usingMessageText:NSLocalizedString(@"Remember Password?", @"Message in alert
dialog") informativeText:NSLocalizedString(@"Do you want to save this password
in your Keychain?", @"Informative text in alert dialog")];
+ if (saveOption == SKOptionAlways) {
+ NSString *fileID = [[[self pdfDocument] fileIDStrings] lastObject] ?:
[pdfData md5String];
+ if (fileID) {
+ NSString *label = [@"Skim: " stringByAppendingString:[self
displayName]];
+ NSString *comment = [[self fileURL] path];
+ // try to update the password in an existing item
+ SKPasswordStatus status = [SKKeychain updatePassword:password
service:nil account:nil label:label comment:comment
forService:SKPDFPasswordServiceName account:fileID];
if (status == SKPasswordStatusNotFound) {
- // add a new password item if no existing item was found
- [SKKeychain setPassword:password
forService:SKPDFPasswordServiceName account:fileID label:label comment:comment];
+ // try to update an item in the old format
+ status = [SKKeychain updatePassword:password
service:SKPDFPasswordServiceName account:fileID label:label comment:comment
forService:[@"Skim - " stringByAppendingString:fileID] account:nil];
+ if (status == SKPasswordStatusNotFound) {
+ // add a new password item if no existing item was found
+ [SKKeychain setPassword:password
forService:SKPDFPasswordServiceName account:fileID label:label comment:comment];
+ }
}
}
}
}
-- (void)savePasswordInKeychain:(NSString *)password {
- NSInteger saveOption = [[NSUserDefaults standardUserDefaults]
integerForKey:SKSavePasswordOptionKey];
- saveOption = [self definitiveOption:saveOption
usingMessageText:NSLocalizedString(@"Remember Password?", @"Message in alert
dialog") informativeText:NSLocalizedString(@"Do you want to save this password
in your Keychain?", @"Informative text in alert dialog")];
- if (saveOption == SKOptionAlways)
- [self _savePasswordInKeychain:password];
-}
-
- (void)tryToUnlockDocument:(PDFDocument *)document {
if ([document permissionsStatus] != kPDFDocumentPermissionsOwner) {
NSString *password = nil;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit