├── .gitignore
├── common
├── CTGradient.h
├── CTGradient.m
├── Login.nib
│ ├── classes.nib
│ ├── info.nib
│ └── keyedobjects.nib
├── RoundedBox.h
├── RoundedBox.m
├── ZKLoginController.h
├── ZKLoginController.m
├── credential.h
├── credential.m
├── minus-8.png
└── plus-8.png
├── readme.md
├── sfCubed
├── AccItem.h
├── AccItem.m
├── AcceptChangeInfo.h
├── AcceptChangeInfo.m
├── ActivityMapper.h
├── ActivityMapper.m
├── BaseMapper.h
├── BaseMapper.m
├── CalendarTracker.h
├── CalendarTracker.m
├── CenteredTextFieldCell.h
├── CenteredTextFieldCell.m
├── ClientDescription.plist
├── Constants.h
├── Constants.m
├── ContactMapper.h
├── ContactMapper.m
├── Credits.html
├── English.lproj
│ ├── InfoPlist.strings
│ └── MainMenu.nib
│ │ ├── classes.nib
│ │ ├── info.nib
│ │ └── keyedobjects.nib
├── EventFieldMappingInfo.h
├── EventFieldMappingInfo.m
├── EventMapper.h
├── EventMapper.m
├── FieldMappingInfo.h
├── FieldMappingInfo.m
├── IdUrlFieldMappingInfo.h
├── IdUrlFieldMappingInfo.m
├── Info.plist
├── LookupInfoCache.h
├── LookupInfoCache.m
├── Mappers.h
├── Mappers.m
├── MyISyncChange.h
├── MyISyncChange.m
├── ProtectController.h
├── ProtectController.m
├── PulledItem.h
├── PulledItem.m
├── SFCubed.h
├── SFCubed.m
├── SFPrefs.h
├── SFPrefs.m
├── SalesforceObjectChangeSummary.h
├── SalesforceObjectChangeSummary.m
├── Sparkle.framework
│ ├── Headers
│ ├── Resources
│ ├── Sparkle
│ └── Versions
│ │ ├── A
│ │ ├── Headers
│ │ │ ├── NSApplication+AppCopies.h
│ │ │ ├── NSFileManager+Authentication.h
│ │ │ ├── NSFileManager+Verification.h
│ │ │ ├── NSString+extras.h
│ │ │ ├── RSS.h
│ │ │ ├── SUAppcast.h
│ │ │ ├── SUAppcastItem.h
│ │ │ ├── SUAutomaticUpdateAlert.h
│ │ │ ├── SUConstants.h
│ │ │ ├── SUStatusChecker.h
│ │ │ ├── SUStatusController.h
│ │ │ ├── SUUnarchiver.h
│ │ │ ├── SUUpdateAlert.h
│ │ │ ├── SUUpdater.h
│ │ │ ├── SUUtilities.h
│ │ │ └── Sparkle.h
│ │ ├── Resources
│ │ │ ├── Info.plist
│ │ │ ├── SUStatus.nib
│ │ │ │ ├── classes.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── keyedobjects.nib
│ │ │ └── en.lproj
│ │ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── classes.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── keyedobjects.nib
│ │ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── classes.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── keyedobjects.nib
│ │ │ │ └── Sparkle.strings
│ │ └── Sparkle
│ │ └── Current
├── SyncFilters.h
├── SyncFilters.m
├── SyncOptions.h
├── SyncOptions.m
├── SyncRunner.h
├── SyncRunner.m
├── TaskFieldMappingInfo.h
├── TaskFieldMappingInfo.m
├── TaskMapper.h
├── TaskMapper.m
├── deleteAccumulator.h
├── deleteAccumulator.m
├── main.m
├── protect.nib
│ ├── classes.nib
│ ├── info.nib
│ └── keyedobjects.nib
├── sf.icns
├── sf3_64.png
├── sf3_64b.png
├── sfCubed.xcodeproj
│ └── project.pbxproj
└── sfCubed_Prefix.pch
└── sforce
├── ZKPartnerEnvelope.h
├── ZKPartnerEnvelope.m
├── ZKPicklistEntry.h
├── ZKPicklistEntry.m
├── ZKRecordTypeInfo.h
├── ZKRecordTypeInfo.m
├── zkBaseClient.h
├── zkBaseClient.m
├── zkChildRelationship.h
├── zkChildRelationship.m
├── zkDescribeField.h
├── zkDescribeField.m
├── zkDescribeSObject.h
├── zkDescribeSObject.m
├── zkEnvelope.h
├── zkEnvelope.m
├── zkQueryResult.h
├── zkQueryResult.m
├── zkSObject.h
├── zkSObject.m
├── zkSaveResult.h
├── zkSaveResult.m
├── zkSforce.h
├── zkSforceClient.h
├── zkSforceClient.m
├── zkSoapException.h
├── zkSoapException.m
├── zkUserInfo.h
├── zkUserInfo.m
├── zkXmlDeserializer.h
└── zkXmlDeserializer.m
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | build
3 | *.pbxuser
4 | *.mode1v3
5 |
--------------------------------------------------------------------------------
/common/CTGradient.h:
--------------------------------------------------------------------------------
1 | //
2 | // CTGradient.h
3 | //
4 | // Created by Chad Weider on 12/3/05.
5 | // Copyright (c) 2006 Cotingent.
6 | // Some rights reserved:
7 | //
8 | // Version: 1.5
9 |
10 | #import
11 |
12 | typedef struct _CTGradientElement
13 | {
14 | float red, green, blue, alpha;
15 | float position;
16 |
17 | struct _CTGradientElement *nextElement;
18 | } CTGradientElement;
19 |
20 | typedef enum _CTBlendingMode
21 | {
22 | CTLinearBlendingMode,
23 | CTChromaticBlendingMode,
24 | CTInverseChromaticBlendingMode
25 | } CTGradientBlendingMode;
26 |
27 |
28 | @interface CTGradient : NSObject
29 | {
30 | CTGradientElement* elementList;
31 | CTGradientBlendingMode blendingMode;
32 |
33 | CGFunctionRef gradientFunction;
34 | }
35 |
36 | + (id)gradientWithBeginningColor:(NSColor *)begin endingColor:(NSColor *)end;
37 |
38 | + (id)aquaSelectedGradient;
39 | + (id)aquaNormalGradient;
40 | + (id)aquaPressedGradient;
41 |
42 | + (id)unifiedSelectedGradient;
43 | + (id)unifiedNormalGradient;
44 | + (id)unifiedPressedGradient;
45 | + (id)unifiedDarkGradient;
46 |
47 | + (id)sourceListSelectedGradient;
48 | + (id)sourceListUnselectedGradient;
49 |
50 | - (CTGradient *)gradientWithAlphaComponent:(float)alpha;
51 |
52 | - (CTGradient *)addColorStop:(NSColor *)color atPosition:(float)position; //positions given relative to [0,1]
53 | - (CTGradient *)removeColorStopAtIndex:(unsigned)index;
54 | - (CTGradient *)removeColorStopAtPosition:(float)position;
55 |
56 | - (CTGradientBlendingMode)blendingMode;
57 | - (NSColor *)colorStopAtIndex:(unsigned)index;
58 | - (NSColor *)colorAtPosition:(float)position;
59 |
60 |
61 | - (void)drawSwatchInRect:(NSRect)rect;
62 | - (void)fillRect:(NSRect)rect angle:(float)angle; //fills rect with axial gradient
63 | // angle in degrees
64 | - (void)radialFillRect:(NSRect)rect; //fills rect with radial gradient
65 | // gradient from center outwards
66 | @end
67 |
--------------------------------------------------------------------------------
/common/CTGradient.m:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/common/CTGradient.m
--------------------------------------------------------------------------------
/common/Login.nib/classes.nib:
--------------------------------------------------------------------------------
1 | {
2 | IBClasses = (
3 | {CLASS = Credential; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
4 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
5 | {
6 | ACTIONS = {
7 | addNewServer = id;
8 | cancelLogin = id;
9 | closeAddNewServer = id;
10 | deleteServer = id;
11 | login = id;
12 | showAddNewServer = id;
13 | };
14 | CLASS = ZKLoginController;
15 | LANGUAGE = ObjC;
16 | OUTLETS = {
17 | addButton = NSButton;
18 | delButton = NSButton;
19 | loginProgress = NSProgressIndicator;
20 | newUrlWindow = NSWindow;
21 | target = id;
22 | window = NSWindow;
23 | };
24 | SUPERCLASS = NSObject;
25 | }
26 | );
27 | IBVersion = 1;
28 | }
--------------------------------------------------------------------------------
/common/Login.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBDocumentLocation
6 | 864 597 356 240 0 0 2560 1578
7 | IBFramework Version
8 | 446.1
9 | IBOpenObjects
10 |
11 | 7
12 | 65
13 |
14 | IBSystem Version
15 | 8L2127
16 |
17 |
18 |
--------------------------------------------------------------------------------
/common/Login.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/common/Login.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/common/RoundedBox.h:
--------------------------------------------------------------------------------
1 | //
2 | // RoundedBox.m
3 | // RoundedBox
4 | //
5 | // Created by Matt Gemmell on 01/11/2005.
6 | // Copyright 2006 Matt Gemmell. http://mattgemmell.com/
7 | //
8 | // Permission to use this code:
9 | //
10 | // Feel free to use this code in your software, either as-is or
11 | // in a modified form. Either way, please include a credit in
12 | // your software's "About" box or similar, mentioning at least
13 | // my name (Matt Gemmell). A link to my site would be nice too.
14 | //
15 | // Permission to redistribute this code:
16 | //
17 | // You can redistribute this code, as long as you keep these
18 | // comments. You can also redistribute modified versions of the
19 | // code, as long as you add comments to say that you've made
20 | // modifications (keeping these original comments too).
21 | //
22 | // If you do use or redistribute this code, an email would be
23 | // appreciated, just to let me know that people are finding my
24 | // code useful. You can reach me at matt.gemmell@gmail.com
25 | //
26 |
27 | #import
28 | #import "CTGradient.h"
29 |
30 | @interface RoundedBox : NSBox {
31 | float borderWidth;
32 | NSColor *borderColor;
33 | NSColor *titleColor;
34 | NSColor *gradientStartColor;
35 | NSColor *gradientEndColor;
36 | NSColor *backgroundColor;
37 | NSMutableDictionary *titleAttrs;
38 | BOOL drawsFullTitleBar;
39 | BOOL selected;
40 | BOOL drawsGradientBackground;
41 | }
42 |
43 | - (void)setDefaults;
44 | - (NSBezierPath *)titlePathWithinRect:(NSRect)rect cornerRadius:(float)radius titleRect:(NSRect)titleRect;
45 |
46 | - (BOOL)drawsFullTitleBar;
47 | - (void)setDrawsFullTitleBar:(BOOL)value;
48 | - (BOOL)selected;
49 | - (void)setSelected:(BOOL)newSelected;
50 | - (NSColor *)borderColor;
51 | - (void)setBorderColor:(NSColor *)newBorderColor;
52 | - (NSColor *)titleColor;
53 | - (void)setTitleColor:(NSColor *)newTitleColor;
54 | - (NSColor *)gradientStartColor;
55 | - (void)setGradientStartColor:(NSColor *)newGradientStartColor;
56 | - (NSColor *)gradientEndColor;
57 | - (void)setGradientEndColor:(NSColor *)newGradientEndColor;
58 | - (NSColor *)backgroundColor;
59 | - (void)setBackgroundColor:(NSColor *)newBackgroundColor;
60 | - (BOOL)drawsGradientBackground;
61 | - (void)setDrawsGradientBackground:(BOOL)newDrawsGradientBackground;
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/common/ZKLoginController.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | // LoginController and Login.nib make a reusable login window that support
23 | // the keychain, multiple servers, and differing ways to open the window
24 | #import
25 |
26 | @class Credential;
27 | @class ZKSforceClient;
28 | @class ZKSoapException;
29 |
30 | @interface ZKLoginController : NSObject {
31 | NSString *username;
32 | NSString *password;
33 | NSString *server;
34 | NSString *clientId;
35 | NSArray *credentials;
36 | Credential *selectedCredential;
37 | ZKSforceClient *sforce;
38 | NSString *newUrl;
39 | NSString *statusText;
40 |
41 | NSWindow *modalWindow;
42 | id target;
43 | SEL selector;
44 | IBOutlet NSWindow *window;
45 | IBOutlet NSButton *addButton;
46 | IBOutlet NSButton *delButton;
47 | IBOutlet NSWindow *newUrlWindow;
48 | IBOutlet NSProgressIndicator *loginProgress;
49 | }
50 |
51 | - (ZKSforceClient *)showModalLoginWindow:(id)sender;
52 | - (void)showLoginWindow:(id)sender target:(id)target selector:(SEL)selector;
53 | - (void)showLoginSheet:(NSWindow *)modalForWindow target:(id)target selector:(SEL)selector;
54 |
55 | - (IBAction)cancelLogin:(id)sender;
56 | - (IBAction)login:(id)sender;
57 | - (IBAction)showAddNewServer:(id)sender;
58 | - (IBAction)closeAddNewServer:(id)sender;
59 | - (IBAction)addNewServer:(id)sender;
60 | - (IBAction)deleteServer:(id)sender;
61 |
62 | - (NSString *)username;
63 | - (void)setUsername:(NSString *)aUsername;
64 | - (NSString *)password;
65 | - (void)setPassword:(NSString *)aPassword;
66 | - (NSString *)server;
67 | - (void)setServer:(NSString *)aServer;
68 | - (NSArray *)credentials;
69 | - (NSString *)newUrl;
70 | - (void)setNewUrl:(NSString *)aNewUrl;
71 | - (NSString *)statusText;
72 | - (void)setStatusText:(NSString *)aStatusText;
73 | - (BOOL)canDeleteServer;
74 | - (NSString *)clientId;
75 | - (void)setClientId:(NSString *)aClientId;
76 | - (void)setClientIdFromInfoPlist;
77 | - (ZKSforceClient *)performLogin:(ZKSoapException **)error;
78 | @end
79 |
--------------------------------------------------------------------------------
/common/credential.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #include
24 |
25 |
26 | @interface Credential : NSObject {
27 | NSString *server;
28 | NSString *username;
29 | SecKeychainItemRef keychainItem;
30 | }
31 |
32 | + (NSArray *)credentialsForServer:(NSString *)protocolAndServer;
33 | + (NSArray *)sortedCredentialsForServer:(NSString *)protocolAndServer;
34 |
35 | + (id)forServer:(NSString *)server username:(NSString *)un keychainItem:(SecKeychainItemRef)kcItem;
36 | + (id)createCredentialForServer:(NSString *)protocolAndServer username:(NSString *)un password:(NSString *)pwd;
37 |
38 | - (id)initForServer:(NSString *)server username:(NSString *)un keychainItem:(SecKeychainItemRef)kcItem;
39 |
40 | - (NSString *)server;
41 | - (NSString *)username;
42 | - (NSString *)password;
43 | - (NSString *)comment;
44 | - (NSString *)creator;
45 | - (BOOL)canReadPasswordWithoutPrompt;
46 |
47 | - (void)setServer:(NSString *)newServer;
48 | - (void)setUsername:(NSString *)newUsername;
49 | - (void)setPassword:(NSString *)newPassword;
50 | - (void)setComment:(NSString *)newComment;
51 | - (void)setCreator:(NSString *)newCreator;
52 |
53 | - (void)removeFromKeychain;
54 | - (OSStatus)update:(NSString *)username password:(NSString *)password;
55 | @end
56 |
57 | @interface NSURL (Keychain)
58 | - (SecProtocolType)SecProtocolType;
59 | @end
--------------------------------------------------------------------------------
/common/minus-8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/common/minus-8.png
--------------------------------------------------------------------------------
/common/plus-8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/common/plus-8.png
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # SF3
2 |
3 | SF3 is an OSX application that uses Apple's Sync Services to synchronized contacts & task/events between Salesforce.com and your Mac.
4 |
5 | SF3 requires OSX 10.6 and a Salesforce.com account
6 |
7 |
8 | **Note:** Given the death bed status of the underlying Sync Services API, I'm not planning to do anymore work on this project.
9 |
10 |
11 | Most of the complexity in this project is handling data model mismatches between the 2 data models, for tasks & events there are minor differences, however
12 | for contacts there are more significant differences, most notably that AdressBook uses child entities for addresses, phone numbers, IM, email address etc
13 | while in Salesforce.com, its an entirly flat model. Most of the problems come in support subsets of the child entities, e.g. one work and one home phone number
14 |
15 |
16 | The actual data model mapping is built up in layers
17 |
18 | - Mappers - the set of entities to sync/map
19 | - BaseMapper - each entity to sync/map is represented by a sub class of base mapper
20 | - FieldMappingInfo - each data point in the entity is mapped using a FieldMappingInfo (or subclass of)
21 | some fields, particularly in contacts are managed "by hand" with code directly at
22 | the entity mapping level.
23 |
24 |
25 | The code in the project is grouped as follows
26 |
27 | - common: shared code between many of my OSX/Salesforce.com projects, for SF3 this is mainly about login & keychain management.
28 | - FieldMappers: FieldMappingInfo and all its entity specific sub classes
29 | - Object Mappers: BaseMapper, plus the entity specific sub classes and some related peices
30 | - Classes: grab bag of random stuff to organize, SFCubed is the primary entry point.
31 | - Sforce Api: set of classes for interacting with the Salesforce.com Web Services API.
32 |
33 |
34 |
35 | There is much to do
36 |
37 | - Support fast sync, currently slow push everying each time we sync.
38 | - review error handling, both from SyncServices and from SF API calls.
39 | - create an URL in the contact to take you to their SFDC page.
40 | - handle fields hidden by FLS
41 | - custom field mappings (would be useful for home email)
42 | - support being able to pick which calendar in iCal to sync to (this would then enable entourage <-> ical <-> sfdc, this is less important now that outlook 2011 syncs all the local calendars)
43 | - for contacts support an AddressBook subset using a Salesforce.com group
44 | - improve logging & diagnostics, fix (aka kill) the stupid logging drawer.
45 | - UI clean-up
46 | - move sync process off the main thread
47 | - prompt/do an AdressBook & iCal backup on first run
48 | - write some help
49 | - investigate "conflicts" on dates that are the same date (probably some TZ weirdness)
50 | - re-occuring events (ugh)
51 | - one of the reason we pull all the changes before working on any is to support the progress bar, perhaps we should give up on the progress bar, and just use an indterminate progress spinner instead.
52 | - show details of changes proposed to be sent to salesforce.com in the protect sfdc dialog.
53 | - switch to OAuth for the login process
54 | - write some unit tests, and look at automated end to end testing
55 |
--------------------------------------------------------------------------------
/sfCubed/AccItem.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "ZKSObject.h"
24 |
25 | @interface AccItem : NSObject {
26 | ZKSObject *item;
27 | NSString *originalId;
28 | NSString *newId;
29 | }
30 |
31 | + (AccItem *)withSObject:(ZKSObject *)item originalId:(NSString *)oid newId:(NSString *)nid;
32 |
33 | - (AccItem *)initWithSObject:(ZKSObject *)item originalId:(NSString *)oid newId:(NSString *)nid;
34 |
35 | - (ZKSObject *)sobject;
36 | - (NSString *)originalId;
37 | - (NSString *)newId;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/sfCubed/AccItem.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "AccItem.h"
23 |
24 | @implementation AccItem
25 |
26 | + (AccItem *)withSObject:(ZKSObject *)item originalId:(NSString *)oid newId:(NSString *)nid
27 | {
28 | AccItem * i = [[AccItem alloc] initWithSObject:item originalId:oid newId:nid];
29 | return [i autorelease];
30 | }
31 |
32 | - (AccItem *) initWithSObject:(ZKSObject *)i originalId:(NSString *)oid newId:(NSString *)nid
33 | {
34 | self = [super init];
35 | item = [i retain];
36 | originalId = [oid retain];
37 | newId = [nid retain];
38 | return self;
39 | }
40 |
41 | -(void)dealloc {
42 | [item release];
43 | [originalId release];
44 | [newId release];
45 | [super dealloc];
46 | }
47 |
48 | - (ZKSObject *)sobject {
49 | return item;
50 | }
51 |
52 | - (NSString *)originalId {
53 | return originalId;
54 | }
55 |
56 | - (NSString *)newId {
57 | return newId;
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/sfCubed/AcceptChangeInfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import
24 |
25 | // tracking object for a single change
26 | @interface AcceptChangeInfo : NSObject {
27 | id recordId;
28 | id formatted;
29 | id newId;
30 | id newIdFormat;
31 | BOOL isForDelete;
32 | }
33 |
34 | + (AcceptChangeInfo *) acceptInfo:(id)recordId formatted:(id)f newId:(id)nid;
35 | + (AcceptChangeInfo *) acceptInfoWithIdFormat:(id)recordId formatted:(id)f newIdFormat:(id)nidf;
36 |
37 | - (id) initAccept:(id)recordId formatted:(id)f newId:(id)nid newIdFormat:(id)nidf;
38 | - (BOOL)isForDelete;
39 | - (void)setIsForDelete:(BOOL)newIsForDelete;
40 |
41 | // all AcceptChangeInfos are moved through preAccept / preAccept2 / accept in parrallel
42 | // this is to allow us to switch Ids, so that in the case the calculated compound
43 | // id for a child-record ends up having to switch between records, it'll actually
44 | // work (e.g. you have a contact with both a work & home phone, and you switch the
45 | // types on the pair of them, we'll need accept the id-Phone record with a new id
46 | // of id-HomePhone, but there's anlready a different record with that id, so we
47 | // need to register new tempororary unique id's for everything, then accept
48 | // them with the temporary recordId, and give it the final required recordId
49 | - (void)preAccept:(ISyncSession *)session sfId:(NSString *)sfId;
50 | - (void)preAccept2:(ISyncSession *)session sfId:(NSString *)sfId;
51 | - (void)accept:(ISyncSession*)session;
52 | - (void)reject:(ISyncSession*)session;
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/sfCubed/AcceptChangeInfo.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "AcceptChangeInfo.h"
23 |
24 | @implementation AcceptChangeInfo
25 |
26 | + (AcceptChangeInfo *) acceptInfo:(id)recordId formatted:(id)f newId:(id)nid
27 | {
28 | AcceptChangeInfo * c = [[AcceptChangeInfo alloc] initAccept:recordId formatted:f newId:nid newIdFormat:nil];
29 | return [c autorelease];
30 | }
31 |
32 | + (AcceptChangeInfo *) acceptInfoWithIdFormat:(id)recordId formatted:(id)f newIdFormat:(id)nidf
33 | {
34 | AcceptChangeInfo * c = [[AcceptChangeInfo alloc] initAccept:recordId formatted:f newId:nil newIdFormat:nidf];
35 | return [c autorelease];
36 | }
37 |
38 | - (id) initAccept:(id)rid formatted:(id)f newId:(id)nid newIdFormat:(id)nidf {
39 | [super init];
40 | recordId = [rid retain];
41 | formatted = [f retain];
42 | newId = [nid retain];
43 | newIdFormat = [nidf retain];
44 | isForDelete = NO;
45 | return self;
46 | }
47 |
48 | - (void)dealloc {
49 | [recordId release];
50 | [formatted release];
51 | [newId release];
52 | [newIdFormat release];
53 | [super dealloc];
54 | }
55 |
56 | - (BOOL)isForDelete {
57 | return isForDelete;
58 | }
59 |
60 | - (void)setIsForDelete:(BOOL)newIsForDelete {
61 | isForDelete = newIsForDelete;
62 | }
63 |
64 | // first phase, if we need to, start the id shuffle, register a new GUID as our recordId, instead
65 | // of the recordId we currently have. We do this if we know we're going to end up with a new
66 | // id we want to register, or for deletes (so that the recordId of the deleted record becomes
67 | // available for another record to use.)
68 | - (void)preAccept:(ISyncSession *)session sfId:(NSString *)sfId {
69 | if ((newId == nil) && (newIdFormat != nil)) {
70 | newId = [[NSString stringWithFormat:newIdFormat, sfId] retain];
71 | }
72 | if (newId != nil || isForDelete) {
73 | CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
74 | NSString *tempId = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
75 | CFRelease(uuid);
76 | [session clientChangedRecordIdentifiers:[NSDictionary dictionaryWithObject:tempId forKey:recordId]];
77 | [recordId release];
78 | recordId = tempId;
79 | }
80 | }
81 |
82 | - (void)preAccept2:(ISyncSession *)session sfId:(NSString *)sfId {
83 | if (newId != nil) {
84 | [session clientChangedRecordIdentifiers:[NSDictionary dictionaryWithObject:newId forKey:recordId]];
85 | [recordId release];
86 | recordId = [newId copy];
87 | }
88 | }
89 |
90 | - (void)accept:(ISyncSession*)session {
91 | [session clientAcceptedChangesForRecordWithIdentifier:recordId formattedRecord:formatted newRecordIdentifier:newId];
92 | }
93 |
94 | - (void)reject:(ISyncSession*)session {
95 | [session clientRefusedChangesForRecordWithIdentifier:recordId];
96 | }
97 |
98 | @end
--------------------------------------------------------------------------------
/sfCubed/ActivityMapper.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "BaseMapper.h"
24 |
25 | @class CalendarTracker;
26 |
27 | @interface ActivityMapper : BaseMapper {
28 | CalendarTracker *calendarTracker;
29 | }
30 |
31 | -(void)setCalendarTracker:(CalendarTracker *)cal;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/sfCubed/ActivityMapper.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "ActivityMapper.h"
23 | #import "CalendarTracker.h"
24 | #import "Constants.h"
25 |
26 | @implementation ActivityMapper
27 |
28 | -(void)dealloc {
29 | [calendarTracker release];
30 | [super dealloc];
31 | }
32 |
33 | - (NSString *)primaryMacEntityName {
34 | return Entity_Calendar;
35 | }
36 |
37 | -(void)setCalendarTracker:(CalendarTracker *)cal {
38 | calendarTracker = [cal retain];
39 | }
40 |
41 | - (void)pulledChange:(ISyncChange *)change entityName:(NSString *)entity {
42 | if ([entity isEqualToString:Entity_Calendar]) {
43 | NSLog(@"title:%@ calId:%@ recordId:%@", [[change record] objectForKey:@"title"], [calendarTracker calendarId], [change recordIdentifier]);
44 | BOOL hasMatchingId = [[change recordIdentifier] isEqualToString:[calendarTracker calendarId]];
45 | if (hasMatchingId || ([[[change record] objectForKey:@"title"] isEqualToString:@"Salesforce.com"])) {
46 | NSLog(@"Task Mapper accepting calendar : %@ : %@", [change recordIdentifier], [[change record] objectForKey:@"title"]);
47 | [session clientAcceptedChangesForRecordWithIdentifier:[change recordIdentifier] formattedRecord:nil newRecordIdentifier:[calendarTracker calendarId]];
48 | } else {
49 | NSLog(@"Task Mapper rejecting calendar : %@", [[change record] objectForKey:@"title"]);
50 | [session clientRefusedChangesForRecordWithIdentifier:[change recordIdentifier]];
51 | }
52 | }
53 | }
54 |
55 | - (void)updateSObject:(ZKSObject *)o withChanges:(NSDictionary *)syncData {
56 | // basiclly the reverse of makeSyncTaskRecord
57 | [self mapFromApple:syncData toSObject:o];
58 | }
59 |
60 | - (void)relationshipUpdate:(ISyncChange *)change {
61 | // no child entities
62 | }
63 |
64 | @end
65 |
--------------------------------------------------------------------------------
/sfCubed/CalendarTracker.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import
24 |
25 | // we have one calendarTracker per sync session, if we're syncing both
26 | // events & tasks, its shared across the 2 *Mapper classes
27 |
28 | @interface CalendarTracker : NSObject {
29 | NSMutableArray *events;
30 | NSMutableArray *tasks;
31 | NSString *calendarId;
32 | NSString *userId;
33 | }
34 |
35 | -(id)initForUserId:(NSString *)uid;
36 |
37 | -(void)addEvent:(NSString *)eventId;
38 | -(void)addTask:(NSString *)taskId;
39 | - (NSString *)calendarId;
40 |
41 | -(NSDictionary *)asSyncObjectForSession:(ISyncSession *)s;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/sfCubed/CalendarTracker.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "CalendarTracker.h"
23 | #import "Constants.h"
24 |
25 | @implementation CalendarTracker
26 |
27 | -(id)initForUserId:(NSString *)uid {
28 | self = [super init];
29 | events = [[NSMutableArray alloc] init];
30 | tasks = [[NSMutableArray alloc] init];
31 | userId = [uid copy];
32 | calendarId = [[NSString stringWithFormat:@"%@-Calendar", userId] retain];
33 |
34 | // we don't care about calendar suffix anymore, remove it from the user prefs
35 | [[NSUserDefaults standardUserDefaults] removeObjectForKey:PREF_CALENDAR_SUFFIX];
36 | return self;
37 | }
38 |
39 | -(void)dealloc {
40 | [tasks release];
41 | [events release];
42 | [calendarId release];
43 | [userId release];
44 | [super dealloc];
45 | }
46 |
47 | -(void)addEvent:(NSString *)eventId {
48 | [events addObject:eventId];
49 | }
50 |
51 | -(void)addTask:(NSString *)taskId {
52 | [tasks addObject:taskId];
53 | }
54 |
55 | - (NSString *)calendarId {
56 | return calendarId;
57 | }
58 |
59 | -(NSDictionary *)asSyncObjectForSession:(ISyncSession *)s {
60 | NSMutableDictionary *cal = [NSMutableDictionary dictionary];
61 | [cal setObject:Entity_Calendar forKey:key_RecordEntityName];
62 | [cal setObject:@"This calendar automatically created by SfCubed" forKey:@"notes"];
63 | [cal setObject:[NSNumber numberWithBool:NO] forKey:@"read only"];
64 | [cal setObject:@"Salesforce.com" forKey:@"title"];
65 | NSArray *theTasks = tasks;
66 | NSArray *theEvents = events;
67 | NSDictionary *truth = nil;
68 | if ([tasks count] == 0 || [events count] == 0) {
69 | ISyncRecordSnapshot *ss = [s snapshotOfRecordsInTruth];
70 | NSString *recordId = [self calendarId];
71 | truth = [[ss recordsWithIdentifiers:[NSArray arrayWithObject:recordId]] objectForKey:recordId];
72 | if ([tasks count] == 0)
73 | theTasks = [truth objectForKey:@"tasks"];
74 | if ([events count] == 0)
75 | theEvents = [truth objectForKey:@"events"];
76 | }
77 | if ([theTasks count] > 0)
78 | [cal setObject:theTasks forKey:@"tasks"];
79 | if ([theEvents count] > 0)
80 | [cal setObject:theEvents forKey:@"events"];
81 | return cal;
82 | }
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/sfCubed/CenteredTextFieldCell.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 |
25 | @interface CenteredTextFieldCell : NSTextFieldCell {
26 |
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/sfCubed/CenteredTextFieldCell.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "CenteredTextFieldCell.h"
23 |
24 |
25 | @implementation CenteredTextFieldCell
26 |
27 | -(void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
28 | NSSize contentSize = [self cellSize];
29 | cellFrame.origin.y += (cellFrame.size.height - contentSize.height) / 2.0;
30 | cellFrame.size.height = contentSize.height;
31 | [super drawInteriorWithFrame:cellFrame inView:controlView];
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/sfCubed/ClientDescription.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
26 |
27 |
28 |
29 | DisplayName
30 | SF Cubed
31 | ImagePath
32 | sf.icns
33 | Entities
34 |
35 | com.apple.contacts.Contact
36 |
37 | com.apple.syncservices.RecordEntityName
38 | first name
39 | last name
40 | job title
41 | department
42 | notes
43 | title
44 | birthday
45 | company name
46 | email addresses
47 | phone numbers
48 | street addresses
49 | display as company
50 |
51 | com.apple.contacts.Email Address
52 |
53 | com.apple.syncservices.RecordEntityName
54 | contact
55 | type
56 | value
57 |
58 | com.apple.contacts.Phone Number
59 |
60 | com.apple.syncservices.RecordEntityName
61 | contact
62 | type
63 | value
64 |
65 | com.apple.contacts.Street Address
66 |
67 | com.apple.syncservices.RecordEntityName
68 | contact
69 | street
70 | city
71 | state
72 | country
73 | postal code
74 | type
75 |
76 | com.apple.calendars.Calendar
77 |
78 | com.apple.syncservices.RecordEntityName
79 | title
80 | tasks
81 | events
82 | notes
83 | read only
84 |
85 | com.apple.calendars.Task
86 |
87 | com.apple.syncservices.RecordEntityName
88 | calendar
89 | description
90 | due date
91 | due date is date only
92 | completion date
93 | priority
94 | summary
95 | completion date
96 | url
97 |
98 | com.apple.calendars.Event
99 |
100 | com.apple.syncservices.RecordEntityName
101 | calendar
102 | summary
103 | description
104 | all day
105 | url
106 | location
107 | start date
108 | end date
109 |
110 |
111 | Type
112 | server
113 |
124 |
125 |
126 |
--------------------------------------------------------------------------------
/sfCubed/Constants.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 | extern NSString *Entity_Contact;
25 | extern NSString *Entity_Email;
26 | extern NSString *Entity_Phone;
27 | extern NSString *Entity_Address;
28 | extern NSString *Entity_Task;
29 | extern NSString *Entity_Calendar;
30 | extern NSString *Entity_Event;
31 |
32 | extern NSString *key_RecordEntityName;
33 |
34 | extern NSString *PREF_SEEN_PREFS;
35 | extern NSString *PREF_SHOW_WELCOME;
36 | extern NSString *PREF_SERVERS;
37 | extern NSString *PREF_SERVER;
38 |
39 | extern NSString *PREF_SYNC_CONTACTS;
40 | extern NSString *PREF_MY_CONTACTS;
41 |
42 | extern NSString *PREF_SYNC_TASKS;
43 | extern NSString *PREF_MY_TASKS;
44 |
45 | extern NSString *PREF_SYNC_EVENTS;
46 | extern NSString *PREF_MY_EVENTS;
47 |
48 | extern NSString *PREF_AUTO_SYNC_INTERVAL;
49 | extern NSString *PREF_LAST_SYNC_DATE;
50 | extern NSString *PREF_VERSION_OF_LAST_REGISTRATION;
51 | extern NSString *PREF_AUTO_JOIN_SYNC;
52 | extern NSString *PREF_CALENDAR_SUFFIX;
53 |
54 | extern NSString *PREF_ENABLE_PROTECT_SFDC;
55 | extern NSString *PREF_PROTECT_SFDC_LIMIT;
56 |
57 | extern NSString *PREF_ONE_WAY_SYNC;
--------------------------------------------------------------------------------
/sfCubed/Constants.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "Constants.h"
23 |
24 | // SyncServices entity names
25 | NSString *Entity_Contact = @"com.apple.contacts.Contact";
26 | NSString *Entity_Email = @"com.apple.contacts.Email Address";
27 | NSString *Entity_Phone = @"com.apple.contacts.Phone Number";
28 | NSString *Entity_Address = @"com.apple.contacts.Street Address";
29 | NSString *Entity_Task = @"com.apple.calendars.Task";
30 | NSString *Entity_Calendar= @"com.apple.calendars.Calendar";
31 | NSString *Entity_Event = @"com.apple.calendars.Event";
32 |
33 | NSString *key_RecordEntityName = @"com.apple.syncservices.RecordEntityName";
34 |
35 | // user preferences
36 | NSString *PREF_SEEN_PREFS = @"SEEN_PREFS";
37 | NSString *PREF_SHOW_WELCOME = @"SHOW_WELCOME";
38 | NSString *PREF_SERVERS = @"servers";
39 | NSString *PREF_SERVER = @"server";
40 |
41 | NSString *PREF_SYNC_CONTACTS = @"SYNC_CONTACTS";
42 | NSString *PREF_MY_CONTACTS = @"MY_CONTACTS";
43 |
44 | NSString *PREF_SYNC_TASKS = @"SYNC_TASKS";
45 | NSString *PREF_MY_TASKS = @"MY_TASKS";
46 | NSString *PREF_SYNC_EVENTS = @"SYNC_EVENTS";
47 | NSString *PREF_MY_EVENTS = @"MY_EVENTS";
48 |
49 | // how often to do auto sync
50 | NSString *PREF_AUTO_SYNC_INTERVAL = @"AUTO_SYNC_INTERVAL";
51 | // do we want to sync when sync services says there's a sync ?
52 | NSString *PREF_AUTO_JOIN_SYNC = @"AUTO_JOIN_SYNC";
53 |
54 | // when did we last sync ?
55 | NSString *PREF_LAST_SYNC_DATE = @"LAST_SYNC_DATE";
56 |
57 | // what version number were we when we last registered
58 | NSString *PREF_VERSION_OF_LAST_REGISTRATION = @"VERSION_LAST_REGISTERED";
59 |
60 | NSString *PREF_CALENDAR_SUFFIX = @"CALENDAR_ID_SUFFIX";
61 |
62 | NSString *PREF_ENABLE_PROTECT_SFDC = @"ENABLE_PROTECT_SFDC";
63 | NSString *PREF_PROTECT_SFDC_LIMIT = @"PROTECT_SFDC_LIMIT";
64 |
65 | NSString *PREF_ONE_WAY_SYNC = @"ONE_WAY_SYNC";
--------------------------------------------------------------------------------
/sfCubed/ContactMapper.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "BaseMapper.h"
23 | #import "LookupInfoCache.h"
24 | #import "PulledItem.h"
25 |
26 | // mapper for Contact/Account to Contacts/address/phone/ etc.
27 | // this is complicated by the significant differences in datamodels, the
28 | // salesforce.com model is flat, where as the apple side has various child
29 | // entities for addresses, phone numbers, IM addresses etc.
30 | // The salesforce.com side has some slots for these, but can't cope with
31 | // the variable number that's supported on the AddressBook side, so we
32 | // have to do various dances to handle a subset of the child entities
33 | // and also a subset of the child entity types (e.g. one work and one home address)
34 | //
35 | // It feels like there must be an easier way to handle this mis-match, but
36 | // its not clear yet how. the Sync Services folks suggested i might be making
37 | // things harder on myself by pulling all the changes first before trying
38 | // to process any of them.
39 | @interface ContactMapper : BaseMapper {
40 | NSDictionary *phoneMappings;
41 | NSDictionary *addressParts;
42 | NSDictionary *addressMappings;
43 | NSMutableSet *duplicatedRecordIds;
44 |
45 | LookupInfoCache *accountLookup;
46 | NSMutableDictionary *accountNameToIds;
47 | }
48 |
49 | + (NSDictionary *)supportedPhoneTypes;
50 |
51 | // init
52 | - (ContactMapper *)initMapper:(ZKSforceClient *)sf options:(SyncOptions *)options;
53 |
54 | // push impl
55 | - (NSDictionary *)makeSyncEmailRecord:(ZKSObject *)src;
56 | - (NSDictionary *)makeSyncPhoneRecord:(ZKSObject *)src sfdcField:(NSString *)sfdcField;
57 | - (NSDictionary *)makeSyncAddressRecord:(ZKSObject *)src prefix:(NSString *)prefix appleType:(NSString *)appleType;
58 | - (NSMutableDictionary *)makeRelatedRecordOfType:(NSString *)entityName type:(NSString *)appleType value:(NSString *)value sfdcId:(NSString *)sfdcId;
59 | - (BOOL)hasAnyAddressField:(ZKSObject *)src addressPrefix:(NSString *)prefix;
60 | - (NSString *)makeAddressKey:(NSString *)Id prefix:(NSString *)prefix;
61 |
62 | // pull impl
63 | - (PulledItem *)findOrCreatePulledItemForRelatedChange:(NSString *)parentId;
64 | - (void)updateFieldValueForContactId:(NSString *)contactId field:(NSString *)field value:(NSString *)value acceptInfo:(AcceptChangeInfo *)cai;
65 | - (void)updateAddressFieldsForContactId:(NSString *)contactId prefix:(NSString *)prefix newAddress:(NSDictionary *)record acceptInfo:(AcceptChangeInfo *)aci;
66 | - (BOOL)pulledRecordWithId:(NSString *)contactId hasThisFieldPopulated:(NSString *)fieldName;
67 |
68 | // accountName support
69 | - (NSString *)lookupAccountIdFromName:(NSString *)accName;
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/sfCubed/Credits.html:
--------------------------------------------------------------------------------
1 | Credits
2 |
3 |
4 | Synchronize data between your Mac and Salesforce.com
5 | http://www.pocketsoap.com/osx/sf3
6 |
7 |
8 |
9 |
10 | Includes RoundedBox code by Matt Gemmell.
11 | Includes Sparkle code by Andy Matuschak.
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sfCubed/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/English.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/sfCubed/English.lproj/MainMenu.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | ACTIONS
9 |
10 | closePrefsWindow
11 | id
12 | closeWelcome
13 | id
14 | launchSfdcInBrowser
15 | id
16 | login
17 | ZKSforceClient
18 | showLogin
19 | id
20 | showPrefsWindow
21 | id
22 | syncNow
23 | id
24 | toggleLogDrawer
25 | id
26 | triggerSyncNow
27 | id
28 | unregisterClient
29 | id
30 |
31 | CLASS
32 | SFCubed
33 | LANGUAGE
34 | ObjC
35 | OUTLETS
36 |
37 | launchSfdc
38 | NSMenuItem
39 | logDrawer
40 | NSDrawer
41 | logTextView
42 | NSTextView
43 | mainBox
44 | RoundedBox
45 | myWindow
46 | NSWindow
47 | prefsWindow
48 | NSWindow
49 | progress
50 | NSProgressIndicator
51 | progressIndicator
52 | NSProgressIndicator
53 | showWelcomeCheckbox
54 | NSButton
55 | statusText1
56 | NSTextField
57 | statusText2
58 | NSTextField
59 | syncNowMenuItem
60 | NSMenuItem
61 | welcomeWindow
62 | NSWindow
63 |
64 | SUPERCLASS
65 | NSObject
66 |
67 |
68 | CLASS
69 | FirstResponder
70 | LANGUAGE
71 | ObjC
72 | SUPERCLASS
73 | NSObject
74 |
75 |
76 | CLASS
77 | ZKSforceClient
78 | LANGUAGE
79 | ObjC
80 | SUPERCLASS
81 | ZKBaseClient
82 |
83 |
84 | ACTIONS
85 |
86 | checkForUpdates
87 | id
88 |
89 | CLASS
90 | SUUpdater
91 | LANGUAGE
92 | ObjC
93 | SUPERCLASS
94 | NSObject
95 |
96 |
97 | CLASS
98 | ZKBaseClient
99 | LANGUAGE
100 | ObjC
101 | SUPERCLASS
102 | NSObject
103 |
104 |
105 | CLASS
106 | RoundedBox
107 | LANGUAGE
108 | ObjC
109 | SUPERCLASS
110 | NSBox
111 |
112 |
113 | CLASS
114 | SFPrefs
115 | LANGUAGE
116 | ObjC
117 | SUPERCLASS
118 | NSObject
119 |
120 |
121 | IBVersion
122 | 1
123 |
124 |
125 |
--------------------------------------------------------------------------------
/sfCubed/English.lproj/MainMenu.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 677
7 | IBLastKnownRelativeProjectPath
8 | ../sfCubed.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 751
14 |
15 | IBSystem Version
16 | 9L30
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sfCubed/English.lproj/MainMenu.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/English.lproj/MainMenu.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/sfCubed/EventFieldMappingInfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "FieldMappingInfo.h"
24 |
25 | // This maps between end date on the iCal side, and duration on the salesforce.com side
26 | @interface DurationFieldMappingInfo : FieldMappingInfo {
27 | }
28 | - (id) initWithInfo:(NSString *)syncName sfdcName:(NSString *)sfdc;
29 | @end
30 |
31 | // This maps between start date on the iCal side, and activityDate/activityDateTime on the salesforce.com side
32 | @interface ActivityDateTimeMappingInfo : FieldMappingInfo {
33 | }
34 | - (id) initWithInfo:(NSString *)syncName;
35 | @end
36 |
--------------------------------------------------------------------------------
/sfCubed/EventFieldMappingInfo.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "EventFieldMappingInfo.h"
23 | #import "zkSObject.h"
24 |
25 | @interface ZKSObject (ActivityDateTime)
26 | -(NSCalendarDate *)activityStart;
27 | @end
28 |
29 | @implementation ZKSObject (ActivityDateTime)
30 | -(NSCalendarDate *)activityStart {
31 | return [self boolValue:@"IsAllDayEvent"] ? [self dateValue:@"ActivityDate"] : [self dateTimeValue:@"ActivityDateTime"];
32 | }
33 | @end
34 |
35 | // maps between activityDateTime + DurationInMinutes on sfdc side, to end date on the apple side
36 | @implementation DurationFieldMappingInfo
37 |
38 | - (id) initWithInfo:(NSString *)sName sfdcName:(NSString *)sfdc {
39 | return [super initWithInfo:sName sfdcName:sfdcName type:syncFieldTypeCustom];
40 | }
41 |
42 | // returns the value from the sfdcName field converted to the syncFieldType type
43 | // subclasses can override this and do more interesting stuff
44 | - (id)typedValue:(ZKSObject *)so {
45 | NSCalendarDate * startDate = [so activityStart];
46 | int duration = [so intValue:@"DurationInMinutes"];
47 | NSCalendarDate *ed = [startDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:duration seconds:0];
48 | return ed;
49 | }
50 |
51 | // updates the value in the SObject with the relevant value(s) from the syncData
52 | - (void)mapFromApple:(NSDictionary *)syncData toSObject:(ZKSObject *)s {
53 | NSCalendarDate *start = [syncData objectForKey:@"start date"];
54 | NSCalendarDate *end = [syncData objectForKey:@"end date"];
55 | long seconds = (long)[end timeIntervalSinceDate:start];
56 | NSString *dur = [NSString stringWithFormat:@"%d", seconds / 60];
57 | [s setFieldValue:dur field:@"DurationInMinutes"];
58 | }
59 |
60 | @end
61 |
62 | @implementation ActivityDateTimeMappingInfo
63 |
64 | - (id) initWithInfo:(NSString *)sName {
65 | return [super initWithInfo:sName sfdcName:@"ActivityDateTime" type:syncFieldTypeCustom];
66 | }
67 |
68 | - (id)typedValue:(ZKSObject *)so {
69 | return [so activityStart];
70 | }
71 |
72 | - (void)mapFromApple:(NSDictionary *)syncData toSObject:(ZKSObject *)s {
73 | NSCalendarDate *start = [syncData objectForKey:syncName];
74 | if (start == nil) return;
75 | if ([[syncData objectForKey:@"all day"] boolValue])
76 | [s setFieldDateValue:start field:@"ActivityDate"];
77 | else
78 | [s setFieldDateTimeValue:start field:sfdcName];
79 | }
80 |
81 | @end
--------------------------------------------------------------------------------
/sfCubed/EventMapper.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "ActivityMapper.h"
25 |
26 | @interface EventMapper : ActivityMapper {
27 | }
28 |
29 | -(id)initMapper:(ZKSforceClient *)sf options:(SyncOptions *)options;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/sfCubed/FieldMappingInfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkSObject.h"
25 |
26 | // what type of field mapping is this ?
27 | typedef enum SyncFieldType {
28 | syncFieldTypeString,
29 | syncFieldTypeNumber,
30 | syncFieldTypeDate,
31 | syncFieldTypeDateTime,
32 | syncFieldTypeBoolean,
33 | syncFieldTypeCustom
34 | } SyncFieldType;
35 |
36 | // metadata for an individual field mapping
37 | @interface FieldMappingInfo : NSObject {
38 | NSString * syncName;
39 | NSString * sfdcName;
40 | SyncFieldType fieldType;
41 | }
42 | - (id) initWithInfo:(NSString *)sync sfdcName:(NSString *)sfdc type:(SyncFieldType)st;
43 | - (NSString *)syncName;
44 | - (NSString *)sfdcName;
45 | - (SyncFieldType)syncFieldType;
46 | // returns the value from the sfdcName field converted to the syncFieldType type
47 | // subclasses can override this and do more interesting stuff
48 | - (id)typedValue:(ZKSObject *)so;
49 |
50 | // updates the value in the SObject with the relevant value(s) from the syncData dictionary
51 | - (void)mapFromApple:(NSDictionary *)syncData toSObject:(ZKSObject *)s;
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/sfCubed/FieldMappingInfo.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "FieldMappingInfo.h"
23 |
24 | @implementation FieldMappingInfo
25 |
26 | - (id) initWithInfo:(NSString *)sync sfdcName:(NSString *)sfdc type:(SyncFieldType)st {
27 | self = [super init];
28 | syncName = [sync retain];
29 | sfdcName = [sfdc retain];
30 | fieldType = st;
31 | return self;
32 | }
33 |
34 | - (void)dealloc {
35 | [syncName release];
36 | [sfdcName release];
37 | [super dealloc];
38 | }
39 |
40 | - (NSString *)syncName {
41 | return syncName;
42 | }
43 |
44 | - (NSString *)sfdcName {
45 | return sfdcName;
46 | }
47 |
48 | - (SyncFieldType)syncFieldType {
49 | return fieldType;
50 | }
51 |
52 | - (id)typedValue:(ZKSObject *)src {
53 | NSString *v = [src fieldValue:sfdcName];
54 | if (v == nil) return nil;
55 | switch (fieldType) {
56 | case syncFieldTypeString: return v;
57 | case syncFieldTypeNumber: return [NSNumber numberWithInt:[src intValue:sfdcName]];
58 | case syncFieldTypeDate: return [src dateValue:sfdcName];
59 | case syncFieldTypeDateTime: return [src dateTimeValue:sfdcName];
60 | case syncFieldTypeBoolean: return [NSNumber numberWithBool:[src boolValue:sfdcName]];
61 | }
62 | @throw [NSException exceptionWithName:@"Unsupported SyncFieldType" reason:[NSString stringWithFormat:@"No type mapping available for syncFieldType of %d", fieldType] userInfo:nil];
63 | }
64 |
65 | - (void)mapFromApple:(NSDictionary *)syncData toSObject:(ZKSObject *)s {
66 | id v = [syncData objectForKey:syncName];
67 | if (v == nil) {
68 | if (syncFieldTypeBoolean == fieldType)
69 | [s setFieldValue:@"false" field:sfdcName];
70 | else
71 | [s setFieldToNull:sfdcName];
72 | } else {
73 | switch (fieldType) {
74 | case syncFieldTypeString: [s setFieldValue:v field:sfdcName]; break;
75 | case syncFieldTypeNumber: [s setFieldValue:[v stringValue] field:sfdcName]; break;
76 | case syncFieldTypeDate: [s setFieldDateValue:v field:sfdcName]; break;
77 | case syncFieldTypeDateTime:[s setFieldDateTimeValue:v field:sfdcName]; break;
78 | case syncFieldTypeBoolean: [s setFieldValue:[v boolValue] ? @"true" : @"false" field:sfdcName]; break;
79 | }
80 | }
81 | }
82 |
83 | @end
--------------------------------------------------------------------------------
/sfCubed/IdUrlFieldMappingInfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "FieldMappingInfo.h"
24 | #import "zkSforceClient.h"
25 | #import "zkDescribeSObject.h"
26 |
27 | // this mapper populates the Url to the event/task based on the saleforce.com records Id.
28 |
29 | // Id / Url field mapping
30 | @interface IdUrlFieldMappingInfo : FieldMappingInfo {
31 | NSString *urlFormat;
32 | }
33 | - (id) initWithInfo:(NSString*)syncName sfdcName:(NSString *)sfdc describe:(ZKDescribeSObject *)desc;
34 | @end
35 |
--------------------------------------------------------------------------------
/sfCubed/IdUrlFieldMappingInfo.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "IdUrlFieldMappingInfo.h"
23 |
24 |
25 | //////////////////////////////////////////////////////////////////////////////////////
26 | // IdUrlFieldMappingInfo
27 | //////////////////////////////////////////////////////////////////////////////////////
28 | @implementation IdUrlFieldMappingInfo
29 |
30 | - (id) initWithInfo:(NSString*)sync sfdcName:(NSString *)sfdc describe:(ZKDescribeSObject *)desc {
31 | [super initWithInfo:sync sfdcName:sfdc type:syncFieldTypeCustom];
32 | NSMutableString *detail = [NSMutableString stringWithString:[desc urlDetail]];
33 | [detail replaceOccurrencesOfString:@"{ID}" withString:@"%@" options:NSLiteralSearch range:NSMakeRange(0, [detail length])];
34 | urlFormat = [detail retain];
35 | return self;
36 | }
37 |
38 | -(void)dealloc {
39 | [urlFormat release];
40 | [super dealloc];
41 | }
42 |
43 | // this is a no-op, we don't care what sync says the url is
44 | - (void)mapFromApple:(NSDictionary *)syncData toSObject:(ZKSObject *)s {
45 | }
46 |
47 | - (id)typedValue:(ZKSObject *)so {
48 | NSString *sfId = [so id];
49 | if (sfId == nil) return nil;
50 | return [NSURL URLWithString:[NSString stringWithFormat:urlFormat, sfId]];
51 | }
52 |
53 | @end
--------------------------------------------------------------------------------
/sfCubed/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | LSMinimumSystemVersion
6 | 10.6.0
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | sf
13 | CFBundleIdentifier
14 | com.pocketsoap.sfCubed
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 0.65
25 | NSMainNibFile
26 | MainMenu
27 | NSPrincipalClass
28 | NSApplication
29 | SUFeedURL
30 | http://www.pocketsoap.com/osx/sf3/sf3.xml
31 | clientId
32 | SFCubed
33 |
34 |
35 |
--------------------------------------------------------------------------------
/sfCubed/LookupInfoCache.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "zkSforceClient.h"
24 |
25 | @interface LookupInfoCache : NSObject {
26 | NSString *sobjectType;
27 | NSString *fieldList;
28 | NSMutableSet *idsToFetch;
29 | NSMutableDictionary *fetchedObjects;
30 | ZKSforceClient *sforce;
31 | }
32 |
33 | + (LookupInfoCache *) cacheForSObject:(NSString *)soType fields:(NSString *)fields sforce:(ZKSforceClient *)sf;
34 |
35 | - (id) initForSObject:(NSString *)soType fields:(NSString *)fields sforce:(ZKSforceClient *)sf;
36 |
37 | - (id)findOrFetchEntry:(NSString *)sfId;
38 | - (NSArray *) allFetchedObjects;
39 | - (void)addEntry:(id)entry forId:(NSString *)sfId;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/sfCubed/LookupInfoCache.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "LookupInfoCache.h"
23 |
24 | @implementation LookupInfoCache
25 |
26 | +(LookupInfoCache *)cacheForSObject:(NSString *)soType fields:(NSString *)fields sforce:(ZKSforceClient *)sf {
27 | return [[[LookupInfoCache alloc] initForSObject:soType fields:fields sforce:sf] autorelease];
28 | }
29 |
30 | -(id)initForSObject:(NSString *)soType fields:(NSString *)fields sforce:(ZKSforceClient *)sf {
31 | self = [super init];
32 | sobjectType = [soType retain];
33 | fieldList = [fields retain];
34 | fetchedObjects = [[NSMutableDictionary alloc] init];
35 | sforce = [sf retain];
36 | return self;
37 | }
38 |
39 | - (void)dealloc {
40 | [sobjectType release];
41 | [fieldList release];
42 | [fetchedObjects release];
43 | [sforce release];
44 | [super dealloc];
45 | }
46 |
47 | - (void)fetchNow:(NSString *)sfid {
48 | [fetchedObjects addEntriesFromDictionary:[sforce retrieve:fieldList sobject:sobjectType ids:[NSArray arrayWithObject:sfid]]];
49 | }
50 |
51 | - (id)findEntry:(NSString *)sfId {
52 | return [fetchedObjects objectForKey:sfId];
53 | }
54 |
55 | - (id)findOrFetchEntry:(NSString *)sfId {
56 | if (sfId == nil) return nil;
57 | id entry= [self findEntry:sfId];
58 | if (entry != nil) return entry;
59 | [self fetchNow:sfId];
60 | return [self findEntry:sfId];
61 | }
62 |
63 | - (NSArray *) allFetchedObjects {
64 | return [fetchedObjects allValues];
65 | }
66 |
67 | - (void)addEntry:(id)entry forId:(NSString *)sfId {
68 | [fetchedObjects setObject:entry forKey:sfId];
69 | }
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/sfCubed/Mappers.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "BaseMapper.h"
24 | #import "CalendarTracker.h"
25 |
26 | // this is the collection of entity mappers we're going to use for a
27 | // sync session, note that because both Tasks & Events share a parent calendar
28 | // we have to specially managed that shared calendar entry (CalendarTracker)
29 |
30 | @interface Mappers : NSObject {
31 | NSMutableArray *mappers;
32 | CalendarTracker *calendar;
33 | ISyncSession *session;
34 | }
35 | - (id)initForUserId:(NSString *)uid;
36 |
37 | - (void)addMapper:(BaseMapper *)m;
38 | - (NSArray *)entityNames;
39 | - (NSArray *)filters;
40 | - (void)setSession:(ISyncSession *)session;
41 |
42 | - (NSEnumerator *)objectEnumerator;
43 | - (UInt32)count;
44 | - (void)pushFinished:(NSString *)userId;
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/sfCubed/Mappers.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import "Mappers.h"
24 | #import "Constants.h"
25 | #import "ActivityMapper.h"
26 |
27 | @interface Mappers (Private)
28 | - (NSArray *)accumulate:(SEL)sel;
29 | @end
30 |
31 | @implementation Mappers
32 |
33 | - (id)initForUserId:(NSString *)uid {
34 | [super init];
35 | mappers = [[NSMutableArray alloc] init];
36 | calendar = [[CalendarTracker alloc] initForUserId:uid];
37 | return self;
38 | }
39 |
40 | - (void)dealloc {
41 | [mappers release];
42 | [calendar release];
43 | [session release];
44 | [super dealloc];
45 | }
46 |
47 | - (void)addMapper:(BaseMapper *)m {
48 | [mappers addObject:m];
49 | if ([m respondsToSelector:@selector(setCalendarTracker:)])
50 | [(id)m setCalendarTracker:calendar];
51 | }
52 |
53 | // when we're done pushing, we need to push the calendar entity if needed
54 | - (void)pushFinished:(NSString *)userId {
55 | NSDictionary *cal = [calendar asSyncObjectForSession:session];
56 | NSUserDefaults *d = [NSUserDefaults standardUserDefaults];
57 | if ([d boolForKey:PREF_SYNC_TASKS] || [d boolForKey:PREF_SYNC_EVENTS])
58 | [session pushChangesFromRecord:cal withIdentifier:[calendar calendarId]];
59 | }
60 |
61 | - (NSArray *)accumulate:(SEL)sel {
62 | NSMutableSet * entities = [NSMutableSet set];
63 | BaseMapper * m;
64 | NSEnumerator * e = [mappers objectEnumerator];
65 | while(m = [e nextObject]) {
66 | [entities addObjectsFromArray:[m performSelector:sel]];
67 | }
68 | return [entities allObjects];
69 | }
70 |
71 | - (NSArray *)entityNames
72 | {
73 | return [self accumulate:@selector(entityNames)];
74 | }
75 |
76 | - (NSArray *)filters
77 | {
78 | return [self accumulate:@selector(filters)];
79 | }
80 |
81 | - (void)setSession:(ISyncSession *)syncSession
82 | {
83 | session = [syncSession retain];
84 | [mappers makeObjectsPerformSelector:@selector(setSession:) withObject:syncSession];
85 | }
86 |
87 | - (NSEnumerator *)objectEnumerator
88 | {
89 | return [mappers objectEnumerator];
90 | }
91 |
92 | - (UInt32)count
93 | {
94 | return [mappers count];
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/sfCubed/MyISyncChange.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import
24 |
25 | @interface MyISyncChange : ISyncChange {
26 | ISyncChangeType type;
27 | ISyncChange *src;
28 | }
29 |
30 | + (id)wrap:(ISyncChange *)src withType:(ISyncChangeType)type;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/sfCubed/MyISyncChange.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "MyISyncChange.h"
23 |
24 | @interface MyISyncChange(Private)
25 | - (id)initWithChange:(ISyncChange *)c type:(ISyncChangeType)type;
26 | - (void)setRecord:(NSDictionary *)r;
27 | @end
28 |
29 | @implementation MyISyncChange
30 |
31 | + (id)wrap:(ISyncChange *)src withType:(ISyncChangeType)type {
32 | return [[[MyISyncChange alloc] initWithChange:src type:type] autorelease];
33 | }
34 |
35 | - (id)initWithChange:(ISyncChange *)c type:(ISyncChangeType)t {
36 | self = [super init];
37 | src = [c retain];
38 | type = t;
39 | return self;
40 | }
41 |
42 | - (void)dealloc {
43 | [src release];
44 | [super dealloc];
45 | }
46 |
47 | - (ISyncChangeType)type {
48 | return type;
49 | }
50 |
51 | - (NSString *)recordIdentifier {
52 | return [src recordIdentifier];
53 | }
54 |
55 | - (NSDictionary *)record {
56 | return [src record];
57 | }
58 |
59 | - (NSArray /* NSDictionary */ *)changes {
60 | return [src changes];
61 | }
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/sfCubed/ProtectController.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 | @class SalesforceChangeSummary;
25 |
26 | @interface ProtectController : NSObject {
27 | SalesforceChangeSummary *summary;
28 | IBOutlet NSWindow *window;
29 | IBOutlet NSTableView *table;
30 | }
31 |
32 | -(id)initWithChanges:(SalesforceChangeSummary *)s;
33 |
34 | // returns true if the user selected to continue with the sync
35 | -(BOOL)shouldContinueSync;
36 |
37 | -(IBAction)cancelSync:(id)sender;
38 | -(IBAction)continueSync:(id)sender;
39 | @end
40 |
--------------------------------------------------------------------------------
/sfCubed/ProtectController.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "ProtectController.h"
23 | #import "SalesforceObjectChangeSummary.h"
24 |
25 | @implementation ProtectController
26 |
27 | -(id)initWithChanges:(SalesforceChangeSummary *)s {
28 | self = [super init];
29 | summary = [s retain];
30 | return self;
31 | }
32 |
33 | -(void)dealloc {
34 | [summary release];
35 | [super dealloc];
36 | }
37 |
38 | // returns true if the user selected to continue with the sync
39 | -(BOOL)shouldContinueSync {
40 | [NSBundle loadNibNamed:@"protect.nib" owner:self];
41 | [table setDelegate:self];
42 | [summary removeEntitiesWithNoChanges];
43 | [table setDataSource:summary];
44 | [table reloadData];
45 |
46 | BOOL cont = [NSApp runModalForWindow:window] == NSRunStoppedResponse;
47 | [window orderOut:self];
48 | [table setDelegate:nil];
49 | [table setDataSource:nil];
50 | return cont;
51 | }
52 |
53 | -(IBAction)cancelSync:(id)sender {
54 | [NSApp abortModal];
55 | }
56 |
57 | -(IBAction)continueSync:(id)sender {
58 | [NSApp stopModal];
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/sfCubed/PulledItem.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import
24 |
25 | @class AcceptChangeInfo;
26 | @class ZKSObject;
27 |
28 | // tracking object for a single sobject that's been pulled from sync services.
29 | // because we map a sync entity + child entities into a single sObject
30 | // we can have a list of Sync Changes that we need to accept for this one
31 | // sobject
32 | @interface PulledItem : NSObject {
33 | ISyncChange *change;
34 | ZKSObject *sobject;
35 | NSMutableArray *childAccepts;
36 | BOOL shouldFormatForAccept;
37 | }
38 |
39 | + (PulledItem *)itemForChange:(ISyncChange *)c SObject:(ZKSObject *)so;
40 | - (id)initForChange:(ISyncChange *)c SObject:(ZKSObject *)so;
41 |
42 | - (BOOL)shouldFormatForAccept;
43 | - (void)setShouldFormatForAccept:(BOOL)f;
44 |
45 | - (ISyncChangeType)changeType;
46 | - (ZKSObject * )sobject;
47 | - (void)addChildAccept:(AcceptChangeInfo *)childAccept;
48 | - (void)accept:(ISyncSession *)session formattedRecord:(NSDictionary *)formattedRecord sfdcId:(NSString *)sfdcId;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/sfCubed/PulledItem.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "PulledItem.h"
23 | #import "AcceptChangeInfo.h"
24 | #import "ZKSObject.h"
25 |
26 | @implementation PulledItem
27 |
28 | + (PulledItem *)itemForChange:(ISyncChange *)c SObject:(ZKSObject *)so
29 | {
30 | PulledItem * i = [[PulledItem alloc] initForChange:c SObject:so];
31 | return [i autorelease];
32 | }
33 |
34 | - (id)initForChange:(ISyncChange *)c SObject:(ZKSObject *)so
35 | {
36 | [super init];
37 | change = [c retain];
38 | sobject = [so retain];
39 | childAccepts = [[NSMutableArray alloc] init];
40 | shouldFormatForAccept = YES;
41 | return self;
42 | }
43 |
44 | - (void)dealloc
45 | {
46 | [change release];
47 | [sobject release];
48 | [childAccepts release];
49 | [super dealloc];
50 | }
51 |
52 |
53 | - (ISyncChangeType)changeType {
54 | // if change is nil, then there's no primary change, but a bunch of changes for related records
55 | // which by definition makes this an update
56 | return change == nil ? ISyncChangeTypeModify : [change type];
57 | }
58 |
59 | - (ZKSObject * )sobject
60 | {
61 | return sobject;
62 | }
63 |
64 | - (void)addChildAccept:(AcceptChangeInfo *)childAccept
65 | {
66 | if (childAccept != nil)
67 | [childAccepts addObject:childAccept];
68 | }
69 |
70 | - (void)acceptChildren:(ISyncSession *)session sfId:(NSString *)sfId isForDelete:(BOOL)forDel {
71 | AcceptChangeInfo * c;
72 | NSEnumerator *e = [childAccepts objectEnumerator];
73 | while (c = [e nextObject]) {
74 | if ([c isForDelete] == forDel)
75 | [c accept:session];
76 | }
77 | }
78 |
79 | - (void)preAcceptChildren:(ISyncSession *)session sfdcId:(NSString *)sfdcId {
80 | AcceptChangeInfo *c;
81 | NSEnumerator *e = [childAccepts objectEnumerator];
82 | while (c = [e nextObject])
83 | [c preAccept:session sfId:sfdcId];
84 |
85 | e = [childAccepts objectEnumerator];
86 | while (c = [e nextObject])
87 | [c preAccept2:session sfId:sfdcId];
88 | }
89 |
90 | - (void)accept:(ISyncSession *)session formattedRecord:(NSDictionary *)formattedRecord sfdcId:(NSString *)sfdcId {
91 | [self preAcceptChildren:session sfdcId:sfdcId];
92 | // because we re-use synthetic ids where we have a flattenen data model vs Apple, we need to accept
93 | // all the delete first so we can re-use the ids.
94 | [self acceptChildren:session sfId:sfdcId isForDelete:YES];
95 | if (change != nil) {
96 | [session clientAcceptedChangesForRecordWithIdentifier:[change recordIdentifier] formattedRecord:formattedRecord newRecordIdentifier:sfdcId];
97 | }
98 | [self acceptChildren:session sfId:sfdcId isForDelete:NO];
99 | }
100 |
101 | - (BOOL)shouldFormatForAccept {
102 | return shouldFormatForAccept;
103 | }
104 |
105 | - (void)setShouldFormatForAccept:(BOOL)f {
106 | shouldFormatForAccept = f;
107 | }
108 |
109 | @end
110 |
--------------------------------------------------------------------------------
/sfCubed/SFCubed.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | // This is the main UI Controller class, in addition to managing the various
23 | // UI bit's'peices it also contains the main driver for the sync session
24 | // the later part should be removed from here to a different object.
25 |
26 | // Most of the interactions between this class and the UI have us hooked upto
27 | // the various widgets via IB, and we change them directly, this really needs
28 | // reworking to using Cocoa bindings instead.
29 |
30 | #import
31 | #import
32 | #import "zkSforceClient.h"
33 | #import "zkSObject.h"
34 | #import "Mappers.h"
35 | #import "SFPrefs.h"
36 | #import "RoundedBox.h"
37 | #import "ZKLoginController.h"
38 |
39 | @class DeleteAccumulator;
40 | @class SyncOptions;
41 |
42 | @interface SFCubed : NSObject {
43 | IBOutlet RoundedBox *mainBox;
44 | IBOutlet NSWindow *welcomeWindow;
45 | IBOutlet NSButton *showWelcomeCheckbox;
46 |
47 | IBOutlet NSMenuItem *syncNowMenuItem;
48 | IBOutlet NSMenuItem *launchSfdc;
49 |
50 | IBOutlet NSWindow *myWindow;
51 | IBOutlet NSTextField *statusText1;
52 | IBOutlet NSTextField *statusText2;
53 | IBOutlet NSProgressIndicator *progressIndicator;
54 |
55 | IBOutlet NSDrawer *logDrawer;
56 | IBOutlet NSTextView *logTextView;
57 |
58 | IBOutlet NSWindow *prefsWindow;
59 |
60 | ZKLoginController *login;
61 | ZKSforceClient *sforce;
62 |
63 | NSTimer *trickleTimer;
64 | NSURL *baseUiUrl;
65 | BOOL registeredWithOtherClients;
66 | }
67 |
68 | - (void)checkShowWelcome:(NSNotification *)n;
69 | - (IBAction)closeWelcome:(id)sender;
70 |
71 | - (IBAction)showPrefsWindow:(id)sender;
72 | - (IBAction)closePrefsWindow:(id)sender;
73 |
74 | - (void)showLastSyncStatus;
75 | - (IBAction)toggleLogDrawer:(id)sender;
76 |
77 | - (IBAction)showLogin:(id)sender;
78 | - (IBAction)login:(ZKSforceClient *)authenticatedClientStub;
79 |
80 | - (IBAction)launchSfdcInBrowser:(id)sender;
81 | - (IBAction)triggerSyncNow:(id)sender;
82 |
83 | - (IBAction)syncNow:(id)sender;
84 |
85 | - (IBAction)unregisterClient:(id)sender;
86 | - (void)client:(ISyncClient *)client willSyncEntityNames:(NSArray *)entityNames;
87 | - (void)registerForOtherClients:(SyncOptions *)options;
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/sfCubed/SFPrefs.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 | @interface SFPrefs : NSObject {
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/sfCubed/SFPrefs.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "SFPrefs.h"
23 | #import "Constants.h"
24 |
25 | // UserDefaults initialization
26 |
27 | @implementation SFPrefs
28 |
29 | + (void)initialize {
30 | // user defaults
31 | NSMutableDictionary * defaults = [NSMutableDictionary dictionary];
32 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_SYNC_CONTACTS];
33 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_MY_CONTACTS];
34 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_SYNC_TASKS];
35 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_MY_TASKS];
36 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_SHOW_WELCOME];
37 | [defaults setObject:[NSNumber numberWithInt:0] forKey:PREF_AUTO_SYNC_INTERVAL];
38 | [defaults setObject:[NSNumber numberWithInt:1] forKey:PREF_CALENDAR_SUFFIX];
39 | [defaults setObject:[NSNumber numberWithInt:0] forKey:PREF_PROTECT_SFDC_LIMIT];
40 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_ENABLE_PROTECT_SFDC];
41 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_AUTO_JOIN_SYNC];
42 | [defaults setObject:[NSNumber numberWithBool:YES] forKey:PREF_ONE_WAY_SYNC];
43 |
44 | NSString *prod = @"https://www.salesforce.com";
45 | NSString *test = @"https://test.salesforce.com";
46 | NSArray *servers = [NSArray arrayWithObjects:prod, test, nil];
47 | [defaults setObject:servers forKey:PREF_SERVERS];
48 | [defaults setObject:prod forKey:PREF_SERVER];
49 |
50 | // register app defaults
51 | [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/sfCubed/SalesforceObjectChangeSummary.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 | // tracks data about changes we're planning to make to salesforce.com
25 | @interface SalesforceObjectChangeSummary : NSObject {
26 | NSString *entityName;
27 | int adds;
28 | int updates;
29 | int deletes;
30 | }
31 |
32 | -(void)incrementAdds:(int)num;
33 | -(void)incrementUpdates:(int)num;
34 | -(void)incrementDeletes:(int)num;
35 |
36 | -(NSNumber *)adds;
37 | -(NSNumber *)deletes;
38 | -(NSNumber *)updates;
39 | -(int)totalChanges;
40 |
41 | -(NSString *)entityName;
42 |
43 | @end
44 |
45 | // summary data about the set of entities we're planning to change in salesforce.com
46 | @interface SalesforceChangeSummary : NSObject {
47 | NSMutableDictionary *changes;
48 | NSArray *keyIndex;
49 | }
50 |
51 | -(SalesforceObjectChangeSummary *)changesForEntity:(NSString *)entityName;
52 |
53 | -(int)totalChanges;
54 | -(void)removeEntitiesWithNoChanges;
55 | @end
--------------------------------------------------------------------------------
/sfCubed/SalesforceObjectChangeSummary.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "SalesforceObjectChangeSummary.h"
23 |
24 |
25 | @implementation SalesforceObjectChangeSummary
26 |
27 | -(id)initForEntity:(NSString *)entity {
28 | self = [super init];
29 | adds = 0;
30 | deletes = 0;
31 | updates = 0;
32 | entityName = [entity retain];
33 | return self;
34 | }
35 |
36 | -(void)dealloc {
37 | [entityName release];
38 | [super dealloc];
39 | }
40 |
41 | -(void)incrementAdds:(int)num {
42 | adds += num;
43 | }
44 |
45 | -(void)incrementUpdates:(int)num {
46 | updates += num;
47 | }
48 |
49 | -(void)incrementDeletes:(int)num {
50 | deletes += num;
51 | }
52 |
53 | -(NSNumber *)adds {
54 | return [NSNumber numberWithInt:adds];
55 | }
56 |
57 | -(NSNumber *)deletes {
58 | return [NSNumber numberWithInt:deletes];
59 | }
60 |
61 | -(NSNumber *)updates {
62 | return [NSNumber numberWithInt:updates];
63 | }
64 |
65 | -(int)totalChanges {
66 | return adds + updates + deletes;
67 | }
68 |
69 | -(NSString *)entityName {
70 | return entityName;
71 | }
72 |
73 | @end
74 |
75 | @implementation SalesforceChangeSummary
76 |
77 | -(id)init {
78 | self = [super init];
79 | changes = [[NSMutableDictionary alloc] init];
80 | return self;
81 | }
82 |
83 | -(void)dealloc {
84 | [changes release];
85 | [keyIndex release];
86 | [super dealloc];
87 | }
88 |
89 | -(SalesforceObjectChangeSummary *)changesForEntity:(NSString *)entityName {
90 | NSString *key = [entityName lowercaseString];
91 | SalesforceObjectChangeSummary *s = [changes objectForKey:key];
92 | if (s == nil) {
93 | s = [[[SalesforceObjectChangeSummary alloc] initForEntity:entityName] autorelease];
94 | [changes setObject:s forKey:key];
95 | }
96 | return s;
97 | }
98 |
99 | -(void)removeEntitiesWithNoChanges {
100 | NSString *k;
101 | NSEnumerator *e = [[changes allKeys] objectEnumerator];
102 | while (k = [e nextObject]) {
103 | if ([[changes objectForKey:k] totalChanges] == 0)
104 | [changes removeObjectForKey:k];
105 | }
106 | }
107 |
108 | -(int)totalChanges {
109 | NSEnumerator *e = [changes objectEnumerator];
110 | int t = 0;
111 | SalesforceObjectChangeSummary *s;
112 | while (s = [e nextObject])
113 | t += [s totalChanges];
114 | return t;
115 | }
116 |
117 | -(int)numberOfRowsInTableView:(NSTableView *)aTableView {
118 | return [changes count];
119 | }
120 |
121 | -(NSArray *)keyIndex {
122 | if (keyIndex == nil)
123 | keyIndex = [[[changes allKeys] sortedArrayUsingSelector:@selector(compare:)] retain];
124 | return keyIndex;
125 | }
126 |
127 | - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {
128 | NSString *k = [[self keyIndex] objectAtIndex:rowIndex];
129 | SalesforceObjectChangeSummary *s = [changes objectForKey:k];
130 | return [s performSelector:NSSelectorFromString([aTableColumn identifier])];
131 | }
132 |
133 | @end
134 |
135 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Sparkle:
--------------------------------------------------------------------------------
1 | Versions/Current/Sparkle
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSApplication+AppCopies.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/16/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSApplication (SUAppCopies)
12 | - (int)copiesRunning;
13 | @end
14 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSFileManager+Authentication.m
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/9/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | @interface NSFileManager (SUAuthenticationAdditions)
10 | - (BOOL)movePathWithAuthentication:(NSString *)src toPath:(NSString *)dst;
11 | @end
12 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSFileManager+Verification.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/16/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // For the paranoid folks!
12 | @interface NSFileManager (SUVerification)
13 | - (BOOL)validatePath:(NSString *)path withMD5Hash:(NSString *)hash;
14 | - (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature;
15 | @end
16 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/NSString+extras.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD License
4 |
5 | Copyright (c) 2002, Brent Simmons
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without modification,
9 | are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice,
12 | this list of conditions and the following disclaimer.
13 | * Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 | * Neither the name of ranchero.com or Brent Simmons nor the names of its
17 | contributors may be used to endorse or promote products derived
18 | from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
24 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 |
32 | */
33 |
34 |
35 | /*
36 | NSString+extras.h
37 | NetNewsWire
38 |
39 | Created by Brent Simmons on Fri Jun 14 2002.
40 | Copyright (c) 2002 Brent Simmons. All rights reserved.
41 | */
42 |
43 |
44 | #import
45 | #import
46 |
47 |
48 | @interface NSString (extras)
49 |
50 | - (NSString *)stringWithSubstitute:(NSString *)subs forCharactersFromSet:(NSCharacterSet *)set;
51 |
52 | - (NSString *) trimWhiteSpace;
53 |
54 | - (NSString *) stripHTML;
55 |
56 | - (NSString *) ellipsizeAfterNWords: (int) n;
57 |
58 | + (BOOL) stringIsEmpty: (NSString *) s;
59 |
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/RSS.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD License
4 |
5 | Copyright (c) 2002, Brent Simmons
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without modification,
9 | are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice,
12 | this list of conditions and the following disclaimer.
13 | * Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 | * Neither the name of ranchero.com or Brent Simmons nor the names of its
17 | contributors may be used to endorse or promote products derived
18 | from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
24 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 |
32 | */
33 |
34 | /*
35 | RSS.h
36 | A class for reading RSS feeds.
37 |
38 | Created by Brent Simmons on Wed Apr 17 2002.
39 | Copyright (c) 2002 Brent Simmons. All rights reserved.
40 | */
41 |
42 |
43 | #import
44 | #import
45 | #import "NSString+extras.h"
46 |
47 |
48 | @interface RSS : NSObject {
49 |
50 | NSDictionary *headerItems;
51 | NSMutableArray *newsItems;
52 | NSString *version;
53 |
54 | BOOL flRdf;
55 | BOOL normalize;
56 | }
57 |
58 |
59 | /*Public*/
60 |
61 | - (RSS *) initWithTitle: (NSString *) title andDescription: (NSString *) description;
62 |
63 | - (RSS *) initWithData: (NSData *) rssData normalize: (BOOL) fl;
64 |
65 | - (RSS *) initWithURL: (NSURL *) url normalize: (BOOL) fl;
66 | - (RSS *) initWithURL: (NSURL *) url normalize: (BOOL) fl userAgent:(NSString *)userAgent;
67 |
68 | - (NSDictionary *) headerItems;
69 |
70 | - (NSMutableArray *) newsItems;
71 |
72 | - (NSString *) version;
73 |
74 | // AMM's extensions for Sparkle
75 | - (NSDictionary *)newestItem;
76 |
77 |
78 | /*Private*/
79 |
80 | - (void) createheaderdictionary: (CFXMLTreeRef) tree;
81 |
82 | - (void) createitemsarray: (CFXMLTreeRef) tree;
83 |
84 | - (void) setversionstring: (CFXMLTreeRef) tree;
85 |
86 | - (void) flattenimagechildren: (CFXMLTreeRef) tree into: (NSMutableDictionary *) dictionary;
87 |
88 | - (void) flattensourceattributes: (CFXMLNodeRef) node into: (NSMutableDictionary *) dictionary;
89 |
90 | - (CFXMLTreeRef) getchanneltree: (CFXMLTreeRef) tree;
91 |
92 | - (CFXMLTreeRef) getnamedtree: (CFXMLTreeRef) currentTree name: (NSString *) name;
93 |
94 | - (void) normalizeRSSItem: (NSMutableDictionary *) rssItem;
95 |
96 | - (NSString *) getelementvalue: (CFXMLTreeRef) tree;
97 |
98 | @end
99 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUAppcast.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUAppcast.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/12/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class RSS, SUAppcastItem;
12 | @interface SUAppcast : NSObject {
13 | NSArray *items;
14 | id delegate;
15 | }
16 |
17 | - (void)fetchAppcastFromURL:(NSURL *)url;
18 | - (void)setDelegate:delegate;
19 |
20 | - (SUAppcastItem *)newestItem;
21 | - (NSArray *)items;
22 |
23 | @end
24 |
25 | @interface NSObject (SUAppcastDelegate)
26 | - appcastDidFinishLoading:(SUAppcast *)appcast;
27 | @end
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUAppcastItem.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/12/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface SUAppcastItem : NSObject {
13 | NSString *title;
14 | NSDate *date;
15 | NSString *description;
16 |
17 | NSURL *releaseNotesURL;
18 |
19 | NSString *DSASignature;
20 | NSString *MD5Sum;
21 |
22 | NSURL *fileURL;
23 | NSString *fileVersion;
24 | NSString *versionString;
25 | }
26 |
27 | // Initializes with data from a dictionary provided by the RSS class.
28 | - initWithDictionary:(NSDictionary *)dict;
29 |
30 | - (NSString *)title;
31 | - (void)setTitle:(NSString *)aTitle;
32 |
33 | - (NSDate *)date;
34 | - (void)setDate:(NSDate *)aDate;
35 |
36 | - (NSString *)description;
37 | - (void)setDescription:(NSString *)aDescription;
38 |
39 | - (NSURL *)releaseNotesURL;
40 | - (void)setReleaseNotesURL:(NSURL *)aReleaseNotesURL;
41 |
42 | - (NSString *)DSASignature;
43 | - (void)setDSASignature:(NSString *)aDSASignature;
44 |
45 | - (NSString *)MD5Sum;
46 | - (void)setMD5Sum:(NSString *)aMd5Sum;
47 |
48 | - (NSURL *)fileURL;
49 | - (void)setFileURL:(NSURL *)aFileURL;
50 |
51 | - (NSString *)fileVersion;
52 | - (void)setFileVersion:(NSString *)aFileVersion;
53 |
54 | - (NSString *)versionString;
55 | - (void)setVersionString:(NSString *)versionString;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUAutomaticUpdateAlert.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/18/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class SUAppcastItem;
12 | @interface SUAutomaticUpdateAlert : NSWindowController {
13 | SUAppcastItem *updateItem;
14 | }
15 |
16 | - initWithAppcastItem:(SUAppcastItem *)item;
17 |
18 | - (IBAction)relaunchNow:sender;
19 | - (IBAction)relaunchLater:sender;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUConstants.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUConstants.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/16/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | extern NSString *SUUpdaterWillRestartNotification;
10 |
11 | extern NSString *SUCheckAtStartupKey;
12 | extern NSString *SUFeedURLKey;
13 | extern NSString *SUShowReleaseNotesKey;
14 | extern NSString *SUSkippedVersionKey;
15 | extern NSString *SUScheduledCheckIntervalKey;
16 | extern NSString *SULastCheckTimeKey;
17 | extern NSString *SUExpectsDSASignatureKey;
18 | extern NSString *SUPublicDSAKeyKey;
19 | extern NSString *SUAutomaticallyUpdateKey;
20 | extern NSString *SUAllowsAutomaticUpdatesKey;
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUStatusChecker.h
3 | // Sparkle
4 | //
5 | // Created by Evan Schoenberg on 7/6/06.
6 | //
7 |
8 | #import
9 | #import
10 |
11 | @class SUStatusChecker;
12 |
13 | @protocol SUStatusCheckerDelegate
14 | //versionString will be nil and isNewVersion will be NO if version checking fails.
15 | - (void)statusChecker:(SUStatusChecker *)statusChecker foundVersion:(NSString *)versionString isNewVersion:(BOOL)isNewVersion;
16 | @end
17 |
18 | @interface SUStatusChecker : SUUpdater {
19 | id scDelegate;
20 | }
21 |
22 | // Create a status checker which will notifiy delegate once the appcast version is determined.
23 | // Notification occurs via the method defined in the SUStatusCheckerDelegate informal protocol.
24 | + (SUStatusChecker *)statusCheckerForDelegate:(id)delegate;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUStatusController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUStatusController.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/14/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface SUStatusController : NSWindowController {
13 | double progressValue, maxProgressValue;
14 | NSString *title, *statusText, *buttonTitle;
15 | IBOutlet NSButton *actionButton;
16 | }
17 |
18 | // Pass 0 for the max progress value to get an indeterminate progress bar.
19 | // Pass nil for the status text to not show it.
20 | - (void)beginActionWithTitle:(NSString *)title maxProgressValue:(double)maxProgressValue statusText:(NSString *)statusText;
21 |
22 | // If isDefault is YES, the button's key equivalent will be \r.
23 | - (void)setButtonTitle:(NSString *)buttonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault;
24 | - (void)setButtonEnabled:(BOOL)enabled;
25 |
26 | - (double)progressValue;
27 | - (void)setProgressValue:(double)value;
28 | - (double)maxProgressValue;
29 | - (void)setMaxProgressValue:(double)value;
30 |
31 | - (void)setStatusText:(NSString *)statusText;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUUnarchiver.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/16/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface SUUnarchiver : NSObject {
13 | id delegate;
14 | }
15 |
16 | - (void)unarchivePath:(NSString *)path;
17 | - (void)setDelegate:delegate;
18 |
19 | @end
20 |
21 | @interface NSObject (SUUnarchiverDelegate)
22 | - (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(long)length;
23 | - (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver;
24 | - (void)unarchiverDidFail:(SUUnarchiver *)unarchiver;
25 | @end
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUUpdateAlert.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/12/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef enum
12 | {
13 | SUInstallUpdateChoice,
14 | SURemindMeLaterChoice,
15 | SUSkipThisVersionChoice
16 | } SUUpdateAlertChoice;
17 |
18 | @class WebView, SUAppcastItem;
19 | @interface SUUpdateAlert : NSWindowController {
20 | SUAppcastItem *updateItem;
21 | id delegate;
22 |
23 | IBOutlet WebView *releaseNotesView;
24 | IBOutlet NSTextField *description;
25 | NSProgressIndicator *releaseNotesSpinner;
26 | BOOL webViewFinishedLoading;
27 | }
28 |
29 | - initWithAppcastItem:(SUAppcastItem *)item;
30 | - (void)setDelegate:delegate;
31 |
32 | - (IBAction)installUpdate:sender;
33 | - (IBAction)skipThisVersion:sender;
34 | - (IBAction)remindMeLater:sender;
35 |
36 | @end
37 |
38 | @interface NSObject (SUUpdateAlertDelegate)
39 | - (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice;
40 | @end
41 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUUpdater.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUUpdater.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 1/4/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // Before you use Sparkle in your app, you must set SUFeedURL in Info.plist to the
12 | // address of the appcast on your webserver. If you don't already have an
13 | // appcast, please see the Sparkle documentation to learn about how to set one up.
14 |
15 | // .zip, .dmg, .tar, .tbz, .tgz archives are supported at this time.
16 |
17 | // By default, Sparkle offers to show the user the release notes of the build they'll be
18 | // getting, which it assumes are in the description (or body) field of the relevant RSS item.
19 | // Set SUShowReleaseNotes to in Info.plist to hide the button.
20 |
21 | @class SUAppcastItem, SUUpdateAlert, SUStatusController;
22 | @interface SUUpdater : NSObject {
23 | SUAppcastItem *updateItem;
24 |
25 | SUStatusController *statusController;
26 | SUUpdateAlert *updateAlert;
27 |
28 | NSURLDownload *downloader;
29 | NSString *downloadPath;
30 |
31 | NSTimer *checkTimer;
32 | NSTimeInterval checkInterval;
33 |
34 | BOOL verbose;
35 | BOOL updateInProgress;
36 | }
37 |
38 | // This IBAction is meant for a main menu item. Hook up any menu item to this action,
39 | // and Sparkle will check for updates and report back its findings verbosely.
40 | - (IBAction)checkForUpdates:sender;
41 |
42 | // This method is similar to the above, but it's intended for updates initiated by
43 | // the computer instead of by the user. It does not alert the user when he is up to date,
44 | // and it remains silent about network errors in fetching the feed. This is what you
45 | // want to call to update programmatically; only use checkForUpdates: with buttons and menu items.
46 | - (void)checkForUpdatesInBackground;
47 |
48 | // This method allows you to schedule a check to run every time interval. You can
49 | // pass 0 to this method to cancel a previously scheduled timer. You probably don't want
50 | // to call this directly: if you set a SUScheduledCheckInterval key in Info.plist or
51 | // the user defaults, Sparkle will set this up for you automatically on startup. You might
52 | // just want to call this every time the user changes the setting in the preferences.
53 | - (void)scheduleCheckWithInterval:(NSTimeInterval)interval;
54 |
55 | @end
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/SUUtilities.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUUtilities.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/12/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | id SUInfoValueForKey(NSString *key);
12 | NSString *SUHostAppName();
13 | NSString *SUHostAppDisplayName();
14 | NSString *SUHostAppVersion();
15 | NSString *SUHostAppVersionString();
16 |
17 | NSComparisonResult SUStandardVersionComparison(NSString * versionA, NSString * versionB);
18 |
19 | // If running make localizable-strings for genstrings, ignore the error on this line.
20 | NSString *SULocalizedString(NSString *key, NSString *comment);
21 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Headers/Sparkle.h:
--------------------------------------------------------------------------------
1 | //
2 | // Sparkle.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/16/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #import "SUUpdater.h"
10 | #import "SUUtilities.h"
11 | #import "SUConstants.h"
12 | #import "SUAppcast.h"
13 | #import "SUAppcastItem.h"
14 | #import "SUUpdateAlert.h"
15 | #import "SUAutomaticUpdateAlert.h"
16 | #import "SUStatusController.h"
17 | #import "SUUnarchiver.h"
18 | #import "SUStatusChecker.h"
19 |
20 | #import "NSApplication+AppCopies.h"
21 | #import "NSFileManager+Authentication.h"
22 | #import "NSFileManager+Verification.h"
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | Sparkle
9 | CFBundleIdentifier
10 | org.andymatuschak.Sparkle
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | Sparkle
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1.1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib:
--------------------------------------------------------------------------------
1 | {
2 | IBClasses = (
3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
4 | {
5 | CLASS = SUStatusController;
6 | LANGUAGE = ObjC;
7 | OUTLETS = {actionButton = id; };
8 | SUPERCLASS = NSWindowController;
9 | }
10 | );
11 | IBVersion = 1;
12 | }
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBDocumentLocation
6 | 69 10 356 240 0 0 1280 832
7 | IBFramework Version
8 | 443.0
9 | IBOpenObjects
10 |
11 | 5
12 |
13 | IBSystem Version
14 | 8H14
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 | {
2 | IBClasses = (
3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
4 | {
5 | ACTIONS = {relaunchLater = id; relaunchNow = id; };
6 | CLASS = SUAutomaticUpdateAlert;
7 | LANGUAGE = ObjC;
8 | SUPERCLASS = NSWindowController;
9 | }
10 | );
11 | IBVersion = 1;
12 | }
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBDocumentLocation
6 | 188 142 356 240 0 0 1280 1002
7 | IBFramework Version
8 | 443.0
9 | IBOpenObjects
10 |
11 | 5
12 |
13 | IBSystem Version
14 | 8H14
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 | {
2 | IBClasses = (
3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
4 | {CLASS = NSObject; LANGUAGE = ObjC; },
5 | {
6 | ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; };
7 | CLASS = SUUpdateAlert;
8 | LANGUAGE = ObjC;
9 | OUTLETS = {description = NSTextField; releaseNotesView = WebView; };
10 | SUPERCLASS = NSWindowController;
11 | },
12 | {
13 | ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; };
14 | CLASS = SUUpdateAlertController;
15 | LANGUAGE = ObjC;
16 | OUTLETS = {releaseNotesView = id; };
17 | SUPERCLASS = NSWindowController;
18 | }
19 | );
20 | IBVersion = 1;
21 | }
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBDocumentLocation
6 | 425 40 356 240 0 0 1280 832
7 | IBFramework Version
8 | 446.1
9 | IBOpenObjects
10 |
11 | 5
12 |
13 | IBSystem Version
14 | 8I127
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/A/Sparkle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/Sparkle.framework/Versions/A/Sparkle
--------------------------------------------------------------------------------
/sfCubed/Sparkle.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/sfCubed/SyncFilters.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import
24 |
25 | @interface BaseSyncFilter : NSObject {
26 | }
27 | @end
28 |
29 | @interface EmailSyncFilter : BaseSyncFilter {
30 | }
31 | @end
32 |
33 | @interface PhoneSyncFilter : BaseSyncFilter {
34 | NSArray * phoneTypes;
35 | }
36 | @end
37 |
38 | @interface AddressSyncFilter : BaseSyncFilter {
39 | }
40 | @end
41 |
42 | @interface CompanySyncFilter : BaseSyncFilter {
43 | }
44 | @end
45 |
46 | @interface CalendarSyncFilter : BaseSyncFilter {
47 | }
48 | @end
49 |
50 | @interface CalendarChildSyncFilter : BaseSyncFilter {
51 | NSString *calendarId;
52 | NSString *entity;
53 | }
54 | -(id)initWithEntity:(NSString *)entity calendar:(NSString *)calId;
55 | @end
--------------------------------------------------------------------------------
/sfCubed/SyncOptions.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008-2010 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 | // This is used to create a snap-shot of the current users preferences
25 | // at the start of the sync, so that during the sync run we consistently
26 | // see what's configured, even if the user trys and changes it while there's
27 | // a sync in progress.
28 |
29 | @interface SyncOptions : NSObject {
30 | BOOL syncContacts;
31 | BOOL limitContactSyncToOwner;
32 | BOOL syncEvents;
33 | BOOL limitEventSyncToOwner;
34 | BOOL syncTasks;
35 | BOOL limitTaskSyncToOwner;
36 | int protectSfdcLimit;
37 | BOOL autoJoinSync;
38 | BOOL oneWaySync;
39 | }
40 |
41 | -(id)initFromUserDefaults;
42 |
43 | @property (readonly) BOOL syncContacts;
44 | @property (readonly) BOOL limitContactSyncToOwner;
45 |
46 | @property (readonly) BOOL syncEvents;
47 | @property (readonly) BOOL limitEventSyncToOwner;
48 |
49 | @property (readonly) BOOL syncTasks;
50 | @property (readonly) BOOL limitTaskSyncToOwner;
51 |
52 | @property (readonly) BOOL autoJoinSync;
53 | @property (readonly) BOOL oneWaySync;
54 |
55 | -(BOOL)shouldShowUserWarningOnSfdcChanges:(int)totalChanges;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/sfCubed/SyncOptions.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008-2010 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import "SyncOptions.h"
24 | #import "Constants.h"
25 |
26 | @implementation SyncOptions
27 |
28 | @synthesize syncContacts, limitContactSyncToOwner, syncEvents, limitEventSyncToOwner, syncTasks, limitTaskSyncToOwner, autoJoinSync, oneWaySync;
29 |
30 | -(id)initFromUserDefaults {
31 | self = [super init];
32 | NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
33 | syncContacts = [ud boolForKey:PREF_SYNC_CONTACTS];
34 | limitContactSyncToOwner = [ud boolForKey:PREF_MY_CONTACTS];
35 | syncEvents = [ud boolForKey:PREF_SYNC_EVENTS];
36 | limitEventSyncToOwner = [ud boolForKey:PREF_MY_EVENTS];
37 | syncTasks = [ud boolForKey:PREF_SYNC_TASKS];
38 | limitTaskSyncToOwner = [ud boolForKey:PREF_MY_TASKS];
39 | protectSfdcLimit = [ud boolForKey:PREF_ENABLE_PROTECT_SFDC] ? [ud integerForKey:PREF_PROTECT_SFDC_LIMIT] : -1;
40 | autoJoinSync = [ud boolForKey:PREF_AUTO_JOIN_SYNC];
41 | oneWaySync = [ud boolForKey:PREF_ONE_WAY_SYNC];
42 | return self;
43 | }
44 |
45 | -(BOOL)shouldShowUserWarningOnSfdcChanges:(int)totalChanges {
46 | return (protectSfdcLimit >= 0) && (totalChanges > protectSfdcLimit);
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/sfCubed/SyncRunner.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2010 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 |
25 | @class ZKSforceClient;
26 | @class ISyncSession;
27 | @class Mappers;
28 | @class SyncOptions;
29 |
30 | // SyncRunner is the main driving class for performing a single sync session
31 | // it handles interacting with Sync Services, and handing things off to the
32 | // mappers, setting up the options based on the set preferences and so on.
33 |
34 | @interface SyncRunner : NSObject {
35 | ZKSforceClient *sforce;
36 | ISyncSession *session;
37 | Mappers *mappers;
38 |
39 | NSString *status;
40 | NSString *status2;
41 | double progress;
42 | SyncOptions *options;
43 | }
44 |
45 | +(ISyncClient *)syncClient;
46 |
47 | -(id)initWithSforceSession:(ZKSforceClient *)sfclient;
48 | -(BOOL)performSync:(SyncOptions *)options;
49 |
50 | -(NSString *)status;
51 | -(NSString *)status2;
52 | -(double)progress;
53 | @end
54 |
--------------------------------------------------------------------------------
/sfCubed/TaskFieldMappingInfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "FieldMappingInfo.h"
24 | #import "zkSforceClient.h"
25 |
26 | // CompletionDate mapper, completion date on apple side, IsClosed/Status on sfdc side
27 | @interface CompletionDateFieldMapingInfo : FieldMappingInfo {
28 | NSMutableDictionary *dates;
29 | NSString *sfdcWriteName;
30 | NSArray *taskStatus;
31 | }
32 | - (id) initWithInfo:(NSString *)syncName sfdcReadName:(NSString *)sfdcRead sfdcWriteName:(NSString *)sfdcWrite sforce:(ZKSforceClient *)sf;
33 |
34 | - (NSString *)datesFilename;
35 | - (void)save;
36 | - (NSString *)completedStatus;
37 | - (NSString *)notStartedStatus;
38 | @end
39 |
40 | // priority field mapping
41 | @interface PriorityFieldMappingInfo : FieldMappingInfo {
42 | NSArray *priority;
43 | }
44 | - (id) initWithInfo:(NSString *)syncName sfdcName:(NSString *)sfdc sforce:(ZKSforceClient *)sforce;
45 | - (NSString *)defaultPriority;
46 | - (NSString *)priorityFromFlag:(NSString *)flagField;
47 | - (int)appleValueFromSfdcValue:(NSString *)sfdcValue;
48 |
49 | @end
50 |
51 |
--------------------------------------------------------------------------------
/sfCubed/TaskMapper.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "ActivityMapper.h"
24 |
25 | // Tasks/Todo mapper
26 |
27 | @interface TaskMapper : ActivityMapper {
28 | }
29 |
30 | - (id)initMapper:(ZKSforceClient *)sf options:(SyncOptions *)options;
31 |
32 | @end
33 |
34 |
35 |
--------------------------------------------------------------------------------
/sfCubed/deleteAccumulator.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import
24 | #import "zkSforceClient.h"
25 | #import "zkSObject.h"
26 |
27 | @interface DeleteAccumulator : NSObject {
28 | NSMutableArray *deletes;
29 | ISyncSession *session;
30 | ZKSforceClient *sforce;
31 | }
32 |
33 | - (id)initWithSession:(ISyncSession *)session sforce:(ZKSforceClient *)sforce;
34 |
35 | - (void)enqueueDelete:(NSString *)sfId;
36 | - (int)count;
37 | - (void)performDeletes;
38 | @end
39 |
40 |
--------------------------------------------------------------------------------
/sfCubed/deleteAccumulator.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 | #import "deleteAccumulator.h"
22 | #import "zkSaveResult.h"
23 | #import "AccItem.h"
24 |
25 | static const int MAX_IN_ONE_BATCH = 50;
26 |
27 | @implementation DeleteAccumulator
28 |
29 | - (id)initWithSession:(ISyncSession *)ss sforce:(ZKSforceClient *)sf
30 | {
31 | self = [super init];
32 | session = [ss retain];
33 | sforce = [sf retain];
34 | deletes = [[NSMutableArray alloc] init];
35 | return self;
36 | }
37 |
38 | -(void)dealloc {
39 | [deletes release];
40 | [session release];
41 | [sforce release];
42 | [super dealloc];
43 | }
44 |
45 | - (void)enqueueDelete:(NSString *)sfId {
46 | [deletes addObject:sfId];
47 | }
48 |
49 | - (int)count {
50 | return [deletes count];
51 | }
52 |
53 | - (void)doDeletes:(NSArray *)idsToDelete {
54 | NSArray * results = [sforce delete:idsToDelete];
55 | UInt32 i;
56 | for (i = 0; i < [results count]; i++) {
57 | ZKSaveResult * sr = [results objectAtIndex:i];
58 | if ([sr success] || [[sr statusCode] isEqualToString:@"ENTITY_IS_DELETED"]) {
59 | // either the delete was succesful, or we've already deleted the item in salesforce, eitherway we can accept this one.
60 | [session clientAcceptedChangesForRecordWithIdentifier:[idsToDelete objectAtIndex:i] formattedRecord:nil newRecordIdentifier:nil];
61 | } else {
62 | NSLog(@"Error deleting :%@ -> %@", [deletes objectAtIndex:i], sr);
63 | }
64 | }
65 | [session clientCommittedAcceptedChanges];
66 | }
67 |
68 | - (void)performDeletes {
69 | if ([deletes count] == 0) return;
70 | NSLog(@"DeleteAccumulator about to remove %d items", [deletes count]);
71 | while ([deletes count] > 0) {
72 | if ([deletes count] <= MAX_IN_ONE_BATCH) {
73 | [self doDeletes:deletes];
74 | [deletes removeAllObjects];
75 | } else {
76 | NSRange rng = NSMakeRange(0, MAX_IN_ONE_BATCH);
77 | [self doDeletes:[deletes subarrayWithRange:rng]];
78 | [deletes removeObjectsInRange:rng];
79 | }
80 | }
81 | }
82 |
83 | @end
84 |
85 |
--------------------------------------------------------------------------------
/sfCubed/main.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 | int main(int argc, char *argv[])
25 | {
26 | return NSApplicationMain(argc, (const char **) argv);
27 | }
28 |
--------------------------------------------------------------------------------
/sfCubed/protect.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | FirstResponder
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSObject
14 |
15 |
16 | CLASS
17 | CenteredTextFieldCell
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSTextFieldCell
22 |
23 |
24 | ACTIONS
25 |
26 | cancelSync
27 | id
28 | continueSync
29 | id
30 |
31 | CLASS
32 | ProtectController
33 | LANGUAGE
34 | ObjC
35 | OUTLETS
36 |
37 | table
38 | NSTableView
39 | window
40 | NSWindow
41 |
42 | SUPERCLASS
43 | NSObject
44 |
45 |
46 | IBVersion
47 | 1
48 |
49 |
50 |
--------------------------------------------------------------------------------
/sfCubed/protect.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 629
7 | IBLastKnownRelativeProjectPath
8 | ../sfCubed.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 5
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sfCubed/protect.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/protect.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/sfCubed/sf.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/sf.icns
--------------------------------------------------------------------------------
/sfCubed/sf3_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/sf3_64.png
--------------------------------------------------------------------------------
/sfCubed/sf3_64b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/superfell/sf3/9f3584e9eae9218d0086d2061cafaff6bcbe83d8/sfCubed/sf3_64b.png
--------------------------------------------------------------------------------
/sfCubed/sfCubed_Prefix.pch:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #ifdef __OBJC__
23 | #import
24 | #import
25 | #endif
26 |
--------------------------------------------------------------------------------
/sforce/ZKPartnerEnvelope.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "ZKEnvelope.h"
24 |
25 | @interface ZKPartnerEnvelope : ZKEnvelope {
26 | }
27 |
28 | - (id)initWithSessionHeader:(NSString *)sessionId clientId:(NSString *)clientId;
29 | - (id)initWithSessionAndMruHeaders:(NSString *)sessionId mru:(BOOL)mru clientId:(NSString *)clientId;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/sforce/ZKPartnerEnvelope.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "ZKPartnerEnvelope.h"
23 |
24 | @implementation ZKPartnerEnvelope
25 |
26 | - (id)initWithSessionHeader:(NSString *)sessionId clientId:(NSString *)clientId {
27 | return [self initWithSessionAndMruHeaders:sessionId mru:NO clientId:clientId];
28 | }
29 |
30 | - (id)initWithSessionAndMruHeaders:(NSString *)sessionId mru:(BOOL)mru clientId:(NSString *)clientId {
31 | self = [super init];
32 | [self start:@"urn:partner.soap.sforce.com"];
33 | [self writeSessionHeader:sessionId];
34 | [self writeCallOptionsHeader:clientId];
35 | [self writeMruHeader:mru];
36 | [self moveToBody];
37 | return self;
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/sforce/ZKPicklistEntry.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkXmlDeserializer.h"
25 |
26 | //
27 | //
28 | //
29 | //
30 | //
31 | //
32 | //
33 | //
34 | //
35 |
36 | @interface ZKPicklistEntry : ZKXmlDeserializer {
37 | }
38 | - (BOOL)active;
39 | - (BOOL)defaultValue;
40 | - (NSString *)label;
41 | - (NSString *)validFor;
42 | - (NSString *)value;
43 | @end
44 |
--------------------------------------------------------------------------------
/sforce/ZKPicklistEntry.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "ZKPicklistEntry.h"
23 |
24 | @implementation ZKPicklistEntry
25 | - (BOOL)active {
26 | return [self boolean:@"active"];
27 | }
28 | - (BOOL)defaultValue {
29 | return [self boolean:@"defaultValue"];
30 | }
31 | - (NSString *)label {
32 | return [self string:@"label"];
33 | }
34 | - (NSString *)validFor {
35 | return [self string:@"validFor"];
36 | }
37 | - (NSString *)value {
38 | return [self string:@"value"];
39 | }
40 | @end
41 |
--------------------------------------------------------------------------------
/sforce/ZKRecordTypeInfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkXmlDeserializer.h"
25 |
26 | //
27 | //
28 | //
29 | //
30 | //
31 | //
32 | //
33 | //
34 |
35 | @interface ZKRecordTypeInfo : ZKXmlDeserializer {
36 | }
37 | - (BOOL)available;
38 | - (BOOL)defaultRecordTypeMapping;
39 | - (NSString *)name;
40 | - (NSString *)recordTypeId;
41 | @end
42 |
--------------------------------------------------------------------------------
/sforce/ZKRecordTypeInfo.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2007 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "ZKRecordTypeInfo.h"
23 |
24 |
25 | @implementation ZKRecordTypeInfo
26 |
27 | - (BOOL)available {
28 | return [self boolean:@"available"];
29 | }
30 | - (BOOL)defaultRecordTypeMapping {
31 | return [self boolean:@"defaultRecordTypeMapping"];
32 | }
33 | - (NSString *)name {
34 | return [self string:@"name"];
35 | }
36 | - (NSString *)recordTypeId {
37 | return [self string:@"recordTypeId"];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/sforce/zkBaseClient.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 |
25 |
26 | @interface ZKBaseClient : NSObject {
27 | NSString *endpointUrl;
28 | }
29 |
30 | - (NSXMLNode *)sendRequest:(NSString *)payload;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/sforce/zkBaseClient.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006-2008 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "zkBaseClient.h"
23 | #import "zkSoapException.h"
24 |
25 | @implementation ZKBaseClient
26 |
27 | - (void)dealloc {
28 | [endpointUrl release];
29 | [super dealloc];
30 | }
31 |
32 | - (NSXMLNode *)sendRequest:(NSString *)payload {
33 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:endpointUrl]];
34 | [request setHTTPMethod:@"POST"];
35 | [request addValue:@"text/xml; charset=UTF-8" forHTTPHeaderField:@"content-type"];
36 | [request addValue:@"\"\"" forHTTPHeaderField:@"SOAPAction"];
37 |
38 | NSData *data = [payload dataUsingEncoding:NSUTF8StringEncoding];
39 | [request setHTTPBody:data];
40 |
41 | NSHTTPURLResponse *resp = nil;
42 | NSError *err = nil;
43 | // todo, support request compression
44 | // todo, support response compression
45 | NSData *respPayload = [NSURLConnection sendSynchronousRequest:request returningResponse:&resp error:&err];
46 | NSXMLDocument *doc = [[[NSXMLDocument alloc] initWithData:respPayload options:NSXMLNodeOptionsNone error:&err] autorelease];
47 | if (err != NULL) {
48 | @throw [NSException exceptionWithName:@"Xml error" reason:@"Unable to parse XML returned by server" userInfo:nil];
49 | }
50 | if (500 == [resp statusCode]) {
51 | NSXMLNode * nFaultCode = [[doc nodesForXPath:@"/soapenv:Envelope/soapenv:Body/soapenv:Fault/faultcode" error:&err] objectAtIndex:0];
52 | NSXMLNode * nFaultMsg = [[doc nodesForXPath:@"/soapenv:Envelope/soapenv:Body/soapenv:Fault/faultstring" error:&err] objectAtIndex:0];
53 | ZKSoapException *exception = [ZKSoapException exceptionWithFaultCode:[nFaultCode stringValue] faultString:[nFaultMsg stringValue]];
54 | @throw exception;
55 | }
56 | NSXMLNode *body = [[doc nodesForXPath:@"/soapenv:Envelope/soapenv:Body" error:&err] objectAtIndex:0];
57 | return [[body children] objectAtIndex:0];
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/sforce/zkChildRelationship.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "zkXmlDeserializer.h"
24 |
25 | //
26 | //
27 | //
28 | //
29 | //
30 | //
31 | //
32 | //
33 |
34 | @interface ZKChildRelationship : ZKXmlDeserializer {
35 | }
36 |
37 | -(BOOL)cascadeDelete;
38 | -(NSString *)childSObject;
39 | -(NSString *)field;
40 | -(NSString *)relationshipName;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/sforce/zkChildRelationship.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import "zkChildRelationship.h"
24 |
25 | @implementation ZKChildRelationship
26 |
27 | -(BOOL)cascadeDelete {
28 | return [self boolean:@"cascadeDelete"];
29 | }
30 |
31 | -(NSString *)childSObject {
32 | return [self string:@"childSObject"];
33 | }
34 |
35 | -(NSString *)field {
36 | return [self string:@"field"];
37 | }
38 |
39 | -(NSString *)relationshipName {
40 | return [self string:@"relationshipName"];
41 | }
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/sforce/zkDescribeField.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkXmlDeserializer.h"
25 |
26 | /*
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | */
61 |
62 | @class ZKDescribeSObject;
63 |
64 | @interface ZKDescribeField : ZKXmlDeserializer {
65 | NSArray *picklistValues;
66 | ZKDescribeSObject *sobject;
67 | }
68 | - (void)setSobject:(ZKDescribeSObject *)s;
69 | - (ZKDescribeSObject *)sobject;
70 |
71 | // Api v7.0
72 | - (BOOL)autoNumber;
73 | - (int)byteLength;
74 | - (BOOL)calculated;
75 | - (NSString *)controllerName;
76 | - (BOOL)createable;
77 | - (BOOL)custom;
78 | - (BOOL)defaultOnCreate;
79 | - (BOOL)dependentPicklist;
80 | - (int)digits;
81 | - (BOOL)externalId;
82 | - (BOOL)filterable;
83 | - (BOOL)htmlFormatted;
84 | - (NSString *)label;
85 | - (int)length;
86 | - (NSString *)name;
87 | - (BOOL)nameField;
88 | - (BOOL)nillable;
89 | - (NSArray *)picklistValues;
90 | - (int)precision;
91 | - (NSArray *)referenceTo;
92 | - (NSString *)relationshipName;
93 | - (BOOL)restrictedPicklist;
94 | - (int)scale;
95 | - (NSString *)soapType;
96 | - (NSString *)type;
97 | - (BOOL)updateable;
98 | // Api v8.0
99 | - (NSString *)calculatedFormula;
100 | - (BOOL)caseSensitive;
101 | - (NSString *)defaultValueFormula;
102 | - (BOOL)namePointing;
103 | - (BOOL)sortable;
104 | - (BOOL)unique;
105 | // Api v11.1
106 | - (BOOL)idLookup;
107 |
108 | @end
109 |
--------------------------------------------------------------------------------
/sforce/zkDescribeSObject.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "zkXmlDeserializer.h"
24 | #import "zkDescribeField.h"
25 |
26 | /*
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | */
51 |
52 | @interface ZKDescribeSObject : ZKXmlDeserializer {
53 | NSArray *fields;
54 | NSDictionary *fieldsByName;
55 | NSArray *childRelationships;
56 | NSArray *recordTypeInfos;
57 | }
58 |
59 | -(BOOL)activateable;
60 | -(BOOL)createable;
61 | -(BOOL)custom;
62 | -(BOOL)deletable;
63 | -(BOOL)layoutable;
64 | -(BOOL)mergeable;
65 | -(BOOL)queryable;
66 | -(BOOL)replicateable;
67 | -(BOOL)retrieveable;
68 | -(BOOL)searchable;
69 | -(BOOL)triggerable;
70 | -(BOOL)undeleteable;
71 | -(BOOL)updateable;
72 | -(NSString *)keyPrefix;
73 | -(NSString *)label;
74 | -(NSString *)labelPlural;
75 | -(NSString *)name;
76 | -(NSString *)urlDetail;
77 | -(NSString *)urlEdit;
78 | -(NSString *)urlNew;
79 | -(NSArray *)fields;
80 | -(ZKDescribeField *)fieldWithName:(NSString *)name;
81 | -(NSArray *)childRelationships;
82 | -(NSArray *)recordTypeInfos;
83 | @end
84 |
--------------------------------------------------------------------------------
/sforce/zkEnvelope.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkSObject.h"
25 |
26 | @interface ZKEnvelope : NSObject {
27 | NSMutableString *env;
28 | int state;
29 | }
30 |
31 | - (void)start:(NSString *)primaryNamespceUri;
32 | - (void)writeSessionHeader:(NSString *)sessionId;
33 | - (void)writeCallOptionsHeader:(NSString *)callOptions;
34 | - (void)writeMruHeader:(BOOL)updateMru;
35 |
36 | - (void) moveToBody;
37 | - (void) startElement:(NSString *)elemName;
38 | - (void) endElement:(NSString *)elemName;
39 | - (void) writeText:(NSString *)text;
40 | - (void) addElement:(NSString *)elemName elemValue:(id)elemValue;
41 | - (NSString *)end;
42 |
43 | - (void) addElementArray:(NSString *)elemName elemValue:(NSArray *)elemValues;
44 | - (void) addElementSObject:(NSString *)elemName elemValue:(ZKSObject *)sobject;
45 | - (void) addElementString:(NSString *)elemName elemValue:(NSString *)elemValue;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/sforce/zkQueryResult.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 | @interface ZKQueryResult : NSObject {
25 | int size;
26 | BOOL done;
27 | NSString * queryLocator;
28 | NSArray * records;
29 | }
30 |
31 | - (id)initFromXmlNode:(NSXMLNode *)node;
32 | - (id)initWithRecords:(NSArray *)records size:(int)s done:(BOOL)d queryLocator:(NSString *)ql;
33 |
34 | - (int)size;
35 | - (BOOL)done;
36 | - (NSString *)queryLocator;
37 | - (NSArray *)records;
38 |
39 | // make it compaitble with the data source for a table
40 | - (int)numberOfRowsInTableView:(NSTableView *)v;
41 | - (id)tableView:(NSTableView *)view objectValueForTableColumn:(NSTableColumn *)tc row:(int)rowIdx;
42 | @end
43 |
--------------------------------------------------------------------------------
/sforce/zkQueryResult.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import "zkQueryResult.h"
24 | #import "zkSObject.h"
25 |
26 | @implementation ZKQueryResult
27 |
28 | - (id)initFromXmlNode:(NSXMLNode *)node {
29 | self = [super init];
30 | int i = 0;
31 | NSError * err = NULL;
32 | size = [[[[node nodesForXPath:@"size" error:&err] objectAtIndex:0] stringValue] intValue];
33 | NSString * strDone = [[[node nodesForXPath:@"done" error:&err] objectAtIndex:0] stringValue];
34 | done = [strDone isEqualToString:@"true"];
35 | if (done == NO)
36 | queryLocator = [[[[node nodesForXPath:@"queryLocator" error:&err] objectAtIndex:0] stringValue] copy];
37 |
38 | NSArray * nodes = [node nodesForXPath:@"records" error:&err];
39 | NSMutableArray * recArray = [NSMutableArray arrayWithCapacity:[nodes count]];
40 | ZKSObject * o;
41 | for (i = 0; i < [nodes count]; i++)
42 | {
43 | NSXMLNode * n = [nodes objectAtIndex:i];
44 | o = [[ZKSObject alloc] initFromXmlNode:n];
45 | [recArray addObject:o];
46 | [o release];
47 | }
48 | records = [recArray retain];
49 | return self;
50 | }
51 |
52 | - (id)initWithRecords:(NSArray *)r size:(int)s done:(BOOL)d queryLocator:(NSString *)ql {
53 | self = [super init];
54 | records = [r retain];
55 | done = d;
56 | size = s;
57 | queryLocator = [ql retain];
58 | return self;
59 | }
60 |
61 | - (id)copyWithZone:(NSZone *)zone {
62 | return [[ZKQueryResult alloc] initWithRecords:records size:size done:done queryLocator:queryLocator];
63 | }
64 |
65 | - (void)dealloc {
66 | [queryLocator release];
67 | [records release];
68 | [super dealloc];
69 | }
70 |
71 | - (int)size {
72 | return size;
73 | }
74 |
75 | - (BOOL)done {
76 | return done;
77 | }
78 |
79 | - (NSString *)queryLocator {
80 | return queryLocator;
81 | }
82 |
83 | - (NSArray *)records {
84 | return records;
85 | }
86 |
87 | - (int)numberOfRowsInTableView:(NSTableView *)v {
88 | return [records count];
89 | }
90 |
91 | - (id)tableView:(NSTableView *)view objectValueForTableColumn:(NSTableColumn *)tc row:(int)rowIdx {
92 | NSArray *path = [[tc identifier] componentsSeparatedByString:@"."];
93 | id val = [records objectAtIndex:rowIdx];
94 | NSString *step;
95 | NSEnumerator *e = [path objectEnumerator];
96 | while (step = [e nextObject]) {
97 | val = [val fieldValue:step];
98 | }
99 | return val;
100 | }
101 |
102 | @end
103 |
--------------------------------------------------------------------------------
/sforce/zkSObject.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 | #import "zkQueryResult.h"
24 |
25 | @interface ZKSObject : NSObject {
26 | NSString *Id;
27 | NSString *type;
28 | NSMutableSet *fieldsToNull;
29 | NSMutableDictionary *fields;
30 | }
31 |
32 | + (id) withType:(NSString *)type;
33 | + (id) withTypeAndId:(NSString *)type sfId:(NSString *)sfId;
34 | + (id) fromXmlNode:(NSXMLNode *)node;
35 |
36 | - (id) initFromXmlNode:(NSXMLNode *)node;
37 | - (id) initWithType:(NSString *)type;
38 |
39 | // setters
40 | - (void)setId:(NSString *)theId;
41 | // setting a fieldValue to nil will automatically put it in the fieldsToNull collection
42 | // setting a fieldValue to non nil will automatically remove it from the fieldsToNull collection
43 | - (void)setFieldValue:(NSString *)value field:(NSString *)field;
44 | - (void)setFieldDateTimeValue:(NSDate *)value field:(NSString *)field;
45 | - (void)setFieldDateValue:(NSDate *)value field:(NSString *)field;
46 | - (void)setFieldToNull:(NSString *)field;
47 |
48 | // basic getters
49 | - (NSString *)id;
50 | - (NSString *)type;
51 | - (NSArray *)fieldsToNull;
52 | - (NSDictionary *)fields;
53 | - (id)fieldValue:(NSString *)field;
54 | - (BOOL)isFieldToNull:(NSString *)field;
55 |
56 | // typed getters
57 | - (BOOL)boolValue:(NSString *)field;
58 | - (NSCalendarDate *)dateTimeValue:(NSString *)field;
59 | - (NSCalendarDate *)dateValue:(NSString *)field;
60 | - (int)intValue:(NSString *)field;
61 | - (double)doubleValue:(NSString *)field;
62 | - (ZKQueryResult *)queryResultValue:(NSString *)field;
63 | @end
64 |
--------------------------------------------------------------------------------
/sforce/zkSaveResult.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkXmlDeserializer.h"
25 |
26 | @interface ZKSaveResult : ZKXmlDeserializer {
27 | }
28 |
29 | - (NSString *)id;
30 | - (BOOL)success;
31 | - (NSString *)statusCode;
32 | - (NSString *)message;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/sforce/zkSaveResult.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import "zkSaveResult.h"
24 |
25 | @implementation ZKSaveResult
26 |
27 | - (NSString *)id {
28 | return [self string:@"id"];
29 | }
30 |
31 | - (BOOL)success {
32 | return [self boolean:@"success"];
33 | }
34 |
35 | - (NSString *)statusCode {
36 | if ([self success]) return nil;
37 | return [self string:@"statusCode" fromXmlElement:[[node elementsForName:@"errors"] objectAtIndex:0]];
38 | }
39 |
40 | - (NSString *)message {
41 | if ([self success]) return nil;
42 | return [self string:@"message" fromXmlElement:[[node elementsForName:@"errors"] objectAtIndex:0]];
43 | }
44 |
45 | - (NSString *)description {
46 | if ([self success])
47 | return [self id];
48 | return [NSString stringWithFormat:@"%@ - %@", [self statusCode], [self message]];
49 | }
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/sforce/zkSforce.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | // this just imports everything else that's you'll need access to, to make
24 | // it easy to pull in everything you might need. you can use this, or just
25 | // import the bits you care about.
26 |
27 | #import "zkSforceClient.h"
28 | #import "zkUserInfo.h"
29 | #import "zkSObject.h"
30 | #import "zkSoapException.h"
31 | #import "zkSaveResult.h"
32 | #import "zkQueryResult.h"
33 | #import "zkDescribeSObject.h"
34 | #import "zkDescribeField.h"
35 |
--------------------------------------------------------------------------------
/sforce/zkSforceClient.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkBaseClient.h"
25 |
26 | @class ZKUserInfo;
27 | @class ZKDescribeSObject;
28 | @class ZKQueryResult;
29 |
30 | @interface ZKSforceClient : ZKBaseClient {
31 | NSString *authEndpointUrl;
32 | NSString *username;
33 | NSString *password;
34 | NSString *clientId;
35 | NSString *sessionId;
36 | NSDate *sessionExpiresAt;
37 | BOOL updateMru;
38 | ZKUserInfo *userInfo;
39 | BOOL cacheDescribes;
40 | NSMutableDictionary *describes;
41 | }
42 |
43 | // configuration
44 | - (void)setLoginProtocolAndHost:(NSString *)protocolAndHost;
45 | - (void)setLoginProtocolAndHost:(NSString *)protocolAndHost andVersion:(int)version;
46 |
47 | // all map directly to Sforce API calls
48 | - (void)login:(NSString *)username password:(NSString *)password;
49 | - (NSArray *)describeGlobal;
50 | - (ZKDescribeSObject *)describeSObject:(NSString *)sobjectName;
51 | - (NSArray *)search:(NSString *)sosl;
52 | - (ZKQueryResult *)query:(NSString *)soql;
53 | - (ZKQueryResult *)queryAll:(NSString *)soql;
54 | - (ZKQueryResult *)queryMore:(NSString *)queryLocator;
55 | - (NSDictionary *)retrieve:(NSString *)fields sobject:(NSString *)sobjectType ids:(NSArray *)ids;
56 | - (NSArray *)create:(NSArray *)objects;
57 | - (NSArray *)update:(NSArray *)objects;
58 | - (NSArray *)delete:(NSArray *)ids;
59 | - (NSString *)serverTimestamp;
60 |
61 | // status info
62 | - (BOOL)loggedIn;
63 | - (ZKUserInfo *)currentUserInfo;
64 | - (NSString *)serverUrl;
65 | - (NSString *)sessionId;
66 |
67 | // headers
68 | - (BOOL)updateMru;
69 | - (void)setUpdateMru:(BOOL)aValue;
70 | - (NSString *)clientId;
71 | - (void)setClientId:(NSString *)aClientId;
72 |
73 |
74 | // describe caching
75 | - (BOOL)cacheDescribes;
76 | - (void)setCacheDescribes:(BOOL)newCacheDescribes;
77 | - (void)flushCachedDescribes;
78 | @end
79 |
--------------------------------------------------------------------------------
/sforce/zkSoapException.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import
23 |
24 |
25 | @interface ZKSoapException : NSException {
26 | NSString * faultCode;
27 | }
28 |
29 | + (id) exceptionWithFaultCode:(NSString *)fc faultString:(NSString *)fs;
30 |
31 | - (NSString *)faultCode;
32 | - (void)setFaultCode:(NSString *)faultCode;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/sforce/zkSoapException.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import "zkSoapException.h"
24 |
25 |
26 | @implementation ZKSoapException
27 |
28 | + (id)exceptionWithFaultCode:(NSString *)fc faultString:(NSString *)fs {
29 | id ex = [ZKSoapException exceptionWithName:fc reason:fs userInfo:nil];
30 | [ex setFaultCode:fc];
31 | return ex;
32 | }
33 |
34 | - (void)dealloc {
35 | [faultCode release];
36 | [super dealloc];
37 | }
38 |
39 | - (NSString *)faultCode {
40 | return faultCode;
41 | }
42 |
43 | - (void)setFaultCode:(NSString *)fc {
44 | if (faultCode == fc) return;
45 | [faultCode release];
46 | faultCode = [fc retain];
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/sforce/zkUserInfo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 | #import "zkXmlDeserializer.h"
25 |
26 | @interface ZKUserInfo : ZKXmlDeserializer {
27 | }
28 |
29 | // API v7.0
30 | -(BOOL)accessibilityMode;
31 | -(NSString *)currencySymbol;
32 | -(NSString *)organizationId;
33 | -(NSString *)organizationName;
34 | -(BOOL)organizationIsMultiCurrency;
35 | -(NSString *)defaultCurrencyIsoCode;
36 | -(NSString *)email;
37 | -(NSString *)fullName;
38 | -(NSString *)userId;
39 | -(NSString *)language;
40 | -(NSString *)locale;
41 | -(NSString *)timeZone;
42 | -(NSString *)skin;
43 | // API v8.0
44 | -(NSString *)licenseType;
45 | -(NSString *)profileId;
46 | -(NSString *)roleId;
47 | -(NSString *)userName;
48 | @end
49 |
--------------------------------------------------------------------------------
/sforce/zkUserInfo.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import "zkUserInfo.h"
24 |
25 | @implementation ZKUserInfo
26 |
27 | /*
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | */
46 |
47 |
48 | -(BOOL)accessibilityMode {
49 | return [self boolean:@"accessibilityMode"];
50 | }
51 | -(NSString *)currencySymbol {
52 | return [self string:@"currencySymbol"];
53 | }
54 | -(NSString *)organizationId {
55 | return [self string:@"organizationId"];
56 | }
57 | -(BOOL)organizationIsMultiCurrency {
58 | return [self boolean:@"organizationMultiCurrency"];
59 | }
60 | -(NSString *)organizationName {
61 | return [self string:@"organizationName"];
62 | }
63 | -(NSString *)defaultCurrencyIsoCode {
64 | return [self string:@"userDefaultCurrencyIsoCode"];
65 | }
66 | -(NSString *)email {
67 | return [self string:@"userEmail"];
68 | }
69 | -(NSString *)fullName {
70 | return [self string:@"userFullName"];
71 | }
72 | -(NSString *)userId {
73 | return [self string:@"userId"];
74 | }
75 | -(NSString *)language {
76 | return [self string:@"userLanguage"];
77 | }
78 | -(NSString *)locale {
79 | return [self string:@"userLocale"];
80 | }
81 | -(NSString *)timeZone {
82 | return [self string:@"userTimeZone"];
83 | }
84 | -(NSString *)skin {
85 | return [self string:@"userUiSkin"];
86 | }
87 | -(NSString *)licenseType {
88 | return [self string:@"licenseType"];
89 | }
90 | -(NSString *)profileId {
91 | return [self string:@"profileId"];
92 | }
93 | -(NSString *)roleId {
94 | return [self string:@"roleId"];
95 | }
96 | -(NSString *)userName {
97 | return [self string:@"userName"];
98 | }
99 |
100 | @end
101 |
--------------------------------------------------------------------------------
/sforce/zkXmlDeserializer.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 |
23 | #import
24 |
25 | @interface ZKXmlDeserializer : NSObject {
26 | NSXMLElement *node;
27 | NSMutableDictionary *values;
28 | }
29 | - (id)initWithXmlElement:(NSXMLElement *)e;
30 |
31 | - (NSString *)string:(NSString *)elem;
32 | - (BOOL)boolean:(NSString *)elem;
33 | - (int)integer:(NSString *)elem;
34 | - (double)double:(NSString *)elem;
35 | - (NSArray *)strings:(NSString *)elem;
36 |
37 | - (NSString *)string:(NSString *)elemName fromXmlElement:(NSXMLElement*)xmlElement;
38 | - (NSArray *)complexTypeArrayFromElements:(NSString *)elemName cls:(Class)type;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/sforce/zkXmlDeserializer.m:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2006 Simon Fell
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and associated documentation files (the "Software"),
5 | // to deal in the Software without restriction, including without limitation
6 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | // and/or sell copies of the Software, and to permit persons to whom the
8 | // Software is furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included
11 | // in all copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | // THE SOFTWARE.
20 | //
21 |
22 | #import "zkXmlDeserializer.h"
23 |
24 | @implementation ZKXmlDeserializer
25 |
26 | -(id)initWithXmlElement:(NSXMLElement *)e {
27 | self = [super init];
28 | node = [e retain];
29 | values = [[NSMutableDictionary alloc] init];
30 | return self;
31 | }
32 |
33 | -(void)dealloc {
34 | [node release];
35 | [values release];
36 | [super dealloc];
37 | }
38 |
39 | - (NSString *)string:(NSString *)elem {
40 | id cached = [values objectForKey:elem];
41 | if (cached != nil) return cached == [NSNull null] ? nil : cached;
42 | id v = [self string:elem fromXmlElement:node];
43 | [values setObject:(v != nil ? v : [NSNull null]) forKey:elem];
44 | return v;
45 | }
46 |
47 | - (BOOL)boolean:(NSString *)elem {
48 | return [[self string:elem] isEqualToString:@"true"];
49 | }
50 |
51 | - (int)integer:(NSString *)elem {
52 | return [[self string:elem] intValue];
53 | }
54 |
55 | - (double)double:(NSString *)elem {
56 | return [[self string:elem] doubleValue];
57 | }
58 |
59 | - (NSArray *)strings:(NSString *)elem {
60 | NSArray *cached = [values objectForKey:elem];
61 | if (cached != nil) return cached;
62 | NSArray *nodes = [node elementsForName:elem];
63 | NSMutableArray *s = [NSMutableArray arrayWithCapacity:[nodes count]];
64 | NSXMLNode *n;
65 | NSEnumerator *e = [nodes objectEnumerator];
66 | while (n = [e nextObject]) {
67 | [s addObject:[n stringValue]];
68 | }
69 | [values setObject:s forKey:elem];
70 | return s;
71 | }
72 |
73 | - (NSString *)string:(NSString *)elemName fromXmlElement:(NSXMLElement*)xmlElement {
74 | NSArray * nodes = [xmlElement elementsForName:elemName];
75 | if ([nodes count] == 0) return nil;
76 | return [[nodes objectAtIndex:0] stringValue];
77 | }
78 |
79 | - (NSArray *)complexTypeArrayFromElements:(NSString *)elemName cls:(Class)type {
80 | NSArray *cached = [values objectForKey:elemName];
81 | if (cached == nil) {
82 | NSArray *elements = [node elementsForName:elemName];
83 | NSMutableArray *results = [NSMutableArray arrayWithCapacity:[elements count]];
84 | NSXMLElement * childNode;
85 | NSEnumerator *e = [elements objectEnumerator];
86 | while (childNode = [e nextObject]) {
87 | NSObject *child = [[type alloc] initWithXmlElement:childNode];
88 | [results addObject:child];
89 | [child release];
90 | }
91 | [values setObject:results forKey:elemName];
92 | cached = results;
93 | }
94 | return cached;
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------