Revision: 24064
http://sourceforge.net/p/bibdesk/svn/24064
Author: hofman
Date: 2019-07-20 21:14:40 +0000 (Sat, 20 Jul 2019)
Log Message:
-----------
Allow downloading Url field whne Local-Url is set, but ask the user first
Modified Paths:
--------------
trunk/bibdesk/BDSKEditor.m
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibItem.m
trunk/bibdesk/English.lproj/Localizable.strings
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2019-07-20 06:30:26 UTC (rev 24063)
+++ trunk/bibdesk/BDSKEditor.m 2019-07-20 21:14:40 UTC (rev 24064)
@@ -567,10 +567,28 @@
}
}
+- (void)downloadAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode
contextInfo:(void *)contextInfo {
+ if (returnCode == NSAlertFirstButtonReturn)
+ [publication downloadURLForField:BDSKUrlString];
+}
+
- (IBAction)downloadRemoteURL:(id)sender{
if ([[NSUserDefaults standardUserDefaults]
boolForKey:BDSKUseLocalUrlAndUrlKey]) {
- if ([publication canDownloadURLForField:BDSKUrlString])
- [publication downloadURLForField:BDSKUrlString];
+ if ([publication canDownloadURLForField:BDSKUrlString]) {
+ if ([NSString isEmptyString:[publication
valueOfField:BDSKLocalUrlString inherit:NO]]) {
+ [publication downloadURLForField:BDSKUrlString];
+ } else {
+ NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+ [alert setMessageText:NSLocalizedString(@"Local-Url is set",
@"Message in alert dialog")];
+ [alert setInformativeText:NSLocalizedString(@"Downloading will
overwrite the current value of the Local-Url field. Do you want to proceed?",
@"Informative text in alert dialog")];
+ [alert addButtonWithTitle:NSLocalizedString(@"Download",
@"Button title")];
+ [alert addButtonWithTitle:NSLocalizedString(@"Cancel",
@"Button title")];
+ [alert beginSheetModalForWindow:[self window]
+ modalDelegate:self
+
didEndSelector:@selector(downloadAlertDidEnd:returnCode:contextInfo:)
+ contextInfo:NULL];
+ }
+ }
} else {
for (BDSKLinkedFile *file in [publication remoteURLs]) {
if ([publication canDownloadLinkedFile:file])
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2019-07-20 06:30:26 UTC (rev 24063)
+++ trunk/bibdesk/BibDocument.m 2019-07-20 21:14:40 UTC (rev 24064)
@@ -2105,7 +2105,7 @@
NSArray *types = [sud stringArrayForKey:BDSKURLTypesToDownloadKey];
for (pub in newPubs) {
if (useLocalUrlAndUrl) {
- if ([pub canDownloadURLForField:BDSKUrlString] && [[pub
localFiles] count] == 0 && [types containsObject:[[[pub
remoteURLForField:BDSKUrlString] pathExtension] lowercaseString] ?: @""])
+ if ([pub canDownloadURLForField:BDSKUrlString] && [NSString
isEmptyString:[pub valueOfField:BDSKLocalUrlString inherit:NO]] && [types
containsObject:[[[pub remoteURLForField:BDSKUrlString] pathExtension]
lowercaseString] ?: @""])
[pub downloadURLForField:BDSKUrlString];
} else if ([[pub localFiles] count] == 0) {
for (BDSKLinkedFile *linkedURL in [pub remoteURLs]) {
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2019-07-20 06:30:26 UTC (rev 24063)
+++ trunk/bibdesk/BibItem.m 2019-07-20 21:14:40 UTC (rev 24064)
@@ -3195,7 +3195,7 @@
NSURL *url = [self remoteURLForField:field];
if (url == nil || [[downloads valueForKey:@"URL"] containsObject:url])
return NO;
- return [NSString isEmptyString:[self valueOfField:BDSKLocalUrlString
inherit:NO]];
+ return YES;
}
#pragma mark -
Modified: trunk/bibdesk/English.lproj/Localizable.strings
===================================================================
(Binary files differ)
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