Dave Page wrote:
> Hi Florian,
>
> I've been trying to figure out how to register pgAdmin as a handler for
> .sql files with Launch Services, however all the documentation I seem to
> be finding is about using Launch Services to launch a file (as Finder
> would), rather than registering as we need to.
>
> Any ideas, or helpful URLs I've missed? I'm trying to basically do:
The necessary changes to the Info.plist files are already in the SVN ;-)
http://svn.pgadmin.org/cgi-bin/viewcvs.cgi/trunk/pgadmin3/pkg/mac/Info.plist?rev=4615&view=markup
I planned to support opening .sql files once, and added the necessary
declarations to the Info.plist file, back when I added icon declaration
from .sql files. Since this was shorty before release, we agreed that
it was a bad time for adding code to actually open the file (the
declaration just lets pgAdmin3 start when the file is doubleclicked),
and so I changed the plist file not to launch pgAdmin3 when a sql-file
is clicked.
Well, and then I had other things to do, and quite forgot about
my plan...
According to
http://svn.pgadmin.org/cgi-bin/viewcvs.cgi/trunk/pgadmin3/pkg/mac/Info.plist?rev=4620&r1=4615&r2=4620
you just need to change CFBundleTypeRole back from Node
to Editor ;-)
> pgAdmin3.app/Contents/MacOS/pgAdmin3 -q -f $FILE.sql
On OSX, these things are handleded via apple events -
Launch Services start the app, and then send some "file open"
event. It seems as if wx already supports receiving this event:
http://www.wxwidgets.org/wiki/index.php/WxMac_Issues
If this page is right, it's as easy as overriding
virtual void wxApp::MacOpenFile(const wxString &fileName)
Hope this helps,
greetings, Florian Pflug