mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-22 19:59:29 +00:00
Added Template editing.
Creating with templates not supported yet. Templates are listed in Context-Menu under the AddEntry Toolbar Toolbar Button is missing an Arrow for now. Control-Size is not working correctly for now Nested Template or Trash groups aren't considered, this is a bug! Minor changes to the UI (Settings tabs now use common icons) Added Workflow-Settings tab to extract all the custom action possible on entries. The copy or open on URL dbl-click setting will move over to this tab.
This commit is contained in:
43
MacPass/MPAddEntryContextMenuDelegate.m
Normal file
43
MacPass/MPAddEntryContextMenuDelegate.m
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// MPAddEntryContextMenuDelegate.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 30.07.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPAddEntryContextMenuDelegate.h"
|
||||
#import "MPDocument.h"
|
||||
#import "MPDocumentWindowController.h"
|
||||
#import "MPActionHelper.h"
|
||||
|
||||
#import "KdbGroup+MPTreeTools.h"
|
||||
|
||||
#define EDIT_TEMPLATES_ITEM_TAG 10;
|
||||
|
||||
@implementation MPAddEntryContextMenuDelegate
|
||||
|
||||
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
||||
/*
|
||||
The Method is rather brute force
|
||||
It's possible nicer to cache the entries and just update
|
||||
the menu entries, that actuyll need updating
|
||||
*/
|
||||
MPDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
if(!document) {
|
||||
[menu removeAllItems];
|
||||
}
|
||||
[menu removeAllItems];
|
||||
[menu addItemWithTitle:NSLocalizedString(@"EDIT_TEMPLATE_GROUP", "") action:[MPActionHelper actionOfType:MPActionEditTemplateGroup] keyEquivalent:@""];
|
||||
[menu addItem:[NSMenuItem separatorItem]];
|
||||
for(KdbEntry *entry in [document.templates childEntries]) {
|
||||
NSString *templateMask = NSLocalizedString(@"NEW_ENTRY_WITH_TEMPLATE_%@", "");
|
||||
NSMenuItem *templateItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:[NSString stringWithFormat:templateMask, entry.title]
|
||||
action:@selector(createEntryFromTemplate:)
|
||||
keyEquivalent:@""];
|
||||
[templateItem setRepresentedObject:entry];
|
||||
[menu addItem:templateItem];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user