Camino only - Bug 364198: Allow the site icon for local files to act as a proxy for the file. r=smorgan sr=pink.
This commit is contained in:
Родитель
0fd88b54c4
Коммит
8c61d81f9f
|
@ -279,7 +279,7 @@
|
|||
if (localFlag)
|
||||
return (NSDragOperationCopy | NSDragOperationGeneric | NSDragOperationMove);
|
||||
|
||||
return (NSDragOperationDelete | NSDragOperationGeneric);
|
||||
return (NSDragOperationCopy | NSDragOperationGeneric | NSDragOperationLink | NSDragOperationDelete);
|
||||
}
|
||||
|
||||
- (void)mouseDragged:(NSEvent*)aEvent
|
||||
|
|
|
@ -1056,7 +1056,7 @@ const int kOutlineViewLeftMargin = 19; // determined empirically, since it doesn
|
|||
if (localFlag)
|
||||
return (NSDragOperationCopy | NSDragOperationGeneric | NSDragOperationMove);
|
||||
|
||||
return (NSDragOperationDelete | NSDragOperationGeneric);
|
||||
return (NSDragOperationCopy | NSDragOperationLink | NSDragOperationDelete | NSDragOperationGeneric);
|
||||
}
|
||||
|
||||
return NSDragOperationGeneric;
|
||||
|
|
|
@ -205,9 +205,12 @@ const int kMenuTruncationChars = 60;
|
|||
|
||||
// NSDraggingSource methods
|
||||
|
||||
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)flag
|
||||
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
||||
{
|
||||
return NSDragOperationGeneric | NSDragOperationCopy;
|
||||
if (isLocal)
|
||||
return (NSDragOperationGeneric | NSDragOperationCopy);
|
||||
|
||||
return (NSDragOperationGeneric | NSDragOperationCopy | NSDragOperationLink);
|
||||
}
|
||||
|
||||
// NSResponder methods
|
||||
|
|
|
@ -76,8 +76,8 @@
|
|||
{
|
||||
if (isLocal)
|
||||
return NSDragOperationGeneric;
|
||||
else
|
||||
return NSDragOperationCopy;
|
||||
|
||||
return (NSDragOperationLink | NSDragOperationCopy);
|
||||
}
|
||||
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
|
|
|
@ -53,6 +53,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
|
|||
NSArray* allTypes = [additionalTypes arrayByAddingObjectsFromArray:
|
||||
[NSArray arrayWithObjects:
|
||||
kWebURLsWithTitlesPboardType,
|
||||
NSFilenamesPboardType,
|
||||
NSURLPboardType,
|
||||
NSStringPboardType,
|
||||
kCorePasteboardFlavorType_url,
|
||||
|
@ -63,7 +64,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
|
|||
|
||||
//
|
||||
// Copy a single URL (with an optional title) to the clipboard in all relevant
|
||||
// formats. Convinience methods for clients that can only ever deal with one
|
||||
// formats. Convenience method for clients that can only ever deal with one
|
||||
// URL and shouldn't have to build up the arrays for setURLs:withTitles:.
|
||||
//
|
||||
- (void)setDataForURL:(NSString*)url title:(NSString*)title
|
||||
|
@ -83,21 +84,31 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
|
|||
//
|
||||
- (void)setURLs:(NSArray*)inUrls withTitles:(NSArray*)inTitles
|
||||
{
|
||||
unsigned int urlCount = [inUrls count];
|
||||
|
||||
// Best format that we know about is Safari's URL + title arrays - build these up
|
||||
NSMutableArray* tmpTitleArray = inTitles;
|
||||
if (!inTitles) {
|
||||
tmpTitleArray = [NSMutableArray array];
|
||||
for ( unsigned int i = 0; i < [inUrls count]; ++i )
|
||||
for (unsigned int i = 0; i < urlCount; ++i)
|
||||
[tmpTitleArray addObject:@""];
|
||||
}
|
||||
|
||||
NSMutableArray* filePaths = [NSMutableArray array];
|
||||
for (unsigned int i = 0; i < urlCount; ++i) {
|
||||
NSURL* url = [NSURL URLWithString:[inUrls objectAtIndex:i]];
|
||||
if ([url isFileURL])
|
||||
[filePaths addObject:[url path]];
|
||||
}
|
||||
[self setPropertyList:filePaths forType:NSFilenamesPboardType];
|
||||
|
||||
NSMutableArray* clipboardData = [NSMutableArray array];
|
||||
[clipboardData addObject:[NSArray arrayWithArray:inUrls]];
|
||||
[clipboardData addObject:tmpTitleArray];
|
||||
|
||||
[self setPropertyList:clipboardData forType:kWebURLsWithTitlesPboardType];
|
||||
|
||||
if ([inUrls count] == 1) {
|
||||
if (urlCount == 1) {
|
||||
NSString* title = @"";
|
||||
if (inTitles)
|
||||
title = [inTitles objectAtIndex:0];
|
||||
|
@ -114,7 +125,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType";
|
|||
tempCString = [title UTF8String];
|
||||
[self setData:[NSData dataWithBytes:tempCString length:strlen(tempCString)] forType:kCorePasteboardFlavorType_urln];
|
||||
}
|
||||
else if ([inUrls count] > 1)
|
||||
else if (urlCount > 1)
|
||||
{
|
||||
// With multiple URLs there aren't many other formats we can use
|
||||
// Just write a string of each URL (ignoring titles) on a separate line
|
||||
|
|
|
@ -468,7 +468,10 @@ static NSString* const kExpandedHistoryStatesDefaultsKey = @"history_expand_stat
|
|||
|
||||
- (unsigned int)outlineView:(NSOutlineView *)outlineView draggingSourceOperationMaskForLocal:(BOOL)localFlag
|
||||
{
|
||||
if (localFlag)
|
||||
return NSDragOperationGeneric;
|
||||
|
||||
return (NSDragOperationGeneric | NSDragOperationCopy | NSDragOperationLink);
|
||||
}
|
||||
|
||||
- (void)outlineViewItemDidExpand:(NSNotification *)notification
|
||||
|
|
Загрузка…
Ссылка в новой задаче