#include <windows.h>
bool open_browser(QWidget* parent, const QString& rUrl) { bool result = false; QApplication::setOverrideCursor(Qt::BusyCursor); #ifdef Q_WS_WIN result = int(ShellExecuteW(parent->winId(), 0, rUrl.ucs2(), 0, 0, SW_SHOWNORMAL)) > 32; #else Q_UNUSED(parent); // Try a range of browsers available on UNIX, until we (hopefully) // find one that works. Start with the most popular first. QProcess process; bool process_started = false; process.setArguments(QStringList() << "netscape" << rUrl);
process_started = process.start(); if (!process_started) { process.setArguments(QStringList() << "mozilla" << rUrl); process_started = process.start(); } if (!process_started) { process.setArguments(QStringList() << "firefox" << rUrl); process_started = process.start(); } if (!process_started) { process.setArguments(QStringList() << "konqueror" << rUrl); process_started = process.start(); } result = process_started; #endif QApplication::restoreOverrideCursor(); return result; }
|