Undo/Redo for add/remove of Stringfields

This commit is contained in:
michael starke
2013-06-28 02:45:48 +02:00
parent f56c325242
commit 56767216c6
4 changed files with 52 additions and 19 deletions

View File

@@ -303,14 +303,14 @@ enum {
#pragma mark Actions
- (IBAction)addCustomField:(id)sender {
Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry;
StringField *stringField = [StringField stringFieldWithKey:@"Key" andValue:@"Value"];
[entry insertObject:stringField inStringFieldsAtIndex:[entry.stringFields count]];
MPDocument *document = [[self windowController] document];
[document createStringField:self.selectedEntry];
}
- (IBAction)removeCustomField:(id)sender {
NSButton *button = sender;
MPDocument *document = [[self windowController] document];
NSUInteger index = [sender tag];
Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry;
[entry removeObjectFromStringFieldsAtIndex:[button tag]];
[document entry:entry removeStringField:[entry.stringFields objectAtIndex:index]];
}
#pragma mark Notificiations