mirror of
https://github.com/MacPass/MacPass.git
synced 2026-01-31 02:28:17 +00:00
More progress on import plugin support
This commit is contained in:
@@ -40,6 +40,9 @@
|
||||
#import "MPToolbarDelegate.h"
|
||||
#import "MPTitlebarColorAccessoryViewController.h"
|
||||
|
||||
#import "MPPluginHost.h"
|
||||
#import "MPPlugin.h"
|
||||
|
||||
#import "KeePassKit/KeePassKit.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MPAlertContext) {
|
||||
@@ -274,6 +277,28 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)importFromPlugin:(id)sender {
|
||||
if(![sender isKindOfClass:NSMenuItem.class]) {
|
||||
return;
|
||||
}
|
||||
NSMenuItem *menuItem = sender;
|
||||
if(![menuItem.representedObject isKindOfClass:NSDictionary.class]) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSWindow *sheetWindow = ((MPDocument *)self.document).windowForSheet;
|
||||
if(!sheetWindow) {
|
||||
return;
|
||||
}
|
||||
MPPlugin<MPImportPlugin> *importPlugin;
|
||||
NSOpenPanel *openPanel = NSOpenPanel.openPanel;
|
||||
[importPlugin prepareOpenPanel:openPanel];
|
||||
[openPanel beginSheetModalForWindow:sheetWindow completionHandler:^(NSModalResponse result) {
|
||||
KPKTree *importedTree = [importPlugin treeForRunningOpenPanel:openPanel withResponse:result];
|
||||
[self.document importTree:importedTree];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)mergeWithOther:(id)sender {
|
||||
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
||||
MPDocument *document = self.document;
|
||||
|
||||
Reference in New Issue
Block a user