mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
Fix bug 259903: allow the user to show file extensions when saving web pages, and correctly fix up the file extension when they swap formats.
This commit is contained in:
parent
1d20c7a55c
commit
11e658247d
@ -1,5 +1,12 @@
|
||||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {setNewSaveOption = id; };
|
||||
CLASS = FilterViewController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {mFilterView = NSView; mSaveOptionsPopUpButton = NSPopUpButton; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
|
@ -3,22 +3,17 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>68 59 356 240 0 0 1280 832 </string>
|
||||
<string>92 76 356 240 0 0 1600 1002 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>13</key>
|
||||
<string>515 513 206 82 0 0 1280 832 </string>
|
||||
<string>676 627 206 82 0 0 1600 1002 </string>
|
||||
<key>5</key>
|
||||
<string>474 513 288 82 0 0 1280 832 </string>
|
||||
<string>635 627 288 82 0 0 1600 1002 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>364.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
<integer>13</integer>
|
||||
</array>
|
||||
<string>437.0</string>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7M34</string>
|
||||
<string>8C46</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Binary file not shown.
@ -81,3 +81,14 @@ private:
|
||||
NSView* mFilterView;
|
||||
};
|
||||
|
||||
|
||||
@interface FilterViewController : NSObject
|
||||
{
|
||||
IBOutlet NSPopUpButton* mSaveOptionsPopUpButton;
|
||||
IBOutlet NSView* mFilterView;
|
||||
}
|
||||
|
||||
-(IBAction)setNewSaveOption:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -320,8 +320,15 @@ nsresult nsHeaderSniffer::PerformSave(nsIURI* inOriginalURI)
|
||||
if (!defaultFileName.IsEmpty())
|
||||
file = [NSString stringWith_nsAString:defaultFileName];
|
||||
|
||||
if (isHTML)
|
||||
if (isHTML) {
|
||||
[savePanel setAccessoryView: mFilterView];
|
||||
// need this because the |stringWith_nsAString| returns a NSString
|
||||
// with an extension that the savePanel does not like and will add
|
||||
// the extensions on top of an extensions
|
||||
NSLog([file pathExtension]);
|
||||
[savePanel setRequiredFileType: [file pathExtension]];
|
||||
[savePanel setCanSelectHiddenExtension: YES];
|
||||
}
|
||||
|
||||
if ([savePanel runModalForDirectory: nil file: file] == NSFileHandlingPanelCancelButton)
|
||||
return NS_OK;
|
||||
@ -426,3 +433,25 @@ nsresult nsHeaderSniffer::InitiateDownload(nsISupports* inSourceData, nsString&
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation FilterViewController
|
||||
|
||||
-(IBAction)setNewSaveOption:(id)sender
|
||||
{
|
||||
if ([[mFilterView window] isKindOfClass:[NSSavePanel class]])
|
||||
{
|
||||
NSSavePanel* savePanel = (NSSavePanel*) [mFilterView window];
|
||||
if (savePanel)
|
||||
{
|
||||
if ([mSaveOptionsPopUpButton indexOfSelectedItem] == eSaveFormatPlainText)
|
||||
[savePanel setRequiredFileType:@"txt"];
|
||||
|
||||
else // rest of the selections all use .html extension
|
||||
[savePanel setRequiredFileType:@"html"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user