discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error in -NSURL writeToPasteboard:


From: Fred Kiefer
Subject: Re: Error in -NSURL writeToPasteboard:
Date: Tue, 24 Apr 2012 11:19:04 +0200

Thank you for spotting this. I don't have the time to work on it right now. If 
you have, could you at least revert my change? And maybe even add the proper 
solution into the known users of this method.

Thank you,
Fred


-------- Original-Nachricht --------
> Datum: Tue, 24 Apr 2012 10:37:05 +0200
> Von: Wolfgang Lux <wolfgang.lux@gmail.com>
> An: Fred Kiefer <fredkiefer@gmx.de>
> CC: discuss-gnustep@gnu.org
> Betreff: Re: Error in -NSURL writeToPasteboard:

> Fred Kiefer wrote:
> 
> > On 24.04.2012 09:37, Andreas Schik wrote:
> >> Hi,
> >> I was trying to install a default OpenURL service on my system and came
> >> across the following: while my service was being called it could not
> >> read the URL from the pasteboard. The pasteboard passed to my service
> >> reported an empty list of types, while there should of course be data
> of
> >> type NSURLPboardType.
> >> Digging around I found the above mentioned method declared in
> >> NSPasteboard.m. This is called from somewhere in NSWorkspace to pass
> the
> >> URL to the service. While the URL as such gets written to the
> >> pasteboard, the method IMHO forgets to declare the proper type.
> Changing
> >> the method as follows remedied my problem:
> >> 
> >> - (void) writeToPasteboard: (NSPasteboard *)pasteBoard
> >> {
> >>   [pasteBoard  declareTypes: [NSArray arrayWithObjects:
> >>                    NSURLPboardType,nil]
> >>            owner: nil];
> >>   [pasteBoard setString: [self absoluteString]
> >>            forType: NSURLPboardType];
> >> }
> > 
> > Committed. Thank you for the analysis and the patch.
> 
> But it's not how OS X works. Quoting the NSURL Additions documentation 
> https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSURL_AppKitAdditions/Reference/Reference.html%23//apple_ref/doc/uid/TP40004147
> it says "You must declare an NSURLPboardType data type for pasteboard
> before invoking this method; otherwise it returns without doing anything." So,
> the correct fix is adding
>   [pb declareTypes: [NSArray arrayWithObject: NSURLPboardType] owner:
> nil];
> to NSWorkspace -openURL:
> 
> Wolfgang
> 
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]