Minor updates for plugins

This commit is contained in:
michael starke
2016-02-29 15:27:49 +01:00
parent 90c731cbb0
commit c392e32e9a
7 changed files with 15 additions and 7 deletions

View File

@@ -263,7 +263,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
- (void)_toggleEditors:(BOOL)editable { - (void)_toggleEditors:(BOOL)editable {
self.itemImageView.enabled = editable; self.itemImageView.enabled = editable;
self.itemNameTextField.enabled = editable; self.itemNameTextField.enabled = editable;
self.itemImageView.enabled = editable; self.itemImageView.editable = editable;
self.notesTextView.editable = editable; self.notesTextView.editable = editable;
} }
#pragma mark - #pragma mark -
@@ -284,6 +284,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
self.nodeController.content = node; self.nodeController.content = node;
self.entryViewController.representedObject = node.asEntry; self.entryViewController.representedObject = node.asEntry;
self.groupViewController.representedObject = node.asGroup; self.groupViewController.representedObject = node.asGroup;
[self _toggleEditors:(nil != node.asGroup)];
} }
- (IBAction)beginEditing:(id)sender { - (IBAction)beginEditing:(id)sender {

View File

@@ -37,14 +37,14 @@ FOUNDATION_EXPORT NSString *const kMPPluginFileExtension;
@class KPKTree; @class KPKTree;
@protocol MPTreeImporting <NSObject> @protocol MPPluginExporting <NSObject>
@required @required
- (KPKTree *)importTreeAtURL:(NSURL *)url error:(NSError **)error; - (KPKTree *)importTreeAtURL:(NSURL *)url error:(NSError **)error;
@end @end
@protocol MPTreeExporting <NSObject> @protocol MPPluginImporting <NSObject>
@required @required
- (NSData *)dataForTree:(KPKTree *)tree error:(NSError **)error; - (NSData *)dataForTree:(KPKTree *)tree error:(NSError **)error;

View File

@@ -7,6 +7,9 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class KPKNode; @class KPKNode;
@class KPKEntry; @class KPKEntry;
@class KPKGroup; @class KPKGroup;
@@ -22,4 +25,7 @@ typedef BOOL (^NodeMatchBlock)(KPKNode *aNode);
- (NSArray<KPKEntry *> *)filteredEntriesUsingBlock:(NodeMatchBlock)matchBlock; - (NSArray<KPKEntry *> *)filteredEntriesUsingBlock:(NodeMatchBlock)matchBlock;
- (NSArray<KPKGroup *> *)filteredGroupsUsingBlock:(NodeMatchBlock)matchBlock; - (NSArray<KPKGroup *> *)filteredGroupsUsingBlock:(NodeMatchBlock)matchBlock;
- (void)presentError:(NSError *)error completionHandler:(void (^)(NSModalResponse response))completionHandler;
@end @end
NS_ASSUME_NONNULL_END

View File

@@ -33,7 +33,7 @@ static MPPluginHost *_instance;
} }
- (NSArray<KPKEntry *> *)filteredEntriesUsingBlock:(NodeMatchBlock)matchBlock { - (NSArray<KPKEntry *> *)filteredEntriesUsingBlock:(NodeMatchBlock)matchBlock {
NSArray *currentDocuments = [[NSDocumentController sharedDocumentController] documents]; NSArray *currentDocuments = [NSDocumentController sharedDocumentController].documents;
NSMutableArray *entries = [[NSMutableArray alloc] initWithCapacity:200]; NSMutableArray *entries = [[NSMutableArray alloc] initWithCapacity:200];
for(MPDocument *document in currentDocuments) { for(MPDocument *document in currentDocuments) {
if(document.tree) { if(document.tree) {
@@ -49,4 +49,7 @@ static MPPluginHost *_instance;
return nil; return nil;
} }
- (void)presentError:(NSError *)error completionHandler:(void (^)(NSModalResponse))completionHandler {
}
@end @end

View File

@@ -15,7 +15,6 @@ FOUNDATION_EXPORT NSString *const MPPluginManagerDidUnloadPlugin;
FOUNDATION_EXPORT NSString *const MPPluginManagerPluginBundleIdentifiyerKey; FOUNDATION_EXPORT NSString *const MPPluginManagerPluginBundleIdentifiyerKey;
@class KPKNode;
@class MPPlugin; @class MPPlugin;
@interface MPPluginManager : NSObject @interface MPPluginManager : NSObject

View File

@@ -142,7 +142,7 @@ NSString *const MPPluginManagerPluginBundleIdentifiyerKey = @"MPPluginManagerPlu
} }
- (BOOL)_validateClass:(Class)class { - (BOOL)_validateClass:(Class)class {
return ([class isSubclassOfClass:[MPPlugin class]]); return [class isSubclassOfClass:[MPPlugin class]];
} }
/* Code by Jedda Wignall<jedda@jedda.me> http://jedda.me/2012/03/verifying-plugin-bundles-using-code-signing/ */ /* Code by Jedda Wignall<jedda@jedda.me> http://jedda.me/2012/03/verifying-plugin-bundles-using-code-signing/ */

View File

@@ -92,7 +92,6 @@
<constraint firstItem="241" firstAttribute="centerY" secondItem="240" secondAttribute="centerY" id="349"/> <constraint firstItem="241" firstAttribute="centerY" secondItem="240" secondAttribute="centerY" id="349"/>
<constraint firstItem="243" firstAttribute="bottom" secondItem="241" secondAttribute="bottom" id="388"/> <constraint firstItem="243" firstAttribute="bottom" secondItem="241" secondAttribute="bottom" id="388"/>
<constraint firstAttribute="trailing" secondItem="243" secondAttribute="trailing" constant="3" id="389"/> <constraint firstAttribute="trailing" secondItem="243" secondAttribute="trailing" constant="3" id="389"/>
<constraint firstAttribute="trailing" secondItem="243" secondAttribute="trailing" constant="3" id="4Vg-BQ-zVQ"/>
</constraints> </constraints>
<connections> <connections>
<outlet property="imageView" destination="241" id="247"/> <outlet property="imageView" destination="241" id="247"/>