added sketch files

This commit is contained in:
Michael Starke
2013-02-17 18:55:27 +01:00
parent c55adff775
commit f20e3d6e1e
20 changed files with 169 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -19,8 +19,8 @@ APPKIT_EXTERN NSString *const MPDataBaseDocumentDocumentKey;
@property (retain, readonly) KdbGroup *root;
@property (retain, readonly) NSURL *file;
@property (retain, readonly) KdbPassword *password;
+ (id)documentWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
+ (id)documentWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
/*
Saves the current database to the filesystem

View File

@@ -12,9 +12,11 @@
NSString *const MPDidLoadDataBaseNotification = @"DidLoadDataBaseNotification";
@interface MPDatabaseDocument ()
@property (retain) KdbTree *tree;
@property (retain) NSURL *file;
@property (retain) KdbPassword *password;
@end
@implementation MPDatabaseDocument
@@ -90,7 +92,7 @@ NSString *const MPDidLoadDataBaseNotification = @"DidLoadDataBaseNotification";
NSError *fileError;
if( self.password && [self.file checkResourceIsReachableAndReturnError:&fileError] ) {
@try {
[KdbWriterFactory persist:self.tree file:[self.file path] withPassword:self.password];
[KdbWriterFactory persist:self.tree file:[self.file path] withPassword:self.password];
}
@catch (NSException *exception) {
NSLog(@"%@", [exception description]);

28
MacPass/MPIconHelper.h Normal file
View File

@@ -0,0 +1,28 @@
//
// MPIconHelper.h
// MacPass
//
// Created by Michael Starke on 17.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum {
MPIconPassword,
MPIconPackageNetwork,
MPIconWarning,
MPIconServer,
MPIconKlipper,
MPIconLanguages
} MPIconType;
@interface MPIconHelper : NSObject
+ (NSImage *)icon:(MPIconType)type;
/*
Available Icons, Use the MPDatabaseIconType to access a individual icon;
*/
+ (NSDictionary *)availableIcons;
@end

31
MacPass/MPIconHelper.m Normal file
View File

@@ -0,0 +1,31 @@
//
// MPIconHelper.m
// MacPass
//
// Created by Michael Starke on 17.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPIconHelper.h"
@implementation MPIconHelper
# pragma mark Icon accessors
+ (NSImage *)icon:(MPIconType)type {
NSDictionary *icons = [MPIconHelper availableIcons];
NSString *imageName = icons[@(type)];
return [[NSBundle mainBundle] imageForResource:imageName];
}
+ (NSDictionary *)availableIcons {
NSDictionary *imageNames = @{ @(MPIconKlipper): @"04_KlipperTemplate",
@(MPIconLanguages): @"05_LanguagesTemplate",
@(MPIconPackageNetwork): @"01_PackageNetworkTemplate",
@(MPIconPassword): @"00_PasswordTemplate",
@(MPIconServer): @"03_ServerTemplate",
@(MPIconWarning): @"02_MessageBoxWarningTemplate" };
return imageNames;
}
@end

View File

@@ -7,6 +7,7 @@
//
#import "MPOutlineViewDelegate.h"
#import "MPIconHelper.h"
#import "KdbLib.h"
@implementation MPOutlineViewDelegate
@@ -20,7 +21,10 @@
}
else {
view = [outlineView makeViewWithIdentifier:@"DataCell" owner:self];
[view.imageView setImage:[NSImage imageNamed:NSImageNameFolder]];
NSDictionary *availableIcons = [MPIconHelper availableIcons];
NSInteger randomIndex = rand() % [availableIcons count];
NSImage *icon = [MPIconHelper icon:(MPIconType)randomIndex];
[view.imageView setImage:icon];
[view.textField setStringValue:[group name]];
}

View File

@@ -0,0 +1,15 @@
//
// MPViewController.h
// MacPass
//
// Created by Michael Starke on 17.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MPViewController : NSViewController
- (void)didLoadView;
@end

View File

@@ -0,0 +1,22 @@
//
// MPViewController.m
// MacPass
//
// Created by Michael Starke on 17.02.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPViewController.h"
@implementation MPViewController
- (void)loadView {
[super loadView];
[self didLoadView];
}
- (void)didLoadView {
// override
}
@end

View File

@@ -231,7 +231,7 @@
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<double key="NSRowHeight">20</double>
<double key="NSRowHeight">24</double>
<int key="NSTvFlags">-767524864</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
@@ -323,7 +323,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="777456971"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSAutorecalculatesContentBorderThicknessMinY">NO</bool>
<double key="NSContentBorderThicknessMinY">32</double>
@@ -1133,7 +1133,6 @@
<string key="419.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="420.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="421.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES" key="421.ibExternalAutomaticallyCalculatesRowSizeFromViewHeight"/>
<string key="422.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="423.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="424.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1212,6 +1211,7 @@
<string key="outlineView">NSOutlineView</string>
<string key="passwordTextField">NSTextField</string>
<string key="passwordView">NSView</string>
<string key="welcomeView">NSView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="contentView">
@@ -1234,6 +1234,10 @@
<string key="name">passwordView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="welcomeView">
<string key="name">welcomeView</string>
<string key="candidateClassName">NSView</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>