make us open url's as a service (bug 150860)

This commit is contained in:
pinkerton%netscape.com 2002-06-18 13:52:17 +00:00
Родитель 4faeb9741e
Коммит 1a3296abd6
8 изменённых файлов: 320 добавлений и 0 удалений

Просмотреть файл

@ -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