Revision: 14768
          http://sourceforge.net/p/skim-app/code/14768
Author:   hofman
Date:     2024-11-30 15:50:52 +0000 (Sat, 30 Nov 2024)
Log Message:
-----------
Always ask for saving password in modal dialog rather than sheet, as it can 
prevent a sheet that follows this, for instance when pritning or converrting 
notes

Modified Paths:
--------------
    trunk/SKMainDocument.m

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2024-11-30 15:35:52 UTC (rev 14767)
+++ trunk/SKMainDocument.m      2024-11-30 15:50:52 UTC (rev 14768)
@@ -1641,23 +1641,16 @@
 
 - (void)savePasswordInKeychain:(NSString *)password {
     NSInteger saveOption = [[NSUserDefaults standardUserDefaults] 
integerForKey:SKSavePasswordOptionKey];
-    if (saveOption == SKOptionAlways) {
-        [self _savePasswordInKeychain:password];
-    } else if (saveOption == SKOptionAsk) {
+    if (saveOption == SKOptionAsk) {
         NSAlert *alert = [[NSAlert alloc] init];
         [alert setMessageText:[NSString 
stringWithFormat:NSLocalizedString(@"Remember Password?", @"Message in alert 
dialog"), nil]];
         [alert setInformativeText:NSLocalizedString(@"Do you want to save this 
password in your Keychain?", @"Informative text in alert dialog")];
-        [alert addButtonWithTitle:NSLocalizedString(@"Yes", @"Button title")];
-        [alert addButtonWithTitle:NSLocalizedString(@"No", @"Button title")];
-        NSWindow *window = [self windowForSheet];
-        if (window && [window attachedSheet] == nil)
-            [alert beginSheetModalForWindow:window 
completionHandler:^(NSModalResponse returnCode){
-                if (returnCode == NSAlertFirstButtonReturn)
-                    [self _savePasswordInKeychain:password];
-            }];
-        else if (NSAlertFirstButtonReturn == [alert runModal])
-            [self _savePasswordInKeychain:password];
+        [[alert addButtonWithTitle:NSLocalizedString(@"Yes", @"Button title")] 
setTag:SKOptionAlways];
+        [[alert addButtonWithTitle:NSLocalizedString(@"No", @"Button title")] 
setTag:SKOptionNever];
+        saveOption = [alert runModal];
     }
+    if (saveOption == SKOptionAlways)
+        [self _savePasswordInKeychain:password];
 }
 
 - (void)tryToUnlockDocument:(PDFDocument *)document {

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

Reply via email to