From: <unu...@us...> - 2012-03-12 23:13:35
|
Revision: 18549 http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18549&view=rev Author: ununnilium Date: 2012-03-12 23:13:20 +0000 (Mon, 12 Mar 2012) Log Message: ----------- Add initial version iOS BibDesk app Added Paths: ----------- trunk/bibdesk_ios/AGRegex-Info.plist trunk/bibdesk_ios/AGRegex.xcodeproj/ trunk/bibdesk_ios/AGRegex.xcodeproj/project.pbxproj trunk/bibdesk_ios/BDSKAppDelegate.h trunk/bibdesk_ios/BDSKAppDelegate.m trunk/bibdesk_ios/BDSKDetailViewController.h trunk/bibdesk_ios/BDSKDetailViewController.m trunk/bibdesk_ios/BDSKDropboxStore.h trunk/bibdesk_ios/BDSKDropboxStore.m trunk/bibdesk_ios/BDSKGroupTableViewController.h trunk/bibdesk_ios/BDSKGroupTableViewController.m trunk/bibdesk_ios/BDSKLocalFile.h trunk/bibdesk_ios/BDSKLocalFile.m trunk/bibdesk_ios/BDSKMasterViewController.h trunk/bibdesk_ios/BDSKMasterViewController.m trunk/bibdesk_ios/BDSKPDFTableViewController.h trunk/bibdesk_ios/BDSKPDFTableViewController.m trunk/bibdesk_ios/BDSKPubTableViewController.h trunk/bibdesk_ios/BDSKPubTableViewController.m trunk/bibdesk_ios/BTParse-Info.plist trunk/bibdesk_ios/BTParse.xcodeproj/ trunk/bibdesk_ios/BTParse.xcodeproj/project.pbxproj trunk/bibdesk_ios/BibDesk-Info.plist trunk/bibdesk_ios/BibDesk.xcodeproj/ trunk/bibdesk_ios/BibDesk.xcodeproj/project.pbxproj trunk/bibdesk_ios/BibDesk.xcodeproj/project.xcworkspace/ trunk/bibdesk_ios/BibDesk.xcodeproj/project.xcworkspace/contents.xcworkspacedata trunk/bibdesk_ios/BibDesk.xcworkspace/ trunk/bibdesk_ios/BibDesk.xcworkspace/contents.xcworkspacedata trunk/bibdesk_ios/BibDocument.h trunk/bibdesk_ios/BibDocument.m trunk/bibdesk_ios/DropboxSDK.framework/ trunk/bibdesk_ios/DropboxSDK.framework/DropboxSDK trunk/bibdesk_ios/DropboxSDK.framework/Headers/ trunk/bibdesk_ios/DropboxSDK.framework/Headers/Base64Transcoder.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBAccountInfo.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBDefines.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBError.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBJSON.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBJsonBase.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBJsonParser.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBJsonWriter.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBLog.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBMetadata.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBQuota.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBRequest.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBRestClient.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DBSession.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/DropboxSDK-Prefix.pch trunk/bibdesk_ios/DropboxSDK.framework/Headers/DropboxSDK.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/JSON.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPDebug.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuth.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthAPI.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthAPIRequestLoader.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthAuthenticationMethod.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthAuthenticationMethodOAuth.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthConnection.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthCredentialConcreteStore+KeychainAdditions.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthCredentialConcreteStore.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthCredentialStore.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthParameterFactory.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthSignatureParameter.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthURLRequest.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPOAuthURLResponse.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/MPURLRequestParameter.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/NSDictionary+Dropbox.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/NSObject+DBJSON.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/NSString+DBJSON.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/NSString+Dropbox.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/NSString+URLEscapingAdditions.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/NSURL+MPURLParameterAdditions.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/NSURLResponse+Encoding.h trunk/bibdesk_ios/DropboxSDK.framework/Headers/UIAlertView+Dropbox.h trunk/bibdesk_ios/DropboxSDK.framework/Info.plist trunk/bibdesk_ios/Images/ trunk/bibdesk_ios/Images/Icon.graffle/ trunk/bibdesk_ios/Images/Icon.graffle/data.plist trunk/bibdesk_ios/Images/Icon.graffle/image1.png trunk/bibdesk_ios/Images/Icon.png trunk/bibdesk_ios/Images/Ic...@2x...g trunk/bibdesk_ios/Images/IconPad.png trunk/bibdesk_ios/Images/Ic...@2x...g trunk/bibdesk_ios/Images/bib.png trunk/bibdesk_ios/Images/bi...@2x...g trunk/bibdesk_ios/Images/iTunesArtwork trunk/bibdesk_ios/Images/pdf.png trunk/bibdesk_ios/Images/pd...@2x...g trunk/bibdesk_ios/NSCellStateValue.h trunk/bibdesk_ios/en.lproj/ trunk/bibdesk_ios/en.lproj/InfoPlist.strings trunk/bibdesk_ios/en.lproj/MainStoryboard_iPad.storyboard trunk/bibdesk_ios/en.lproj/MainStoryboard_iPhone.storyboard trunk/bibdesk_ios/main.m Added: trunk/bibdesk_ios/AGRegex-Info.plist =================================================================== --- trunk/bibdesk_ios/AGRegex-Info.plist (rev 0) +++ trunk/bibdesk_ios/AGRegex-Info.plist 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>net.sourceforge.bibdesk.${PRODUCT_NAME:rfc1034identifier}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>CFPlugInDynamicRegisterFunction</key> + <string></string> + <key>CFPlugInDynamicRegistration</key> + <string>NO</string> + <key>CFPlugInFactories</key> + <dict> + <key>00000000-0000-0000-0000-000000000000</key> + <string>MyFactoryFunction</string> + </dict> + <key>CFPlugInTypes</key> + <dict> + <key>00000000-0000-0000-0000-000000000000</key> + <array> + <string>00000000-0000-0000-0000-000000000000</string> + </array> + </dict> + <key>CFPlugInUnloadFunction</key> + <string></string> + <key>NSHumanReadableCopyright</key> + <string></string> +</dict> +</plist> Property changes on: trunk/bibdesk_ios/AGRegex.xcodeproj ___________________________________________________________________ Added: svn:ignore + xcuserdata Added: trunk/bibdesk_ios/AGRegex.xcodeproj/project.pbxproj =================================================================== --- trunk/bibdesk_ios/AGRegex.xcodeproj/project.pbxproj (rev 0) +++ trunk/bibdesk_ios/AGRegex.xcodeproj/project.pbxproj 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,297 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 3B13604F1506731E001DBBA5 /* AGRegex.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B13604115067255001DBBA5 /* AGRegex.m */; }; + 3B1360501506731E001DBBA5 /* get.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B13604515067275001DBBA5 /* get.c */; }; + 3B1360511506731E001DBBA5 /* maketables.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B13604715067275001DBBA5 /* maketables.c */; }; + 3B1360521506731E001DBBA5 /* pcre.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B13604815067275001DBBA5 /* pcre.c */; }; + 3B1360531506731E001DBBA5 /* study.c in Sources */ = {isa = PBXBuildFile; fileRef = 3B13604A15067275001DBBA5 /* study.c */; }; + 3B1360551506733E001DBBA5 /* AGRegex.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B13604015067255001DBBA5 /* AGRegex.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3B1360561506733E001DBBA5 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B13604415067275001DBBA5 /* config.h */; }; + 3B1360571506733E001DBBA5 /* internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B13604615067275001DBBA5 /* internal.h */; }; + 3B1360581506733E001DBBA5 /* pcre.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B13604915067275001DBBA5 /* pcre.h */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 3B136032150670EC001DBBA5 /* AGRegex.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AGRegex.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B136037150670ED001DBBA5 /* AGRegex-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AGRegex-Info.plist"; sourceTree = "<group>"; }; + 3B13604015067255001DBBA5 /* AGRegex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AGRegex.h; sourceTree = "<group>"; }; + 3B13604115067255001DBBA5 /* AGRegex.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AGRegex.m; sourceTree = "<group>"; }; + 3B13604315067275001DBBA5 /* chartables.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = chartables.c; path = "pcre-4.3/chartables.c"; sourceTree = "<group>"; }; + 3B13604415067275001DBBA5 /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = config.h; path = "pcre-4.3/config.h"; sourceTree = "<group>"; }; + 3B13604515067275001DBBA5 /* get.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = get.c; path = "pcre-4.3/get.c"; sourceTree = "<group>"; }; + 3B13604615067275001DBBA5 /* internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = internal.h; path = "pcre-4.3/internal.h"; sourceTree = "<group>"; }; + 3B13604715067275001DBBA5 /* maketables.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = maketables.c; path = "pcre-4.3/maketables.c"; sourceTree = "<group>"; }; + 3B13604815067275001DBBA5 /* pcre.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = pcre.c; path = "pcre-4.3/pcre.c"; sourceTree = "<group>"; }; + 3B13604915067275001DBBA5 /* pcre.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = pcre.h; path = "pcre-4.3/pcre.h"; sourceTree = "<group>"; }; + 3B13604A15067275001DBBA5 /* study.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = study.c; path = "pcre-4.3/study.c"; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3B13602F150670EC001DBBA5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3B136013150670BC001DBBA5 = { + isa = PBXGroup; + children = ( + 3B136023150670BC001DBBA5 /* AGRegex */, + 3B136024150670BC001DBBA5 /* Supporting Files */, + 3B13601F150670BC001DBBA5 /* Products */, + ); + sourceTree = "<group>"; + }; + 3B13601F150670BC001DBBA5 /* Products */ = { + isa = PBXGroup; + children = ( + 3B136032150670EC001DBBA5 /* AGRegex.framework */, + ); + name = Products; + sourceTree = "<group>"; + }; + 3B136023150670BC001DBBA5 /* AGRegex */ = { + isa = PBXGroup; + children = ( + 3B13604015067255001DBBA5 /* AGRegex.h */, + 3B13604115067255001DBBA5 /* AGRegex.m */, + 3B1360421506726B001DBBA5 /* pcre-4.3 */, + ); + name = AGRegex; + path = bibdesk/vendorsrc/agkit_sourceforge/agregex; + sourceTree = "<group>"; + }; + 3B136024150670BC001DBBA5 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 3B136037150670ED001DBBA5 /* AGRegex-Info.plist */, + ); + name = "Supporting Files"; + sourceTree = "<group>"; + }; + 3B1360421506726B001DBBA5 /* pcre-4.3 */ = { + isa = PBXGroup; + children = ( + 3B13604315067275001DBBA5 /* chartables.c */, + 3B13604415067275001DBBA5 /* config.h */, + 3B13604515067275001DBBA5 /* get.c */, + 3B13604615067275001DBBA5 /* internal.h */, + 3B13604715067275001DBBA5 /* maketables.c */, + 3B13604815067275001DBBA5 /* pcre.c */, + 3B13604915067275001DBBA5 /* pcre.h */, + 3B13604A15067275001DBBA5 /* study.c */, + ); + name = "pcre-4.3"; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 3B13605415067325001DBBA5 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3B1360551506733E001DBBA5 /* AGRegex.h in Headers */, + 3B1360561506733E001DBBA5 /* config.h in Headers */, + 3B1360571506733E001DBBA5 /* internal.h in Headers */, + 3B1360581506733E001DBBA5 /* pcre.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 3B136031150670EC001DBBA5 /* AGRegex */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3B13603C150670ED001DBBA5 /* Build configuration list for PBXNativeTarget "AGRegex" */; + buildPhases = ( + 3B13602E150670EC001DBBA5 /* Sources */, + 3B13602F150670EC001DBBA5 /* Frameworks */, + 3B136030150670EC001DBBA5 /* Resources */, + 3B13605415067325001DBBA5 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AGRegex; + productName = AGRegex; + productReference = 3B136032150670EC001DBBA5 /* AGRegex.framework */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3B136015150670BC001DBBA5 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + ORGANIZATIONNAME = ""; + }; + buildConfigurationList = 3B136018150670BC001DBBA5 /* Build configuration list for PBXProject "AGRegex" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 3B136013150670BC001DBBA5; + productRefGroup = 3B13601F150670BC001DBBA5 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3B136031150670EC001DBBA5 /* AGRegex */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3B136030150670EC001DBBA5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3B13602E150670EC001DBBA5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3B13604F1506731E001DBBA5 /* AGRegex.m in Sources */, + 3B1360501506731E001DBBA5 /* get.c in Sources */, + 3B1360511506731E001DBBA5 /* maketables.c in Sources */, + 3B1360521506731E001DBBA5 /* pcre.c in Sources */, + 3B1360531506731E001DBBA5 /* study.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3B136029150670BC001DBBA5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + SUPPORT_UTF8, + "POSIX_MALLOC_THRESHOLD=10", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_MISSING_PARENTHESES = NO; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + SDKROOT = iphoneos; + WARNING_CFLAGS = "-Wno-constant-logical-operand"; + }; + name = Debug; + }; + 3B13602A150670BC001DBBA5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ( + SUPPORT_UTF8, + "POSIX_MALLOC_THRESHOLD=10", + ); + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_MISSING_PARENTHESES = NO; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + WARNING_CFLAGS = "-Wno-constant-logical-operand"; + }; + name = Release; + }; + 3B13603D150670ED001DBBA5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + DEAD_CODE_STRIPPING = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "AGRegex-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + LINK_WITH_STANDARD_LIBRARIES = NO; + MACH_O_TYPE = mh_object; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + 3B13603E150670ED001DBBA5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + DEAD_CODE_STRIPPING = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "AGRegex-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + LINK_WITH_STANDARD_LIBRARIES = NO; + MACH_O_TYPE = mh_object; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3B136018150670BC001DBBA5 /* Build configuration list for PBXProject "AGRegex" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3B136029150670BC001DBBA5 /* Debug */, + 3B13602A150670BC001DBBA5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3B13603C150670ED001DBBA5 /* Build configuration list for PBXNativeTarget "AGRegex" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3B13603D150670ED001DBBA5 /* Debug */, + 3B13603E150670ED001DBBA5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3B136015150670BC001DBBA5 /* Project object */; +} Added: trunk/bibdesk_ios/BDSKAppDelegate.h =================================================================== --- trunk/bibdesk_ios/BDSKAppDelegate.h (rev 0) +++ trunk/bibdesk_ios/BDSKAppDelegate.h 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,48 @@ +// +// BDSKAppDelegate.h +// BibDesk +// +// Created by Colin A. Smith on 3/3/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <UIKit/UIKit.h> + +#import <DropboxSDK/DropboxSDK.h> + +@interface BDSKAppDelegate : UIResponder <UIApplicationDelegate, DBSessionDelegate> + +@property (strong, nonatomic) UIWindow *window; +@property (readonly) BOOL dropboxLinked; + +@end Added: trunk/bibdesk_ios/BDSKAppDelegate.m =================================================================== --- trunk/bibdesk_ios/BDSKAppDelegate.m (rev 0) +++ trunk/bibdesk_ios/BDSKAppDelegate.m 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,235 @@ +// +// BDSKAppDelegate.m +// BibDesk +// +// Created by Colin A. Smith on 3/3/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "BDSKAppDelegate.h" + +#import "BDSKDropboxStore.h" + +@interface BDSKAppDelegate () { + NSString *relinkUserId; + BOOL _dropboxLinked; +} + +- (void)setDropboxLinked:(BOOL)linked; + +@end + +@implementation BDSKAppDelegate + +@synthesize window = _window; + +- (void)dealloc +{ + [_window release]; + [super dealloc]; +} + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + + // Set these variables before launching the app + NSString* appKey = @"eq4q5w8c3389t6u"; + NSString* appSecret = @"ezbmorda4ycilxx"; + NSString *root = kDBRootAppFolder; // Should be set to either kDBRootAppFolder or kDBRootDropbox + // You can determine if you have App folder access or Full Dropbox along with your consumer key/secret + // from https://dropbox.com/developers/apps + + // Look below where the DBSession is created to understand how to use DBSession in your app + + NSString* errorMsg = nil; + if ([appKey rangeOfCharacterFromSet:[[NSCharacterSet alphanumericCharacterSet] invertedSet]].location != NSNotFound) { + errorMsg = @"Make sure you set the app key correctly in DBRouletteAppDelegate.m"; + } else if ([appSecret rangeOfCharacterFromSet:[[NSCharacterSet alphanumericCharacterSet] invertedSet]].location != NSNotFound) { + errorMsg = @"Make sure you set the app secret correctly in DBRouletteAppDelegate.m"; + } else if ([root length] == 0) { + errorMsg = @"Set your root to use either App Folder of full Dropbox"; + } else { + NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"]; + NSData *plistData = [NSData dataWithContentsOfFile:plistPath]; + NSDictionary *loadedPlist = + [NSPropertyListSerialization + propertyListFromData:plistData mutabilityOption:0 format:NULL errorDescription:NULL]; + NSString *scheme = [[[[loadedPlist objectForKey:@"CFBundleURLTypes"] objectAtIndex:0] objectForKey:@"CFBundleURLSchemes"] objectAtIndex:0]; + if ([scheme isEqual:@"db-APP_KEY"]) { + errorMsg = @"Set your URL scheme correctly in DBRoulette-Info.plist"; + } + } + + DBSession* session = + [[DBSession alloc] initWithAppKey:appKey appSecret:appSecret root:root]; + session.delegate = self; // DBSessionDelegate methods allow you to handle re-authenticating + [DBSession setSharedSession:session]; + [session release]; + + if (errorMsg != nil) { + [[[[UIAlertView alloc] + initWithTitle:@"Error Configuring Session" message:errorMsg + delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] + autorelease] + show]; + } + + [[BDSKDropboxStore sharedStore] addLocalFiles]; + + _dropboxLinked = [[DBSession sharedSession] isLinked]; + + if (self.dropboxLinked) { + [[BDSKDropboxStore sharedStore] startSync]; + } + + NSDictionary *defaults = [NSDictionary dictionaryWithObjectsAndKeys:@",:;", @"BDSKGroupFieldSeparatorCharactersKey", nil]; + [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; + + if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { + UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; + UINavigationController *navigationController = [splitViewController.viewControllers lastObject]; + splitViewController.delegate = (id)navigationController.topViewController; + } + + return YES; +} + +- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { + if ([[DBSession sharedSession] handleOpenURL:url]) { + [self setDropboxLinked:[[DBSession sharedSession] isLinked]]; + if (self.dropboxLinked) { + [[BDSKDropboxStore sharedStore] startSync]; + } + return YES; + } + + return NO; +} + +- (BOOL)dropboxLinked { + + return _dropboxLinked; +} + +- (void)setDropboxLinked:(BOOL)linked { + + if (linked != _dropboxLinked) { + [self willChangeValueForKey:@"dropboxLinked"]; + _dropboxLinked = linked; + [self didChangeValueForKey:@"dropboxLinked"]; + } +} + ++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey { + + BOOL automatic = NO; + if ([theKey isEqualToString:@"dropboxLinked"]) { + automatic = NO; + } else { + automatic = [super automaticallyNotifiesObserversForKey:theKey]; + } + return automatic; +} + +- (void)toggleDropboxLink { + + if (!self.dropboxLinked) { + [[DBSession sharedSession] link]; + } else { + [[DBSession sharedSession] unlinkAll]; + [[[[UIAlertView alloc] + initWithTitle:@"Account Unlinked!" message:@"Your dropbox account has been unlinked" + delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] + autorelease] + show]; + + [self setDropboxLinked:NO]; + } +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +#pragma mark - +#pragma mark DBSessionDelegate methods + +- (void)sessionDidReceiveAuthorizationFailure:(DBSession*)session userId:(NSString *)userId { + relinkUserId = [userId retain]; + [[[[UIAlertView alloc] + initWithTitle:@"Dropbox Session Ended" message:@"Do you want to relink?" delegate:self + cancelButtonTitle:@"Cancel" otherButtonTitles:@"Relink", nil] + autorelease] + show]; + + [self setDropboxLinked:NO]; +} + + +#pragma mark - +#pragma mark UIAlertViewDelegate methods + +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)index { + if (index != alertView.cancelButtonIndex) { + [[DBSession sharedSession] linkUserId:relinkUserId]; + } + [relinkUserId release]; + relinkUserId = nil; +} + + +@end Added: trunk/bibdesk_ios/BDSKDetailViewController.h =================================================================== --- trunk/bibdesk_ios/BDSKDetailViewController.h (rev 0) +++ trunk/bibdesk_ios/BDSKDetailViewController.h 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,49 @@ +// +// BDSKDetailViewController.h +// BibDesk +// +// Created by Colin A. Smith on 3/3/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <UIKit/UIKit.h> + +@class BDSKLocalFile; + +@interface BDSKDetailViewController : UIViewController <UISplitViewControllerDelegate, UIWebViewDelegate> + +@property (strong, nonatomic) BDSKLocalFile *displayedFile; + +@property (strong, nonatomic) IBOutlet UIWebView *webView; + +@end Added: trunk/bibdesk_ios/BDSKDetailViewController.m =================================================================== --- trunk/bibdesk_ios/BDSKDetailViewController.m (rev 0) +++ trunk/bibdesk_ios/BDSKDetailViewController.m 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,128 @@ +// +// BDSKDetailViewController.m +// BibDesk +// +// Created by Colin A. Smith on 3/3/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "BDSKDetailViewController.h" + +#import "BDSKLocalFile.h" + +@interface BDSKDetailViewController () +@property (strong, nonatomic) UIPopoverController *masterPopoverController; +- (void)configureView; +@end + +@implementation BDSKDetailViewController + +@synthesize displayedFile = _displayedFile; +@synthesize masterPopoverController = _masterPopoverController; +@synthesize webView; + +- (void)dealloc +{ + [_displayedFile release]; + [_masterPopoverController release]; + [super dealloc]; +} + +#pragma mark - Managing the detail item + +- (void)setDisplayedFile:(BDSKLocalFile *)newDisplayedFile +{ + if (_displayedFile != newDisplayedFile) { + [_displayedFile release]; + _displayedFile = [newDisplayedFile retain]; + + // Update the view. + [self configureView]; + } + + if (self.masterPopoverController != nil) { + [self.masterPopoverController dismissPopoverAnimated:YES]; + } +} + +- (void)configureView +{ + // Update the user interface for the detail item. + + if (self.displayedFile && self.webView) { + NSURL *url = [NSURL fileURLWithPath:self.displayedFile.fullPath]; + NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url]; + [self.webView loadRequest:urlRequest]; + self.title = self.displayedFile.nameNoExtension; + } +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + [self configureView]; +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { + return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); + } else { + return YES; + } +} + +#pragma mark - Split view + +- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController +{ + barButtonItem.title = NSLocalizedString(@"Publications", @"Publications"); + [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES]; + self.masterPopoverController = popoverController; +} + +- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem +{ + // Called when the view is shown again in the split view, invalidating the button and popover controller. + [self.navigationItem setLeftBarButtonItem:nil animated:YES]; + self.masterPopoverController = nil; +} + +@end Added: trunk/bibdesk_ios/BDSKDropboxStore.h =================================================================== --- trunk/bibdesk_ios/BDSKDropboxStore.h (rev 0) +++ trunk/bibdesk_ios/BDSKDropboxStore.h 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,53 @@ +// +// BDSKDropboxStore.h +// BibDesk +// +// Created by Colin A. Smith on 3/3/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +@interface BDSKDropboxStore : NSObject + +@property (readonly) NSMutableArray *bibliographies; +@property (readonly) NSMutableArray *pdfs; +@property (readonly) NSMutableDictionary *pdfFilePaths; +@property (readonly) BOOL syncing; + ++ (BDSKDropboxStore *)sharedStore; + +- (void)addLocalFiles; +- (void)startSync; + +@end Added: trunk/bibdesk_ios/BDSKDropboxStore.m =================================================================== --- trunk/bibdesk_ios/BDSKDropboxStore.m (rev 0) +++ trunk/bibdesk_ios/BDSKDropboxStore.m 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,362 @@ +// +// BDSKDropboxStore.m +// BibDesk +// +// Created by Colin A. Smith on 3/3/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "BDSKDropboxStore.h" + +#import <DropboxSDK/DropboxSDK.h> +#import "BDSKLocalFile.h" + +static BDSKDropboxStore *sharedDropboxStore = nil; + +@interface BDSKDropboxStore () <DBRestClientDelegate> { + NSMutableArray *_bibliographies; + NSMutableArray *_pdfs; + NSMutableDictionary *_pdfFilePaths; + NSMutableArray *_filesToLoad; + DBRestClient *_restClient; + NSString *_rootHash; + BOOL _syncing; + + NSArray *_bibExtensions; + NSArray *_pdfExtensions; +} + +@property (nonatomic, readonly) DBRestClient* restClient; + +- (void)setSyncing:(BOOL)syncing; + +@end + +@implementation BDSKDropboxStore + ++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey { + + BOOL automatic = NO; + if ([theKey isEqualToString:@"syncing"]) { + automatic = NO; + } else { + automatic=[super automaticallyNotifiesObserversForKey:theKey]; + } + return automatic; +} + ++ (BDSKDropboxStore *)sharedStore { + + if (!sharedDropboxStore) { + sharedDropboxStore = [[BDSKDropboxStore alloc] init]; + } + + return sharedDropboxStore; +} + +- (id)init { + + [super init]; + _bibliographies = [[NSMutableArray alloc] init]; + _pdfs = [[NSMutableArray alloc] init]; + _pdfFilePaths = [[NSMutableDictionary alloc] init]; + _filesToLoad = [[NSMutableArray alloc] init]; + + _bibExtensions = [[NSArray alloc] initWithObjects:@"bib", nil]; + _pdfExtensions = [[NSArray alloc] initWithObjects:@"pdf", nil]; + + return self; +} + +- (void) dealloc { + + [_bibliographies release]; + [_pdfs release]; + [_pdfFilePaths release]; + [_restClient release]; + [_rootHash release]; + [_bibExtensions release]; + [_pdfExtensions release]; + [super dealloc]; +} + +#pragma mark Property methods + +- (NSMutableArray*)bibliographies { + return _bibliographies; +} + +- (NSMutableArray*)pdfs { + return _pdfs; +} + +- (NSDictionary *)pdfFilePaths { + + return _pdfFilePaths; +} + +- (DBRestClient*)restClient { + if (_restClient == nil) { + _restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]]; + _restClient.delegate = self; + } + return _restClient; +} + +- (BOOL)syncing { + + return _syncing; +} + +- (void)setSyncing:(BOOL)syncing { + + [self willChangeValueForKey:@"syncing"]; + _syncing = syncing; + [self didChangeValueForKey:@"syncing"]; +} + +#pragma mark Synchronization methods + +- (void)addLocalFiles { + + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSError *error = nil; + NSArray *contents = [fileManager contentsOfDirectoryAtPath:[BDSKLocalFile documentsRoot] error:&error]; + if (error) { + NSLog(@"Contents of Directory Failed: %@", [error localizedDescription]); + } + + BOOL isDirectory; + + NSMutableArray *bibliographiesProxy = [self mutableArrayValueForKey:@"bibliographies"]; + NSMutableArray *pdfsProxy = [self mutableArrayValueForKey:@"pdfs"]; + + for (NSString *filename in contents) { + NSString *fullPath = [[BDSKLocalFile documentsRoot] stringByAppendingPathComponent:filename]; + NSLog(@"Adding Local File: %@", fullPath); + [fileManager fileExistsAtPath:fullPath isDirectory:(BOOL *)&isDirectory]; + NSString* extension = [[filename pathExtension] lowercaseString]; + if (!isDirectory && [_bibExtensions indexOfObject:extension] != NSNotFound) { + BDSKLocalFile *newFile = [[BDSKLocalFile alloc] initWithFullPath:fullPath]; + [bibliographiesProxy addObject:newFile]; + [newFile release]; + } else if (!isDirectory && [_pdfExtensions indexOfObject:extension] != NSNotFound) { + BDSKLocalFile *newFile = [[BDSKLocalFile alloc] initWithFullPath:fullPath]; + NSLog(@"Adding Path: %@", newFile.path); + [_pdfFilePaths setObject:newFile forKey:newFile.pathWithoutLeadingSlash]; + [pdfsProxy addObject:newFile]; + [newFile release]; + } + } +} + +- (void)startSync { + + if (!_syncing) { + [self.restClient loadMetadata:@"/" withHash:_rootHash]; + [self setSyncing:YES]; + } +} + +#pragma mark DBRestClientDelegate methods + +- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata { + + if ([metadata.path isEqualToString: @"/"]) { + + [_rootHash release]; + _rootHash = [metadata.hash retain]; + + NSMutableIndexSet *bibliographiesToRemove = [[NSMutableIndexSet alloc] init]; + NSMutableIndexSet *pdfsToRemove = [[NSMutableIndexSet alloc] init]; + [bibliographiesToRemove addIndexesInRange:NSMakeRange(0, [_bibliographies count])]; + [pdfsToRemove addIndexesInRange:NSMakeRange(0, [_pdfs count])]; + + for (DBMetadata* child in metadata.contents) { + NSString* extension = [[child.path pathExtension] lowercaseString]; + NSString* noExtension = [child.path stringByDeletingPathExtension]; + if (!child.isDirectory && [_bibExtensions indexOfObject:extension] != NSNotFound && ![noExtension hasSuffix:@"(Autosaved)"]) { + + BDSKLocalFile *newFile = [[BDSKLocalFile alloc] initWithDropboxPath:child.path lastModifiedDate:child.lastModifiedDate totalByets:child.totalBytes]; + + NSUInteger existingIndex = [_bibliographies indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { + return [((BDSKLocalFile *)obj).path isEqualToString:newFile.path]; + }]; + + if (existingIndex == NSNotFound) { + [_filesToLoad addObject:newFile]; + } else { + [bibliographiesToRemove removeIndex:existingIndex]; + BDSKLocalFile *existingFile = [_bibliographies objectAtIndex:existingIndex]; + if (!([newFile.lastModifiedDate isEqualToDate:existingFile.lastModifiedDate] && newFile.totalBytes == existingFile.totalBytes)) { + [_filesToLoad addObject:newFile]; + } + } + + [newFile release]; + + } else if (!child.isDirectory && [_pdfExtensions indexOfObject:extension] != NSNotFound) { + + BDSKLocalFile *newFile = [[BDSKLocalFile alloc] initWithDropboxPath:child.path lastModifiedDate:child.lastModifiedDate totalByets:child.totalBytes]; + + NSUInteger existingIndex = [_pdfs indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { + return [((BDSKLocalFile *)obj).path isEqualToString:newFile.path]; + }]; + + if (existingIndex == NSNotFound) { + [_filesToLoad addObject:newFile]; + } else { + [pdfsToRemove removeIndex:existingIndex]; + BDSKLocalFile *existingFile = [_pdfs objectAtIndex:existingIndex]; + if (!([newFile.lastModifiedDate isEqualToDate:existingFile.lastModifiedDate] && newFile.totalBytes == existingFile.totalBytes)) { + [_filesToLoad addObject:newFile]; + } + } + + [newFile release]; + } + } + + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSError *error = nil; + for (BDSKLocalFile *file in [_bibliographies objectsAtIndexes:bibliographiesToRemove]) { + NSLog(@"Removing File at Path: %@", file.fullPath); + [fileManager removeItemAtPath:file.fullPath error:&error]; + if (error) { + NSLog(@"Remove File Failed: %@", [error localizedDescription]); + } + } + + NSMutableArray *bibliographiesProxy = [self mutableArrayValueForKey:@"bibliographies"]; + [bibliographiesProxy removeObjectsAtIndexes:bibliographiesToRemove]; + [bibliographiesToRemove release]; + + for (BDSKLocalFile *file in [_pdfs objectsAtIndexes:pdfsToRemove]) { + NSLog(@"Removing File at Path: %@", file.fullPath); + [fileManager removeItemAtPath:file.fullPath error:&error]; + if (error) { + NSLog(@"Remove File Failed: %@", [error localizedDescription]); + } + [_pdfFilePaths removeObjectForKey:file.pathWithoutLeadingSlash]; + } + + NSMutableArray *pdfsProxy = [self mutableArrayValueForKey:@"pdfs"]; + [pdfsProxy removeObjectsAtIndexes:pdfsToRemove]; + [pdfsToRemove release]; + + if ([_filesToLoad count]) { + BDSKLocalFile *fileToLoad = [_filesToLoad objectAtIndex:0]; + NSLog(@"Loading File: %@", fileToLoad.dropboxPath); + [self.restClient loadFile:fileToLoad.dropboxPath intoPath:fileToLoad.fullPath]; + } else { + [self setSyncing:NO]; + } + } +} + +- (void)restClient:(DBRestClient*)client metadataUnchangedAtPath:(NSString*)path { + + if ([path isEqualToString: @"/"]) { + [self setSyncing:NO]; + } +} + +- (void)restClient:(DBRestClient*)client loadMetadataFailedWithError:(NSError*)error { + + NSLog(@"Load Metadata Failed: %@", [error localizedDescription]); + + [self setSyncing:NO]; +} + +- (void)restClient:(DBRestClient*)client loadedFile:(NSString*)destPath contentType:(NSString*)contentType metadata:(DBMetadata*)metadata { + + NSMutableArray *arrayProxy = nil; + NSString* extension = [[metadata.path pathExtension] lowercaseString]; + if ([_bibExtensions indexOfObject:extension] != NSNotFound) { + arrayProxy = [self mutableArrayValueForKey:@"bibliographies"]; + } else if ([_pdfExtensions indexOfObject:extension] != NSNotFound) { + arrayProxy = [self mutableArrayValueForKey:@"pdfs"]; + } + + BDSKLocalFile *loadedFile = [_filesToLoad objectAtIndex:0]; + + NSDictionary *attributes = [NSDictionary dictionaryWithObject:loadedFile.lastModifiedDate forKey:NSFileModificationDate]; + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSError *error = nil; + //NSLog(@"Setting File Modification Date: %@", loadedFile.lastModifiedDate); + [fileManager setAttributes:attributes ofItemAtPath:loadedFile.fullPath error:&error]; + if (error) { + NSLog(@"Set Attributes Failed: %@", [error localizedDescription]); + } + + NSUInteger existingIndex = [arrayProxy indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { + return [((BDSKLocalFile *)obj).path isEqualToString:loadedFile.path]; + }]; + + if (existingIndex == NSNotFound) { + if ([_pdfExtensions indexOfObject:extension] != NSNotFound) { + [_pdfFilePaths setObject:loadedFile forKey:loadedFile.pathWithoutLeadingSlash]; + } + [arrayProxy addObject:loadedFile]; + } else { + BDSKLocalFile *existingFile = [arrayProxy objectAtIndex:existingIndex]; + [existingFile updateWithRevisedFile:loadedFile]; + } + + [_filesToLoad removeObjectAtIndex:0]; + + if ([_filesToLoad count]) { + BDSKLocalFile *fileToLoad = [_filesToLoad objectAtIndex:0]; + NSLog(@"Loading File: %@", fileToLoad.dropboxPath); + [self.restClient loadFile:fileToLoad.dropboxPath intoPath:fileToLoad.fullPath]; + } else { + [self setSyncing:NO]; + } +} + +- (void)restClient:(DBRestClient*)client loadFileFailedWithError:(NSError*)error { + + NSLog(@"Load File Failed: %@", [error localizedDescription]); + + [_filesToLoad removeObjectAtIndex:0]; + + if ([_filesToLoad count]) { + BDSKLocalFile *fileToLoad = [_filesToLoad objectAtIndex:0]; + NSLog(@"Loading File: %@", fileToLoad.dropboxPath); + [self.restClient loadFile:fileToLoad.dropboxPath intoPath:fileToLoad.fullPath]; + } else { + [self setSyncing:NO]; + } +} + +@end Added: trunk/bibdesk_ios/BDSKGroupTableViewController.h =================================================================== --- trunk/bibdesk_ios/BDSKGroupTableViewController.h (rev 0) +++ trunk/bibdesk_ios/BDSKGroupTableViewController.h 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,47 @@ +// +// BDSKGroupTableViewController.h +// BibDesk +// +// Created by Colin A. Smith on 3/10/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <UIKit/UIKit.h> + +@class BibDocument; + +@interface BDSKGroupTableViewController : UITableViewController + +@property (retain, nonatomic) BibDocument *document; + +@end Added: trunk/bibdesk_ios/BDSKGroupTableViewController.m =================================================================== --- trunk/bibdesk_ios/BDSKGroupTableViewController.m (rev 0) +++ trunk/bibdesk_ios/BDSKGroupTableViewController.m 2012-03-12 23:13:20 UTC (rev 18549) @@ -0,0 +1,202 @@ +// +// BDSKGroupTableViewController.m +// BibDesk +// +// Created by Colin A. Smith on 3/10/12. +/* + This software is Copyright (c) 2012-2012 + Colin A. Smith. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Colin A. Smith nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "BDSKGroupTableViewController.h" + +#import "BDSKPubTableViewController.h" +#import "BibDocument.h" +#import "BDSKPublicationsArray.h" + +@interface BDSKGroupTableViewController () + +@end + +@implementation BDSKGroupTableViewController + +@synthesize document; + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + self.clearsSelectionOnViewWillAppear = YES; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { + return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); + } else { + return YES; + } +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + // Return the number of sections. + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + // Return the number of rows in the section. + if (section == 0) return 1; + ... [truncated message content] |