diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 45d83955..2bcbf6dd 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -229,6 +229,7 @@ 4CA0B2F915BCAF6700654E32 /* MPGeneralSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0B2F815BCAF6700654E32 /* MPGeneralSettingsController.m */; }; 4CA0B2FC15BCAF8600654E32 /* MPSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0B2FB15BCAF8600654E32 /* MPSettingsWindowController.m */; }; 4CA0E3A7176FAF99004D18CB /* MPDocumentQueryService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */; }; + 4CA0F3ED1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0F3EC1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.m */; }; 4CA2335A176DBFE100F0B6AC /* MPLockDaemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */; }; 4CA334CA18AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA334C918AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m */; }; 4CA3530B18A53CB800839B0F /* MPKeyMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA3530A18A53CB800839B0F /* MPKeyMapper.m */; }; @@ -556,7 +557,7 @@ 4C3D4C0617594CA40038DAAC /* HNHSeparator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHSeparator.h; sourceTree = ""; }; 4C3D4C0717594CA40038DAAC /* HNHSeparator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHSeparator.m; sourceTree = ""; }; 4C3F28521791EDE800703281 /* KPKErrors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKErrors.h; sourceTree = ""; }; - 4C3F28531791EDFD00703281 /* KPKErrors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKErrors.m; sourceTree = ""; }; + 4C3F28531791EDFD00703281 /* KPKErrors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = KPKErrors.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4C3FFD9D16DAF60600DF9186 /* ContextBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ContextBar.xib; sourceTree = ""; }; 4C431BCB16E2A82700700A81 /* MPPasteBoardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasteBoardController.h; sourceTree = ""; }; 4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasteBoardController.m; sourceTree = ""; }; @@ -598,9 +599,9 @@ 4C52A88C1788628B00868229 /* 13_KeysTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 13_KeysTemplate.pdf; sourceTree = ""; }; 4C52A88D1788628B00868229 /* 18_DisplayTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 18_DisplayTemplate.pdf; sourceTree = ""; }; 4C52A891178863B000868229 /* 68_PhoneTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 68_PhoneTemplate.pdf; sourceTree = ""; }; - 4C53A7A81864C3A1000DFF0D /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/KPKLocalizable.strings; sourceTree = ""; }; - 4C53A7A91864C3A2000DFF0D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/KPKLocalizable.strings; sourceTree = ""; }; - 4C53A7AA1864C3A2000DFF0D /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/KPKLocalizable.strings; sourceTree = ""; }; + 4C53A7A81864C3A1000DFF0D /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; lineEnding = 0; name = de; path = de.lproj/KPKLocalizable.strings; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; }; + 4C53A7A91864C3A2000DFF0D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; lineEnding = 0; name = en; path = en.lproj/KPKLocalizable.strings; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; }; + 4C53A7AA1864C3A2000DFF0D /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; lineEnding = 0; name = fr; path = fr.lproj/KPKLocalizable.strings; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; }; 4C5426F217BEEA8700A4424C /* Autotype_test.kdbx */ = {isa = PBXFileReference; lastKnownFileType = file; name = Autotype_test.kdbx; path = Databases/Autotype_test.kdbx; sourceTree = ""; }; 4C569D9C17652AC800595B62 /* MPConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPConstants.h; sourceTree = ""; }; 4C569D9D17652B0600595B62 /* MPConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPConstants.m; sourceTree = ""; }; @@ -793,6 +794,8 @@ 4CA0B30D15BCB6FD00654E32 /* MPSettingsTab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPSettingsTab.h; sourceTree = ""; }; 4CA0E3A5176FAF99004D18CB /* MPDocumentQueryService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocumentQueryService.h; sourceTree = ""; }; 4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentQueryService.m; sourceTree = ""; }; + 4CA0F3EB1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPWindowTitleComboBoxDelegate.h; sourceTree = ""; }; + 4CA0F3EC1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPWindowTitleComboBoxDelegate.m; sourceTree = ""; }; 4CA23358176DBFE100F0B6AC /* MPLockDaemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLockDaemon.h; sourceTree = ""; }; 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPLockDaemon.m; sourceTree = ""; }; 4CA334C818AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPWindowAssociationsTableViewDelegate.h; sourceTree = ""; }; @@ -861,7 +864,7 @@ 4CD3ABBD178F72610073F5C5 /* KPKEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKEntry.h; sourceTree = ""; }; 4CD3ABBE178F72610073F5C5 /* KPKEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = KPKEntry.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4CD3ABC0178F72720073F5C5 /* KPKGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKGroup.h; sourceTree = ""; }; - 4CD3ABC1178F72720073F5C5 /* KPKGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKGroup.m; sourceTree = ""; }; + 4CD3ABC1178F72720073F5C5 /* KPKGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = KPKGroup.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4CD4900E18513C180017397F /* KPKXmlElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KPKXmlElements.h; path = Format/KPKXmlElements.h; sourceTree = ""; }; 4CD4900F18513C180017397F /* KPKXmlElements.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KPKXmlElements.m; path = Format/KPKXmlElements.m; sourceTree = ""; }; 4CD5D703177A5F3300100649 /* MPDatabaseSettingsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDatabaseSettingsWindowController.h; sourceTree = ""; }; @@ -949,7 +952,7 @@ 601F811818E016340028F3DE /* zh-Hans */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; }; 601F811918E016340028F3DE /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = "zh-Hans"; path = "zh-Hans.lproj/Credits.rtf"; sourceTree = ""; }; 601F811A18E016340028F3DE /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = ""; }; - 601F811B18E016340028F3DE /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/KPKLocalizable.strings"; sourceTree = ""; }; + 601F811B18E016340028F3DE /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; lineEnding = 0; name = "zh-Hans"; path = "zh-Hans.lproj/KPKLocalizable.strings"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; }; 601F811C18E016340028F3DE /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = ""; }; 6021FE3C18E1341900C3BC51 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/EntryInspectorView.xib; sourceTree = ""; }; 6021FE4418E1342500C3BC51 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/EntryInspectorView.strings"; sourceTree = ""; }; @@ -1013,7 +1016,7 @@ BD6C366319484CF40089EB37 /* nl */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; lineEnding = 0; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; }; BD6C366419484CF40089EB37 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = nl; path = nl.lproj/Credits.rtf; sourceTree = ""; }; BD6C366519484CF40089EB37 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = ""; }; - BD6C366619484CF40089EB37 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/KPKLocalizable.strings; sourceTree = ""; }; + BD6C366619484CF40089EB37 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; lineEnding = 0; name = nl; path = nl.lproj/KPKLocalizable.strings; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.simpleColoring; }; BD6C366719484CF40089EB37 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1374,6 +1377,8 @@ 4CA334C918AD60D1008A3322 /* MPWindowAssociationsTableViewDelegate.m */, 4C89B70E19B4B4A300DC0A6A /* MPTreeDelegate.h */, 4C89B70F19B4B4A300DC0A6A /* MPTreeDelegate.m */, + 4CA0F3EB1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.h */, + 4CA0F3EC1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.m */, ); name = Delegates; sourceTree = ""; @@ -2418,6 +2423,7 @@ 4C245BE9176E1E3D0086100E /* GCDAsyncSocket.m in Sources */, 4C245BEB176E1E3D0086100E /* DDAbstractDatabaseLogger.m in Sources */, 4C245BEC176E1E3D0086100E /* DDASLLogger.m in Sources */, + 4CA0F3ED1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.m in Sources */, 4C245BED176E1E3D0086100E /* DDFileLogger.m in Sources */, 4C245BEE176E1E3D0086100E /* DDLog.m in Sources */, 4C245BEF176E1E3D0086100E /* DDTTYLogger.m in Sources */, diff --git a/MacPass/Base.lproj/EntryInspectorView.xib b/MacPass/Base.lproj/EntryInspectorView.xib index ad237a6b..8b7f2df8 100644 --- a/MacPass/Base.lproj/EntryInspectorView.xib +++ b/MacPass/Base.lproj/EntryInspectorView.xib @@ -808,7 +808,7 @@ - + diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index c2624d43..de2d87c2 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -12,6 +12,7 @@ #import "MPPasswordCreatorViewController.h" #import "MPAttachmentTableDataSource.h" #import "MPWindowAssociationsTableViewDelegate.h" +#import "MPWindowTitleComboBoxDelegate.h" #import "NSString+MPPasswordCreation.h" @@ -48,6 +49,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { MPCustomFieldTableViewDelegate *_customFieldTableDelegate; MPAttachmentTableDataSource *_attachmentDataSource; MPWindowAssociationsTableViewDelegate *_windowAssociationsTableDelegate; + MPWindowTitleComboBoxDelegate *_windowTitleMenuDelegate; } @property (nonatomic, assign) BOOL showPassword; @@ -76,6 +78,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { _customFieldTableDelegate = [[MPCustomFieldTableViewDelegate alloc] init]; _attachmentDataSource = [[MPAttachmentTableDataSource alloc] init]; _windowAssociationsTableDelegate = [[MPWindowAssociationsTableViewDelegate alloc] init]; + _windowTitleMenuDelegate = [[MPWindowTitleComboBoxDelegate alloc] init]; _attachmentTableDelegate.viewController = self; _customFieldTableDelegate.viewController = self; _activeTab = MPEntryTabGeneral; @@ -92,19 +95,22 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:NSStringFromSelector(@selector(activeTab)) options:nil]; /* Set background to clearcolor so we can draw in the scrollview */ - [self.attachmentTableView setBackgroundColor:[NSColor clearColor]]; + self.attachmentTableView.backgroundColor = [NSColor clearColor]; [self.attachmentTableView bind:NSContentBinding toObject:_attachmentsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil]; - [self.attachmentTableView setDelegate:_attachmentTableDelegate]; - [self.attachmentTableView setDataSource:_attachmentDataSource]; + self.attachmentTableView.delegate = _attachmentTableDelegate; + self.attachmentTableView.dataSource = _attachmentDataSource; [self.attachmentTableView registerForDraggedTypes:@[NSFilenamesPboardType]]; /* Set background to clearcolor so we can draw in the scrollview */ - [self.customFieldsTableView setBackgroundColor:[NSColor clearColor]]; + self.customFieldsTableView.backgroundColor = [NSColor clearColor]; [self.customFieldsTableView bind:NSContentBinding toObject:_customFieldsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil]; - [self.customFieldsTableView setDelegate:_customFieldTableDelegate]; + self.customFieldsTableView.delegate = _customFieldTableDelegate; - [self.windowAssociationsTableView setBackgroundColor:[NSColor clearColor]]; - [self.windowAssociationsTableView setDelegate:_windowAssociationsTableDelegate]; + self.windowAssociationsTableView.backgroundColor = [NSColor clearColor]; + self.windowAssociationsTableView.delegate = _windowAssociationsTableDelegate; [self.windowAssociationsTableView bind:NSContentBinding toObject:_windowAssociationsController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil]; + [self.windowAssociationsTableView bind:NSSelectionIndexesBinding toObject:_windowAssociationsController withKeyPath:NSSelectionIndexesBinding options:nil]; + + self.windowTitleComboBox.delegate = _windowTitleMenuDelegate; [self.passwordTextField bind:NSStringFromSelector(@selector(showPassword)) toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil]; [self.togglePassword bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(showPassword)) options:nil]; @@ -380,7 +386,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }]; [self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil]; [self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(tags)) options:nil]; - + /* Setup enable/disable */ for(id item in items) { [item bind:NSEnabledBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(isEditable)) options:nil]; @@ -422,6 +428,12 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self.customEntrySequenceTextField bind:NSEnabledBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(isEnabled)) options:nil]; [self.customEntrySequenceTextField bind:NSValueBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(defaultKeystrokeSequence)) options:@{ NSValidatesImmediatelyBindingOption: @(YES) }]; [_windowAssociationsController bind:NSContentArrayBinding toObject:self.entry.autotype withKeyPath:NSStringFromSelector(@selector(associations)) options:nil]; + //[self.windowTitleComboBox setStringValue:@""]; + NSString *selectedWindowTitlePath = [[NSString alloc] initWithFormat:@"selection.%@", NSStringFromSelector(@selector(windowTitle))]; + [self.windowTitleComboBox bind:NSValueBinding toObject:_windowAssociationsController withKeyPath:selectedWindowTitlePath options:nil]; + + NSString *selectedWindowKeyStrokesPath = [[NSString alloc] initWithFormat:@"selection.%@", NSStringFromSelector(@selector(keystrokeSequence))]; + [self.associationSequenceTextField bind:NSValueBinding toObject:_windowAssociationsController withKeyPath:selectedWindowKeyStrokesPath options:nil]; } else { [self.enableAutotypeCheckButton unbind:NSValueBinding]; @@ -431,6 +443,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [_windowAssociationsController unbind:NSContentArrayBinding]; [_windowAssociationsController setContent:nil]; } + [self.windowTitleComboBox unbind:NSValueBinding]; + [self.associationSequenceTextField unbind:NSValueBinding]; } } diff --git a/MacPass/MPWindowTitleComboBoxDelegate.h b/MacPass/MPWindowTitleComboBoxDelegate.h new file mode 100644 index 00000000..933f088a --- /dev/null +++ b/MacPass/MPWindowTitleComboBoxDelegate.h @@ -0,0 +1,13 @@ +// +// MPWindowTitleMenuDelegate.h +// MacPass +// +// Created by Michael Starke on 04/12/14. +// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved. +// + +#import + +@interface MPWindowTitleComboBoxDelegate : NSObject + +@end diff --git a/MacPass/MPWindowTitleComboBoxDelegate.m b/MacPass/MPWindowTitleComboBoxDelegate.m new file mode 100644 index 00000000..38a61ae3 --- /dev/null +++ b/MacPass/MPWindowTitleComboBoxDelegate.m @@ -0,0 +1,45 @@ +// +// MPWindowTitleMenuDelegate.m +// MacPass +// +// Created by Michael Starke on 04/12/14. +// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved. +// + +#import "MPWindowTitleComboBoxDelegate.h" + +@implementation MPWindowTitleComboBoxDelegate + +- (void)comboBoxWillPopUp:(NSNotification *)notification { + NSComboBox *comboBox = notification.object; + if(!comboBox) { + return; + } + [comboBox removeAllItems]; + [comboBox addItemsWithObjectValues:[self _currentWindowTitles]]; + comboBox.numberOfVisibleItems = MIN(5, comboBox.numberOfItems); +} + +- (NSArray *)_currentWindowTitles { + static NSArray *ownerSkipList; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + ownerSkipList = @[ @"SystemUIServer", @"Window Server", @"Dock" ]; + }); + NSArray *currentWindows = CFBridgingRelease(CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID)); + NSMutableArray *windowTitles = [[NSMutableArray alloc] initWithCapacity:MAX(1,currentWindows.count)]; + for(NSDictionary *windowDict in currentWindows) { + NSString *windowName = windowDict[(NSString *)kCGWindowName]; + if([windowName length] <= 0) { + continue; // No title, skip + } + NSString *ownerName = windowDict[(NSString *)kCGWindowOwnerName]; + if([ownerSkipList containsObject:ownerName]) { + continue; // We do not want to insert some system windows (Dock, Menubars) + } + [windowTitles addObject:windowDict[(NSString *)kCGWindowName]]; + } + return windowTitles; +} + +@end diff --git a/MacPass/de.lproj/KPKLocalizable.strings b/MacPass/de.lproj/KPKLocalizable.strings index 80f3c248..84b93060 100644 --- a/MacPass/de.lproj/KPKLocalizable.strings +++ b/MacPass/de.lproj/KPKLocalizable.strings @@ -1,5 +1,5 @@ /* - KPKlocalizable.strings + KPKLocalizable.strings MacPass Created by Michael Starke on 20/12/13. diff --git a/MacPass/de.lproj/Localizable.strings b/MacPass/de.lproj/Localizable.strings index e34202f2..c6e6d70b 100644 Binary files a/MacPass/de.lproj/Localizable.strings and b/MacPass/de.lproj/Localizable.strings differ diff --git a/MacPass/en.lproj/KPKLocalizable.strings b/MacPass/en.lproj/KPKLocalizable.strings index c3fa427f..d9c947ea 100644 --- a/MacPass/en.lproj/KPKLocalizable.strings +++ b/MacPass/en.lproj/KPKLocalizable.strings @@ -1,5 +1,5 @@ /* - KPKlocalizable.strings + KPKLocalizable.strings MacPass Created by Michael Starke on 20/12/13. diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings index eae9ebab..91d37ebc 100644 Binary files a/MacPass/en.lproj/Localizable.strings and b/MacPass/en.lproj/Localizable.strings differ diff --git a/MacPass/fr.lproj/KPKLocalizable.strings b/MacPass/fr.lproj/KPKLocalizable.strings index ab5e4834..8582b0b1 100644 --- a/MacPass/fr.lproj/KPKLocalizable.strings +++ b/MacPass/fr.lproj/KPKLocalizable.strings @@ -1,5 +1,5 @@ /* - KPKlocalizable.strings + KPKLocalizable.strings MacPass Created by Michael Starke on 20/12/13. diff --git a/MacPass/fr.lproj/Localizable.strings b/MacPass/fr.lproj/Localizable.strings index e55bbf16..be5d7237 100644 Binary files a/MacPass/fr.lproj/Localizable.strings and b/MacPass/fr.lproj/Localizable.strings differ diff --git a/MacPass/nl.lproj/KPKLocalizable.strings b/MacPass/nl.lproj/KPKLocalizable.strings index 862f8122..b284d953 100644 --- a/MacPass/nl.lproj/KPKLocalizable.strings +++ b/MacPass/nl.lproj/KPKLocalizable.strings @@ -1,5 +1,5 @@ /* - KPKlocalizable.strings + KPKLocalizable.strings MacPass Created by Michael Starke on 20/12/13. diff --git a/MacPass/nl.lproj/Localizable.strings b/MacPass/nl.lproj/Localizable.strings index 746e584b..ab3aaabc 100644 Binary files a/MacPass/nl.lproj/Localizable.strings and b/MacPass/nl.lproj/Localizable.strings differ diff --git a/MacPass/zh-Hans.lproj/KPKLocalizable.strings b/MacPass/zh-Hans.lproj/KPKLocalizable.strings index fcb89f40..884dc42d 100644 --- a/MacPass/zh-Hans.lproj/KPKLocalizable.strings +++ b/MacPass/zh-Hans.lproj/KPKLocalizable.strings @@ -1,5 +1,5 @@ /* - KPKlocalizable.strings + KPKLocalizable.strings MacPass Created by Michael Starke on 20/12/13. diff --git a/MacPass/zh-Hans.lproj/Localizable.strings b/MacPass/zh-Hans.lproj/Localizable.strings index 1390871d..8b3e36a8 100644 Binary files a/MacPass/zh-Hans.lproj/Localizable.strings and b/MacPass/zh-Hans.lproj/Localizable.strings differ