Обсуждение: Filetype registration on OS X

Поиск
Список
Период
Сортировка

Filetype registration on OS X

От
Dave Page
Дата:
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:

pgAdmin3.app/Contents/MacOS/pgAdmin3 -q -f $FILE.sql

whenever $FILE.sql is launched.

Regards, Dave.

Re: Filetype registration on OS X

От
"Florian G. Pflug"
Дата:
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

Re: Filetype registration on OS X

От
Dave Page
Дата:
Florian G. Pflug wrote:
> you just need to change CFBundleTypeRole back from Node
> to Editor ;-)

Ahh, right - I knew we were exporting the filetype, didn't know that
change was require though.

>> 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)


Oh - it's not documented in the wxWidgets class reference which might be
why I didn't find it :-(

Stefan; is there a reason for that, or is it simply oversight? Is there
any other funky stuff hidden away that might be useful?

Anyway, I've implemented this in SVN trunk - both Windows and Mac now
allow you to double click a .sql and have it open in pgAdmin's query
tool :-)

Thanks Florian.

Regards, Dave.

Re: Filetype registration on OS X

От
Stefan Csomor
Дата:
Hi

> -----Original Message-----
> From: Dave Page [mailto:dpage@postgresql.org]
> Sent: Freitag, 11. Mai 2007 13:02
> To: Florian G. Pflug
> Cc: pgadmin-hackers; Stefan Csomor
> Subject: Re: Filetype registration on OS X
>
> Florian G. Pflug wrote:
> > you just need to change CFBundleTypeRole back from Node
> > to Editor ;-)
>
> Ahh, right - I knew we were exporting the filetype, didn't know that
> change was require though.
>
> >> 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)
>
>
> Oh - it's not documented in the wxWidgets class reference which might
> be
> why I didn't find it :-(
>
> Stefan; is there a reason for that, or is it simply oversight? Is
> there
> any other funky stuff hidden away that might be useful?

the problem is just the lack of time, or the lack of more developers to help with wxMac, I've answered things like
theseon the list only, so the wiki is a good place because people post and copy things there, also the docview sample
isshowing how to do this. If in doubt you can always email me directly, or make sure wxMac is in the subject line so
thatmy filters can catch it. 

BTW is WX_2_8_BRANCH ok for you, I'll notify Apple in a few days once 2.8.4 has been tagged.

Best,

Stefan

Re: Filetype registration on OS X

От
Dave Page
Дата:
Stefan Csomor wrote:
> the problem is just the lack of time, or the lack of more developers to help with wxMac, I've answered things like
theseon the list only, so the wiki is a good place because people post and copy things there, also the docview sample
isshowing how to do this. If in doubt you can always email me directly, or make sure wxMac is in the subject line so
thatmy filters can catch it. 

OK.

> BTW is WX_2_8_BRANCH ok for you, I'll notify Apple in a few days once 2.8.4 has been tagged.

The only issue was wxGrid scrolling cells but not headers. I had a bug
open for that for ages, but it was noted on there this week that it's
fixed for 2.8.4.

So I think it's good... I assume this will be bundled with Leopard?

Thanks, Dave.


Re: Filetype registration on OS X

От
Stefan Csomor
Дата:
Hi

> -----Original Message-----
> From: Dave Page [mailto:dpage@postgresql.org]
> Sent: Freitag, 11. Mai 2007 15:06
> To: Stefan Csomor
> Cc: Florian G. Pflug; pgadmin-hackers
> Subject: Re: Filetype registration on OS X
>
> Stefan Csomor wrote:
> > the problem is just the lack of time, or the lack of more
> developers to help with wxMac, I've answered things like these on the
> list only, so the wiki is a good place because people post and copy
> things there, also the docview sample is showing how to do this. If
> in doubt you can always email me directly, or make sure wxMac is in
> the subject line so that my filters can catch it.
>
> OK.
>
> > BTW is WX_2_8_BRANCH ok for you, I'll notify Apple in a few days
> once 2.8.4 has been tagged.
>
> The only issue was wxGrid scrolling cells but not headers. I had a
> bug
> open for that for ages, but it was noted on there this week that it's
> fixed for 2.8.4.

yes, I had to fix it in a way no to re-introduce the performance problems that were the reason for changing the code at
all... 

> So I think it's good... I assume this will be bundled with Leopard?

yes, that's the plan

Thanks,

Stefan

Re: Filetype registration on OS X

От
Dave Page
Дата:
Stefan Csomor wrote:
>> The only issue was wxGrid scrolling cells but not headers. I had a
>> bug
>> open for that for ages, but it was noted on there this week that it's
>> fixed for 2.8.4.
>
> yes, I had to fix it in a way no to re-introduce the performance problems that were the reason for changing the code
atall ... 

:-( Oh well, at least it will work!

>> So I think it's good... I assume this will be bundled with Leopard?
>
> yes, that's the plan

Cool - thanks for your hard work with the port; it is appreciated!!

Regards, Dave.

Re: Filetype registration on OS X

От
"Florian G. Pflug"
Дата:
Dave Page wrote:
> Anyway, I've implemented this in SVN trunk - both Windows and Mac now
> allow you to double click a .sql and have it open in pgAdmin's query
> tool :-)

Cool! Can't wait to try it...

greetings, Florian Pflug