1 #include <QtSingleApplication>
10 QString url =
"qthelp://ultrascaniii/";
11 if ( !page.contains(
"manual/" ) )
12 url.append(
"manual/" );
17 args << QLatin1String(
"-collectionFile" )
19 << QLatin1String(
"-enableRemoteControl" )
20 << QLatin1String(
"-showURL" )
23 debug( args.join(
" " ) );
25 daemon.start( QLatin1String(
"assistant" ), args );
28 daemon.start( assisloc, args );
32 connect( &
daemon, SIGNAL( finished (
int, QProcess::ExitStatus ) ),
33 SLOT (
close (
int, QProcess::ExitStatus ) ) );
43 if ( helpPage ==
"Quit" )
49 if (
daemon.state() == QProcess::NotRunning )
51 debug(
"assistant not running" );
54 QString page = helpPage;
55 if ( ! helpPage.contains(
"manual/" ) ) page.prepend(
"manual/" );
57 debug(
"setSource qthelp://ultrascaniii/" + page );
60 ba.append(
"setSource qthelp://ultrascaniii/" );
61 ba.append( page.toAscii() );
69 QFile d(
"/tmp/helpdaemon.log" );
70 d.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append );
71 QTextStream out ( &d );
72 out << message << endl;
82 int main(
int argc,
char* argv[] )
87 QtSingleApplication application(
"UltraScan Help Daemon", argc, argv );
89 QString message = QString( argv[ 1 ] );
91 if ( application.sendMessage( message ) )
return 0;
93 application.initialize();
96 QObject::connect( &application, SIGNAL( messageReceived(
const QString& ) ),
97 daemon, SLOT ( show (
const QString& ) ) );
99 return application.exec();