Revision: 23960
          http://sourceforge.net/p/bibdesk/svn/23960
Author:   hofman
Date:     2019-07-07 13:47:40 +0000 (Sun, 07 Jul 2019)
Log Message:
-----------
display URL fields when not using linked files and single item is selected

Modified Paths:
--------------
    trunk/bibdesk/BibDocument.h
    trunk/bibdesk/BibDocument_Actions.m
    trunk/bibdesk/BibDocument_DataSource.m
    trunk/bibdesk/BibDocument_UI.m

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2019-07-07 13:33:44 UTC (rev 23959)
+++ trunk/bibdesk/BibDocument.h 2019-07-07 13:47:40 UTC (rev 23960)
@@ -253,6 +253,7 @@
         unsigned int        ignoreGroupExpansionChange:1;
         unsigned int        controllingQLPreviewPanel:1;
         unsigned int        controllingFVPreviewPanel:1;
+        unsigned int        showingURLFields:1;
     } docFlags;
     
     NSString *basePath;

Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2019-07-07 13:33:44 UTC (rev 23959)
+++ trunk/bibdesk/BibDocument_Actions.m 2019-07-07 13:47:40 UTC (rev 23960)
@@ -897,7 +897,7 @@
 }
 
 - (IBAction)chooseLinkedFile:(id)sender {
-    if ([self isDisplayingFileContentSearch] || [self 
hasGroupTypeSelected:BDSKExternalGroupType] || [[self selectedPublications] 
count] != 1) {
+    if ([self isDisplayingFileContentSearch] || [self 
hasGroupTypeSelected:BDSKExternalGroupType] || [[self selectedPublications] 
count] != 1 || docFlags.showingURLFields) {
         NSBeep();
         return;
     }

Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m      2019-07-07 13:33:44 UTC (rev 
23959)
+++ trunk/bibdesk/BibDocument_DataSource.m      2019-07-07 13:47:40 UTC (rev 
23960)
@@ -1531,7 +1531,7 @@
         }
     }
     
-    if ([self isDisplayingFileContentSearch] == NO && [self 
hasGroupTypeSelected:BDSKExternalGroupType] == NO && [[self 
selectedPublications] count] == 1) {
+    if ([self isDisplayingFileContentSearch] == NO && [self 
hasGroupTypeSelected:BDSKExternalGroupType] == NO && [[self 
selectedPublications] count] == 1 && docFlags.showingURLFields == NO) {
         i = [menu indexOfItemWithTag:FVRemoveMenuItemTag];
         if (i != NSNotFound && theURL && [[aFileView selectionIndexes] count] 
== 1) {
             if ([theURL isFileURL]) {

Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m      2019-07-07 13:33:44 UTC (rev 23959)
+++ trunk/bibdesk/BibDocument_UI.m      2019-07-07 13:47:40 UTC (rev 23960)
@@ -287,7 +287,22 @@
             NSArray *selPubs = [self selectedPublications];
             if (selPubs) {
                 shownFiles = [[NSMutableArray alloc] initWithCapacity:[selPubs 
count]];
-                CFArrayApplyFunction((CFArrayRef)selPubs, CFRangeMake(0, 
[selPubs count]), addAllFileViewObjectsForItemToArray, shownFiles);
+                if (docFlags.showingURLFields) {
+                    BibItem *pub = [selPubs firstObject];
+                    NSURL *url;
+                    if ((url = [pub localFileURLForField:BDSKLocalUrlString])) 
{
+                        BDSKFileViewObject *obj = [[BDSKFileViewObject alloc] 
initWithURL:url string:[pub displayTitle]];
+                        [shownFiles addObject:obj];
+                        [obj release];
+                    }
+                    if ((url = [pub remoteURLForField:BDSKUrlString])) {
+                        BDSKFileViewObject *obj = [[BDSKFileViewObject alloc] 
initWithURL:url string:[pub displayTitle]];
+                        [shownFiles addObject:obj];
+                        [obj release];
+                    }
+                } else {
+                    CFArrayApplyFunction((CFArrayRef)selPubs, CFRangeMake(0, 
[selPubs count]), addAllFileViewObjectsForItemToArray, shownFiles);
+                }
             }
         }
     }
@@ -1186,6 +1201,12 @@
     [self updatePreviews];
     [groupOutlineView setNeedsDisplay:YES];
     BOOL fileViewEditable = [self isDisplayingFileContentSearch] == NO && 
[self hasGroupTypeSelected:BDSKExternalGroupType] == NO && [[self 
selectedPublications] count] == 1;
+    if (fileViewEditable && [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUseLocalUrlAndUrlKey] && [[[[self selectedPublications] 
firstObject] files] count] == 0) {
+        docFlags.showingURLFields = YES;
+        fileViewEditable = NO;
+    } else {
+        docFlags.showingURLFields = NO;
+    }
     [sideFileView removeAllProgressIndicators];
     [sideFileView setEditable:fileViewEditable];
     [sideFileView setAllowsDownloading:fileViewEditable];

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

Reply via email to