/* tr macro on no Q_OBJECT class !!!! */
static inline void OpenDesk
( QUrl loc
) {
#if defined Q_WS_MAC
/* direct to open */
macs << loc.toString();
m
->startDetached
(QString("open") , macs
);
return;
#endif
#if defined Q_WS_WIN
QString fullFileName
= loc.
toString();
if (fullFileName.startsWith("http://", Qt::CaseInsensitive) ||
fullFileName.startsWith("https://", Qt::CaseInsensitive) ||
fullFileName.startsWith("ftp://", Qt::CaseInsensitive) ||
fullFileName.startsWith("news://", Qt::CaseInsensitive) ||
fullFileName.startsWith("mailto:", Qt::CaseInsensitive) ||
fullFileName.startsWith("webdav://", Qt::CaseInsensitive) )
{
} else {
fullFileName.prepend("file:///"); /* or qurl to localfile */
}
if (!wr) {
QString("Window Unable to open action file or dir %1").
arg(loc.
toString()));
}
return;
#endif
/* linux */
if (!r) {
QString("Linux Unable to open action file or dir %1").
arg(loc.
toString()));
}
}
/* tr macro on no Q_OBJECT class !!!! */
static inline void OpenDesk( QUrl loc )
{
#if defined Q_WS_MAC
/* direct to open */
QProcess *m = new QProcess();
QStringList macs;
macs << loc.toString();
m->startDetached(QString("open") , macs );
return;
#endif
#if defined Q_WS_WIN
QString fullFileName = loc.toString();
if (fullFileName.startsWith("http://", Qt::CaseInsensitive) ||
fullFileName.startsWith("https://", Qt::CaseInsensitive) ||
fullFileName.startsWith("ftp://", Qt::CaseInsensitive) ||
fullFileName.startsWith("news://", Qt::CaseInsensitive) ||
fullFileName.startsWith("mailto:", Qt::CaseInsensitive) ||
fullFileName.startsWith("webdav://", Qt::CaseInsensitive) )
{
} else {
fullFileName.prepend("file:///"); /* or qurl to localfile */
}
bool wr = QDesktopServices::openUrl(QUrl(fullFileName));
if (!wr) {
QMessageBox::warning(0,QString("Error"),
QString("Window Unable to open action file or dir %1").arg(loc.toString()));
}
return;
#endif
/* linux */
bool r = QDesktopServices::openUrl(loc);
if (!r) {
QMessageBox::warning(0,QString("Error"),
QString("Linux Unable to open action file or dir %1").arg(loc.toString()));
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks