how to externally trigger konq-e to refresh view

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to externally trigger konq-e to refresh view

Stefan Strobl-2
Hello

I just subscribed to the list in the hope you can give me some ideas on
how to solve my problem.

First I should mention that I'm using a rather old version of konq-e and
qt/embedded, mainly because cross-compilation is already working for my
PPC computer. I'm using konqueror3-embedded-0.2-20040524 with
qt/embedded-3.3.4.

What I would like to do is to somehow tell konq-e from another
application XY to reload its current URL. This is of use if application
XY generates and stors a html page locally and wants konqueror to
display/reload it.

Now, this is how I tried to do it and the problems I ran into:
I thought I use the Unix system signal SIGUSR2 to do the signaling. In
the file view.cc in the BrowserView constructor I'm registering my
"protected: static void sigusr2_handler()" function for SIGUSR2 which is
generally working so far. From this handler I thought of calling the
public slot function reload() which is _not_ working because I cannot
call this non-static function reload() from my static function
sigusr2_handler(). From sigusr2_handler() I also cannot access "HTMLView
*m_doc" for the same reason. On the other hand I cannot make
sigusr2_handler() non-static because sigaction() would complain about
that. I'm lost here. Why can't I access the data even though I'm in the
same class?

Any ideas what I'm doing wrong? Or maybe ideas about a better approach
to make my application XY cause konq-e to reload its page?

Any help is highly appreciated.
Thanks
Stefan.
_______________________________________________
konq-e mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/konq-e
Reply | Threaded
Open this post in threaded view
|

Re: how to externally trigger konq-e to refresh view

u.luckas (Bugzilla)
On Wednesday, 23. September 2009, Stefan Strobl wrote:

> Hello
>
> I just subscribed to the list in the hope you can give me some ideas on
> how to solve my problem.
>
> First I should mention that I'm using a rather old version of konq-e and
> qt/embedded, mainly because cross-compilation is already working for my
> PPC computer. I'm using konqueror3-embedded-0.2-20040524 with
> qt/embedded-3.3.4.
>
> What I would like to do is to somehow tell konq-e from another
> application XY to reload its current URL. This is of use if application
> XY generates and stors a html page locally and wants konqueror to
> display/reload it.
>
> Now, this is how I tried to do it and the problems I ran into:
> I thought I use the Unix system signal SIGUSR2 to do the signaling. In
> the file view.cc in the BrowserView constructor I'm registering my
> "protected: static void sigusr2_handler()" function for SIGUSR2 which is
> generally working so far. From this handler I thought of calling the
> public slot function reload() which is _not_ working because I cannot
> call this non-static function reload() from my static function
> sigusr2_handler(). From sigusr2_handler() I also cannot access "HTMLView
> *m_doc" for the same reason. On the other hand I cannot make
> sigusr2_handler() non-static because sigaction() would complain about
> that. I'm lost here. Why can't I access the data even though I'm in the
> same class?
>
> Any ideas what I'm doing wrong? Or maybe ideas about a better approach
> to make my application XY cause konq-e to reload its page?
>
Hi Stefan,
there are a few problems here.
First and most important, there are strict semantics of what is allowed to be
done inside a signal handler. Keep in mind, that the signal handler could have
interupted the main flow of code at any point and must make sure not to cause
any unexpected modifications to the environment of the interrupted code.
Please take a look at any unix book and what it tells you about signals.

Second, non static methods need an object (an instance of the class) to
operate on, static methods, also called "class methods", can be called on the
class itself. Please take a look at any C++ book and what it tells you about
classes and objects and the difference thereof.

Qt/Embedded has a mechanism called qcop for inter process communication:
http://doc.trolltech.com/3.3/qcopchannel.html
You can extend konq-e to listen for a qcop message which could then trigger a
reload.

Regards,
Uli

--

------- ROAD ...the handyPC Company - - -  ) ) )

Uli Luckas
Head of Software Development

ROAD GmbH
Bennigsenstr. 14 | 12159 Berlin | Germany
fon: +49 (30) 230069 - 62 | fax: +49 (30) 230069 - 69
url: www.road.de

Amtsgericht Charlottenburg: HRB 96688 B
Managing director: Hans-Peter Constien
_______________________________________________
konq-e mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/konq-e
Reply | Threaded
Open this post in threaded view
|

Re: how to externally trigger konq-e to refresh view

u.luckas (Bugzilla)
On Wednesday, 23. September 2009, Stefan Strobl wrote:

> Hi Uli
>
> thanks for your prompt answer.
>
> Uli Luckas wrote:
> > On Wednesday, 23. September 2009, Stefan Strobl wrote:
> >> What I would like to do is to somehow tell konq-e from another
> >> application XY to reload its current URL. This is of use if application
> >> XY generates and stors a html page locally and wants konqueror to
> >> display/reload it.
> >>
> >> Now, this is how I tried to do it and the problems I ran into:
> >> I thought I use the Unix system signal SIGUSR2 to do the signaling. In
> >> the file view.cc in the BrowserView constructor I'm registering my
> >> "protected: static void sigusr2_handler()" function for SIGUSR2 which is
> >> generally working so far. From this handler I thought of calling the
> >> public slot function reload() which is _not_ working because I cannot
> >> call this non-static function reload() from my static function
> >> sigusr2_handler(). From sigusr2_handler() I also cannot access "HTMLView
> >> *m_doc" for the same reason. On the other hand I cannot make
> >> sigusr2_handler() non-static because sigaction() would complain about
> >> that. I'm lost here. Why can't I access the data even though I'm in the
> >> same class?
> >>
> >> Any ideas what I'm doing wrong? Or maybe ideas about a better approach
> >> to make my application XY cause konq-e to reload its page?
> >
> > Hi Stefan,
> > there are a few problems here.
> > First and most important, there are strict semantics of what is allowed
> > to be done inside a signal handler. Keep in mind, that the signal handler
> > could have interupted the main flow of code at any point and must make
> > sure not to cause any unexpected modifications to the environment of the
> > interrupted code. Please take a look at any unix book and what it tells
> > you about signals.
> >
> > Second, non static methods need an object (an instance of the class) to
> > operate on, static methods, also called "class methods", can be called on
> > the class itself. Please take a look at any C++ book and what it tells
> > you about classes and objects and the difference thereof.
> >
> > Qt/Embedded has a mechanism called qcop for inter process communication:
> > http://doc.trolltech.com/3.3/qcopchannel.html
> > You can extend konq-e to listen for a qcop message which could then
> > trigger a reload.
>
> I now understand that I need an Object to access reload() from a static
> function. I also understand that SIGUSR2 is asynchronous and may
> interrupt the process at the wrong time.
>
> The other thing is that my application doing the signalling is not a
> graphical QT application but a C program. Do you think using a Unix FIFO
> could be an alternative or is it better to make my application XY a QT
> application to be able to use QCopChannel?
>
Please keep the list CCed.

If you don't want to make your programm a qapplication, you could also send
qcop messages by calling the qcop command line application via ::system().
As you sugested you can also use a FIFO or a socket for communication. In the
browser, just make sure to use the event loop (QSocket/QSocketNotifier) for
asynchronus notification on fifo events.

Regards,
Uli

--

------- ROAD ...the handyPC Company - - -  ) ) )

Uli Luckas
Head of Software Development

ROAD GmbH
Bennigsenstr. 14 | 12159 Berlin | Germany
fon: +49 (30) 230069 - 62 | fax: +49 (30) 230069 - 69
url: www.road.de

Amtsgericht Charlottenburg: HRB 96688 B
Managing director: Hans-Peter Constien
_______________________________________________
konq-e mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/konq-e
Reply | Threaded
Open this post in threaded view
|

Re: how to externally trigger konq-e to refresh view

Stefan Strobl-2
Uli Luckas wrote:
> On Wednesday, 23. September 2009, Stefan Strobl wrote:
> If you don't want to make your programm a qapplication, you could also send
> qcop messages by calling the qcop command line application via ::system().
> As you sugested you can also use a FIFO or a socket for communication. In the
> browser, just make sure to use the event loop (QSocket/QSocketNotifier) for
> asynchronus notification on fifo events.

Thanks for your help. I did manage to use a QCopChannel to call reload()
in konqueror from another application.

For my signalling application I'd like to use the qcop tool as you
suggested, but I cannot find it anywhere. According to this
(http://doc.trolltech.com/qtopia4.3/qcop-tool.html) it should be part of
qtopia but I didn't find it nowhere in qte-3.3.4 nor in qte-4.4.3. Can
you tell me where to find the sources to the qcop tool?

Many thanks
Stefan
_______________________________________________
konq-e mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/konq-e
Reply | Threaded
Open this post in threaded view
|

Re: how to externally trigger konq-e to refresh view

u.luckas (Bugzilla)
On Wednesday, 23. September 2009, Stefan Strobl wrote:

> Uli Luckas wrote:
> > On Wednesday, 23. September 2009, Stefan Strobl wrote:
> > If you don't want to make your programm a qapplication, you could also
> > send qcop messages by calling the qcop command line application via
> > ::system(). As you sugested you can also use a FIFO or a socket for
> > communication. In the browser, just make sure to use the event loop
> > (QSocket/QSocketNotifier) for asynchronus notification on fifo events.
>
> Thanks for your help. I did manage to use a QCopChannel to call reload()
> in konqueror from another application.
>
> For my signalling application I'd like to use the qcop tool as you
> suggested, but I cannot find it anywhere. According to this
> (http://doc.trolltech.com/qtopia4.3/qcop-tool.html) it should be part of
> qtopia but I didn't find it nowhere in qte-3.3.4 nor in qte-4.4.3. Can
> you tell me where to find the sources to the qcop tool?
>
> Many thanks
> Stefan
>
Sorry, Stefan.
You are right, the qcop tool is part of Qtopia only and it seems, these
sources are no longer offered by Trolltech/Nokia.
So now you can either write a small command line app, yourself. Or go back to
the FIFO idea.

Good Luck
Uli



--

------- ROAD ...the handyPC Company - - -  ) ) )

Uli Luckas
Head of Software Development

ROAD GmbH
Bennigsenstr. 14 | 12159 Berlin | Germany
fon: +49 (30) 230069 - 62 | fax: +49 (30) 230069 - 69
url: www.road.de

Amtsgericht Charlottenburg: HRB 96688 B
Managing director: Hans-Peter Constien

_______________________________________________
konq-e mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/konq-e

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to externally trigger konq-e to refresh view

Stefan Strobl-2
Uli Luckas wrote:
> On Wednesday, 23. September 2009, Stefan Strobl wrote:
>> Uli Luckas wrote:
>> For my signalling application I'd like to use the qcop tool as you
>> suggested, but I cannot find it anywhere. According to this
>> (http://doc.trolltech.com/qtopia4.3/qcop-tool.html) it should be part of
>> qtopia but I didn't find it nowhere in qte-3.3.4 nor in qte-4.4.3. Can
>> you tell me where to find the sources to the qcop tool?

> Sorry, Stefan.
> You are right, the qcop tool is part of Qtopia only and it seems, these
> sources are no longer offered by Trolltech/Nokia.
> So now you can either write a small command line app, yourself. Or go back to
> the FIFO idea.

Sorry. I again forgot to CC the list. Here we go.

I've done my own little command line tool which works fine. Thanks for
pointing me towards QCopMessages.

AS mentioned, external triggering of reload() works find, apart from a
memory leak. After doing some 100 refresh the memory use of konq
increases from 28308kB up to 31556kB (+11%). This might have to do with
my configuration though, or is this a known issue?

The threading & processes is not an issue anymore. Don't know why I got
confused here.

Regards
Stefan
_______________________________________________
konq-e mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/konq-e