Commit d22f35d1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Implement a basic version of 'Download-from-HTTP-Server'

parent 7a07db5d
......@@ -119,6 +119,8 @@
if (pasteURL && ![[pasteURL scheme] isEqualToString:@""] && ![[pasteURL absoluteString] isEqualToString:@""])
self.openURLField.text = [pasteURL absoluteString];
}
if (self.openURLView.superview)
[self.openURLView removeFromSuperview];
[self.openNetworkStreamButton addSubview:self.openURLView];
} else {
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
......@@ -129,7 +131,26 @@
- (IBAction)downloadFromHTTPServer:(id)sender
{
//TODO
if (sender == self.downloadFromHTTPServerButton) {
if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:@[@"public.url", @"public.text"]]) {
NSURL *pasteURL = [[UIPasteboard generalPasteboard] valueForPasteboardType:@"public.url"];
if (!pasteURL || [[pasteURL absoluteString] isEqualToString:@""]) {
NSString *pasteString = [[UIPasteboard generalPasteboard] valueForPasteboardType:@"public.text"];
pasteURL = [NSURL URLWithString:pasteString];
}
if (pasteURL && ![[pasteURL scheme] isEqualToString:@""] && ![[pasteURL absoluteString] isEqualToString:@""])
self.openURLField.text = [pasteURL absoluteString];
}
if (self.openURLView.superview)
[self.openURLView removeFromSuperview];
[self.downloadFromHTTPServerButton addSubview:self.openURLView];
} else {
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
NSURL *URLtoSave = [NSURL URLWithString:self.openURLField.text];
if ([URLtoSave.scheme isEqualToString:@"http"] || [URLtoSave.scheme isEqualToString:@"https"])
[appDelegate application:[UIApplication sharedApplication] openURL:URLtoSave sourceApplication:@"self" annotation:nil];
}
}
- (IBAction)showSettings:(id)sender
......
......@@ -43,7 +43,7 @@
if (_playlistViewController && url != nil) {
APLog(@"%@ requested %@ to be opened", sourceApplication, url);
if (url.isFileURL) {
if (url.isFileURL || [url.scheme isEqualToString:@"http"] || [url.scheme isEqualToString:@"https"]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"SAVE_FILE", @"") message:[NSString stringWithFormat:NSLocalizedString(@"SAVE_FILE_LONG", @""), url.lastPathComponent] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:NSLocalizedString(@"BUTTON_SAVE", @""), nil];
_tempURL = url;
[alert show];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment