From: Miltiadis Vasilakis Date: Tue, 19 Feb 2013 16:19:35 +0000 (+0200) Subject: Use user catalog displayname when displaying modified by X-Git-Tag: v1.2~4 X-Git-Url: https://code.grnet.gr/git/pithos-macos/commitdiff_plain/e88945f25e183f66fa76bb4e3ff7b9fd3d342331?hp=eebb5f0221cec27f742457b82cce899803e4952d Use user catalog displayname when displaying modified by --- diff --git a/pithos-macos/PithosBrowserPreviewController.xib b/pithos-macos/PithosBrowserPreviewController.xib index db4dd66..f04f81e 100644 --- a/pithos-macos/PithosBrowserPreviewController.xib +++ b/pithos-macos/PithosBrowserPreviewController.xib @@ -2,25 +2,25 @@ 1070 - 11D50b - 2182 - 1138.32 - 568.00 + 11G63 + 2843 + 1138.51 + 569.00 com.apple.InterfaceBuilder.CocoaPlugin - 2182 + 2843 YES - NSTextField - NSTextFieldCell NSButton + NSButtonCell + NSCustomObject NSCustomView NSImageCell - NSButtonCell NSImageView + NSTextField + NSTextFieldCell NSUserDefaultsController - NSCustomObject YES @@ -51,7 +51,6 @@ 269 {{49, 18}, {102, 19}} - YES @@ -77,7 +76,6 @@ 271 {{1, 45}, {98, 14}} - YES @@ -116,7 +114,6 @@ 271 {{1, 61}, {98, 14}} - YES @@ -135,7 +132,6 @@ 271 {{1, 77}, {98, 14}} - YES @@ -154,7 +150,6 @@ 271 {{1, 93}, {98, 14}} - YES @@ -173,7 +168,6 @@ 271 {{1, 109}, {98, 14}} - YES @@ -192,7 +186,6 @@ 271 {{1, 125}, {98, 14}} - YES @@ -211,7 +204,6 @@ 271 {{101, 45}, {98, 14}} - YES @@ -237,7 +229,6 @@ 271 {{101, 61}, {98, 14}} - YES @@ -255,7 +246,6 @@ 271 {{101, 77}, {98, 14}} - YES @@ -273,7 +263,6 @@ 271 {{101, 93}, {98, 14}} - YES @@ -291,7 +280,6 @@ 271 {{101, 109}, {98, 14}} - YES @@ -309,7 +297,6 @@ 271 {{101, 125}, {98, 14}} - YES @@ -339,11 +326,10 @@ {{36, 147}, {128, 128}} - YES - 130560 + 134348288 33554432 0 3 @@ -355,7 +341,6 @@ {200, 295} - NSView @@ -464,19 +449,19 @@ - value: representedObject.pithosObject.modifiedBy + value: representedObject.translatedModifiedBy - value: representedObject.pithosObject.modifiedBy + value: representedObject.translatedModifiedBy value - representedObject.pithosObject.modifiedBy + representedObject.translatedModifiedBy 2 - 90 + 98 @@ -890,7 +875,7 @@ - 97 + 98 0 diff --git a/pithos-macos/PithosObjectNode.h b/pithos-macos/PithosObjectNode.h index 0b82005..f19321e 100644 --- a/pithos-macos/PithosObjectNode.h +++ b/pithos-macos/PithosObjectNode.h @@ -52,6 +52,7 @@ ASIPithosObjectRequest *refreshVersionsObjectRequest; BOOL isPublic; + NSString *translatedModifiedBy; } - (id)initWithPithos:(ASIPithos *)aPithos @@ -63,6 +64,7 @@ @property (nonatomic, strong) ASIPithosObject *pithosObject; @property (nonatomic, strong) NSArray *versions; @property (nonatomic, assign) BOOL isPublic; +@property (nonatomic, strong) NSString *translatedModifiedBy; - (void)applyInfo; - (void)refreshInfo; diff --git a/pithos-macos/PithosObjectNode.m b/pithos-macos/PithosObjectNode.m index 67686b0..5407694 100644 --- a/pithos-macos/PithosObjectNode.m +++ b/pithos-macos/PithosObjectNode.m @@ -42,12 +42,13 @@ #import "ASIPithosContainer.h" #import "ASIPithosObject.h" #import "ASIDownloadCache.h" +#import "PithosAccount.h" #import "PithosUtilities.h" #import "PithosObjectNodeInfoController.h" @implementation PithosObjectNode @synthesize pithos, pithosContainer, pithosObject, versions; -@synthesize isPublic; +@synthesize isPublic, translatedModifiedBy; #pragma mark - #pragma mark Object Lifecycle @@ -71,6 +72,27 @@ } #pragma mark - +#pragma mark Internal + +- (void)updateModifiedBy { + if (!pithosObject.modifiedBy) { + self.translatedModifiedBy = nil; + } else { + if (pithosAccountManager) { + NSString *displayname = [pithosAccountManager displaynameForUUID:pithosObject.modifiedBy safe:NO]; + if (displayname) { + self.translatedModifiedBy = displayname; + } else { + [pithosAccountManager updateUserCatalogForForDisplaynames:nil UUIDs:[NSArray arrayWithObject:pithosObject.modifiedBy]]; + self.translatedModifiedBy = [pithosAccountManager displaynameForUUID:pithosObject.modifiedBy safe:YES]; + } + } else { + self.translatedModifiedBy = [pithosObject.modifiedBy copy]; + } + } +} + +#pragma mark - #pragma mark Properties - (void)setPithos:(ASIPithos *)aPithos { @@ -116,6 +138,7 @@ if (![pithosObject isEqualTo:aPithosObject]) { pithosObject = aPithosObject; } + [self updateModifiedBy]; self.isPublic = (pithosObject.publicURI != nil); // Refresh browser if the object is in my shared and is no longer shared if (shared && !pithosObject.sharing) @@ -141,6 +164,8 @@ self.pithosObject.sharing = aPithosObject.sharing; self.pithosObject.publicURI = aPithosObject.publicURI; self.pithosObject = pithosObject; + } else { + [self updateModifiedBy]; } } } diff --git a/pithos-macos/PithosObjectNodeInfoController.xib b/pithos-macos/PithosObjectNodeInfoController.xib index 5b6b491..a11ba35 100755 --- a/pithos-macos/PithosObjectNodeInfoController.xib +++ b/pithos-macos/PithosObjectNodeInfoController.xib @@ -2,34 +2,34 @@ 1070 - 11D50b - 2182 - 1138.32 - 568.00 + 11G63 + 2843 + 1138.51 + 569.00 com.apple.InterfaceBuilder.CocoaPlugin - 2182 + 2843 YES - NSTableColumn - NSComboBoxCell - NSScroller - NSTableHeaderView - NSButton NSArrayController + NSButton NSButtonCell + NSComboBoxCell + NSCustomObject + NSCustomView + NSDictionaryController + NSImageCell NSImageView - NSTextFieldCell NSScrollView - NSImageCell + NSScroller + NSTableColumn + NSTableHeaderView NSTableView - NSCustomObject - NSCustomView + NSTextField + NSTextFieldCell NSView NSWindowTemplate - NSTextField - NSDictionaryController YES @@ -86,7 +86,7 @@ YES - 130560 + 134348288 33554432 NSImage @@ -2258,15 +2258,15 @@ - value: node.pithosObject.modifiedBy + value: node.translatedModifiedBy - value: node.pithosObject.modifiedBy + value: node.translatedModifiedBy value - node.pithosObject.modifiedBy + node.translatedModifiedBy NSNullPlaceholder - @@ -2274,7 +2274,7 @@ 2 - 1233 + 1501 @@ -4887,7 +4887,7 @@ - 1500 + 1501 diff --git a/pithos-macos/PithosSubdirNode.h b/pithos-macos/PithosSubdirNode.h index e52c0af..c48dd89 100644 --- a/pithos-macos/PithosSubdirNode.h +++ b/pithos-macos/PithosSubdirNode.h @@ -48,6 +48,7 @@ ASIPithosObjectRequest *refreshVersionsObjectRequest; BOOL isPublic; + NSString *translatedModifiedBy; BOOL refreshParent; } @@ -59,6 +60,7 @@ @property (nonatomic, strong) ASIPithosObject *pithosObject; @property (nonatomic, strong) NSArray *versions; @property (nonatomic, assign) BOOL isPublic; +@property (nonatomic, strong) NSString *translatedModifiedBy; - (void)applyInfo; - (void)refreshInfo; diff --git a/pithos-macos/PithosSubdirNode.m b/pithos-macos/PithosSubdirNode.m index ce4263f..46e52ce 100644 --- a/pithos-macos/PithosSubdirNode.m +++ b/pithos-macos/PithosSubdirNode.m @@ -43,6 +43,7 @@ #import "ASIPithosObject.h" #import "ASINetworkQueue.h" #import "ASIDownloadCache.h" +#import "PithosAccount.h" #import "PithosUtilities.h" #import "PithosObjectNodeInfoController.h" @@ -50,7 +51,7 @@ static NSImage *sharedIcon = nil; @implementation PithosSubdirNode @synthesize pithosObject, versions; -@synthesize isPublic; +@synthesize isPublic, translatedModifiedBy; + (void)initialize { if (self == [PithosSubdirNode class]) @@ -79,6 +80,27 @@ static NSImage *sharedIcon = nil; } #pragma mark - +#pragma mark Internal + +- (void)updateModifiedBy { + if (!pithosObject.modifiedBy) { + self.translatedModifiedBy = nil; + } else { + if (pithosAccountManager) { + NSString *displayname = [pithosAccountManager displaynameForUUID:pithosObject.modifiedBy safe:NO]; + if (displayname) { + self.translatedModifiedBy = displayname; + } else { + [pithosAccountManager updateUserCatalogForForDisplaynames:nil UUIDs:[NSArray arrayWithObject:pithosObject.modifiedBy]]; + self.translatedModifiedBy = [pithosAccountManager displaynameForUUID:pithosObject.modifiedBy safe:YES]; + } + } else { + self.translatedModifiedBy = [pithosObject.modifiedBy copy]; + } + } +} + +#pragma mark - #pragma mark Properties - (void)setPithos:(ASIPithos *)aPithos { @@ -125,6 +147,7 @@ static NSImage *sharedIcon = nil; } else { self.prefix = [NSString stringWithString:pithosObject.name]; } + [self updateModifiedBy]; self.isPublic = (pithosObject.publicURI != nil); // Refresh browser if the object is in my shared and is no longer shared if (shared && !pithosObject.subdir && !pithosObject.sharing) { @@ -151,6 +174,8 @@ static NSImage *sharedIcon = nil; self.pithosObject.sharing = aPithosObject.sharing; self.pithosObject.publicURI = aPithosObject.publicURI; self.pithosObject = pithosObject; + } else { + [self updateModifiedBy]; } } }