Sharing in the object info window can be updated.
authorMiltiadis Vasilakis <mvasilak@gmail.com>
Fri, 2 Sep 2011 13:16:17 +0000 (16:16 +0300)
committerMiltiadis Vasilakis <mvasilak@gmail.com>
Fri, 2 Sep 2011 13:16:17 +0000 (16:16 +0300)
pithos-macos.xcodeproj/project.pbxproj
pithos-macos/MetadataKeyFormatter.m
pithos-macos/PithosNodeInfoController.h
pithos-macos/PithosNodeInfoController.m
pithos-macos/PithosNodeInfoController.xib
pithos-macos/PithosObjectNode.m
pithos-macos/SharingDictionaryTransformer.h [new file with mode: 0644]
pithos-macos/SharingDictionaryTransformer.m [new file with mode: 0644]
pithos-macos/SharingNameFormatter.h [new file with mode: 0644]
pithos-macos/SharingNameFormatter.m [new file with mode: 0644]

index 6c90d2c..6de78a2 100644 (file)
@@ -52,6 +52,8 @@
                619B85D513F8077800C9371F /* PithosPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 619B85D313F8077100C9371F /* PithosPreferencesController.m */; };
                619B85D613F8077800C9371F /* PithosPreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 619B85D413F8077300C9371F /* PithosPreferencesController.xib */; };
                61C24BBB1410D350007004DC /* PublicURLTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C24BBA1410D350007004DC /* PublicURLTransformer.m */; };
+               61C24BBE1410E031007004DC /* SharingDictionaryTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C24BBD1410E031007004DC /* SharingDictionaryTransformer.m */; };
+               61C24BC114110BDB007004DC /* SharingNameFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C24BC014110BDB007004DC /* SharingNameFormatter.m */; };
                61E99D9413EC348500E48DA5 /* 145-persondot.png in Resources */ = {isa = PBXBuildFile; fileRef = 61E99D9313EC348500E48DA5 /* 145-persondot.png */; };
 /* End PBXBuildFile section */
 
                619B85D413F8077300C9371F /* PithosPreferencesController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PithosPreferencesController.xib; sourceTree = "<group>"; };
                61C24BB91410D350007004DC /* PublicURLTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PublicURLTransformer.h; path = "pithos-macos/PublicURLTransformer.h"; sourceTree = "<group>"; };
                61C24BBA1410D350007004DC /* PublicURLTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PublicURLTransformer.m; path = "pithos-macos/PublicURLTransformer.m"; sourceTree = "<group>"; };
+               61C24BBC1410E031007004DC /* SharingDictionaryTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharingDictionaryTransformer.h; path = "pithos-macos/SharingDictionaryTransformer.h"; sourceTree = "<group>"; };
+               61C24BBD1410E031007004DC /* SharingDictionaryTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SharingDictionaryTransformer.m; path = "pithos-macos/SharingDictionaryTransformer.m"; sourceTree = "<group>"; };
+               61C24BBF14110BDB007004DC /* SharingNameFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharingNameFormatter.h; path = "pithos-macos/SharingNameFormatter.h"; sourceTree = "<group>"; };
+               61C24BC014110BDB007004DC /* SharingNameFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SharingNameFormatter.m; path = "pithos-macos/SharingNameFormatter.m"; sourceTree = "<group>"; };
                61E99D9313EC348500E48DA5 /* 145-persondot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "145-persondot.png"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
                        children = (
                                615A444F140F8A7F00308614 /* MetadataKeyFormatter.h */,
                                615A4450140F8A7F00308614 /* MetadataKeyFormatter.m */,
+                               61C24BBF14110BDB007004DC /* SharingNameFormatter.h */,
+                               61C24BC014110BDB007004DC /* SharingNameFormatter.m */,
                        );
                        name = Formatters;
                        sourceTree = "<group>";
                                615A444D140F8A5700308614 /* MetadataKeyTransformer.m */,
                                61C24BB91410D350007004DC /* PublicURLTransformer.h */,
                                61C24BBA1410D350007004DC /* PublicURLTransformer.m */,
+                               61C24BBC1410E031007004DC /* SharingDictionaryTransformer.h */,
+                               61C24BBD1410E031007004DC /* SharingDictionaryTransformer.m */,
                        );
                        name = "Value Transformers";
                        sourceTree = "<group>";
                                615A444E140F8A5700308614 /* MetadataKeyTransformer.m in Sources */,
                                615A4451140F8A7F00308614 /* MetadataKeyFormatter.m in Sources */,
                                61C24BBB1410D350007004DC /* PublicURLTransformer.m in Sources */,
+                               61C24BBE1410E031007004DC /* SharingDictionaryTransformer.m in Sources */,
+                               61C24BC114110BDB007004DC /* SharingNameFormatter.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 066579c..933e75f 100644 (file)
        unichar aChar;  
        for (int i = 0; i < [partialString length]; i++) {
                aChar = [partialString characterAtIndex:i];
-               if (!(aChar == '_' || (aChar >= '0' && aChar <= '9') || (aChar >= 'A' && aChar <= 'Z') || (aChar >= 'a' && aChar <= 'z'))) {
+               if (!((aChar == '_') || 
+              ((aChar >= '0') && (aChar <= '9')) || 
+              ((aChar >= 'A') && (aChar <= 'Z')) || 
+              ((aChar >= 'a') && (aChar <= 'z')))) {
                        *newString = nil;
                        return NO;
                }
index 6c44343..94f205b 100644 (file)
@@ -40,6 +40,9 @@
 
 @interface PithosNodeInfoController : NSWindowController <NSWindowDelegate> {
     PithosNode *node;
+    
+    IBOutlet NSDictionaryController *metadataDictionaryController;
+    IBOutlet NSDictionaryController *sharingDictionaryController;
 }
 
 @property(assign) PithosNode *node;
index bd041ab..430688e 100644 (file)
 - (void)windowDidLoad {
     [super windowDidLoad];
     
+    [metadataDictionaryController setInitialKey:@"key"];
+    [metadataDictionaryController setInitialValue:@"value"];
+    [sharingDictionaryController setInitialKey:@"user"];
+    [sharingDictionaryController setInitialValue:@"read"];
+    
     [[self window] setDelegate:self];
 }
 
index 8933ef8..45fb87a 100644 (file)
@@ -17,6 +17,7 @@
                        <string>NSScroller</string>
                        <string>NSTableHeaderView</string>
                        <string>NSButton</string>
+                       <string>NSComboBoxCell</string>
                        <string>NSTextFieldCell</string>
                        <string>NSScrollView</string>
                        <string>NSImageView</string>
                                                                                                                <reference key="NSBackgroundColor" ref="201284931"/>
                                                                                                                <reference key="NSTextColor" ref="328313533"/>
                                                                                                        </object>
-                                                                                                       <object class="NSTextFieldCell" key="NSDataCell" id="574425450">
-                                                                                                               <int key="NSCellFlags">337772096</int>
-                                                                                                               <int key="NSCellFlags2">2048</int>
-                                                                                                               <string key="NSContents">Text Cell</string>
+                                                                                                       <object class="NSComboBoxCell" key="NSDataCell" id="469414486">
+                                                                                                               <int key="NSCellFlags">68288064</int>
+                                                                                                               <int key="NSCellFlags2">272761856</int>
+                                                                                                               <string key="NSContents"/>
                                                                                                                <reference key="NSSupport" ref="26"/>
                                                                                                                <reference key="NSControlView" ref="247900786"/>
-                                                                                                               <reference key="NSBackgroundColor" ref="465271680"/>
+                                                                                                               <reference key="NSBackgroundColor" ref="349501126"/>
                                                                                                                <reference key="NSTextColor" ref="162787576"/>
+                                                                                                               <int key="NSVisibleItemCount">2</int>
+                                                                                                               <bool key="NSHasVerticalScroller">YES</bool>
+                                                                                                               <object class="NSMutableArray" key="NSPopUpListData">
+                                                                                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                                                                       <string>read</string>
+                                                                                                                       <string>write</string>
+                                                                                                               </object>
+                                                                                                               <object class="NSComboTableView" key="NSTableView" id="296811353">
+                                                                                                                       <reference key="NSNextResponder"/>
+                                                                                                                       <int key="NSvFlags">274</int>
+                                                                                                                       <string key="NSFrameSize">{13, 18}</string>
+                                                                                                                       <reference key="NSSuperview"/>
+                                                                                                                       <reference key="NSWindow"/>
+                                                                                                                       <bool key="NSEnabled">YES</bool>
+                                                                                                                       <object class="NSMutableArray" key="NSTableColumns">
+                                                                                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                                                                               <object class="NSTableColumn">
+                                                                                                                                       <double key="NSWidth">10</double>
+                                                                                                                                       <double key="NSMinWidth">10</double>
+                                                                                                                                       <double key="NSMaxWidth">1000</double>
+                                                                                                                                       <object class="NSTableHeaderCell" key="NSHeaderCell">
+                                                                                                                                               <int key="NSCellFlags">75628032</int>
+                                                                                                                                               <int key="NSCellFlags2">0</int>
+                                                                                                                                               <string key="NSContents"/>
+                                                                                                                                               <object class="NSFont" key="NSSupport" id="1072536285">
+                                                                                                                                                       <string key="NSName">LucidaGrande</string>
+                                                                                                                                                       <double key="NSSize">12</double>
+                                                                                                                                                       <int key="NSfFlags">16</int>
+                                                                                                                                               </object>
+                                                                                                                                               <object class="NSColor" key="NSBackgroundColor">
+                                                                                                                                                       <int key="NSColorSpace">3</int>
+                                                                                                                                                       <bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
+                                                                                                                                               </object>
+                                                                                                                                               <reference key="NSTextColor" ref="392809818"/>
+                                                                                                                                       </object>
+                                                                                                                                       <object class="NSTextFieldCell" key="NSDataCell">
+                                                                                                                                               <int key="NSCellFlags">338820672</int>
+                                                                                                                                               <int key="NSCellFlags2">1024</int>
+                                                                                                                                               <reference key="NSSupport" ref="26"/>
+                                                                                                                                               <reference key="NSControlView" ref="296811353"/>
+                                                                                                                                               <bool key="NSDrawsBackground">YES</bool>
+                                                                                                                                               <reference key="NSBackgroundColor" ref="465271680"/>
+                                                                                                                                               <reference key="NSTextColor" ref="162787576"/>
+                                                                                                                                       </object>
+                                                                                                                                       <int key="NSResizingMask">3</int>
+                                                                                                                                       <bool key="NSIsResizeable">YES</bool>
+                                                                                                                                       <reference key="NSTableView" ref="296811353"/>
+                                                                                                                               </object>
+                                                                                                                       </object>
+                                                                                                                       <double key="NSIntercellSpacingWidth">3</double>
+                                                                                                                       <double key="NSIntercellSpacingHeight">2</double>
+                                                                                                                       <reference key="NSBackgroundColor" ref="465271680"/>
+                                                                                                                       <reference key="NSGridColor" ref="320747002"/>
+                                                                                                                       <double key="NSRowHeight">16</double>
+                                                                                                                       <string key="NSAction">tableViewAction:</string>
+                                                                                                                       <int key="NSTvFlags">-765427712</int>
+                                                                                                                       <reference key="NSDelegate" ref="469414486"/>
+                                                                                                                       <reference key="NSDataSource" ref="469414486"/>
+                                                                                                                       <reference key="NSTarget" ref="469414486"/>
+                                                                                                                       <int key="NSColumnAutoresizingStyle">1</int>
+                                                                                                                       <int key="NSDraggingSourceMaskForLocal">15</int>
+                                                                                                                       <int key="NSDraggingSourceMaskForNonLocal">0</int>
+                                                                                                                       <bool key="NSAllowsTypeSelect">YES</bool>
+                                                                                                                       <int key="NSTableViewDraggingDestinationStyle">0</int>
+                                                                                                               </object>
+                                                                                                               <bool key="NSButtonBordered">NO</bool>
                                                                                                        </object>
                                                                                                        <int key="NSResizingMask">3</int>
                                                                                                        <bool key="NSIsResizeable">YES</bool>
                                                                <int key="NSCellFlags">-2080244224</int>
                                                                <int key="NSCellFlags2">134217728</int>
                                                                <string key="NSContents">Revert</string>
-                                                               <object class="NSFont" key="NSSupport" id="1072536285">
-                                                                       <string key="NSName">LucidaGrande</string>
-                                                                       <double key="NSSize">12</double>
-                                                                       <int key="NSfFlags">16</int>
-                                                               </object>
+                                                               <reference key="NSSupport" ref="1072536285"/>
                                                                <reference key="NSControlView" ref="870983347"/>
                                                                <int key="NSButtonFlags">-2038152961</int>
                                                                <int key="NSButtonFlags2">164</int>
                                <string key="NSInitialKey">key</string>
                                <string key="NSInitialValue">value</string>
                        </object>
+                       <object class="NSDictionaryController" id="86063028">
+                               <bool key="NSAvoidsEmptySelection">YES</bool>
+                               <bool key="NSPreservesSelection">YES</bool>
+                               <bool key="NSSelectsInsertedObjects">YES</bool>
+                               <bool key="NSFilterRestrictsInsertion">YES</bool>
+                               <object class="NSArray" key="NSSortDescriptors">
+                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                       <object class="NSSortDescriptor">
+                                               <string key="NSKey">key</string>
+                                               <bool key="NSAscending">YES</bool>
+                                               <string key="NSSelector">compare:</string>
+                                       </object>
+                               </object>
+                               <bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
+                               <string key="NSInitialKey">key</string>
+                               <string key="NSInitialValue">value</string>
+                       </object>
                        <object class="NSCustomObject" id="974608694">
                                <string key="NSClassName">MetadataKeyFormatter</string>
                        </object>
+                       <object class="NSCustomObject" id="685782685">
+                               <string key="NSClassName">SharingNameFormatter</string>
+                       </object>
                </object>
                <object class="IBObjectContainer" key="IBDocument.Objects">
                        <object class="NSMutableArray" key="connectionRecords">
                                        </object>
                                        <int key="connectionID">294</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">contentDictionary: node.pithosObject.sharing</string>
+                                               <reference key="source" ref="86063028"/>
+                                               <reference key="destination" ref="1001"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="86063028"/>
+                                                       <reference key="NSDestination" ref="1001"/>
+                                                       <string key="NSLabel">contentDictionary: node.pithosObject.sharing</string>
+                                                       <string key="NSBinding">contentDictionary</string>
+                                                       <string key="NSKeyPath">node.pithosObject.sharing</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValueTransformerName</string>
+                                                               <string key="NS.object.0">SharingDictionaryTransformer</string>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">298</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">content: arrangedObjects</string>
+                                               <reference key="source" ref="247900786"/>
+                                               <reference key="destination" ref="86063028"/>
+                                               <object class="NSNibBindingConnector" key="connector" id="687753622">
+                                                       <reference key="NSSource" ref="247900786"/>
+                                                       <reference key="NSDestination" ref="86063028"/>
+                                                       <string key="NSLabel">content: arrangedObjects</string>
+                                                       <string key="NSBinding">content</string>
+                                                       <string key="NSKeyPath">arrangedObjects</string>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">299</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">selectionIndexes: selectionIndexes</string>
+                                               <reference key="source" ref="247900786"/>
+                                               <reference key="destination" ref="86063028"/>
+                                               <object class="NSNibBindingConnector" key="connector" id="251663882">
+                                                       <reference key="NSSource" ref="247900786"/>
+                                                       <reference key="NSDestination" ref="86063028"/>
+                                                       <string key="NSLabel">selectionIndexes: selectionIndexes</string>
+                                                       <string key="NSBinding">selectionIndexes</string>
+                                                       <string key="NSKeyPath">selectionIndexes</string>
+                                                       <reference key="NSPreviousConnector" ref="687753622"/>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">301</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">sortDescriptors: sortDescriptors</string>
+                                               <reference key="source" ref="247900786"/>
+                                               <reference key="destination" ref="86063028"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="247900786"/>
+                                                       <reference key="NSDestination" ref="86063028"/>
+                                                       <string key="NSLabel">sortDescriptors: sortDescriptors</string>
+                                                       <string key="NSBinding">sortDescriptors</string>
+                                                       <string key="NSKeyPath">sortDescriptors</string>
+                                                       <reference key="NSPreviousConnector" ref="251663882"/>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">303</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">value: arrangedObjects.key</string>
+                                               <reference key="source" ref="151509599"/>
+                                               <reference key="destination" ref="86063028"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="151509599"/>
+                                                       <reference key="NSDestination" ref="86063028"/>
+                                                       <string key="NSLabel">value: arrangedObjects.key</string>
+                                                       <string key="NSBinding">value</string>
+                                                       <string key="NSKeyPath">arrangedObjects.key</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValidatesImmediately</string>
+                                                               <boolean value="YES" key="NS.object.0"/>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">307</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">value: arrangedObjects.value</string>
+                                               <reference key="source" ref="434421234"/>
+                                               <reference key="destination" ref="86063028"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="434421234"/>
+                                                       <reference key="NSDestination" ref="86063028"/>
+                                                       <string key="NSLabel">value: arrangedObjects.value</string>
+                                                       <string key="NSBinding">value</string>
+                                                       <string key="NSKeyPath">arrangedObjects.value</string>
+                                                       <object class="NSDictionary" key="NSOptions">
+                                                               <string key="NS.key.0">NSValidatesImmediately</string>
+                                                               <boolean value="YES" key="NS.object.0"/>
+                                                       </object>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">310</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBActionConnection" key="connection">
+                                               <string key="label">add:</string>
+                                               <reference key="source" ref="86063028"/>
+                                               <reference key="destination" ref="1002056463"/>
+                                       </object>
+                                       <int key="connectionID">311</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBActionConnection" key="connection">
+                                               <string key="label">remove:</string>
+                                               <reference key="source" ref="86063028"/>
+                                               <reference key="destination" ref="218462401"/>
+                                       </object>
+                                       <int key="connectionID">312</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBBindingConnection" key="connection">
+                                               <string key="label">enabled: canRemove</string>
+                                               <reference key="source" ref="218462401"/>
+                                               <reference key="destination" ref="86063028"/>
+                                               <object class="NSNibBindingConnector" key="connector">
+                                                       <reference key="NSSource" ref="218462401"/>
+                                                       <reference key="NSDestination" ref="86063028"/>
+                                                       <string key="NSLabel">enabled: canRemove</string>
+                                                       <string key="NSBinding">enabled</string>
+                                                       <string key="NSKeyPath">canRemove</string>
+                                                       <int key="NSNibBindingConnectorVersion">2</int>
+                                               </object>
+                                       </object>
+                                       <int key="connectionID">316</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">metadataDictionaryController</string>
+                                               <reference key="source" ref="1001"/>
+                                               <reference key="destination" ref="1051118663"/>
+                                       </object>
+                                       <int key="connectionID">319</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">sharingDictionaryController</string>
+                                               <reference key="source" ref="1001"/>
+                                               <reference key="destination" ref="86063028"/>
+                                       </object>
+                                       <int key="connectionID">320</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">formatter</string>
+                                               <reference key="source" ref="50414786"/>
+                                               <reference key="destination" ref="685782685"/>
+                                       </object>
+                                       <int key="connectionID">322</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                                        <reference ref="413572703"/>
                                                </object>
                                                <reference key="parent" ref="1006"/>
+                                               <string key="objectName">Scroll View - Table View - Sharing</string>
                                        </object>
                                        <object class="IBObjectRecord">
                                                <int key="objectID">69</int>
                                                <reference key="object" ref="434421234"/>
                                                <object class="NSMutableArray" key="children">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
-                                                       <reference ref="574425450"/>
+                                                       <reference ref="469414486"/>
                                                </object>
                                                <reference key="parent" ref="247900786"/>
                                        </object>
                                                <reference key="parent" ref="151509599"/>
                                        </object>
                                        <object class="IBObjectRecord">
-                                               <int key="objectID">80</int>
-                                               <reference key="object" ref="574425450"/>
-                                               <reference key="parent" ref="434421234"/>
-                                       </object>
-                                       <object class="IBObjectRecord">
                                                <int key="objectID">81</int>
                                                <reference key="object" ref="1048447927"/>
                                                <reference key="parent" ref="1056330804"/>
                                                <reference key="object" ref="631288671"/>
                                                <reference key="parent" ref="889445631"/>
                                        </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">295</int>
+                                               <reference key="object" ref="86063028"/>
+                                               <reference key="parent" ref="0"/>
+                                               <string key="objectName">Dictionary Controller (Sharing)</string>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">314</int>
+                                               <reference key="object" ref="469414486"/>
+                                               <reference key="parent" ref="434421234"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">321</int>
+                                               <reference key="object" ref="685782685"/>
+                                               <reference key="parent" ref="0"/>
+                                       </object>
                                </object>
                        </object>
                        <object class="NSMutableDictionary" key="flattenedProperties">
                                        <string>27.IBPluginDependency</string>
                                        <string>28.IBPluginDependency</string>
                                        <string>29.IBPluginDependency</string>
+                                       <string>295.IBPluginDependency</string>
                                        <string>3.IBPluginDependency</string>
                                        <string>30.IBPluginDependency</string>
                                        <string>31.IBPluginDependency</string>
+                                       <string>314.IBComboBoxObjectValuesKey.objectValues</string>
+                                       <string>314.IBPluginDependency</string>
                                        <string>32.IBPluginDependency</string>
+                                       <string>321.IBPluginDependency</string>
                                        <string>33.IBPluginDependency</string>
                                        <string>34.IBPluginDependency</string>
                                        <string>35.IBPluginDependency</string>
                                        <string>78.IBPluginDependency</string>
                                        <string>79.IBPluginDependency</string>
                                        <string>8.IBPluginDependency</string>
-                                       <string>80.IBPluginDependency</string>
                                        <string>81.IBPluginDependency</string>
                                        <string>85.IBPluginDependency</string>
                                        <string>86.IBPluginDependency</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <object class="NSArray">
+                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                               <string>read</string>
+                                               <string>write</string>
+                                       </object>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">294</int>
+                       <int key="maxID">322</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes"/>
                <int key="IBDocument.localizationMode">0</int>
index aa5481a..dd1fcdb 100644 (file)
                                                                                                contentEncoding:nil
                                                                                             contentDisposition:nil 
                                                                                                       manifest:nil 
-                                                                                                       sharing:nil 
+                                                                                                       sharing:pithosObject.sharing 
                                                                                                       isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
                                                                                                       metadata:pithosObject.metadata
                                                                                                         update:NO] retain];
diff --git a/pithos-macos/SharingDictionaryTransformer.h b/pithos-macos/SharingDictionaryTransformer.h
new file mode 100644 (file)
index 0000000..39ee3f4
--- /dev/null
@@ -0,0 +1,39 @@
+//
+//  SharingDictionaryTransformer.h
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+@interface SharingDictionaryTransformer : NSValueTransformer
+@end
diff --git a/pithos-macos/SharingDictionaryTransformer.m b/pithos-macos/SharingDictionaryTransformer.m
new file mode 100644 (file)
index 0000000..3469508
--- /dev/null
@@ -0,0 +1,121 @@
+//
+//  SharingDictionaryTransformer.m
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+#import "SharingDictionaryTransformer.h"
+
+@implementation SharingDictionaryTransformer
+
++ (Class)transformedValueClass {
+       return [NSMutableDictionary class];
+}
+
++ (BOOL)allowsReverseTransformation {
+       return YES;
+}
+
+- (id)transformedValue:(id)value {
+    NSMutableDictionary *sharingDictionary = [NSMutableDictionary dictionary];
+    
+    if (value == nil)
+        return sharingDictionary;
+    
+    NSRange readRange = [(NSString *)value rangeOfString:@"read=" options:NSCaseInsensitiveSearch];
+    NSUInteger readStart = readRange.location + readRange.length;
+    NSRange writeRange = [(NSString *)value rangeOfString:@"write=" options:NSCaseInsensitiveSearch];
+    NSUInteger writeStart = writeRange.location + writeRange.length;
+    if (writeRange.length == 0) {
+        if (readRange.length == 0) {
+            return sharingDictionary;
+        }
+        for (NSString *readUser in [[(NSString *)value substringFromIndex:readStart] componentsSeparatedByString:@","]) {
+            [sharingDictionary setValue:@"read" forKey:readUser];
+        }
+    } else if (readRange.length == 0) {
+        for (NSString *writeUser in [[(NSString *)value substringFromIndex:writeStart] componentsSeparatedByString:@","]) {
+            [sharingDictionary setValue:@"write" forKey:writeUser];
+        }
+    } else if (readRange.location < writeRange.location) {
+        NSRange semicolonRange = [(NSString *)value rangeOfString:@";"];
+        for (NSString *readUser in [[(NSString *)value substringWithRange:NSMakeRange(readStart, semicolonRange.location - readStart)] componentsSeparatedByString:@","]) {
+            [sharingDictionary setValue:@"read" forKey:readUser];
+        }
+        for (NSString *writeUser in [[(NSString *)value substringFromIndex:writeStart] componentsSeparatedByString:@","]) {
+            [sharingDictionary setValue:@"write" forKey:writeUser];
+        }        
+    } else {
+        NSRange semicolonRange = [(NSString *)value rangeOfString:@";"];
+        for (NSString *readUser in [[(NSString *)value substringFromIndex:readStart] componentsSeparatedByString:@","]) {
+            [sharingDictionary setValue:@"read" forKey:readUser];
+        }                
+        for (NSString *writeUser in [[(NSString *)value substringWithRange:NSMakeRange(writeStart, semicolonRange.location - writeStart)] componentsSeparatedByString:@","]) {
+            [sharingDictionary setValue:@"write" forKey:writeUser];
+        }
+    }
+    
+    return sharingDictionary;
+}
+
+- (id)reverseTransformedValue:(id)value {
+    if (value == nil || ([(NSMutableDictionary *)value count] == 0))
+        return nil;
+    
+    NSString *readSharingString = nil;
+    NSArray *readUsers = [(NSMutableDictionary *)value allKeysForObject:@"read"];
+    if ([readUsers count])
+        readSharingString = [NSString stringWithFormat:@"read=%@", [readUsers componentsJoinedByString:@","]];
+    NSString *writeSharingString = nil;
+    
+    NSArray *writeUsers = [(NSMutableDictionary *)value allKeysForObject:@"write"];
+    if ([writeUsers count])
+        writeSharingString = [NSString stringWithFormat:@"write=%@", [writeUsers componentsJoinedByString:@","]];
+        
+
+    if (readSharingString) {
+        if (writeSharingString) {
+            return [NSString stringWithFormat:@"%@;%@", readSharingString, writeSharingString];
+        }
+        return readSharingString;
+    } else {
+        return writeSharingString;
+    }
+}
+
++ (void)initialize {
+    [[NSValueTransformer class] setValueTransformer:[self new] forName:@"SharingDictionaryTransformer"];
+}
+
+@end
diff --git a/pithos-macos/SharingNameFormatter.h b/pithos-macos/SharingNameFormatter.h
new file mode 100644 (file)
index 0000000..80f025b
--- /dev/null
@@ -0,0 +1,39 @@
+//
+//  SharingNameFormatter.h
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+@interface SharingNameFormatter : NSFormatter
+@end
diff --git a/pithos-macos/SharingNameFormatter.m b/pithos-macos/SharingNameFormatter.m
new file mode 100644 (file)
index 0000000..ed1636e
--- /dev/null
@@ -0,0 +1,71 @@
+//
+//  SharingNameFormatter.m
+//  pithos-macos
+//
+// Copyright 2011 GRNET S.A. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
+// 
+//   1. Redistributions of source code must retain the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials
+//      provided with the distribution.
+// 
+// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+// 
+// The views and conclusions contained in the software and
+// documentation are those of the authors and should not be
+// interpreted as representing official policies, either expressed
+// or implied, of GRNET S.A.
+
+#import "SharingNameFormatter.h"
+
+@implementation SharingNameFormatter
+
+- (NSString *)stringForObjectValue:(id)anObject {
+       if (anObject != nil)
+               return [NSString stringWithString:anObject];
+       return nil;
+}
+
+- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error {
+       *anObject = [NSString stringWithString:string];
+       return YES;
+}
+
+- (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error {
+       if ([partialString length] == 0) {
+        *newString = nil;
+        return NO;
+    }
+    
+       unichar aChar;
+       for (int i = 0; i < [partialString length]; i++) {
+               aChar = [partialString characterAtIndex:i];
+               if ((aChar == ' ') || (aChar == '=') || (aChar == ',') || (aChar == ';')) {
+                       *newString = nil;
+                       return NO;
+               }
+       }
+    
+    return YES;
+}
+
+@end