From 48fc70018ea1f1f2efa455a18fded95697209189 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Wed, 2 Jun 2021 10:44:45 +0200 Subject: [PATCH] Added UI setting to control toolbar style --- MacPass/MPDocumentWindowController.m | 12 ++++++++++-- MacPass/MPSettingsHelper.h | 3 +++ MacPass/MPSettingsHelper.m | 5 ++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 0b7cb1db..41622269 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -100,9 +100,17 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); [super windowDidLoad]; self.window.delegate = self.documentWindowDelegate; - //self.window.styleMask |= NSWindowStyleMaskFullSizeContentView; if (@available(macOS 11.0, *)) { - self.window.toolbarStyle = NSWindowToolbarStyleExpanded; + /* let the user decide how to dipsplay the toolbar */ + BOOL useUnifiedToolbar = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyUseUnifiedToolbar]; + if(useUnifiedToolbar) { + self.window.toolbarStyle = NSWindowToolbarStyleAutomatic; + // Do not use full size since the sidebar takes too much room! + // self.window.styleMask |= NSWindowStyleMaskFullSizeContentView; + } + else { + self.window.toolbarStyle = NSWindowToolbarStyleExpanded; + } } [self.window registerForDraggedTypes:@[NSURLPboardType]]; diff --git a/MacPass/MPSettingsHelper.h b/MacPass/MPSettingsHelper.h index b7dcacfb..8db6f3ba 100644 --- a/MacPass/MPSettingsHelper.h +++ b/MacPass/MPSettingsHelper.h @@ -94,6 +94,9 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyAllowRemoteFetchOfPluginRepository; /* Network */ APPKIT_EXTERN NSString *const kMPSettingsKeyFaviconDownloadMethod; +/* UI */ +APPKIT_EXTERN NSString *const kMPSettingsKeyUseUnifiedToolbar; + typedef NS_ENUM(NSUInteger, MPFileChangeStrategy) { MPFileChangeStrategyAsk, MPFileChangeStrategyKeepMine, diff --git a/MacPass/MPSettingsHelper.m b/MacPass/MPSettingsHelper.m index c17f8f91..9e9c0111 100644 --- a/MacPass/MPSettingsHelper.m +++ b/MacPass/MPSettingsHelper.m @@ -90,6 +90,8 @@ NSString *const kMPSettingsKeyAllowRemoteFetchOfPluginRepository = @"Al NSString *const kMPSettingsKeyFaviconDownloadMethod = @"FaviconDownloadMethod"; +NSString *const kMPSettingsKeyUseUnifiedToolbar =@"UseUnifiedToolbar"; + /* Deprecated */ NSString *const kMPDeprecatedSettingsKeyRememberKeyFilesForDatabases = @"kMPSettingsKeyRememberKeyFilesForDatabases"; NSString *const kMPDeprecatedSettingsKeyLastDatabasePath = @"MPLastDatabasePath"; @@ -170,7 +172,8 @@ NSString *const kMPDepricatedSettingsKeyAutotypeHideAccessibiltyWarning = @"Au kMPSettingsKeyEnableAutosave: @YES, kMPSettingsKeyHideAfterCopyToClipboard: @NO, kMPSettingsKeyFaviconDownloadMethod: @(MPFaviconDownloadMethodDirect), // Download directly from host - kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection: @NO + kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection: @NO, + kMPSettingsKeyUseUnifiedToolbar: @NO // Do not use unified toolbar under Big Sur and above }; }); return standardDefaults;