mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
NSPerformService fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17946 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7bbabe4e72
commit
e109b8d959
2 changed files with 44 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2003-10-21 Bjorn Giesler <bjoern@giesler.de>
|
||||
|
||||
* Source/GSServicesManager.m: Fix NSPerformService() to work for
|
||||
any localised service name.
|
||||
|
||||
2003-10-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSServicesManager.m: Revert last modification in favour
|
||||
of a fix by ... Bjorn.
|
||||
|
||||
2003-10-20 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSApplication.m (-changeWindowsItem:title:filename:): Use
|
||||
|
|
|
@ -1376,6 +1376,39 @@ GSContactApplication(NSString *appName, NSString *port, NSDate *expire)
|
|||
return app;
|
||||
}
|
||||
|
||||
NSDictionary *
|
||||
_serviceFromAnyLocalizedTitle(NSString *title)
|
||||
{
|
||||
NSDictionary *allServices;
|
||||
NSEnumerator *e1;
|
||||
NSDictionary *service;
|
||||
|
||||
allServices = [manager menuServices];
|
||||
if(allServices == nil)
|
||||
return nil;
|
||||
|
||||
if([allServices objectForKey: title] != nil)
|
||||
return [allServices objectForKey: title];
|
||||
|
||||
e1 = [allServices objectEnumerator];
|
||||
while((service = [e1 nextObject]))
|
||||
{
|
||||
NSDictionary *menuItems;
|
||||
NSString *itemName;
|
||||
NSEnumerator *e2;
|
||||
|
||||
menuItems = [service objectForKey: @"NSMenuItem"];
|
||||
if(menuItems == nil)
|
||||
continue;
|
||||
e2 = [menuItems objectEnumerator];
|
||||
while((itemName = [e2 nextObject]))
|
||||
if([itemName isEqualToString: title])
|
||||
return service;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Given the name of a serviceItem, and some data in a pasteboard
|
||||
* this function sends the data to the service provider (launching
|
||||
|
@ -1399,7 +1432,7 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
|
|||
NSString *userData;
|
||||
NSString *error = nil;
|
||||
|
||||
service = [[manager menuServices] objectForKey: serviceItem];
|
||||
service = _serviceFromAnyLocalizedTitle(serviceItem);
|
||||
if (service == nil)
|
||||
{
|
||||
NSRunAlertPanel(nil,
|
||||
|
|
Loading…
Reference in a new issue