diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index f9a75edc..52d73aa2 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -13,7 +13,7 @@ 4C1DDCDD1711ECEB00C98DA3 /* PasswordCreatorWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C1DDCDC1711ECEB00C98DA3 /* PasswordCreatorWindow.xib */; }; 4C22040D1746ED160054C916 /* KdbGroup+Undo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C22040C1746ED160054C916 /* KdbGroup+Undo.m */; }; 4C25D58716CF0FAA00F6806C /* EntryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25D58616CF0FAA00F6806C /* EntryView.xib */; }; - 4C2C4C2C16D3BE3700D49295 /* KdbGroup+MPAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C2C4C2B16D3BE3700D49295 /* KdbGroup+MPAdditions.m */; }; + 4C2C4C2C16D3BE3700D49295 /* KdbGroup+MPTreeTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C2C4C2B16D3BE3700D49295 /* KdbGroup+MPTreeTools.m */; }; 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 */; }; @@ -32,6 +32,9 @@ 4C46B88B1706D16E0046109A /* NSData+MPRandomBytes.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C46B88A1706D16E0046109A /* NSData+MPRandomBytes.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 */; }; + 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 */; }; 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 */; }; @@ -141,8 +144,8 @@ 4C22040B1746ED160054C916 /* KdbGroup+Undo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KdbGroup+Undo.h"; sourceTree = ""; }; 4C22040C1746ED160054C916 /* KdbGroup+Undo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KdbGroup+Undo.m"; sourceTree = ""; }; 4C25D58616CF0FAA00F6806C /* EntryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EntryView.xib; sourceTree = ""; }; - 4C2C4C2A16D3BE3700D49295 /* KdbGroup+MPAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KdbGroup+MPAdditions.h"; sourceTree = ""; }; - 4C2C4C2B16D3BE3700D49295 /* KdbGroup+MPAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KdbGroup+MPAdditions.m"; sourceTree = ""; }; + 4C2C4C2A16D3BE3700D49295 /* KdbGroup+MPTreeTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KdbGroup+MPTreeTools.h"; sourceTree = ""; }; + 4C2C4C2B16D3BE3700D49295 /* KdbGroup+MPTreeTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KdbGroup+MPTreeTools.m"; 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 = ""; }; @@ -174,6 +177,12 @@ 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 = ""; }; + 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 = ""; }; + 4C569DA017652BFE00595B62 /* MPEntryTableDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPEntryTableDataSource.m; sourceTree = ""; }; + 4C569DA217653F3500595B62 /* KdbEntry+MPTreeTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KdbEntry+MPTreeTools.h"; sourceTree = ""; }; + 4C569DA317653F3500595B62 /* KdbEntry+MPTreeTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KdbEntry+MPTreeTools.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 = ""; }; @@ -411,12 +420,14 @@ 4C2C4C2516D3BCEA00D49295 /* KeePassLibAdditions */ = { isa = PBXGroup; children = ( - 4C01C23D1764D2980016D5D0 /* KdbEntry+Undo.h */, - 4C01C23E1764D2980016D5D0 /* KdbEntry+Undo.m */, - 4C2C4C2A16D3BE3700D49295 /* KdbGroup+MPAdditions.h */, - 4C2C4C2B16D3BE3700D49295 /* KdbGroup+MPAdditions.m */, + 4C569DA217653F3500595B62 /* KdbEntry+MPTreeTools.h */, + 4C569DA317653F3500595B62 /* KdbEntry+MPTreeTools.m */, + 4C2C4C2A16D3BE3700D49295 /* KdbGroup+MPTreeTools.h */, + 4C2C4C2B16D3BE3700D49295 /* KdbGroup+MPTreeTools.m */, 4CC1AEBC16D4467C006D2AAB /* KdbTree+MPAdditions.h */, 4CC1AEBD16D4467C006D2AAB /* KdbTree+MPAdditions.m */, + 4C01C23D1764D2980016D5D0 /* KdbEntry+Undo.h */, + 4C01C23E1764D2980016D5D0 /* KdbEntry+Undo.m */, 4C22040B1746ED160054C916 /* KdbGroup+Undo.h */, 4C22040C1746ED160054C916 /* KdbGroup+Undo.m */, 4C4A101017629DA900BBF2CA /* KdbGroup+KVOAdditions.h */, @@ -438,6 +449,8 @@ 4C5BF67A175C01F300D53DF7 /* MPUppercaseStringValueTransformer.m */, 4C01C2401764D8980016D5D0 /* MPContextMenuHelper.h */, 4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */, + 4C569D9C17652AC800595B62 /* MPConstants.h */, + 4C569D9D17652B0600595B62 /* MPConstants.m */, ); name = Helper; sourceTree = ""; @@ -462,6 +475,8 @@ children = ( 4C37A83E15B8B474005EF8EE /* MPOutlineDataSource.h */, 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */, + 4C569D9F17652BFE00595B62 /* MPEntryTableDataSource.h */, + 4C569DA017652BFE00595B62 /* MPEntryTableDataSource.m */, 6E719715172058BA00E4C5FC /* MPDatabaseVersion.h */, 4CE5B548173AFBA700207B39 /* MPDocument.h */, 4CE5B549173AFBA700207B39 /* MPDocument.m */, @@ -1001,7 +1016,7 @@ 4CDF01A316D1B76700D0AC08 /* MPEntryViewController.m in Sources */, 4C3BD51516D276F800389F1F /* MPToolbarDelegate.m in Sources */, 4C61EA0316D2FD0800AC519E /* MPOutlineViewController.m in Sources */, - 4C2C4C2C16D3BE3700D49295 /* KdbGroup+MPAdditions.m in Sources */, + 4C2C4C2C16D3BE3700D49295 /* KdbGroup+MPTreeTools.m in Sources */, 4CC1AEBE16D4467C006D2AAB /* KdbTree+MPAdditions.m in Sources */, 4C69A73A16D589DF00EC1B1A /* HNHGradientView.m in Sources */, 4C920E2A16DCDFA00083839B /* MPLoggerProxy.m in Sources */, @@ -1036,6 +1051,9 @@ 4C01C23F1764D2980016D5D0 /* KdbEntry+Undo.m in Sources */, 4C01C2421764D8980016D5D0 /* MPContextMenuHelper.m in Sources */, 4C01C245176500C40016D5D0 /* HNHLevelIndicatorCell.m in Sources */, + 4C569D9E17652B0600595B62 /* MPConstants.m in Sources */, + 4C569DA117652BFE00595B62 /* MPEntryTableDataSource.m in Sources */, + 4C569DA417653F3500595B62 /* KdbEntry+MPTreeTools.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MacPass/Base.lproj/InspectorView.xib b/MacPass/Base.lproj/InspectorView.xib index 402b7847..b28b5790 100644 --- a/MacPass/Base.lproj/InspectorView.xib +++ b/MacPass/Base.lproj/InspectorView.xib @@ -12,8 +12,6 @@ IBNSLayoutConstraint - NSButton - NSButtonCell NSCustomObject NSCustomView NSImageCell @@ -46,7 +44,7 @@ 268 - {{40, 417}, {35, 14}} + {{40, 372}, {35, 14}} @@ -87,7 +85,7 @@ 268 - {{80, 413}, {164, 22}} + {{80, 368}, {124, 22}} @@ -129,7 +127,7 @@ 268 - {{17, 385}, {58, 14}} + {{17, 340}, {58, 14}} @@ -150,7 +148,7 @@ 268 - {{80, 381}, {164, 22}} + {{80, 336}, {124, 22}} @@ -172,7 +170,7 @@ 268 - {{80, 349}, {164, 22}} + {{80, 304}, {124, 22}} @@ -194,7 +192,7 @@ 268 - {{50, 353}, {25, 14}} + {{50, 308}, {25, 14}} @@ -215,7 +213,7 @@ 268 - {{20, 292}, {55, 14}} + {{20, 247}, {55, 14}} @@ -233,34 +231,6 @@ NO - - - 268 - {{212, 286}, {32, 25}} - - - _NS:22 - YES - - 67108864 - 134217728 - - - _NS:22 - - -1228652544 - 163 - - NSImage - NSRefreshTemplate - - - - 400 - 75 - - NO - 268 @@ -272,7 +242,7 @@ NeXT Encapsulated PostScript v1.2 pasteboard type NeXT TIFF v4.0 pasteboard type - {{20, 464}, {48, 48}} + {{20, 419}, {48, 48}} @@ -297,7 +267,7 @@ 268 - {{73, 480}, {136, 17}} + {{73, 435}, {134, 17}} @@ -324,7 +294,7 @@ 268 - {{20, 454}, {224, 2}} + {{20, 409}, {184, 2}} @@ -334,10 +304,10 @@ 268 - {{80, 288}, {124, 22}} + {{80, 243}, {124, 22}} - + _NS:9 YES @@ -354,7 +324,7 @@ NO - {264, 532} + {224, 487} @@ -379,14 +349,6 @@ 112 - - - showPasswordCreator - - - - 520 - titleOrNameLabel @@ -466,27 +428,11 @@ 455 - - - 5 - 0 - - 6 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - 6 0 - + 6 1 @@ -514,22 +460,6 @@ 24 2 - - - 3 - 0 - - 3 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - 5 @@ -578,6 +508,22 @@ 9 3 + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + 6 @@ -610,22 +556,6 @@ 24 3 - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 9 - 40 - 2 - 3 @@ -818,6 +748,22 @@ 24 2 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 10 @@ -898,7 +844,7 @@ 40 3 - + 5 0 @@ -910,11 +856,11 @@ 1000 - 9 - 40 + 8 + 29 3 - + 3 0 @@ -926,8 +872,8 @@ 1000 - 9 - 40 + 8 + 29 3 @@ -935,7 +881,6 @@ - @@ -945,178 +890,13 @@ - - 493 - - - - - 479 - - - - - 478 - - - - - 477 - - - - - 475 - - - - - 474 - - - - - 473 - - - - - 472 - - - - - 471 - - - - - 466 - - - - - - - - 465 - - - - - - - - 464 - - - - - - - - 463 - - - - - - - - 462 - - - - - - - - 461 - - - - - - - - 459 - - - - - - - - 457 - - - - - - 7 - 0 - - 0 - 1 - - 32 - - 1000 - - 3 - 9 - 1 - - - - - - 505 - - - - - 502 - - - - - 500 - - - - - 499 - - - - - 498 - - - - - 497 - - - - - 496 - - - - - 495 - - - 62 - + - 8 + 7 0 0 @@ -1130,9 +910,9 @@ 9 1 - + - 7 + 8 0 0 @@ -1151,14 +931,14 @@ - 109 - - + 651 + + - 110 - - + 650 + + 63 @@ -1166,63 +946,9 @@ - 514 - - - - - 515 - - - - - 100 - - - - - - 7 - 1 - - 0 - 1 - - 130 - - 1000 - - 9 - 40 - 1 - - - - - - 101 - - - - - 516 - - - - - 517 - - - - - 526 - - - - - 529 - - + 109 + + 530 @@ -1247,6 +973,16 @@ + + 547 + + + + + 544 + + + 540 @@ -1258,33 +994,24 @@ - 544 - + 461 + + + + - 547 - - + 500 + + - 556 - - - - - 557 - - - - - 558 - - - - - 559 - + 463 + + + + @@ -1293,15 +1020,132 @@ - 629 - - + 498 + + + + + 466 + + + + + + + + 495 + + + + + 465 + + + + + + + + 556 + + + + + 526 + + + + + 471 + + + + + 558 + + + + + 496 + + + + + 464 + + + + + + + + 475 + + + + + 474 + + + + + 473 + + + + + 472 + + + + + 557 + + + + + 497 + + + + + 462 + + + + + + + + 652 + + 631 + + 479 + + + + + 477 + + + + + 559 + + + + + 499 + + + 635 @@ -1311,13 +1155,8 @@ - 636 - - - - - 638 - + 646 + @@ -1326,13 +1165,21 @@ - 640 - + 638 + - 641 - + 636 + + + + + 459 + + + + @@ -1341,32 +1188,67 @@ - 643 - + 640 + + + 502 + + + + + 100 + + + + + + + + 648 + + + + + 517 + + + + + 516 + + + + + 101 + + + + + 661 + + + 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 - - - + + + + @@ -1379,25 +1261,18 @@ - + - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1418,9 +1293,7 @@ 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 HNHRoundedTextFieldCell com.apple.InterfaceBuilder.CocoaPlugin @@ -1431,13 +1304,9 @@ 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 @@ -1453,13 +1322,12 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin MPPopupImageView - + - + com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1469,15 +1337,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 - 644 + 661 @@ -1592,10 +1464,10 @@ IBCocoaFramework YES 3 - - {128, 128} - {10, 12} - + + NSApplicationIcon + {128, 128} + YES diff --git a/MacPass/EntryView.xib b/MacPass/EntryView.xib index 607d6ed0..0c0cd5c1 100644 --- a/MacPass/EntryView.xib +++ b/MacPass/EntryView.xib @@ -1502,17 +1502,6 @@ MPEntryViewController MPViewController - - _toggleFilterSpace: - id - - - _toggleFilterSpace: - - _toggleFilterSpace: - id - - NSTableView NSView @@ -1522,7 +1511,6 @@ NSButton NSButton NSButton - NSLayoutConstraint NSLayoutConstraint @@ -1558,10 +1546,6 @@ filterUsernameButton NSButton - - tableToBottom - NSLayoutConstraint - tableToTop NSLayoutConstraint diff --git a/MacPass/KdbEntry+MPTreeTools.h b/MacPass/KdbEntry+MPTreeTools.h new file mode 100644 index 00000000..7788cbc1 --- /dev/null +++ b/MacPass/KdbEntry+MPTreeTools.h @@ -0,0 +1,15 @@ +// +// KdbEntry+MPTreeTools.h +// MacPass +// +// Created by Michael Starke on 10.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb.h" + +@interface KdbEntry (MPTreeTools) + +- (NSUInteger)indexInParent; + +@end diff --git a/MacPass/KdbEntry+MPTreeTools.m b/MacPass/KdbEntry+MPTreeTools.m new file mode 100644 index 00000000..0b7c6642 --- /dev/null +++ b/MacPass/KdbEntry+MPTreeTools.m @@ -0,0 +1,20 @@ +// +// KdbEntry+MPTreeTools.m +// MacPass +// +// Created by Michael Starke on 10.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "KdbEntry+MPTreeTools.h" + +@implementation KdbEntry (MPTreeTools) + +- (NSUInteger)indexInParent { + if(self.parent) { + return [self.parent.entries indexOfObject:self]; + } + return NSNotFound; +} + +@end diff --git a/MacPass/KdbEntry+Undo.m b/MacPass/KdbEntry+Undo.m index 108f61b1..dda22d8d 100644 --- a/MacPass/KdbEntry+Undo.m +++ b/MacPass/KdbEntry+Undo.m @@ -7,7 +7,7 @@ // #import "KdbEntry+Undo.h" -#import "KdbGroup+MPAdditions.h" +#import "KdbGroup+MPTreeTools.h" NSString *const MPEntryTitleUndoableKey = @"titleUndoable"; NSString *const MPEntryUsernameUndoableKey = @"usernameUndoable"; diff --git a/MacPass/KdbGroup+MPAdditions.h b/MacPass/KdbGroup+MPAdditions.h deleted file mode 100644 index 250b93cd..00000000 --- a/MacPass/KdbGroup+MPAdditions.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// KdbGroup+MPAdditions.h -// MacPass -// -// Created by michael starke on 19.02.13. -// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. -// - -#import "KdbLib.h" - -@interface KdbGroup (MPAdditions) - -- (NSArray *)childGroups; - -- (NSArray *)childEntries; - -- (void)moveEntry:(KdbEntry *)entry toIndex:(NSUInteger)index; - -@end \ No newline at end of file diff --git a/MacPass/KdbGroup+MPTreeTools.h b/MacPass/KdbGroup+MPTreeTools.h new file mode 100644 index 00000000..5b64b4a2 --- /dev/null +++ b/MacPass/KdbGroup+MPTreeTools.h @@ -0,0 +1,21 @@ +// +// KdbGroup+MPTreeTools.h +// MacPass +// +// Created by michael starke on 19.02.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "Kdb.h" +@class UUID; + +@interface KdbGroup (MPTreeTools) + +/* Returns all groups under this group and it's subgroups */ +- (NSArray *)childGroups; +/* Returns all entries under this group and it's subgroups */ +- (NSArray *)childEntries; + +- (KdbEntry *)entryForUUID:(UUID *)uuid; + +@end \ No newline at end of file diff --git a/MacPass/KdbGroup+MPAdditions.m b/MacPass/KdbGroup+MPTreeTools.m similarity index 59% rename from MacPass/KdbGroup+MPAdditions.m rename to MacPass/KdbGroup+MPTreeTools.m index b6924616..157e174c 100644 --- a/MacPass/KdbGroup+MPAdditions.m +++ b/MacPass/KdbGroup+MPTreeTools.m @@ -1,14 +1,16 @@ // -// KdbGroup+MPAdditions.m +// KdbGroup+MPTreeTools.m // MacPass // // Created by michael starke on 19.02.13. // Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. // -#import "KdbGroup+MPAdditions.h" +#import "KdbGroup+MPTreeTools.h" +#import "Kdb4Node.h" +#import "Kdb3Node.h" -@implementation KdbGroup (MPAdditions) +@implementation KdbGroup (MPTreeTools) - (NSArray *)childGroups { NSMutableArray *childGroups = [NSMutableArray arrayWithCapacity:[self.groups count]]; @@ -27,15 +29,11 @@ return childEntries; } -- (void)moveEntry:(KdbEntry *)entry toIndex:(NSUInteger)index { - if([entries count] > index) { - return; - } - NSUInteger oldIndex = [entries indexOfObject:entry]; - if(oldIndex == NSNotFound) { - return; - } - [entries exchangeObjectAtIndex:oldIndex withObjectAtIndex:index]; +- (KdbEntry *)entryForUUID:(UUID *)uuid { + NSArray *childEntries = [self childEntries]; + NSArray *filterdEntries = [childEntries filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { + return [uuid isEqual:(UUID *)[evaluatedObject uuid]]; + }]]; + return [filterdEntries lastObject]; } - @end \ No newline at end of file diff --git a/MacPass/KdbTree+MPAdditions.m b/MacPass/KdbTree+MPAdditions.m index efa0e35a..dd7b1fbf 100644 --- a/MacPass/KdbTree+MPAdditions.m +++ b/MacPass/KdbTree+MPAdditions.m @@ -7,7 +7,7 @@ // #import "KdbTree+MPAdditions.h" -#import "KdbGroup+MPAdditions.h" +#import "KdbGroup+MPTreeTools.h" @implementation KdbTree (MPAdditions) diff --git a/MacPass/MPConstants.h b/MacPass/MPConstants.h new file mode 100644 index 00000000..69c418ab --- /dev/null +++ b/MacPass/MPConstants.h @@ -0,0 +1,16 @@ +// +// MPConstants.h +// MacPass +// +// Created by Michael Starke on 09.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#ifndef MacPass_MPConstants_h +#define MacPass_MPConstants_h + +#import + +FOUNDATION_EXPORT NSString *const MPPasteBoardType; + +#endif diff --git a/MacPass/MPConstants.m b/MacPass/MPConstants.m new file mode 100644 index 00000000..a4c3e061 --- /dev/null +++ b/MacPass/MPConstants.m @@ -0,0 +1,11 @@ +// +// MPConstants.m +// MacPass +// +// Created by Michael Starke on 09.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "MPConstants.h" + +NSString *const MPPasteBoardType = @"com.hicknhack.macpass.pasteboard"; diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index daa6e05c..72c6062f 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -43,4 +43,6 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; - (void)moveGroup:(KdbGroup *)group toGroup:(KdbGroup *)target index:(NSInteger)index; - (BOOL)group:(KdbGroup *)group isMoveableToGroup:(KdbGroup *)target; +- (void)moveEntry:(KdbEntry *)entry toGroup:(KdbGroup *)target index:(NSInteger)index; + @end diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 67ffc746..676b561b 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -184,4 +184,19 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } return isMovable; } + +- (void)moveEntry:(KdbEntry *)entry toGroup:(KdbGroup *)target index:(NSInteger)index { + NSInteger oldIndex = [entry.parent.entries indexOfObject:entry]; + if(entry.parent == target && oldIndex == index) { + return; // No changes + } + [[[self undoManager] prepareWithInvocationTarget:self] moveEntry:entry toGroup:entry.parent index:oldIndex]; + [[self undoManager] setActionName:@"MOVE_ENTRY"]; + [entry.parent removeObjectFromEntriesAtIndex:oldIndex]; + if(index < 0 || index > [target.groups count] ) { + index = [target.groups count]; + } + [target insertObject:entry inEntriesAtIndex:index]; +} + @end diff --git a/MacPass/MPDocumentWindowController.h b/MacPass/MPDocumentWindowController.h index f8e44d1c..c61f1f2a 100644 --- a/MacPass/MPDocumentWindowController.h +++ b/MacPass/MPDocumentWindowController.h @@ -17,7 +17,10 @@ @class MPCreationViewController; -@interface MPDocumentWindowController : NSWindowController +@interface MPDocumentWindowController : NSWindowController { +@private + NSArray *_inspectorContraints; +} @property (readonly, retain) MPPasswordInputController *passwordInputController; @property (readonly, retain) MPPasswordEditViewController *passwordEditController; @@ -34,4 +37,6 @@ - (IBAction)editPassword:(id)sender; - (void)lock:(id)sender; +- (void)toggleInspector:(id)sender; + @end diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 31b1888b..e9d6a996 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -34,8 +34,6 @@ @property (retain) MPToolbarDelegate *toolbarDelegate; -- (void)_setContentViewController:(MPViewController *)viewController; - @end @implementation MPDocumentWindowController @@ -69,7 +67,6 @@ } #pragma mark View Handling - - (void)windowDidLoad { [super windowDidLoad]; @@ -90,7 +87,8 @@ [_splitView setHoldingPriority:NSLayoutPriorityDefaultLow+2 forSubviewAtIndex:0]; [_splitView setHoldingPriority:NSLayoutPriorityDefaultLow+1 forSubviewAtIndex:2]; - //TODO: Fix setup on start + [_splitView setDelegate:self]; + MPDocument *document = [self document]; if(!document.isDecrypted) { [self showPasswordInput]; @@ -100,6 +98,10 @@ } } +- (BOOL)splitView:(NSSplitView *)splitView shouldHideDividerAtIndex:(NSInteger)dividerIndex { + return NO; +} + - (void)_setContentViewController:(MPViewController *)viewController { NSView *newContentView = nil; @@ -172,6 +174,10 @@ [self showPasswordInput]; } +- (void)toggleInspector:(id)sender { + +} + - (void)showEntries { NSView *contentView = [[self window] contentView]; if(_splitView == contentView) { diff --git a/MacPass/MPEntryTableDataSource.h b/MacPass/MPEntryTableDataSource.h new file mode 100644 index 00000000..817c814c --- /dev/null +++ b/MacPass/MPEntryTableDataSource.h @@ -0,0 +1,16 @@ +// +// MPEntyTableDataSource.h +// MacPass +// +// Created by Michael Starke on 09.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import + +@class MPEntryViewController; +@interface MPEntryTableDataSource : NSObject + +@property (assign, nonatomic) MPEntryViewController *viewController; + +@end diff --git a/MacPass/MPEntryTableDataSource.m b/MacPass/MPEntryTableDataSource.m new file mode 100644 index 00000000..09ed6610 --- /dev/null +++ b/MacPass/MPEntryTableDataSource.m @@ -0,0 +1,42 @@ +// +// MPEntyTableDataSource.m +// MacPass +// +// Created by Michael Starke on 09.06.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "MPEntryTableDataSource.h" +#import "MPEntryViewController.h" +#import "UUID.h" +#import "MPConstants.h" + +@interface MPEntryTableDataSource () + +@end + +@implementation MPEntryTableDataSource + +- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard { + + if([rowIndexes count] != 1) { + return NO; // No valid drag + } + + id entry = [self.viewController.entryArrayController arrangedObjects][[rowIndexes firstIndex]]; + + if(![entry respondsToSelector:@selector(uuid)]) { + return NO; // Invalid item for dragging + } + UUID *uuid = (UUID *)[entry uuid]; + NSPasteboardItem *pBoardItem = [[NSPasteboardItem alloc] init]; + [pBoardItem setString:[uuid description] forType:MPPasteBoardType]; + [pboard writeObjects:@[pBoardItem]]; + [pBoardItem release]; + + return YES; +} + +//TODO: Validation and adding + +@end diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 78b307e3..4b1caf04 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -15,10 +15,12 @@ #import "MPDocumentWindowController.h" #import "MPPasteBoardController.h" #import "MPOverlayWindowController.h" -#import "KdbGroup+MPAdditions.h" +#import "KdbGroup+MPTreeTools.h" #import "KdbGroup+Undo.h" #import "KdbEntry+Undo.h" #import "MPContextMenuHelper.h" +#import "MPConstants.h" +#import "MPEntryTableDataSource.h" NSString *const MPDidChangeSelectedEntryNotification = @"com.macpass.MPDidChangeSelectedEntryNotification"; @@ -68,6 +70,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; @property (assign) KdbEntry *selectedEntry; +@property (nonatomic, retain) MPEntryTableDataSource *dataSource; @property (assign, nonatomic) MPFilterModeType filterMode; @property (retain, nonatomic) NSDictionary *filterButtonToMode; @@ -90,6 +93,8 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; _toggleFilterURLButton : @(MPFilterUrls) } retain]; _entryArrayController = [[NSArrayController alloc] init]; + _dataSource = [[MPEntryTableDataSource alloc] init]; + _dataSource.viewController = self; _selectedEntry = nil; } return self; @@ -103,6 +108,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; self.filterBar = nil; self.tableToTop = nil; self.filterButtonToMode = nil; + self.dataSource = nil; [super dealloc]; } @@ -120,6 +126,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; [self.entryTable setDoubleAction:@selector(_columnDoubleClick:)]; [self.entryTable setTarget:self]; [self.entryTable setFloatsGroupRows:NO]; + [self.entryTable registerForDraggedTypes:@[MPPasteBoardType]]; [self _setupEntryMenu]; NSTableColumn *parentColumn = [self.entryTable tableColumns][0]; @@ -150,6 +157,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; [self.entryTable bind:NSContentBinding toObject:self.entryArrayController withKeyPath:@"arrangedObjects" options:nil]; [self.entryTable bind:NSSortDescriptorsBinding toObject:self.entryArrayController withKeyPath:@"sortDescriptors" options:nil]; + [self.entryTable setDataSource:_dataSource]; [parentColumn setHidden:YES]; } @@ -197,7 +205,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; } - (void)tableViewSelectionDidChange:(NSNotification *)notification { - if([self.entryTable selectedRow] < 0) { + if([self.entryTable selectedRow] < 0 || [[_entryTable selectedRowIndexes] count] > 1) { self.selectedEntry = nil; } else { diff --git a/MacPass/MPGeneralSettingsController.m b/MacPass/MPGeneralSettingsController.m index a06f80a3..88fbb072 100644 --- a/MacPass/MPGeneralSettingsController.m +++ b/MacPass/MPGeneralSettingsController.m @@ -11,12 +11,6 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab"; -@interface MPGeneralSettingsController () - -- (void)didLoadView; - -@end - @implementation MPGeneralSettingsController + (NSString *)identifier { diff --git a/MacPass/MPOutlineDataSource.h b/MacPass/MPOutlineDataSource.h index 6938abe4..abd4252e 100644 --- a/MacPass/MPOutlineDataSource.h +++ b/MacPass/MPOutlineDataSource.h @@ -8,8 +8,6 @@ #import -APPKIT_EXTERN NSString *const MPPasteBoardType; - @class KdbGroup; @interface MPOutlineDataSource : NSObject { diff --git a/MacPass/MPOutlineDataSource.m b/MacPass/MPOutlineDataSource.m index 4ddf0a4e..f83edad0 100644 --- a/MacPass/MPOutlineDataSource.m +++ b/MacPass/MPOutlineDataSource.m @@ -10,8 +10,10 @@ #import "MPDocument.h" #import "KdbLib.h" #import "KdbGroup+Undo.h" - -NSString *const MPPasteBoardType = @"com.hicknhack.macpass.pasteboard"; +#import "KdbGroup+MPTreeTools.h" +#import "KdbEntry+MPTreeTools.h" +#import "MPConstants.h" +#import "UUID.h" @implementation MPOutlineDataSource @@ -43,23 +45,48 @@ NSString *const MPPasteBoardType = @"com.hicknhack.macpass.pasteboard"; return NSDragOperationMove; } } + NSPasteboard *pasteBoard = [info draggingPasteboard]; + NSArray *items = [pasteBoard pasteboardItems]; + if([items count] > 0) { + if( index != NSOutlineViewDropOnItemIndex ) { + [outlineView setDropItem:item dropChildIndex:NSOutlineViewDropOnItemIndex]; + } + return NSDragOperationMove; + } return NSDragOperationNone; } - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id)info item:(id)item childIndex:(NSInteger)index { - NSLog(@"Drag %@ to: %@ index: %ld", _draggedItem, [item representedObject], index); KdbGroup *target = [item representedObject]; - BOOL accepted = YES; - if( _draggedItem.parent == target ) { - accepted &= index != NSOutlineViewDropOnItemIndex; - accepted &= index != [_draggedItem.parent.groups indexOfObject:_draggedItem]; + if(_draggedItem) { + BOOL accepted = YES; + if( _draggedItem.parent == target ) { + accepted &= index != NSOutlineViewDropOnItemIndex; + accepted &= index != [_draggedItem.parent.groups indexOfObject:_draggedItem]; + } + MPDocument *document = [[[outlineView window] windowController] document]; + accepted = [document group:_draggedItem isMoveableToGroup:target]; + if( accepted ) { + [document moveGroup:_draggedItem toGroup:target index:index]; + } + info.animatesToDestination = !accepted; + return accepted; } - MPDocument *document = [[[outlineView window] windowController] document]; - accepted = [document group:_draggedItem isMoveableToGroup:target]; - if( accepted ) { - [document moveGroup:_draggedItem toGroup:target index:index]; + NSPasteboard *pasteBoard = [info draggingPasteboard]; + NSArray *items = [pasteBoard pasteboardItems]; + if([items count] > 0) { + NSPasteboardItem *item = items[0]; + UUID *uuid = [[UUID alloc] initWithString:[item stringForType:MPPasteBoardType]]; + MPDocument *document = [[[outlineView window] windowController] document]; + KdbGroup *rootGroup = [document root]; + KdbEntry *draggedEntry = [rootGroup entryForUUID:uuid]; + if(draggedEntry) { + if(draggedEntry.parent != target && index == NSOutlineViewDropOnItemIndex) { + [document moveEntry:draggedEntry toGroup:target index:index]; + return YES; + } + } } - info.animatesToDestination = !accepted; - return accepted; + return NO; } @end diff --git a/MacPass/MPOutlineViewController.m b/MacPass/MPOutlineViewController.m index b46dbf9c..7c572490 100644 --- a/MacPass/MPOutlineViewController.m +++ b/MacPass/MPOutlineViewController.m @@ -14,6 +14,7 @@ #import "KdbLib.h" #import "KdbGroup+Undo.h" #import "MPContextMenuHelper.h" +#import "MPConstants.h" @interface MPOutlineViewController () { diff --git a/MacPass/MPPasswordInputController.m b/MacPass/MPPasswordInputController.m index 9ddebe24..3c0b1c95 100644 --- a/MacPass/MPPasswordInputController.m +++ b/MacPass/MPPasswordInputController.m @@ -20,8 +20,6 @@ @property (assign) IBOutlet NSTextField *errorInfoTextField; - (IBAction)_decrypt:(id)sender; -- (void)_showError; -- (void)_reset; @end diff --git a/MacPass/MPPasteBoardController.m b/MacPass/MPPasteBoardController.m index 9272efc5..dbe8819f 100644 --- a/MacPass/MPPasteBoardController.m +++ b/MacPass/MPPasteBoardController.m @@ -13,10 +13,6 @@ @property (assign) BOOL isEmpty; -- (void)_clearPasteboardContents; -- (void)_setupBindings; -- (void)_updateNotifications; - @end @implementation MPPasteBoardController diff --git a/MacPass/MPSettingsHelper.m b/MacPass/MPSettingsHelper.m index 14ce2e60..2a0e269d 100644 --- a/MacPass/MPSettingsHelper.m +++ b/MacPass/MPSettingsHelper.m @@ -12,12 +12,6 @@ NSString *const kMPSettingsKeyPasteboardClearTimeout = @"ClipboardClearTimeout"; NSString *const kMPSettingsKeyClearPasteboardOnQuit = @"ClearClipboardOnQuit"; NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch"; -@interface MPSettingsHelper () - -+ (NSDictionary *)_standardDefaults; - -@end - @implementation MPSettingsHelper + (void)setupDefaults { diff --git a/MacPass/MPSettingsWindowController.m b/MacPass/MPSettingsWindowController.m index 9978a890..c0cf9609 100644 --- a/MacPass/MPSettingsWindowController.m +++ b/MacPass/MPSettingsWindowController.m @@ -15,10 +15,6 @@ @property (retain, nonatomic) NSMutableDictionary *settingsController; @property (retain, nonatomic) NSMutableDictionary *toolbarItems; -- (void)_addSettingsTab:(id)tabController; -- (void)_setupDefaultSettingsTabs; -- (void)_showSettingsTab:(id)sender; - @end @implementation MPSettingsWindowController diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist index efe94e2d..06dec301 100644 --- a/MacPass/MacPass-Info.plist +++ b/MacPass/MacPass-Info.plist @@ -48,7 +48,7 @@ CFBundleSignature ???? CFBundleVersion - B23 + B85 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright