mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 15:12:21 +00:00
Added dynamic visibility for edit button. Button should only be used if history is enabled and thus will be saved. Otherwise direct editing should be possible
This commit is contained in:
Submodule KeePassKit updated: 76975731c3...43af7b31f0
@@ -107,7 +107,7 @@
|
|||||||
<object class="NSImageCell" key="NSCell" id="152819686">
|
<object class="NSImageCell" key="NSCell" id="152819686">
|
||||||
<int key="NSCellFlags">134217728</int>
|
<int key="NSCellFlags">134217728</int>
|
||||||
<int key="NSCellFlags2">33554432</int>
|
<int key="NSCellFlags2">33554432</int>
|
||||||
<object class="NSCustomResource" key="NSContents" id="202092680">
|
<object class="NSCustomResource" key="NSContents">
|
||||||
<string key="NSClassName">NSImage</string>
|
<string key="NSClassName">NSImage</string>
|
||||||
<string key="NSResourceName">NSActionTemplate</string>
|
<string key="NSResourceName">NSActionTemplate</string>
|
||||||
</object>
|
</object>
|
||||||
@@ -127,22 +127,24 @@
|
|||||||
<object class="NSButton" id="830540359">
|
<object class="NSButton" id="830540359">
|
||||||
<reference key="NSNextResponder" ref="381395509"/>
|
<reference key="NSNextResponder" ref="381395509"/>
|
||||||
<int key="NSvFlags">-2147483380</int>
|
<int key="NSvFlags">-2147483380</int>
|
||||||
<string key="NSFrame">{{20, 2}, {35, 25}}</string>
|
<string key="NSFrame">{{197, 2}, {60, 25}}</string>
|
||||||
<reference key="NSSuperview" ref="381395509"/>
|
<reference key="NSSuperview" ref="381395509"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
|
||||||
<string key="NSReuseIdentifierKey">_NS:22</string>
|
<string key="NSReuseIdentifierKey">_NS:22</string>
|
||||||
<bool key="NSEnabled">YES</bool>
|
<bool key="NSEnabled">YES</bool>
|
||||||
<object class="NSButtonCell" key="NSCell" id="348505851">
|
<object class="NSButtonCell" key="NSCell" id="348505851">
|
||||||
<int key="NSCellFlags">-2080374784</int>
|
<int key="NSCellFlags">-2080374784</int>
|
||||||
<int key="NSCellFlags2">134217728</int>
|
<int key="NSCellFlags2">134217728</int>
|
||||||
<string key="NSContents"/>
|
<string key="NSContents">Edit</string>
|
||||||
<reference key="NSSupport" ref="240853158"/>
|
<reference key="NSSupport" ref="240853158"/>
|
||||||
<string key="NSCellIdentifier">_NS:22</string>
|
<string key="NSCellIdentifier">_NS:22</string>
|
||||||
<reference key="NSControlView" ref="830540359"/>
|
<reference key="NSControlView" ref="830540359"/>
|
||||||
<int key="NSButtonFlags">-2034483200</int>
|
<int key="NSButtonFlags">-2034483200</int>
|
||||||
<int key="NSButtonFlags2">163</int>
|
<int key="NSButtonFlags2">163</int>
|
||||||
<reference key="NSNormalImage" ref="202092680"/>
|
<object class="NSCustomResource" key="NSNormalImage">
|
||||||
|
<string key="NSClassName">NSImage</string>
|
||||||
|
<string key="NSResourceName">07_NotepadTemplate</string>
|
||||||
|
</object>
|
||||||
<string key="NSAlternateContents"/>
|
<string key="NSAlternateContents"/>
|
||||||
<string key="NSKeyEquivalent"/>
|
<string key="NSKeyEquivalent"/>
|
||||||
<int key="NSPeriodicDelay">400</int>
|
<int key="NSPeriodicDelay">400</int>
|
||||||
@@ -164,7 +166,6 @@
|
|||||||
<string key="NSFrame">{{0, 30}, {278, 369}}</string>
|
<string key="NSFrame">{{0, 30}, {278, 369}}</string>
|
||||||
<reference key="NSSuperview" ref="233312071"/>
|
<reference key="NSSuperview" ref="233312071"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView" ref="906788312"/>
|
|
||||||
<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="367063082">
|
<object class="NSTabViewItem" id="367063082">
|
||||||
@@ -175,7 +176,7 @@
|
|||||||
<string key="NSFrameSize">{278, 369}</string>
|
<string key="NSFrameSize">{278, 369}</string>
|
||||||
<reference key="NSSuperview" ref="45251842"/>
|
<reference key="NSSuperview" ref="45251842"/>
|
||||||
<reference key="NSWindow"/>
|
<reference key="NSWindow"/>
|
||||||
<reference key="NSNextKeyView"/>
|
<reference key="NSNextKeyView" ref="381395509"/>
|
||||||
<string key="NSReuseIdentifierKey">_NS:28</string>
|
<string key="NSReuseIdentifierKey">_NS:28</string>
|
||||||
</object>
|
</object>
|
||||||
<string key="NSLabel">Entry</string>
|
<string key="NSLabel">Entry</string>
|
||||||
@@ -317,6 +318,14 @@
|
|||||||
</object>
|
</object>
|
||||||
<int key="connectionID">3095</int>
|
<int key="connectionID">3095</int>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBConnectionRecord">
|
||||||
|
<object class="IBOutletConnection" key="connection">
|
||||||
|
<string key="label">editButton</string>
|
||||||
|
<reference key="source" ref="1001"/>
|
||||||
|
<reference key="destination" ref="830540359"/>
|
||||||
|
</object>
|
||||||
|
<int key="connectionID">3122</int>
|
||||||
|
</object>
|
||||||
</array>
|
</array>
|
||||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||||
<array key="orderedObjects">
|
<array key="orderedObjects">
|
||||||
@@ -610,6 +619,23 @@
|
|||||||
<int key="objectID">2930</int>
|
<int key="objectID">2930</int>
|
||||||
<reference key="object" ref="381395509"/>
|
<reference key="object" ref="381395509"/>
|
||||||
<array class="NSMutableArray" key="children">
|
<array class="NSMutableArray" key="children">
|
||||||
|
<object class="IBNSLayoutConstraint" id="359501674">
|
||||||
|
<reference key="firstItem" ref="381395509"/>
|
||||||
|
<int key="firstAttribute">6</int>
|
||||||
|
<int key="relation">0</int>
|
||||||
|
<reference key="secondItem" ref="830540359"/>
|
||||||
|
<int key="secondAttribute">6</int>
|
||||||
|
<float key="multiplier">1</float>
|
||||||
|
<object class="IBLayoutConstant" key="constant">
|
||||||
|
<double key="value">21</double>
|
||||||
|
</object>
|
||||||
|
<float key="priority">1000</float>
|
||||||
|
<reference key="containingView" ref="381395509"/>
|
||||||
|
<int key="scoringType">3</int>
|
||||||
|
<float key="scoringTypeFloat">9</float>
|
||||||
|
<int key="contentType">3</int>
|
||||||
|
<bool key="placeholder">NO</bool>
|
||||||
|
</object>
|
||||||
<object class="IBNSLayoutConstraint" id="696932551">
|
<object class="IBNSLayoutConstraint" id="696932551">
|
||||||
<reference key="firstItem" ref="830540359"/>
|
<reference key="firstItem" ref="830540359"/>
|
||||||
<int key="firstAttribute">10</int>
|
<int key="firstAttribute">10</int>
|
||||||
@@ -627,23 +653,6 @@
|
|||||||
<int key="contentType">2</int>
|
<int key="contentType">2</int>
|
||||||
<bool key="placeholder">NO</bool>
|
<bool key="placeholder">NO</bool>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBNSLayoutConstraint" id="618180937">
|
|
||||||
<reference key="firstItem" ref="830540359"/>
|
|
||||||
<int key="firstAttribute">5</int>
|
|
||||||
<int key="relation">0</int>
|
|
||||||
<reference key="secondItem" ref="381395509"/>
|
|
||||||
<int key="secondAttribute">5</int>
|
|
||||||
<float key="multiplier">1</float>
|
|
||||||
<object class="IBNSLayoutSymbolicConstant" key="constant">
|
|
||||||
<double key="value">20</double>
|
|
||||||
</object>
|
|
||||||
<float key="priority">1000</float>
|
|
||||||
<reference key="containingView" ref="381395509"/>
|
|
||||||
<int key="scoringType">0</int>
|
|
||||||
<float key="scoringTypeFloat">29</float>
|
|
||||||
<int key="contentType">3</int>
|
|
||||||
<bool key="placeholder">NO</bool>
|
|
||||||
</object>
|
|
||||||
<object class="IBNSLayoutConstraint" id="574545128">
|
<object class="IBNSLayoutConstraint" id="574545128">
|
||||||
<reference key="firstItem" ref="381395509"/>
|
<reference key="firstItem" ref="381395509"/>
|
||||||
<int key="firstAttribute">8</int>
|
<int key="firstAttribute">8</int>
|
||||||
@@ -877,13 +886,13 @@
|
|||||||
<reference key="parent" ref="830540359"/>
|
<reference key="parent" ref="830540359"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">3111</int>
|
<int key="objectID">3112</int>
|
||||||
<reference key="object" ref="618180937"/>
|
<reference key="object" ref="696932551"/>
|
||||||
<reference key="parent" ref="381395509"/>
|
<reference key="parent" ref="381395509"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">3112</int>
|
<int key="objectID">3123</int>
|
||||||
<reference key="object" ref="696932551"/>
|
<reference key="object" ref="359501674"/>
|
||||||
<reference key="parent" ref="381395509"/>
|
<reference key="parent" ref="381395509"/>
|
||||||
</object>
|
</object>
|
||||||
</array>
|
</array>
|
||||||
@@ -925,8 +934,8 @@
|
|||||||
<string key="2929.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="2929.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<array class="NSMutableArray" key="2930.IBNSViewMetadataConstraints">
|
<array class="NSMutableArray" key="2930.IBNSViewMetadataConstraints">
|
||||||
<reference ref="574545128"/>
|
<reference ref="574545128"/>
|
||||||
<reference ref="618180937"/>
|
|
||||||
<reference ref="696932551"/>
|
<reference ref="696932551"/>
|
||||||
|
<reference ref="359501674"/>
|
||||||
</array>
|
</array>
|
||||||
<boolean value="NO" key="2930.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
<boolean value="NO" key="2930.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||||
<string key="2930.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="2930.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
@@ -968,14 +977,14 @@
|
|||||||
<boolean value="NO" key="3109.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
<boolean value="NO" key="3109.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||||
<string key="3109.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="3109.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string key="3110.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="3110.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string key="3111.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
|
||||||
<string key="3112.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string key="3112.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string key="3123.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||||
<nil key="activeLocalization"/>
|
<nil key="activeLocalization"/>
|
||||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||||
<nil key="sourceID"/>
|
<nil key="sourceID"/>
|
||||||
<int key="maxID">3117</int>
|
<int key="maxID">3123</int>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||||
@@ -1004,6 +1013,7 @@
|
|||||||
<dictionary class="NSMutableDictionary" key="outlets">
|
<dictionary class="NSMutableDictionary" key="outlets">
|
||||||
<string key="bottomBar">HNHGradientView</string>
|
<string key="bottomBar">HNHGradientView</string>
|
||||||
<string key="createdTextField">NSTextField</string>
|
<string key="createdTextField">NSTextField</string>
|
||||||
|
<string key="editButton">NSButton</string>
|
||||||
<string key="itemImageView">MPPopupImageView</string>
|
<string key="itemImageView">MPPopupImageView</string>
|
||||||
<string key="itemNameTextField">NSTextField</string>
|
<string key="itemNameTextField">NSTextField</string>
|
||||||
<string key="modifiedTextField">NSTextField</string>
|
<string key="modifiedTextField">NSTextField</string>
|
||||||
@@ -1019,6 +1029,10 @@
|
|||||||
<string key="name">createdTextField</string>
|
<string key="name">createdTextField</string>
|
||||||
<string key="candidateClassName">NSTextField</string>
|
<string key="candidateClassName">NSTextField</string>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBToOneOutletInfo" key="editButton">
|
||||||
|
<string key="name">editButton</string>
|
||||||
|
<string key="candidateClassName">NSButton</string>
|
||||||
|
</object>
|
||||||
<object class="IBToOneOutletInfo" key="itemImageView">
|
<object class="IBToOneOutletInfo" key="itemImageView">
|
||||||
<string key="name">itemImageView</string>
|
<string key="name">itemImageView</string>
|
||||||
<string key="candidateClassName">MPPopupImageView</string>
|
<string key="candidateClassName">MPPopupImageView</string>
|
||||||
@@ -1084,10 +1098,10 @@
|
|||||||
</object>
|
</object>
|
||||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||||
<string key="NS.key.0">NSActionTemplate</string>
|
<string key="07_NotepadTemplate">{16, 16}</string>
|
||||||
<string key="NS.object.0">{15, 15}</string>
|
<string key="NSActionTemplate">{15, 15}</string>
|
||||||
</object>
|
</dictionary>
|
||||||
<bool key="IBDocument.UseAutolayout">YES</bool>
|
<bool key="IBDocument.UseAutolayout">YES</bool>
|
||||||
</data>
|
</data>
|
||||||
</archive>
|
</archive>
|
||||||
|
|||||||
@@ -18,12 +18,6 @@ APPKIT_EXTERN NSString *const MPDocumentDidUnlockDatabaseNotification;
|
|||||||
APPKIT_EXTERN NSString *const MPDocumentEntryKey;
|
APPKIT_EXTERN NSString *const MPDocumentEntryKey;
|
||||||
APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||||
|
|
||||||
/*
|
|
||||||
APPKIT_EXTERN NSString *const MPDocumentDidChangeCurrentItemNotification;
|
|
||||||
APPKIT_EXTERN NSString *const MPDocumentDidChangeCurrentGroupNotication;
|
|
||||||
APPKIT_EXTERN NSString *const MPDocumnetDidChangeCurrentEntryNotification;
|
|
||||||
*/
|
|
||||||
|
|
||||||
@class KPKGroup;
|
@class KPKGroup;
|
||||||
@class KPKEntry;
|
@class KPKEntry;
|
||||||
@class KPKTree;
|
@class KPKTree;
|
||||||
@@ -32,7 +26,6 @@ APPKIT_EXTERN NSString *const MPDocumnetDidChangeCurrentEntryNotification;
|
|||||||
|
|
||||||
@interface MPDocument : NSDocument
|
@interface MPDocument : NSDocument
|
||||||
|
|
||||||
/* true, if password and/or keyfile are set */
|
|
||||||
@property (assign, readonly) BOOL hasPasswordOrKey;
|
@property (assign, readonly) BOOL hasPasswordOrKey;
|
||||||
@property (nonatomic, readonly, assign) BOOL encrypted;
|
@property (nonatomic, readonly, assign) BOOL encrypted;
|
||||||
|
|
||||||
@@ -63,21 +56,32 @@ APPKIT_EXTERN NSString *const MPDocumnetDidChangeCurrentEntryNotification;
|
|||||||
- (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL error:(NSError *__autoreleasing*)error;
|
- (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL error:(NSError *__autoreleasing*)error;
|
||||||
|
|
||||||
#pragma mark Data Lookup
|
#pragma mark Data Lookup
|
||||||
/*
|
/**
|
||||||
Returns the entry for the given UUID, nil if none was found
|
* Finds an entry with the given UUID. If none is found, nil is returned
|
||||||
|
* @param uuid The UUID for the searched Entry
|
||||||
|
* @return enty, matching the UUID, nil if none was found
|
||||||
*/
|
*/
|
||||||
- (KPKEntry *)findEntry:(NSUUID *)uuid;
|
- (KPKEntry *)findEntry:(NSUUID *)uuid;
|
||||||
|
/**
|
||||||
|
* Finds the group with the given UUID in this document. If none if found, nil is returned
|
||||||
|
* @param uuid The UUID of the searched group
|
||||||
|
* @return matching group, nil if none was found
|
||||||
|
*/
|
||||||
- (KPKGroup *)findGroup:(NSUUID *)uuid;
|
- (KPKGroup *)findGroup:(NSUUID *)uuid;
|
||||||
|
|
||||||
- (void)useGroupAsTrash:(KPKGroup *)group;
|
- (void)useGroupAsTrash:(KPKGroup *)group;
|
||||||
- (void)useGroupAsTemplate:(KPKGroup *)group;
|
- (void)useGroupAsTemplate:(KPKGroup *)group;
|
||||||
|
/**
|
||||||
|
* Determines, whether the given item is inside the trash.
|
||||||
|
* The trash group itself is not considered as trashed.
|
||||||
|
* Hence when sending this message with the trash group as item, NO is returned
|
||||||
|
* @param item Item to test if trashed or not
|
||||||
|
* @return YES, if the item is inside the trash, NO otherwise (and if item is trash group)
|
||||||
|
*/
|
||||||
- (BOOL)isItemTrashed:(id)item;
|
- (BOOL)isItemTrashed:(id)item;
|
||||||
|
|
||||||
#pragma mark Export
|
|
||||||
- (void)writeXMLToURL:(NSURL *)url;
|
- (void)writeXMLToURL:(NSURL *)url;
|
||||||
|
|
||||||
#pragma mark Undo Data Manipulation
|
|
||||||
/* Undoable Intiialization of elements */
|
/* Undoable Intiialization of elements */
|
||||||
- (KPKGroup *)createGroup:(KPKGroup *)parent;
|
- (KPKGroup *)createGroup:(KPKGroup *)parent;
|
||||||
- (KPKEntry *)createEntry:(KPKGroup *)parent;
|
- (KPKEntry *)createEntry:(KPKGroup *)parent;
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark Properties
|
#pragma mark Properties
|
||||||
|
|
||||||
- (KPKVersion)versionForFileType {
|
- (KPKVersion)versionForFileType {
|
||||||
return [[self class] versionForFileType:[self fileType]];
|
return [[self class] versionForFileType:[self fileType]];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,6 +406,8 @@ typedef NS_ENUM(NSUInteger, MPAlertContext) {
|
|||||||
[_entryViewController updateResponderChain];
|
[_entryViewController updateResponderChain];
|
||||||
[_inspectorViewController updateResponderChain];
|
[_inspectorViewController updateResponderChain];
|
||||||
[_outlineViewController updateResponderChain];
|
[_outlineViewController updateResponderChain];
|
||||||
|
/* Custom setup after being added to window */
|
||||||
|
[_inspectorViewController prepareView];
|
||||||
[_outlineViewController showOutline];
|
[_outlineViewController showOutline];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
|||||||
NSTextField *textField = [view textField];
|
NSTextField *textField = [view textField];
|
||||||
if(!isModifedColumn && !isNotesColumn) {
|
if(!isModifedColumn && !isNotesColumn) {
|
||||||
/* clean up old formatter that might be left */
|
/* clean up old formatter that might be left */
|
||||||
NSLog(@"Cleaing formatter. %@", [textField formatter]);
|
|
||||||
[textField setFormatter:nil];
|
[textField setFormatter:nil];
|
||||||
}
|
}
|
||||||
if(isModifedColumn) {
|
if(isModifedColumn) {
|
||||||
|
|||||||
@@ -19,10 +19,12 @@
|
|||||||
@property (weak) IBOutlet NSTextField *noSelectionInfo;
|
@property (weak) IBOutlet NSTextField *noSelectionInfo;
|
||||||
@property (weak) IBOutlet MPPopupImageView *itemImageView;
|
@property (weak) IBOutlet MPPopupImageView *itemImageView;
|
||||||
@property (weak) IBOutlet NSTextField *itemNameTextField;
|
@property (weak) IBOutlet NSTextField *itemNameTextField;
|
||||||
|
@property (weak) IBOutlet NSButton *editButton;
|
||||||
|
|
||||||
- (IBAction)showImagePopup:(id)sender;
|
- (IBAction)showImagePopup:(id)sender;
|
||||||
|
|
||||||
/* Seperate call to ensure alle registered objects are in place */
|
/* Seperate call to ensure alle registered objects are in place */
|
||||||
- (void)setupNotifications:(NSWindowController *)windowController;
|
- (void)setupNotifications:(NSWindowController *)windowController;
|
||||||
|
- (void)prepareView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#import "NSDate+Humanized.h"
|
#import "NSDate+Humanized.h"
|
||||||
|
|
||||||
|
#import "KPKTree.h"
|
||||||
|
#import "KPKMetaData.h"
|
||||||
|
|
||||||
#import "HNHGradientView.h"
|
#import "HNHGradientView.h"
|
||||||
#import "MPPopupImageView.h"
|
#import "MPPopupImageView.h"
|
||||||
@@ -35,6 +37,8 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
@property (nonatomic, strong) NSDate *modificationDate;
|
@property (nonatomic, strong) NSDate *modificationDate;
|
||||||
@property (nonatomic, strong) NSDate *creationDate;
|
@property (nonatomic, strong) NSDate *creationDate;
|
||||||
|
|
||||||
|
@property (nonatomic, assign) BOOL showEditButton;
|
||||||
|
|
||||||
@property (nonatomic, assign) NSUInteger activeTab;
|
@property (nonatomic, assign) NSUInteger activeTab;
|
||||||
@property (weak) IBOutlet NSTabView *tabView;
|
@property (weak) IBOutlet NSTabView *tabView;
|
||||||
|
|
||||||
@@ -52,6 +56,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
_activeTab = MPEmptyTab;
|
_activeTab = MPEmptyTab;
|
||||||
_entryViewController = [[MPEntryInspectorViewController alloc] init];
|
_entryViewController = [[MPEntryInspectorViewController alloc] init];
|
||||||
_groupViewController = [[MPGroupInspectorViewController alloc] init];
|
_groupViewController = [[MPGroupInspectorViewController alloc] init];
|
||||||
|
_showEditButton = NO;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -60,6 +65,21 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark Properties
|
||||||
|
- (void)setActiveTab:(NSUInteger)activeTab {
|
||||||
|
if(_activeTab != activeTab) {
|
||||||
|
_activeTab = activeTab;
|
||||||
|
self.showEditButton = [[[self windowController] document] tree].metaData.isHistoryEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setShowEditButton:(BOOL)showEditButton {
|
||||||
|
showEditButton &= (self.activeTab == MPEntryTab);
|
||||||
|
if(_showEditButton != showEditButton) {
|
||||||
|
_showEditButton = showEditButton;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)didLoadView {
|
- (void)didLoadView {
|
||||||
[_bottomBar setBorderType:HNHBorderTop];
|
[_bottomBar setBorderType:HNHBorderTop];
|
||||||
[[self.noSelectionInfo cell] setBackgroundStyle:NSBackgroundStyleRaised];
|
[[self.noSelectionInfo cell] setBackgroundStyle:NSBackgroundStyleRaised];
|
||||||
@@ -94,7 +114,6 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
selector:@selector(_didChangeCurrentItem:)
|
selector:@selector(_didChangeCurrentItem:)
|
||||||
name:MPCurrentItemChangedNotification
|
name:MPCurrentItemChangedNotification
|
||||||
object:document];
|
object:document];
|
||||||
|
|
||||||
[_entryViewController setupBindings:document];
|
[_entryViewController setupBindings:document];
|
||||||
[_groupViewController setupBindings:document];
|
[_groupViewController setupBindings:document];
|
||||||
|
|
||||||
@@ -145,9 +164,14 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
_popover = nil;
|
_popover = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark Item Binding
|
#pragma mark Bindings
|
||||||
|
- (void)prepareView {
|
||||||
|
MPDocument *document = [[self windowController] document];
|
||||||
|
[self bind:@"showEditButton" toObject:document.tree.metaData withKeyPath:@"isHistoryEnabled" options:nil];
|
||||||
|
NSDictionary *bindingOptions = @{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName };
|
||||||
|
[self.editButton bind:NSHiddenBinding toObject:self withKeyPath:@"showEditButton" options:bindingOptions];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)_updateItemBindings:(id)item {
|
- (void)_updateItemBindings:(id)item {
|
||||||
if(!item) {
|
if(!item) {
|
||||||
@@ -177,6 +201,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
- (void)_didChangeCurrentItem:(NSNotification *)notification {
|
- (void)_didChangeCurrentItem:(NSNotification *)notification {
|
||||||
MPDocument *document = [notification object];
|
MPDocument *document = [notification object];
|
||||||
if(!document.selectedItem) {
|
if(!document.selectedItem) {
|
||||||
|
/* show emty tab and hide edit button */
|
||||||
self.activeTab = MPEmptyTab;
|
self.activeTab = MPEmptyTab;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -191,5 +216,4 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
|||||||
}
|
}
|
||||||
[self _updateItemBindings:document.selectedItem];
|
[self _updateItemBindings:document.selectedItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
Reference in New Issue
Block a user