Handle OPML file import without drag & drop
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user