add link that open web browser on unix
hi
I wish to open a web browser in unix ( mozilla) from QT .
I saw that this question was asked here before and i used the answer in mu code .
BUT
it doesn't work for me. the process crash ( normalExit return 0 ) and no browser is open.
How can i figure out why it does not work ??
more details :
I am working on sun OS
which i am loged in using the rlogin command
the DISPLAY env is set correctlly in my ~/.cshrc file.
here is the code that i copy from this forum :
and what does Q_UNUSED(this) mean ?
Code:
bool result = false;
QUrl rUrl
("http://www.cnn.com");
Q_UNUSED(this);
// Try a range of browsers available on UNIX, until we (hopefully)
// find one that works. Start with the most popular first.
bool process_started = false;
process.
setArguments(QStringList() <<
"mozilla" << sUrl
);
process_started = process.start();
return;
Re: add link that open web browser on unix
Quote:
Originally Posted by
asafb
How can i figure out why it does not work ??
You create QProcess instance on the stack and it gets destroyed when it goes out of scope.
Quote:
Originally Posted by
asafb
and what does Q_UNUSED(this) mean ?
You can use it to suppress warnings about unused function arguments.
Re: add link that open web browser on unix
Qt 4.2 (released yesterday) includes QDesktopServices. This allows you to open URLs in a desktop-neutral manner. Give it an URL and it hands it off to the desktop to open, using the user's application preference.
For example, an application of mine uses it for a website in the About Box. It opens in Firefox under Windows, Konqueror under KDE, and Safari under Mac, because those are my preferences.
Re: add link that open web browser on unix
And nothing under gnome...or not for me anyways...
Re: add link that open web browser on unix
Quote:
Originally Posted by
bwindorski
And nothing under gnome...or not for me anyways...
Does your link have a proper scheme (eg. http)? What happens if you issue command "xdg-open http://www.qtcentre.org" in terminal?
Re: add link that open web browser on unix
Yeah that opened a browser thanks. I've had little to no luck with the QUrl or QDesktopServices.
Re: add link that open web browser on unix
Quote:
Originally Posted by
bwindorski
Yeah that opened a browser thanks. I've had little to no luck with the QUrl or QDesktopServices.
Well then the problem must be with the URL because that's what QDesktopServices does behind the scenes. Make sure the link contains the scheme as I mentioned.
Re: add link that open web browser on unix
Its something with my GCofig
this is the dbug-output
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://www.gnome.org/projects/gconf/ for information. (Details - 1: Failed to get connection to session: '=' character not found or has no value following it)
not sure what it is looking into it.
sorry asafb I'm not trying to hijack your post.