mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 01:12:31 +00:00
Moving editing session to KeePassKit
Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
Submodule KeePassKit updated: ad2b8a13db...65f46c47e4
@@ -244,7 +244,7 @@
|
||||
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 /* MPEditingSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C94A06E1938DC8C0040ABAB /* MPEditingSession.m */; };
|
||||
4C94A06F1938DC8C0040ABAB /* KPKEditingSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C94A06E1938DC8C0040ABAB /* KPKEditingSession.m */; };
|
||||
4C94A0721938DDC20040ABAB /* MPDocument+EditingSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C94A0711938DDC20040ABAB /* MPDocument+EditingSession.m */; };
|
||||
4C978E0619AE53FE003067DF /* HNHCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C978E0519AE53FE003067DF /* HNHCommon.m */; };
|
||||
4C978E0D19AE54AB003067DF /* MPFlagsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C978E0C19AE54AB003067DF /* MPFlagsHelper.m */; };
|
||||
@@ -798,8 +798,8 @@
|
||||
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 /* MPEditingSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEditingSession.h; sourceTree = "<group>"; };
|
||||
4C94A06E1938DC8C0040ABAB /* MPEditingSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEditingSession.m; sourceTree = "<group>"; };
|
||||
4C94A06D1938DC8C0040ABAB /* KPKEditingSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKEditingSession.h; sourceTree = "<group>"; };
|
||||
4C94A06E1938DC8C0040ABAB /* KPKEditingSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKEditingSession.m; sourceTree = "<group>"; };
|
||||
4C94A0711938DDC20040ABAB /* MPDocument+EditingSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MPDocument+EditingSession.m"; sourceTree = "<group>"; };
|
||||
4C978E0519AE53FE003067DF /* HNHCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHCommon.m; sourceTree = "<group>"; };
|
||||
4C978E0C19AE54AB003067DF /* MPFlagsHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFlagsHelper.m; sourceTree = "<group>"; };
|
||||
@@ -899,6 +899,7 @@
|
||||
4CD78ABB16D155FF00768A1D /* 11_CameraTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 11_CameraTemplate.pdf; sourceTree = "<group>"; };
|
||||
4CD820221A32173100399DBB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ReferenceBuilderView.xib; sourceTree = "<group>"; };
|
||||
4CD884B615BD47080042BBF8 /* DocumentWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DocumentWindow.xib; sourceTree = "<group>"; };
|
||||
4CD9D6CB1BCE6539008C1960 /* KPKEditingSession+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPKEditingSession+Private.h"; sourceTree = "<group>"; };
|
||||
4CDB5C401794AA4F0017667E /* KPKTree+Serializing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPKTree+Serializing.h"; sourceTree = "<group>"; };
|
||||
4CDB5C411794AA4F0017667E /* KPKTree+Serializing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = "KPKTree+Serializing.m"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
4CDF01A116D1B76700D0AC08 /* MPEntryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEntryViewController.h; sourceTree = "<group>"; };
|
||||
@@ -1293,8 +1294,6 @@
|
||||
4C15B74518BCA3B1003F8008 /* MPDocument+Search.m */,
|
||||
4C6B7C7C18BE7EB0001D5D77 /* MPDocument+HistoryBrowsing.m */,
|
||||
4C94A0711938DDC20040ABAB /* MPDocument+EditingSession.m */,
|
||||
4C94A06D1938DC8C0040ABAB /* MPEditingSession.h */,
|
||||
4C94A06E1938DC8C0040ABAB /* MPEditingSession.m */,
|
||||
4C0AF62D195C1F2B009E658D /* MPEntrySearchContext.h */,
|
||||
4C0AF62E195C1F2B009E658D /* MPEntrySearchContext.m */,
|
||||
);
|
||||
@@ -1843,6 +1842,9 @@
|
||||
4CD3ABB1178F71B50073F5C5 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4C94A06D1938DC8C0040ABAB /* KPKEditingSession.h */,
|
||||
4CD9D6CB1BCE6539008C1960 /* KPKEditingSession+Private.h */,
|
||||
4C94A06E1938DC8C0040ABAB /* KPKEditingSession.m */,
|
||||
4C70D0FE179092F200652EE9 /* KPKCompositeKey.h */,
|
||||
4C70D0FF179092F200652EE9 /* KPKCompositeKey.m */,
|
||||
4CD3ABB3178F71B50073F5C5 /* KPKTree.h */,
|
||||
@@ -2369,7 +2371,7 @@
|
||||
4C77547516E55FE800970E02 /* MPInspectorViewController.m in Sources */,
|
||||
4C89F524182FB4740069C73C /* MPAutotypeCommand.m in Sources */,
|
||||
4C8EB8C118D399FD00438B08 /* KPKTag.m in Sources */,
|
||||
4C94A06F1938DC8C0040ABAB /* MPEditingSession.m in Sources */,
|
||||
4C94A06F1938DC8C0040ABAB /* KPKEditingSession.m in Sources */,
|
||||
4CFC53BF16E94729007396BE /* MPShadowBox.m in Sources */,
|
||||
4C0AF62F195C1F2B009E658D /* MPEntrySearchContext.m in Sources */,
|
||||
4C888C9316EB6F5E003D34A1 /* MPToolbarItem.m in Sources */,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "MPDocument.h"
|
||||
#import "MPEditingSession.h"
|
||||
#import "KPKEditingSession.h"
|
||||
|
||||
#import "KPKNode.h"
|
||||
|
||||
@@ -33,14 +33,13 @@ NSString *const MPDocumentDidCommitChangesToSelectedItem = @"com.hicknhack.mac
|
||||
[((NSWindowController *)self.windowControllers.firstObject).window makeFirstResponder:nil];
|
||||
|
||||
/* update the data */
|
||||
[self.editingSession.source updateToNode:self.editingSession.node];
|
||||
if(self.editingSession.node.asEntry) {
|
||||
[self.editingSession.source commitEditing];
|
||||
if(self.editingSession.source.asEntry) {
|
||||
[self.undoManager setActionName:NSLocalizedString(@"UPDATE_ENTRY", "")];
|
||||
}
|
||||
else if(self.editingSession.node.asGroup) {
|
||||
else if(self.editingSession.source.asGroup) {
|
||||
[self.undoManager setActionName:NSLocalizedString(@"UPDATE_GROUP", "")];
|
||||
}
|
||||
self.editingSession = nil;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidCommitChangesToSelectedItem object:self];
|
||||
}
|
||||
|
||||
@@ -48,7 +47,7 @@ NSString *const MPDocumentDidCommitChangesToSelectedItem = @"com.hicknhack.mac
|
||||
if(nil == self.editingSession) {
|
||||
return; // No session to cancel
|
||||
}
|
||||
self.editingSession = nil;
|
||||
[self.selectedItem cancelEditing];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidCancelChangesToSelectedItem object:self];
|
||||
}
|
||||
|
||||
@@ -56,7 +55,7 @@ NSString *const MPDocumentDidCommitChangesToSelectedItem = @"com.hicknhack.mac
|
||||
if(nil == self.selectedItem) {
|
||||
return;
|
||||
}
|
||||
self.editingSession = [MPEditingSession editingSessionWithSource:self.selectedItem];
|
||||
[self.selectedItem beginEditing];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidBeginEditingSelectedItem object:self];
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
@class KPKAttribute;
|
||||
@class KPKCompositeKey;
|
||||
@class KPKNode;
|
||||
@class MPEditingSession;
|
||||
@class KPKEditingSession;
|
||||
|
||||
@interface MPDocument : NSDocument <MPTargetNodeResolving>
|
||||
|
||||
@@ -88,11 +88,6 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
@property (nonatomic, copy) MPEntrySearchContext *searchContext;
|
||||
@property (nonatomic, strong) NSArray *searchResult;
|
||||
|
||||
/*
|
||||
Editing Session
|
||||
*/
|
||||
@property (nonatomic, strong) MPEditingSession *editingSession;
|
||||
|
||||
+ (KPKVersion)versionForFileType:(NSString *)fileType;
|
||||
+ (NSString *)fileTypeForVersion:(KPKVersion)version;
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
||||
@property (nonatomic, strong) NSData *encryptedData;
|
||||
@property (nonatomic, strong) MPTreeDelegate *treeDelgate;
|
||||
|
||||
|
||||
@property (assign) BOOL readOnly;
|
||||
@property (strong) NSURL *lockFileURL;
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// MPEditSession.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 30/05/14.
|
||||
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class KPKNode;
|
||||
|
||||
@interface MPEditingSession : NSObject
|
||||
|
||||
@property (copy, readonly) KPKNode *node;
|
||||
@property (nullable, weak, readonly) KPKNode *source;
|
||||
|
||||
+ (instancetype)editingSessionWithSource:(KPKNode *)node;
|
||||
- (instancetype)initWithSource:(KPKNode *)node;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
- (BOOL)hasChanges;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
//
|
||||
// MPEditSession.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 30/05/14.
|
||||
// Copyright (c) 2014 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPEditingSession.h"
|
||||
#import "KPKNode.h"
|
||||
|
||||
@interface MPEditingSession ()
|
||||
|
||||
@property (copy) KPKNode *node;
|
||||
@property (weak) KPKNode *source;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPEditingSession
|
||||
|
||||
+ (instancetype)editingSessionWithSource:(KPKNode *)node {
|
||||
return [[MPEditingSession alloc] initWithSource:node];
|
||||
}
|
||||
|
||||
- (instancetype)initWithSource:(KPKNode *)node {
|
||||
self = [super init];
|
||||
if(self) {
|
||||
self.node = node;
|
||||
self.source = node;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)hasChanges {
|
||||
return ![self.node isEqual:self.source];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -9,7 +9,7 @@
|
||||
#import "MPInspectorViewController.h"
|
||||
#import "MPDatePickingViewController.h"
|
||||
#import "MPDocument.h"
|
||||
#import "MPEditingSession.h"
|
||||
#import "KPKEditingSession.h"
|
||||
#import "MPEntryInspectorViewController.h"
|
||||
#import "MPGroupInspectorViewController.h"
|
||||
#import "MPIconHelper.h"
|
||||
|
||||
Reference in New Issue
Block a user