Option to export selected items

This commit is contained in:
relikd
2019-07-29 01:12:58 +02:00
parent cb117c0f01
commit 314a3ea9cb
4 changed files with 17 additions and 8 deletions

View File

@@ -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: Right click menu with edit actions
- Settings, Feeds: Drag & Drop feeds from / to OPML file - Settings, Feeds: Drag & Drop feeds from / to OPML file
- Settings, Feeds: Drag & Drop feed titles and urls as text - Settings, Feeds: Drag & Drop feed titles and urls as text
- Settings, Feeds: OPML export with selected items only
- Accessibility hints for most UI elements - Accessibility hints for most UI elements
- Associate OPML files (double click and right click actions in Finder) - Associate OPML files (double click and right click actions in Finder)

View File

@@ -68,8 +68,6 @@
[self reopenPreferencesIfOpen]; [self reopenPreferencesIfOpen];
}]; }];
} }
// TODO: handle other app schemes like configuration export / import
// NSURLComponents *comp = [NSURLComponents componentsWithString:url];
} }
/// Handle opml file imports /// Handle opml file imports

View File

@@ -60,7 +60,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>9639</string> <string>9654</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key> <key>LSUIElement</key>

View File

@@ -212,14 +212,24 @@ NS_INLINE NSInteger RadioGroupSelection(NSView *view) {
sp.nameFieldStringValue = [NSString stringWithFormat:@"baRSS feeds %@", [NSDate dayStringLocalized]]; sp.nameFieldStringValue = [NSString stringWithFormat:@"baRSS feeds %@", [NSDate dayStringLocalized]];
sp.allowedFileTypes = @[UTI_OPML]; sp.allowedFileTypes = @[UTI_OPML];
sp.allowsOtherFileTypes = YES; sp.allowsOtherFileTypes = YES;
NSView *radioView = [NSView radioGroup:@[NSLocalizedString(@"Hierarchical", nil), NSView *select = [NSView radioGroup:@[NSLocalizedString(@"Everything", nil),
NSLocalizedString(@"Selection", nil)]];
NSView *nested = [NSView radioGroup:@[NSLocalizedString(@"Hierarchical", nil),
NSLocalizedString(@"Flattened", nil)]]; NSLocalizedString(@"Flattened", nil)]];
sp.accessoryView = [NSView wrapView:radioView withLabel:NSLocalizedString(@"Export format:", nil) padding:PAD_M]; 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) { [sp beginSheetModalForWindow:window completionHandler:^(NSModalResponse result) {
if (result == NSModalResponseOK) { if (result == NSModalResponseOK) {
OpmlFileExportOptions opt = OpmlFileExportOptionFullBackup; OpmlFileExportOptions opt = 0;
if (RadioGroupSelection(radioView) == 1) if (RadioGroupSelection(select) == 0)
opt |= OpmlFileExportOptionFullBackup;
if (RadioGroupSelection(nested) == 1)
opt |= OpmlFileExportOptionFlattened; opt |= OpmlFileExportOptionFlattened;
[self writeOPMLFile:sp.URL withOptions:opt]; [self writeOPMLFile:sp.URL withOptions:opt];
} }