diff --git a/MacPass/KdbEntry+Undo.m b/MacPass/KdbEntry+Undo.m index b46cdf68..778a3aa7 100644 --- a/MacPass/KdbEntry+Undo.m +++ b/MacPass/KdbEntry+Undo.m @@ -7,6 +7,8 @@ // #import "KdbEntry+Undo.h" + +#import "Kdb4Node.h" #import "KdbGroup+Undo.h" #import "KdbGroup+KVOAdditions.h" #import "KdbGroup+MPTreeTools.h" @@ -48,7 +50,7 @@ if(![[self undoManager] isUndoing]) {\ [[self undoManager] registerUndoWithTarget:self selector:@selector(setTitleUndoable:) object:self.title]; MPSetActionName(@"SET_TITLE", ""); - [self setLastModificationTime:[NSDate date]]; + [self _touchModifcationDate]; [self setTitle:title]; } @@ -56,7 +58,7 @@ if(![[self undoManager] isUndoing]) {\ [[self undoManager] registerUndoWithTarget:self selector:@selector(setUsernameUndoable:) object:self.username]; MPSetActionName(@"SET_USERNAME", ""); - [self setLastModificationTime:[NSDate date]]; + [self _touchModifcationDate]; [self setUsername:username]; } @@ -64,7 +66,7 @@ if(![[self undoManager] isUndoing]) {\ [[self undoManager] registerUndoWithTarget:self selector:@selector(setPasswordUndoable:) object:self.password]; MPSetActionName(@"SET_PASSWORT", "Undo set password"); - [self setLastModificationTime:[NSDate date]]; + [self _touchModifcationDate]; [self setPassword:password]; } @@ -72,7 +74,7 @@ if(![[self undoManager] isUndoing]) {\ [[self undoManager] registerUndoWithTarget:self selector:@selector(setUrlUndoable:) object:self.url]; MPSetActionName(@"SET_URL", "Undo set URL"); - [self setLastModificationTime:[NSDate date]]; + [self _touchModifcationDate]; [self setUrl:url]; } @@ -80,7 +82,7 @@ if(![[self undoManager] isUndoing]) {\ [[self undoManager] registerUndoWithTarget:self selector:@selector(setNotesUndoable:) object:self.notes]; MPSetActionName(@"SET_NOTES", "Set Notes"); - [self setLastModificationTime:[NSDate date]]; + [self _touchModifcationDate]; [self setNotes:notes]; } @@ -124,8 +126,14 @@ if(![[self undoManager] isUndoing]) {\ // Old indices might be wrong, correct them if necessary index = MIN(index, [group.entries count]); [group insertObject:self inEntriesAtIndex:index]; + if([self respondsToSelector:@selector(setLocationChanged:)]) { + id entry = self; + [entry setLocationChanged:[NSDate date]]; + } } - +- (void)_touchModifcationDate { + self.lastModificationTime = [NSDate date]; +} @end \ No newline at end of file diff --git a/MacPass/MPAppDelegate.m b/MacPass/MPAppDelegate.m index ed2b6fb6..df14e75e 100644 --- a/MacPass/MPAppDelegate.m +++ b/MacPass/MPAppDelegate.m @@ -48,6 +48,14 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; } +- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { + if(!flag) { + [self _loadWelcomeWindow]; + [self.welcomeWindow orderFront:self]; + } + return YES; +} + - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender { return [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyOpenEmptyDatabaseOnLaunch]; } @@ -101,8 +109,7 @@ } else { - NSArray *topLevelObject; - [[NSBundle mainBundle] loadNibNamed:@"WelcomeWindow" owner:self topLevelObjects:&topLevelObject]; + [self _loadWelcomeWindow]; [self.welcomeWindow orderFront:self]; } } @@ -159,4 +166,12 @@ _restoredWindows = [documents count] > 0; } +- (void)_loadWelcomeWindow { + if(!_welcomeWindow) { + NSArray *topLevelObject; + [[NSBundle mainBundle] loadNibNamed:@"WelcomeWindow" owner:self topLevelObjects:&topLevelObject]; + //CFRelease((__bridge CFTypeRef)_welcomeWindow); + } +} + @end diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 7adcfe5b..a38f7a99 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -57,6 +57,7 @@ NSString *const MPEntryTableParentColumnIdentifier = @"MPParentColumnIdentifier" NSString *const MPEntryTableURLColumnIdentifier = @"MPEntryTableURLColumnIdentifier"; NSString *const MPEntryTableNotesColumnIdentifier = @"MPEntryTableNotesColumnIdentifier"; NSString *const MPEntryTableAttachmentColumnIdentifier = @"MPEntryTableAttachmentColumnIdentifier"; +NSString *const MPEntryTableModfiedColumnIdentifier = @"MPEntryTableModfiedColumnIdentifier"; NSString *const _MPTableImageCellView = @"ImageCell"; NSString *const _MPTableStringCellView = @"StringCell"; @@ -153,8 +154,10 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; NSTableColumn *urlColumn = [self.entryTable tableColumns][4]; NSTableColumn *attachmentsColumn = [[NSTableColumn alloc] initWithIdentifier:MPEntryTableAttachmentColumnIdentifier]; NSTableColumn *notesColumn = [[NSTableColumn alloc] initWithIdentifier:MPEntryTableNotesColumnIdentifier]; + NSTableColumn *modifiedColumn = [[NSTableColumn alloc] initWithIdentifier:MPEntryTableModfiedColumnIdentifier]; [self.entryTable addTableColumn:notesColumn]; [self.entryTable addTableColumn:attachmentsColumn]; + [self.entryTable addTableColumn:modifiedColumn]; [parentColumn setIdentifier:MPEntryTableParentColumnIdentifier]; [titleColumn setIdentifier:MPEntryTableTitleColumnIdentifier]; @@ -168,10 +171,14 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; NSSortDescriptor *titleColumSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES selector:@selector(compare:)]; NSSortDescriptor *userNameSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"username" ascending:YES selector:@selector(compare:)]; NSSortDescriptor *urlSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"url" ascending:YES selector:@selector(compare:)]; + NSSortDescriptor *groupnameSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"parent.name" ascending:YES selector:@selector(compare:)]; + NSSortDescriptor *dateSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"lastModificationTime" ascending:YES selector:@selector(compare:)]; [titleColumn setSortDescriptorPrototype:titleColumSortDescriptor]; [userNameColumn setSortDescriptorPrototype:userNameSortDescriptor]; [urlColumn setSortDescriptorPrototype:urlSortDescriptor]; + [parentColumn setSortDescriptorPrototype:groupnameSortDescriptor]; + [modifiedColumn setSortDescriptorPrototype:dateSortDescriptor]; [[parentColumn headerCell] setStringValue:NSLocalizedString(@"GROUP", "")]; [[titleColumn headerCell] setStringValue:NSLocalizedString(@"TITLE", "")]; @@ -180,6 +187,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; [[urlColumn headerCell] setStringValue:NSLocalizedString(@"URL", "")]; [[notesColumn headerCell] setStringValue:NSLocalizedString(@"NOTES", "")]; [[attachmentsColumn headerCell] setStringValue:NSLocalizedString(@"ATTACHMENTS", "")]; + [[modifiedColumn headerCell] setStringValue:NSLocalizedString(@"MODIFIED", "")]; [self.entryTable bind:NSContentBinding toObject:self.entryArrayController withKeyPath:@"arrangedObjects" options:nil]; [self.entryTable bind:NSSortDescriptorsBinding toObject:self.entryArrayController withKeyPath:@"sortDescriptors" options:nil]; @@ -209,6 +217,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; BOOL isURLColumn = [[tableColumn identifier] isEqualToString:MPEntryTableURLColumnIdentifier]; BOOL isAttachmentColumn = [[tableColumn identifier] isEqualToString:MPEntryTableAttachmentColumnIdentifier]; BOOL isNotesColumn = [[tableColumn identifier] isEqualToString:MPEntryTableNotesColumnIdentifier]; + BOOL isModifedColumn = [[tableColumn identifier] isEqualToString:MPEntryTableModfiedColumnIdentifier]; NSTableCellView *view = nil; if(isTitleColumn || isGroupColumn) { @@ -244,6 +253,13 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; [[view textField] setStringValue:@""]; //[[view textField] bind:NSValueBinding toObject:entry withKeyPath:@"countOfBinaries" options:nil]; } + else if( isModifedColumn ) { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateStyle:NSDateFormatterMediumStyle]; + [formatter setTimeStyle:NSDateFormatterMediumStyle]; + [[view textField] setFormatter:formatter]; + [[view textField] bind:NSValueBinding toObject:entry withKeyPath:@"lastModificationTime" options:nil]; + } } return view; @@ -556,13 +572,15 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername"; [headerMenu addItemWithTitle:NSLocalizedString(@"URL", "") action:NULL keyEquivalent:@""]; [headerMenu addItemWithTitle:NSLocalizedString(@"NOTES", "") action:NULL keyEquivalent:@""]; [headerMenu addItemWithTitle:NSLocalizedString(@"ATTACHMENTS", "") action:NULL keyEquivalent:@""]; + [headerMenu addItemWithTitle:NSLocalizedString(@"MODIFIED", "") action:NULL keyEquivalent:@""]; NSArray *identifier = @[ MPEntryTableTitleColumnIdentifier, MPEntryTableUserNameColumnIdentifier, MPEntryTablePasswordColumnIdentifier, MPEntryTableURLColumnIdentifier, MPEntryTableNotesColumnIdentifier, - MPEntryTableAttachmentColumnIdentifier ]; + MPEntryTableAttachmentColumnIdentifier, + MPEntryTableModfiedColumnIdentifier ]; NSDictionary *options = @{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName }; for(NSMenuItem *item in [headerMenu itemArray]) { diff --git a/MacPass/MPOutlineDataSource.m b/MacPass/MPOutlineDataSource.m index fdba0a95..ddff9209 100644 --- a/MacPass/MPOutlineDataSource.m +++ b/MacPass/MPOutlineDataSource.m @@ -90,7 +90,6 @@ validTarget &= index != [self.draggedGroup.parent.groups indexOfObject:self.draggedGroup]; } BOOL isAnchesor = [self.draggedGroup isAnchestorOfGroup:targetGroup]; - NSLog(@"DraggedGroup:%@ isAnchestor:%d ofTargetGroup:%@", self.draggedGroup.name, isAnchesor, targetGroup.name); validTarget &= !isAnchesor; } else if(self.draggedEntry) { diff --git a/MacPass/WelcomeWindow.xib b/MacPass/WelcomeWindow.xib index 9de0f42f..870a6877 100644 --- a/MacPass/WelcomeWindow.xib +++ b/MacPass/WelcomeWindow.xib @@ -43,7 +43,7 @@ 7 2 {{196, 240}, {448, 255}} - 544735232 + 1618477056 Welcome NSWindow @@ -186,7 +186,6 @@ {{372, 18}, {56, 25}} - _NS:22 YES diff --git a/MacPass/de.lproj/Localizable.strings b/MacPass/de.lproj/Localizable.strings index c1222919..7718a9e7 100644 Binary files a/MacPass/de.lproj/Localizable.strings and b/MacPass/de.lproj/Localizable.strings differ diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings index f5778c61..6515f6fe 100644 Binary files a/MacPass/en.lproj/Localizable.strings and b/MacPass/en.lproj/Localizable.strings differ