From 314a3ea9cb36b2196aa793f947fa8d683b860b56 Mon Sep 17 00:00:00 2001 From: relikd Date: Mon, 29 Jul 2019 01:12:58 +0200 Subject: [PATCH] Option to export selected items --- CHANGELOG.md | 1 + baRSS/AppHook.m | 2 -- baRSS/Info.plist | 2 +- baRSS/Preferences/Feeds Tab/OpmlFile.m | 20 +++++++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95db382..151338c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project does NOT adhere to [Semantic Versioning](https://semver.org/spe - Settings, Feeds: Right click menu with edit actions - Settings, Feeds: Drag & Drop feeds from / to OPML file - Settings, Feeds: Drag & Drop feed titles and urls as text +- Settings, Feeds: OPML export with selected items only - Accessibility hints for most UI elements - Associate OPML files (double click and right click actions in Finder) diff --git a/baRSS/AppHook.m b/baRSS/AppHook.m index 96b0cad..1ef0371 100644 --- a/baRSS/AppHook.m +++ b/baRSS/AppHook.m @@ -68,8 +68,6 @@ [self reopenPreferencesIfOpen]; }]; } - // TODO: handle other app schemes like configuration export / import - // NSURLComponents *comp = [NSURLComponents componentsWithString:url]; } /// Handle opml file imports diff --git a/baRSS/Info.plist b/baRSS/Info.plist index 18cb44a..8725043 100644 --- a/baRSS/Info.plist +++ b/baRSS/Info.plist @@ -60,7 +60,7 @@ CFBundleVersion - 9639 + 9654 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) LSUIElement diff --git a/baRSS/Preferences/Feeds Tab/OpmlFile.m b/baRSS/Preferences/Feeds Tab/OpmlFile.m index d2add32..576f7dc 100644 --- a/baRSS/Preferences/Feeds Tab/OpmlFile.m +++ b/baRSS/Preferences/Feeds Tab/OpmlFile.m @@ -212,14 +212,24 @@ NS_INLINE NSInteger RadioGroupSelection(NSView *view) { sp.nameFieldStringValue = [NSString stringWithFormat:@"baRSS feeds %@", [NSDate dayStringLocalized]]; sp.allowedFileTypes = @[UTI_OPML]; sp.allowsOtherFileTypes = YES; - NSView *radioView = [NSView radioGroup:@[NSLocalizedString(@"Hierarchical", nil), - NSLocalizedString(@"Flattened", nil)]]; - sp.accessoryView = [NSView wrapView:radioView withLabel:NSLocalizedString(@"Export format:", nil) padding:PAD_M]; + NSView *select = [NSView radioGroup:@[NSLocalizedString(@"Everything", nil), + NSLocalizedString(@"Selection", nil)]]; + NSView *nested = [NSView radioGroup:@[NSLocalizedString(@"Hierarchical", nil), + NSLocalizedString(@"Flattened", nil)]]; + NSView *v1 = [NSView wrapView:select withLabel:NSLocalizedString(@"Export:", nil) padding:PAD_M]; + NSView *v2 = [NSView wrapView:nested withLabel:NSLocalizedString(@"Format:", nil) padding:PAD_M]; + NSView *final = [[NSView alloc] init]; + [v1 placeIn:final x:0 yTop:0]; + [v2 placeIn:final x:NSWidth(v1.frame) + 100 yTop:0]; + [final setFrameSize:NSMakeSize(NSMaxX(v2.frame), NSHeight(v2.frame))]; + sp.accessoryView = final; [sp beginSheetModalForWindow:window completionHandler:^(NSModalResponse result) { if (result == NSModalResponseOK) { - OpmlFileExportOptions opt = OpmlFileExportOptionFullBackup; - if (RadioGroupSelection(radioView) == 1) + OpmlFileExportOptions opt = 0; + if (RadioGroupSelection(select) == 0) + opt |= OpmlFileExportOptionFullBackup; + if (RadioGroupSelection(nested) == 1) opt |= OpmlFileExportOptionFlattened; [self writeOPMLFile:sp.URL withOptions:opt]; }