From bfc610a25e7a626f8141076ddf657c0ca5189107 Mon Sep 17 00:00:00 2001 From: michael starke Date: Thu, 18 Jul 2013 04:21:23 +0200 Subject: [PATCH] Added "reopen last database" featuer Removed standard open new db on activate Enabled windows state restoration Enabled table column state restoration Menu items should be validated better --- MacPass.xcodeproj/project.pbxproj | 8 +- MacPass/Base.lproj/GeneralSettings.xib | 486 +++++++++-------------- MacPass/Base.lproj/PasswordInputView.xib | 54 +-- MacPass/DatabaseSettingsWindow.xib | 120 +++--- MacPass/MPAppDelegate.m | 32 +- MacPass/MPDocument.m | 10 +- MacPass/MPDocumentWindowController.h | 2 +- MacPass/MPDocumentWindowController.m | 15 +- MacPass/MPGeneralSettingsController.h | 1 + MacPass/MPGeneralSettingsController.m | 2 + MacPass/MPSettingsHelper.h | 1 + MacPass/MPSettingsHelper.m | 2 + MacPass/MacPass-Info.plist | 4 +- MacPass/de.lproj/GeneralSettings.strings | 48 ++- MacPass/en.lproj/GeneralSettings.strings | 40 +- 15 files changed, 387 insertions(+), 438 deletions(-) diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index a2228ec5..1b50fdcc 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -494,7 +494,6 @@ 4C76156B1764C0C80015A1A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PasswordInputView.xib; sourceTree = ""; }; 4C76156C1764C0CC0015A1A6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/PasswordInputView.strings; sourceTree = ""; }; 4C7615701764C0E80015A1A6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/InspectorView.xib; sourceTree = ""; }; - 4C7615721764C4A40015A1A6 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/GeneralSettings.strings; sourceTree = ""; }; 4C7615751764C4A40015A1A6 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/PasswordInputView.strings; sourceTree = ""; }; 4C7615771764C4A40015A1A6 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; 4C7615781764C4A50015A1A6 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = de; path = de.lproj/Credits.rtf; sourceTree = ""; }; @@ -550,7 +549,6 @@ 4CA0B30D15BCB6FD00654E32 /* MPSettingsTab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPSettingsTab.h; sourceTree = ""; }; 4CA0E3A5176FAF99004D18CB /* MPDocumentQueryService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocumentQueryService.h; sourceTree = ""; }; 4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentQueryService.m; sourceTree = ""; }; - 4CA23357176DB8F000F0B6AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/GeneralSettings.strings; sourceTree = ""; }; 4CA23358176DBFE100F0B6AC /* MPLockDaemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLockDaemon.h; sourceTree = ""; }; 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPLockDaemon.m; sourceTree = ""; }; 4CAAFDD51787AED60013FCF9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/MainMenu.strings; sourceTree = ""; }; @@ -591,6 +589,8 @@ 4CC6727B1781D0D2006DEDCF /* KdbEntry+MPAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KdbEntry+MPAdditions.m"; sourceTree = ""; }; 4CC7EA1917807E7E0089D4F3 /* HNHRoundendTextFieldCellHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHRoundendTextFieldCellHelper.h; sourceTree = ""; }; 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 = ""; }; 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 = ""; }; @@ -1826,8 +1826,8 @@ isa = PBXVariantGroup; children = ( 4C76155F1764C0590015A1A6 /* Base */, - 4C7615721764C4A40015A1A6 /* de */, - 4CA23357176DB8F000F0B6AC /* en */, + 4CCA7EEC1797866F00B0B55E /* de */, + 4CCA7EEE1797867200B0B55E /* en */, ); name = GeneralSettings.xib; sourceTree = ""; diff --git a/MacPass/Base.lproj/GeneralSettings.xib b/MacPass/Base.lproj/GeneralSettings.xib index df3c63c2..c88545b0 100644 --- a/MacPass/Base.lproj/GeneralSettings.xib +++ b/MacPass/Base.lproj/GeneralSettings.xib @@ -48,7 +48,7 @@ 268 - {{18, 174}, {233, 18}} + {{18, 177}, {241, 18}} @@ -56,9 +56,9 @@ {250, 252} YES - -1543503872 + -2080374784 268435456 - Open empty database on activate + Reopen last Database after Launch LucidaGrande 13 @@ -82,34 +82,6 @@ NO - - - 268 - {{18, 194}, {226, 18}} - - - - _NS:9 - {250, 253} - YES - - -1543503872 - 268435456 - Open empty database on launch - - _NS:9 - - 1211912448 - 2 - - - - - 200 - 25 - - NO - 12 @@ -121,7 +93,7 @@ 268 - {{15, 96}, {170, 17}} + {{15, 96}, {124, 17}} @@ -158,7 +130,7 @@ 268 - {{237, 92}, {112, 23}} + {{179, 92}, {170, 23}} @@ -200,7 +172,7 @@ - 10 Seconds + after 10 Seconds 1048576 2147483647 @@ -212,7 +184,7 @@ - 30 Seconds + after 30 Seconds 1048576 2147483647 @@ -224,7 +196,7 @@ - 1 Minute + after 1 Minute 1048576 2147483647 @@ -248,7 +220,7 @@ 268 - {{16, 70}, {172, 18}} + {{31, 72}, {172, 18}} @@ -276,7 +248,7 @@ 268 - {{237, 32}, {112, 26}} + {{179, 33}, {170, 26}} @@ -360,7 +332,7 @@ 268 - {{16, 12}, {122, 18}} + {{31, 12}, {122, 18}} _NS:9 @@ -386,7 +358,7 @@ 268 - {{18, 38}, {98, 17}} + {{15, 38}, {98, 17}} @@ -453,7 +425,7 @@ {400, 230} - + NSView @@ -499,6 +471,14 @@ 810 + + + reopenLastDatabase + + + + 878 + @@ -530,6 +510,22 @@ 1 + + + 3 + 0 + + 3 + 1 + + 74 + + 1000 + + 3 + 9 + 3 + 4 @@ -546,38 +542,6 @@ 29 3 - - - 4 - 1 - - 4 - 1 - - 20 - - 1000 - - 9 - 40 - 3 - - - - 3 - 0 - - 4 - 1 - - 20 - - 1000 - - 9 - 40 - 3 - 6 @@ -610,56 +574,24 @@ 40 3 - + 3 0 - - 4 - 1 - - 6 - - 1000 - - 9 - 40 - 3 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 3 - 0 3 1 - - 20 + + 37 1000 - 9 - 40 + 3 + 9 3 - - + + 5 0 @@ -708,7 +640,6 @@ - @@ -716,7 +647,23 @@ 465 - + + + 6 + 0 + + 6 + 1 + + 16 + + 1000 + + 8 + 29 + 3 + + 4 0 @@ -724,7 +671,7 @@ 4 1 - 32 + 33 1000 @@ -733,10 +680,10 @@ 3 - + 5 0 - + 5 1 @@ -748,11 +695,11 @@ 24 2 - + 6 0 - + 6 1 @@ -780,37 +727,21 @@ 24 2 - - + + 5 0 - - 6 + + 5 1 - 57 + 0.0 1000 - 9 - 40 - 3 - - - - 6 - 0 - - 6 - 1 - - 16 - - 1000 - - 9 - 40 - 3 + 6 + 24 + 2 @@ -845,7 +776,7 @@ 3 - + 5 0 @@ -860,12 +791,12 @@ 29 3 - + - 11 + 10 0 - 11 + 10 1 0.0 @@ -876,15 +807,15 @@ 24 2 - - + + 5 0 5 1 - 19 + 31 1000 @@ -892,36 +823,20 @@ 9 3 - + 3 0 4 1 - - 10 + + 8 1000 - 9 - 40 - 3 - - - - 5 - 0 - - 5 - 1 - - 16 - - 1000 - - 8 - 29 + 6 + 24 3 @@ -973,11 +888,11 @@ 3 - + + - @@ -1020,7 +935,7 @@ - + 7 0 @@ -1028,7 +943,7 @@ 0 1 - 107 + 165 1000 @@ -1112,34 +1027,6 @@ - - 506 - - - - - 509 - - - - - 526 - - - - - - - - 527 - - - - - 528 - - - 530 @@ -1158,16 +1045,6 @@ - - 535 - - - - - 536 - - - 584 @@ -1210,16 +1087,6 @@ - - 660 - - - - - 664 - - - 630 @@ -1233,26 +1100,6 @@ - - 706 - - - - - 708 - - - - - 718 - - - - - 759 - - - 773 @@ -1288,11 +1135,6 @@ - - 802 - - - 803 @@ -1317,40 +1159,80 @@ - 807 - + 788 + - 808 - - - - - 537 - - - - - 721 - - - - - 800 + 840 - 799 + 845 + + + + + 846 + + + + + 847 - 788 - + 861 + + + 862 + + + + + 867 + + + + + 868 + + + + + 870 + + + + + 871 + + + + + 873 + + + + + 875 + + + + + 876 + + + + + 877 + + + @@ -1360,21 +1242,18 @@ - - - + - - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin @@ -1400,38 +1279,28 @@ - - - - + + + - - + - + - + + 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 @@ -1442,36 +1311,38 @@ 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 + 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 - 814 + 878 @@ -1483,6 +1354,7 @@ NSPopUpButton NSPopUpButton NSButton + NSButton @@ -1501,6 +1373,10 @@ lockOnSleepCheckButton NSButton + + reopenLastDatabase + NSButton + IBProjectSource diff --git a/MacPass/Base.lproj/PasswordInputView.xib b/MacPass/Base.lproj/PasswordInputView.xib index 3e034fd0..428561c5 100644 --- a/MacPass/Base.lproj/PasswordInputView.xib +++ b/MacPass/Base.lproj/PasswordInputView.xib @@ -286,7 +286,7 @@ 268 - {{281, 65}, {83, 32}} + {{320, 65}, {83, 32}} _NS:9 @@ -526,6 +526,22 @@ 24 2 + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + 3 @@ -542,22 +558,6 @@ 24 3 - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - 4 @@ -804,9 +804,9 @@ - + @@ -1027,11 +1027,6 @@ - - 465 - - - 286 @@ -1105,13 +1100,18 @@ + + 496 + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - + @@ -1127,8 +1127,8 @@ - + @@ -1187,7 +1187,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 @@ -1200,12 +1199,13 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin - 495 + 497 diff --git a/MacPass/DatabaseSettingsWindow.xib b/MacPass/DatabaseSettingsWindow.xib index d3af97c9..b2d09649 100644 --- a/MacPass/DatabaseSettingsWindow.xib +++ b/MacPass/DatabaseSettingsWindow.xib @@ -53,7 +53,7 @@ NSApplication - 15 + 7 2 {{196, 240}, {546, 293}} 1618477056 @@ -99,13 +99,13 @@ {{13, 41}, {520, 246}} - + _NS:9 1 - + 256 @@ -113,6 +113,7 @@ 268 {{136, 148}, {280, 22}} + _NS:9 YES @@ -150,6 +151,7 @@ 268 {{50, 121}, {81, 17}} + _NS:1535 YES @@ -183,6 +185,7 @@ 268 {{25, 151}, {106, 17}} + _NS:1535 YES @@ -209,9 +212,29 @@ 2322 + + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + public.url + {278, 121} - + + _NS:13 @@ -273,6 +296,7 @@ {{1, 1}, {278, 121}} + _NS:11 @@ -303,7 +327,8 @@ 256 {{263, 1}, {16, 121}} - + + _NS:83 NO @@ -315,6 +340,7 @@ -2147483392 {{-100, -100}, {87, 18}} + _NS:33 NO @@ -327,7 +353,8 @@ {{136, 17}, {280, 123}} - + + _NS:9 133138 @@ -339,6 +366,8 @@ {{10, 33}, {500, 200}} + + _NS:11 @@ -354,7 +383,7 @@ 268 - {{69, 126}, {68, 17}} + {{111, 125}, {68, 17}} _NS:1535 @@ -378,7 +407,7 @@ Apple URL pasteboard type NSFilenamesPboardType - {{139, 92}, {170, 26}} + {{181, 91}, {170, 26}} _NS:9 @@ -402,7 +431,7 @@ 268 - {{86, 96}, {51, 17}} + {{128, 95}, {51, 17}} _NS:1535 @@ -422,9 +451,9 @@ 268 - {{142, 69}, {164, 19}} + {{184, 68}, {164, 19}} - + _NS:9 YES @@ -450,7 +479,7 @@ 268 - {{314, 122}, {31, 25}} + {{356, 121}, {31, 25}} _NS:22 @@ -478,7 +507,7 @@ 268 - {{314, 91}, {31, 25}} + {{356, 90}, {31, 25}} _NS:22 @@ -506,7 +535,7 @@ 268 - {{142, 124}, {164, 22}} + {{184, 123}, {164, 22}} _NS:9 @@ -685,7 +714,7 @@ - + 256 @@ -693,7 +722,6 @@ 268 {{15, 154}, {307, 18}} - _NS:9 YES @@ -720,7 +748,6 @@ 268 {{15, 55}, {138, 18}} - _NS:9 YES @@ -747,7 +774,6 @@ 268 {{57, 32}, {187, 18}} - _NS:9 YES @@ -774,7 +800,6 @@ 268 {{56, 128}, {94, 17}} - _NS:1535 YES @@ -795,7 +820,6 @@ 268 {{56, 103}, {142, 17}} - _NS:1535 YES @@ -816,7 +840,6 @@ 268 {{201, 98}, {122, 26}} - _NS:9 YES @@ -892,7 +915,6 @@ 268 {{203, 126}, {96, 22}} - _NS:9 YES @@ -914,7 +936,6 @@ 268 {{304, 123}, {19, 27}} - _NS:1099 YES @@ -934,7 +955,6 @@ 268 {{157, 51}, {220, 26}} - _NS:9 {750, 750} @@ -968,8 +988,6 @@ {{10, 33}, {500, 200}} - - Advanced @@ -977,13 +995,13 @@ - + 0 YES YES - + @@ -1017,7 +1035,7 @@ - {{0, 0}, {1680, 1028}} + {{0, 0}, {1920, 1058}} {10000000000000, 10000000000000} YES @@ -2647,7 +2665,7 @@ 24 3 - + 3 0 @@ -2655,7 +2673,7 @@ 3 1 - 54 + 55 1000 @@ -2743,7 +2761,7 @@ 24 2 - + 5 0 @@ -2751,7 +2769,7 @@ 5 1 - 72 + 114 1000 @@ -2762,10 +2780,10 @@ - - + + @@ -2944,11 +2962,6 @@ - - 869 - - - 956 @@ -3102,11 +3115,6 @@ - - 1045 - - - 1046 @@ -3187,6 +3195,16 @@ + + 1079 + + + + + 1080 + + + @@ -3220,7 +3238,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 @@ -3237,6 +3254,8 @@ 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 @@ -3395,14 +3414,14 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - + + - + @@ -3449,7 +3468,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 @@ -3464,7 +3482,7 @@ - 1078 + 1080 diff --git a/MacPass/MPAppDelegate.m b/MacPass/MPAppDelegate.m index ab22ef52..9ea5bc23 100644 --- a/MacPass/MPAppDelegate.m +++ b/MacPass/MPAppDelegate.m @@ -38,17 +38,29 @@ [MPStringLengthValueTransformer registerTransformer]; } +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender { return [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyOpenEmptyDatabaseOnLaunch]; } + +- (void)applicationWillFinishLaunching:(NSNotification *)notification { + BOOL reopen = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyReopenLastDatabaseOnLaunch]; + if(reopen) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(_applicationDidFinishRestoringWindows:) + name:NSApplicationDidFinishRestoringWindowsNotification + object:nil]; + + } +} + - (void)applicationDidFinishLaunching:(NSNotification *)notification { serverDaemon = [[MPServerDaemon alloc] init]; lockDaemon = [[MPLockDaemon alloc] init]; - NSUInteger openDocs = [[[NSDocumentController sharedDocumentController] documents] count]; - if(openDocs == 0) { - NSLog(@"Do something!"); - } } - (NSString *)applicationName { @@ -96,4 +108,16 @@ } } +- (void)_applicationDidFinishRestoringWindows:(NSNotification *)notification { + NSDocumentController *documentController = [NSDocumentController sharedDocumentController]; + NSArray *documents = [documentController documents]; + NSArray *recentDocuments = [documentController recentDocumentURLs]; + if([documents count] == 0 && [recentDocuments count] > 0) { + NSURL *url = recentDocuments[0]; + [documentController openDocumentWithContentsOfURL:url display:YES completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) { + // do nothing + }]; + } +} + @end diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index e1cb15b9..37b55bea 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -263,7 +263,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; - (Kdb3Tree *)treeV3 { switch (_version) { case MPDatabaseVersion3: - NSAssert([self.tree isKindOfClass:[Kdb3Tree class]], @"Tree has to be Version3"); + NSAssert(self.tree == nil || [self.tree isKindOfClass:[Kdb3Tree class]], @"Tree has to be Version3"); return (Kdb3Tree *)self.tree; case MPDatabaseVersion4: return nil; @@ -277,7 +277,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; case MPDatabaseVersion3: return nil; case MPDatabaseVersion4: - NSAssert([self.tree isKindOfClass:[Kdb4Tree class]], @"Tree has to be Version4"); + NSAssert(self.tree == nil || [self.tree isKindOfClass:[Kdb4Tree class]], @"Tree has to be Version4"); return (Kdb4Tree *)self.tree; default: return nil; @@ -454,13 +454,13 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } } -- (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - if([menuItem action] == [MPActionHelper actionOfType:MPActionEmptyTrash]) { +- (BOOL)validateUserInterfaceItem:(id)anItem { + if([anItem action] == [MPActionHelper actionOfType:MPActionEmptyTrash]) { BOOL hasGroups = [self.trash.groups count] > 0; BOOL hasEntries = [self.trash.entries count] > 0; return (hasEntries || hasGroups); } - return YES; + return [super validateUserInterfaceItem:anItem]; } #pragma mark Private diff --git a/MacPass/MPDocumentWindowController.h b/MacPass/MPDocumentWindowController.h index 377187d1..b381b69f 100644 --- a/MacPass/MPDocumentWindowController.h +++ b/MacPass/MPDocumentWindowController.h @@ -19,7 +19,7 @@ APPKIT_EXTERN NSString *const MPCurrentItemChangedNotification; -@interface MPDocumentWindowController : NSWindowController +@interface MPDocumentWindowController : NSWindowController @property (readonly, strong) MPPasswordInputController *passwordInputController; @property (readonly, strong) MPEntryViewController *entryViewController; diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 1ea7c54d..d4f1b88f 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -176,18 +176,25 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur } - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - BOOL enabled = YES; MPDocument *document = [self document]; - if([menuItem action] == @selector(exportDatabase:)) { + SEL itemAction = [menuItem action]; + if(itemAction == @selector(showDatabaseSettings:) + || itemAction == @selector(editPassword:)) { + return document.decrypted && !document.isLocked; + } + + BOOL enabled = YES; + if(itemAction == @selector(exportDatabase:)) { enabled = (nil != document.treeV4); } - enabled &= !( document.isLocked || document.isReadOnly ); + + enabled &= !( !document.decrypted || document.isLocked || document.isReadOnly ); return enabled; } - (BOOL)validateToolbarItem:(NSToolbarItem *)theItem { MPDocument *document = [self document]; - if(document.isLocked || document.isReadOnly) { + if(!document.decrypted || document.isLocked || document.isReadOnly) { return NO; } SEL itemAction = [theItem action]; diff --git a/MacPass/MPGeneralSettingsController.h b/MacPass/MPGeneralSettingsController.h index 777e6cf0..6eb7a50c 100644 --- a/MacPass/MPGeneralSettingsController.h +++ b/MacPass/MPGeneralSettingsController.h @@ -16,5 +16,6 @@ @property (weak) IBOutlet NSPopUpButton *clearPasteboardTimeoutPopup; @property (weak) IBOutlet NSPopUpButton *idleTimeOutPopup; @property (weak) IBOutlet NSButton *lockOnSleepCheckButton; +@property (weak) IBOutlet NSButton *reopenLastDatabase; @end diff --git a/MacPass/MPGeneralSettingsController.m b/MacPass/MPGeneralSettingsController.m index 299d574f..fd75d963 100644 --- a/MacPass/MPGeneralSettingsController.m +++ b/MacPass/MPGeneralSettingsController.m @@ -32,6 +32,7 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab"; - (void)didLoadView { NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController]; + NSString *reopenLastFilePath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyReopenLastDatabaseOnLaunch]; NSString *clearPasteboardKeyPath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyClearPasteboardOnQuit]; NSString *clearPasteboardTimeOutKeyPath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyPasteboardClearTimeout]; NSString *idleTimeOutKeyPath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyIdleLockTimeOut]; @@ -40,5 +41,6 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab"; [self.clearPasteboardTimeoutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:clearPasteboardTimeOutKeyPath options:nil]; [self.lockOnSleepCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:lockOnSleepKeyPath options:nil]; [self.idleTimeOutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:idleTimeOutKeyPath options:nil]; + [self.reopenLastDatabase bind:NSValueBinding toObject:defaultsController withKeyPath:reopenLastFilePath options:nil]; } @end diff --git a/MacPass/MPSettingsHelper.h b/MacPass/MPSettingsHelper.h index 8c89d7b7..a6219945 100644 --- a/MacPass/MPSettingsHelper.h +++ b/MacPass/MPSettingsHelper.h @@ -15,6 +15,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyClearPasteboardOnQuit; /* Behaviour */ APPKIT_EXTERN NSString *const kMPSettingsKeyPasswordEncoding; APPKIT_EXTERN NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch; +APPKIT_EXTERN NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch; /* Server Settings */ APPKIT_EXTERN NSString *const kMPSettingsKeyHttpPort; diff --git a/MacPass/MPSettingsHelper.m b/MacPass/MPSettingsHelper.m index 203ec20c..df300e86 100644 --- a/MacPass/MPSettingsHelper.m +++ b/MacPass/MPSettingsHelper.m @@ -11,6 +11,7 @@ NSString *const kMPSettingsKeyPasteboardClearTimeout = @"ClipboardClearTimeout"; NSString *const kMPSettingsKeyClearPasteboardOnQuit = @"ClearClipboardOnQuit"; NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch"; +NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch = @"ReopenLastDatabaseOnLaunch"; NSString *const kMPSettingsKeyHttpPort =@"HttpPort"; NSString *const kMPSettingsKeyEnableHttpServer = @"EnableHttpServer"; NSString *const kMPSettingsKeyShowMenuItem = @"ShowMenuItem"; @@ -28,6 +29,7 @@ NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut"; kMPSettingsKeyPasteboardClearTimeout: @30, // 30 seconds kMPSettingsKeyClearPasteboardOnQuit: @YES, kMPSettingsKeyOpenEmptyDatabaseOnLaunch: @NO, + kMPSettingsKeyReopenLastDatabaseOnLaunch: @YES, kMPSettingsKeyHttpPort: @19455, kMPSettingsKeyEnableHttpServer: @NO, kMPSettingsKeyShowMenuItem: @YES, diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist index ca8859f9..ee017419 100644 --- a/MacPass/MacPass-Info.plist +++ b/MacPass/MacPass-Info.plist @@ -44,11 +44,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.3.2 + 0.3.3 CFBundleSignature ???? CFBundleVersion - 2506 + 2508 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright diff --git a/MacPass/de.lproj/GeneralSettings.strings b/MacPass/de.lproj/GeneralSettings.strings index f48e8275..eaa66e6d 100644 --- a/MacPass/de.lproj/GeneralSettings.strings +++ b/MacPass/de.lproj/GeneralSettings.strings @@ -1,30 +1,48 @@ -/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "421"; */ -"421.title" = "OtherViews"; +/* Class = "NSMenu"; title = "ClipboardClearInterval"; ObjectID = "421"; */ +"421.title" = "ClipboardClearInterval"; -/* Class = "NSMenuItem"; title = "10 Seconds"; ObjectID = "422"; */ -"422.title" = "10 Sekunden"; +/* Class = "NSMenuItem"; title = "after 10 Seconds"; ObjectID = "422"; */ +"422.title" = "nach 10 Sekunden"; -/* Class = "NSMenuItem"; title = "30 Seconds"; ObjectID = "423"; */ -"423.title" = "30 Sekunden"; +/* Class = "NSMenuItem"; title = "after 30 Seconds"; ObjectID = "423"; */ +"423.title" = "nach 30 Sekunden"; -/* Class = "NSMenuItem"; title = "1 Minute"; ObjectID = "424"; */ -"424.title" = "1 Minute"; +/* Class = "NSMenuItem"; title = "after 1 Minute"; ObjectID = "424"; */ +"424.title" = "nach 1 Minute"; /* Class = "NSMenuItem"; title = "Never"; ObjectID = "429"; */ "429.title" = "Nie"; /* Class = "NSTextFieldCell"; title = "Clear Copied Items"; ObjectID = "432"; */ -"432.title" = "Zwischenablage Leere"; +"432.title" = "Leere Zwischenablage"; /* Class = "NSButtonCell"; title = "Clear Clipboard on Quit"; ObjectID = "448"; */ "448.title" = "Zwischenablage beim Beenden leeren"; -/* Class = "NSBox"; title = "Clipboard"; ObjectID = "465"; */ -"465.title" = "Zwischenablage"; +/* Class = "NSBox"; title = "Security"; ObjectID = "465"; */ +"465.title" = "Sicherheit"; -/* Class = "NSButtonCell"; title = "Open empty database on launch"; ObjectID = "527"; */ -"527.title" = "Leere Datenbank beim Programmstart öffnen"; +/* Class = "NSButtonCell"; title = "Reopen last Database after Launch"; ObjectID = "531"; */ +"531.title" = "Letzte Datenbank beim Start wieder öffnen"; -/* Class = "NSButtonCell"; title = "Open empty database on activate"; ObjectID = "531"; */ -"531.title" = "Lerre Datenbank beim Aktiveren öffnen"; +/* Class = "NSMenu"; title = "LockTimes"; ObjectID = "586"; */ +"586.title" = "LockTimes"; + +/* Class = "NSMenuItem"; title = "for 1 Minute"; ObjectID = "588"; */ +"588.title" = "für 1 Minute"; + +/* Class = "NSMenuItem"; title = "for 5 Minutes"; ObjectID = "589"; */ +"589.title" = "für 5 Minuten"; + +/* Class = "NSMenuItem"; title = "for 15 Minutes"; ObjectID = "603"; */ +"603.title" = "für 15 Minuten"; + +/* Class = "NSButtonCell"; title = "Lock after sleep"; ObjectID = "631"; */ +"631.title" = "Datenbank im Ruhezustand sperren"; + +/* Class = "NSMenuItem"; title = "Never"; ObjectID = "804"; */ +"804.title" = "Nie"; + +/* Class = "NSTextFieldCell"; title = "Lock while idle"; ObjectID = "806"; */ +"806.title" = "Sperren nach Inaktivität"; diff --git a/MacPass/en.lproj/GeneralSettings.strings b/MacPass/en.lproj/GeneralSettings.strings index 81a48946..d9c79ab5 100644 --- a/MacPass/en.lproj/GeneralSettings.strings +++ b/MacPass/en.lproj/GeneralSettings.strings @@ -2,14 +2,14 @@ /* Class = "NSMenu"; title = "ClipboardClearInterval"; ObjectID = "421"; */ "421.title" = "ClipboardClearInterval"; -/* Class = "NSMenuItem"; title = "10 Seconds"; ObjectID = "422"; */ -"422.title" = "10 Seconds"; +/* Class = "NSMenuItem"; title = "after 10 Seconds"; ObjectID = "422"; */ +"422.title" = "after 10 Seconds"; -/* Class = "NSMenuItem"; title = "30 Seconds"; ObjectID = "423"; */ -"423.title" = "30 Seconds"; +/* Class = "NSMenuItem"; title = "after 30 Seconds"; ObjectID = "423"; */ +"423.title" = "after 30 Seconds"; -/* Class = "NSMenuItem"; title = "1 Minute"; ObjectID = "424"; */ -"424.title" = "1 Minute"; +/* Class = "NSMenuItem"; title = "after 1 Minute"; ObjectID = "424"; */ +"424.title" = "after 1 Minute"; /* Class = "NSMenuItem"; title = "Never"; ObjectID = "429"; */ "429.title" = "Never"; @@ -23,26 +23,26 @@ /* Class = "NSBox"; title = "Security"; ObjectID = "465"; */ "465.title" = "Security"; -/* Class = "NSButtonCell"; title = "Open empty database on launch"; ObjectID = "527"; */ -"527.title" = "Open empty database on launch"; - -/* Class = "NSButtonCell"; title = "Open empty database on activate"; ObjectID = "531"; */ -"531.title" = "Open empty database on activate"; +/* Class = "NSButtonCell"; title = "Reopen last Database after Launch"; ObjectID = "531"; */ +"531.title" = "Reopen last Database after Launch"; /* Class = "NSMenu"; title = "LockTimes"; ObjectID = "586"; */ "586.title" = "LockTimes"; -/* Class = "NSMenuItem"; title = "1 Minute"; ObjectID = "588"; */ -"588.title" = "1 Minute"; +/* Class = "NSMenuItem"; title = "for 1 Minute"; ObjectID = "588"; */ +"588.title" = "for 1 Minute"; -/* Class = "NSMenuItem"; title = "5 Minutes"; ObjectID = "589"; */ -"589.title" = "5 Minutes"; +/* Class = "NSMenuItem"; title = "for 5 Minutes"; ObjectID = "589"; */ +"589.title" = "for 5 Minutes"; -/* Class = "NSMenuItem"; title = "15 Minutes"; ObjectID = "603"; */ -"603.title" = "15 Minutes"; - -/* Class = "NSButtonCell"; title = "Lock while idle for"; ObjectID = "606"; */ -"606.title" = "Lock while idle for"; +/* Class = "NSMenuItem"; title = "for 15 Minutes"; ObjectID = "603"; */ +"603.title" = "for 15 Minutes"; /* Class = "NSButtonCell"; title = "Lock after sleep"; ObjectID = "631"; */ "631.title" = "Lock after sleep"; + +/* Class = "NSMenuItem"; title = "Never"; ObjectID = "804"; */ +"804.title" = "Never"; + +/* Class = "NSTextFieldCell"; title = "Lock while idle"; ObjectID = "806"; */ +"806.title" = "Lock while idle";