mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 22:52:26 +00:00
Mingling with Editing. Updated KeePassKit
This commit is contained in:
Submodule KeePassKit updated: 675b09c75b...c5368d2d8b
@@ -210,6 +210,8 @@
|
||||
4C8A173D1790AA41008B5C17 /* NSData+Keyfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8A173C1790AA41008B5C17 /* NSData+Keyfile.m */; };
|
||||
4C8B36AB17A6ED4B005E1FF1 /* MPOutlineContextMenuDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8B36AA17A6ED4B005E1FF1 /* MPOutlineContextMenuDelegate.m */; };
|
||||
4C8EB8C118D399FD00438B08 /* KPKTag.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8EB8C018D399FD00438B08 /* KPKTag.m */; };
|
||||
4C94A06F1938DC8C0040ABAB /* MPEditSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C94A06E1938DC8C0040ABAB /* MPEditSession.m */; };
|
||||
4C94A0721938DDC20040ABAB /* MPDocument+EditingSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C94A0711938DDC20040ABAB /* MPDocument+EditingSession.m */; };
|
||||
4C96D15417A12E4F00D931FA /* 99_CreatedTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C96D15317A12E4F00D931FA /* 99_CreatedTemplate.pdf */; };
|
||||
4C9D6AA917615199001C660C /* HNHRoundedSecureTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C9D6AA817615199001C660C /* HNHRoundedSecureTextFieldCell.m */; };
|
||||
4CA08DA017A831B200A6544B /* MPAddEntryContextMenuDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA08D9F17A831B200A6544B /* MPAddEntryContextMenuDelegate.m */; };
|
||||
@@ -736,6 +738,9 @@
|
||||
4C8B36AA17A6ED4B005E1FF1 /* MPOutlineContextMenuDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOutlineContextMenuDelegate.m; sourceTree = "<group>"; };
|
||||
4C8EB8BF18D399FD00438B08 /* KPKTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTag.h; sourceTree = "<group>"; };
|
||||
4C8EB8C018D399FD00438B08 /* KPKTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTag.m; sourceTree = "<group>"; };
|
||||
4C94A06D1938DC8C0040ABAB /* MPEditSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEditSession.h; sourceTree = "<group>"; };
|
||||
4C94A06E1938DC8C0040ABAB /* MPEditSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEditSession.m; sourceTree = "<group>"; };
|
||||
4C94A0711938DDC20040ABAB /* MPDocument+EditingSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MPDocument+EditingSession.m"; sourceTree = "<group>"; };
|
||||
4C96D15317A12E4F00D931FA /* 99_CreatedTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = 99_CreatedTemplate.pdf; path = Icons/99_CreatedTemplate.pdf; sourceTree = "<group>"; };
|
||||
4C9D6AA717615199001C660C /* HNHRoundedSecureTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHRoundedSecureTextFieldCell.h; sourceTree = "<group>"; };
|
||||
4C9D6AA817615199001C660C /* HNHRoundedSecureTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHRoundedSecureTextFieldCell.m; sourceTree = "<group>"; };
|
||||
@@ -807,6 +812,7 @@
|
||||
4CCEDE2F179F550D008402BE /* KPKTreeReading.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKTreeReading.h; sourceTree = "<group>"; };
|
||||
4CCEDE30179F5B6C008402BE /* KPKDataStreamReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKDataStreamReader.h; sourceTree = "<group>"; };
|
||||
4CCEDE31179F5B6C008402BE /* KPKDataStreamReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKDataStreamReader.m; sourceTree = "<group>"; };
|
||||
4CD106211935E5A1006A3A58 /* KPKModificationRecording.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKModificationRecording.h; sourceTree = "<group>"; };
|
||||
4CD25F9218B17A17006098E9 /* KPKTestUUIDAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestUUIDAdditions.m; sourceTree = "<group>"; };
|
||||
4CD2B9041849424B0051B395 /* MPAutotypeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeContext.h; sourceTree = "<group>"; };
|
||||
4CD2B9051849424B0051B395 /* MPAutotypeContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeContext.m; sourceTree = "<group>"; };
|
||||
@@ -851,6 +857,7 @@
|
||||
4CE39AC316ECE4F7000FE29D /* MPPopupImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPopupImageView.m; sourceTree = "<group>"; };
|
||||
4CE3E62417AB0D2D00D9E4B4 /* MPAttachmentTableDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAttachmentTableDataSource.h; sourceTree = "<group>"; };
|
||||
4CE3E62517AB0D2D00D9E4B4 /* MPAttachmentTableDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAttachmentTableDataSource.m; sourceTree = "<group>"; };
|
||||
4CE5299F194847150078C2FF /* MPDocument+EditingSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MPDocument+EditingSession.h"; sourceTree = "<group>"; };
|
||||
4CE5B548173AFBA700207B39 /* MPDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocument.h; sourceTree = "<group>"; };
|
||||
4CE5B549173AFBA700207B39 /* MPDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocument.m; sourceTree = "<group>"; };
|
||||
4CE76DAC17B3AD010043B82B /* KPKHashedDataTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKHashedDataTest.m; sourceTree = "<group>"; };
|
||||
@@ -895,7 +902,6 @@
|
||||
4CFC873A179DEDF3000DFC03 /* KPKMetaData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKMetaData.m; sourceTree = "<group>"; };
|
||||
4CFC873C179DF200000DFC03 /* KPKTimeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTimeInfo.h; sourceTree = "<group>"; };
|
||||
4CFC873D179DF200000DFC03 /* KPKTimeInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTimeInfo.m; sourceTree = "<group>"; };
|
||||
4CFC873F179DF295000DFC03 /* KPKModificationRecording.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKModificationRecording.h; sourceTree = "<group>"; };
|
||||
4CFC8742179DFD3E000DFC03 /* KPKTestXmlLoading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestXmlLoading.m; sourceTree = "<group>"; };
|
||||
4CFDDDE7185E92A600A9E7F1 /* HNHTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHTextView.h; sourceTree = "<group>"; };
|
||||
4CFDDDE8185E92A600A9E7F1 /* HNHTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHTextView.m; sourceTree = "<group>"; };
|
||||
@@ -1331,6 +1337,10 @@
|
||||
4C15B74518BCA3B1003F8008 /* MPDocument+Search.m */,
|
||||
4C6B7C7B18BE7EB0001D5D77 /* MPDocument+HistoryBrowsing.h */,
|
||||
4C6B7C7C18BE7EB0001D5D77 /* MPDocument+HistoryBrowsing.m */,
|
||||
4CE5299F194847150078C2FF /* MPDocument+EditingSession.h */,
|
||||
4C94A0711938DDC20040ABAB /* MPDocument+EditingSession.m */,
|
||||
4C94A06D1938DC8C0040ABAB /* MPEditSession.h */,
|
||||
4C94A06E1938DC8C0040ABAB /* MPEditSession.m */,
|
||||
);
|
||||
name = Model;
|
||||
sourceTree = "<group>";
|
||||
@@ -1731,6 +1741,14 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4CD106201935E5A1006A3A58 /* Protocols */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4CD106211935E5A1006A3A58 /* KPKModificationRecording.h */,
|
||||
);
|
||||
path = Protocols;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4CD3ABAD178F71B50073F5C5 /* KeePassKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1740,6 +1758,7 @@
|
||||
4CD3ABAF178F71B50073F5C5 /* Categories */,
|
||||
4CD3ABB1178F71B50073F5C5 /* Core */,
|
||||
4CD3ABB5178F71B50073F5C5 /* IO */,
|
||||
4CD106201935E5A1006A3A58 /* Protocols */,
|
||||
);
|
||||
path = KeePassKit;
|
||||
sourceTree = "<group>";
|
||||
@@ -1804,7 +1823,6 @@
|
||||
4CFC873A179DEDF3000DFC03 /* KPKMetaData.m */,
|
||||
4CFC873C179DF200000DFC03 /* KPKTimeInfo.h */,
|
||||
4CFC873D179DF200000DFC03 /* KPKTimeInfo.m */,
|
||||
4CFC873F179DF295000DFC03 /* KPKModificationRecording.h */,
|
||||
4C68456817BC21DD00FCDBFC /* KPKAutotype.h */,
|
||||
4C68456917BC21DD00FCDBFC /* KPKAutotype.m */,
|
||||
4C68456B17BC227B00FCDBFC /* KPKWindowAssociation.h */,
|
||||
@@ -2252,6 +2270,7 @@
|
||||
4C77547516E55FE800970E02 /* MPInspectorViewController.m in Sources */,
|
||||
4C89F524182FB4740069C73C /* MPAutotypeCommand.m in Sources */,
|
||||
4C8EB8C118D399FD00438B08 /* KPKTag.m in Sources */,
|
||||
4C94A06F1938DC8C0040ABAB /* MPEditSession.m in Sources */,
|
||||
4CFC53BF16E94729007396BE /* MPShadowBox.m in Sources */,
|
||||
4C888C9316EB6F5E003D34A1 /* MPToolbarItem.m in Sources */,
|
||||
4C888C9716EB754B003D34A1 /* MPActionHelper.m in Sources */,
|
||||
@@ -2283,6 +2302,7 @@
|
||||
4C245B76176E1E3D0086100E /* DDData.m in Sources */,
|
||||
4C245B77176E1E3D0086100E /* DDNumber.m in Sources */,
|
||||
4C245B78176E1E3D0086100E /* DDRange.m in Sources */,
|
||||
4C94A0721938DDC20040ABAB /* MPDocument+EditingSession.m in Sources */,
|
||||
4C77C84118E240E000D1C42B /* DDHotKey+Keydata.m in Sources */,
|
||||
4C3C4EA618D6FEA100153127 /* TTTJSONTransformer.m in Sources */,
|
||||
4C88C66918D9F8D600F43852 /* MPTemporaryFileStorageCenter.m in Sources */,
|
||||
|
||||
@@ -181,6 +181,7 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
|
||||
}
|
||||
if(!self.passwordCreatorController) {
|
||||
self.passwordCreatorController = [[MPPasswordCreatorViewController alloc] init];
|
||||
self.passwordCreatorController.closeTarget = self.passwordCreatorWindow;
|
||||
NSView *creatorView = [_passwordCreatorController view];
|
||||
[self.passwordCreatorWindow setContentView:creatorView];
|
||||
}
|
||||
|
||||
19
MacPass/MPDocument+EditingSession.h
Normal file
19
MacPass/MPDocument+EditingSession.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MPDocument+EditingSession.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 30/05/14.
|
||||
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPDocument.h"
|
||||
|
||||
@class MPEditSession;
|
||||
|
||||
@interface MPDocument (EditingSession)
|
||||
|
||||
- (BOOL)hasActiveSession;
|
||||
- (void)cancelEditingSession;
|
||||
- (void)commitEditingSession;
|
||||
|
||||
@end
|
||||
48
MacPass/MPDocument+EditingSession.m
Normal file
48
MacPass/MPDocument+EditingSession.m
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// MPDocument+EditingSession.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 30/05/14.
|
||||
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPDocument+EditingSession.h"
|
||||
|
||||
#import "KPKNode.h"
|
||||
#import "MPEditSession.h"
|
||||
|
||||
@implementation MPDocument (EditingSession)
|
||||
|
||||
- (BOOL)hasActiveSession {
|
||||
return (self.editingSession != nil);
|
||||
}
|
||||
|
||||
- (void)commitEditingSession {
|
||||
[self _commitEditingSession:self.editingSession];
|
||||
}
|
||||
|
||||
- (void)cancelEditingSession {
|
||||
[self _cancelEditingSession:self.editingSession];
|
||||
}
|
||||
|
||||
#pragma mark Private
|
||||
- (void)_commitEditingSession:(MPEditSession *)session {
|
||||
if(nil == session) {
|
||||
return; // No session to commit
|
||||
}
|
||||
[[self.undoManager prepareWithInvocationTarget:self] _cancelEditingSession:session];
|
||||
if(session.hasChanges) {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_cancelEditingSession:(MPEditSession *)session {
|
||||
if(nil == session) {
|
||||
return; // No session to cancel
|
||||
}
|
||||
[[self.undoManager prepareWithInvocationTarget:self] _commitEditingSession:session];
|
||||
if(session.hasChanges) {
|
||||
[session.node updateTo:session.rollbackNode];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -41,6 +41,7 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
@class KPKAttribute;
|
||||
@class KPKCompositeKey;
|
||||
@class KPKNode;
|
||||
@class MPEditSession;
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, MPEntrySearchFlags) {
|
||||
MPEntrySearchNone = 0,
|
||||
@@ -90,6 +91,10 @@ typedef NS_OPTIONS(NSUInteger, MPEntrySearchFlags) {
|
||||
@property (nonatomic, assign) BOOL hasSearch;
|
||||
@property (nonatomic, strong) NSArray *searchResult;
|
||||
|
||||
/*
|
||||
Editing Session
|
||||
*/
|
||||
@property (nonatomic, strong) MPEditSession *editingSession;
|
||||
|
||||
+ (KPKVersion)versionForFileType:(NSString *)fileType;
|
||||
+ (NSString *)fileTypeForVersion:(KPKVersion)version;
|
||||
@@ -177,4 +182,4 @@ typedef NS_OPTIONS(NSUInteger, MPEntrySearchFlags) {
|
||||
|
||||
- (IBAction)cloneEntryWithOptions:(id)sender;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
22
MacPass/MPEditSession.h
Normal file
22
MacPass/MPEditSession.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// MPEditSession.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 30/05/14.
|
||||
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class KPKNode;
|
||||
|
||||
@interface MPEditSession : NSObject
|
||||
|
||||
@property (strong, readonly) KPKNode *node;
|
||||
@property (copy, readonly) KPKNode *rollbackNode;
|
||||
|
||||
- (instancetype)initWithNode:(KPKNode *)node;
|
||||
|
||||
- (BOOL)hasChanges;
|
||||
|
||||
@end
|
||||
39
MacPass/MPEditSession.m
Normal file
39
MacPass/MPEditSession.m
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// MPEditSession.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 30/05/14.
|
||||
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPEditSession.h"
|
||||
#import "KPKNode.h"
|
||||
|
||||
@interface MPEditSession ()
|
||||
|
||||
@property (strong) KPKNode *node;
|
||||
@property (copy) KPKNode *rollbackNode;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPEditSession
|
||||
|
||||
- (instancetype)init {
|
||||
self = [self initWithNode:nil];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNode:(KPKNode *)node {
|
||||
self = [super init];
|
||||
if(self) {
|
||||
self.node = node;
|
||||
self.rollbackNode = node;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)hasChanges {
|
||||
return [self.node isEqual:self.rollbackNode];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -265,7 +265,11 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
_activePopover = [[NSPopover alloc] init];
|
||||
_activePopover.delegate = self;
|
||||
_activePopover.behavior = NSPopoverBehaviorTransient;
|
||||
if([viewController respondsToSelector:@selector(setCloseTarget:)]) {
|
||||
[(id)viewController setCloseTarget:_activePopover];
|
||||
}
|
||||
_activePopover.contentViewController = viewController;
|
||||
|
||||
[_activePopover showRelativeToRect:NSZeroRect ofView:view preferredEdge:edge];
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,10 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
MPEmptyTab,
|
||||
};
|
||||
|
||||
@interface MPInspectorViewController () {
|
||||
MPEntryInspectorViewController *_entryViewController;
|
||||
MPGroupInspectorViewController *_groupViewController;
|
||||
BOOL _isEditing;
|
||||
}
|
||||
@interface MPInspectorViewController ()
|
||||
|
||||
@property (strong) MPEntryInspectorViewController *entryViewController;
|
||||
@property (strong) MPGroupInspectorViewController *groupViewController;
|
||||
|
||||
@property (strong) MPIconSelectViewController *iconSelectionViewController;
|
||||
@property (strong) NSPopover *popover;
|
||||
@@ -64,10 +63,9 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
_activeTab = MPEmptyTab;
|
||||
_entryViewController = [[MPEntryInspectorViewController alloc] init];
|
||||
_groupViewController = [[MPGroupInspectorViewController alloc] init];
|
||||
_isEditing = NO;
|
||||
self.activeTab = MPEmptyTab;
|
||||
self.entryViewController = [[MPEntryInspectorViewController alloc] init];
|
||||
self.groupViewController = [[MPGroupInspectorViewController alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -87,8 +85,8 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
[[self.itemImageView cell] setBackgroundStyle:NSBackgroundStyleRaised];
|
||||
[self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil];
|
||||
|
||||
NSView *entryView = [_entryViewController view];
|
||||
NSView *groupView = [_groupViewController view];
|
||||
NSView *entryView = [self.entryViewController view];
|
||||
NSView *groupView = [self.groupViewController view];
|
||||
|
||||
|
||||
NSTabViewItem *entryTabItem = [self.tabView tabViewItemAtIndex:MPEntryTab];
|
||||
@@ -115,14 +113,14 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
selector:@selector(_didChangeCurrentItem:)
|
||||
name:MPDocumentCurrentItemChangedNotification
|
||||
object:document];
|
||||
[_entryViewController setupBindings:document];
|
||||
[_groupViewController setupBindings:document];
|
||||
[self.entryViewController setupBindings:document];
|
||||
[self.groupViewController setupBindings:document];
|
||||
}
|
||||
|
||||
- (void)updateResponderChain {
|
||||
[super updateResponderChain];
|
||||
[_groupViewController updateResponderChain];
|
||||
[_entryViewController updateResponderChain];
|
||||
[self.groupViewController updateResponderChain];
|
||||
[self.entryViewController updateResponderChain];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@@ -167,31 +165,31 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
- (void)toggleEdit:(id)sender {
|
||||
BOOL didCancel = sender == self.cancelEditButton;
|
||||
MPDocument *document = [[self windowController] document];
|
||||
NSUndoManager *undoManager = [document undoManager];
|
||||
|
||||
if(_isEditing) {
|
||||
BOOL didChangeItem = [undoManager canUndo];
|
||||
[undoManager endUndoGrouping];
|
||||
[undoManager setActionName:NSLocalizedString(@"EDIT_GROUP_OR_ENTRY", "")];
|
||||
if(document.selectedItem) {
|
||||
|
||||
/* TODO UndoManager handling */
|
||||
[self.editButton setTitle:NSLocalizedString(@"EDIT_ITEM", "")];
|
||||
[self.cancelEditButton setHidden:YES];
|
||||
[_entryViewController endEditing];
|
||||
[self.entryViewController endEditing];
|
||||
|
||||
/*
|
||||
We need to be carefull to only undo the things we actually changed
|
||||
otherwise we undo older actions
|
||||
*/
|
||||
if(didCancel && didChangeItem) {
|
||||
[undoManager undo];
|
||||
if(didCancel) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
[undoManager beginUndoGrouping];
|
||||
//[document.selectedItem beginEditSession];
|
||||
[self.editButton setTitle:NSLocalizedString(@"SAVE_CHANGES", "")];
|
||||
[self.cancelEditButton setHidden:NO];
|
||||
[_entryViewController beginEditing];
|
||||
[self.entryViewController beginEditing];
|
||||
}
|
||||
_isEditing = !_isEditing;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@@ -309,6 +307,6 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
[self _updateBindings:document.selectedItem];
|
||||
|
||||
/* disable the entry text fields whenever the entry selection changes */
|
||||
//[_entryViewController endEditing];
|
||||
//[self.entryViewController endEditing];
|
||||
}
|
||||
@end
|
||||
@@ -11,6 +11,7 @@
|
||||
@interface MPPasswordCreatorViewController : MPViewController <NSTextFieldDelegate>
|
||||
|
||||
@property (copy, readonly) NSString *generatedPassword;
|
||||
@property (weak) id closeTarget;
|
||||
|
||||
/**
|
||||
* Should be called to reset the generator
|
||||
|
||||
@@ -57,11 +57,6 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) {
|
||||
@property (nonatomic, assign) NSUInteger passwordLength;
|
||||
@property (nonatomic, assign) CGFloat entropy;
|
||||
|
||||
- (IBAction)_generatePassword:(id)sender;
|
||||
- (IBAction)_toggleCharacters:(id)sender;
|
||||
- (IBAction)_usePassword:(id)sender;
|
||||
- (IBAction)_cancel:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPPasswordCreatorViewController
|
||||
@@ -140,15 +135,11 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) {
|
||||
if([self.shouldCopyPasswordToPasteboardButton state] == NSOnState) {
|
||||
[[MPPasteBoardController defaultController] copyObjects:@[_password]];
|
||||
}
|
||||
/* Since we might be displayed inside a NSPopup or a NSWindow, search for the target */
|
||||
id target = [NSApp targetForAction:@selector(performClose:)];
|
||||
[target performClose:nil];
|
||||
[[self _findCloseTarget] performClose:nil];
|
||||
}
|
||||
|
||||
- (IBAction)_cancel:(id)sender {
|
||||
/* Since we might be displayed inside a NSPopup or a NSWindow, search for the target */
|
||||
id target = [NSApp targetForAction:@selector(performClose:)];
|
||||
[target performClose:nil];
|
||||
[[self _findCloseTarget] performClose:nil];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@@ -213,4 +204,11 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) {
|
||||
[_numbersButton setState:useNumbers ? NSOnState : NSOffState];
|
||||
[_symbolsButton setState:useSymbols ? NSOnState : NSOffState];
|
||||
}
|
||||
|
||||
- (id)_findCloseTarget {
|
||||
if([self.closeTarget respondsToSelector:@selector(performClose:)]) {
|
||||
return self.closeTarget;
|
||||
}
|
||||
return [NSApp targetForAction:@selector(performClose:)];
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user