Respect startup page and 'remove download on complete' preferences
This commit is contained in:
parent
4201a58347
commit
7395cb8b66
|
@ -17,6 +17,7 @@
|
||||||
#import "BookmarkFolder.h"
|
#import "BookmarkFolder.h"
|
||||||
#import "BookmarksWindowController.h"
|
#import "BookmarksWindowController.h"
|
||||||
#import "PreferencesWindowController.h"
|
#import "PreferencesWindowController.h"
|
||||||
|
#import "Preferences.h"
|
||||||
|
|
||||||
#define MAX_RECENT_HISTORY 10
|
#define MAX_RECENT_HISTORY 10
|
||||||
|
|
||||||
|
@ -118,8 +119,9 @@ static NSMenuItem *menuItemForItem(id item) {
|
||||||
NSLog(@"Will create a new window %@", self);
|
NSLog(@"Will create a new window %@", self);
|
||||||
struct nsurl *url;
|
struct nsurl *url;
|
||||||
nserror error;
|
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) {
|
if (error == NSERROR_OK) {
|
||||||
error = browser_window_create(BW_CREATE_HISTORY, url, NULL, NULL, NULL);
|
error = browser_window_create(BW_CREATE_HISTORY, url, NULL, NULL, NULL);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "DownloadManager.h"
|
#import "DownloadManager.h"
|
||||||
#import "desktop/download.h"
|
#import "desktop/download.h"
|
||||||
|
#import "Preferences.h"
|
||||||
|
|
||||||
@implementation DownloadItem
|
@implementation DownloadItem
|
||||||
|
|
||||||
|
@ -105,6 +106,9 @@
|
||||||
[outputStream close];
|
[outputStream close];
|
||||||
completed = YES;
|
completed = YES;
|
||||||
[[manager delegate] downloadManager: manager didUpdateItem: self];
|
[[manager delegate] downloadManager: manager didUpdateItem: self];
|
||||||
|
if ([[Preferences defaultPreferences] removeDownloadsOnComplete]) {
|
||||||
|
[manager removeDownloadsAtIndexes: [NSIndexSet indexSetWithIndex: index]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL)isComplete {
|
-(BOOL)isComplete {
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
if ([defaults objectForKey: KEY_CONFIRM_OVERWRITE] != nil) {
|
if ([defaults objectForKey: KEY_CONFIRM_OVERWRITE] != nil) {
|
||||||
return [defaults boolForKey: KEY_CONFIRM_OVERWRITE];
|
return [defaults boolForKey: KEY_CONFIRM_OVERWRITE];
|
||||||
} else {
|
} else {
|
||||||
return NO;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-(void)setConfirmBeforeOverwriting: (BOOL)value {
|
-(void)setConfirmBeforeOverwriting: (BOOL)value {
|
||||||
|
|
|
@ -175,20 +175,10 @@
|
||||||
|
|
||||||
-(void)didPressStartupUseCurrentPage: (id)sender {
|
-(void)didPressStartupUseCurrentPage: (id)sender {
|
||||||
NSLog(@"Did press startup use current page");
|
NSLog(@"Did press startup use current page");
|
||||||
@try {
|
|
||||||
AppDelegate *delegate = [NSApp delegate];
|
AppDelegate *delegate = [NSApp delegate];
|
||||||
NSString *url = [delegate currentUrl];
|
NSString *url = [delegate currentUrl];
|
||||||
NSLog(@"url: %@", url);
|
|
||||||
[[Preferences defaultPreferences] setStartupUrl: url];
|
[[Preferences defaultPreferences] setStartupUrl: url];
|
||||||
[startupPageField setStringValue: [[Preferences defaultPreferences] startupUrl]];
|
[startupPageField setStringValue: [[Preferences defaultPreferences] startupUrl]];
|
||||||
}
|
|
||||||
@catch (NSException *ex) {
|
|
||||||
NSLog(@"ex: %@", ex);
|
|
||||||
}
|
|
||||||
@finally {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue