Support Ansel's version 2 API
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 3 Sep 2010 19:31:37 +0000 (15:31 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 3 Sep 2010 19:31:37 +0000 (15:31 -0400)
25 files changed:
iPhoto2Ansel/AnselExportController.h
iPhoto2Ansel/AnselExportController.m
iPhoto2Ansel/AnselExportPluginBox.h
iPhoto2Ansel/AnselExportPluginBox.m
iPhoto2Ansel/ExportImageProtocol.h
iPhoto2Ansel/ExportPluginBoxProtocol.h
iPhoto2Ansel/ExportPluginProtocol.h
iPhoto2Ansel/FBProgressController.h
iPhoto2Ansel/FBProgressController.m
iPhoto2Ansel/NSDataAdditions.h
iPhoto2Ansel/NSDataAdditions.m
iPhoto2Ansel/NSStringAdditions.h
iPhoto2Ansel/NSStringAdditions.m
iPhoto2Ansel/Resources/English.lproj/Panel.nib/designable.nib
iPhoto2Ansel/Resources/English.lproj/Panel.nib/keyedobjects.nib
iPhoto2Ansel/TURAnselKit/AnselGalleryViewItem.h
iPhoto2Ansel/TURAnselKit/AnselGalleryViewItem.m
iPhoto2Ansel/TURAnselKit/TURAnsel.h
iPhoto2Ansel/TURAnselKit/TURAnsel.m
iPhoto2Ansel/TURAnselKit/TURAnselConstants.h
iPhoto2Ansel/TURAnselKit/TURAnselConstants.m
iPhoto2Ansel/TURAnselKit/TURAnselGallery.h
iPhoto2Ansel/TURAnselKit/TURAnselGallery.m
iPhoto2Ansel/TURAnselKit/TURAnselGalleryPanelController.h
iPhoto2Ansel/TURAnselKit/TURAnselGalleryPanelController.m

index e253b06..4993f69 100644 (file)
@@ -1,10 +1,11 @@
-//
-//  AnselExportController.h
-//  iPhoto2Ansel
-//
-//  Created by Michael Rubinsky on 10/23/08.
-//  Copyright 2008 __MyCompanyName__. All rights reserved.
-//
+/**
+ * iPhoto2Ansel
+ *
+ * Copyright 2008-2010 The Horde Project (http://www.horde.org)
+ *
+ * @license http://opensource.org/licenses/bsd-license.php
+ * @author  Michael J. Rubinsky <mrubinsk@horde.org>
+ */
 
 #import <Cocoa/Cocoa.h>
 #import <Quartz/Quartz.h>
@@ -35,6 +36,7 @@
     IBOutlet NSButton *mNewGalleryButton;
     IBOutlet NSPopUpButton *mServersPopUp;
     IBOutlet NSTextField *mImageCountLabel;
+    IBOutlet NSPopUpButton *mAnselVersion;
     
     // Gallery View
     IBOutlet NSButton *viewGallery;
index d4e7165..95d6d81 100644 (file)
@@ -1,7 +1,8 @@
 /**
  * AnselExportController.m
+ * iPhoto2Ansel
  *
- * Copyright 2008 The Horde Project (http://www.horde.org)
+ * Copyright 2008-2010 The Horde Project (http://www.horde.org)
  * 
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
@@ -37,6 +38,7 @@ NSString * const TURAnselServerNickKey = @"nickname";
 NSString * const TURAnselServerEndpointKey = @"endpoint";
 NSString * const TURAnselServerUsernameKey = @"username";
 NSString * const TURAnselServerPasswordKey = @"password";
+NSString * const TURAnselServerVersionKey = @"version";
 
 @implementation AnselExportController
 
@@ -266,6 +268,7 @@ NSString * const TURAnselServerPasswordKey = @"password";
                                [mServerSheetHostURL stringValue], TURAnselServerEndpointKey,
                                [mServerSheetUsername stringValue], TURAnselServerUsernameKey,
                                [mServerSheetPassword stringValue], TURAnselServerPasswordKey,
+                               [NSNumber numberWithInt: [mAnselVersion indexOfSelectedItem] + 1] , TURAnselServerVersionKey,
                                 nil];
     [anselServers addObject: newServer];
     [NSApp endSheet: newServerSheet];
@@ -509,12 +512,23 @@ NSString * const TURAnselServerPasswordKey = @"password";
     [self setStatusText: @"Connecting..."];
     [spinner startAnimation: self];
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    
+    // NSDictionary objects cannot contain nil objects
+    NSNumber *apiversion = [currentServer objectForKey: TURAnselServerVersionKey];
+    if (apiversion == nil) {
+        apiversion = [NSNumber numberWithInt: 1];
+    }
     NSDictionary *p = [[NSDictionary alloc] initWithObjects: [NSArray arrayWithObjects:
                                                               [currentServer objectForKey:TURAnselServerEndpointKey],
                                                               [currentServer objectForKey:TURAnselServerUsernameKey],
                                                               [currentServer objectForKey:TURAnselServerPasswordKey],
+                                                              apiversion,
                                                               nil]
-                                                    forKeys: [NSArray arrayWithObjects:@"endpoint", @"username", @"password", nil]];
+                                                    forKeys: [NSArray arrayWithObjects:TURAnselServerEndpointKey,
+                                                                                       TURAnselServerUsernameKey,
+                                                                                       TURAnselServerPasswordKey,
+                                                                                       TURAnselServerVersionKey,
+                                                                                       nil]];
     // Create our controller
     anselController = [[TURAnsel alloc] initWithConnectionParameters:p];
     [anselController setDelegate:self];
index 9bf027a..f1678a5 100644 (file)
@@ -1,10 +1,11 @@
-//
-//  AnselExportPluginBox.h
-//  iPhoto2Ansel
-//
-//  Created by Michael Rubinsky on 10/23/08.
-//  Copyright 2008 __MyCompanyName__. All rights reserved.
-//
+/**
+ * iPhoto2Ansel
+ *
+ * Copyright 2008-2010 The Horde Project (http://www.horde.org)
+ *
+ * @license http://opensource.org/licenses/bsd-license.php
+ * @author  Michael J. Rubinsky <mrubinsk@horde.org>
+ */
 
 #import <Cocoa/Cocoa.h>
 #import "ExportPluginProtocol.h"
index ef325f8..c67afcc 100644 (file)
@@ -1,14 +1,12 @@
-//
-//  AnselExportPluginBox.m
-//  iPhoto2Ansel
-//
-//  Generic PluginBox handles Enter key presses to initiate the
-//  export.
-//
-//  Created by Michael Rubinsky on 10/23/08.
-//  Copyright 2008 __MyCompanyName__. All rights reserved.
-//
-
+/**
+ * AnselExportPluginBox.m
+ * iPhoto2Ansel
+ *
+ * Copyright 2008-2010 The Horde Project (http://www.horde.org)
+ *
+ * @license http://opensource.org/licenses/bsd-license.php
+ * @author  Michael J. Rubinsky <mrubinsk@horde.org>
+ */
 #import "AnselExportPluginBox.h"
 
 @implementation AnselExportPluginBox
@@ -18,7 +16,7 @@
 {
     NSString *keyString = [anEvent charactersIgnoringModifiers];
     unichar keyChar = [keyString characterAtIndex:0];
-    
+
     switch (keyChar)
     {
         case NSFormFeedCharacter:
@@ -32,7 +30,7 @@
         default:
             break;
     }
-    
+
     return([super performKeyEquivalent:anEvent]);
 }
 @end
index d9334f6..37180df 100755 (executable)
@@ -1,16 +1,16 @@
 /*
      File:       ExportImageProtocol.h
+
      Contains:   iPhoto Plug-ins interfaces: Protocol for image exporting
+
      Version:    Technology: iPhoto
                  Release:    1.0
+
      Copyright:  © 2002-2007 by Apple Inc. All rights reserved.
+
      Bugs?:      For bug reports, consult the following page on
                  the World Wide Web:
+
                      http://developer.apple.com/bugreporter/
 */
 
index cf9f9ac..8761d14 100755 (executable)
@@ -1,16 +1,16 @@
 /*
      File:       ExportPluginBoxProtocol.h
+
      Contains:   iPhoto Plug-ins interfaces: Export plugin box expected format and methods
+
      Version:    Technology: iPhoto
                  Release:    1.0
+
      Copyright:  © 2002-2007 by Apple Inc. All rights reserved.
+
      Bugs?:      For bug reports, consult the following page on
                  the World Wide Web:
+
                      http://developer.apple.com/bugreporter/
 */
 
index 96bdbff..9e18ea2 100755 (executable)
@@ -1,16 +1,16 @@
 /*
      File:       ExportPluginProtocol.h
+
      Contains:   iPhoto Plug-ins interfaces: Export plugin expected format and methods
+
      Version:    Technology: iPhoto
                  Release:    1.0
+
      Copyright:  © 2002-2007 by Apple Inc. All rights reserved.
+
      Bugs?:      For bug reports, consult the following page on
                  the World Wide Web:
+
                      http://developer.apple.com/bugreporter/
 */
 
@@ -88,7 +88,7 @@ typedef struct
 
        // This selector may be called from within a separate NSThread.
        // Perform the export with the current settings to <path>.
-       // It will periodically send the <callback> selector a 
+       // It will periodically send the <callback> selector a
        // progress message in the form of a pointer to a ExportPluginProgress structure.
 - (void)performExport:(NSString *)path;
 
index 4fb61bd..7ae55df 100644 (file)
@@ -2,35 +2,35 @@
  * Facebook Exporter for iPhoto Software License
  * Copyright 2007, Facebook, Inc.
  * All rights reserved.
- * Permission is hereby granted, free of charge, to any person or organization 
- * obtaining a copy of the software and accompanying documentation covered by 
- * this license (which, together with any graphical images included with such 
- * software, are collectively referred to below as the “Software”) to (a) use, 
- * reproduce, display, distribute, execute, and transmit the Software, (b) 
- * prepare derivative works of the Software (excluding any graphical images 
- * included with the Software, which may not be modified or altered), and (c) 
- * permit third-parties to whom the Software is furnished to do so, all 
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (which, together with any graphical images included with such
+ * software, are collectively referred to below as the “Software”) to (a) use,
+ * reproduce, display, distribute, execute, and transmit the Software, (b)
+ * prepare derivative works of the Software (excluding any graphical images
+ * included with the Software, which may not be modified or altered), and (c)
+ * permit third-parties to whom the Software is furnished to do so, all
  * subject to the following:
  *
- * - Redistributions of source code must retain the above copyright notice, 
+ * - Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice, 
- *   this list of conditions and the following disclaimer in the documentation 
+ * - 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.
- * - Neither the name of Facebook, Inc. nor the names of its contributors may 
- *   be used to endorse or promote products derived from this software without 
+ * - Neither the name of Facebook, Inc. nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
  *   specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER 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 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER 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.
  *
  */
index 30be30b..ea1c0da 100644 (file)
@@ -2,35 +2,35 @@
  * Facebook Exporter for iPhoto Software License
  * Copyright 2007, Facebook, Inc.
  * All rights reserved.
- * Permission is hereby granted, free of charge, to any person or organization 
- * obtaining a copy of the software and accompanying documentation covered by 
- * this license (which, together with any graphical images included with such 
- * software, are collectively referred to below as the “Software”) to (a) use, 
- * reproduce, display, distribute, execute, and transmit the Software, (b) 
- * prepare derivative works of the Software (excluding any graphical images 
- * included with the Software, which may not be modified or altered), and (c) 
- * permit third-parties to whom the Software is furnished to do so, all 
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (which, together with any graphical images included with such
+ * software, are collectively referred to below as the “Software”) to (a) use,
+ * reproduce, display, distribute, execute, and transmit the Software, (b)
+ * prepare derivative works of the Software (excluding any graphical images
+ * included with the Software, which may not be modified or altered), and (c)
+ * permit third-parties to whom the Software is furnished to do so, all
  * subject to the following:
  *
- * - Redistributions of source code must retain the above copyright notice, 
+ * - Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice, 
- *   this list of conditions and the following disclaimer in the documentation 
+ * - 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.
- * - Neither the name of Facebook, Inc. nor the names of its contributors may 
- *   be used to endorse or promote products derived from this software without 
+ * - Neither the name of Facebook, Inc. nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
  *   specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER 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 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER 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.
  *
  */
@@ -78,7 +78,7 @@ NSString* const CompleteStatus = @"Export completed!";
     [progressIndicator setIndeterminate: YES];
     [progressIndicator startAnimation: nil];
     [self setStatus: @"Started export"];
-    
+
     [NSApp beginSheet: progressPanel modalForWindow: [fbExport window] modalDelegate: nil didEndSelector: nil contextInfo: nil];
 }
 
index a0f6acb..b745010 100644 (file)
@@ -1,16 +1,16 @@
-// 
+//
 // Copyright 2008 Eric Czarny <eczarny@gmail.com>
-// 
+//
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of  this  software  and  associated documentation files (the "Software"), to
 // deal  in  the Software without restriction, including without limitation the
 // rights  to  use,  copy,  modify,  merge,  publish,  distribute,  sublicense,
 // and/or sell copies  of  the  Software,  and  to  permit  persons to whom the
 // Software is furnished to do so, subject to the following conditions:
-// 
+//
 // The  above  copyright notice and this permission notice shall be included in
 // all copies or substantial portions of the Software.
-// 
+//
 // THE  SOFTWARE  IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 // IMPLIED,  INCLUDING  BUT  NOT  LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 // FITNESS  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 // LIABILITY,  WHETHER  IN  AN  ACTION  OF CONTRACT, TORT OR OTHERWISE, ARISING
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
-// 
+//
 
-// 
+//
 // Cocoa XML-RPC Framework
 // NSDataAdditions.h
-// 
+//
 // Created by Eric Czarny on Wednesday, January 14, 2004.
 // Copyright 2008 Divisible by Zero.
-// 
+//
 
 #import <Foundation/NSData.h>
 
index 4b3c076..ae89859 100644 (file)
@@ -1,16 +1,16 @@
-// 
+//
 // Copyright 2008 Eric Czarny <eczarny@gmail.com>
-// 
+//
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of  this  software  and  associated documentation files (the "Software"), to
 // deal  in  the Software without restriction, including without limitation the
 // rights  to  use,  copy,  modify,  merge,  publish,  distribute,  sublicense,
 // and/or sell copies  of  the  Software,  and  to  permit  persons to whom the
 // Software is furnished to do so, subject to the following conditions:
-// 
+//
 // The  above  copyright notice and this permission notice shall be included in
 // all copies or substantial portions of the Software.
-// 
+//
 // THE  SOFTWARE  IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 // IMPLIED,  INCLUDING  BUT  NOT  LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 // FITNESS  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 // LIABILITY,  WHETHER  IN  AN  ACTION  OF CONTRACT, TORT OR OTHERWISE, ARISING
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
-// 
+//
 
-// 
+//
 // Cocoa XML-RPC Framework
 // NSDataAdditions.m
-// 
+//
 // Created by Eric Czarny on Wednesday, January 14, 2004.
 // Copyright 2008 Divisible by Zero.
-// 
+//
 
 #import "NSDataAdditions.h"
 
        Boolean flignore, flendtext = false;
        const char *temporary;
        NSMutableData *result;
-       
+
        if (string == nil) {
                return [NSData data];
        }
-       
+
        ixtext = 0;
-       
+
        temporary = [string UTF8String];
-       
+
        lentext = [string length];
-       
+
        result = [NSMutableData dataWithCapacity: lentext];
-       
+
        ixinput = 0;
-       
+
        while (true) {
                if (ixtext >= lentext) {
                        break;
                }
-               
+
                ch = temporary[ixtext++];
-               
+
                flignore = false;
-               
+
                if ((ch >= 'A') && (ch <= 'Z')) {
                        ch = ch - 'A';
                } else if ((ch >= 'a') && (ch <= 'z')) {
                } else if (ch == '/') {
                        ch = 63;
                } else {
-                       flignore = true; 
+                       flignore = true;
                }
-               
+
                if (!flignore) {
                        short ctcharsinput = 3;
                        Boolean flbreak = false;
-                       
+
                        if (flendtext) {
                                if (ixinput == 0) {
                                        break;
                                }
-                               
+
                                if ((ixinput == 1) || (ixinput == 2)) {
                                        ctcharsinput = 1;
                                } else {
                                        ctcharsinput = 2;
                                }
-                               
+
                                ixinput = 3;
-                               
+
                                flbreak = true;
                        }
-                       
+
                        input[ixinput++] = ch;
-                       
+
                        if (ixinput == 4) {
                                ixinput = 0;
-                               
+
                                output[0] = (input[0] << 2) | ((input[1] & 0x30) >> 4);
                                output[1] = ((input[1] & 0x0F) << 4) | ((input[2] & 0x3C) >> 2);
                                output[2] = ((input[2] & 0x03) << 6) | (input[3] & 0x3F);
-                               
+
                                for (i = 0; i < ctcharsinput; i++) {
                                        [result appendBytes: &output[i] length: 1];
                                }
                        }
-                       
+
                        if (flbreak) {
                                break;
                        }
                }
        }
-       
+
        return result;
 }
 
index b4776f9..2abc220 100644 (file)
@@ -1,16 +1,16 @@
-// 
+//
 // Copyright 2008 Eric Czarny <eczarny@gmail.com>
-// 
+//
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of  this  software  and  associated documentation files (the "Software"), to
 // deal  in  the Software without restriction, including without limitation the
 // rights  to  use,  copy,  modify,  merge,  publish,  distribute,  sublicense,
 // and/or sell copies  of  the  Software,  and  to  permit  persons to whom the
 // Software is furnished to do so, subject to the following conditions:
-// 
+//
 // The  above  copyright notice and this permission notice shall be included in
 // all copies or substantial portions of the Software.
-// 
+//
 // THE  SOFTWARE  IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 // IMPLIED,  INCLUDING  BUT  NOT  LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 // FITNESS  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 // LIABILITY,  WHETHER  IN  AN  ACTION  OF CONTRACT, TORT OR OTHERWISE, ARISING
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
-// 
+//
 
-// 
+//
 // Cocoa XML-RPC Framework
 // NSStringAdditions.h
-// 
+//
 // Created by Eric Czarny on Wednesday, January 14, 2004.
 // Copyright 2008 Divisible by Zero.
-// 
+//
 
 #import <Foundation/NSString.h>
 
index 22387b9..0566103 100644 (file)
@@ -1,16 +1,16 @@
-// 
+//
 // Copyright 2008 Eric Czarny <eczarny@gmail.com>
-// 
+//
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of  this  software  and  associated documentation files (the "Software"), to
 // deal  in  the Software without restriction, including without limitation the
 // rights  to  use,  copy,  modify,  merge,  publish,  distribute,  sublicense,
 // and/or sell copies  of  the  Software,  and  to  permit  persons to whom the
 // Software is furnished to do so, subject to the following conditions:
-// 
+//
 // The  above  copyright notice and this permission notice shall be included in
 // all copies or substantial portions of the Software.
-// 
+//
 // THE  SOFTWARE  IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 // IMPLIED,  INCLUDING  BUT  NOT  LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 // FITNESS  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 // LIABILITY,  WHETHER  IN  AN  ACTION  OF CONTRACT, TORT OR OTHERWISE, ARISING
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
-// 
+//
 
-// 
+//
 // Cocoa XML-RPC Framework
 // NSStringAdditions.m
-// 
+//
 // Created by Eric Czarny on Wednesday, January 14, 2004.
 // Copyright 2008 Divisible by Zero.
-// 
+//
 
 #import "NSDataAdditions.h"
 
@@ -47,72 +47,72 @@ static char base64EncodingTable[64] = {
        short i, charsonline = 0, ctcopy;
        const unsigned char *raw;
        NSMutableString *result;
-    
+
        lentext = [data length];
-       
+
        if (lentext < 1) {
                return @"";
        }
-       
+
        result = [NSMutableString stringWithCapacity: lentext];
-       
+
        raw = [data bytes];
-       
-       ixtext = 0; 
-       
+
+       ixtext = 0;
+
        while (true) {
                ctremaining = lentext - ixtext;
-               
+
                if (ctremaining <= 0) {
                        break;
                }
-               
-               for (i = 0; i < 3; i++) { 
+
+               for (i = 0; i < 3; i++) {
                        unsigned long ix = ixtext + i;
-                       
+
                        if (ix < lentext) {
                                input[i] = raw[ix];
                        } else {
                                input[i] = 0;
                        }
                }
-               
+
                output[0] = (input[0] & 0xFC) >> 2;
                output[1] = ((input[0] & 0x03) << 4) | ((input[1] & 0xF0) >> 4);
                output[2] = ((input[1] & 0x0F) << 2) | ((input[2] & 0xC0) >> 6);
                output[3] = input[2] & 0x3F;
-               
+
                ctcopy = 4;
-               
+
                switch (ctremaining) {
-                       case 1: 
-                               ctcopy = 2; 
+                       case 1:
+                               ctcopy = 2;
                                break;
-                       case 2: 
-                               ctcopy = 3; 
+                       case 2:
+                               ctcopy = 3;
                                break;
                }
-               
+
                for (i = 0; i < ctcopy; i++) {
                        [result appendString: [NSString stringWithFormat: @"%c", base64EncodingTable[output[i]]]];
                }
-               
+
                for (i = ctcopy; i < 4; i++) {
                        [result appendString: @"="];
                }
-               
+
                ixtext += 3;
                charsonline += 4;
-               
+
                if (length > 0) {
                        if (charsonline >= length) {
                                charsonline = 0;
-                               
+
                                [result appendString: @"\n"];
                        }
                }
        }
-       
+
        return result;
 }
 
index a0d9f67..6bed80b 100644 (file)
@@ -2,10 +2,10 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
        <data>
                <int key="IBDocument.SystemTarget">1050</int>
-               <string key="IBDocument.SystemVersion">10B504</string>
-               <string key="IBDocument.InterfaceBuilderVersion">732</string>
-               <string key="IBDocument.AppKitVersion">1038.2</string>
-               <string key="IBDocument.HIToolboxVersion">437.00</string>
+               <string key="IBDocument.SystemVersion">10F569</string>
+               <string key="IBDocument.InterfaceBuilderVersion">762</string>
+               <string key="IBDocument.AppKitVersion">1038.29</string>
+               <string key="IBDocument.HIToolboxVersion">461.00</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                        <object class="NSArray" key="dict.sortedKeys">
                        </object>
                        <object class="NSMutableArray" key="dict.values">
                                <bool key="EncodedWithXMLCoder">YES</bool>
-                               <string>732</string>
+                               <string>762</string>
                                <string>1.1</string>
                        </object>
                </object>
                <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                        <integer value="137"/>
+                       <integer value="388"/>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                        <object class="NSWindowTemplate" id="920958882">
                                <int key="NSWindowStyleMask">23</int>
                                <int key="NSWindowBacking">2</int>
-                               <string key="NSWindowRect">{{196, 315}, {455, 195}}</string>
+                               <string key="NSWindowRect">{{196, 281}, {455, 229}}</string>
                                <int key="NSWTFlags">-1543503872</int>
                                <string key="NSWindowTitle">Add Server</string>
                                <string key="NSWindowClass">NSPanel</string>
                                <nil key="NSViewClass"/>
                                <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
                                <object class="NSView" key="NSWindowView" id="345710193">
-                                       <nil key="NSNextResponder"/>
+                                       <reference key="NSNextResponder"/>
                                        <int key="NSvFlags">256</int>
                                        <object class="NSMutableArray" key="NSSubviews">
                                                <bool key="EncodedWithXMLCoder">YES</bool>
                                                <object class="NSTextField" id="143194876">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{124, 124}, {311, 22}}</string>
+                                                       <string key="NSFrame">{{124, 158}, {311, 22}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="954322263">
                                                <object class="NSTextField" id="816852072">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{17, 126}, {102, 17}}</string>
+                                                       <string key="NSFrame">{{17, 160}, {102, 17}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="748421632">
                                                <object class="NSTextField" id="943485916">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{124, 92}, {311, 22}}</string>
+                                                       <string key="NSFrame">{{124, 126}, {311, 22}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="332374721">
                                                <object class="NSSecureTextField" id="407883474">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{124, 60}, {311, 22}}</string>
+                                                       <string key="NSFrame">{{124, 94}, {311, 22}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSSecureTextFieldCell" key="NSCell" id="321721582">
                                                <object class="NSTextField" id="545362646">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{17, 94}, {67, 17}}</string>
+                                                       <string key="NSFrame">{{17, 128}, {67, 17}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="726913580">
                                                <object class="NSTextField" id="377949113">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{17, 62}, {67, 17}}</string>
+                                                       <string key="NSFrame">{{17, 96}, {67, 17}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1043094791">
                                                <object class="NSTextField" id="17412812">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{17, 158}, {102, 17}}</string>
+                                                       <string key="NSFrame">{{17, 192}, {102, 17}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="1034567103">
                                                <object class="NSTextField" id="536650280">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{124, 156}, {311, 22}}</string>
+                                                       <string key="NSFrame">{{124, 190}, {311, 22}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="611300750">
                                                <object class="NSButton" id="381272541">
                                                        <reference key="NSNextResponder" ref="345710193"/>
                                                        <int key="NSvFlags">268</int>
-                                                       <string key="NSFrame">{{18, 18}, {145, 18}}</string>
+                                                       <string key="NSFrame">{{18, 21}, {145, 18}}</string>
                                                        <reference key="NSSuperview" ref="345710193"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="754494626">
                                                                <int key="NSPeriodicInterval">25</int>
                                                        </object>
                                                </object>
+                                               <object class="NSTextField" id="219647969">
+                                                       <reference key="NSNextResponder" ref="345710193"/>
+                                                       <int key="NSvFlags">268</int>
+                                                       <string key="NSFrame">{{17, 71}, {67, 17}}</string>
+                                                       <reference key="NSSuperview" ref="345710193"/>
+                                                       <bool key="NSEnabled">YES</bool>
+                                                       <object class="NSTextFieldCell" key="NSCell" id="732025825">
+                                                               <int key="NSCellFlags">68288064</int>
+                                                               <int key="NSCellFlags2">272630784</int>
+                                                               <string key="NSContents">Version</string>
+                                                               <reference key="NSSupport" ref="1065031457"/>
+                                                               <reference key="NSControlView" ref="219647969"/>
+                                                               <reference key="NSBackgroundColor" ref="258809705"/>
+                                                               <reference key="NSTextColor" ref="428586510"/>
+                                                       </object>
+                                               </object>
+                                               <object class="NSPopUpButton" id="637006678">
+                                                       <reference key="NSNextResponder" ref="345710193"/>
+                                                       <int key="NSvFlags">268</int>
+                                                       <string key="NSFrame">{{121, 65}, {100, 26}}</string>
+                                                       <reference key="NSSuperview" ref="345710193"/>
+                                                       <bool key="NSEnabled">YES</bool>
+                                                       <object class="NSPopUpButtonCell" key="NSCell" id="730871934">
+                                                               <int key="NSCellFlags">-2076049856</int>
+                                                               <int key="NSCellFlags2">2048</int>
+                                                               <reference key="NSSupport" ref="1065031457"/>
+                                                               <reference key="NSControlView" ref="637006678"/>
+                                                               <int key="NSButtonFlags">109199615</int>
+                                                               <int key="NSButtonFlags2">129</int>
+                                                               <string key="NSAlternateContents"/>
+                                                               <string key="NSKeyEquivalent"/>
+                                                               <int key="NSPeriodicDelay">400</int>
+                                                               <int key="NSPeriodicInterval">75</int>
+                                                               <object class="NSMenuItem" key="NSMenuItem" id="777951784">
+                                                                       <reference key="NSMenu" ref="864692499"/>
+                                                                       <string key="NSTitle">2.x</string>
+                                                                       <string key="NSKeyEquiv"/>
+                                                                       <int key="NSKeyEquivModMask">1048576</int>
+                                                                       <int key="NSMnemonicLoc">2147483647</int>
+                                                                       <int key="NSState">1</int>
+                                                                       <object class="NSCustomResource" key="NSOnImage" id="310030708">
+                                                                               <string key="NSClassName">NSImage</string>
+                                                                               <string key="NSResourceName">NSMenuCheckmark</string>
+                                                                       </object>
+                                                                       <object class="NSCustomResource" key="NSMixedImage" id="735163678">
+                                                                               <string key="NSClassName">NSImage</string>
+                                                                               <string key="NSResourceName">NSMenuMixedState</string>
+                                                                       </object>
+                                                                       <string key="NSAction">_popUpItemAction:</string>
+                                                                       <reference key="NSTarget" ref="730871934"/>
+                                                               </object>
+                                                               <bool key="NSMenuItemRespectAlignment">YES</bool>
+                                                               <object class="NSMenu" key="NSMenu" id="864692499">
+                                                                       <string key="NSTitle">OtherViews</string>
+                                                                       <object class="NSMutableArray" key="NSMenuItems">
+                                                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                                                               <object class="NSMenuItem" id="62202253">
+                                                                                       <reference key="NSMenu" ref="864692499"/>
+                                                                                       <string key="NSTitle">1.x</string>
+                                                                                       <string key="NSKeyEquiv"/>
+                                                                                       <int key="NSKeyEquivModMask">1048576</int>
+                                                                                       <int key="NSMnemonicLoc">2147483647</int>
+                                                                                       <reference key="NSOnImage" ref="310030708"/>
+                                                                                       <reference key="NSMixedImage" ref="735163678"/>
+                                                                                       <string key="NSAction">_popUpItemAction:</string>
+                                                                                       <reference key="NSTarget" ref="730871934"/>
+                                                                               </object>
+                                                                               <reference ref="777951784"/>
+                                                                       </object>
+                                                                       <reference key="NSMenuFont" ref="1065031457"/>
+                                                               </object>
+                                                               <int key="NSSelectedIndex">1</int>
+                                                               <int key="NSPreferredEdge">1</int>
+                                                               <bool key="NSUsesItemFromMenu">YES</bool>
+                                                               <bool key="NSAltersState">YES</bool>
+                                                               <int key="NSArrowPosition">2</int>
+                                                       </object>
+                                               </object>
                                        </object>
-                                       <string key="NSFrameSize">{455, 195}</string>
+                                       <string key="NSFrameSize">{455, 229}</string>
+                                       <reference key="NSSuperview"/>
                                </object>
                                <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
                                <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
                                                        <reference key="NSHScroller" ref="434957656"/>
                                                        <reference key="NSContentView" ref="1028887197"/>
                                                        <reference key="NSHeaderClipView" ref="490935428"/>
-                                                       <reference key="NSCornerView" ref="814300438"/>
                                                        <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
                                                </object>
                                                <object class="NSButton" id="887276643">
                                <nil key="NSViewClass"/>
                                <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
                                <object class="NSView" key="NSWindowView" id="573233790">
-                                       <reference key="NSNextResponder"/>
+                                       <nil key="NSNextResponder"/>
                                        <int key="NSvFlags">256</int>
                                        <object class="NSMutableArray" key="NSSubviews">
                                                <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <int key="NSvFlags">268</int>
                                                        <string key="NSFrame">{{370, 12}, {96, 32}}</string>
                                                        <reference key="NSSuperview" ref="573233790"/>
-                                                       <reference key="NSWindow"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSButtonCell" key="NSCell" id="569706565">
                                                                <int key="NSCellFlags">67239424</int>
                                                                                                        <string>NSTypedFilenamesPboardType:SGI</string>
                                                                                                        <string>NSTypedFilenamesPboardType:SR2</string>
                                                                                                        <string>NSTypedFilenamesPboardType:SRF</string>
+                                                                                                       <string>NSTypedFilenamesPboardType:SRW</string>
                                                                                                        <string>NSTypedFilenamesPboardType:TARGA</string>
                                                                                                        <string>NSTypedFilenamesPboardType:TGA</string>
                                                                                                        <string>NSTypedFilenamesPboardType:TIF</string>
                                                                                                        <string>NSTypedFilenamesPboardType:sgi</string>
                                                                                                        <string>NSTypedFilenamesPboardType:sr2</string>
                                                                                                        <string>NSTypedFilenamesPboardType:srf</string>
+                                                                                                       <string>NSTypedFilenamesPboardType:srw</string>
                                                                                                        <string>NSTypedFilenamesPboardType:targa</string>
                                                                                                        <string>NSTypedFilenamesPboardType:tga</string>
                                                                                                        <string>NSTypedFilenamesPboardType:tif</string>
                                                                                        </object>
                                                                                        <string key="NSFrameSize">{423, 337}</string>
                                                                                        <reference key="NSSuperview" ref="896759949"/>
-                                                                                       <reference key="NSWindow"/>
                                                                                        <bool key="constrainsToOriginalSize">NO</bool>
                                                                                        <bool key="cellsHaveSubtitle">YES</bool>
                                                                                        <bool key="cellsHaveTitle">YES</bool>
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 1}, {423, 337}}</string>
                                                                        <reference key="NSSuperview" ref="445821140"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="798730592"/>
                                                                        <reference key="NSDocView" ref="798730592"/>
                                                                        <reference key="NSBGColor" ref="258809705"/>
                                                                        <int key="NSvFlags">256</int>
                                                                        <string key="NSFrame">{{424, 1}, {15, 337}}</string>
                                                                        <reference key="NSSuperview" ref="445821140"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSTarget" ref="445821140"/>
                                                                        <string key="NSAction">_doScroller:</string>
                                                                        <double key="NSCurValue">1</double>
                                                                        <int key="NSvFlags">256</int>
                                                                        <string key="NSFrame">{{1, 338}, {423, 15}}</string>
                                                                        <reference key="NSSuperview" ref="445821140"/>
-                                                                       <reference key="NSWindow"/>
                                                                        <int key="NSsFlags">1</int>
                                                                        <reference key="NSTarget" ref="445821140"/>
                                                                        <string key="NSAction">_doScroller:</string>
                                                        </object>
                                                        <string key="NSFrame">{{20, 60}, {440, 354}}</string>
                                                        <reference key="NSSuperview" ref="573233790"/>
-                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="896759949"/>
                                                        <int key="NSsFlags">50</int>
                                                        <reference key="NSVScroller" ref="34214668"/>
                                                </object>
                                        </object>
                                        <string key="NSFrameSize">{480, 413}</string>
-                                       <reference key="NSSuperview"/>
-                                       <reference key="NSWindow"/>
                                </object>
                                <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
                                <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
                                                                                                                                        <int key="NSKeyEquivModMask">1048576</int>
                                                                                                                                        <int key="NSMnemonicLoc">2147483647</int>
                                                                                                                                        <int key="NSState">1</int>
-                                                                                                                                       <object class="NSCustomResource" key="NSOnImage" id="441143142">
-                                                                                                                                               <string key="NSClassName">NSImage</string>
-                                                                                                                                               <string key="NSResourceName">NSMenuCheckmark</string>
-                                                                                                                                       </object>
-                                                                                                                                       <object class="NSCustomResource" key="NSMixedImage" id="1052235771">
-                                                                                                                                               <string key="NSClassName">NSImage</string>
-                                                                                                                                               <string key="NSResourceName">NSMenuMixedState</string>
-                                                                                                                                       </object>
+                                                                                                                                       <reference key="NSOnImage" ref="310030708"/>
+                                                                                                                                       <reference key="NSMixedImage" ref="735163678"/>
                                                                                                                                        <string key="NSAction">_popUpItemAction:</string>
                                                                                                                                        <reference key="NSTarget" ref="979637046"/>
                                                                                                                                </object>
                                                                                                                                        <int key="NSKeyEquivModMask">1048576</int>
                                                                                                                                        <int key="NSMnemonicLoc">2147483647</int>
                                                                                                                                        <int key="NSState">1</int>
-                                                                                                                                       <reference key="NSOnImage" ref="441143142"/>
-                                                                                                                                       <reference key="NSMixedImage" ref="1052235771"/>
+                                                                                                                                       <reference key="NSOnImage" ref="310030708"/>
+                                                                                                                                       <reference key="NSMixedImage" ref="735163678"/>
                                                                                                                                        <string key="NSAction">_popUpItemAction:</string>
                                                                                                                                        <int key="NSTag">2</int>
                                                                                                                                        <reference key="NSTarget" ref="710721070"/>
                                                                                                                                                        <string key="NSKeyEquiv"/>
                                                                                                                                                        <int key="NSKeyEquivModMask">1048576</int>
                                                                                                                                                        <int key="NSMnemonicLoc">2147483647</int>
-                                                                                                                                                       <reference key="NSOnImage" ref="441143142"/>
-                                                                                                                                                       <reference key="NSMixedImage" ref="1052235771"/>
+                                                                                                                                                       <reference key="NSOnImage" ref="310030708"/>
+                                                                                                                                                       <reference key="NSMixedImage" ref="735163678"/>
                                                                                                                                                        <string key="NSAction">_popUpItemAction:</string>
                                                                                                                                                        <reference key="NSTarget" ref="710721070"/>
                                                                                                                                                </object>
                                                                                                                                                        <string key="NSKeyEquiv"/>
                                                                                                                                                        <int key="NSKeyEquivModMask">1048576</int>
                                                                                                                                                        <int key="NSMnemonicLoc">2147483647</int>
-                                                                                                                                                       <reference key="NSOnImage" ref="441143142"/>
-                                                                                                                                                       <reference key="NSMixedImage" ref="1052235771"/>
+                                                                                                                                                       <reference key="NSOnImage" ref="310030708"/>
+                                                                                                                                                       <reference key="NSMixedImage" ref="735163678"/>
                                                                                                                                                        <string key="NSAction">_popUpItemAction:</string>
                                                                                                                                                        <int key="NSTag">1</int>
                                                                                                                                                        <reference key="NSTarget" ref="710721070"/>
                                                                                                                                                        <string key="NSKeyEquiv"/>
                                                                                                                                                        <int key="NSKeyEquivModMask">1048576</int>
                                                                                                                                                        <int key="NSMnemonicLoc">2147483647</int>
-                                                                                                                                                       <reference key="NSOnImage" ref="441143142"/>
-                                                                                                                                                       <reference key="NSMixedImage" ref="1052235771"/>
+                                                                                                                                                       <reference key="NSOnImage" ref="310030708"/>
+                                                                                                                                                       <reference key="NSMixedImage" ref="735163678"/>
                                                                                                                                                        <string key="NSAction">_popUpItemAction:</string>
                                                                                                                                                        <int key="NSTag">3</int>
                                                                                                                                                        <reference key="NSTarget" ref="710721070"/>
                                        </object>
                                        <int key="connectionID">583</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">mAnselVersion</string>
+                                               <reference key="source" ref="685567789"/>
+                                               <reference key="destination" ref="637006678"/>
+                                       </object>
+                                       <int key="connectionID">641</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                                        <reference ref="931753347"/>
                                                        <reference ref="470501331"/>
                                                        <reference ref="381272541"/>
+                                                       <reference ref="219647969"/>
+                                                       <reference ref="637006678"/>
                                                </object>
                                                <reference key="parent" ref="920958882"/>
                                        </object>
                                                <reference key="object" ref="441029368"/>
                                                <reference key="parent" ref="140247589"/>
                                        </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">626</int>
+                                               <reference key="object" ref="219647969"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="732025825"/>
+                                               </object>
+                                               <reference key="parent" ref="345710193"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">627</int>
+                                               <reference key="object" ref="732025825"/>
+                                               <reference key="parent" ref="219647969"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">634</int>
+                                               <reference key="object" ref="637006678"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="730871934"/>
+                                               </object>
+                                               <reference key="parent" ref="345710193"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">635</int>
+                                               <reference key="object" ref="730871934"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="864692499"/>
+                                               </object>
+                                               <reference key="parent" ref="637006678"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">636</int>
+                                               <reference key="object" ref="864692499"/>
+                                               <object class="NSMutableArray" key="children">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <reference ref="62202253"/>
+                                                       <reference ref="777951784"/>
+                                               </object>
+                                               <reference key="parent" ref="730871934"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">637</int>
+                                               <reference key="object" ref="62202253"/>
+                                               <reference key="parent" ref="864692499"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">638</int>
+                                               <reference key="object" ref="777951784"/>
+                                               <reference key="parent" ref="864692499"/>
+                                       </object>
                                </object>
                        </object>
                        <object class="NSMutableDictionary" key="flattenedProperties">
                                        <string>582.IBPluginDependency</string>
                                        <string>6.IBPluginDependency</string>
                                        <string>6.ImportedFromIB2</string>
+                                       <string>626.IBPluginDependency</string>
+                                       <string>627.IBPluginDependency</string>
+                                       <string>634.IBPluginDependency</string>
+                                       <string>635.IBPluginDependency</string>
+                                       <string>636.IBEditorWindowLastContentRect</string>
+                                       <string>636.IBPluginDependency</string>
+                                       <string>637.IBPluginDependency</string>
+                                       <string>638.IBPluginDependency</string>
                                        <string>7.CustomClassName</string>
                                        <string>7.IBPluginDependency</string>
                                        <string>7.ImportedFromIB2</string>
                                        <real value="0.0"/>
                                        <real value="0.0"/>
                                        <integer value="1"/>
-                                       <string>{{351, 386}, {455, 195}}</string>
+                                       <string>{{226, 873}, {455, 229}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <string>{{351, 386}, {455, 195}}</string>
+                                       <string>{{226, 873}, {455, 229}}</string>
                                        <integer value="1"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <integer value="1"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <string>{{1069, 745}, {548, 406}}</string>
+                                       <string>{{433, 614}, {548, 406}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <string>{{1069, 745}, {548, 406}}</string>
+                                       <string>{{433, 614}, {548, 406}}</string>
                                        <integer value="1"/>
                                        <integer value="1"/>
                                        <string>{213, 107}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <integer value="1"/>
+                                       <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>{{336, 921}, {100, 43}}</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>AnselExportPluginBox</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <integer value="1"/>
                                </object>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">625</int>
+                       <int key="maxID">641</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
                                                        <string>defaultImageView</string>
                                                        <string>firstView</string>
                                                        <string>galleryCombo</string>
+                                                       <string>mAnselVersion</string>
                                                        <string>mImageCountLabel</string>
                                                        <string>mMakeNewServerDefault</string>
                                                        <string>mNewGalleryButton</string>
                                                        <string>NSImageView</string>
                                                        <string>NSControl</string>
                                                        <string>NSComboBox</string>
+                                                       <string>NSPopUpButton</string>
                                                        <string>NSTextField</string>
                                                        <string>NSButton</string>
                                                        <string>NSButton</string>
                        </object>
                </object>
                <int key="IBDocument.localizationMode">0</int>
+               <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
                        <integer value="1050" key="NS.object.0"/>
                        <integer value="3000" key="NS.object.0"/>
                </object>
                <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-               <string key="IBDocument.LastKnownRelativeProjectPath">../iPhoto2Ansel.xcodeproj</string>
+               <string key="IBDocument.LastKnownRelativeProjectPath">../../iPhoto2Ansel.xcodeproj</string>
                <int key="IBDocument.defaultPropertyAccessControl">3</int>
+               <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+                       <bool key="EncodedWithXMLCoder">YES</bool>
+                       <object class="NSArray" key="dict.sortedKeys">
+                               <bool key="EncodedWithXMLCoder">YES</bool>
+                               <string>NSMenuCheckmark</string>
+                               <string>NSMenuMixedState</string>
+                               <string>NSSwitch</string>
+                       </object>
+                       <object class="NSMutableArray" key="dict.values">
+                               <bool key="EncodedWithXMLCoder">YES</bool>
+                               <string>{9, 8}</string>
+                               <string>{7, 2}</string>
+                               <string>{15, 15}</string>
+                       </object>
+               </object>
        </data>
 </archive>
index 8eb1ec6..6d91891 100644 (file)
Binary files a/iPhoto2Ansel/Resources/English.lproj/Panel.nib/keyedobjects.nib and b/iPhoto2Ansel/Resources/English.lproj/Panel.nib/keyedobjects.nib differ
index 91cbd84..8a9803d 100644 (file)
@@ -2,7 +2,7 @@
  * AnselGalleryViewItem
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @implements IKImageBrowserItem
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
@@ -10,7 +10,7 @@
 #import <Cocoa/Cocoa.h>
 #import <Quartz/Quartz.h>
 
-@interface AnselGalleryViewItem: NSObject 
+@interface AnselGalleryViewItem: NSObject
 {
        NSURL *image;
        NSString *imageID;
index 42edf5b..15aed58 100644 (file)
@@ -5,7 +5,7 @@
  * remote Ansel gallery in an IKImageBrowser.
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @implements IKImageBrowserItem
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
@@ -25,7 +25,7 @@
     imageID = [[theURL absoluteString] retain];
     imageTitle = [theTitle retain];
     imageDate =  [theDate retain];
-    return self; 
+    return self;
 }
 - (void)dealloc
 {
index e897027..c3ea089 100644 (file)
@@ -2,7 +2,7 @@
  * TURAnsel
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
  */
@@ -33,12 +33,14 @@ typedef enum {
 @interface TURAnsel : NSObject <NSComboBoxDataSource>
 #else
 @interface TURAnsel : NSObject
-#endif         
+#endif
 {
     NSString *userAgent;
     NSString *rpcEndPoint;
     NSString *username;
     NSString *password;
+    NSString *version;
+
     NSMutableArray *galleryList;
     TURAnselState state;
     id delegate;
@@ -48,6 +50,7 @@ typedef enum {
 @property (readwrite, retain) NSString *rpcEndPoint;
 @property (readwrite, retain) NSString *username;
 @property (readwrite, retain) NSString *password;
+@property (readwrite, retain) NSString *version;
 
 - (id)initWithConnectionParameters: (NSDictionary *)params;
 - (void)connect;
@@ -62,4 +65,7 @@ typedef enum {
 - (TURAnselState)state;
 - (id)delegate;
 - (void)setDelegate: (id)newDelegate;
+
+- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
+- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index;
 @end
index 31560d1..506cfac 100644 (file)
@@ -4,7 +4,7 @@
  * Main class for interacting with a remote Ansel server.
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
  */
@@ -20,6 +20,7 @@
 @synthesize rpcEndPoint;
 @synthesize username;
 @synthesize password;
+@synthesize version;
 
 #pragma mark -
 #pragma mark init/dealloc
@@ -27,9 +28,9 @@
 {
     [super init];
     galleryList = [[NSMutableArray alloc] init];
-    
+
     // Initialize the connection properties, KVC style
-    [self setValue:[params objectForKey:@"endpoint"] 
+    [self setValue:[params objectForKey:@"endpoint"]
             forKey: @"rpcEndPoint"];
     [self setValue: [params objectForKey:@"username"]
             forKey: @"username"];
             forKey: @"password"];
     [self setValue: @"The Ansel Cocoa XML-RPC Client"
             forKey: @"userAgent"];
-    
+    [self setValue: [params objectForKey:@"version"]
+            forKey: @"version"];
+
     return self;
 }
 -(void) dealloc
 {
-    NSLog(@"TURAnsel dealloc");   
+    NSLog(@"TURAnsel dealloc");
     [galleryList removeAllObjects];
     [galleryList release];
     [rpcEndPoint release];
     [username release];
     [password release];
     [userAgent release];
+    [version release];
     [super dealloc];
 }
 
 #pragma mark -
 #pragma mark Actions
-- (void)connect 
+- (void)connect
 {
     [self doLogin];
 }
  */
 - (NSDictionary *)createNewGallery: (NSDictionary *)params
 {
-    NSArray *apiparams = [NSArray arrayWithObjects: @"ansel", params, nil]; 
-    NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamGaleryParams, nil];
-    
+    NSArray *apiparams;
+    NSArray *order;
+
+    if ([[self valueForKey: @"version"] intValue] == 2) {
+        apiparams = [NSArray arrayWithObjects: params, nil];
+        order = [NSArray arrayWithObjects: kTURAnselAPIParamGalleryParams, nil];
+    } else {
+        apiparams = [NSArray arrayWithObjects: @"ansel", params, nil];
+        order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamGalleryParams, nil];
+    }
+
     NSDictionary *response = [self callRPCMethod: @"images.createGallery"
                                       withParams: apiparams
                                        withOrder: order];
-    
+
     if (response) {
-        NSNumber *gallery_id = [response objectForKey: (NSString *)kWSMethodInvocationResult];    
+        NSNumber *gallery_id = [response objectForKey: (NSString *)kWSMethodInvocationResult];
         NSDictionary *results = [NSDictionary dictionaryWithObjectsAndKeys:
                                  gallery_id, kTURAnselGalleryKeyId,
                                  [params valueForKey: @"name"], kTURAnselGalleryKeyName,
                                  @"", kTURAnselGalleryKeyDescription,
                                  [NSNumber numberWithInt: 0], kTURAnselGalleryKeyImages,
                                  [NSNumber numberWithInt: 0], kTURAnselGalleryKeyDefaultImage, nil];
-        
+
         TURAnselGallery *newGallery = [[TURAnselGallery alloc] initWithObject: results
                                                                    controller: self];
         [galleryList addObject: newGallery];
         [newGallery release];
-        
+
         return results;
     }
-    
+
     return nil;
 }
 
 
 /**
- * Entry point for calling RPC methods on the Horde server. 
- * 
+ * Entry point for calling RPC methods on the Horde server.
+ *
  * @param NSString methodName  The method to call (e.g. images.listGalleries)
  * @param NSArray  params      All the method's parameters
  * @param NSArray  order       Keys for the params array, needed because of how
                       withOrder: (NSArray *) order
 {
     NSLog(@"Initiating connection for %@", methodName);
-    
+
     // Get a URL object
     NSURL *url = [NSURL URLWithString: [self valueForKey: @"rpcEndPoint"]];
     NSDictionary *values = [NSDictionary dictionaryWithObjects: params forKeys:order];
-    
+
     // Credentials
     NSString *user = [self valueForKey:@"username"];
     NSString *pass = [self valueForKey:@"password"];
-    
+
     if (user != nil && [user length] && pass != nil && [pass length]) {
         // Create a custom http request with authorization
         CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault,
                                                          (CFStringRef)pass,
                                                          kCFHTTPAuthenticationSchemeBasic,
                                                          false);
-        
+
         NSLog(@"Results adding credentials to request: %d", success);
         if (!success) {
             NSLog(@"Unable to authenticate");
-            
             if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) {
                 NSError *error = [NSError errorWithDomain:@"TURAnsel"
                                                      code: 1
                                                  userInfo:[NSDictionary dictionaryWithObjectsAndKeys: @"Authentication failure.", @"message", nil]];
-                
                 [[self delegate] TURAnselHadError: error];
             }
-            
+
             return nil;
-            
         } else {
             // Build a new invocation
             [self setState:TURAnselStateWaiting];
             WSMethodInvocationRef rpcCall;
-            rpcCall = WSMethodInvocationCreate((CFURLRef)url, (CFStringRef)methodName, kWSXMLRPCProtocol); 
+            rpcCall = WSMethodInvocationCreate((CFURLRef)url, (CFStringRef)methodName, kWSXMLRPCProtocol);
             WSMethodInvocationSetParameters(rpcCall, (CFDictionaryRef)values, (CFArrayRef)order);
             WSMethodInvocationSetProperty(rpcCall, kWSHTTPMessage, request);
             NSDictionary *result = (NSDictionary *)WSMethodInvocationInvoke(rpcCall);
                         error = [NSError errorWithDomain: @"TURAnsel"
                                                     code: [faultCode intValue]
                                                 userInfo: [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat: @"There was an error contacting the Ansel server: %@, %@", resStatusLine, faultString], @"NSLocalizedDescriptionKey", nil]];
-                        
-                        
-                    } 
+
+
+                    }
                     [resStatusLine release];
                 } else {
                     // No response
                                             userInfo: [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat: @"There was an error contacting the Ansel server: %@", faultString], @"NSLocalizedDescriptionKey", nil]];
 
                 }
-                
+
                 if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) {
                     [[self delegate] TURAnselHadError: error];
                 }
                 [result autorelease];
+
                 return nil;
-                
             }
             CFHTTPMessageRef response = (CFHTTPMessageRef)[result objectForKey:(id)kWSHTTPResponseMessage];
             int resStatusCode = CFHTTPMessageGetResponseStatusCode(response);
             NSLog(@"ResponseCode: %d", resStatusCode);
             [self setState:TURAnselStateConnected];
+
             return [result autorelease];
-        }       
+        }
     }
-    
     NSLog(@"No authentication information present.");
+
     return nil;
-    
 }
 
 #pragma mark -
 #pragma mark Setters/Getters
-// Fetch a gallery by id
+/**
+ * Fetch a gallery by it's id.
+ *
+ * @param NSString galleryId  The gallery's id.
+ *
+ * @return TURAnselGallery  Then gallery object.
+ */
 - (TURAnselGallery *)getGalleryById: (NSString *)galleryId
 {
     for (TURAnselGallery *g in galleryList) {
             return g;
         }
     }
-    
+
     return nil;
 }
 
 /**
  * Return the gallery at the specified position in the internal storage array.
  * Needed for when we are using this class as a datasource for a UI element.
+ *
+ * @param NSInteger index  The index into the storage array.
+ *
+ * @return TURAnselGallery  The galley obejct located at the specified index.
  */
 - (TURAnselGallery *)getGalleryByIndex: (NSInteger)index
 {
 {
     return [galleryList count];
 }
-
 - (id)comboBox:(NSComboBox *)aComboBox
   objectValueForItemAtIndex:(NSInteger)index
 {
 {
     state = newstate;
 }
-
 - (id)delegate {
-    return delegate;    
+    return delegate;
 }
-
 - (void)setDelegate:(id)newDelegate {
     delegate = newDelegate;
 }
  */
 - (void)doLogin
 {
-    NSArray *params = [[NSArray alloc] initWithObjects:
-                       @"ansel",                                 // Scope 
-                       [NSNumber numberWithInt: PERMS_EDIT],     // Perms
-                       @"",                                      // No parent
-                       [NSNumber numberWithBool:YES],            // allLevels
-                       [NSNumber numberWithInt: 0],              // Offset
-                       [NSNumber numberWithInt: 0],              // Count
-                       [self valueForKey:@"username"], nil];     // Restrict to user (This should be an option eventually).
-    
-    NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamPerms,
-                                                kTURAnselAPIParamParent, kTURAnselAPIParamAllLevels,
-                                                kTURAnselAPIParamOffset, kTURAnselAPIParamCount,
-                                                kTURAnselAPIParamUserOnly, nil];
-    
+    NSArray *params;
+    NSArray *order;
+
+    if ([[self valueForKey: @"version"] intValue] == 2) {
+        params = [NSArray arrayWithObjects: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: PERMS_EDIT], @"perm",
+                                                                                        [self valueForKey:@"username"], @"filter",
+                                                                                        nil],
+                                             nil];
+        order = [NSArray arrayWithObjects: kTURAnselAPIParamSingleParameter, nil];
+    } else {
+        // Assume it's version 1.x
+        params = [NSArray arrayWithObjects:
+                           @"ansel",                                 // Scope
+                           [NSNumber numberWithInt: PERMS_EDIT],     // Perms
+                           @"",                                      // No parent
+                           [NSNumber numberWithBool:YES],            // allLevels
+                           [NSNumber numberWithInt: 0],              // Offset
+                           [NSNumber numberWithInt: 0],              // Count
+                           [self valueForKey:@"username"], nil];     // Restrict to user.
+
+        order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamPerms,
+                                                    kTURAnselAPIParamParent, kTURAnselAPIParamAllLevels,
+                                                    kTURAnselAPIParamOffset, kTURAnselAPIParamCount,
+                                                    kTURAnselAPIParamUserOnly, nil];
+    }
     NSDictionary *results = [self callRPCMethod: @"images.listGalleries"
                                      withParams: params
                                       withOrder: order];
-    
     if (results) {
         NSDictionary *galleries = [results objectForKey: (id)kWSMethodInvocationResult];
         for (NSString *gal in galleries) {
             [theGallery release];
             theGallery = nil;
         }
-        
+
         if ([delegate respondsToSelector:@selector(TURAnselDidInitialize)]) {
             [delegate performSelectorOnMainThread:@selector(TURAnselDidInitialize)
                                        withObject:self
                                     waitUntilDone: NO];
         }
-        
+
     }
-    
-    [params release];
 }
-@end
\ No newline at end of file
+@end
index 1b6a56b..757bdea 100644 (file)
@@ -2,14 +2,14 @@
  * TURAnselConstants
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
  */
 
 // Constants for the API parameter names.
 extern NSString * const kTURAnselAPIParamScope;
-extern NSString * const kTURAnselAPIParamGaleryParams;
+extern NSString * const kTURAnselAPIParamGalleryParams;
 extern NSString * const kTURAnselAPIParamPerms;
 extern NSString * const kTURAnselAPIParamParent;
 extern NSString * const kTURAnselAPIParamAllLevels;
@@ -25,6 +25,12 @@ extern NSString * const kTURAnselAPIParamSetAsDefault;
 extern NSString * const kTURAnselAPIParamAdditionalData;
 extern NSString * const kTURAnselAPIParamEncoding;
 
+// Constants specific to Ansel version 2 API parameters.
+extern NSString * const kTURAnselAPIParamSingleParameter;
+extern NSString * const kTURAnselAPIParamView;
+extern NSString * const kTURAnselAPIParamFull;
+extern NSString * const kTURAnselAPIParamEncoding;
+
 // Constants for the dictionary keys used to describe/create TURAnselGallery
 extern NSString * const kTURAnselGalleryKeyId;
 extern NSString * const kTURAnselGalleryKeyName;
index 74472bb..a0162b9 100644 (file)
@@ -1,16 +1,18 @@
-//
-//  TURAnselConstants.m
-//  ApertureToAnselExportPlugin
-//
-//  Created by Michael Rubinsky on 9/22/09.
-//  Copyright 2009 __MyCompanyName__. All rights reserved.
-//
+/**
+ *  TURAnselConstants.m
+ *  ApertureToAnselExportPlugin
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org)
+ *
+ * @license http://opensource.org/licenses/bsd-license.php
+ * @author  Michael J. Rubinsky <mrubinsk@horde.org>
+ */
 
 #import "TURAnselConstants.h"
 
 // Constants for the API parameter names.
 NSString * const kTURAnselAPIParamScope             = @"scope";
-NSString * const kTURAnselAPIParamGaleryParams      = @"galleryParams";
+NSString * const kTURAnselAPIParamGalleryParams      = @"galleryParams";
 NSString * const kTURAnselAPIParamPerms             = @"perms";
 NSString * const kTURAnselAPIParamParent            = @"parent";
 NSString * const kTURAnselAPIParamAllLevels         = @"allLevels";
@@ -26,6 +28,10 @@ NSString * const kTURAnselAPIParamSetAsDefault      = @"default";
 NSString * const kTURAnselAPIParamAdditionalData    = @"additionalData";
 NSString * const kTURAnselAPIParamEncoding          = @"encoding";
 
+NSString * const kTURAnselAPIParamSingleParameter   = @"params";
+NSString * const kTURAnselAPIParamView              = @"view";
+NSString * const kTURAnselAPIParamFull              = @"full";
+
 // Ansel gallery attribtues.
 NSString * const kTURAnselGalleryKeyId              = @"share_id";
 NSString * const kTURAnselGalleryKeyName            = @"attribute_name";
index dfb3143..e077773 100644 (file)
@@ -2,7 +2,7 @@
  * TURAnselGallery
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
  */
@@ -36,7 +36,7 @@
 - (void)setDelegate: (id)newDelegate;
 - (id)delegate;
 - (NSURL *)galleryKeyImageURL;
-- (id)listImages;
+- (NSMutableArray *)listImages;
 - (int)galleryId;
 - (void)setAnselController:(TURAnsel *)newController;
 @end
\ No newline at end of file
index c6f945e..75130d1 100644 (file)
@@ -2,7 +2,7 @@
  * TURAnselGallery.m
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
  */
@@ -23,7 +23,7 @@
 #pragma mark -
 #pragma mark init/dealloc
 /**
- * Init a gallery object
+ * Initialize a gallery object
  */
 - (id)initWithObject:(id)galleryData controller:(TURAnsel *)controller
 {
@@ -35,7 +35,7 @@
     [self setValue:[galleryData valueForKey: kTURAnselGalleryKeyName]
             forKey:@"galleryName"];
     [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyImages]
-            forKey:@"galleryImageCount"];    
+            forKey:@"galleryImageCount"];
     [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyDefaultImage]
             forKey:@"galleryKeyImage"];
     [self setAnselController: controller];
     NSLog(@"TURAnselGallery dealloc called on Gallery %@", self);
     [anselController release];
     anselController = nil;
-    
+
     [galleryKeyImageURL release];
     galleryKeyImageURL = nil;
-    
+
     [imageList release];
     imageList = nil;
-    
+
     [super dealloc];
 }
-- (id)description 
+- (id)description
 {
     NSString *text = [NSString stringWithFormat:@"Description: %@ Id: %d has: %d images", galleryName, _galleryId, galleryImageCount];
     return text;
 /**
  * Requests the gallery's key image url to be fetched from the server
  * (This information is not present in the gallery definition array returned
- *  from the images.listGalleries call). 
+ *  from the images.listGalleries call).
+ *
+ * @return NSURL  The url object
  */
 - (NSURL *)galleryKeyImageURL
 {
     if (galleryKeyImageURL) {
         return galleryKeyImageURL;
     } else {
-        NSArray *params = [[NSArray alloc] initWithObjects:
-                           @"ansel",                                         // Scope
-                           [NSNumber numberWithInt: galleryKeyImage],        // Image Id
-                           @"thumb",                                         // Thumbnail type
-                           [NSNumber numberWithBool:YES],                    // Full path
-                           nil];
+        NSArray *params;
+        NSArray *order;
+        if ([[anselController valueForKey:@"version"] intValue] == 2) {
+            // Version 2 API
+            params = [NSArray arrayWithObjects:
+                       [NSNumber numberWithInt: galleryKeyImage],
+                       [NSDictionary dictionaryWithObjectsAndKeys: @"thumb", kTURAnselAPIParamView, [NSNumber numberWithBool:YES], kTURAnselAPIParamFull, nil],
+                       nil];
+            order = [NSArray arrayWithObjects: kTURAnselAPIParamImageId,
+                                               kTURAnselAPIParamSingleParameter,
+                                               nil];
+        } else {
+            params = [NSArray arrayWithObjects:
+                               @"ansel",                                         // Scope
+                               [NSNumber numberWithInt: galleryKeyImage],        // Image Id
+                               @"thumb",                                         // Thumbnail type
+                               [NSNumber numberWithBool:YES],                    // Full path
+                               nil];
 
-        NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope,
-                                                    kTURAnselAPIParamImageId,
-                                                    kTURAnselAPIParamThumbnailStyle,
-                                                    kTURAnselAPIParamFullPath, nil];
-        
+            order = [NSArray arrayWithObjects: kTURAnselAPIParamScope,
+                                               kTURAnselAPIParamImageId,
+                                               kTURAnselAPIParamThumbnailStyle,
+                                               kTURAnselAPIParamFullPath, nil];
+        }
         NSDictionary *response = [anselController callRPCMethod: @"images.getImageUrl"
                                                        withParams: params
                                                         withOrder: order];
-        
+
         if (response) {
             NSDictionary *url = [response objectForKey:(id)kWSMethodInvocationResult];
             [galleryKeyImageURL autorelease];
             galleryKeyImageURL = [[NSURL URLWithString: [NSString stringWithFormat: @"%@", url]] retain];
             NSLog(@"galleryKeyImageURL: %@", galleryKeyImageURL);
             return galleryKeyImageURL;
-        } 
-        
+        }
+
         return nil;
     }
 }
 /**
  * Get the complete list of image ids and URLs
  */
-- (id)listImages
+- (NSMutableArray *)listImages
 {
-    if (!imageList) {
-        
-        NSArray *params = [[NSArray alloc] initWithObjects:
-                           @"ansel",                                //Scope
-                           [NSNumber numberWithInt: _galleryId],    //Gallery Id
-                           [NSNumber numberWithInt: 2],             //PERMS_SHOW
-                           @"thumb",                                // Thumbnail
-                           [NSNumber numberWithBool:YES],           // Full path
-                           nil];
-        NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope,
-                                                    kTURAnselAPIParamGalleryId,
-                                                    kTURAnselAPIParamPerms,
-                                                    kTURAnselAPIParamThumbnailStyle,
-                                                    kTURAnselAPIParamFullPath, nil];
-        
+    if (![imageList count]) {
+        NSArray *params;
+        NSArray *order;
+
+//        if ([[anselController valueForKey:@"version"] intValue] == 2) {
+// listImages hasn't been refactored yet in version 2 API
+//        } else {
+            params = [NSArray arrayWithObjects:
+                               @"ansel",                                //Scope
+                               [NSNumber numberWithInt: _galleryId],    //Gallery Id
+                               [NSNumber numberWithInt: 2],             //PERMS_SHOW
+                               @"thumb",                                // Thumbnail
+                               [NSNumber numberWithBool:YES],           // Full path
+                               nil];
+            order = [NSArray arrayWithObjects: kTURAnselAPIParamScope,
+                                               kTURAnselAPIParamGalleryId,
+                                               kTURAnselAPIParamPerms,
+                                               kTURAnselAPIParamThumbnailStyle,
+                                               kTURAnselAPIParamFullPath, nil];
+//        }
         NSDictionary *response = [anselController callRPCMethod: @"images.listImages"
                                                      withParams: params
                                                       withOrder: order];
         if (response) {
             [imageList autorelease];
-            imageList = [[response objectForKey: (id)kWSMethodInvocationResult] retain];
-            
+            if ([[anselController valueForKey:@"version"] intValue] == 2) {
+                // images.listImages returns a hash in version 2, not an array
+                imageList = [NSMutableArray arrayWithArray: [[[response objectForKey: (id)kWSMethodInvocationResult] retain] allValues]];
+            } else {
+                imageList = [[response objectForKey: (id)kWSMethodInvocationResult] retain];
+            }
             NSLog(@"listImages: %@", imageList);
-            
-            return imageList;
         }
     }
-    
-    return nil;
+
+    return imageList;;
 }
-    
+
 /**
  * Upload the provided image to this gallery.
  */
 #pragma mark PrivateAPI
 - (void)doUpload:(NSDictionary *)imageParameters
 {
-        // Need to build the params array now.
-        NSArray *params = [[NSArray alloc] initWithObjects:
+
+    NSArray *params;
+    NSArray *order;
+
+    if ([[anselController valueForKey:@"version"] intValue] == 2) {
+        params = [NSArray arrayWithObjects: [NSNumber numberWithInt: _galleryId],
+                                            [imageParameters valueForKey: @"data"],
+                                            [NSDictionary dictionaryWithObjectsAndKeys:@"base64", kTURAnselAPIParamEncoding, nil],
+                                            nil];
+        order = [NSArray arrayWithObjects: kTURAnselAPIParamGalleryId,
+                                           kTURAnselAPIParamImageData,
+                                           kTURAnselAPIParamSingleParameter,
+                                           nil];
+    } else {
+        params = [NSArray arrayWithObjects:
                            @"ansel",                                  // app
                            [NSNumber numberWithInt: _galleryId],      // gallery_id
-                           [imageParameters valueForKey: @"data"],    // image data array   
+                           [imageParameters valueForKey: @"data"],    // image data array
                            [imageParameters valueForKey: @"default"], // set as default?
-                           @"",                                       // Additional gallery data to set?      
-                           @"base64",                                 // Image data encoding      
+                           @"",                                       // Additional gallery data to set?
+                           @"base64",                                 // Image data encoding
                            nil];
-        NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope,
-                                                    kTURAnselAPIParamGalleryId,
-                                                    kTURAnselAPIParamImageData,
-                                                    kTURAnselAPIParamSetAsDefault,
-                                                    kTURAnselAPIParamAdditionalData,
-                                                    kTURAnselAPIParamEncoding, nil];
-        
-        // Send the request up to the controller
-        NSDictionary *result = [anselController callRPCMethod: @"images.saveImage"
-                                                   withParams: params
-                                                    withOrder: order];
-    
-        if (result) {
-            if ([delegate respondsToSelector:@selector(TURAnselGalleryDidUploadImage:)]) {
-                [delegate performSelectorOnMainThread: @selector(TURAnselGalleryDidUploadImage:)
-                                           withObject: self 
-                                        waitUntilDone: NO];
-            }
+        order = [NSArray arrayWithObjects: kTURAnselAPIParamScope,
+                                           kTURAnselAPIParamGalleryId,
+                                           kTURAnselAPIParamImageData,
+                                           kTURAnselAPIParamSetAsDefault,
+                                           kTURAnselAPIParamAdditionalData,
+                                           kTURAnselAPIParamEncoding, nil];
+    }
+
+    // Send the request up to the controller
+    NSDictionary *result = [anselController callRPCMethod: @"images.saveImage"
+                                               withParams: params
+                                                withOrder: order];
+
+    if (result) {
+        if ([delegate respondsToSelector:@selector(TURAnselGalleryDidUploadImage:)]) {
+            [delegate performSelectorOnMainThread: @selector(TURAnselGalleryDidUploadImage:)
+                                       withObject: self
+                                    waitUntilDone: NO];
         }
-    
-        [params release];
+    }
 }
 @end
index 2def026..d11d39f 100644 (file)
@@ -2,7 +2,7 @@
  * TURAnselGalleryPanelController
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
  */
@@ -19,7 +19,7 @@
     IBOutlet NSTextField *gallerySlugTextField;
     IBOutlet NSTextField *galleryDescTextField;
     IBOutlet NSPanel *newGallerySheet;
-    
+
     // Instance members
     TURAnsel *_anselController;
     NSWindow *_controllerWindow;
index 988d1b1..e7c3756 100644 (file)
@@ -4,7 +4,7 @@
  * Controller for handling the form that creates new remote Ansel galleries.
  *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org)
- * 
+ *
  * @license http://opensource.org/licenses/bsd-license.php
  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
  */
     _anselController = [theController retain];
     [NSBundle loadNibNamed: @"AnselGalleryPanel"
                      owner: self];
-    
+
     return self;
 }
 - (id)initWithController: (TURAnsel *)theController
-         withGalleryName: (NSString *)galleryName 
+         withGalleryName: (NSString *)galleryName
 {
-    
+
     [super init];
     _anselController = [theController retain];
     [NSBundle loadNibNamed: @"AnselGalleryPanel"
                      owner: self];
-    
+
     [galleryNameTextField setStringValue: galleryName];
-    
-    return self;      
+
+    return self;
 }
-- (void)dealloc 
+- (void)dealloc
 {
     [_anselController release];
     [_controllerWindow release];
@@ -48,7 +48,7 @@
 - (IBAction)cancelNewGallery: (id)sender
 {
     [NSApp endSheet: newGallerySheet];
-    [newGallerySheet orderOut: nil];   
+    [newGallerySheet orderOut: nil];
 }
 
 - (IBAction)doNewGallery: (id)sender
     NSString *galleryName = [galleryNameTextField stringValue];
     NSString *gallerySlug = [gallerySlugTextField stringValue];
     NSString *galleryDescription = [galleryDescTextField stringValue];
-    
+
     if (!galleryName) {
-        
+
         [NSApp endSheet: newGallerySheet];
         [newGallerySheet orderOut: nil];
-        
+
         NSAlert *alert = [[NSAlert alloc] init];
         [alert setMessageText:@"Gallery names cannot be empty"];
         [alert setAlertStyle: NSCriticalAlertStyle];
         [alert beginSheetModalForWindow: _controllerWindow
-                          modalDelegate: nil 
+                          modalDelegate: nil
                          didEndSelector: nil
                             contextInfo: nil];
         [alert release];
                             galleryName, @"name",
                             gallerySlug, @"slug",
                             galleryDescription, @"desc", nil];
-    
+
     NSDictionary *results = [[_anselController createNewGallery: params] retain];
-    
+
     [NSApp endSheet: newGallerySheet];
     [newGallerySheet orderOut: nil];
-    
+
     if ([_anselController state] != TURAnselStateError) {
         NSAlert *alert = [[NSAlert alloc] init];
         [alert setMessageText: @"Gallery successfully created."];
@@ -95,7 +95,7 @@
             [_delegate TURAnselGalleryPanelDidAddGallery];
         }
     }
-    
+
     [results release];
 }