mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
OS X: Rename LiferayNativity code for shell icons
This commit is contained in:
parent
4b716f3ea6
commit
b62b87eed3
53 changed files with 333 additions and 3747 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -79,7 +79,7 @@ dlldata.c
|
|||
*.scc
|
||||
|
||||
# Mac OS X specific
|
||||
shell_integration/MacOSX/LiferayNativity.xcworkspace/xcuserdata/
|
||||
shell_integration/MacOSX/*.xcworkspace/xcuserdata/
|
||||
**/.DS_Store
|
||||
|
||||
# Visual C++ cache files
|
||||
|
|
|
@ -793,7 +793,7 @@
|
|||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Library/ScriptingAdditions/LiferayNativity.osax/Contents</string>
|
||||
<string>Library/ScriptingAdditions/OwnCloudFinder.osax/Contents</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>3</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
|
@ -807,7 +807,7 @@
|
|||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>LiferayNativity.osax</string>
|
||||
<string>OwnCloudFinder.osax</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
if(APPLE)
|
||||
add_custom_target( mac_overlayplugin ALL
|
||||
xcodebuild -workspace ${CMAKE_SOURCE_DIR}/shell_integration/MacOSX/LiferayNativity.xcworkspace
|
||||
-scheme LiferayNativity.osax SYMROOT=${CMAKE_CURRENT_BINARY_DIR} archive
|
||||
xcodebuild -workspace ${CMAKE_SOURCE_DIR}/shell_integration/MacOSX/OwnCloud.xcworkspace
|
||||
-scheme OwnCloudFinder.osax SYMROOT=${CMAKE_CURRENT_BINARY_DIR} archive
|
||||
COMMENT building Mac Overlay iccons)
|
||||
|
||||
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Release/LiferayNativity.osax/Contents
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/Library/ScriptingAdditions/LiferayNativity.osax/ )
|
||||
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Release/OwnCloudFinder.osax/Contents
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/Library/ScriptingAdditions/OwnCloudFinder.osax/ )
|
||||
endif(APPLE)
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:LiferayNativityFinder/LiferayNativityFinder.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:LiferayNativityInjector/LiferayNativityInjector.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "0"
|
||||
version = "1.0">
|
||||
<FileBreakpoints>
|
||||
<FileBreakpoint
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "LiferayNativityFinder/ContentManager.m"
|
||||
timestampString = "426161859.780288"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "90"
|
||||
endingLineNumber = "90"
|
||||
landmarkName = "-setResultForPath:result:"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
</FileBreakpoints>
|
||||
</Bucket>
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSObject (ContextMenuHandlers)
|
||||
|
||||
struct TFENodeVector;
|
||||
|
||||
+ (void)ContextMenuHandlers_handleContextMenuCommon:(unsigned int)arg1 nodes:(const struct TFENodeVector*)arg2 event:(id)arg3 view:(id)arg4 browserController:(id)arg5 addPlugIns:(BOOL)arg6;
|
||||
+ (void)ContextMenuHandlers_handleContextMenuCommon:(unsigned int)arg1 nodes:(const struct TFENodeVector*)arg2 event:(id)arg3 view:(id)arg4 windowController:(id)arg5 addPlugIns:(BOOL)arg6;
|
||||
+ (void)ContextMenuHandlers_addViewSpecificStuffToMenu:(id)arg1 browserViewController:(id)arg2 context:(unsigned int)arg3;
|
||||
|
||||
- (void)ContextMenuHandlers_configureWithNodes:(const struct TFENodeVector*)arg1 browserController:(id)arg2 container:(BOOL)arg3;
|
||||
- (void)ContextMenuHandlers_configureWithNodes:(const struct TFENodeVector*)arg1 windowController:(id)arg2 container:(BOOL)arg3;
|
||||
|
||||
@end
|
Binary file not shown.
Binary file not shown.
|
@ -1,125 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#import "ContentManager.h"
|
||||
#import "FinderHook.h"
|
||||
#import "IconCache.h"
|
||||
#import "objc/objc-class.h"
|
||||
#import "RequestManager.h"
|
||||
|
||||
static BOOL installed = NO;
|
||||
|
||||
@implementation FinderHook
|
||||
|
||||
+ (void)hookClassMethod:(SEL)oldSelector inClass:(NSString*)className toCallToTheNewMethod:(SEL)newSelector
|
||||
{
|
||||
Class hookedClass = NSClassFromString(className);
|
||||
Method oldMethod = class_getClassMethod(hookedClass, oldSelector);
|
||||
Method newMethod = class_getClassMethod(hookedClass, newSelector);
|
||||
|
||||
method_exchangeImplementations(newMethod, oldMethod);
|
||||
}
|
||||
|
||||
+ (void)hookMethod:(SEL)oldSelector inClass:(NSString*)className toCallToTheNewMethod:(SEL)newSelector
|
||||
{
|
||||
Class hookedClass = NSClassFromString(className);
|
||||
Method oldMethod = class_getInstanceMethod(hookedClass, oldSelector);
|
||||
Method newMethod = class_getInstanceMethod(hookedClass, newSelector);
|
||||
|
||||
method_exchangeImplementations(newMethod, oldMethod);
|
||||
}
|
||||
|
||||
+ (void)install
|
||||
{
|
||||
if (installed)
|
||||
{
|
||||
NSLog(@"LiferayNativityFinder: already installed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog(@"LiferayNativityFinder: installing ownCloud Shell extension");
|
||||
|
||||
[RequestManager sharedInstance];
|
||||
|
||||
// Icons
|
||||
[self hookMethod:@selector(drawImage:) inClass:@"IKImageBrowserCell" toCallToTheNewMethod:@selector(IconOverlayHandlers_IKImageBrowserCell_drawImage:)]; // 10.7 & 10.8 & 10.9 (Icon View arrange by name)
|
||||
|
||||
[self hookMethod:@selector(drawImage:) inClass:@"IKFinderReflectiveIconCell" toCallToTheNewMethod:@selector(IconOverlayHandlers_IKFinderReflectiveIconCell_drawImage:)]; // 10.7 & 10.8 & 10.9 (Icon View arrange by everything else)
|
||||
|
||||
[self hookMethod:@selector(drawIconWithFrame:) inClass:@"TListViewIconAndTextCell" toCallToTheNewMethod:@selector(IconOverlayHandlers_drawIconWithFrame:)]; // 10.7 & 10.8 & 10.9 Column View
|
||||
|
||||
[self hookMethod:@selector(drawRect:) inClass:@"TDimmableIconImageView" toCallToTheNewMethod:@selector(IconOverlayHandlers_drawRect:)]; // 10.9 (List and Coverflow Views)
|
||||
|
||||
// Context Menus
|
||||
[self hookClassMethod:@selector(addViewSpecificStuffToMenu:browserViewController:context:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_addViewSpecificStuffToMenu:browserViewController:context:)]; // 10.7 & 10.8
|
||||
|
||||
[self hookClassMethod:@selector(addViewSpecificStuffToMenu:clickedView:browserViewController:context:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_addViewSpecificStuffToMenu:clickedView:browserViewController:context:)]; // 10.9
|
||||
|
||||
[self hookClassMethod:@selector(handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:)]; // 10.7
|
||||
|
||||
[self hookClassMethod:@selector(handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:)]; // 10.8
|
||||
|
||||
[self hookClassMethod:@selector(handleContextMenuCommon:nodes:event:clickedView:browserViewController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_handleContextMenuCommon:nodes:event:clickedView:browserViewController:addPlugIns:)]; // 10.9
|
||||
|
||||
[self hookMethod:@selector(configureWithNodes:windowController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_configureWithNodes:windowController:container:)]; // 10.7
|
||||
|
||||
[self hookMethod:@selector(configureWithNodes:browserController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_configureWithNodes:browserController:container:)]; // 10.8
|
||||
|
||||
[self hookMethod:@selector(configureFromMenuNeedsUpdate:clickedView:container:event:selectedNodes:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(ContextMenuHandlers_configureFromMenuNeedsUpdate:clickedView:container:event:selectedNodes:)]; // 10.9
|
||||
|
||||
installed = YES;
|
||||
|
||||
NSLog(@"LiferayNativityFinder: installed");
|
||||
}
|
||||
|
||||
+ (void)uninstall
|
||||
{
|
||||
if (!installed)
|
||||
{
|
||||
NSLog(@"LiferayNativityFinder: not installed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog(@"LiferayNativityFinder: uninstalling");
|
||||
|
||||
[[ContentManager sharedInstance] dealloc];
|
||||
|
||||
[[IconCache sharedInstance] dealloc];
|
||||
|
||||
[[RequestManager sharedInstance] dealloc];
|
||||
|
||||
// Icons
|
||||
[self hookMethod:@selector(IconOverlayHandlers_drawImage:) inClass:@"TIconViewCell" toCallToTheNewMethod:@selector(drawImage:)]; // 10.7 & 10.8 & 10.9
|
||||
|
||||
[self hookMethod:@selector(IconOverlayHandlers_drawIconWithFrame:) inClass:@"TListViewIconAndTextCell" toCallToTheNewMethod:@selector(drawIconWithFrame:)]; // 10.7 & 10.8 & 10.9
|
||||
|
||||
// Context Menus
|
||||
[self hookClassMethod:@selector(ContextMenuHandlers_addViewSpecificStuffToMenu:browserViewController:context:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(addViewSpecificStuffToMenu:browserViewController:context:)]; // 10.7 & 10.8
|
||||
|
||||
[self hookClassMethod:@selector(ContextMenuHandlers_handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:)]; // 10.7
|
||||
|
||||
[self hookMethod:@selector(ContextMenuHandlers_configureWithNodes:windowController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(configureWithNodes:windowController:container:)]; // 10.7
|
||||
|
||||
[self hookClassMethod:@selector(ContextMenuHandlers_handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:)]; // 10.8
|
||||
|
||||
[self hookMethod:@selector(ContextMenuHandlers_configureWithNodes:browserController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(configureWithNodes:browserController:container:)]; // 10.8
|
||||
|
||||
installed = NO;
|
||||
|
||||
NSLog(@"LiferayNativityFinder: uninstalled");
|
||||
}
|
||||
|
||||
@end
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
|
||||
<dictionary title="LiferayNativityInjector Terminology">
|
||||
<suite name="LiferayNativityInjector Suite" code="NVTY" description="LiferayNativity Injector commands">
|
||||
<command name="install LiferayNativity" code="NVTYload" description="Loads LiferayNativity into the Finder process"/>
|
||||
<command name="uninstall LiferayNativity" code="NVTYunld" description="Unloads LiferayNativity from the Finder process"/>
|
||||
<command name="check LiferayNativity" code="NVTYlded" description="Checks if LiferayNativity is loaded in Finder process"/>
|
||||
</suite>
|
||||
</dictionary>
|
10
shell_integration/MacOSX/OwnCloud.xcworkspace/contents.xcworkspacedata
generated
Normal file
10
shell_integration/MacOSX/OwnCloud.xcworkspace/contents.xcworkspacedata
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:OwnCloudFinder/OwnCloudFinder.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:OwnCloudInjector/OwnCloudInjector.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -0,0 +1,41 @@
|
|||
<?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>IDESourceControlProjectFavoriteDictionaryKey</key>
|
||||
<false/>
|
||||
<key>IDESourceControlProjectIdentifier</key>
|
||||
<string>5264E8F5-AB49-45F3-868F-647EEFAB70E0</string>
|
||||
<key>IDESourceControlProjectName</key>
|
||||
<string>OwnCloud</string>
|
||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||
<dict>
|
||||
<key>09EE94AA-F410-4594-AB26-5A0220DEAEC7</key>
|
||||
<string>ssh://github.com/owncloud/mirall.git</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectPath</key>
|
||||
<string>shell_integration/MacOSX/OwnCloud.xcworkspace</string>
|
||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||
<dict>
|
||||
<key>09EE94AA-F410-4594-AB26-5A0220DEAEC7</key>
|
||||
<string>../../..</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectURL</key>
|
||||
<string>ssh://github.com/owncloud/mirall.git</string>
|
||||
<key>IDESourceControlProjectVersion</key>
|
||||
<integer>110</integer>
|
||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||
<string>09EE94AA-F410-4594-AB26-5A0220DEAEC7</string>
|
||||
<key>IDESourceControlProjectWCConfigurations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>09EE94AA-F410-4594-AB26-5A0220DEAEC7</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>mirall</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -237,7 +237,7 @@ static ContentManager* sharedInstance = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"LiferayNativityFinder: refreshing icon badges failed");
|
||||
NSLog(@"OwnCloudFinder: refreshing icon badges failed");
|
||||
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSObject (ContextMenuHandlers)
|
||||
|
||||
struct TFENodeVector;
|
||||
|
||||
+ (void)OCContextMenuHandlers_handleContextMenuCommon:(unsigned int)arg1 nodes:(const struct TFENodeVector*)arg2 event:(id)arg3 view:(id)arg4 browserController:(id)arg5 addPlugIns:(BOOL)arg6;
|
||||
+ (void)OCContextMenuHandlers_handleContextMenuCommon:(unsigned int)arg1 nodes:(const struct TFENodeVector*)arg2 event:(id)arg3 view:(id)arg4 windowController:(id)arg5 addPlugIns:(BOOL)arg6;
|
||||
+ (void)OCContextMenuHandlers_addViewSpecificStuffToMenu:(id)arg1 browserViewController:(id)arg2 context:(unsigned int)arg3;
|
||||
|
||||
- (void)OCContextMenuHandlers_configureWithNodes:(const struct TFENodeVector*)arg1 browserController:(id)arg2 container:(BOOL)arg3;
|
||||
- (void)OCContextMenuHandlers_configureWithNodes:(const struct TFENodeVector*)arg1 windowController:(id)arg2 container:(BOOL)arg3;
|
||||
|
||||
@end
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
@implementation NSObject (ContextMenuHandlers)
|
||||
|
||||
+ (void)ContextMenuHandlers_addViewSpecificStuffToMenu:(id)arg1 browserViewController:(id)arg2 context:(unsigned int)arg3 // 10.7 & 10.8
|
||||
+ (void)OCContextMenuHandlers_addViewSpecificStuffToMenu:(id)arg1 browserViewController:(id)arg2 context:(unsigned int)arg3 // 10.7 & 10.8
|
||||
{
|
||||
[self ContextMenuHandlers_addViewSpecificStuffToMenu:arg1 browserViewController:arg2 context:arg3];
|
||||
[self OCContextMenuHandlers_addViewSpecificStuffToMenu:arg1 browserViewController:arg2 context:arg3];
|
||||
|
||||
MenuManager* menuManager = [MenuManager sharedInstance];
|
||||
|
||||
|
@ -30,9 +30,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
+ (void)ContextMenuHandlers_addViewSpecificStuffToMenu:(id)arg1 clickedView:(id)arg2 browserViewController:(id)arg3 context:(unsigned int)arg4 // 10.9
|
||||
+ (void)OCContextMenuHandlers_addViewSpecificStuffToMenu:(id)arg1 clickedView:(id)arg2 browserViewController:(id)arg3 context:(unsigned int)arg4 // 10.9
|
||||
{
|
||||
[self ContextMenuHandlers_addViewSpecificStuffToMenu:arg1 clickedView:arg2 browserViewController:arg3 context:arg4];
|
||||
[self OCContextMenuHandlers_addViewSpecificStuffToMenu:arg1 clickedView:arg2 browserViewController:arg3 context:arg4];
|
||||
|
||||
MenuManager* menuManager = [MenuManager sharedInstance];
|
||||
|
125
shell_integration/MacOSX/OwnCloudFinder/FinderHook.m
Normal file
125
shell_integration/MacOSX/OwnCloudFinder/FinderHook.m
Normal file
|
@ -0,0 +1,125 @@
|
|||
/**
|
||||
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
#import "ContentManager.h"
|
||||
#import "FinderHook.h"
|
||||
#import "IconCache.h"
|
||||
#import "objc/objc-class.h"
|
||||
#import "RequestManager.h"
|
||||
|
||||
static BOOL installed = NO;
|
||||
|
||||
@implementation FinderHook
|
||||
|
||||
+ (void)hookClassMethod:(SEL)oldSelector inClass:(NSString*)className toCallToTheNewMethod:(SEL)newSelector
|
||||
{
|
||||
Class hookedClass = NSClassFromString(className);
|
||||
Method oldMethod = class_getClassMethod(hookedClass, oldSelector);
|
||||
Method newMethod = class_getClassMethod(hookedClass, newSelector);
|
||||
|
||||
method_exchangeImplementations(newMethod, oldMethod);
|
||||
}
|
||||
|
||||
+ (void)hookMethod:(SEL)oldSelector inClass:(NSString*)className toCallToTheNewMethod:(SEL)newSelector
|
||||
{
|
||||
Class hookedClass = NSClassFromString(className);
|
||||
Method oldMethod = class_getInstanceMethod(hookedClass, oldSelector);
|
||||
Method newMethod = class_getInstanceMethod(hookedClass, newSelector);
|
||||
|
||||
method_exchangeImplementations(newMethod, oldMethod);
|
||||
}
|
||||
|
||||
+ (void)install
|
||||
{
|
||||
if (installed)
|
||||
{
|
||||
NSLog(@"OwnCloudFinder: already installed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog(@"OwnCloudFinder: installing ownCloud Shell extension");
|
||||
|
||||
[RequestManager sharedInstance];
|
||||
|
||||
// Icons
|
||||
[self hookMethod:@selector(drawImage:) inClass:@"IKImageBrowserCell" toCallToTheNewMethod:@selector(OCIconOverlayHandlers_IKImageBrowserCell_drawImage:)]; // 10.7 & 10.8 & 10.9 (Icon View arrange by name)
|
||||
|
||||
[self hookMethod:@selector(drawImage:) inClass:@"IKFinderReflectiveIconCell" toCallToTheNewMethod:@selector(OCIconOverlayHandlers_IKFinderReflectiveIconCell_drawImage:)]; // 10.7 & 10.8 & 10.9 (Icon View arrange by everything else)
|
||||
|
||||
[self hookMethod:@selector(drawIconWithFrame:) inClass:@"TListViewIconAndTextCell" toCallToTheNewMethod:@selector(OCIconOverlayHandlers_drawIconWithFrame:)]; // 10.7 & 10.8 & 10.9 Column View
|
||||
|
||||
[self hookMethod:@selector(drawRect:) inClass:@"TDimmableIconImageView" toCallToTheNewMethod:@selector(OCIconOverlayHandlers_drawRect:)]; // 10.9 (List and Coverflow Views)
|
||||
|
||||
// Context Menus
|
||||
[self hookClassMethod:@selector(addViewSpecificStuffToMenu:browserViewController:context:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_addViewSpecificStuffToMenu:browserViewController:context:)]; // 10.7 & 10.8
|
||||
|
||||
[self hookClassMethod:@selector(addViewSpecificStuffToMenu:clickedView:browserViewController:context:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_addViewSpecificStuffToMenu:clickedView:browserViewController:context:)]; // 10.9
|
||||
|
||||
[self hookClassMethod:@selector(handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:)]; // 10.7
|
||||
|
||||
[self hookClassMethod:@selector(handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:)]; // 10.8
|
||||
|
||||
[self hookClassMethod:@selector(handleContextMenuCommon:nodes:event:clickedView:browserViewController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_handleContextMenuCommon:nodes:event:clickedView:browserViewController:addPlugIns:)]; // 10.9
|
||||
|
||||
[self hookMethod:@selector(configureWithNodes:windowController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_configureWithNodes:windowController:container:)]; // 10.7
|
||||
|
||||
[self hookMethod:@selector(configureWithNodes:browserController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_configureWithNodes:browserController:container:)]; // 10.8
|
||||
|
||||
[self hookMethod:@selector(configureFromMenuNeedsUpdate:clickedView:container:event:selectedNodes:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(OCContextMenuHandlers_configureFromMenuNeedsUpdate:clickedView:container:event:selectedNodes:)]; // 10.9
|
||||
|
||||
installed = YES;
|
||||
|
||||
NSLog(@"OwnCloudFinder: installed");
|
||||
}
|
||||
|
||||
+ (void)uninstall
|
||||
{
|
||||
if (!installed)
|
||||
{
|
||||
NSLog(@"OwnCloudFinder: not installed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog(@"OwnCloudFinder: uninstalling");
|
||||
|
||||
[[ContentManager sharedInstance] dealloc];
|
||||
|
||||
[[IconCache sharedInstance] dealloc];
|
||||
|
||||
[[RequestManager sharedInstance] dealloc];
|
||||
|
||||
// Icons
|
||||
[self hookMethod:@selector(OCIconOverlayHandlers_drawImage:) inClass:@"TIconViewCell" toCallToTheNewMethod:@selector(drawImage:)]; // 10.7 & 10.8 & 10.9
|
||||
|
||||
[self hookMethod:@selector(OCIconOverlayHandlers_drawIconWithFrame:) inClass:@"TListViewIconAndTextCell" toCallToTheNewMethod:@selector(drawIconWithFrame:)]; // 10.7 & 10.8 & 10.9
|
||||
|
||||
// Context Menus
|
||||
[self hookClassMethod:@selector(OCContextMenuHandlers_addViewSpecificStuffToMenu:browserViewController:context:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(addViewSpecificStuffToMenu:browserViewController:context:)]; // 10.7 & 10.8
|
||||
|
||||
[self hookClassMethod:@selector(OCContextMenuHandlers_handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(handleContextMenuCommon:nodes:event:view:windowController:addPlugIns:)]; // 10.7
|
||||
|
||||
[self hookMethod:@selector(OCContextMenuHandlers_configureWithNodes:windowController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(configureWithNodes:windowController:container:)]; // 10.7
|
||||
|
||||
[self hookClassMethod:@selector(OCContextMenuHandlers_handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(handleContextMenuCommon:nodes:event:view:browserController:addPlugIns:)]; // 10.8
|
||||
|
||||
[self hookMethod:@selector(OCContextMenuHandlers_configureWithNodes:browserController:container:) inClass:@"TContextMenu" toCallToTheNewMethod:@selector(configureWithNodes:browserController:container:)]; // 10.8
|
||||
|
||||
installed = NO;
|
||||
|
||||
NSLog(@"OwnCloudFinder: uninstalled");
|
||||
}
|
||||
|
||||
@end
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
@interface NSObject (IconOverlayHandlers)
|
||||
|
||||
- (void)IconOverlayHandlers_drawIconWithFrame:(struct CGRect)arg1;
|
||||
- (void)IconOverlayHandlers_drawImage:(id)arg1;
|
||||
- (void)IconOverlayHandlers_drawRect:(struct CGRect)arg1;
|
||||
- (void)OCIconOverlayHandlers_drawIconWithFrame:(struct CGRect)arg1;
|
||||
- (void)OCIconOverlayHandlers_drawImage:(id)arg1;
|
||||
- (void)OCIconOverlayHandlers_drawRect:(struct CGRect)arg1;
|
||||
|
||||
@end
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
- (void)IconOverlayHandlers_drawIconWithFrame:(struct CGRect)arg1
|
||||
{
|
||||
[self IconOverlayHandlers_drawIconWithFrame:arg1];
|
||||
[self OCIconOverlayHandlers_drawIconWithFrame:arg1];
|
||||
|
||||
NSURL* url = [[NSClassFromString(@"FINode") nodeFromNodeRef:[(TIconAndTextCell*)self node]->fNodeRef] previewItemURL];
|
||||
|
||||
|
@ -48,21 +48,21 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)IconOverlayHandlers_IKImageBrowserCell_drawImage:(id)arg1
|
||||
- (void)OCIconOverlayHandlers_IKImageBrowserCell_drawImage:(id)arg1
|
||||
{
|
||||
IKImageWrapper*imageWrapper = [self IconOverlayHandlers_imageWrapper:arg1];
|
||||
IKImageWrapper*imageWrapper = [self OCIconOverlayHandlers_imageWrapper:arg1];
|
||||
|
||||
[self IconOverlayHandlers_IKImageBrowserCell_drawImage:imageWrapper];
|
||||
[self OCIconOverlayHandlers_IKImageBrowserCell_drawImage:imageWrapper];
|
||||
}
|
||||
|
||||
- (void)IconOverlayHandlers_IKFinderReflectiveIconCell_drawImage:(id)arg1
|
||||
- (void)OCIconOverlayHandlers_IKFinderReflectiveIconCell_drawImage:(id)arg1
|
||||
{
|
||||
IKImageWrapper*imageWrapper = [self IconOverlayHandlers_imageWrapper:arg1];
|
||||
IKImageWrapper*imageWrapper = [self OCIconOverlayHandlers_imageWrapper:arg1];
|
||||
|
||||
[self IconOverlayHandlers_IKFinderReflectiveIconCell_drawImage:imageWrapper];
|
||||
[self OCIconOverlayHandlers_IKFinderReflectiveIconCell_drawImage:imageWrapper];
|
||||
}
|
||||
|
||||
- (IKImageWrapper*)IconOverlayHandlers_imageWrapper:(id)arg1
|
||||
- (IKImageWrapper*)OCIconOverlayHandlers_imageWrapper:(id)arg1
|
||||
{
|
||||
TIconViewCell* realSelf = (TIconViewCell*)self;
|
||||
FINode* node = (FINode*)[realSelf representedItem];
|
||||
|
@ -111,9 +111,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)IconOverlayHandlers_drawRect:(struct CGRect)arg1
|
||||
- (void)OCIconOverlayHandlers_drawRect:(struct CGRect)arg1
|
||||
{
|
||||
[self IconOverlayHandlers_drawRect:arg1];
|
||||
[self OCIconOverlayHandlers_drawRect:arg1];
|
||||
|
||||
NSView* supersuperview = [[(NSView*)self superview] superview];
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>FinderHook</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
@ -11,7 +9,7 @@
|
|||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.liferay.nativity</string>
|
||||
<string>com.owncloud.finder</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
@ -42,5 +40,7 @@
|
|||
</dict>
|
||||
<key>CFPlugInUnloadFunction</key>
|
||||
<string></string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>FinderHook</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -48,7 +48,7 @@
|
|||
8C37DDB9161594B400016A95 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
|
||||
8C99F6921622D145002D2135 /* IconCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconCache.h; sourceTree = "<group>"; };
|
||||
8C99F6931622D145002D2135 /* IconCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IconCache.m; sourceTree = "<group>"; };
|
||||
8D576316048677EA00EA77CD /* LiferayNativityFinder.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LiferayNativityFinder.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D576316048677EA00EA77CD /* OwnCloudFinder.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OwnCloudFinder.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
089C166AFE841209C02AAC07 /* LiferayNativityFinder */ = {
|
||||
089C166AFE841209C02AAC07 /* OwnCloudFinder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB77AFFE84173DC02AAC07 /* Source */,
|
||||
|
@ -75,7 +75,7 @@
|
|||
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
|
||||
19C28FB6FE9D52B211CA2CBB /* Products */,
|
||||
);
|
||||
name = LiferayNativityFinder;
|
||||
name = OwnCloudFinder;
|
||||
sourceTree = "<group>";
|
||||
usesTabs = 1;
|
||||
};
|
||||
|
@ -152,7 +152,7 @@
|
|||
19C28FB6FE9D52B211CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8D576316048677EA00EA77CD /* LiferayNativityFinder.bundle */,
|
||||
8D576316048677EA00EA77CD /* OwnCloudFinder.bundle */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -160,9 +160,9 @@
|
|||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8D57630D048677EA00EA77CD /* LiferayNativityFinder */ = {
|
||||
8D57630D048677EA00EA77CD /* OwnCloudFinder */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "LiferayNativityFinder" */;
|
||||
buildConfigurationList = 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "OwnCloudFinder" */;
|
||||
buildPhases = (
|
||||
8D57630F048677EA00EA77CD /* Resources */,
|
||||
8D576311048677EA00EA77CD /* Sources */,
|
||||
|
@ -172,10 +172,10 @@
|
|||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = LiferayNativityFinder;
|
||||
name = OwnCloudFinder;
|
||||
productInstallPath = "$(HOME)/Library/Bundles";
|
||||
productName = LiferayNativityFinder;
|
||||
productReference = 8D576316048677EA00EA77CD /* LiferayNativityFinder.bundle */;
|
||||
productName = OwnCloudFinder;
|
||||
productReference = 8D576316048677EA00EA77CD /* OwnCloudFinder.bundle */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
@ -186,7 +186,7 @@
|
|||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
};
|
||||
buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "LiferayNativityFinder" */;
|
||||
buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "OwnCloudFinder" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
|
@ -196,11 +196,11 @@
|
|||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 089C166AFE841209C02AAC07 /* LiferayNativityFinder */;
|
||||
mainGroup = 089C166AFE841209C02AAC07 /* OwnCloudFinder */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8D57630D048677EA00EA77CD /* LiferayNativityFinder */,
|
||||
8D57630D048677EA00EA77CD /* OwnCloudFinder */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
@ -260,7 +260,7 @@
|
|||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Library/Bundles";
|
||||
PRODUCT_NAME = LiferayNativityFinder;
|
||||
PRODUCT_NAME = OwnCloudFinder;
|
||||
WRAPPER_EXTENSION = bundle;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -277,7 +277,7 @@
|
|||
GCC_MODEL_TUNING = G5;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Library/Bundles";
|
||||
PRODUCT_NAME = LiferayNativityFinder;
|
||||
PRODUCT_NAME = OwnCloudFinder;
|
||||
WRAPPER_EXTENSION = bundle;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -315,7 +315,7 @@
|
|||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "LiferayNativityFinder" */ = {
|
||||
1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "OwnCloudFinder" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB911B08733D790010E9CD /* Debug */,
|
||||
|
@ -324,7 +324,7 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "LiferayNativityFinder" */ = {
|
||||
1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "OwnCloudFinder" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB911F08733D790010E9CD /* Debug */,
|
|
@ -2,6 +2,6 @@
|
|||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:LiferayNativityFinder.xcodeproj">
|
||||
location = "self:OwnCloudFinder.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -217,7 +217,7 @@ static RequestManager* sharedInstance = nil;
|
|||
{
|
||||
NSLog(@"Connect Socket!");
|
||||
NSError *err = nil;
|
||||
if (![_socket connectToHost:@"localhost" onPort:33001 withTimeout:5 error:&err]) // Asynchronous!
|
||||
if (![_socket connectToHost:@"localhost" onPort:34001 withTimeout:5 error:&err]) // Asynchronous!
|
||||
{
|
||||
// If there was an error, it's likely something like "already connected" or "no delegate set"
|
||||
NSLog(@"I goofed: %@", err);
|
|
@ -7,51 +7,51 @@
|
|||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.liferay.nativity</string>
|
||||
<string>com.owncloud.injector</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>LiferayNativityInjector</string>
|
||||
<string>OwnCloudInjector</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>osax</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>NVTY</string>
|
||||
<string>OWNC</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.2</string>
|
||||
<key>OSAScriptingDefinition</key>
|
||||
<string>LiferayNativityInjector.sdef</string>
|
||||
<string>OwnCloudInjector.sdef</string>
|
||||
<key>OSAXHandlers</key>
|
||||
<dict>
|
||||
<key>Events</key>
|
||||
<dict>
|
||||
<key>NVTYload</key>
|
||||
<dict>
|
||||
<key>Handler</key>
|
||||
<string>HandleLoadEvent</string>
|
||||
<key>ThreadSafe</key>
|
||||
<false/>
|
||||
<key>Context</key>
|
||||
<string>Process</string>
|
||||
</dict>
|
||||
<key>NVTYunld</key>
|
||||
<dict>
|
||||
<key>Handler</key>
|
||||
<string>HandleUnloadEvent</string>
|
||||
<key>ThreadSafe</key>
|
||||
<false/>
|
||||
<key>Context</key>
|
||||
<string>Process</string>
|
||||
</dict>
|
||||
<key>NVTYlded</key>
|
||||
<dict>
|
||||
<key>Context</key>
|
||||
<string>Process</string>
|
||||
<key>Handler</key>
|
||||
<string>HandleLoadedEvent</string>
|
||||
<key>ThreadSafe</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>NVTYload</key>
|
||||
<dict>
|
||||
<key>Context</key>
|
||||
<string>Process</string>
|
||||
<key>Handler</key>
|
||||
<string>HandleLoadEvent</string>
|
||||
<key>ThreadSafe</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>NVTYunld</key>
|
||||
<dict>
|
||||
<key>Context</key>
|
||||
<string>Process</string>
|
||||
<key>Handler</key>
|
||||
<string>HandleUnloadEvent</string>
|
||||
<key>ThreadSafe</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
|
@ -7,27 +7,27 @@
|
|||
#define WAIT_FOR_APPLE_EVENT_TO_ENTER_HANDLER_IN_SECONDS 1.0
|
||||
#define FINDER_MIN_TESTED_VERSION @"10.7"
|
||||
#define FINDER_MAX_TESTED_VERSION @"10.8.5"
|
||||
#define LIFERAYNATIVITY_INJECTED_NOTIFICATION @"LiferayNativityInjectedNotification"
|
||||
#define LIFERAYNATIVITY_INJECTED_NOTIFICATION @"OwnCloudInjectedNotification"
|
||||
|
||||
EXPORT OSErr HandleLoadEvent(const AppleEvent* ev, AppleEvent* reply, long refcon);
|
||||
|
||||
static NSString* globalLock = @"I'm the global lock to prevent concruent handler executions";
|
||||
|
||||
// SIMBL-compatible interface
|
||||
@interface LiferayNativityShell : NSObject { }
|
||||
@interface OwnCloudShell : NSObject { }
|
||||
-(void) install;
|
||||
-(void) uninstall;
|
||||
@end
|
||||
|
||||
// just a dummy class for locating our bundle
|
||||
@interface LiferayNativityInjector : NSObject { }
|
||||
@interface OwnCloudInjector : NSObject { }
|
||||
@end
|
||||
|
||||
@implementation LiferayNativityInjector { }
|
||||
@implementation OwnCloudInjector { }
|
||||
@end
|
||||
|
||||
static bool liferayNativityLoaded = false;
|
||||
static NSString* liferayNativityBundleName = @"LiferayNativityFinder";
|
||||
static NSString* liferayNativityBundleName = @"OwnCloudFinder";
|
||||
|
||||
typedef struct {
|
||||
NSString* location;
|
||||
|
@ -128,7 +128,7 @@ static OSErr loadBundle(LNBundleType type, AppleEvent* reply, long refcon) {
|
|||
}
|
||||
}
|
||||
|
||||
NSBundle* liferayNativityInjectorBundle = [NSBundle bundleForClass:[LiferayNativityInjector class]];
|
||||
NSBundle* liferayNativityInjectorBundle = [NSBundle bundleForClass:[OwnCloudInjector class]];
|
||||
NSString* liferayNativityLocation = [liferayNativityInjectorBundle pathForResource:bundleName ofType:@"bundle"];
|
||||
NSBundle* pluginBundle = [NSBundle bundleWithPath:liferayNativityLocation];
|
||||
if (!pluginBundle) {
|
||||
|
@ -182,11 +182,11 @@ static LNBundleType mainBundleType(AppleEvent* reply) {
|
|||
EXPORT OSErr HandleLoadEvent(const AppleEvent* ev, AppleEvent* reply, long refcon) {
|
||||
@synchronized(globalLock) {
|
||||
@autoreleasepool {
|
||||
NSBundle* injectorBundle = [NSBundle bundleForClass:[LiferayNativityInjector class]];
|
||||
NSBundle* injectorBundle = [NSBundle bundleForClass:[OwnCloudInjector class]];
|
||||
NSString* injectorVersion = [injectorBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
|
||||
|
||||
if (!injectorVersion || ![injectorVersion isKindOfClass:[NSString class]]) {
|
||||
reportError(reply, [NSString stringWithFormat:@"Unable to determine LiferayNativityInjector version!"]);
|
||||
reportError(reply, [NSString stringWithFormat:@"Unable to determine OwnCloudInjector version!"]);
|
||||
return 7;
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ EXPORT OSErr HandleLoadEvent(const AppleEvent* ev, AppleEvent* reply, long refco
|
|||
|
||||
return noErr;
|
||||
} @catch (NSException* exception) {
|
||||
reportError(reply, [NSString stringWithFormat:@"Failed to load LiferayNativity with exception: %@", exception]);
|
||||
reportError(reply, [NSString stringWithFormat:@"Failed to load OwnCloudFinder with exception: %@", exception]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -232,13 +232,13 @@ EXPORT OSErr HandleUnloadEvent(const AppleEvent* ev, AppleEvent* reply, long ref
|
|||
@autoreleasepool {
|
||||
@try {
|
||||
if (!liferayNativityLoaded) {
|
||||
NSLog(@"LiferayNativityInjector: not loaded.");
|
||||
NSLog(@"OwnCloudInjector: not loaded.");
|
||||
return noErr;
|
||||
}
|
||||
|
||||
NSString* bundleName = liferayNativityBundleName;
|
||||
|
||||
NSBundle* liferayNativityInjectorBundle = [NSBundle bundleForClass:[LiferayNativityInjector class]];
|
||||
NSBundle* liferayNativityInjectorBundle = [NSBundle bundleForClass:[OwnCloudInjector class]];
|
||||
NSString* liferayNativityLocation = [liferayNativityInjectorBundle pathForResource:bundleName ofType:@"bundle"];
|
||||
NSBundle* pluginBundle = [NSBundle bundleWithPath:liferayNativityLocation];
|
||||
if (!pluginBundle) {
|
||||
|
@ -261,7 +261,7 @@ EXPORT OSErr HandleUnloadEvent(const AppleEvent* ev, AppleEvent* reply, long ref
|
|||
|
||||
return noErr;
|
||||
} @catch (NSException* exception) {
|
||||
reportError(reply, [NSString stringWithFormat:@"Failed to unload LiferayNativity with exception: %@", exception]);
|
||||
reportError(reply, [NSString stringWithFormat:@"Failed to unload OwnCloudFinder with exception: %@", exception]);
|
||||
}
|
||||
|
||||
return 1;
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
|
||||
<dictionary title="OwnCloudInjector Terminology">
|
||||
<suite name="OwnCloudInjector Suite" code="OWNC" description="OwnCloud Injector commands">
|
||||
<command name="install OwnCloud" code="OWNCload" description="Loads OwnCloud into the Finder process"/>
|
||||
<command name="uninstall OwnCloud" code="OWNCunld" description="Unloads OwnCloud from the Finder process"/>
|
||||
<command name="check OwnCloud" code="OWNClded" description="Checks if OwnCloud is loaded in Finder process"/>
|
||||
</suite>
|
||||
</dictionary>
|
|
@ -7,27 +7,27 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
0B36CB92182461A10039B237 /* LiferayNativityFinder.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0B36CB91182461A10039B237 /* LiferayNativityFinder.bundle */; };
|
||||
0B36CB92182461A10039B237 /* OwnCloudFinder.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0B36CB91182461A10039B237 /* OwnCloudFinder.bundle */; };
|
||||
0BD9C38E1778EF450094CF5D /* license.txt in Resources */ = {isa = PBXBuildFile; fileRef = 0BD9C38D1778EF450094CF5D /* license.txt */; };
|
||||
8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; };
|
||||
8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
|
||||
D6ACBEA2117B7D5600F6691C /* LiferayNativityInjector.m in Sources */ = {isa = PBXBuildFile; fileRef = D6ACBE9E117B7D5600F6691C /* LiferayNativityInjector.m */; };
|
||||
D6ACBEA2117B7D5600F6691C /* OwnCloudInjector.m in Sources */ = {isa = PBXBuildFile; fileRef = D6ACBE9E117B7D5600F6691C /* OwnCloudInjector.m */; };
|
||||
D6ACBEA3117B7D5600F6691C /* LNStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = D6ACBEA0117B7D5600F6691C /* LNStandardVersionComparator.m */; };
|
||||
D6ACBEA5117B7D6100F6691C /* LiferayNativityInjector.sdef in Resources */ = {isa = PBXBuildFile; fileRef = D6ACBEA4117B7D6100F6691C /* LiferayNativityInjector.sdef */; };
|
||||
D6ACBEA5117B7D6100F6691C /* OwnCloudInjector.sdef in Resources */ = {isa = PBXBuildFile; fileRef = D6ACBEA4117B7D6100F6691C /* OwnCloudInjector.sdef */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
|
||||
0B36CB91182461A10039B237 /* LiferayNativityFinder.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = LiferayNativityFinder.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0B36CB91182461A10039B237 /* OwnCloudFinder.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = OwnCloudFinder.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0BD9C38D1778EF450094CF5D /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = license.txt; sourceTree = "<group>"; };
|
||||
8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
D60A992314CE37030061AD6D /* LiferayNativity.osax */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LiferayNativity.osax; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D6ACBE9E117B7D5600F6691C /* LiferayNativityInjector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiferayNativityInjector.m; sourceTree = "<group>"; };
|
||||
D60A992314CE37030061AD6D /* OwnCloudFinder.osax */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OwnCloudFinder.osax; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D6ACBE9E117B7D5600F6691C /* OwnCloudInjector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OwnCloudInjector.m; sourceTree = "<group>"; };
|
||||
D6ACBE9F117B7D5600F6691C /* LNVersionComparisonProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LNVersionComparisonProtocol.h; sourceTree = "<group>"; };
|
||||
D6ACBEA0117B7D5600F6691C /* LNStandardVersionComparator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LNStandardVersionComparator.m; sourceTree = "<group>"; };
|
||||
D6ACBEA1117B7D5600F6691C /* LNStandardVersionComparator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LNStandardVersionComparator.h; sourceTree = "<group>"; };
|
||||
D6ACBEA4117B7D6100F6691C /* LiferayNativityInjector.sdef */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = LiferayNativityInjector.sdef; sourceTree = "<group>"; };
|
||||
D6ACBEA4117B7D6100F6691C /* OwnCloudInjector.sdef */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = OwnCloudInjector.sdef; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -67,8 +67,8 @@
|
|||
089C167CFE841241C02AAC07 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0B36CB91182461A10039B237 /* LiferayNativityFinder.bundle */,
|
||||
D6ACBEA4117B7D6100F6691C /* LiferayNativityInjector.sdef */,
|
||||
0B36CB91182461A10039B237 /* OwnCloudFinder.bundle */,
|
||||
D6ACBEA4117B7D6100F6691C /* OwnCloudInjector.sdef */,
|
||||
8D576317048677EA00EA77CD /* Info.plist */,
|
||||
8D5B49A704867FD3000E48DA /* InfoPlist.strings */,
|
||||
0BD9C38D1778EF450094CF5D /* license.txt */,
|
||||
|
@ -79,7 +79,7 @@
|
|||
08FB77AFFE84173DC02AAC07 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D6ACBE9E117B7D5600F6691C /* LiferayNativityInjector.m */,
|
||||
D6ACBE9E117B7D5600F6691C /* OwnCloudInjector.m */,
|
||||
D6ACBE9F117B7D5600F6691C /* LNVersionComparisonProtocol.h */,
|
||||
D6ACBEA0117B7D5600F6691C /* LNStandardVersionComparator.m */,
|
||||
D6ACBEA1117B7D5600F6691C /* LNStandardVersionComparator.h */,
|
||||
|
@ -90,7 +90,7 @@
|
|||
D60A992414CE37030061AD6D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D60A992314CE37030061AD6D /* LiferayNativity.osax */,
|
||||
D60A992314CE37030061AD6D /* OwnCloudFinder.osax */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -98,9 +98,9 @@
|
|||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8D57630D048677EA00EA77CD /* LiferayNativity.osax */ = {
|
||||
8D57630D048677EA00EA77CD /* OwnCloudFinder.osax */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "LiferayNativity.osax" */;
|
||||
buildConfigurationList = 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "OwnCloudFinder.osax" */;
|
||||
buildPhases = (
|
||||
8D57630F048677EA00EA77CD /* Resources */,
|
||||
8D576311048677EA00EA77CD /* Sources */,
|
||||
|
@ -110,10 +110,10 @@
|
|||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = LiferayNativity.osax;
|
||||
name = OwnCloudFinder.osax;
|
||||
productInstallPath = "$(HOME)/Library/Bundles";
|
||||
productName = "TotalFinder-osax";
|
||||
productReference = D60A992314CE37030061AD6D /* LiferayNativity.osax */;
|
||||
productReference = D60A992314CE37030061AD6D /* OwnCloudFinder.osax */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
@ -126,7 +126,7 @@
|
|||
LastUpgradeCheck = 0460;
|
||||
ORGANIZATIONNAME = BinaryAge;
|
||||
};
|
||||
buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "LiferayNativityInjector" */;
|
||||
buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "OwnCloudInjector" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
|
@ -139,7 +139,7 @@
|
|||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8D57630D048677EA00EA77CD /* LiferayNativity.osax */,
|
||||
8D57630D048677EA00EA77CD /* OwnCloudFinder.osax */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
@ -149,9 +149,9 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0B36CB92182461A10039B237 /* LiferayNativityFinder.bundle in Resources */,
|
||||
0B36CB92182461A10039B237 /* OwnCloudFinder.bundle in Resources */,
|
||||
8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
|
||||
D6ACBEA5117B7D6100F6691C /* LiferayNativityInjector.sdef in Resources */,
|
||||
D6ACBEA5117B7D6100F6691C /* OwnCloudInjector.sdef in Resources */,
|
||||
0BD9C38E1778EF450094CF5D /* license.txt in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -163,7 +163,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D6ACBEA2117B7D5600F6691C /* LiferayNativityInjector.m in Sources */,
|
||||
D6ACBEA2117B7D5600F6691C /* OwnCloudInjector.m in Sources */,
|
||||
D6ACBEA3117B7D5600F6691C /* LNStandardVersionComparator.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -195,7 +195,7 @@
|
|||
"-framework",
|
||||
AppKit,
|
||||
);
|
||||
PRODUCT_NAME = LiferayNativity;
|
||||
PRODUCT_NAME = OwnCloudFinder;
|
||||
SKIP_INSTALL = YES;
|
||||
WRAPPER_EXTENSION = osax;
|
||||
};
|
||||
|
@ -214,7 +214,7 @@
|
|||
"-framework",
|
||||
AppKit,
|
||||
);
|
||||
PRODUCT_NAME = LiferayNativity;
|
||||
PRODUCT_NAME = OwnCloudFinder;
|
||||
WRAPPER_EXTENSION = osax;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -245,7 +245,7 @@
|
|||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "LiferayNativity.osax" */ = {
|
||||
1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "OwnCloudFinder.osax" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB911B08733D790010E9CD /* Debug */,
|
||||
|
@ -254,7 +254,7 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "LiferayNativityInjector" */ = {
|
||||
1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "OwnCloudInjector" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB911F08733D790010E9CD /* Debug */,
|
|
@ -2,6 +2,6 @@
|
|||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:LiferayNativityInjector.xcodeproj">
|
||||
location = "self:OwnCloudFinder.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -15,9 +15,9 @@
|
|||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8D57630D048677EA00EA77CD"
|
||||
BuildableName = "LiferayNativityFinder.bundle"
|
||||
BlueprintName = "LiferayNativityFinder"
|
||||
ReferencedContainer = "container:../LiferayNativityFinder/LiferayNativityFinder.xcodeproj">
|
||||
BuildableName = "OwnCloudFinder.bundle"
|
||||
BlueprintName = "OwnCloudFinder"
|
||||
ReferencedContainer = "container:../OwnCloudFinder/OwnCloudFinder.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
|
@ -29,9 +29,9 @@
|
|||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8D57630D048677EA00EA77CD"
|
||||
BuildableName = "LiferayNativity.osax"
|
||||
BlueprintName = "LiferayNativity.osax"
|
||||
ReferencedContainer = "container:LiferayNativityInjector.xcodeproj">
|
||||
BuildableName = "OwnCloudFinder.osax"
|
||||
BlueprintName = "OwnCloudFinder.osax"
|
||||
ReferencedContainer = "container:OwnCloudInjector.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
|
@ -1,8 +1,14 @@
|
|||
#!/bin/sh
|
||||
# osascript $HOME/owncloud.com/mirall/shell_integration/MacOSX/unload.scpt
|
||||
|
||||
sudo rm -rf /Library/ScriptingAdditions/LiferayNativity.osax
|
||||
sudo cp -r $HOME/Library/Developer/Xcode/DerivedData/LiferayNativity-gvtginoclfyisuagangtxsfbuztw/Build/Products/Debug/LiferayNativity.osax /Library/ScriptingAdditions/
|
||||
sudo rm -rf /Library/ScriptingAdditions/OwnCloudFinder.osax
|
||||
# Klaas' machine
|
||||
OSAXDIR=$HOME/Library/Developer/Xcode/DerivedData/OwnCloud-*/Build/Products/Debug/OwnCloudFinder.osax
|
||||
[ -d $OSAXDIR ] ||OSAXDIR=$HOME/Library/Developer/Xcode/DerivedData/OwnCloud-*/Build/Intermediates/ArchiveIntermediates/OwnCloudFinder.osax/IntermediateBuildFilesPath/UninstalledProducts/OwnCloudFinder.osax
|
||||
|
||||
# Markus' machine
|
||||
[ -d $OSAXDIR ] || echo "OSAX does not exist"
|
||||
[ -d $OSAXDIR ] && sudo cp -rv $OSAXDIR /Library/ScriptingAdditions/
|
||||
|
||||
sudo killall Finder
|
||||
sleep 1
|
||||
|
|
|
@ -97,7 +97,7 @@ ownCloudGui::ownCloudGui(Application *parent) :
|
|||
void ownCloudGui::setupOverlayIcons()
|
||||
{
|
||||
|
||||
if( Utility::isMac() && QFile::exists("/Library/ScriptingAdditions/LiferayNativity.osax") ) {
|
||||
if( Utility::isMac() && QFile::exists("/Library/ScriptingAdditions/OwnCloudFinder.osax") ) {
|
||||
QString aScript = QString::fromUtf8("tell application \"Finder\"\n"
|
||||
" try\n"
|
||||
" «event NVTYload»\n"
|
||||
|
|
Loading…
Reference in a new issue