From acc800c9e636f36480e1ec5d8e092e05322f3f45 Mon Sep 17 00:00:00 2001 From: michael starke Date: Sun, 21 Jul 2013 23:23:45 +0200 Subject: [PATCH] Fixed #59 Password length input is nu read only. Not a nice solution but for now working Attachments for Kdb and Kdbx Databases are now supported. Save, Add, Delete --- KeePassKit | 2 +- MacPass.xcodeproj/project.pbxproj | 92 +++++++++++-------- MacPass/MPDatabaseSettingsWindowController.m | 29 +++++- MacPass/MPDocument+Attachments.m | 48 +++++----- MacPass/MPDocument.h | 9 +- MacPass/MPDocument.m | 32 ++++--- MacPass/MPDocumentWindowController.m | 32 +++++-- MacPass/MPInspectorViewController.m | 18 +++- MacPass/MacPass-Info.plist | 4 +- MacPass/PasswordCreatorView.xib | 25 ++--- MacPass/en.lproj/Localizable.strings | Bin 10024 -> 11244 bytes 11 files changed, 181 insertions(+), 110 deletions(-) diff --git a/KeePassKit b/KeePassKit index 2ae0ec06..4e8693c8 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit 2ae0ec067cf75e64fed71f2b2f11427989814927 +Subproject commit 4e8693c89c269534ee578a012ff08dfa571d1d50 diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 08a81a92..93c542e1 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -18,10 +18,13 @@ 4C1842B2179B28C400E2F5BC /* KPKBinaryTreeReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842B1179B28C400E2F5BC /* KPKBinaryTreeReader.m */; }; 4C1842B5179B28D400E2F5BC /* KPKBinaryTreeWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842B4179B28D400E2F5BC /* KPKBinaryTreeWriter.m */; }; 4C1842B8179B348600E2F5BC /* KPKTreeLoadingTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842B7179B348600E2F5BC /* KPKTreeLoadingTest.m */; }; - 4C1842BC179B434C00E2F5BC /* KPKXmlCipherInformation.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842BB179B434C00E2F5BC /* KPKXmlCipherInformation.m */; }; + 4C1842BC179B434C00E2F5BC /* KPKXmlHeaderReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842BB179B434C00E2F5BC /* KPKXmlHeaderReader.m */; }; 4C1842C0179B5BFD00E2F5BC /* NSData+CommonCrypto.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842BF179B5BFD00E2F5BC /* NSData+CommonCrypto.m */; }; 4C1842C3179B69E700E2F5BC /* NSData+HashedData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842C2179B69E700E2F5BC /* NSData+HashedData.m */; }; - 4C1842C6179BF52100E2F5BC /* KPKBinaryCipherInformation.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842C5179BF52000E2F5BC /* KPKBinaryCipherInformation.m */; }; + 4C1842C6179BF52100E2F5BC /* KPKLegacyHeaderReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842C5179BF52000E2F5BC /* KPKLegacyHeaderReader.m */; }; + 4C1842CA179C616700E2F5BC /* KPKTreeCryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842C9179C616700E2F5BC /* KPKTreeCryptor.m */; }; + 4C1842D0179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842CF179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m */; }; + 4C1842D3179C64F000E2F5BC /* KPKXmlTreeCryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842D2179C64EF00E2F5BC /* KPKXmlTreeCryptor.m */; }; 4C18F9AB178E122500890BCE /* Test_Password_1234.kdb in Resources */ = {isa = PBXBuildFile; fileRef = 4C18F9AA178E122500890BCE /* Test_Password_1234.kdb */; }; 4C19E500178E26EF002F2CD0 /* Test_Password_1234.kdbx in Resources */ = {isa = PBXBuildFile; fileRef = 4C19E4FF178E26EF002F2CD0 /* Test_Password_1234.kdbx */; }; 4C19E503178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C19E502178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m */; }; @@ -79,7 +82,6 @@ 4C3D4C0817594CA40038DAAC /* HNHSeparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3D4C0717594CA40038DAAC /* HNHSeparator.m */; }; 4C3E1CC0177DEFB3003BD9BD /* StringField+Undo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3E1CBF177DEFB3003BD9BD /* StringField+Undo.m */; }; 4C3F28541791EDFD00703281 /* KPKErrors.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3F28531791EDFD00703281 /* KPKErrors.m */; }; - 4C3F28581791F04F00703281 /* LocalizableErrors.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C3F28571791F04F00703281 /* LocalizableErrors.strings */; }; 4C3FFD9E16DAF60600DF9186 /* FilterBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */; }; 4C431BCD16E2A82800700A81 /* MPPasteBoardController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */; }; 4C431BCF16E2BAB000700A81 /* OverlayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C431BCE16E2BAB000700A81 /* OverlayWindow.xib */; }; @@ -159,7 +161,6 @@ 4C6D1D27178586CA0014C5A5 /* 99_AddFolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */; }; 4C6D1D2B17858A250014C5A5 /* MacPass.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D2A17858A250014C5A5 /* MacPass.icns */; }; 4C701CBC178618A000581B88 /* 12_RemoteTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */; }; - 4C70D0FD1790924700652EE9 /* KPKTreeLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C70D0FC1790924700652EE9 /* KPKTreeLoader.m */; }; 4C70D100179092F200652EE9 /* KPKPassword.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C70D0FF179092F200652EE9 /* KPKPassword.m */; }; 4C74DD07177BD1640034A9DB /* MPCustomFieldView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C74DD06177BD1640034A9DB /* MPCustomFieldView.m */; }; 4C76155C1764C04C0015A1A6 /* GeneralSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C76155E1764C04C0015A1A6 /* GeneralSettings.xib */; }; @@ -271,16 +272,24 @@ 4C1842B4179B28D400E2F5BC /* KPKBinaryTreeWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKBinaryTreeWriter.m; sourceTree = ""; }; 4C1842B6179B348600E2F5BC /* KPKTreeLoadingTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTreeLoadingTest.h; sourceTree = ""; }; 4C1842B7179B348600E2F5BC /* KPKTreeLoadingTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTreeLoadingTest.m; sourceTree = ""; }; - 4C1842B9179B3A1700E2F5BC /* KPKHeaderFields.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKHeaderFields.h; sourceTree = ""; }; - 4C1842BA179B434C00E2F5BC /* KPKXmlCipherInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKXmlCipherInformation.h; sourceTree = ""; }; - 4C1842BB179B434C00E2F5BC /* KPKXmlCipherInformation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKXmlCipherInformation.m; sourceTree = ""; }; + 4C1842B9179B3A1700E2F5BC /* KPKHeaderFields.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KPKHeaderFields.h; path = Format/KPKHeaderFields.h; sourceTree = ""; }; + 4C1842BA179B434C00E2F5BC /* KPKXmlHeaderReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKXmlHeaderReader.h; sourceTree = ""; }; + 4C1842BB179B434C00E2F5BC /* KPKXmlHeaderReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKXmlHeaderReader.m; sourceTree = ""; }; 4C1842BE179B5BFD00E2F5BC /* NSData+CommonCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+CommonCrypto.h"; sourceTree = ""; }; 4C1842BF179B5BFD00E2F5BC /* NSData+CommonCrypto.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+CommonCrypto.m"; sourceTree = ""; }; 4C1842C1179B69E600E2F5BC /* NSData+HashedData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+HashedData.h"; sourceTree = ""; }; 4C1842C2179B69E700E2F5BC /* NSData+HashedData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+HashedData.m"; sourceTree = ""; }; - 4C1842C4179BF51F00E2F5BC /* KPKBinaryCipherInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKBinaryCipherInformation.h; sourceTree = ""; }; - 4C1842C5179BF52000E2F5BC /* KPKBinaryCipherInformation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKBinaryCipherInformation.m; sourceTree = ""; }; - 4C1842C7179BF6A100E2F5BC /* KPKKdbHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKKdbHeader.h; sourceTree = ""; }; + 4C1842C4179BF51F00E2F5BC /* KPKLegacyHeaderReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKLegacyHeaderReader.h; sourceTree = ""; }; + 4C1842C5179BF52000E2F5BC /* KPKLegacyHeaderReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKLegacyHeaderReader.m; sourceTree = ""; }; + 4C1842C7179BF6A100E2F5BC /* KPKLegacyHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KPKLegacyHeader.h; path = Format/KPKLegacyHeader.h; sourceTree = ""; }; + 4C1842C8179C616600E2F5BC /* KPKTreeCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTreeCryptor.h; sourceTree = ""; }; + 4C1842C9179C616700E2F5BC /* KPKTreeCryptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTreeCryptor.m; sourceTree = ""; }; + 4C1842CE179C64DC00E2F5BC /* KPKLegacyTreeCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKLegacyTreeCryptor.h; sourceTree = ""; }; + 4C1842CF179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKLegacyTreeCryptor.m; sourceTree = ""; }; + 4C1842D1179C64EF00E2F5BC /* KPKXmlTreeCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKXmlTreeCryptor.h; sourceTree = ""; }; + 4C1842D2179C64EF00E2F5BC /* KPKXmlTreeCryptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKXmlTreeCryptor.m; sourceTree = ""; }; + 4C1842D4179C6DE400E2F5BC /* KPKHeaderReading.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKHeaderReading.h; sourceTree = ""; }; + 4C1842D5179C6F1800E2F5BC /* KPKHeaderWriting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKHeaderWriting.h; sourceTree = ""; }; 4C18F9AA178E122500890BCE /* Test_Password_1234.kdb */ = {isa = PBXFileReference; lastKnownFileType = file; name = Test_Password_1234.kdb; path = Databases/Test_Password_1234.kdb; sourceTree = ""; }; 4C19E4FF178E26EF002F2CD0 /* Test_Password_1234.kdbx */ = {isa = PBXFileReference; lastKnownFileType = file; name = Test_Password_1234.kdbx; path = Databases/Test_Password_1234.kdbx; sourceTree = ""; }; 4C19E501178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDatabasePasswordAndKeyfile.h; sourceTree = ""; }; @@ -386,13 +395,12 @@ 4C3E1CBF177DEFB3003BD9BD /* StringField+Undo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "StringField+Undo.m"; sourceTree = ""; }; 4C3F28521791EDE800703281 /* KPKErrors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKErrors.h; sourceTree = ""; }; 4C3F28531791EDFD00703281 /* KPKErrors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKErrors.m; sourceTree = ""; }; - 4C3F28571791F04F00703281 /* LocalizableErrors.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = LocalizableErrors.strings; path = Resources/LocalizableErrors.strings; sourceTree = ""; }; 4C3FFD9D16DAF60600DF9186 /* FilterBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FilterBar.xib; sourceTree = ""; }; 4C431BCB16E2A82700700A81 /* MPPasteBoardController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasteBoardController.h; sourceTree = ""; }; 4C431BCC16E2A82700700A81 /* MPPasteBoardController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasteBoardController.m; sourceTree = ""; }; 4C431BCE16E2BAB000700A81 /* OverlayWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OverlayWindow.xib; sourceTree = ""; }; - 4C4436751792BE810099E220 /* KPKFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKFormat.h; sourceTree = ""; }; - 4C4436761792BE810099E220 /* KPKFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKFormat.m; sourceTree = ""; }; + 4C4436751792BE810099E220 /* KPKFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KPKFormat.h; path = Format/KPKFormat.h; sourceTree = ""; }; + 4C4436761792BE810099E220 /* KPKFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KPKFormat.m; path = Format/KPKFormat.m; sourceTree = ""; }; 4C4510071798C53700219998 /* StringField+Validation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "StringField+Validation.h"; sourceTree = ""; }; 4C4510081798C53700219998 /* StringField+Validation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "StringField+Validation.m"; sourceTree = ""; }; 4C45100A1798C65C00219998 /* Kdb4Entry+MPAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Kdb4Entry+MPAdditions.h"; sourceTree = ""; }; @@ -534,8 +542,6 @@ 4C6D1D26178586CA0014C5A5 /* 99_AddFolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 99_AddFolderTemplate.pdf; sourceTree = ""; }; 4C6D1D2A17858A250014C5A5 /* MacPass.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = MacPass.icns; path = "../Assets/App icon/MacPass.icns"; sourceTree = ""; }; 4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 12_RemoteTemplate.pdf; sourceTree = ""; }; - 4C70D0FB1790924700652EE9 /* KPKTreeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTreeLoader.h; sourceTree = ""; }; - 4C70D0FC1790924700652EE9 /* KPKTreeLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTreeLoader.m; sourceTree = ""; }; 4C70D0FE179092F200652EE9 /* KPKPassword.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKPassword.h; sourceTree = ""; }; 4C70D0FF179092F200652EE9 /* KPKPassword.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKPassword.m; sourceTree = ""; }; 4C74DD05177BD1640034A9DB /* MPCustomFieldView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPCustomFieldView.h; sourceTree = ""; }; @@ -644,7 +650,7 @@ 4CC7EA1A17807E7E0089D4F3 /* HNHRoundendTextFieldCellHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHRoundendTextFieldCellHelper.m; sourceTree = ""; }; 4CCA7EEC1797866F00B0B55E /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/GeneralSettings.strings; sourceTree = ""; }; 4CCA7EEE1797867200B0B55E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/GeneralSettings.strings; sourceTree = ""; }; - 4CD3ABB2178F71B50073F5C5 /* KPKVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKVersion.h; sourceTree = ""; }; + 4CD3ABB2178F71B50073F5C5 /* KPKVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KPKVersion.h; path = Format/KPKVersion.h; sourceTree = ""; }; 4CD3ABB3178F71B50073F5C5 /* KPKTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTree.h; sourceTree = ""; }; 4CD3ABB4178F71B50073F5C5 /* KPKTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTree.m; sourceTree = ""; }; 4CD3ABBD178F72610073F5C5 /* KPKEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKEntry.h; sourceTree = ""; }; @@ -779,6 +785,18 @@ name = ValueTransformer; sourceTree = ""; }; + 4C1842D6179C716100E2F5BC /* Format */ = { + isa = PBXGroup; + children = ( + 4C4436751792BE810099E220 /* KPKFormat.h */, + 4C4436761792BE810099E220 /* KPKFormat.m */, + 4CD3ABB2178F71B50073F5C5 /* KPKVersion.h */, + 4C1842C7179BF6A100E2F5BC /* KPKLegacyHeader.h */, + 4C1842B9179B3A1700E2F5BC /* KPKHeaderFields.h */, + ); + name = Format; + sourceTree = ""; + }; 4C18F9AC178E123200890BCE /* Databases */ = { isa = PBXGroup; children = ( @@ -1060,14 +1078,6 @@ name = Model; sourceTree = ""; }; - 4C3F28591791F05400703281 /* Resources */ = { - isa = PBXGroup; - children = ( - 4C3F28571791F04F00703281 /* LocalizableErrors.strings */, - ); - name = Resources; - sourceTree = ""; - }; 4C45FB1E178E09ED0010007D /* MacPassTests */ = { isa = PBXGroup; children = ( @@ -1434,7 +1444,7 @@ 4CD3ABAD178F71B50073F5C5 /* KeePassKit */ = { isa = PBXGroup; children = ( - 4C3F28591791F05400703281 /* Resources */, + 4C1842D6179C716100E2F5BC /* Format */, 4CD3ABAF178F71B50073F5C5 /* Categories */, 4CD3ABB1178F71B50073F5C5 /* Core */, 4CD3ABB5178F71B50073F5C5 /* IO */, @@ -1464,9 +1474,6 @@ children = ( 4C70D0FE179092F200652EE9 /* KPKPassword.h */, 4C70D0FF179092F200652EE9 /* KPKPassword.m */, - 4C4436751792BE810099E220 /* KPKFormat.h */, - 4C4436761792BE810099E220 /* KPKFormat.m */, - 4CD3ABB2178F71B50073F5C5 /* KPKVersion.h */, 4CD3ABB3178F71B50073F5C5 /* KPKTree.h */, 4CD3ABB4178F71B50073F5C5 /* KPKTree.m */, 4CD3ABBD178F72610073F5C5 /* KPKEntry.h */, @@ -1485,7 +1492,6 @@ 4C305F35179A0BD70082334F /* KPKIcon.m */, 4C1842A9179B027700E2F5BC /* KPKDeletedNode.h */, 4C1842AA179B027800E2F5BC /* KPKDeletedNode.m */, - 4C1842C7179BF6A100E2F5BC /* KPKKdbHeader.h */, ); path = Core; sourceTree = ""; @@ -1493,8 +1499,6 @@ 4CD3ABB5178F71B50073F5C5 /* IO */ = { isa = PBXGroup; children = ( - 4C70D0FB1790924700652EE9 /* KPKTreeLoader.h */, - 4C70D0FC1790924700652EE9 /* KPKTreeLoader.m */, 4CDB5C401794AA4F0017667E /* KPKTree+Serializing.h */, 4CDB5C411794AA4F0017667E /* KPKTree+Serializing.m */, 4C5AA58F179549A1008ECAD7 /* KPKXmlTreeWriter.h */, @@ -1505,11 +1509,18 @@ 4C1842B1179B28C400E2F5BC /* KPKBinaryTreeReader.m */, 4C1842B3179B28D400E2F5BC /* KPKBinaryTreeWriter.h */, 4C1842B4179B28D400E2F5BC /* KPKBinaryTreeWriter.m */, - 4C1842B9179B3A1700E2F5BC /* KPKHeaderFields.h */, - 4C1842BA179B434C00E2F5BC /* KPKXmlCipherInformation.h */, - 4C1842BB179B434C00E2F5BC /* KPKXmlCipherInformation.m */, - 4C1842C4179BF51F00E2F5BC /* KPKBinaryCipherInformation.h */, - 4C1842C5179BF52000E2F5BC /* KPKBinaryCipherInformation.m */, + 4C1842BA179B434C00E2F5BC /* KPKXmlHeaderReader.h */, + 4C1842BB179B434C00E2F5BC /* KPKXmlHeaderReader.m */, + 4C1842C4179BF51F00E2F5BC /* KPKLegacyHeaderReader.h */, + 4C1842C5179BF52000E2F5BC /* KPKLegacyHeaderReader.m */, + 4C1842C8179C616600E2F5BC /* KPKTreeCryptor.h */, + 4C1842C9179C616700E2F5BC /* KPKTreeCryptor.m */, + 4C1842CE179C64DC00E2F5BC /* KPKLegacyTreeCryptor.h */, + 4C1842CF179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m */, + 4C1842D1179C64EF00E2F5BC /* KPKXmlTreeCryptor.h */, + 4C1842D2179C64EF00E2F5BC /* KPKXmlTreeCryptor.m */, + 4C1842D4179C6DE400E2F5BC /* KPKHeaderReading.h */, + 4C1842D5179C6F1800E2F5BC /* KPKHeaderWriting.h */, ); path = IO; sourceTree = ""; @@ -1707,7 +1718,6 @@ 4C52A88F1788628B00868229 /* 13_KeysTemplate.pdf in Resources */, 4C52A8901788628B00868229 /* 18_DisplayTemplate.pdf in Resources */, 4C52A892178863B000868229 /* 68_PhoneTemplate.pdf in Resources */, - 4C3F28581791F04F00703281 /* LocalizableErrors.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1898,7 +1908,6 @@ 4CD3ABC2178F72720073F5C5 /* KPKGroup.m in Sources */, 4C591B57178F897A0080B16B /* KPKAttachment.m in Sources */, 4C39B3F5178FEFAE0027DC7C /* KPKNode.m in Sources */, - 4C70D0FD1790924700652EE9 /* KPKTreeLoader.m in Sources */, 4C70D100179092F200652EE9 /* KPKPassword.m in Sources */, 4C8A173D1790AA41008B5C17 /* NSData+Keyfile.m in Sources */, 4C3F28541791EDFD00703281 /* KPKErrors.m in Sources */, @@ -1922,10 +1931,13 @@ 4C1842AF179B211C00E2F5BC /* KPKXmlTreeReader.m in Sources */, 4C1842B2179B28C400E2F5BC /* KPKBinaryTreeReader.m in Sources */, 4C1842B5179B28D400E2F5BC /* KPKBinaryTreeWriter.m in Sources */, - 4C1842BC179B434C00E2F5BC /* KPKXmlCipherInformation.m in Sources */, + 4C1842BC179B434C00E2F5BC /* KPKXmlHeaderReader.m in Sources */, 4C1842C0179B5BFD00E2F5BC /* NSData+CommonCrypto.m in Sources */, 4C1842C3179B69E700E2F5BC /* NSData+HashedData.m in Sources */, - 4C1842C6179BF52100E2F5BC /* KPKBinaryCipherInformation.m in Sources */, + 4C1842C6179BF52100E2F5BC /* KPKLegacyHeaderReader.m in Sources */, + 4C1842CA179C616700E2F5BC /* KPKTreeCryptor.m in Sources */, + 4C1842D0179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m in Sources */, + 4C1842D3179C64F000E2F5BC /* KPKXmlTreeCryptor.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MacPass/MPDatabaseSettingsWindowController.m b/MacPass/MPDatabaseSettingsWindowController.m index a373978e..25ef4c9a 100644 --- a/MacPass/MPDatabaseSettingsWindowController.m +++ b/MacPass/MPDatabaseSettingsWindowController.m @@ -57,8 +57,7 @@ NSAssert(_document != nil, @"Document needs to be present"); [self.saveButton bind:NSEnabledBinding toObject:self withKeyPath:@"hasValidPasswordOrKey" options:nil]; - [self.cancelButton bind:NSEnabledBinding toObject:self withKeyPath:@"hasValidPasswordOrKey" options:nil]; - + [self.sectionTabView setDelegate:self]; @@ -296,6 +295,32 @@ } +- (void)_updateFirstResponder { + NSTabViewItem *selected = [self.sectionTabView selectedTabViewItem]; + MPDatabaseSettingsTab tab = [[self.sectionTabView tabViewItems] indexOfObject:selected]; + + switch(tab) { + case MPDatabaseSettingsTabAdvanced: + [[self window] makeFirstResponder:self.databaseNameTextField]; + break; + + case MPDatabaseSettingsTabDisplay: + [[self window] makeFirstResponder:self.protectTitleCheckButton]; + break; + + case MPDatabaseSettingsTabGeneral: + [[self window] makeFirstResponder:self.databaseNameTextField]; + break; + + case MPDatabaseSettingsTabPassword: + [[self window] makeFirstResponder:self.passwordTextField]; + break; + + case MPDatabaseSettingsTemplatesTab: + break; + } +} + - (void)_updateTrashFolders:(Kdb4Tree *)tree { NSMenu *menu = [self _buildTrashTreeMenu:tree]; [self.selectRecycleBinGroupPopUpButton setMenu:menu]; diff --git a/MacPass/MPDocument+Attachments.m b/MacPass/MPDocument+Attachments.m index 9a44e313..23a958e8 100644 --- a/MacPass/MPDocument+Attachments.m +++ b/MacPass/MPDocument+Attachments.m @@ -80,17 +80,6 @@ } } -- (void)saveAttachmentFromEntry:(KdbEntry *)anEntry toLocation:(NSURL *)location { - if([anEntry isKindOfClass:[Kdb3Entry class]]) { - Kdb3Entry *entry = (Kdb3Entry *)anEntry; - NSError *error = nil; - if(! [entry.binary writeToURL:location options:NSDataWritingWithoutOverwriting error:&error] ) { - [NSApp presentError:error]; - } - } - return; // -} - - (void)removeAttachment:(BinaryRef *)reference fromEntry:(KdbEntry *)anEntry { if(self.version != MPDatabaseVersion4) { return; // Wrong Database version; @@ -125,22 +114,35 @@ return [filteredBinary lastObject]; } -- (void)saveAttachment:(BinaryRef *)reference toLocation:(NSURL *)location { - Binary *binary = [self findBinary:reference]; - NSData *rawData = nil; - if(binary) { - if(binary.compressed) { - rawData = [NSMutableData mutableDataWithBase64DecodedData:[binary.data dataUsingEncoding:NSUTF8StringEncoding]]; - rawData = [rawData gzipInflate]; - } - else { - rawData = [NSMutableData mutableDataWithBase64DecodedData:[binary.data dataUsingEncoding:NSUTF8StringEncoding]]; - } +- (void)saveAttachmentForItem:(id)item toLocation:(NSURL *)location { + if([item isKindOfClass:[Kdb3Entry class]]) { + Kdb3Entry *entry = (Kdb3Entry *)item; NSError *error = nil; - if( ![rawData writeToURL:location options:0 error:&error] ) { + if(! [entry.binary writeToURL:location options:NSDataWritingAtomic error:&error] ) { [NSApp presentError:error]; } } + else if([item isKindOfClass:[BinaryRef class]]) { + Binary *binary = [self findBinary:item]; + NSData *rawData = nil; + if(binary) { + if(binary.compressed) { + rawData = [NSMutableData mutableDataWithBase64DecodedData:[binary.data dataUsingEncoding:NSUTF8StringEncoding]]; + rawData = [rawData gzipInflate]; + } + else { + rawData = [NSMutableData mutableDataWithBase64DecodedData:[binary.data dataUsingEncoding:NSUTF8StringEncoding]]; + } + NSError *error = nil; + if( ![rawData writeToURL:location options:NSDataWritingAtomic error:&error] ) { + [NSApp presentError:error]; + } + } + } + else { + NSAssert(NO, @"Item is neither BinaryRef nor Kdb3Entry"); + return; + } } - (NSUInteger)nextBinaryId { diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index 13331844..e0e3ebe4 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -19,6 +19,8 @@ APPKIT_EXTERN NSString *const MPDocumentDidRevertNotifiation; APPKIT_EXTERN NSString *const MPDocumentEntryKey; APPKIT_EXTERN NSString *const MPDocumentGroupKey; +APPKIT_EXTERN NSString *const MPDocumentRequestPasswordSaveNotification; + @class KdbGroup; @class KdbEntry; @class KdbTree; @@ -50,6 +52,7 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; @property (assign, readonly) MPDatabaseVersion version; @property (assign, readonly, getter = isReadOnly) BOOL readOnly; + - (id)initWithVersion:(MPDatabaseVersion)version; #pragma mark Lock/Decrypt @@ -98,8 +101,10 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; @interface MPDocument (Attachments) - (void)addAttachment:(NSURL *)location toEntry:(KdbEntry *)anEntry; -- (void)saveAttachmentFromEntry:(KdbEntry *)anEntry toLocation:(NSURL *)location; -- (void)saveAttachment:(BinaryRef *)reference toLocation:(NSURL *)location; +/** + item can be either a BinaryRef or an Kdb3Entry. + */ +- (void)saveAttachmentForItem:(id)item toLocation:(NSURL *)location; - (void)removeAttachment:(BinaryRef *)reference fromEntry:(KdbEntry *)anEntry; - (void)removeAttachmentFromEntry:(KdbEntry *)anEntry; - (NSUInteger)nextBinaryId; diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 317d2859..1044f249 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -37,14 +37,16 @@ #import "DDXMLNode.h" -NSString *const MPDocumentDidAddGroupNotification = @"com.hicknhack.macpass.MPDocumentDidAddGroupNotification"; -NSString *const MPDocumentWillDelteGroupNotification = @"com.hicknhack.macpass.MPDocumentDidDelteGroupNotification"; -NSString *const MPDocumentDidAddEntryNotification = @"com.hicknhack.macpass.MPDocumentDidAddEntryNotification"; -NSString *const MPDocumentWillDeleteEntryNotification = @"com.hicknhack.macpass.MPDocumentDidDeleteEntryNotification"; -NSString *const MPDocumentDidRevertNotifiation = @"com.hicknhack.macpass.MPDocumentDidRevertNotifiation"; +NSString *const MPDocumentDidAddGroupNotification = @"com.hicknhack.macpass.MPDocumentDidAddGroupNotification"; +NSString *const MPDocumentWillDelteGroupNotification = @"com.hicknhack.macpass.MPDocumentDidDelteGroupNotification"; +NSString *const MPDocumentDidAddEntryNotification = @"com.hicknhack.macpass.MPDocumentDidAddEntryNotification"; +NSString *const MPDocumentWillDeleteEntryNotification = @"com.hicknhack.macpass.MPDocumentDidDeleteEntryNotification"; +NSString *const MPDocumentDidRevertNotifiation = @"com.hicknhack.macpass.MPDocumentDidRevertNotifiation"; +NSString *const MPDocumentRequestPasswordSaveNotification = @"com.hicknhack.macpass.MPDocumentRequestPasswordSaveNotification"; -NSString *const MPDocumentEntryKey = @"MPDocumentEntryKey"; -NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; + +NSString *const MPDocumentEntryKey = @"MPDocumentEntryKey"; +NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; @interface MPDocument () { @@ -238,17 +240,21 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; return NO; } +- (void)saveDocument:(id)sender { + if(self.hasPasswordOrKey) { + [super saveDocument:sender]; + } + else { + [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentRequestPasswordSaveNotification object:self userInfo:nil]; + } +} + - (BOOL)prepareSavePanel:(NSSavePanel *)savePanel { if(self.hasPasswordOrKey) { [savePanel setAccessoryView:nil]; return YES; } - if(!self.warningView) { - [[NSBundle mainBundle] loadNibNamed:@"UnprotectedWarningView" owner:self topLevelObjects:nil]; - [self.warningViewImage setImage:[NSImage imageNamed:NSImageNameCaution]]; - } - [savePanel setAccessoryView:self.warningView]; - return YES; + return NO; } #pragma mark Data Accesors diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 5ba56dc2..05428af5 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -24,6 +24,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur @interface MPDocumentWindowController () { @private id _firstResponder; + BOOL _requestPassword; // We did open a new document, request teh password } @property (strong) IBOutlet NSSplitView *splitView; @@ -54,6 +55,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur _entryViewController = [[MPEntryViewController alloc] init]; _inspectorViewController = [[MPInspectorViewController alloc] init]; _currentItem = nil; + _requestPassword = NO; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateCurrentItem:) name:MPOutlineViewDidChangeGroupSelection object:_outlineViewController]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateCurrentItem:) name:MPDidChangeSelectedEntryNotification object:_entryViewController]; @@ -69,6 +71,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur - (void)windowDidLoad { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didRevertDocument:) name:MPDocumentDidRevertNotifiation object:[self document]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editPassword:) name:MPDocumentRequestPasswordSaveNotification object:[self document]]; [_entryViewController setupNotifications:self]; [_inspectorViewController setupNotifications:self]; @@ -209,7 +212,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur switch (actionType) { case MPActionAddGroup: case MPActionAddEntry: - return (nil != _outlineViewController.selectedGroup); + return (nil != _outlineViewController.selectedGroup); case MPActionDelete: { BOOL valid = (nil != _currentItem); valid &= (_currentItem != document.trash); @@ -218,10 +221,10 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur } case MPActionLock: return document.hasPasswordOrKey; - + case MPActionToggleInspector: return (nil != [_splitView superview]); - + default: return YES; } @@ -391,12 +394,16 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur } } -- (void)windowDidBecomeKey:(NSNotification *)notification { - MPDocument *document = [self document]; - if(!document.hasPasswordOrKey && document.decrypted) { - [self performSelector:@selector(editPassword:) withObject:nil afterDelay:0.5]; - } -} +//- (void)windowDidBecomeKey:(NSNotification *)notification { +// if(!_requestPassword) { +// return; // Nothing to do; +// } +// MPDocument *document = [self document]; +// if(!document.hasPasswordOrKey && document.decrypted) { +// _requestPassword = NO; +// [self performSelector:@selector(editPassword:) withObject:nil afterDelay:0.5]; +// } +//} #pragma mark Helper @@ -406,7 +413,12 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur } [self.documentSettingsWindowController update]; [self.documentSettingsWindowController showSettingsTab:tab]; - [[NSApplication sharedApplication] beginSheet:[self.documentSettingsWindowController window] modalForWindow:[self window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + [[NSApplication sharedApplication] beginSheet:[self.documentSettingsWindowController window] + modalForWindow:[self window] + modalDelegate:nil + didEndSelector:NULL + contextInfo:NULL]; + } - (NSSearchField *)locateToolbarSearchField { diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m index 28af9080..edf028c3 100644 --- a/MacPass/MPInspectorViewController.m +++ b/MacPass/MPInspectorViewController.m @@ -350,18 +350,26 @@ enum { } - (IBAction)saveAttachment:(id)sender { - Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry; - BinaryRef *reference = entry.binaries[[sender tag]]; - + BOOL isVersion4 = [self.selectedEntry isKindOfClass:[Kdb4Entry class]]; + id item = self.selectedEntry; + NSString *fileName = nil; + if(isVersion4) { + Kdb4Entry *entry= (Kdb4Entry *)self.selectedEntry; + item = entry.binaries[[sender tag]]; + fileName = ((BinaryRef *)item).key; + } + else { + fileName = ((Kdb3Entry *)item).binaryDesc; + } NSSavePanel *savePanel = [NSSavePanel savePanel]; [savePanel setCanCreateDirectories:YES]; - [savePanel setNameFieldStringValue:reference.key]; + [savePanel setNameFieldStringValue:fileName]; [savePanel beginSheetModalForWindow:[[self windowController] window] completionHandler:^(NSInteger result) { if(result == NSFileHandlingPanelOKButton) { MPDocument *document = [[self windowController] document]; - [document saveAttachment:reference toLocation:[savePanel URL]]; + [document saveAttachmentForItem:item toLocation:[savePanel URL]]; } }]; } diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist index 87e65454..74e37406 100644 --- a/MacPass/MacPass-Info.plist +++ b/MacPass/MacPass-Info.plist @@ -44,11 +44,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3.6 + 0.3.7 CFBundleSignature ???? CFBundleVersion - 2518 + 2521 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright diff --git a/MacPass/PasswordCreatorView.xib b/MacPass/PasswordCreatorView.xib index 278d1c28..7d667f4b 100644 --- a/MacPass/PasswordCreatorView.xib +++ b/MacPass/PasswordCreatorView.xib @@ -1,7 +1,7 @@ - 1070 + 1080 12E55 3084 1187.39 @@ -381,8 +381,8 @@ _NS:9 YES - -1804599231 - 272630784 + -2075131840 + -1874852864 _NS:9 @@ -1189,6 +1189,7 @@ 183 + @@ -1987,7 +1988,7 @@ - 623 + 626 @@ -2003,11 +2004,16 @@ MPPasswordCreatorViewController MPViewController + id id id id + + _cancel: + id + _generatePassword: id @@ -2022,7 +2028,6 @@ - NSButton NSButton NSButton NSTextField @@ -2035,10 +2040,6 @@ NSButton - - _cancel - NSButton - addPasswordToPasteboardButton NSButton @@ -2105,9 +2106,9 @@ 0 IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + YES 3 diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings index 759134d750cbdb1aa8a47b367c7f51a4bff73cfc..459b2cbe45f0cae9b432371bcf2eb8348384e0e2 100644 GIT binary patch delta 1180 zcmb7^!EVz)5QhJA51iqEWFlxK4sh!Qac~o-sobV%l2UrIOcT-w5=Ti2%E=Frm*B{q zSK`iFTU^YJ$nYWW7Hg_Cv*Ycr=g+qL zFCOKIx;jJhR-e=Aa=vUa8_bcpN6W-1H zhCcFLGv4O-Z|IG7u#x(?`nd1o@Ek`2Y>#F$LzY|2w-hoCb-**QPndh>{Xj?T?AG9h zx^|cr*In~`@M|017v`5BPL+XB;?9+4uE$C@TF^2!t=T%NGyW5?sSYSTtl?E!o#X27 zlLIxuoZ=1G9ESlPw;psDdw?#miQ4S6u-M2nI&p3ObodFUnZEih+qfyh)Ap;)T$h^s z%1il;Jp`i=xar6DJsd?KDkmNENm0lIErq=DCg}*NuE6_ejU9b%| z0d(ld;XPn?Gb>