Added simple settings

This commit is contained in:
michael starke
2012-07-23 00:54:44 +02:00
parent 957b91cceb
commit 588f0c75c0
12 changed files with 914 additions and 28 deletions

528
MacPass/GeneralSettings.xib Normal file
View File

@@ -0,0 +1,528 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSTextField</string>
<string>NSCustomObject</string>
<string>NSMenu</string>
<string>NSMenuItem</string>
<string>NSPopUpButton</string>
<string>NSCustomView</string>
<string>NSPopUpButtonCell</string>
<string>IBNSLayoutConstraint</string>
<string>NSTextFieldCell</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="NSCustomObject" id="1001">
<string key="NSClassName">MPGeneralSettingsController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomView" id="1005">
<reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSPopUpButton" id="421904700">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{146, 292}, {127, 26}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSAntiCompressionPriority">{750, 751}</string>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="161510884">
<int key="NSCellFlags">-2076049856</int>
<int key="NSCellFlags2">2048</int>
<object class="NSFont" key="NSSupport" id="874940307">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="421904700"/>
<int key="NSButtonFlags">109199615</int>
<int key="NSButtonFlags2">65</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
<object class="NSMenuItem" key="NSMenuItem" id="620916101">
<reference key="NSMenu" ref="988324640"/>
<string key="NSTitle">Item 1</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<int key="NSState">1</int>
<object class="NSCustomResource" key="NSOnImage" id="622518040">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage" id="746261602">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="161510884"/>
</object>
<bool key="NSMenuItemRespectAlignment">YES</bool>
<object class="NSMenu" key="NSMenu" id="988324640">
<string key="NSTitle">OtherViews</string>
<array class="NSMutableArray" key="NSMenuItems">
<reference ref="620916101"/>
<object class="NSMenuItem" id="286854037">
<reference key="NSMenu" ref="988324640"/>
<string key="NSTitle">Item 2</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="622518040"/>
<reference key="NSMixedImage" ref="746261602"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="161510884"/>
</object>
<object class="NSMenuItem" id="884033455">
<reference key="NSMenu" ref="988324640"/>
<string key="NSTitle">Item 3</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="622518040"/>
<reference key="NSMixedImage" ref="746261602"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="161510884"/>
</object>
</array>
<reference key="NSMenuFont" ref="874940307"/>
</object>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
<bool key="NSAltersState">YES</bool>
<int key="NSArrowPosition">2</int>
</object>
</object>
<object class="NSTextField" id="637214120">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 298}, {127, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="421904700"/>
<string key="NSReuseIdentifierKey">_NS:1505</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1050281039">
<int key="NSCellFlags">68288064</int>
<int key="NSCellFlags2">71304192</int>
<string key="NSContents">Password Encoding</string>
<reference key="NSSupport" ref="874940307"/>
<string key="NSCellIdentifier">_NS:1505</string>
<reference key="NSControlView" ref="637214120"/>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
</object>
</array>
<string key="NSFrameSize">{290, 336}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="637214120"/>
<string key="NSClassName">NSView</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1005"/>
</object>
<int key="connectionID">82</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">encodingPopup</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="421904700"/>
</object>
<int key="connectionID">83</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="1005"/>
<array class="NSMutableArray" key="children">
<reference ref="421904700"/>
<reference ref="637214120"/>
<object class="IBNSLayoutConstraint" id="180695068">
<reference key="firstItem" ref="637214120"/>
<int key="firstAttribute">5</int>
<int key="relation">1</int>
<reference key="secondItem" ref="1005"/>
<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>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">3</int>
<reference key="containingView" ref="1005"/>
</object>
<object class="IBNSLayoutConstraint" id="989429017">
<reference key="firstItem" ref="637214120"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="1005"/>
<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>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">3</int>
<reference key="containingView" ref="1005"/>
</object>
<object class="IBNSLayoutConstraint" id="704304955">
<reference key="firstItem" ref="421904700"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="637214120"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">8</double>
</object>
<float key="priority">1000</float>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">3</int>
<reference key="containingView" ref="1005"/>
</object>
<object class="IBNSLayoutConstraint" id="106372279">
<reference key="firstItem" ref="1005"/>
<int key="firstAttribute">6</int>
<int key="relation">1</int>
<reference key="secondItem" ref="421904700"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">3</int>
<reference key="containingView" ref="1005"/>
</object>
<object class="IBNSLayoutConstraint" id="850330857">
<reference key="firstItem" ref="421904700"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="1005"/>
<int key="secondAttribute">3</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<reference key="containingView" ref="1005"/>
</object>
<object class="IBNSLayoutConstraint" id="689515169">
<reference key="firstItem" ref="637214120"/>
<int key="firstAttribute">7</int>
<int key="relation">0</int>
<reference key="secondItem" ref="421904700"/>
<int key="secondAttribute">7</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<int key="scoringType">9</int>
<float key="scoringTypeFloat">40</float>
<int key="contentType">5</int>
<reference key="containingView" ref="1005"/>
</object>
<object class="IBNSLayoutConstraint" id="215335887">
<reference key="firstItem" ref="1005"/>
<int key="firstAttribute">6</int>
<int key="relation">0</int>
<reference key="secondItem" ref="421904700"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
<reference key="containingView" ref="1005"/>
</object>
<object class="IBNSLayoutConstraint" id="835508122">
<reference key="firstItem" ref="421904700"/>
<int key="firstAttribute">11</int>
<int key="relation">0</int>
<reference key="secondItem" ref="637214120"/>
<int key="secondAttribute">11</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">2</int>
<reference key="containingView" ref="1005"/>
</object>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="637214120"/>
<array class="NSMutableArray" key="children">
<reference ref="1050281039"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="1050281039"/>
<reference key="parent" ref="637214120"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="421904700"/>
<array class="NSMutableArray" key="children">
<reference ref="161510884"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="161510884"/>
<array class="NSMutableArray" key="children">
<reference ref="988324640"/>
</array>
<reference key="parent" ref="421904700"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="988324640"/>
<array class="NSMutableArray" key="children">
<reference ref="620916101"/>
<reference ref="286854037"/>
<reference ref="884033455"/>
</array>
<reference key="parent" ref="161510884"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">17</int>
<reference key="object" ref="620916101"/>
<reference key="parent" ref="988324640"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">18</int>
<reference key="object" ref="286854037"/>
<reference key="parent" ref="988324640"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">19</int>
<reference key="object" ref="884033455"/>
<reference key="parent" ref="988324640"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">59</int>
<reference key="object" ref="180695068"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">62</int>
<reference key="object" ref="989429017"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">66</int>
<reference key="object" ref="704304955"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">68</int>
<reference key="object" ref="106372279"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">124</int>
<reference key="object" ref="850330857"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">129</int>
<reference key="object" ref="689515169"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">130</int>
<reference key="object" ref="215335887"/>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">131</int>
<reference key="object" ref="835508122"/>
<reference key="parent" ref="1005"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<array class="NSMutableArray" key="1.IBNSViewMetadataConstraints">
<reference ref="180695068"/>
<reference ref="989429017"/>
<reference ref="704304955"/>
<reference ref="106372279"/>
<reference ref="850330857"/>
<reference ref="689515169"/>
<reference ref="215335887"/>
<reference ref="835508122"/>
</array>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="124.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="129.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="130.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="131.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="14.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="19.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="59.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="62.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="66.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="68.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="8.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">131</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">MPGeneralSettingsController</string>
<string key="superclassName">NSViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">encodingPopup</string>
<string key="NS.object.0">NSPopUpButton</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">encodingPopup</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">encodingPopup</string>
<string key="candidateClassName">NSPopUpButton</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPGeneralSettingsController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSLayoutConstraint</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NSLayoutConstraint.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NSMenuCheckmark">{11, 11}</string>
<string key="NSMenuMixedState">{10, 3}</string>
</dictionary>
<bool key="IBDocument.UseAutolayout">YES</bool>
</data>
</archive>

View File

@@ -11,16 +11,19 @@
#import "MPDatabaseDocument.h"
#import "MPOutlineDataSource.h"
#import "MPOutlineViewDelegate.h"
#import "MPSettingsController.h"
NSString *const kColumnIdentifier = @"OutlineColumn";
NSString *const kOutlineViewIdentifier = @"OutlineView";
@interface MPAppDelegate ()
@property (assign) IBOutlet NSOutlineView *outlineView;
@property (retain) MPSettingsController *settingsController;
@property (retain) MPOutlineDataSource *datasource;
@property (retain) MPOutlineViewDelegate *outlineDelegate;
@property (retain) MPDatabaseDocument *database;
- (void)updateData;
- (IBAction)showPreferences:(id)sender;
@end
@implementation MPAppDelegate
@@ -30,6 +33,7 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
@synthesize database = _database;
@synthesize outlineDelegate = _outlineDelegate;
@synthesize datasource = _datasource;
@synthesize settingsController = _settingsController;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
@@ -37,8 +41,7 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
_datasource = [[MPOutlineDataSource alloc] init];
[[_outlineView outlineTableColumn] setIdentifier:kColumnIdentifier];
[_outlineView setDelegate:_outlineDelegate];
[_outlineView setDataSource:_datasource];
[_outlineView setDataSource:_datasource];
// register for sucessfull document loads
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateData) name:MPDidLoadDataBaseNotification object:_database];
}
@@ -47,4 +50,13 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
[_outlineView reloadData];
}
#pragma mark IBActions
- (void)showPreferences:(id)sender {
if(_settingsController == nil) {
_settingsController = [[MPSettingsController alloc] init];
}
[_settingsController showWindow:_settingsController.window];
}
@end

View File

@@ -13,5 +13,6 @@ APPKIT_EXTERN NSString *const MPDidLoadDataBaseNotification;
@interface MPDatabaseDocument : NSObject
- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
- (void)openFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
@end

View File

@@ -20,37 +20,42 @@ NSString *const MPDidLoadDataBaseNotification = @"DidLoadDataBaseNotification";
@synthesize tree = _tree;
- (id)init {
return [self initWithFile:nil password:nil keyfile:nil];
// no appropriate init method
return nil;
}
- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key
{
self = [super init];
if (self) {
// test for supplied parameters
KdbPassword *kdbPassword = nil;
if( password != nil ) {
if( key != nil ) {
kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding keyfile:[key path]];
}
else {
kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding];
}
}
@try {
_tree = [KdbReaderFactory load:[file path] withPassword:kdbPassword];
}
@catch (NSException *exception) {
// ignore
}
if( _tree != nil) {
// Post notification that a new document was loaded
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter postNotificationName:MPDidLoadDataBaseNotification object:self];
}
[self openFile:file password:password keyfile:key];
}
return self;
}
- (void)openFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key {
// Try to load the file
KdbPassword *kdbPassword = nil;
if( password != nil ) {
if( key != nil ) {
kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding keyfile:[key path]];
}
else {
kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding];
}
}
@try {
_tree = [KdbReaderFactory load:[file path] withPassword:kdbPassword];
}
@catch (NSException *exception) {
// ignore
}
if( _tree != nil) {
// Post notification that a new document was loaded
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter postNotificationName:MPDidLoadDataBaseNotification object:self];
}
}
@end

View File

@@ -0,0 +1,14 @@
//
// MPGeneralSettingsController.h
// MacPass
//
// Created by Michael Starke on 23.07.12.
// Copyright (c) 2012 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MPSettingsTabProtocoll.h"
@interface MPGeneralSettingsController : NSViewController <MPSettingsTabProtocoll>
@end

View File

@@ -0,0 +1,59 @@
//
// MPGeneralSettingsController.m
// MacPass
//
// Created by Michael Starke on 23.07.12.
// Copyright (c) 2012 HicknHack Software GmbH. All rights reserved.
//
#import "MPGeneralSettingsController.h"
NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
@interface MPGeneralSettingsController ()
@property (assign) IBOutlet NSPopUpButton *encodingPopup;
- (void)didLoadView;
@end
@implementation MPGeneralSettingsController
@synthesize encodingPopup = _encodingPopup;
+ (NSString *)identifier {
return MPGeneralSetingsIdentifier;
}
- (id)init {
return [self initWithNibName:@"GeneralSettings" bundle:[NSBundle mainBundle]];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
return self;
}
- (void)loadView {
[super loadView];
[self didLoadView];
}
- (void)didLoadView {
// setup connections
NSMenu *encodingMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] init];
NSMenuItem *item;
item = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"UTF8 Encoding" action:NULL keyEquivalent:@""];
[item setRepresentedObject:[NSNumber numberWithInt:NSUTF8StringEncoding]];
[encodingMenu addItem:item];
[item release];
item = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"ASCII Encoding" action:NULL keyEquivalent:@""];
[item setRepresentedObject:[NSNumber numberWithInt:NSASCIIStringEncoding]];
[encodingMenu addItem:item];
[item release];
[_encodingPopup setMenu:encodingMenu];
[encodingMenu release];
}
@end

View File

@@ -0,0 +1,14 @@
//
// MPSettingsController.h
// MacPass
//
// Created by Michael Starke on 23.07.12.
// Copyright (c) 2012 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
APPKIT_EXTERN NSString const* kMPPasswordEnvodingSettingsKey;
@interface MPSettingsController : NSWindowController
@end

View File

@@ -0,0 +1,32 @@
//
// MPSettingsController.m
// MacPass
//
// Created by Michael Starke on 23.07.12.
// Copyright (c) 2012 HicknHack Software GmbH. All rights reserved.
//
#import "MPSettingsController.h"
#import "MPGeneralSettingsController.h"
NSString const* kMPPasswordEnvodingSettingsKey = @"PasswordEncoding";
@interface MPSettingsController ()
@property (retain) MPGeneralSettingsController *generalController;
@end
@implementation MPSettingsController
@synthesize generalController = _generalController;
-(id)init {
self = [super initWithWindowNibName:@"SettingsWindow"];
return self;
}
- (void)windowDidLoad {
_generalController = [[MPGeneralSettingsController alloc] init];
[_generalController loadView];
[[self window] setContentView:[_generalController view]];
}
@end

View File

@@ -0,0 +1,16 @@
//
// MPSettingsTabProtocoll.h
// MacPass
//
// Created by Michael Starke on 23.07.12.
// Copyright (c) 2012 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MPSettingsTabProtocoll <NSObject>
@required
+ (NSString *)identifier;
@end

141
MacPass/SettingsWindow.xib Normal file
View File

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSWindowTemplate</string>
<string>NSView</string>
<string>NSCustomObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="NSCustomObject" id="1001">
<string key="NSClassName">MPSettingsController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="1005">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{196, 240}, {473, 232}}</string>
<int key="NSWTFlags">544735232</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="1006">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{473, 232}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1050}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1005"/>
</object>
<int key="connectionID">3</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="1005"/>
<array class="NSMutableArray" key="children">
<reference ref="1006"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="1006"/>
<reference key="parent" ref="1005"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1.IBWindowTemplateEditedContentRect">{{357, 418}, {480, 270}}</string>
<integer value="1" key="1.NSWindowTemplate.visibleAtLaunch"/>
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">3</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">MPSettingsController</string>
<string key="superclassName">NSWindowController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MPSettingsController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<bool key="IBDocument.UseAutolayout">YES</bool>
</data>
</archive>

View File

@@ -1015,7 +1015,6 @@
<string key="NSFrame">{{145, 0}, {579, 501}}</string>
<reference key="NSSuperview" ref="221828200"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<string key="NSClassName">NSView</string>
</object>
@@ -1034,7 +1033,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="221828200"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSScreenRect">{{0, 0}, {1680, 1050}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
@@ -1463,6 +1462,14 @@
</object>
<int key="connectionID">1109</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">showPreferences:</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="609285721"/>
</object>
<int key="connectionID">1175</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">imageView</string>
@@ -2653,13 +2660,24 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">1174</int>
<int key="maxID">1175</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">MPAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">showPreferences:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">showPreferences:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">showPreferences:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="outlineView">NSOutlineView</string>
<string key="window">NSWindow</string>