PDA

View Full Version : Qprocess MAC OSX - Open Finder path xx & Open firefox arg url...



patrik08
16th June 2006, 20:57
to open a path on explorer.exe is running so:
process.start("explorer.exe", QStringList() << "x:\path\xx\");
and running
and to open browser + url runnig to on window...
process.start(browser, QStringList() << url); /* browser is the full path to exe */

But /Applications/Firefox.app + url is a path....
How i can open firefox + url and finder + url? on qprocess....
Thanks in advance of every answer.





void Tab_Oggetto::OpenPath()
{
/* apri cartella pathfileroot */
QString xapri = pathfileroot;
xapri.replace(QString("/"),"\\");
qDebug() << "### pathfileroot " << xapri;
#if defined(Q_WS_WIN)
QProcess process;
process.setReadChannelMode(QProcess::MergedChannel s);
process.start("explorer.exe", QStringList() << xapri);
if (!process.waitForFinished()) {
QMessageBox::information( this, tr( "Errore del sistema operativo" ),tr("Explorer non risponde. Aggiornate Window update! Errore ritornato %1").arg(process.errorString()));
} else {
qDebug() << "### reade " << process.readAll();
}
#endif
}

void Tab_Oggetto::OpenBrowserPath()
{
/* pref_browser http://wellson.ciz.ch/webdav/ */
QString browser = Global_Config(APPLICATION_SETTING,"pref_browser");
QString url = WWW_DOMAIN_USER + PATH_OGGETTI_HTML + QString::number(UNIXTIMEDIR) + "/it/";

qDebug() << "### browser " << browser;
qDebug() << "### url " << url;
if (browser.size() < 3) {
QMessageBox::information( this, tr( "Informazione Browser." ),tr("Non avete ancora configurato un Applicativo Browser nelle preferenze!"));
} else {
QProcess process;
process.setReadChannelMode(QProcess::MergedChannel s);
process.start(browser, QStringList() << url);
if (!process.waitForFinished()) {
QMessageBox::information( this, tr( "Errore del browser!" ),tr("Il programma Browser configurato risponde con un errore ... %1").arg(process.errorString()));
} else {
qDebug() << "### reade " << process.readAll();
}
}

}

pasnox
29th June 2006, 17:52
I can translate your project to french if u want.

Contat me on pasnox@gmail.com.

P@sNox,

Chicken Blood Machine
29th June 2006, 18:18
to open a path on explorer.exe is running so:
process.start("explorer.exe", QStringList() << "x:\path\xx\");
and running
and to open browser + url runnig to on window...
process.start(browser, QStringList() << url); /* browser is the full path to exe */

But /Applications/Firefox.app + url is a path....
How i can open firefox + url and finder + url? on qprocess....
Thanks in advance of every answer.


Use the OSX "open" command, e.g:

process.start("open", QStringList() << "x:\path\xx\");
process.start("open", QStringList() << url);

Both will open the directory file/path with the correct application respectively. In this case that will be the Finder and the default web browser.

To specifically use Firefox, you can use "open -a", e.g:
process.start("open", QStringList() << "-a" << "Firefox" << url);

gaddlord
25th August 2010, 13:39
What about Q_WS_X11? how we can open a folder in the default Linux "explorer"?