mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
[macos] fix bug 65972
This commit is contained in:
@ -583,14 +583,15 @@
|
||||
|
||||
[self.tabsControl selectTab:tab];
|
||||
|
||||
__block NSInteger fileType = [params[@"fileType"] intValue];
|
||||
// __block NSInteger fileType = [params[@"fileType"] intValue];
|
||||
|
||||
__block ASCSavePanelWithFormatController * saveController = [ASCSavePanelWithFormatController new];
|
||||
|
||||
NSSavePanel * savePanel = [saveController savePanel];
|
||||
|
||||
saveController.filters = formats;
|
||||
saveController.filterType = fileType;
|
||||
saveController.original = params[@"original"];
|
||||
// saveController.filterType = fileType;
|
||||
|
||||
if (!path || path.length < 1) {
|
||||
path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
|
||||
|
||||
@ -330,11 +330,18 @@ public:
|
||||
|
||||
// End hotfix ODP presentation
|
||||
|
||||
NSDictionary * formatInfo = [ASCConstants ascFormatsInfo][@(pData->get_FileType())];
|
||||
NSDictionary * originalFileInfo = @{
|
||||
@"type" : @(pData->get_FileType()),
|
||||
@"typeInfo" : formatInfo ? formatInfo : @{}
|
||||
};
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:CEFEventNameSaveLocal
|
||||
object:nil
|
||||
userInfo:@{
|
||||
@"path" : [NSString stringWithstdwstring:pData->get_Path()],
|
||||
@"fileType": @(pData->get_FileType()),
|
||||
// @"fileType": @(pData->get_FileType()),
|
||||
@"original": originalFileInfo,
|
||||
@"supportedFormats" : supportFormats,
|
||||
@"viewId" : [NSString stringWithFormat:@"%d", pData->get_Id()]
|
||||
}];
|
||||
|
||||
@ -44,4 +44,5 @@
|
||||
@property (nonatomic) NSSavePanel *savePanel;
|
||||
@property (nonatomic) NSArray * filters;
|
||||
@property (nonatomic) NSInteger filterType;
|
||||
@property (nonatomic) NSDictionary * original;
|
||||
@end
|
||||
|
||||
@ -109,6 +109,18 @@
|
||||
}];
|
||||
|
||||
if (NSNotFound == index) {
|
||||
if ( _original ) {
|
||||
NSString * postfix = _original[@"typeInfo"][@"extension"];
|
||||
if ( postfix ) {
|
||||
predicate = [NSPredicate predicateWithFormat:@"self.extension == %@", postfix];
|
||||
index = [_filters indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
return [predicate evaluateWithObject:obj];
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( NSNotFound == index ) {
|
||||
NSInteger selectIndex = MAX([_popupFormats indexOfSelectedItem], 0);
|
||||
_filterType = [_filters[selectIndex][@"type"] intValue];
|
||||
} else {
|
||||
@ -117,4 +129,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setOriginal:(NSDictionary *)original {
|
||||
_original = original;
|
||||
[self setFilterType:[original[@"type"] intValue]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user