mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-22 16:29:23 +00:00
Settings now work with KDB1 Files and do not trap the Application in the modal dialog
Added user base settings to hide/show passwords at KDB1 field. The settings are stored but not considered ;)
This commit is contained in:
@@ -16,15 +16,38 @@
|
||||
|
||||
- (NSString *)humanized {
|
||||
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
|
||||
NSDateComponents *components = [calendar components:NSMinuteCalendarUnit|NSHourCalendarUnit|NSDayCalendarUnit fromDate:self toDate:[NSDate date] options:0];
|
||||
if([components day] > 1) {
|
||||
NSDateComponents *components = [calendar components:NSMinuteCalendarUnit|NSHourCalendarUnit|NSDayCalendarUnit|NSWeekCalendarUnit|NSMonthCalendarUnit fromDate:self toDate:[NSDate date] options:0];
|
||||
/* More than one month in the past, give full date */
|
||||
if([components month] > 1) {
|
||||
return [NSDateFormatter localizedStringFromDate:self
|
||||
dateStyle:NSDateFormatterShortStyle
|
||||
timeStyle:NSDateFormatterShortStyle];
|
||||
}
|
||||
if([components day] == 1) {
|
||||
NSUInteger weeks = [components week];
|
||||
/* More than one week, less than a month */
|
||||
if(weeks > 1) {
|
||||
NSString *weekTemplate = NSLocalizedString(@"%ld_WEEKS_AGO", "% Weeks ago");
|
||||
return [NSString stringWithFormat:weekTemplate, weeks];
|
||||
}
|
||||
/* One week or more */
|
||||
if( weeks == 1) {
|
||||
return NSLocalizedString(@"ONE_WEEK_AGO", "one week ago");
|
||||
}
|
||||
/* Last week */
|
||||
NSUInteger days = [components day];
|
||||
if(days > 3) {
|
||||
return NSLocalizedString(@"LAST_WEEK", "last week");
|
||||
}
|
||||
/* 1-3 days */
|
||||
if(days > 1 ) {
|
||||
NSString *daysTemplate = NSLocalizedString(@"%ld_DAYS_AGO", "% days ago");
|
||||
return [NSString stringWithFormat:daysTemplate, days];
|
||||
}
|
||||
/* Yesterday */
|
||||
if(days == 1) {
|
||||
return NSLocalizedString(@"YESTERDAY", "Yesterday");
|
||||
}
|
||||
/* Hours ago */
|
||||
if([components hour] > 1) {
|
||||
NSString *hourTemplate = NSLocalizedString(@"%ld_HOURS_AGO", "% Hours ago");
|
||||
return [NSString stringWithFormat:hourTemplate, [components hour]];
|
||||
|
||||
Reference in New Issue
Block a user