Revision: 27627
http://sourceforge.net/p/bibdesk/svn/27627
Author: hofman
Date: 2022-06-13 16:34:36 +0000 (Mon, 13 Jun 2022)
Log Message:
-----------
Add a trash menu item to fileview context menu in main window when single pub
and single file selected
Modified Paths:
--------------
trunk/bibdesk/BibDocument_Actions.h
trunk/bibdesk/BibDocument_Actions.m
trunk/bibdesk/BibDocument_DataSource.h
trunk/bibdesk/BibDocument_DataSource.m
Modified: trunk/bibdesk/BibDocument_Actions.h
===================================================================
--- trunk/bibdesk/BibDocument_Actions.h 2022-06-13 15:53:31 UTC (rev 27626)
+++ trunk/bibdesk/BibDocument_Actions.h 2022-06-13 16:34:36 UTC (rev 27627)
@@ -131,6 +131,7 @@
#pragma mark URL actions
+- (IBAction)trashLinkedFile:(id)sender;
- (IBAction)chooseLinkedFile:(id)sender;
- (IBAction)chooseLinkedURL:(id)sender;
Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2022-06-13 15:53:31 UTC (rev 27626)
+++ trunk/bibdesk/BibDocument_Actions.m 2022-06-13 16:34:36 UTC (rev 27627)
@@ -995,6 +995,22 @@
[self previewURLs:[sender representedObject]];
}
+- (IBAction)trashLinkedFile:(id)sender {
+ BibItem *publication = [self singleSelectedPublication];
+ if (publication == nil || docFlags.showingURLFields) {
+ NSBeep();
+ return;
+ }
+
+ NSUInteger anIndex = NSNotFound;
+ NSNumber *indexNumber = [sender representedObject];
+ NSURL *url = nil;
+ if (indexNumber) {
+ anIndex = [indexNumber unsignedIntegerValue];
+ [self publication:publication deleteURLsAtIndexes:[NSIndexSet
indexSetWithIndex:anIndex] moveToTrash:1];
+ }
+}
+
- (IBAction)chooseLinkedFile:(id)sender {
BibItem *publication = [self singleSelectedPublication];
if (publication == nil || docFlags.showingURLFields) {
Modified: trunk/bibdesk/BibDocument_DataSource.h
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.h 2022-06-13 15:53:31 UTC (rev
27626)
+++ trunk/bibdesk/BibDocument_DataSource.h 2022-06-13 16:34:36 UTC (rev
27627)
@@ -54,4 +54,6 @@
- (BOOL)selectItemsInAuxFileURL:(NSURL *)auxURL;
+- (void)publication:(BibItem *)publication deleteURLsAtIndexes:(NSIndexSet
*)indexSet moveToTrash:(NSInteger)moveToTrash;
+
@end
Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m 2022-06-13 15:53:31 UTC (rev
27626)
+++ trunk/bibdesk/BibDocument_DataSource.m 2022-06-13 16:34:36 UTC (rev
27627)
@@ -1533,6 +1533,12 @@
i = [menu indexOfItemWithTag:FVRemoveMenuItemTag];
if (i != NSNotFound && theURL && [[aFileView selectionIndexes] count]
== 1) {
if ([theURL isFileURL]) {
+ item = [menu insertItemWithTitle:NSLocalizedString(@"Move To
Trash", @"Menu item title")
+ action:@selector(trashLinkedFile:)
+ keyEquivalent:@""
+ atIndex:++i];
+ [item setRepresentedObject:[NSNumber
numberWithUnsignedInteger:anIndex]];
+
item = [menu insertItemWithTitle:[NSLocalizedString(@"Replace
File", @"Menu item title") stringByAppendingEllipsis]
action:@selector(chooseLinkedFile:)
keyEquivalent:@""
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit