mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-15 16:12:16 +00:00
modern Objective-C
This commit is contained in:
@@ -210,7 +210,7 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)removeWindowAssociation:(id)sender {
|
- (void)removeWindowAssociation:(id)sender {
|
||||||
NSInteger row = [self.windowAssociationsTableView selectedRow];
|
NSInteger row = self.windowAssociationsTableView.selectedRow;
|
||||||
if(row > - 1 && row < [self.contentEntry.autotype.associations count]) {
|
if(row > - 1 && row < [self.contentEntry.autotype.associations count]) {
|
||||||
[self.contentEntry.autotype removeAssociation:self.contentEntry.autotype.associations[row]];
|
[self.contentEntry.autotype removeAssociation:self.contentEntry.autotype.associations[row]];
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
|
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
|
||||||
switch([MPActionHelper typeForAction:[menuItem action]]) {
|
switch([MPActionHelper typeForAction:menuItem.action]) {
|
||||||
case MPActionToggleQuicklook: {
|
case MPActionToggleQuicklook: {
|
||||||
BOOL enabled = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyEnableQuicklookPreview];
|
BOOL enabled = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyEnableQuicklookPreview];
|
||||||
return enabled ? [self acceptsPreviewPanelControl:nil] : NO;
|
return enabled ? [self acceptsPreviewPanelControl:nil] : NO;
|
||||||
@@ -476,9 +476,4 @@ static NSString *kMPContentBindingString3 = @"content.%@.%@.%@";
|
|||||||
[self.titleTextField becomeFirstResponder];
|
[self.titleTextField becomeFirstResponder];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_willSave:(NSNotification *)notification {
|
|
||||||
// Force selected textfield to end editing
|
|
||||||
[self.view.window makeFirstResponder:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -31,16 +31,16 @@
|
|||||||
NSString *title = [NSString stringWithFormat:@"%@ (%@)", description, extension];
|
NSString *title = [NSString stringWithFormat:@"%@ (%@)", description, extension];
|
||||||
[menu addItemWithTitle:title action:@selector(setFileType:) keyEquivalent:@""];
|
[menu addItemWithTitle:title action:@selector(setFileType:) keyEquivalent:@""];
|
||||||
NSMenuItem *item = [[menu itemArray] lastObject];
|
NSMenuItem *item = [[menu itemArray] lastObject];
|
||||||
[item setTarget:self];
|
item.target = self;
|
||||||
[item setRepresentedObject:uti];
|
item.representedObject = uti;
|
||||||
}
|
}
|
||||||
[self.fileTypePopupButton setMenu:menu];
|
self.fileTypePopupButton.menu = menu;
|
||||||
[self.infoTextField setHidden:YES];
|
self.infoTextField.hidden = YES;
|
||||||
[self updateView];
|
[self updateView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)setFileType:(id)sender {
|
- (IBAction)setFileType:(id)sender {
|
||||||
NSString *uti = [[self.fileTypePopupButton selectedItem] representedObject];
|
NSString *uti = self.fileTypePopupButton.selectedItem.representedObject;
|
||||||
if([uti isEqualToString:MPLegacyDocumentUTI]) {
|
if([uti isEqualToString:MPLegacyDocumentUTI]) {
|
||||||
self.selectedVersion = KPKLegacyVersion;
|
self.selectedVersion = KPKLegacyVersion;
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
}
|
}
|
||||||
NSAssert(uti != nil, @"UTI cannot be nil");
|
NSAssert(uti != nil, @"UTI cannot be nil");
|
||||||
[self _updateNote];
|
[self _updateNote];
|
||||||
[self.savePanel setAllowedFileTypes:@[uti]];
|
self.savePanel.allowedFileTypes = @[uti];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setDocument:(MPDocument *)document {
|
- (void)setDocument:(MPDocument *)document {
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
/*
|
/*
|
||||||
Access view at least once to make sure it is properly loaded
|
Access view at least once to make sure it is properly loaded
|
||||||
*/
|
*/
|
||||||
NSView *view = [self view];
|
NSView *view = self.view;
|
||||||
NSAssert(view != nil, @"View has to be loaded at this point");
|
NSAssert(view != nil, @"View has to be loaded at this point");
|
||||||
switch(self.document.versionForFileType) {
|
switch(self.document.versionForFileType) {
|
||||||
case KPKLegacyVersion:
|
case KPKLegacyVersion:
|
||||||
|
|||||||
Reference in New Issue
Block a user