how to add item in right click context menu of file and folder in objective c - cocoa

I am developing an cocoa application for Mac and what i need is to add an item in the context menu that appears when user right-clicks on specific file and folder (i.e. when user click on file or folder by pressing ctrl key of keyboard).
I am new to Cocoa application development. I have searched in google for it and found that it can be implemented by using CFPlugIn. Does anyone know how to use CFPlugIn to implement this or any other method to add item in context menu of specific file or folder??
Thanks in advance

You can use system services for contextual menu. you should refer Services Implementation Guide. take a look at Services step out in Snow Leopard article.
If you wish to sell your product on apple app store than you should not follow dropbox.

This is no longer supported in Mac OS X 10.6 and Mac OS X 10.7. Earlier versions of Mac OS X had support for contextual menu plugins, but this feature has since been removed.
What is it you're trying to accomplish in the broader sense? If you give us an idea of what your goal is, we may be able to suggest an alternate way to accomplish it.

Using System Extensions and a FinderSync extension you can accomplish this.
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html

Related

Create custom right-click menu for OS X app, developed on Linux

I am creating an app for Mac OS, but it is being built on Linux. Because of this, I am not able to use tools such as Xcode, and I am not developing in swift. Rather, the .app directory is being put together according to Apple's documentation, and the entrypoint/executable of my app is a shell script.
I need to customize the menu which appears when you right click on the app (either on the dock icon or in Finder). Is there a way to do this, without using cocoa, etc.?
The menu I believe you are referring to is called "Services".
In order to add a menu item there for your application you would create a script to enable including it there. Xcode isn't needed or required, however, you'll need to know at the very least some basic AppleScript or Javascript to accomplish what you want. (see examples from the link)
↳ Mac Automation Scripting Guide

RCP application menus in Mac OS

I am struggling to figure out how RCP applications on Mac OS work with "About" and "Preferences" actions. I create them with ActionFactory and place them to relevant file menus. Works fine everywhere. However, on Mac OS those actions get placed into application menu by something which knows better where to put other peoples good actions. But of course they don't work.. Any idea why?
(eclipse target platform 3.7, OSX - the latest El Capitan)
For the 3.x style action bar advisor add the menu item in the normal place but use an ActionContributionItem and set the menu item in be invisible on the Mac:
So for Quit something like:
IWorkbenchAction quitAction = ActionFactory.QUIT.create(window);
register(quitAction);
ActionContributionItem quitItem = new ActionContributionItem(quitAction);
quitItem.setVisible(!Util.isMac());
menu.add(quitItem);
'About' and 'Preferences' can also be specified like this.
Util is org.eclipse.jface.util.Util.
Eclipse will find these items and move them to the correct place.

Can I create an OSX System Preferences pane with Qt

I am creating an application in Qt to modify settings for a USB audio device. I need these setting to appear in System Preferences in OSX.
According to the apple documentation (Preference Pane Programming Guide) the NSPrincipalClass entry in the bundle Info.plist would need to specify a Qt binary that subclasses NSPreferencePane rather than NSApplication. I have looked through the Qt documentation and searched the forums and see no reference on how to do this. I was ready to give up when I ran across a post which eludes to it being possible to create OSX preference panes from Qt, but unfortunately gives no clues as to how this might have been achieved.
Is it possible to create an OSX System Preferences panel using Qt? Any help or advice on how to do this would be greatly appreciated.

How to change the application menu name in PyQt4 on OS X

I'm porting a PyQt4 (PySide) application that I wrote for Linux and Windows to OS X, menus seem to be otherwise OK out of the box (i.e. Help menu that only has About in it is magically moved to the "main menu" and a File menu is created just fine, but the "main" menu is titled Python instead of Application name.
I call self.setWindowTitle("Appname") in MainWindow.__init__() and self.setApplicationName("Appname") in Application.__init__() but the result is this:
How can I fix this? - Preferably in a way that my app still looks the same as it did before on Windows & Linux.
So it looks like Mac does something different than the other OS systems. I don't have a Mac so I can't really test it out but I think on a Mac the QMainWindow.menuBar() function does not return the application wide menu bar. You might try creating menubar like.
menubar = QtGui.MenuBar()
that has no parent.
I'm getting this information from the following links.
From the documents
Deploying an Application on Mac OS X
Also, it looks like the file Info.plist in "The Bundle" section of the second link is where the application name would live.
I'm sorry I can't be of more help but I hope this information will help you. Good luck!

Contextual Menu Item development for OSX (Leopard and Snow Leopard)

i was wondering what the best practice is for creating a contextual menu item that would work in both leopard and snow leopard and works with a selection of files and/or folders, sending them to a shellscript.
i know that the contextual menu items have been deprecated in SL - but does that mean there is no way to create a solution that would work on both Leopard and Snow Leopard (using applescript or xcode or automator)?
basically i want to feed the files/folders to a shellscript that creates different compressed archives (rar, zip, tbz2) out of them.
thanks for your help!
There's not really a way to create one overall piece of code that will work in both Leopard and Snow Leopard.
You can, however, create a service for Snow Leopard and then create a Finder contextual menu for Leopard that just invokes that service.
That way you can do most of your implementation in Cocoa as part of the service, and only use the Finder contextual menu portion on systems that can't "natively" use the service.
Short of using an Automator service (10.4 or above) or the newly-overhauled services system (10.6 only), you'll have to leave the comfortable world of Cocoa:
SampleCMPlugIn
You can make an AppleScript application that accepts a drag 'n' dropped file/folder onto it.
You can probably make an Automator app to accept drag 'n' dropped files also.
Both should work on Leopard and Snow Leopard. On Snow Leopard, at least, you can set up a new Services Menu item that points to a particular app to process the selection. This is done via the Keyboard preference panel.

Resources