Um im zustaendigen Mime Type dateien oder url zu oeffnen geht es auf window sowie Auf Mac OSX (mac am einfachsten) folgender massen...
sogar mailto:mail@domain geht auch....
Im window cmd:
rundll32.exe url.dll,FileProtocolHandler http://www.qtforum.de/forum/
Im Mac
open http://www.qtforum.de/forum/
(ist verdammt schnell)
in einem QProcess packen und fertig ist der schmerz!
auf beide systemen kann man so file ordner url mailto:eeee@eee.de
oeffnen
Auf Mac kann mann sogar applescript zum laufen bringen....
/usr/bin/osascript file_applescript
(ohne dass die console aufgeht!)
(bei window sind es bat file)
Code: Alles auswählen
void ClassName::OpenUrl_File_Dir_Dektop()
{
#if defined(Q_WS_WIN)
QProcess p;
QStringList s;
s << "url.dll,FileProtocolHandler" << "http://www.qtforum.de/forum/";
p.startDetached(QString("rundll32.exe") , s );
#endif
#if defined Q_WS_MAC
QProcess m;
QStringList macs;
macs << "http://www.qtforum.de/forum/"; /* oeffnet der default browser */
m.startDetached(QString("open") , macs );
#endif
}
Setzt ein neuen hindergrund bild auf dem desktop....
teilcode von http://albumshaper.sourceforge.net/
Code: Alles auswählen
//MacOSX
#elif defined(Q_OS_MACX)
//create script
QString scriptFilename = ((Window*)qApp->mainWidget())->getTitle()->getAlbum()->getTmpDir() +
"/tmpBackgroundScript";
QFile file( scriptFilename );
if(file.open(IO_WriteOnly))
{
//-----
QTextStream stream;
stream.setDevice( &file );
stream.setEncoding( QTextStream::UnicodeUTF8 );
//-----
stream << "tell application \"Finder\"\n";
stream << "set pFile to POSIX file \"" << chosenFilename.ascii() << "\"\n";
stream << "set desktop picture to file pFile\n";
stream << "end tell";
}
file.close();
//run script to set background
QProcess p;
p.addArgument( "/usr/bin/osascript" );
p.addArgument( scriptFilename );
p.start();
//if there is an old file remove it
if(!oldFilename.isNull())
{ tmpDir.remove( oldFilename ); }
//-------------------------------
//UNIX
#else