mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 17:32:17 +00:00
Added Undo/Redo for string field editing
Fixed #26 - Entries now can be added to the rout group
This commit is contained in:
2
HNHUi
2
HNHUi
Submodule HNHUi updated: 87d76f4481...573b1d9409
@@ -56,6 +56,7 @@
|
|||||||
4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */; };
|
4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */; };
|
||||||
4C3BD51516D276F800389F1F /* MPToolbarDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BD51416D276F800389F1F /* MPToolbarDelegate.m */; };
|
4C3BD51516D276F800389F1F /* MPToolbarDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BD51416D276F800389F1F /* MPToolbarDelegate.m */; };
|
||||||
4C3D4C0817594CA40038DAAC /* HNHSeparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3D4C0717594CA40038DAAC /* HNHSeparator.m */; };
|
4C3D4C0817594CA40038DAAC /* HNHSeparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3D4C0717594CA40038DAAC /* HNHSeparator.m */; };
|
||||||
|
4C3E1CC0177DEFB3003BD9BD /* StringField+Undo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3E1CBF177DEFB3003BD9BD /* StringField+Undo.m */; };
|
||||||
4C3FFD9E16DAF60600DF9186 /* FilterBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */; };
|
4C3FFD9E16DAF60600DF9186 /* FilterBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */; };
|
||||||
4C431BCD16E2A82800700A81 /* MPPasteBoardController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */; };
|
4C431BCD16E2A82800700A81 /* MPPasteBoardController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */; };
|
||||||
4C431BCF16E2BAB000700A81 /* OverlayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C431BCE16E2BAB000700A81 /* OverlayWindow.xib */; };
|
4C431BCF16E2BAB000700A81 /* OverlayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C431BCE16E2BAB000700A81 /* OverlayWindow.xib */; };
|
||||||
@@ -281,6 +282,8 @@
|
|||||||
4C3BD51416D276F800389F1F /* MPToolbarDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPToolbarDelegate.m; sourceTree = "<group>"; };
|
4C3BD51416D276F800389F1F /* MPToolbarDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPToolbarDelegate.m; sourceTree = "<group>"; };
|
||||||
4C3D4C0617594CA40038DAAC /* HNHSeparator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHSeparator.h; sourceTree = "<group>"; };
|
4C3D4C0617594CA40038DAAC /* HNHSeparator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHSeparator.h; sourceTree = "<group>"; };
|
||||||
4C3D4C0717594CA40038DAAC /* HNHSeparator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHSeparator.m; sourceTree = "<group>"; };
|
4C3D4C0717594CA40038DAAC /* HNHSeparator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHSeparator.m; sourceTree = "<group>"; };
|
||||||
|
4C3E1CBE177DEFB3003BD9BD /* StringField+Undo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "StringField+Undo.h"; sourceTree = "<group>"; };
|
||||||
|
4C3E1CBF177DEFB3003BD9BD /* StringField+Undo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "StringField+Undo.m"; sourceTree = "<group>"; };
|
||||||
4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FilterBar.xib; sourceTree = "<group>"; };
|
4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FilterBar.xib; sourceTree = "<group>"; };
|
||||||
4C431BCB16E2A82700700A81 /* MPPasteBoardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasteBoardController.h; sourceTree = "<group>"; };
|
4C431BCB16E2A82700700A81 /* MPPasteBoardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasteBoardController.h; sourceTree = "<group>"; };
|
||||||
4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasteBoardController.m; sourceTree = "<group>"; };
|
4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasteBoardController.m; sourceTree = "<group>"; };
|
||||||
@@ -752,6 +755,8 @@
|
|||||||
4C22040C1746ED160054C916 /* KdbGroup+Undo.m */,
|
4C22040C1746ED160054C916 /* KdbGroup+Undo.m */,
|
||||||
4C36E5AF177CD38C00152132 /* Kdb4Tree+Undo.h */,
|
4C36E5AF177CD38C00152132 /* Kdb4Tree+Undo.h */,
|
||||||
4C36E5B0177CD38C00152132 /* Kdb4Tree+Undo.m */,
|
4C36E5B0177CD38C00152132 /* Kdb4Tree+Undo.m */,
|
||||||
|
4C3E1CBE177DEFB3003BD9BD /* StringField+Undo.h */,
|
||||||
|
4C3E1CBF177DEFB3003BD9BD /* StringField+Undo.m */,
|
||||||
4C4A101017629DA900BBF2CA /* KdbGroup+KVOAdditions.h */,
|
4C4A101017629DA900BBF2CA /* KdbGroup+KVOAdditions.h */,
|
||||||
4C4A101117629DA900BBF2CA /* KdbGroup+KVOAdditions.m */,
|
4C4A101117629DA900BBF2CA /* KdbGroup+KVOAdditions.m */,
|
||||||
4C36E5B2177CD4FB00152132 /* Kdb4Tree+KVOAdditions.h */,
|
4C36E5B2177CD4FB00152132 /* Kdb4Tree+KVOAdditions.h */,
|
||||||
@@ -1462,6 +1467,7 @@
|
|||||||
4C4FCE15177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m in Sources */,
|
4C4FCE15177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m in Sources */,
|
||||||
4C4FCE18177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.m in Sources */,
|
4C4FCE18177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.m in Sources */,
|
||||||
4C52A244177D7B9F0000D88F /* HNHScrollView.m in Sources */,
|
4C52A244177D7B9F0000D88F /* HNHScrollView.m in Sources */,
|
||||||
|
4C3E1CC0177DEFB3003BD9BD /* StringField+Undo.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -201,7 +201,6 @@
|
|||||||
<string key="NSFrame">{{0, 31}, {293, 399}}</string>
|
<string key="NSFrame">{{0, 31}, {293, 399}}</string>
|
||||||
<reference key="NSSuperview" ref="87082330"/>
|
<reference key="NSSuperview" ref="87082330"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView" ref="177600245"/>
|
|
||||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
<array class="NSMutableArray" key="NSTabViewItems">
|
<array class="NSMutableArray" key="NSTabViewItems">
|
||||||
<object class="NSTabViewItem" id="1002013291">
|
<object class="NSTabViewItem" id="1002013291">
|
||||||
@@ -1030,7 +1029,7 @@
|
|||||||
</array>
|
</array>
|
||||||
<double key="NSIntercellSpacingWidth">3</double>
|
<double key="NSIntercellSpacingWidth">3</double>
|
||||||
<double key="NSIntercellSpacingHeight">2</double>
|
<double key="NSIntercellSpacingHeight">2</double>
|
||||||
<reference key="NSBackgroundColor" ref="533509460"/>
|
<reference key="NSBackgroundColor" ref="566946319"/>
|
||||||
<reference key="NSGridColor" ref="771228525"/>
|
<reference key="NSGridColor" ref="771228525"/>
|
||||||
<double key="NSRowHeight">54</double>
|
<double key="NSRowHeight">54</double>
|
||||||
<int key="NSTvFlags">-1774190592</int>
|
<int key="NSTvFlags">-1774190592</int>
|
||||||
|
|||||||
@@ -58,7 +58,6 @@
|
|||||||
<string key="NSFrame">{{7, 5}, {32, 19}}</string>
|
<string key="NSFrame">{{7, 5}, {32, 19}}</string>
|
||||||
<reference key="NSSuperview" ref="163272962"/>
|
<reference key="NSSuperview" ref="163272962"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
|
||||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<object class="NSButtonCell" key="NSCell" id="160641004">
|
<object class="NSButtonCell" key="NSCell" id="160641004">
|
||||||
@@ -108,7 +107,7 @@
|
|||||||
<string key="NSFrameSize">{684, 548}</string>
|
<string key="NSFrameSize">{684, 548}</string>
|
||||||
<reference key="NSSuperview" ref="262664416"/>
|
<reference key="NSSuperview" ref="262664416"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView" ref="788738248"/>
|
<reference key="NSNextKeyView" ref="736877784"/>
|
||||||
<string key="NSReuseIdentifierKey">_NS:13</string>
|
<string key="NSReuseIdentifierKey">_NS:13</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||||
@@ -305,18 +304,8 @@
|
|||||||
<double key="NSIntercellSpacingWidth">3</double>
|
<double key="NSIntercellSpacingWidth">3</double>
|
||||||
<double key="NSIntercellSpacingHeight">2</double>
|
<double key="NSIntercellSpacingHeight">2</double>
|
||||||
<object class="NSColor" key="NSBackgroundColor">
|
<object class="NSColor" key="NSBackgroundColor">
|
||||||
<int key="NSColorSpace">6</int>
|
|
||||||
<string key="NSCatalogName">System</string>
|
|
||||||
<string key="NSColorName">_sourceListBackgroundColor</string>
|
|
||||||
<object class="NSColor" key="NSColor">
|
|
||||||
<int key="NSColorSpace">6</int>
|
|
||||||
<string key="NSCatalogName">System</string>
|
|
||||||
<string key="NSColorName">alternateSelectedControlColor</string>
|
|
||||||
<object class="NSColor" key="NSColor">
|
|
||||||
<int key="NSColorSpace">1</int>
|
<int key="NSColorSpace">1</int>
|
||||||
<bytes key="NSRGB">MCAwIDEAA</bytes>
|
<bytes key="NSRGB">MSAxIDEAA</bytes>
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
</object>
|
</object>
|
||||||
<object class="NSColor" key="NSGridColor">
|
<object class="NSColor" key="NSGridColor">
|
||||||
<int key="NSColorSpace">6</int>
|
<int key="NSColorSpace">6</int>
|
||||||
@@ -393,7 +382,7 @@
|
|||||||
<string key="NSFrame">{{0, 30}, {684, 565}}</string>
|
<string key="NSFrame">{{0, 30}, {684, 565}}</string>
|
||||||
<reference key="NSSuperview" ref="997686550"/>
|
<reference key="NSSuperview" ref="997686550"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView" ref="736877784"/>
|
<reference key="NSNextKeyView" ref="262664416"/>
|
||||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
<int key="NSsFlags">133680</int>
|
<int key="NSsFlags">133680</int>
|
||||||
<reference key="NSVScroller" ref="1037276411"/>
|
<reference key="NSVScroller" ref="1037276411"/>
|
||||||
@@ -1777,7 +1766,6 @@
|
|||||||
<string key="filterTitleButton">NSButton</string>
|
<string key="filterTitleButton">NSButton</string>
|
||||||
<string key="filterURLButton">NSButton</string>
|
<string key="filterURLButton">NSButton</string>
|
||||||
<string key="filterUsernameButton">NSButton</string>
|
<string key="filterUsernameButton">NSButton</string>
|
||||||
<string key="readOnlyImageView">NSImageView</string>
|
|
||||||
<string key="tableToTop">NSLayoutConstraint</string>
|
<string key="tableToTop">NSLayoutConstraint</string>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||||
@@ -1821,10 +1809,6 @@
|
|||||||
<string key="name">filterUsernameButton</string>
|
<string key="name">filterUsernameButton</string>
|
||||||
<string key="candidateClassName">NSButton</string>
|
<string key="candidateClassName">NSButton</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBToOneOutletInfo" key="readOnlyImageView">
|
|
||||||
<string key="name">readOnlyImageView</string>
|
|
||||||
<string key="candidateClassName">NSImageView</string>
|
|
||||||
</object>
|
|
||||||
<object class="IBToOneOutletInfo" key="tableToTop">
|
<object class="IBToOneOutletInfo" key="tableToTop">
|
||||||
<string key="name">tableToTop</string>
|
<string key="name">tableToTop</string>
|
||||||
<string key="candidateClassName">NSLayoutConstraint</string>
|
<string key="candidateClassName">NSLayoutConstraint</string>
|
||||||
|
|||||||
@@ -252,6 +252,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
|||||||
|
|
||||||
#pragma mark Data manipulation
|
#pragma mark Data manipulation
|
||||||
- (KdbEntry *)createEntry:(KdbGroup *)parent {
|
- (KdbEntry *)createEntry:(KdbGroup *)parent {
|
||||||
|
if(!parent) {
|
||||||
|
return nil; // No parent
|
||||||
|
}
|
||||||
KdbEntry *newEntry = [self.tree createEntry:parent];
|
KdbEntry *newEntry = [self.tree createEntry:parent];
|
||||||
newEntry.title = NSLocalizedString(@"DEFAULT_ENTRY_TITLE", @"Title for a newly created entry");
|
newEntry.title = NSLocalizedString(@"DEFAULT_ENTRY_TITLE", @"Title for a newly created entry");
|
||||||
if(self.treeV4 && ([self.treeV4.defaultUserName length] > 0)) {
|
if(self.treeV4 && ([self.treeV4.defaultUserName length] > 0)) {
|
||||||
@@ -264,6 +267,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (KdbGroup *)createGroup:(KdbGroup *)parent {
|
- (KdbGroup *)createGroup:(KdbGroup *)parent {
|
||||||
|
if(!parent) {
|
||||||
|
return nil; // no parent!
|
||||||
|
}
|
||||||
KdbGroup *newGroup = [self.tree createGroup:parent];
|
KdbGroup *newGroup = [self.tree createGroup:parent];
|
||||||
newGroup.name = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
newGroup.name = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
||||||
[self group:parent addGroup:newGroup atIndex:[parent.groups count]];
|
[self group:parent addGroup:newGroup atIndex:[parent.groups count]];
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#import "Kdb3Node.h"
|
#import "Kdb3Node.h"
|
||||||
#import "KdbGroup+Undo.h"
|
#import "KdbGroup+Undo.h"
|
||||||
#import "KdbEntry+Undo.h"
|
#import "KdbEntry+Undo.h"
|
||||||
|
#import "StringField+Undo.h"
|
||||||
#import "Kdb4Entry+KVOAdditions.h"
|
#import "Kdb4Entry+KVOAdditions.h"
|
||||||
#import "NSMutableData+Base64.h"
|
#import "NSMutableData+Base64.h"
|
||||||
|
|
||||||
@@ -97,6 +98,8 @@ enum {
|
|||||||
|
|
||||||
[_attachmentTableView bind:NSContentBinding toObject:self.attachmentsController withKeyPath:@"arrangedObjects" options:nil];
|
[_attachmentTableView bind:NSContentBinding toObject:self.attachmentsController withKeyPath:@"arrangedObjects" options:nil];
|
||||||
[_attachmentTableView setDelegate:self];
|
[_attachmentTableView setDelegate:self];
|
||||||
|
/* Set background to clearcolor so we can draw in the scrollview */
|
||||||
|
[_customFieldsTableView setBackgroundColor:[NSColor clearColor]];
|
||||||
[_customFieldsTableView bind:NSContentBinding toObject:self.customFieldsController withKeyPath:@"arrangedObjects" options:nil];
|
[_customFieldsTableView bind:NSContentBinding toObject:self.customFieldsController withKeyPath:@"arrangedObjects" options:nil];
|
||||||
[_customFieldsTableView setDelegate:self];
|
[_customFieldsTableView setDelegate:self];
|
||||||
|
|
||||||
@@ -358,8 +361,8 @@ enum {
|
|||||||
if([self.selectedEntry isKindOfClass:[Kdb4Entry class]]) {
|
if([self.selectedEntry isKindOfClass:[Kdb4Entry class]]) {
|
||||||
Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry;
|
Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry;
|
||||||
StringField *stringField = entry.stringFields[row];
|
StringField *stringField = entry.stringFields[row];
|
||||||
[view.labelTextField bind:NSValueBinding toObject:stringField withKeyPath:@"key" options:nil];
|
[view.labelTextField bind:NSValueBinding toObject:stringField withKeyPath:MPStringFieldKeyUndoableKey options:nil];
|
||||||
[view.valueTextField bind:NSValueBinding toObject:stringField withKeyPath:@"value" options:nil];
|
[view.valueTextField bind:NSValueBinding toObject:stringField withKeyPath:MPStringFieldValueUndoableKey options:nil];
|
||||||
[view.removeButton setTarget:self];
|
[view.removeButton setTarget:self];
|
||||||
[view.removeButton setAction:@selector(removeCustomField:)];
|
[view.removeButton setAction:@selector(removeCustomField:)];
|
||||||
[view.removeButton setTag:row];
|
[view.removeButton setTag:row];
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
[_outlineView expandItem:item];
|
[_outlineView expandItem:item];
|
||||||
indexSet = [NSIndexSet indexSetWithIndex:selectedRow + 1];
|
indexSet = [NSIndexSet indexSetWithIndex:selectedRow + 1];
|
||||||
}
|
}
|
||||||
[_outlineView selectRowIndexes:indexSet byExtendingSelection:NO];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@@ -123,23 +122,11 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
|||||||
if(!group) {
|
if(!group) {
|
||||||
group = document.root;
|
group = document.root;
|
||||||
}
|
}
|
||||||
BOOL isFistGroup = [document.root.groups count] == 0;
|
|
||||||
[document createGroup:group];
|
[document createGroup:group];
|
||||||
/*
|
|
||||||
TODO: Find out if a lower hierachy node was the first child
|
|
||||||
and auto-expand that item too
|
|
||||||
*/
|
|
||||||
if(isFistGroup) {
|
|
||||||
NSTreeNode *node = [_outlineView itemAtRow:0];
|
|
||||||
[_outlineView expandItem:node expandChildren:NO];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)createEntry:(id)sender {
|
- (void)createEntry:(id)sender {
|
||||||
KdbGroup *group = [self _clickedOrSelectedGroup];
|
KdbGroup *group = [self _clickedOrSelectedGroup];
|
||||||
if(!group.parent) {
|
|
||||||
return; // Entries are not allowed in root group
|
|
||||||
}
|
|
||||||
if(group) {
|
if(group) {
|
||||||
MPDocument *document = [[self windowController] document];
|
MPDocument *document = [[self windowController] document];
|
||||||
[document createEntry:group];
|
[document createEntry:group];
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
We need to clear the outer areas
|
We need to clear the outer areas
|
||||||
as calling super will not do that for us
|
as calling super will not do that for us
|
||||||
*/
|
*/
|
||||||
[[NSColor whiteColor] set];
|
[[self backgroundColor] set];
|
||||||
NSRectFill(clipRect);
|
NSRectFill(clipRect);
|
||||||
[super drawBackgroundInClipRect:clipRect];
|
[super drawBackgroundInClipRect:clipRect];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1508</string>
|
<string>1556</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
|||||||
23
MacPass/StringField+Undo.h
Normal file
23
MacPass/StringField+Undo.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// StringField+Undo.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 28.06.13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Kdb4Node.h"
|
||||||
|
|
||||||
|
APPKIT_EXTERN NSString *const MPStringFieldKeyUndoableKey;
|
||||||
|
APPKIT_EXTERN NSString *const MPStringFieldValueUndoableKey;
|
||||||
|
|
||||||
|
@interface StringField (Undo)
|
||||||
|
|
||||||
|
|
||||||
|
- (NSString *)keyUndoable;
|
||||||
|
- (NSString *)valueUndoable;
|
||||||
|
|
||||||
|
- (void)setKeyUndoable:(NSString *)key;
|
||||||
|
- (void)setValueUndoable:(NSString *)value;
|
||||||
|
|
||||||
|
@end
|
||||||
44
MacPass/StringField+Undo.m
Normal file
44
MacPass/StringField+Undo.m
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
//
|
||||||
|
// StringField+Undo.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 28.06.13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "StringField+Undo.h"
|
||||||
|
|
||||||
|
NSString *const MPStringFieldKeyUndoableKey = @"keyUndoable";
|
||||||
|
NSString *const MPStringFieldValueUndoableKey = @"valueUndoable";
|
||||||
|
|
||||||
|
@implementation StringField (Undo)
|
||||||
|
|
||||||
|
- (NSUndoManager *)undoManager {
|
||||||
|
return [[[NSDocumentController sharedDocumentController] currentDocument] undoManager];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)keyUndoable {
|
||||||
|
return self.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)valueUndoable {
|
||||||
|
return self.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setKeyUndoable:(NSString *)key {
|
||||||
|
if(![self.key isEqualToString:key]) {
|
||||||
|
[[self undoManager] registerUndoWithTarget:self selector:@selector(setKeyUndoable:) object:self.key];
|
||||||
|
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_STRINGFILED_KEY", @"Set StringField key")];
|
||||||
|
self.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setValueUndoable:(NSString *)value {
|
||||||
|
if(![self.value isEqualToString:value]) {
|
||||||
|
[[self undoManager] registerUndoWithTarget:self selector:@selector(setValueUndoable:) object:self.value];
|
||||||
|
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_STRINGFIELD_VALUE", @"Set StringField value")];
|
||||||
|
self.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
Reference in New Issue
Block a user