Use user catalog displayname when displaying modified by
authorMiltiadis Vasilakis <mvasilak@gmail.com>
Tue, 19 Feb 2013 16:19:35 +0000 (18:19 +0200)
committerMiltiadis Vasilakis <mvasilak@gmail.com>
Tue, 19 Feb 2013 16:19:35 +0000 (18:19 +0200)
pithos-macos/PithosBrowserPreviewController.xib
pithos-macos/PithosObjectNode.h
pithos-macos/PithosObjectNode.m
pithos-macos/PithosObjectNodeInfoController.xib
pithos-macos/PithosSubdirNode.h
pithos-macos/PithosSubdirNode.m

index db4dd66..f04f81e 100644 (file)
@@ -2,25 +2,25 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
        <data>
                <int key="IBDocument.SystemTarget">1070</int>
-               <string key="IBDocument.SystemVersion">11D50b</string>
-               <string key="IBDocument.InterfaceBuilderVersion">2182</string>
-               <string key="IBDocument.AppKitVersion">1138.32</string>
-               <string key="IBDocument.HIToolboxVersion">568.00</string>
+               <string key="IBDocument.SystemVersion">11G63</string>
+               <string key="IBDocument.InterfaceBuilderVersion">2843</string>
+               <string key="IBDocument.AppKitVersion">1138.51</string>
+               <string key="IBDocument.HIToolboxVersion">569.00</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                       <string key="NS.object.0">2182</string>
+                       <string key="NS.object.0">2843</string>
                </object>
                <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
-                       <string>NSTextField</string>
-                       <string>NSTextFieldCell</string>
                        <string>NSButton</string>
+                       <string>NSButtonCell</string>
+                       <string>NSCustomObject</string>
                        <string>NSCustomView</string>
                        <string>NSImageCell</string>
-                       <string>NSButtonCell</string>
                        <string>NSImageView</string>
+                       <string>NSTextField</string>
+                       <string>NSTextFieldCell</string>
                        <string>NSUserDefaultsController</string>
-                       <string>NSCustomObject</string>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -51,7 +51,6 @@
                                                <int key="NSvFlags">269</int>
                                                <string key="NSFrame">{{49, 18}, {102, 19}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSButtonCell" key="NSCell" id="1036336951">
@@ -77,7 +76,6 @@
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{1, 45}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="711438167"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="984886579">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{1, 61}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="348582496"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="358475028">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{1, 77}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="490957876"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="423776930">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{1, 93}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="458298377"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="27846884">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{1, 109}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="933584688"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="726762919">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{1, 125}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="183377333"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="558074580">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{101, 45}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="241278852"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="948332378">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{101, 61}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="361683768"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="373378417">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{101, 77}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="779495175"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="622580923">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{101, 93}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="130674256"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="599752880">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{101, 109}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="363250715"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="11695648">
                                                <int key="NSvFlags">271</int>
                                                <string key="NSFrame">{{101, 125}, {98, 14}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="261591603"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSTextFieldCell" key="NSCell" id="59179920">
                                                </object>
                                                <string key="NSFrame">{{36, 147}, {128, 128}}</string>
                                                <reference key="NSSuperview" ref="1005"/>
-                                               <reference key="NSWindow"/>
                                                <reference key="NSNextKeyView" ref="774296355"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSImageCell" key="NSCell" id="327417217">
-                                                       <int key="NSCellFlags">130560</int>
+                                                       <int key="NSCellFlags">134348288</int>
                                                        <int key="NSCellFlags2">33554432</int>
                                                        <int key="NSAlign">0</int>
                                                        <int key="NSScale">3</int>
                                </object>
                                <string key="NSFrameSize">{200, 295}</string>
                                <reference key="NSSuperview"/>
-                               <reference key="NSWindow"/>
                                <reference key="NSNextKeyView" ref="501039666"/>
                                <string key="NSClassName">NSView</string>
                        </object>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBBindingConnection" key="connection">
-                                               <string key="label">value: representedObject.pithosObject.modifiedBy</string>
+                                               <string key="label">value: representedObject.translatedModifiedBy</string>
                                                <reference key="source" ref="348582496"/>
                                                <reference key="destination" ref="1001"/>
                                                <object class="NSNibBindingConnector" key="connector">
                                                        <reference key="NSSource" ref="348582496"/>
                                                        <reference key="NSDestination" ref="1001"/>
-                                                       <string key="NSLabel">value: representedObject.pithosObject.modifiedBy</string>
+                                                       <string key="NSLabel">value: representedObject.translatedModifiedBy</string>
                                                        <string key="NSBinding">value</string>
-                                                       <string key="NSKeyPath">representedObject.pithosObject.modifiedBy</string>
+                                                       <string key="NSKeyPath">representedObject.translatedModifiedBy</string>
                                                        <int key="NSNibBindingConnectorVersion">2</int>
                                                </object>
                                        </object>
-                                       <int key="connectionID">90</int>
+                                       <int key="connectionID">98</int>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBBindingConnection" key="connection">
                                <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">97</int>
+                       <int key="maxID">98</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes"/>
                <int key="IBDocument.localizationMode">0</int>
index 0b82005..f19321e 100644 (file)
@@ -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;
index 67686b0..5407694 100644 (file)
 #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
 }
 
 #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 {
     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)
             self.pithosObject.sharing = aPithosObject.sharing;
             self.pithosObject.publicURI = aPithosObject.publicURI;
             self.pithosObject = pithosObject;
+        } else {
+            [self updateModifiedBy];
         }
     }
 }
index 5b6b491..a11ba35 100755 (executable)
@@ -2,34 +2,34 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
        <data>
                <int key="IBDocument.SystemTarget">1070</int>
-               <string key="IBDocument.SystemVersion">11D50b</string>
-               <string key="IBDocument.InterfaceBuilderVersion">2182</string>
-               <string key="IBDocument.AppKitVersion">1138.32</string>
-               <string key="IBDocument.HIToolboxVersion">568.00</string>
+               <string key="IBDocument.SystemVersion">11G63</string>
+               <string key="IBDocument.InterfaceBuilderVersion">2843</string>
+               <string key="IBDocument.AppKitVersion">1138.51</string>
+               <string key="IBDocument.HIToolboxVersion">569.00</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                       <string key="NS.object.0">2182</string>
+                       <string key="NS.object.0">2843</string>
                </object>
                <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
-                       <string>NSTableColumn</string>
-                       <string>NSComboBoxCell</string>
-                       <string>NSScroller</string>
-                       <string>NSTableHeaderView</string>
-                       <string>NSButton</string>
                        <string>NSArrayController</string>
+                       <string>NSButton</string>
                        <string>NSButtonCell</string>
+                       <string>NSComboBoxCell</string>
+                       <string>NSCustomObject</string>
+                       <string>NSCustomView</string>
+                       <string>NSDictionaryController</string>
+                       <string>NSImageCell</string>
                        <string>NSImageView</string>
-                       <string>NSTextFieldCell</string>
                        <string>NSScrollView</string>
-                       <string>NSImageCell</string>
+                       <string>NSScroller</string>
+                       <string>NSTableColumn</string>
+                       <string>NSTableHeaderView</string>
                        <string>NSTableView</string>
-                       <string>NSCustomObject</string>
-                       <string>NSCustomView</string>
+                       <string>NSTextField</string>
+                       <string>NSTextFieldCell</string>
                        <string>NSView</string>
                        <string>NSWindowTemplate</string>
-                       <string>NSTextField</string>
-                       <string>NSDictionaryController</string>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -86,7 +86,7 @@
                                                        <reference key="NSNextKeyView" ref="56844250"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSImageCell" key="NSCell" id="689737374">
-                                                               <int key="NSCellFlags">130560</int>
+                                                               <int key="NSCellFlags">134348288</int>
                                                                <int key="NSCellFlags2">33554432</int>
                                                                <object class="NSCustomResource" key="NSContents">
                                                                        <string key="NSClassName">NSImage</string>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBBindingConnection" key="connection">
-                                               <string key="label">value: node.pithosObject.modifiedBy</string>
+                                               <string key="label">value: node.translatedModifiedBy</string>
                                                <reference key="source" ref="548192102"/>
                                                <reference key="destination" ref="1001"/>
                                                <object class="NSNibBindingConnector" key="connector">
                                                        <reference key="NSSource" ref="548192102"/>
                                                        <reference key="NSDestination" ref="1001"/>
-                                                       <string key="NSLabel">value: node.pithosObject.modifiedBy</string>
+                                                       <string key="NSLabel">value: node.translatedModifiedBy</string>
                                                        <string key="NSBinding">value</string>
-                                                       <string key="NSKeyPath">node.pithosObject.modifiedBy</string>
+                                                       <string key="NSKeyPath">node.translatedModifiedBy</string>
                                                        <object class="NSDictionary" key="NSOptions">
                                                                <string key="NS.key.0">NSNullPlaceholder</string>
                                                                <string key="NS.object.0">-</string>
                                                        <int key="NSNibBindingConnectorVersion">2</int>
                                                </object>
                                        </object>
-                                       <int key="connectionID">1233</int>
+                                       <int key="connectionID">1501</int>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBBindingConnection" key="connection">
                                <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">1500</int>
+                       <int key="maxID">1501</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
index e52c0af..c48dd89 100644 (file)
@@ -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;
index ce4263f..46e52ce 100644 (file)
@@ -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];
         }
     }
 }