diff --git a/Assets/Database Icons.sketch/Data b/Assets/Database Icons.sketch/Data new file mode 100644 index 00000000..8f1aef27 Binary files /dev/null and b/Assets/Database Icons.sketch/Data differ diff --git a/Assets/Database Icons.sketch/QuickLook/Preview.png b/Assets/Database Icons.sketch/QuickLook/Preview.png new file mode 100644 index 00000000..e53dc711 Binary files /dev/null and b/Assets/Database Icons.sketch/QuickLook/Preview.png differ diff --git a/Assets/Database Icons.sketch/QuickLook/Thumbnail.png b/Assets/Database Icons.sketch/QuickLook/Thumbnail.png new file mode 100644 index 00000000..7736f7be Binary files /dev/null and b/Assets/Database Icons.sketch/QuickLook/Thumbnail.png differ diff --git a/Assets/Database Icons.sketch/fonts b/Assets/Database Icons.sketch/fonts new file mode 100644 index 00000000..e69de29b diff --git a/Assets/Database Icons.sketch/version b/Assets/Database Icons.sketch/version new file mode 100644 index 00000000..301160a9 --- /dev/null +++ b/Assets/Database Icons.sketch/version @@ -0,0 +1 @@ +8 \ No newline at end of file diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 4683dbcd..3ff13628 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -9,7 +9,15 @@ /* Begin PBXBuildFile section */ 4C25D58516CF0F8800F6806C /* WelcomeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25D58416CF0F8800F6806C /* WelcomeView.xib */; }; 4C25D58716CF0FAA00F6806C /* EntryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25D58616CF0FAA00F6806C /* EntryView.xib */; }; + 4C2E381D16D11FF900037A9D /* 03_ServerTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C2E381A16D11FF900037A9D /* 03_ServerTemplate.pdf */; }; + 4C2E381E16D11FF900037A9D /* 04_KlipperTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C2E381B16D11FF900037A9D /* 04_KlipperTemplate.pdf */; }; + 4C2E381F16D11FF900037A9D /* 05_LanguagesTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C2E381C16D11FF900037A9D /* 05_LanguagesTemplate.pdf */; }; + 4C2E382316D1421B00037A9D /* MPIconHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C2E382216D1421B00037A9D /* MPIconHelper.m */; }; + 4C2E382616D1470200037A9D /* MPViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C2E382516D1470200037A9D /* MPViewController.m */; }; 4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */; }; + 4C586F9E16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C586F9D16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf */; }; + 4C586FA016D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C586F9F16D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf */; }; + 4C586FA216D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C586FA116D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf */; }; 4C669B7F16760ED100DD0774 /* AesInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B3116760ED100DD0774 /* AesInputStream.m */; }; 4C669B8016760ED100DD0774 /* AesOutputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B3316760ED100DD0774 /* AesOutputStream.m */; }; 4C669B8116760ED100DD0774 /* Arc4RandomStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B3516760ED100DD0774 /* Arc4RandomStream.m */; }; @@ -74,8 +82,18 @@ /* Begin PBXFileReference section */ 4C25D58416CF0F8800F6806C /* WelcomeView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WelcomeView.xib; sourceTree = ""; }; 4C25D58616CF0FAA00F6806C /* EntryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EntryView.xib; sourceTree = ""; }; + 4C2E381A16D11FF900037A9D /* 03_ServerTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 03_ServerTemplate.pdf; sourceTree = ""; }; + 4C2E381B16D11FF900037A9D /* 04_KlipperTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 04_KlipperTemplate.pdf; sourceTree = ""; }; + 4C2E381C16D11FF900037A9D /* 05_LanguagesTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 05_LanguagesTemplate.pdf; sourceTree = ""; }; + 4C2E382116D1421B00037A9D /* MPIconHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPIconHelper.h; sourceTree = ""; }; + 4C2E382216D1421B00037A9D /* MPIconHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPIconHelper.m; sourceTree = ""; }; + 4C2E382416D1470200037A9D /* MPViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPViewController.h; sourceTree = ""; }; + 4C2E382516D1470200037A9D /* MPViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPViewController.m; sourceTree = ""; }; 4C37A83E15B8B474005EF8EE /* MPOutlineDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOutlineDataSource.h; sourceTree = ""; }; 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOutlineDataSource.m; sourceTree = ""; }; + 4C586F9D16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 00_PasswordTemplate.pdf; sourceTree = ""; }; + 4C586F9F16D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 01_PackageNetworkTemplate.pdf; sourceTree = ""; }; + 4C586FA116D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 02_MessageBoxWarningTemplate.pdf; sourceTree = ""; }; 4C669B3016760ED100DD0774 /* AesInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AesInputStream.h; sourceTree = ""; }; 4C669B3116760ED100DD0774 /* AesInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AesInputStream.m; sourceTree = ""; }; 4C669B3216760ED100DD0774 /* AesOutputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AesOutputStream.h; sourceTree = ""; }; @@ -225,6 +243,15 @@ name = Views; sourceTree = ""; }; + 4C2E382016D141F700037A9D /* Helper */ = { + isa = PBXGroup; + children = ( + 4C2E382116D1421B00037A9D /* MPIconHelper.h */, + 4C2E382216D1421B00037A9D /* MPIconHelper.m */, + ); + name = Helper; + sourceTree = ""; + }; 4C37A84115B8B47D005EF8EE /* Delegates */ = { isa = PBXGroup; children = ( @@ -249,6 +276,19 @@ name = Model; sourceTree = ""; }; + 4C586F9C16D07ABD00E7DB57 /* Icons */ = { + isa = PBXGroup; + children = ( + 4C586F9D16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf */, + 4C586F9F16D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf */, + 4C586FA116D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf */, + 4C2E381A16D11FF900037A9D /* 03_ServerTemplate.pdf */, + 4C2E381B16D11FF900037A9D /* 04_KlipperTemplate.pdf */, + 4C2E381C16D11FF900037A9D /* 05_LanguagesTemplate.pdf */, + ); + path = Icons; + sourceTree = ""; + }; 4C669B2D16760ED100DD0774 /* MiniKeePassLib */ = { isa = PBXGroup; children = ( @@ -388,6 +428,8 @@ 4C77E36C15B84A240093A587 /* MacPass */ = { isa = PBXGroup; children = ( + 4C2E382016D141F700037A9D /* Helper */, + 4C586F9C16D07ABD00E7DB57 /* Icons */, 4CA0B30F15BCB85D00654E32 /* General */, 4CA0B30E15BCB70200654E32 /* Protocolls */, 4CA0B2F115BCAEE600654E32 /* Controller */, @@ -422,6 +464,8 @@ 4C83814115BF4677001AE468 /* MPMainWindowController.m */, 4C75CE3A16CB128700F61A4D /* MPDatabaseController.h */, 4C75CE3B16CB128700F61A4D /* MPDatabaseController.m */, + 4C2E382416D1470200037A9D /* MPViewController.h */, + 4C2E382516D1470200037A9D /* MPViewController.m */, ); name = Controller; sourceTree = ""; @@ -555,6 +599,12 @@ 4C6B0E8C16C9B99B00A9ED23 /* PasswordView.xib in Resources */, 4C25D58516CF0F8800F6806C /* WelcomeView.xib in Resources */, 4C25D58716CF0FAA00F6806C /* EntryView.xib in Resources */, + 4C586F9E16D07ABD00E7DB57 /* 00_PasswordTemplate.pdf in Resources */, + 4C586FA016D07D7200E7DB57 /* 01_PackageNetworkTemplate.pdf in Resources */, + 4C586FA216D07F6A00E7DB57 /* 02_MessageBoxWarningTemplate.pdf in Resources */, + 4C2E381D16D11FF900037A9D /* 03_ServerTemplate.pdf in Resources */, + 4C2E381E16D11FF900037A9D /* 04_KlipperTemplate.pdf in Resources */, + 4C2E381F16D11FF900037A9D /* 05_LanguagesTemplate.pdf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -615,6 +665,8 @@ 4C669BA216760ED100DD0774 /* UUID.m in Sources */, 4C90D9B416CA4B18003081E7 /* MPMainWindowDelegate.m in Sources */, 4C75CE3C16CB128700F61A4D /* MPDatabaseController.m in Sources */, + 4C2E382316D1421B00037A9D /* MPIconHelper.m in Sources */, + 4C2E382616D1470200037A9D /* MPViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -673,7 +725,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "/usr/include/libxml2/**"; + HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2/**"; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "-lxml2"; @@ -700,7 +752,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "/usr/include/libxml2/**"; + HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2/**"; MACOSX_DEPLOYMENT_TARGET = 10.7; OTHER_LDFLAGS = "-lxml2"; SDKROOT = macosx; @@ -714,6 +766,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MacPass/MacPass-Prefix.pch"; INFOPLIST_FILE = "MacPass/MacPass-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -726,6 +779,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MacPass/MacPass-Prefix.pch"; INFOPLIST_FILE = "MacPass/MacPass-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/MacPass/Icons/00_PasswordTemplate.pdf b/MacPass/Icons/00_PasswordTemplate.pdf new file mode 100644 index 00000000..51763f87 Binary files /dev/null and b/MacPass/Icons/00_PasswordTemplate.pdf differ diff --git a/MacPass/Icons/01_PackageNetworkTemplate.pdf b/MacPass/Icons/01_PackageNetworkTemplate.pdf new file mode 100644 index 00000000..87c587b6 Binary files /dev/null and b/MacPass/Icons/01_PackageNetworkTemplate.pdf differ diff --git a/MacPass/Icons/02_MessageBoxWarningTemplate.pdf b/MacPass/Icons/02_MessageBoxWarningTemplate.pdf new file mode 100644 index 00000000..36bcad8c Binary files /dev/null and b/MacPass/Icons/02_MessageBoxWarningTemplate.pdf differ diff --git a/MacPass/Icons/03_ServerTemplate.pdf b/MacPass/Icons/03_ServerTemplate.pdf new file mode 100644 index 00000000..c5f536ea Binary files /dev/null and b/MacPass/Icons/03_ServerTemplate.pdf differ diff --git a/MacPass/Icons/04_KlipperTemplate.pdf b/MacPass/Icons/04_KlipperTemplate.pdf new file mode 100644 index 00000000..f24161e0 Binary files /dev/null and b/MacPass/Icons/04_KlipperTemplate.pdf differ diff --git a/MacPass/Icons/05_LanguagesTemplate.pdf b/MacPass/Icons/05_LanguagesTemplate.pdf new file mode 100644 index 00000000..7b30dbe9 Binary files /dev/null and b/MacPass/Icons/05_LanguagesTemplate.pdf differ diff --git a/MacPass/MPDatabaseDocument.h b/MacPass/MPDatabaseDocument.h index 46ddd689..a6b6272b 100644 --- a/MacPass/MPDatabaseDocument.h +++ b/MacPass/MPDatabaseDocument.h @@ -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 diff --git a/MacPass/MPDatabaseDocument.m b/MacPass/MPDatabaseDocument.m index 433b6b3b..400da26e 100644 --- a/MacPass/MPDatabaseDocument.m +++ b/MacPass/MPDatabaseDocument.m @@ -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]); diff --git a/MacPass/MPIconHelper.h b/MacPass/MPIconHelper.h new file mode 100644 index 00000000..f90d5b69 --- /dev/null +++ b/MacPass/MPIconHelper.h @@ -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 + +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 diff --git a/MacPass/MPIconHelper.m b/MacPass/MPIconHelper.m new file mode 100644 index 00000000..0aeb7eec --- /dev/null +++ b/MacPass/MPIconHelper.m @@ -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 diff --git a/MacPass/MPOutlineViewDelegate.m b/MacPass/MPOutlineViewDelegate.m index 255cd0d7..c77d1641 100644 --- a/MacPass/MPOutlineViewDelegate.m +++ b/MacPass/MPOutlineViewDelegate.m @@ -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]]; } diff --git a/MacPass/MPViewController.h b/MacPass/MPViewController.h new file mode 100644 index 00000000..ae87f663 --- /dev/null +++ b/MacPass/MPViewController.h @@ -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 + +@interface MPViewController : NSViewController + +- (void)didLoadView; + +@end diff --git a/MacPass/MPViewController.m b/MacPass/MPViewController.m new file mode 100644 index 00000000..e4dfdb66 --- /dev/null +++ b/MacPass/MPViewController.m @@ -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 diff --git a/MacPass/MainWindow.xib b/MacPass/MainWindow.xib index c56b35de..a4ee4354 100644 --- a/MacPass/MainWindow.xib +++ b/MacPass/MainWindow.xib @@ -231,7 +231,7 @@ MC41AA - 20 + 24 -767524864 @@ -323,7 +323,7 @@ - {{0, 0}, {1680, 1028}} + {{0, 0}, {1920, 1058}} {10000000000000, 10000000000000} NO 32 @@ -1133,7 +1133,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1212,6 +1211,7 @@ NSOutlineView NSTextField NSView + NSView @@ -1234,6 +1234,10 @@ passwordView NSView + + welcomeView + NSView + IBProjectSource