Revision: 14732
          http://sourceforge.net/p/skim-app/code/14732
Author:   hofman
Date:     2024-11-20 23:31:29 +0000 (Wed, 20 Nov 2024)
Log Message:
-----------
Use the same method for separate services with different userData

Modified Paths:
--------------
    trunk/Info.plist
    trunk/SKDocumentController.m

Modified: trunk/Info.plist
===================================================================
--- trunk/Info.plist    2024-11-20 22:55:40 UTC (rev 14731)
+++ trunk/Info.plist    2024-11-20 23:31:29 UTC (rev 14732)
@@ -433,7 +433,7 @@
                                <string>Show Skim Notes</string>
                        </dict>
                        <key>NSMessage</key>
-                       <string>openNotesDocumentFromURLOnPboard</string>
+                       <string>openDocumentFromURLOnPboard</string>
                        <key>NSPortName</key>
                        <string>Skim</string>
                        <key>NSRequiredContext</key>
@@ -457,6 +457,8 @@
                                <string>public.file-url</string>
                                <string>public.plain-text</string>
                        </array>
+                       <key>NSUserData</key>
+                       <string>1</string>
                </dict>
                <dict>
                        <key>NSMenuItem</key>
@@ -489,6 +491,8 @@
                                <string>public.file-url</string>
                                <string>public.plain-text</string>
                        </array>
+                       <key>NSUserData</key>
+                       <string>1</string>
                </dict>
                <dict>
                        <key>NSMenuItem</key>
@@ -497,7 +501,7 @@
                                <string>Print File with Skim</string>
                        </dict>
                        <key>NSMessage</key>
-                       
<string>printDocumentWithoutPanelFromURLOnPboard</string>
+                       <string>printDocumentPanelFromURLOnPboard</string>
                        <key>NSPortName</key>
                        <string>Skim</string>
                        <key>NSRequiredContext</key>

Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m        2024-11-20 22:55:40 UTC (rev 14731)
+++ trunk/SKDocumentController.m        2024-11-20 23:31:29 UTC (rev 14732)
@@ -679,7 +679,7 @@
 #pragma mark Services Support
 
 - (void)openDocumentFromURLOnPboard:(NSPasteboard *)pboard userData:(NSString 
*)userData error:(out NSString * __autoreleasing *)errorString {
-    [self openDocumentWithURLFromPasteboard:pboard showNotes:NO 
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError 
*error){}];
+    [self openDocumentWithURLFromPasteboard:pboard showNotes:[userData 
boolValue] completionHandler:^(NSDocument *document, BOOL 
documentWasAlreadyOpen, NSError *error){}];
 }
 
 - (void)openDocumentFromDataOnPboard:(NSPasteboard *)pboard userData:(NSString 
*)userData error:(out NSString * __autoreleasing *)errorString {
@@ -687,22 +687,11 @@
     
 }
 
-- (void)openNotesDocumentFromURLOnPboard:(NSPasteboard *)pboard 
userData:(NSString *)userData error:(out NSString * __autoreleasing 
*)errorString {
-    [self openDocumentWithURLFromPasteboard:pboard showNotes:YES 
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError 
*error){}];
-}
-
 - (void)printDocumentFromURLOnPboard:(NSPasteboard *)pboard userData:(NSString 
*)userData error:(out NSString * __autoreleasing *)errorString {
     NSURL *theURL = [[NSURL readURLsFromPasteboard:pboard] firstObject];
     if ([theURL isFileURL] && [[NSApp delegate] 
respondsToSelector:@selector(application:printFiles:withSettings:showPrintPanels:)])
 {
-        [[NSApp delegate] application:NSApp printFiles:@[theURL] 
withSettings:@{} showPrintPanels:YES];
+        [[NSApp delegate] application:NSApp printFiles:@[theURL] 
withSettings:@{} showPrintPanels:[userData boolValue]];
     }
 }
 
-- (void)printDocumentWithoutPanelFromURLOnPboard:(NSPasteboard *)pboard 
userData:(NSString *)userData error:(out NSString * __autoreleasing 
*)errorString {
-    NSURL *theURL = [[NSURL readURLsFromPasteboard:pboard] firstObject];
-    if ([theURL isFileURL] && [[NSApp delegate] 
respondsToSelector:@selector(application:printFiles:withSettings:showPrintPanels:)])
 {
-        [[NSApp delegate] application:NSApp printFiles:@[theURL] 
withSettings:@{} showPrintPanels:NO];
-    }
-}
-
 @end

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to