Respect startup page and 'remove download on complete' preferences

This commit is contained in:
anthony 2021-01-28 20:06:38 +00:00
parent 4201a58347
commit 7395cb8b66
4 changed files with 8 additions and 12 deletions

View File

@ -17,6 +17,7 @@
#import "BookmarkFolder.h"
#import "BookmarksWindowController.h"
#import "PreferencesWindowController.h"
#import "Preferences.h"
#define MAX_RECENT_HISTORY 10
@ -118,8 +119,9 @@ static NSMenuItem *menuItemForItem(id item) {
NSLog(@"Will create a new window %@", self);
struct nsurl *url;
nserror error;
NSString *startupUrl = [[Preferences defaultPreferences] startupUrl];
error = nsurl_create("https://www.startpage.com", &url);
error = nsurl_create([startupUrl cString], &url);
if (error == NSERROR_OK) {
error = browser_window_create(BW_CREATE_HISTORY, url, NULL, NULL, NULL);

View File

@ -1,6 +1,7 @@
#import <Cocoa/Cocoa.h>
#import "DownloadManager.h"
#import "desktop/download.h"
#import "Preferences.h"
@implementation DownloadItem
@ -105,6 +106,9 @@
[outputStream close];
completed = YES;
[[manager delegate] downloadManager: manager didUpdateItem: self];
if ([[Preferences defaultPreferences] removeDownloadsOnComplete]) {
[manager removeDownloadsAtIndexes: [NSIndexSet indexSetWithIndex: index]];
}
}
-(BOOL)isComplete {

View File

@ -77,7 +77,7 @@
if ([defaults objectForKey: KEY_CONFIRM_OVERWRITE] != nil) {
return [defaults boolForKey: KEY_CONFIRM_OVERWRITE];
} else {
return NO;
return YES;
}
}
-(void)setConfirmBeforeOverwriting: (BOOL)value {

View File

@ -175,20 +175,10 @@
-(void)didPressStartupUseCurrentPage: (id)sender {
NSLog(@"Did press startup use current page");
@try {
AppDelegate *delegate = [NSApp delegate];
NSString *url = [delegate currentUrl];
NSLog(@"url: %@", url);
[[Preferences defaultPreferences] setStartupUrl: url];
[startupPageField setStringValue: [[Preferences defaultPreferences] startupUrl]];
}
@catch (NSException *ex) {
NSLog(@"ex: %@", ex);
}
@finally {
}
}