mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 16:22:21 +00:00
Fixed isse with wrong sort descriptors on modification date
This commit is contained in:
@@ -46,4 +46,8 @@ typedef NS_ENUM( NSUInteger, MPCopyContentTypeTag) {
|
||||
- (void)copyURL:(id)sender;
|
||||
- (void)openURL:(id)sender;
|
||||
|
||||
/* Settings migration */
|
||||
+ (NSString *)timeInfoModificationTimeKeyPath;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -93,6 +93,14 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
||||
|
||||
@implementation MPEntryViewController
|
||||
|
||||
+ (NSString *)timeInfoModificationTimeKeyPath {
|
||||
static NSString *timeInfoModificationTimeKeyPath;
|
||||
if(nil == timeInfoModificationTimeKeyPath) {
|
||||
timeInfoModificationTimeKeyPath = [[NSString alloc] initWithFormat:@"%@.%@", NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(lastModificationTime))];
|
||||
}
|
||||
return timeInfoModificationTimeKeyPath;
|
||||
}
|
||||
|
||||
- (NSString *)nibName {
|
||||
return @"EntryView";
|
||||
}
|
||||
@@ -158,12 +166,11 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
||||
[self.entryTable setAutosaveTableColumns:YES];
|
||||
|
||||
NSString *parentNameKeyPath = [[NSString alloc] initWithFormat:@"%@.%@", NSStringFromSelector(@selector(parent)), NSStringFromSelector(@selector(name))];
|
||||
NSString *timeInfoModificationTimeKeyPath = [[NSString alloc] initWithFormat:@"%@.%@", NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(lastModificationTime))];
|
||||
NSSortDescriptor *titleColumSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(title))ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||
NSSortDescriptor *userNameSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(username)) ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||
NSSortDescriptor *urlSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(url)) ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||
NSSortDescriptor *groupnameSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:parentNameKeyPath ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||
NSSortDescriptor *dateSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:timeInfoModificationTimeKeyPath ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
|
||||
NSSortDescriptor *dateSortDescriptor = [NSSortDescriptor sortDescriptorWithKey:[MPEntryViewController timeInfoModificationTimeKeyPath] ascending:YES selector:@selector(compare:)];
|
||||
|
||||
[titleColumn setSortDescriptorPrototype:titleColumSortDescriptor];
|
||||
[userNameColumn setSortDescriptorPrototype:userNameSortDescriptor];
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#import "MPSettingsHelper.h"
|
||||
#import "NSString+MPPasswordCreation.h"
|
||||
#import "MPEntryViewController.h" // Sort descriptors
|
||||
|
||||
NSString *const kMPSettingsKeyPasteboardClearTimeout = @"ClipboardClearTimeout";
|
||||
NSString *const kMPSettingsKeyClearPasteboardOnQuit = @"ClearClipboardOnQuit";
|
||||
@@ -141,8 +142,9 @@ NSString *const kMPDeprecatedSettingsKeyDoubleClickURLToLaunch = @"Do
|
||||
return; // No user defaults
|
||||
}
|
||||
NSArray *sortDescriptors = [NSUnarchiver unarchiveObjectWithData:descriptorData];
|
||||
|
||||
for(NSSortDescriptor *descriptor in sortDescriptors) {
|
||||
if([descriptor selector] == @selector(compare:)) {
|
||||
if([descriptor selector] == @selector(compare:) || [[descriptor key] isEqualToString:[MPEntryViewController timeInfoModificationTimeKeyPath]] ) {
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kMPSettingsKeyEntryTableSortDescriptors];
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user