Handle OPML file import without drag & drop

This commit is contained in:
relikd
2019-07-28 22:43:18 +02:00
parent cd68febd88
commit bdc6d45a54
6 changed files with 41 additions and 7 deletions

View File

@@ -25,6 +25,7 @@
#import "FeedDownload.h"
#import "Preferences.h"
#import "DrawImage.h"
#import "SettingsFeeds+DragDrop.h"
@interface AppHook()
@property (strong) NSWindowController *prefWindow;
@@ -71,6 +72,19 @@
// NSURLComponents *comp = [NSURLComponents componentsWithString:url];
}
/// Handle opml file imports
- (void)application:(NSApplication *)sender openFiles:(NSArray<NSString *> *)filenames {
NSMutableArray<NSURL*> *urls = [NSMutableArray arrayWithCapacity:filenames.count];
for (NSString *file in filenames) {
NSURL *u = [NSURL fileURLWithPath:file];
if (u) [urls addObject:u];
}
[self openPreferences];
SettingsFeeds *sf = [(Preferences*)(self.prefWindow.window) selectFeedsTab];
[sf importOpmlFiles:urls];
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
}
#pragma mark - App Preferences