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