mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
make us open url's as a service (bug 150860)
This commit is contained in:
parent
99fbbed83e
commit
66c181d5df
@ -378,6 +378,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
@ -4197,6 +4220,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
|
@ -79,6 +79,9 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
mSplashScreen = [[CHSplashScreenWindow alloc] splashImage:nil withFade:YES withStatusRect:NSMakeRect(0,0,0,0)];
|
||||
mFindDialog = nil;
|
||||
mMenuBookmarks = nil;
|
||||
|
||||
[NSApp setServicesProvider:self];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -516,4 +519,35 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return NO;
|
||||
}
|
||||
|
||||
// services
|
||||
|
||||
- (void)openURL:(NSPasteboard *) pboard userData:(NSString *) userData error:(NSString **) error
|
||||
{
|
||||
NSString *urlString = [[[NSMutableString alloc] init] autorelease];
|
||||
if ( !urlString )
|
||||
return;
|
||||
|
||||
NSArray* types = [pboard types];
|
||||
if (![types containsObject:NSStringPboardType]) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSString* pboardString = [pboard stringForType:NSStringPboardType];
|
||||
if (!pboardString) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSScanner* scanner = [NSScanner scannerWithString:pboardString];
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&urlString];
|
||||
while(![scanner isAtEnd]) {
|
||||
NSString *tmpString;
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&tmpString];
|
||||
[urlString appendString:tmpString];
|
||||
}
|
||||
|
||||
[self openBrowserWindowWithURLString:urlString];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -378,6 +378,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
@ -4197,6 +4220,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
|
@ -79,6 +79,9 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
mSplashScreen = [[CHSplashScreenWindow alloc] splashImage:nil withFade:YES withStatusRect:NSMakeRect(0,0,0,0)];
|
||||
mFindDialog = nil;
|
||||
mMenuBookmarks = nil;
|
||||
|
||||
[NSApp setServicesProvider:self];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -516,4 +519,35 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return NO;
|
||||
}
|
||||
|
||||
// services
|
||||
|
||||
- (void)openURL:(NSPasteboard *) pboard userData:(NSString *) userData error:(NSString **) error
|
||||
{
|
||||
NSString *urlString = [[[NSMutableString alloc] init] autorelease];
|
||||
if ( !urlString )
|
||||
return;
|
||||
|
||||
NSArray* types = [pboard types];
|
||||
if (![types containsObject:NSStringPboardType]) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSString* pboardString = [pboard stringForType:NSStringPboardType];
|
||||
if (!pboardString) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSScanner* scanner = [NSScanner scannerWithString:pboardString];
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&urlString];
|
||||
while(![scanner isAtEnd]) {
|
||||
NSString *tmpString;
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&tmpString];
|
||||
[urlString appendString:tmpString];
|
||||
}
|
||||
|
||||
[self openBrowserWindowWithURLString:urlString];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -378,6 +378,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
@ -4197,6 +4220,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
|
@ -79,6 +79,9 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
mSplashScreen = [[CHSplashScreenWindow alloc] splashImage:nil withFade:YES withStatusRect:NSMakeRect(0,0,0,0)];
|
||||
mFindDialog = nil;
|
||||
mMenuBookmarks = nil;
|
||||
|
||||
[NSApp setServicesProvider:self];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -516,4 +519,35 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return NO;
|
||||
}
|
||||
|
||||
// services
|
||||
|
||||
- (void)openURL:(NSPasteboard *) pboard userData:(NSString *) userData error:(NSString **) error
|
||||
{
|
||||
NSString *urlString = [[[NSMutableString alloc] init] autorelease];
|
||||
if ( !urlString )
|
||||
return;
|
||||
|
||||
NSArray* types = [pboard types];
|
||||
if (![types containsObject:NSStringPboardType]) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSString* pboardString = [pboard stringForType:NSStringPboardType];
|
||||
if (!pboardString) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSScanner* scanner = [NSScanner scannerWithString:pboardString];
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&urlString];
|
||||
while(![scanner isAtEnd]) {
|
||||
NSString *tmpString;
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&tmpString];
|
||||
[urlString appendString:tmpString];
|
||||
}
|
||||
|
||||
[self openBrowserWindowWithURLString:urlString];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -378,6 +378,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
@ -4197,6 +4220,29 @@
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSServices</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSKeyEquivalent</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>U</string>
|
||||
</dict>
|
||||
<key>NSMenuItem</key>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<string>Open URL in Navigator</string>
|
||||
</dict>
|
||||
<key>NSMessage</key>
|
||||
<string>openURL</string>
|
||||
<key>NSPortName</key>
|
||||
<string>Navigator</string>
|
||||
<key>NSSendTypes</key>
|
||||
<array>
|
||||
<string>NSStringPboardType</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
";
|
||||
|
@ -79,6 +79,9 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
mSplashScreen = [[CHSplashScreenWindow alloc] splashImage:nil withFade:YES withStatusRect:NSMakeRect(0,0,0,0)];
|
||||
mFindDialog = nil;
|
||||
mMenuBookmarks = nil;
|
||||
|
||||
[NSApp setServicesProvider:self];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -516,4 +519,35 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||
return NO;
|
||||
}
|
||||
|
||||
// services
|
||||
|
||||
- (void)openURL:(NSPasteboard *) pboard userData:(NSString *) userData error:(NSString **) error
|
||||
{
|
||||
NSString *urlString = [[[NSMutableString alloc] init] autorelease];
|
||||
if ( !urlString )
|
||||
return;
|
||||
|
||||
NSArray* types = [pboard types];
|
||||
if (![types containsObject:NSStringPboardType]) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSString* pboardString = [pboard stringForType:NSStringPboardType];
|
||||
if (!pboardString) {
|
||||
*error = NSLocalizedString(@"Error: couldn't open URL.",
|
||||
@"pboard couldn't give URL string.");
|
||||
return;
|
||||
}
|
||||
NSScanner* scanner = [NSScanner scannerWithString:pboardString];
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&urlString];
|
||||
while(![scanner isAtEnd]) {
|
||||
NSString *tmpString;
|
||||
[scanner scanCharactersFromSet:[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] intoString:&tmpString];
|
||||
[urlString appendString:tmpString];
|
||||
}
|
||||
|
||||
[self openBrowserWindowWithURLString:urlString];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user