From f56c3252429f919707d02a09b7183892883d7d7c Mon Sep 17 00:00:00 2001 From: michael starke Date: Fri, 28 Jun 2013 02:17:49 +0200 Subject: [PATCH] Changed custom fields to use a tableview Custom fields are stored and loaded, missing Undo --- MacPass.xcodeproj/project.pbxproj | 24 + MacPass/Base.lproj/InspectorView.xib | 1255 ++++++++++++++---- MacPass/Kdb4Entry+KVOAdditions.h | 19 + MacPass/Kdb4Entry+KVOAdditions.m | 29 + MacPass/Kdb4Tree+KVOAdditions.h | 19 + MacPass/Kdb4Tree+KVOAdditions.m | 29 + MacPass/Kdb4Tree+Undo.h | 58 + MacPass/Kdb4Tree+Undo.m | 127 ++ MacPass/MPCustomFieldTableCellView.h | 17 + MacPass/MPCustomFieldTableCellView.m | 17 + MacPass/MPDocument.h | 4 + MacPass/MPDocument.m | 28 +- MacPass/MPDocumentSettingsWindowController.m | 15 +- MacPass/MPInspectorViewController.h | 1 + MacPass/MPInspectorViewController.m | 120 +- MacPass/MacPass-Info.plist | 2 +- MacPass/de.lproj/Localizable.strings | Bin 5528 -> 6092 bytes MacPass/en.lproj/Localizable.strings | Bin 5370 -> 5906 bytes 18 files changed, 1441 insertions(+), 323 deletions(-) create mode 100644 MacPass/Kdb4Entry+KVOAdditions.h create mode 100644 MacPass/Kdb4Entry+KVOAdditions.m create mode 100644 MacPass/Kdb4Tree+KVOAdditions.h create mode 100644 MacPass/Kdb4Tree+KVOAdditions.m create mode 100644 MacPass/Kdb4Tree+Undo.h create mode 100644 MacPass/Kdb4Tree+Undo.m create mode 100644 MacPass/MPCustomFieldTableCellView.h create mode 100644 MacPass/MPCustomFieldTableCellView.m diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 606faaaf..0afc05bd 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -51,6 +51,8 @@ 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 */; }; + 4C36E5B1177CD38C00152132 /* Kdb4Tree+Undo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C36E5B0177CD38C00152132 /* Kdb4Tree+Undo.m */; }; + 4C36E5B4177CD4FB00152132 /* Kdb4Tree+KVOAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C36E5B3177CD4FB00152132 /* Kdb4Tree+KVOAdditions.m */; }; 4C37A6731769393300AD0A40 /* HNHTableHeaderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C37A6721769393300AD0A40 /* HNHTableHeaderCell.m */; }; 4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */; }; 4C3BD51516D276F800389F1F /* MPToolbarDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BD51416D276F800389F1F /* MPToolbarDelegate.m */; }; @@ -63,6 +65,8 @@ 4C46E09E17673A0A00DA62E8 /* HNHShadowBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C46E09D17673A0A00DA62E8 /* HNHShadowBox.m */; }; 4C4A100F176286FD00BBF2CA /* MPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A100E176286FD00BBF2CA /* MPTableView.m */; }; 4C4A101217629DA900BBF2CA /* KdbGroup+KVOAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A101117629DA900BBF2CA /* KdbGroup+KVOAdditions.m */; }; + 4C4FCE15177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4FCE14177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m */; }; + 4C4FCE18177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4FCE17177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.m */; }; 4C569D9E17652B0600595B62 /* MPConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C569D9D17652B0600595B62 /* MPConstants.m */; }; 4C569DA117652BFE00595B62 /* MPEntryTableDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C569DA017652BFE00595B62 /* MPEntryTableDataSource.m */; }; 4C569DA417653F3500595B62 /* KdbEntry+MPTreeTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C569DA317653F3500595B62 /* KdbEntry+MPTreeTools.m */; }; @@ -268,6 +272,10 @@ 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 = ""; }; + 4C36E5AF177CD38C00152132 /* Kdb4Tree+Undo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Kdb4Tree+Undo.h"; sourceTree = ""; }; + 4C36E5B0177CD38C00152132 /* Kdb4Tree+Undo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Kdb4Tree+Undo.m"; sourceTree = ""; }; + 4C36E5B2177CD4FB00152132 /* Kdb4Tree+KVOAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Kdb4Tree+KVOAdditions.h"; sourceTree = ""; }; + 4C36E5B3177CD4FB00152132 /* Kdb4Tree+KVOAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Kdb4Tree+KVOAdditions.m"; sourceTree = ""; }; 4C37A6711769393300AD0A40 /* HNHTableHeaderCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHTableHeaderCell.h; sourceTree = ""; }; 4C37A6721769393300AD0A40 /* HNHTableHeaderCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHTableHeaderCell.m; sourceTree = ""; }; 4C37A83E15B8B474005EF8EE /* MPOutlineDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOutlineDataSource.h; sourceTree = ""; }; @@ -290,6 +298,10 @@ 4C4A100E176286FD00BBF2CA /* MPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTableView.m; sourceTree = ""; }; 4C4A101017629DA900BBF2CA /* KdbGroup+KVOAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KdbGroup+KVOAdditions.h"; sourceTree = ""; }; 4C4A101117629DA900BBF2CA /* KdbGroup+KVOAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KdbGroup+KVOAdditions.m"; sourceTree = ""; }; + 4C4FCE13177CFE6B00BBF7AE /* MPCustomFieldTableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPCustomFieldTableCellView.h; sourceTree = ""; }; + 4C4FCE14177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPCustomFieldTableCellView.m; sourceTree = ""; }; + 4C4FCE16177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Kdb4Entry+KVOAdditions.h"; sourceTree = ""; }; + 4C4FCE17177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Kdb4Entry+KVOAdditions.m"; sourceTree = ""; }; 4C569D9C17652AC800595B62 /* MPConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPConstants.h; sourceTree = ""; }; 4C569D9D17652B0600595B62 /* MPConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPConstants.m; sourceTree = ""; }; 4C569D9F17652BFE00595B62 /* MPEntryTableDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEntryTableDataSource.h; sourceTree = ""; }; @@ -561,6 +573,8 @@ 4CE39AC316ECE4F7000FE29D /* MPPopupImageView.m */, 4C4A100D176286FD00BBF2CA /* MPTableView.h */, 4C4A100E176286FD00BBF2CA /* MPTableView.m */, + 4C4FCE13177CFE6B00BBF7AE /* MPCustomFieldTableCellView.h */, + 4C4FCE14177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m */, ); name = Views; sourceTree = ""; @@ -739,8 +753,14 @@ 4C01C23E1764D2980016D5D0 /* KdbEntry+Undo.m */, 4C22040B1746ED160054C916 /* KdbGroup+Undo.h */, 4C22040C1746ED160054C916 /* KdbGroup+Undo.m */, + 4C36E5AF177CD38C00152132 /* Kdb4Tree+Undo.h */, + 4C36E5B0177CD38C00152132 /* Kdb4Tree+Undo.m */, 4C4A101017629DA900BBF2CA /* KdbGroup+KVOAdditions.h */, 4C4A101117629DA900BBF2CA /* KdbGroup+KVOAdditions.m */, + 4C36E5B2177CD4FB00152132 /* Kdb4Tree+KVOAdditions.h */, + 4C36E5B3177CD4FB00152132 /* Kdb4Tree+KVOAdditions.m */, + 4C4FCE16177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.h */, + 4C4FCE17177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.m */, 4C83F4A81774B155006C5FC0 /* Kdb3Tree+NewTree.h */, 4C83F4A91774B155006C5FC0 /* Kdb3Tree+NewTree.m */, 4C83F4AB1774B25F006C5FC0 /* Kdb4Tree+NewTree.h */, @@ -1442,6 +1462,10 @@ 4CD5D705177A5F3300100649 /* MPDocumentSettingsWindowController.m in Sources */, 4C5EC302177B700D00DA955B /* MPRootAdapter.m in Sources */, 4C74DD07177BD1640034A9DB /* MPCustomFieldView.m in Sources */, + 4C36E5B1177CD38C00152132 /* Kdb4Tree+Undo.m in Sources */, + 4C36E5B4177CD4FB00152132 /* Kdb4Tree+KVOAdditions.m in Sources */, + 4C4FCE15177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m in Sources */, + 4C4FCE18177D03D700BBF7AE /* Kdb4Entry+KVOAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MacPass/Base.lproj/InspectorView.xib b/MacPass/Base.lproj/InspectorView.xib index 0ad4da1a..6d96bf9b 100644 --- a/MacPass/Base.lproj/InspectorView.xib +++ b/MacPass/Base.lproj/InspectorView.xib @@ -91,7 +91,7 @@ 268 - {{73, 477}, {209, 17}} + {{73, 477}, {203, 17}} @@ -134,16 +134,17 @@ 268 - {299, 30} + {293, 30} + _NS:9 HNHGradientView 268 - {{67, 429}, {165, 25}} + {{64, 429}, {165, 25}} @@ -198,7 +199,7 @@ 12 - {{0, 31}, {299, 399}} + {{0, 31}, {293, 399}} @@ -245,7 +246,7 @@ 268 - {{20, 335}, {259, 22}} + {{20, 335}, {253, 22}} _NS:9 @@ -299,7 +300,7 @@ 268 - {{20, 283}, {259, 22}} + {{20, 283}, {253, 22}} _NS:9 @@ -320,7 +321,7 @@ 268 - {{20, 231}, {259, 22}} + {{20, 231}, {253, 22}} _NS:9 @@ -381,7 +382,7 @@ 268 - {{20, 179}, {259, 22}} + {{20, 179}, {253, 22}} _NS:9 @@ -402,7 +403,7 @@ 268 - {{20, 152}, {259, 19}} + {{20, 152}, {253, 19}} _NS:9 @@ -451,7 +452,7 @@ 268 - {{20, 105}, {259, 18}} + {{20, 105}, {253, 18}} _NS:9 @@ -514,7 +515,7 @@ NO - {299, 399} + {293, 399} _NS:11 @@ -539,9 +540,9 @@ 2322 - {257, 332} + {251, 332} - + _NS:13 @@ -558,7 +559,7 @@ - 257 + 251 1 @@ -601,7 +602,7 @@ - {{1, 1}, {257, 332}} + {{1, 1}, {251, 332}} _NS:11 @@ -631,7 +632,7 @@ 256 - {{242, 1}, {16, 332}} + {{236, 1}, {16, 332}} _NS:83 @@ -656,9 +657,9 @@ 0.94565218687057495 - {{20, 20}, {259, 334}} + {{20, 20}, {253, 334}} - + _NS:9 133138 @@ -689,7 +690,7 @@ NO - {299, 399} + {293, 399} _NS:28 @@ -705,7 +706,7 @@ 268 - {{217, 19}, {62, 19}} + {{211, 19}, {62, 19}} _NS:9 @@ -729,7 +730,7 @@ 268 - {{145, 19}, {64, 19}} + {{139, 19}, {64, 19}} _NS:9 @@ -741,7 +742,7 @@ _NS:9 - -2038153216 + -2033434624 164 @@ -782,7 +783,7 @@ 256 - {257, 304} + {251, 304} _NS:13 @@ -798,7 +799,7 @@ - 254 + 248 40 1000 @@ -810,7 +811,7 @@ 3 MC4zMzMzMzI5ODU2AA - + 6 System headerTextColor @@ -840,7 +841,7 @@ 3 2 - + 6 System gridColor @@ -861,7 +862,7 @@ 1 - {{1, 1}, {257, 304}} + {{1, 1}, {251, 304}} _NS:11 @@ -895,7 +896,7 @@ 0.99487179487179489 - {{20, 48}, {259, 306}} + {{20, 48}, {253, 306}} _NS:9 @@ -909,7 +910,7 @@ 1 - {299, 399} + {293, 399} Attachments @@ -924,10 +925,10 @@ 268 - {{247, 362}, {32, 19}} + {{241, 362}, {32, 19}} - + _NS:9 YES @@ -971,8 +972,134 @@ NO + + + 268 + + + + 2304 + + + + 256 + + {261, 335} + + + + _NS:13 + YES + NO + YES + + + -2147483392 + {{224, 0}, {16, 17}} + + _NS:19 + + + + 258 + 40 + 1000 + + 75497536 + 2048 + + + + 3 + MC4zMzMzMzI5ODU2AA + + + + + 337641536 + 2048 + Text Cell + + + + + + 3 + YES + YES + + + + 3 + 2 + + + 54 + -1774190592 + + + 4 + 15 + 0 + YES + -1 + 0 + 1 + + + {261, 335} + + + + _NS:11 + + + 2 + + + + -2147483392 + {{224, 17}, {15, 102}} + + + + _NS:58 + NO + + _doScroller: + 0.99702380952380953 + + + + -2147483392 + {{1, 119}, {223, 15}} + + + + _NS:60 + NO + 1 + + _doScroller: + 0.99615384615384617 + + + {{16, 20}, {261, 335}} + + + + _NS:9 + 133680 + + + + QSAAAEEgAABCYAAAQmAAAA + 0.25 + 4 + 1 + - {299, 399} + {293, 399} @@ -992,7 +1119,7 @@ - {299, 529} + {293, 529} @@ -1153,6 +1280,14 @@ 2006 + + + customFieldsTableView + + + + 2068 + imageView @@ -1195,7 +1330,7 @@ 266 - {{25, 0}, {229, 17}} + {{25, 0}, {223, 17}} _NS:20 @@ -1214,7 +1349,7 @@ NO - {{1, 1}, {254, 17}} + {{1, 1}, {248, 17}} _NS:9 @@ -1230,6 +1365,108 @@ 1571 + + + valueTextField + + + 274 + + + + 268 + {{3, 10}, {210, 22}} + + + _NS:9 + YES + + -1804599231 + 272630784 + + + Value + _NS:9 + + YES + + + + NO + + + + 268 + {{0, 40}, {256, 14}} + + + _NS:9 + YES + + -1808793535 + 272761856 + + + Title + _NS:9 + + + + + NO + + + + 268 + {{221, 11}, {32, 19}} + + + _NS:9 + YES + + -2080374784 + 134217728 + + + _NS:9 + + -2033434624 + 164 + + NSImage + NSRemoveTemplate + + + + 400 + 75 + + NO + + + {{1, 1}, {258, 54}} + + + + + 2069 + + + + labelTextField + + + + 2070 + + + + removeButton + + + + 2173 + @@ -1673,22 +1910,6 @@ 1396 - - - 3 - 0 - - 4 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - 6 @@ -1705,6 +1926,22 @@ 29 3 + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + 4 @@ -1858,6 +2095,22 @@ 29 3 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 3 @@ -1874,22 +2127,6 @@ 40 3 - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 5 @@ -1938,6 +2175,22 @@ 29 3 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 3 @@ -1954,12 +2207,12 @@ 40 3 - - - 6 + + + 5 0 - - 6 + + 5 1 20 @@ -1970,12 +2223,12 @@ 29 3 - - - 5 + + + 6 0 - - 5 + + 6 1 20 @@ -2002,22 +2255,6 @@ 40 3 - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 5 @@ -2066,6 +2303,22 @@ 29 3 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 3 @@ -2082,22 +2335,6 @@ 40 3 - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 5 @@ -2146,6 +2383,22 @@ 29 3 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 3 @@ -2162,22 +2415,6 @@ 40 3 - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 5 @@ -2242,6 +2479,22 @@ 29 3 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 3 @@ -2258,22 +2511,6 @@ 40 3 - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 5 @@ -2636,41 +2873,6 @@ - - 1798 - - - - - 1806 - - - - - 1808 - - - - - 1810 - - - - - 1815 - - - - - 1817 - - - - - 1819 - - - 1849 @@ -2826,6 +3028,22 @@ 24 3 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 4 @@ -2842,12 +3060,12 @@ 29 3 - + - 6 + 4 0 - - 6 + + 4 1 20 @@ -2858,12 +3076,12 @@ 29 3 - + - 4 + 6 0 - - 4 + + 6 1 20 @@ -2922,22 +3140,6 @@ 29 3 - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - 5 @@ -3021,6 +3223,70 @@ 29 3 + + + 4 + 0 + + 4 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 16 + + 1000 + + 9 + 40 + 3 + + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 5 + 0 + + 5 + 1 + + 16 + + 1000 + + 9 + 40 + 3 + 5 @@ -3055,6 +3321,7 @@ + @@ -3282,11 +3549,6 @@ - - 1949 - - - 1952 @@ -3388,16 +3650,6 @@ - - 1972 - - - - - 1975 - - - 1978 @@ -3462,11 +3714,6 @@ - - 1988 - - - 1990 @@ -3520,6 +3767,425 @@ + + 2009 + + + + + + + + + + 2010 + + + + + + + + 2011 + + + + + 2013 + + + + + 2014 + + + + + + + + + 2017 + + + + + 2020 + + + Horizontal Space - Scroll View - Table View - View + + + 2021 + + + + + 2023 + + + + + 2024 + + + + + 6 + 0 + + 6 + 1 + + 3 + + 1000 + + 9 + 40 + 3 + + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 9 + 40 + 3 + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 4 + 0 + + 4 + 1 + + 10 + + 1000 + + 9 + 40 + 3 + + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 5 + 0 + + 5 + 1 + + 3 + + 1000 + + 9 + 40 + 3 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 5 + 0 + + 5 + 1 + + 3 + + 1000 + + 8 + 29 + 3 + + + + + + + + + 2042 + + + + + + 7 + 1 + + 0 + 1 + + 100 + + 1000 + + 9 + 40 + 1 + + + + 8 + 0 + + 0 + 1 + + 22 + + 1000 + + 9 + 40 + 1 + + + + + + 2043 + + + + + 2047 + + + + + + 8 + 0 + + 0 + 1 + + 14 + + 1000 + + 9 + 40 + 1 + + + + + + 2049 + + + + + 1988 + + + + + 2022 + + + + + 2074 + + + + + 2078 + + + + + 2080 + + + + + 2082 + + + + + 2083 + + + + + 2085 + + + + + 2086 + + + + + 2087 + + + + + 2090 + + + + + 2091 + + + + + 2098 + + + + + 2100 + + + + + 2134 + + + + + 2136 + + + + + 2141 + + + + + 2142 + + + + + 2144 + + + + + + 7 + 0 + + 0 + 1 + + 32 + + 1000 + + 9 + 40 + 1 + + + + + + 2145 + + + + + 2147 + + + + + 2152 + + + + + 2153 + + + + + 2156 + + + + + 2165 + + + + + 2166 + + + @@ -3576,40 +4242,40 @@ - + com.apple.InterfaceBuilder.CocoaPlugin - + - + - + - + - + - + - + @@ -3711,13 +4377,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 - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3749,13 +4408,13 @@ - + - + com.apple.InterfaceBuilder.CocoaPlugin @@ -3763,18 +4422,19 @@ + + + + com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3794,6 +4454,76 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + MPCustomFieldTableCellView + + + + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + HNHRoundedTextFieldCell + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -3840,7 +4570,7 @@ - 2008 + 2173 @@ -3884,28 +4614,56 @@ ./Classes/HNHRoundedTextFieldCell.h + + MPCustomFieldTableCellView + NSTableCellView + + NSTextField + NSButton + NSTextField + + + + labelTextField + NSTextField + + + removeButton + NSButton + + + valueTextField + NSTextField + + + + IBProjectSource + ./Classes/MPCustomFieldTableCellView.h + + MPInspectorViewController MPViewController - id id + id - - _popUpPasswordGenerator: - id - addCustomField: id + + removeCustomField: + id + NSTextField NSTableView HNHGradientView NSTextField + NSTableView NSTextField NSButton NSSegmentedControl @@ -3936,6 +4694,10 @@ createdTextField NSTextField + + customFieldsTableView + NSTableView + customFieldsTextField NSTextField @@ -4027,6 +4789,7 @@ {15, 15} {8, 8} {128, 128} + {8, 8} {15, 15} YES diff --git a/MacPass/Kdb4Entry+KVOAdditions.h b/MacPass/Kdb4Entry+KVOAdditions.h new file mode 100644 index 00000000..9afe4aa8 --- /dev/null +++ b/MacPass/Kdb4Entry+KVOAdditions.h @@ -0,0 +1,19 @@ +// +// Kdb4Entry+KVOAdditions.h +// MacPass +// +// Created by Michael Starke on 28.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb4Node.h" + +@interface Kdb4Entry (KVOAdditions) + +- (NSUInteger)countOfStringFields; +- (StringField *)objectInStringFieldsAtIndex:(NSUInteger)index; +- (void)removeObjectFromStringFieldsAtIndex:(NSUInteger)anIndex; +- (void)insertObject:(StringField *)stringfield inStringFieldsAtIndex:(NSUInteger)anIndex; + + +@end diff --git a/MacPass/Kdb4Entry+KVOAdditions.m b/MacPass/Kdb4Entry+KVOAdditions.m new file mode 100644 index 00000000..7d682347 --- /dev/null +++ b/MacPass/Kdb4Entry+KVOAdditions.m @@ -0,0 +1,29 @@ +// +// Kdb4Entry+KVOAdditions.m +// MacPass +// +// Created by Michael Starke on 28.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb4Entry+KVOAdditions.h" + +@implementation Kdb4Entry (KVOAdditions) + +- (NSUInteger)countOfStringFields { + return [self.stringFields count]; +} + +- (StringField *)objectInStringFieldsAtIndex:(NSUInteger)index { + return [self.stringFields objectAtIndex:index]; +} + +- (void)insertObject:(StringField *)stringfield inStringFieldsAtIndex:(NSUInteger)anIndex { + [self.stringFields insertObject:stringfield atIndex:anIndex]; +} + +- (void)removeObjectFromStringFieldsAtIndex:(NSUInteger)anIndex { + [self.stringFields removeObjectAtIndex:anIndex]; +} + +@end diff --git a/MacPass/Kdb4Tree+KVOAdditions.h b/MacPass/Kdb4Tree+KVOAdditions.h new file mode 100644 index 00000000..400e6980 --- /dev/null +++ b/MacPass/Kdb4Tree+KVOAdditions.h @@ -0,0 +1,19 @@ +// +// Kdb4Tree+KVOAdditions.h +// MacPass +// +// Created by Michael Starke on 27.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb4Node.h" + +@interface Kdb4Tree (KVOAdditions) + +- (void)insertObject:(Binary *)binary inBinariesAtIndex:(NSUInteger)index; +- (void)insertObject:(CustomIcon *)icon inCustomIconsAtIndex:(NSUInteger)index; + +- (CustomIcon *)objectInCustomIconsAtIndex:(NSUInteger)index; +- (Binary *)objectInBinariesAtIndex:(NSUInteger)index; + +@end diff --git a/MacPass/Kdb4Tree+KVOAdditions.m b/MacPass/Kdb4Tree+KVOAdditions.m new file mode 100644 index 00000000..e313a923 --- /dev/null +++ b/MacPass/Kdb4Tree+KVOAdditions.m @@ -0,0 +1,29 @@ +// +// Kdb4Tree+KVOAdditions.m +// MacPass +// +// Created by Michael Starke on 27.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb4Tree+KVOAdditions.h" + +@implementation Kdb4Tree (KVOAdditions) + +- (void)insertObject:(Binary *)binary inBinariesAtIndex:(NSUInteger)index { + [self.binaries insertObject:binary atIndex:index]; +} + +- (void)insertObject:(CustomIcon *)icon inCustomIconsAtIndex:(NSUInteger)index { + [self.customIcons insertObject:icon atIndex:index]; +} + +- (Binary *)objectInBinariesAtIndex:(NSUInteger)index { + return [self.binaries objectAtIndex:index]; +} + +- (CustomIcon *)objectInCustomIconsAtIndex:(NSUInteger)index { + return [self.customIcons objectAtIndex:index]; +} + +@end diff --git a/MacPass/Kdb4Tree+Undo.h b/MacPass/Kdb4Tree+Undo.h new file mode 100644 index 00000000..8489c532 --- /dev/null +++ b/MacPass/Kdb4Tree+Undo.h @@ -0,0 +1,58 @@ +// +// Kdb4Tree+Undo.h +// MacPass +// +// Created by Michael Starke on 27.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb4Node.h" + +APPKIT_EXTERN NSString *const MPTree4DatabaseNameUndoableKey; +APPKIT_EXTERN NSString *const MPTree4DatabaseDescriptionUndoableKey; +APPKIT_EXTERN NSString *const MPTree4DatabaseDefaultUsernameUndoableKey; + +APPKIT_EXTERN NSString *const MPTree4ProtectNotesUndoableKey; +APPKIT_EXTERN NSString *const MPTree4ProtectPasswordUndoableKey; +APPKIT_EXTERN NSString *const MPTree4ProtectTitleUndoableKey; +APPKIT_EXTERN NSString *const MPTree4ProtectUrlUndoableKey; +APPKIT_EXTERN NSString *const MPTree4ProtectUsernameUndoableKey; + +@interface Kdb4Tree (Undo) + +- (NSString *)databaseNameUndoable; +- (NSString *)databaseDescriptionUndoable; +- (NSString *)defaultUserNameUndoable; + +- (void)setDatabaseDescriptionUndoable:(NSString *)databaseDescription; +- (void)setDatabaseNameUndoable:(NSString *)databaseName; +- (void)setDefaultUserNameUndoable:(NSString *)defaultUserName; + +- (BOOL)protectNotesUndoable; +- (BOOL)protectPasswordUndoable; +- (BOOL)protectTitleUndoable; +- (BOOL)protectUrlUndoable; +- (BOOL)protectUserNameUndoable; + +- (void)setProtectNotesUndoable:(BOOL)protectNotes; +- (void)setProtectPasswordUndoable:(BOOL)protectPassword; +- (void)setProtectTitleUndoable:(BOOL)protectTitle; +- (void)setProtectUrlUndoable:(BOOL)protectUrl; +- (void)setProtectUserNameUndoable:(BOOL)protectUserName; + + +//@property(nonatomic, assign) NSInteger maintenanceHistoryDays; +// +//@property(nonatomic, retain) NSDate *masterKeyChanged; +//@property(nonatomic, assign) NSInteger masterKeyChangeRec; +//@property(nonatomic, assign) NSInteger masterKeyChangeForce; +// +//@property(nonatomic, assign) BOOL recycleBinEnabled; +//@property(nonatomic, retain) NSDate *recycleBinChanged; +// +//@property(nonatomic, assign) NSInteger historyMaxItems; +//@property(nonatomic, assign) NSInteger historyMaxSize; +// +//@property(nonatomic, readonly) NSMutableArray *binaries; + +@end diff --git a/MacPass/Kdb4Tree+Undo.m b/MacPass/Kdb4Tree+Undo.m new file mode 100644 index 00000000..1173921f --- /dev/null +++ b/MacPass/Kdb4Tree+Undo.m @@ -0,0 +1,127 @@ +// +// Kdb4Tree+Undo.m +// MacPass +// +// Created by Michael Starke on 27.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb4Tree+Undo.h" + +NSString *const MPTree4DatabaseNameUndoableKey = @"databaseNameUndoable"; +NSString *const MPTree4DatabaseDescriptionUndoableKey = @"databaseDescriptionUndoable"; +NSString *const MPTree4DatabaseDefaultUsernameUndoableKey = @"defaultUserNameUndoable"; + +NSString *const MPTree4ProtectNotesUndoableKey = @"protectNotesUndoable"; +NSString *const MPTree4ProtectPasswordUndoableKey = @"protectPasswordUndoable"; +NSString *const MPTree4ProtectTitleUndoableKey = @"protectTitleUndoable"; +NSString *const MPTree4ProtectUrlUndoableKey = @"protectUrlUndoable"; +NSString *const MPTree4ProtectUsernameUndoableKey = @"protectUserNameUndoable"; + +@implementation Kdb4Tree (Undo) + +- (NSUndoManager *)undoManager { + return [[[NSDocumentController sharedDocumentController] currentDocument] undoManager]; +} + + +- (NSString *)databaseDescriptionUndoable { + return self.databaseDescription; +} + +- (NSString *)databaseNameUndoable { + return self.databaseName; +} + + +- (NSString *)defaultUserNameUndoable { + return self.defaultUserName; +} + +- (void)setDatabaseDescriptionUndoable:(NSString *)databaseDescription { + if(![self.databaseDescription isEqualToString:databaseDescription]) { + [[self undoManager] registerUndoWithTarget:self selector:@selector(setDatabaseDescriptionUndoable:) object:self.databaseDescription]; + [[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_DATABASE_DESCRIPTION", @"Undo edit databse description")]; + self.databaseDescriptionChanged = [NSDate date]; + self.databaseDescription = databaseDescription; + } +} + +- (void)setDatabaseNameUndoable:(NSString *)databaseName { + if(![self.databaseName isEqualToString:databaseName]) { + [[self undoManager] registerUndoWithTarget:self selector:@selector(setDatabaseNameUndoable:) object:self.databaseName]; + [[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_DATABASE_NAME", @"Undo edit database name")]; + self.databaseName = databaseName; + self.databaseNameChanged = [NSDate date]; + } +} + +- (void)setDefaultUserNameUndoable:(NSString *)defaultUserName { + if(![self.defaultUserName isEqualToString:defaultUserName]) { + [[self undoManager] registerUndoWithTarget:self selector:@selector(setDefaultUserNameUndoable:) object:self.defaultUserName]; + [[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_DEFAULT_USERNAME", @"Undo edit default username")]; + self.defaultUserName = defaultUserName; + self.defaultUserNameChanged = [NSDate date]; + } +} + +- (BOOL)protectNotesUndoable { + return self.protectNotes; +} + +- (BOOL)protectPasswordUndoable { + return self.protectPassword; +} + +- (BOOL)protectTitleUndoable { + return self.protectTitle; +} + +- (BOOL)protectUrlUndoable { + return self.protectUrl; +} + +- (BOOL)protectUserNameUndoable { + return self.protectUserName; +} + +- (void)setProtectNotesUndoable:(BOOL)protectNotes { + if(self.protectNotes != protectNotes) { + [[[self undoManager] prepareWithInvocationTarget:self] setProtectNotesUndoable:self.protectNotes]; + [[self undoManager] setActionName:NSLocalizedString(@"UNOD_SET_PROTECT_NOTES", @"")]; + self.protectNotes = protectNotes; + } +} + +- (void)setProtectPasswordUndoable:(BOOL)protectPassword { + if(self.protectPassword != protectPassword) { + [[[self undoManager] prepareWithInvocationTarget:self] setProtectPasswordUndoable:self.protectPassword]; + [[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_PROTECT_PASSWORD", @"")]; + self.protectPassword = protectPassword; + } +} + +- (void)setProtectTitleUndoable:(BOOL)protectTitle { + if(self.protectTitle != protectTitle) { + [[[self undoManager] prepareWithInvocationTarget:self] setProtectTitleUndoable:self.protectPassword]; + [[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_PROTECT_TITLE", @"")]; + self.protectTitle = protectTitle; + } +} + +- (void)setProtectUrlUndoable:(BOOL)protectUrl { + if(self.protectUrl != protectUrl) { + [[[self undoManager] prepareWithInvocationTarget:self] setProtectUrlUndoable:self.protectUrl]; + [[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_PROTECT_URL", @"")]; + self.protectUrl = protectUrl; + } +} + +- (void)setProtectUserNameUndoable:(BOOL)protectUserName { + if(self.protectUserName != protectUserName) { + [[[self undoManager] prepareWithInvocationTarget:self] setProtectUserNameUndoable:self.protectUserName]; + [[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_PROTECT_USERNAME", @"")]; + self.protectUserName = protectUserName; + } +} +@end diff --git a/MacPass/MPCustomFieldTableCellView.h b/MacPass/MPCustomFieldTableCellView.h new file mode 100644 index 00000000..97b3c876 --- /dev/null +++ b/MacPass/MPCustomFieldTableCellView.h @@ -0,0 +1,17 @@ +// +// MPCustomFieldTableCellView.h +// MacPass +// +// Created by Michael Starke on 28.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import + +@interface MPCustomFieldTableCellView : NSTableCellView + +@property (assign) IBOutlet NSTextField *labelTextField; +@property (assign) IBOutlet NSTextField *valueTextField; +@property (assign) IBOutlet NSButton *removeButton; + +@end diff --git a/MacPass/MPCustomFieldTableCellView.m b/MacPass/MPCustomFieldTableCellView.m new file mode 100644 index 00000000..1f949a06 --- /dev/null +++ b/MacPass/MPCustomFieldTableCellView.m @@ -0,0 +1,17 @@ +// +// MPCustomFieldTableCellView.m +// MacPass +// +// Created by Michael Starke on 28.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "MPCustomFieldTableCellView.h" + +@implementation MPCustomFieldTableCellView + +- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle { + [super setBackgroundStyle:NSBackgroundStyleLight]; +} + +@end diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index f51a592e..671302f2 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -22,6 +22,8 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; @class KdbGroup; @class KdbEntry; @class KdbTree; +@class Kdb4Tree; +@class Kdb3Tree; @class UUID; @class Binary; @class BinaryRef; @@ -56,6 +58,8 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; */ - (Binary *)binaryForRef:(BinaryRef *)binaryRef; +- (Kdb4Tree *)treeV4; +- (Kdb3Tree *)treeV3; #pragma mark Data Manipulation /* Undoable Intiialization of elements */ diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 3f097e9e..dd2a78b0 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -225,11 +225,37 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; return [filteredBinary lastObject]; } +- (Kdb3Tree *)treeV3 { + switch (_version) { + case MPDatabaseVersion3: + NSAssert([self.tree isKindOfClass:[Kdb3Tree class]], @"Tree has to be Version3"); + return (Kdb3Tree *)self.tree; + case MPDatabaseVersion4: + return nil; + default: + return nil; + } +} + +- (Kdb4Tree *)treeV4 { + switch (_version) { + case MPDatabaseVersion3: + return nil; + case MPDatabaseVersion4: + NSAssert([self.tree isKindOfClass:[Kdb4Tree class]], @"Tree has to be Version4"); + return (Kdb4Tree *)self.tree; + default: + return nil; + } +} #pragma mark Data manipulation - (KdbEntry *)createEntry:(KdbGroup *)parent { KdbEntry *newEntry = [self.tree createEntry:parent]; newEntry.title = NSLocalizedString(@"DEFAULT_ENTRY_TITLE", @"Title for a newly created entry"); + if(self.treeV4 && ([self.treeV4.defaultUserName length] > 0)) { + newEntry.title = self.treeV4.defaultUserName; + } [self group:parent addEntry:newEntry]; NSDictionary *userInfo = @{ MPDocumentEntryKey : newEntry }; [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddEntryNotification object:self userInfo:userInfo]; @@ -322,7 +348,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; [group removeObjectFromGroupsAtIndex:index]; } -#pragma mark Private +#pragma mark Private - (void)_cleanupLock { if(_didLockFile) { [[NSFileManager defaultManager] removeItemAtURL:_lockFileURL error:nil]; diff --git a/MacPass/MPDocumentSettingsWindowController.m b/MacPass/MPDocumentSettingsWindowController.m index f13586c3..c9f52dd8 100644 --- a/MacPass/MPDocumentSettingsWindowController.m +++ b/MacPass/MPDocumentSettingsWindowController.m @@ -10,6 +10,7 @@ #import "MPDocument.h" #import "MPDatabaseVersion.h" #import "Kdb4Node.h" +#import "Kdb4Tree+Undo.h" @interface MPDocumentSettingsWindowController () { MPDocument *_document; @@ -36,14 +37,14 @@ NSAssert(_document != nil, @"Document needs to be present"); if( _document.version == MPDatabaseVersion4 ) { Kdb4Tree *tree = (Kdb4Tree *)_document.tree; - [self.databaseNameTextField bind:NSValueBinding toObject:tree withKeyPath:@"databaseName" options:nil]; - [self.databaseDescriptionTextView bind:NSValueBinding toObject:tree withKeyPath:@"databaseDescription" options:nil]; + [self.databaseNameTextField bind:NSValueBinding toObject:tree withKeyPath:MPTree4DatabaseNameUndoableKey options:nil]; + [self.databaseDescriptionTextView bind:NSValueBinding toObject:tree withKeyPath:MPTree4DatabaseDescriptionUndoableKey options:nil]; - [self.protectNotesCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectNotes" options:nil]; - [self.protectPasswortCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectPassword" options:nil]; - [self.protectTitleCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectTitle" options:nil]; - [self.protectURLCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectUrl" options:nil]; - [self.protectUserNameCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectUserName" options:nil]; + [self.protectNotesCheckButton bind:NSValueBinding toObject:tree withKeyPath:MPTree4ProtectNotesUndoableKey options:nil]; + [self.protectPasswortCheckButton bind:NSValueBinding toObject:tree withKeyPath:MPTree4ProtectPasswordUndoableKey options:nil]; + [self.protectTitleCheckButton bind:NSValueBinding toObject:tree withKeyPath:MPTree4ProtectTitleUndoableKey options:nil]; + [self.protectURLCheckButton bind:NSValueBinding toObject:tree withKeyPath:MPTree4ProtectUrlUndoableKey options:nil]; + [self.protectUserNameCheckButton bind:NSValueBinding toObject:tree withKeyPath:MPTree4ProtectUsernameUndoableKey options:nil]; } else { // Switch to KdbV3 View diff --git a/MacPass/MPInspectorViewController.h b/MacPass/MPInspectorViewController.h index 8f19b4c7..9a3b3713 100644 --- a/MacPass/MPInspectorViewController.h +++ b/MacPass/MPInspectorViewController.h @@ -29,6 +29,7 @@ @property (assign) IBOutlet NSTextField *modifiedTextField; @property (assign) IBOutlet NSSegmentedControl *infoTabControl; @property (assign) IBOutlet NSTableView *attachmentTableView; +@property (assign) IBOutlet NSTableView *customFieldsTableView; @property (assign) IBOutlet NSTextView *notesTextView; @property (assign) IBOutlet NSTextField *customFieldsTextField; diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m index 63f61313..03e36d2a 100644 --- a/MacPass/MPInspectorViewController.m +++ b/MacPass/MPInspectorViewController.m @@ -17,12 +17,15 @@ #import "MPOutlineViewController.h" #import "MPDocument.h" #import "MPCustomFieldView.h" +#import "MPDatabaseVersion.h" +#import "MPCustomFieldTableCellView.h" #import "KdbLib.h" #import "Kdb4Node.h" #import "Kdb3Node.h" #import "KdbGroup+Undo.h" #import "KdbEntry+Undo.h" +#import "Kdb4Entry+KVOAdditions.h" #import "NSMutableData+Base64.h" #import "HNHGradientView.h" @@ -50,7 +53,7 @@ enum { @property (nonatomic, assign) NSUInteger activeTab; @property (assign) IBOutlet NSTabView *tabView; @property (retain) NSArrayController *attachmentsController; -@property (retain) NSMutableArray *customFieldViews; +@property (retain) NSArrayController *customFieldsController; - (IBAction)addCustomField:(id)sender; - (IBAction)removeCustomField:(id)sender; @@ -69,8 +72,8 @@ enum { _selectedEntry = nil; _selectedGroup = nil; _attachmentsController = [[NSArrayController alloc] init]; + _customFieldsController = [[NSArrayController alloc] init]; _activeTab = MPGeneralTab; - _customFieldViews = [[NSMutableArray alloc] initWithCapacity:5]; } return self; } @@ -79,7 +82,7 @@ enum { [[NSNotificationCenter defaultCenter] removeObserver:self]; [_activePopover release]; [_attachmentsController release]; - [_customFieldViews release]; + [_customFieldsController release]; [super dealloc]; } @@ -94,6 +97,8 @@ enum { [_attachmentTableView bind:NSContentBinding toObject:self.attachmentsController withKeyPath:@"arrangedObjects" options:nil]; [_attachmentTableView setDelegate:self]; + [_customFieldsTableView bind:NSContentBinding toObject:self.customFieldsController withKeyPath:@"arrangedObjects" options:nil]; + [_customFieldsTableView setDelegate:self]; [self _clearContent]; } @@ -135,6 +140,7 @@ enum { [self _clearContent]; } [self _updateAttachments]; + [self _updateCustomFields]; } - (void)_updateAttachments { @@ -143,16 +149,24 @@ enum { [self.attachmentsController bind:NSContentArrayBinding toObject:self.selectedEntry withKeyPath:@"binaries" options:nil]; } else { - /* Use binarydes and binary form Kdb3Entry */ + /* Use binary from Kdb3Entry */ } } else if([self.attachmentsController content] != nil){ - [self.attachmentsController unbind:NSContentArrayBinding]; [self.attachmentsController setContent:nil]; } - +} + +- (void)_updateCustomFields { + if(self.selectedEntry && [self.selectedEntry isKindOfClass:[Kdb4Entry class]]) { + [self.customFieldsController bind:NSContentArrayBinding toObject:self.selectedEntry withKeyPath:@"stringFields" options:nil]; + } + else if([self.customFieldsController content] != nil){ + [self.customFieldsController unbind:NSContentArrayBinding]; + [self.customFieldsController setContent:nil]; + } } - (void)_showEntry { @@ -239,8 +253,10 @@ enum { [self.URLTextField setEnabled:enabled]; [self.generatePasswordButton setEnabled:enabled]; - [self.infoTabControl setEnabled:enabled forSegment:MPAttachmentsTab]; [self.infoTabControl setEnabled:enabled forSegment:MPNotesTab]; + [self.infoTabControl setEnabled:enabled forSegment:MPAttachmentsTab]; + + enabled &= [self.selectedEntry isKindOfClass:[Kdb4Entry class]]; [self.infoTabControl setEnabled:enabled forSegment:MPCustomFieldsTab]; } @@ -287,68 +303,14 @@ enum { #pragma mark Actions - (IBAction)addCustomField:(id)sender { - NSArray *topLevelObjects; - BOOL success = [[NSBundle mainBundle] loadNibNamed:@"CustomFieldView" owner:self topLevelObjects:&topLevelObjects]; - if(success) { - id object = [topLevelObjects lastObject]; - MPCustomFieldView *fieldView; - if(![object isKindOfClass:[MPCustomFieldView class]]) { - fieldView = topLevelObjects[0]; - } - else { - fieldView = object; - } - [fieldView.deleteButton setTarget:self]; - NSTabViewItem *tabViewItem = [self.tabView tabViewItemAtIndex:MPCustomFieldsTab]; - - NSView *predecessorView = [self.customFieldViews lastObject]; - if(!predecessorView) { - predecessorView = _customFieldsTextField; - } - - [[tabViewItem view] addSubview:fieldView]; - [self.customFieldViews addObject:fieldView]; - - NSDictionary *views = NSDictionaryOfVariableBindings(fieldView, predecessorView); - [[tabViewItem view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-20-[fieldView]-20-|" - options:0 - metrics:nil - views:views]]; - [[tabViewItem view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[predecessorView]-10-[fieldView]" - options:0 - metrics:nil - views:views]]; - [[tabViewItem view] layoutSubtreeIfNeeded]; - } + Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry; + StringField *stringField = [StringField stringFieldWithKey:@"Key" andValue:@"Value"]; + [entry insertObject:stringField inStringFieldsAtIndex:[entry.stringFields count]]; } - (IBAction)removeCustomField:(id)sender { - NSControl *button = sender; - NSView *fieldView = [button superview]; - - if([self.customFieldViews containsObject:fieldView]) { - [fieldView removeFromSuperview]; - NSUInteger index = [self.customFieldViews indexOfObject:fieldView]; - NSView *newPredecessorView = nil; - NSView *newSuccesorView = nil; - if(index == 0) { - newPredecessorView = _customFieldsTextField; - } - else { - NSAssert(index > 0, @""); - newPredecessorView = [self.customFieldViews objectAtIndex:index - 1]; - } - NSTabViewItem *tabViewItem = [self.tabView tabViewItemAtIndex:MPCustomFieldsTab]; - if(index < [self.customFieldViews count] - 1) { - newSuccesorView = [self.customFieldViews objectAtIndex:index + 1]; - NSDictionary *views = NSDictionaryOfVariableBindings(newPredecessorView, newSuccesorView); - [[tabViewItem view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[newPredecessorView]-10-[newSuccesorView]" - options:0 - metrics:nil - views:views]]; - } - [self.customFieldViews removeObject:fieldView]; - [[tabViewItem view] layoutSubtreeIfNeeded]; - } + NSButton *button = sender; + Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry; + [entry removeObjectFromStringFieldsAtIndex:[button tag]]; } #pragma mark Notificiations @@ -373,7 +335,14 @@ enum { #pragma mark NSTableViewDelegate - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { - NSTableCellView *view = [tableView makeViewWithIdentifier:[tableColumn identifier] owner:tableView]; + if(tableView == self.attachmentTableView) { + return [self _viewForAttachmentTableColumn:tableColumn row:row]; + } + return [self _viewForCustomFieldTableColumn:tableColumn row:row]; +} + +- (NSView *)_viewForAttachmentTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + NSTableCellView *view = [_attachmentTableView makeViewWithIdentifier:[tableColumn identifier] owner:_attachmentTableView]; if([self.selectedEntry isKindOfClass:[Kdb4Entry class]]) { Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry; BinaryRef *binaryRef = entry.binaries[row]; @@ -384,4 +353,19 @@ enum { } return view; } +- (NSView *)_viewForCustomFieldTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + MPCustomFieldTableCellView *view = [_customFieldsTableView makeViewWithIdentifier:[tableColumn identifier] owner:_customFieldsTableView]; + if([self.selectedEntry isKindOfClass:[Kdb4Entry class]]) { + Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry; + StringField *stringField = entry.stringFields[row]; + [view.labelTextField bind:NSValueBinding toObject:stringField withKeyPath:@"key" options:nil]; + [view.valueTextField bind:NSValueBinding toObject:stringField withKeyPath:@"value" options:nil]; + [view.removeButton setTarget:self]; + [view.removeButton setAction:@selector(removeCustomField:)]; + [view.removeButton setTag:row]; + } + return view; +} + + @end diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist index e68024ce..fab8894b 100644 --- a/MacPass/MacPass-Info.plist +++ b/MacPass/MacPass-Info.plist @@ -48,7 +48,7 @@ CFBundleSignature ???? CFBundleVersion - 1354 + 1407 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright diff --git a/MacPass/de.lproj/Localizable.strings b/MacPass/de.lproj/Localizable.strings index 9a3db7db8783b185575e177c9668222f2b84c0a2..f08f5a9eedce50745d79543e0bff8ebdddf08f60 100644 GIT binary patch delta 373 zcmZvYO-chn5QRSoA_^i-6qFDc2C`5WL)H@TXCfp>5=^p|8K>2tP9!mF&mg^V>kR}? z;ND9JIf$=&5kx{$R9E+--dFW@_#J;72Ngrkh-X6OR5>M6OfiJEQLb$!oG?(FD*80- z*XquG;+2NNYYXnBF7)>3bI4p(uKUEkZ&%`F4!*zFOu1$vf+u;87*p78P<{F5$`uJs z`JZt~i=K#Dbm*U9oi z@<1_Eb=E@4`q)eXngKR76=+&ALlMxH0-*Vs4EYRslkU(rn&&l#xRv3ok5Agnt=-l^%=AnLK*Uae#!@`Ms{5) pLmJTir3^Wf&kGrHgKTsI`Yn{fXYy|$O&}j3FE4Dm`Jdn)CIAw$JyQSx delta 12 TcmbQF_e*obH^I$(A}q`RB(Vf{