[Clipboard] Add textual data to clipboard on copy
The copy action now includes formatted text of the selected entries when copying, in addition to the supported file and URL types. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
4c95c943ef
commit
72c4dddf18
|
@ -20,6 +20,7 @@
|
|||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingStatus;
|
||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingStatusMessage;
|
||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingSpam;
|
||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingIndexedSpam;
|
||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingAlbumArt;
|
||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingTrackText;
|
||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingLengthText;
|
||||
|
@ -33,6 +34,7 @@
|
|||
@property(nonatomic, readonly) NSString *_Nonnull filename;
|
||||
|
||||
@property(nonatomic, readonly) NSString *_Nonnull spam;
|
||||
@property(nonatomic, readonly) NSString *_Nonnull indexedSpam;
|
||||
|
||||
@property(nonatomic, readonly) NSString *_Nonnull positionText;
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
|
|||
return [NSSet setWithObjects:@"albumartist", @"artist", @"rawTitle", @"album", @"track", @"disc", @"totalFrames", @"currentPosition", @"bitrate", nil];
|
||||
}
|
||||
|
||||
+ (NSSet *)keyPathsForValuesAffectingIndexedSpam {
|
||||
return [NSSet setWithObjects:@"albumartist", @"artist", @"rawTitle", @"album", @"track", @"disc", @"totalFrames", @"currentPosition", @"bitrate", @"index", nil];
|
||||
}
|
||||
|
||||
+ (NSSet *)keyPathsForValuesAffectingTrackText {
|
||||
return [NSSet setWithObjects:@"track", @"disc", nil];
|
||||
}
|
||||
|
@ -121,6 +125,11 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
|
|||
}
|
||||
}
|
||||
|
||||
@dynamic indexedSpam;
|
||||
- (NSString *)indexedSpam {
|
||||
return [NSString stringWithFormat:@"%llu. %@", self.index, self.spam];
|
||||
}
|
||||
|
||||
@dynamic spam;
|
||||
- (NSString *)spam {
|
||||
BOOL hasBitrate = (self.bitrate != 0);
|
||||
|
|
|
@ -220,10 +220,15 @@
|
|||
NSUInteger capacity = [entries count];
|
||||
NSMutableArray *selectedURLs = [NSMutableArray arrayWithCapacity:capacity];
|
||||
|
||||
NSMutableArray *fileSpams = [NSMutableArray array];
|
||||
|
||||
for(PlaylistEntry *pe in entries) {
|
||||
[selectedURLs addObject:pe.url];
|
||||
[fileSpams addObject:pe.indexedSpam];
|
||||
}
|
||||
|
||||
[pboard writeObjects:@[[fileSpams componentsJoinedByString:@"\n"]]];
|
||||
|
||||
NSError *error;
|
||||
NSData *data;
|
||||
if(@available(macOS 10.13, *)) {
|
||||
|
|
Loading…
Reference in New Issue