diff -uNrp apt-indicator1/src/help_browser.ui apt-indicator/src/help_browser.ui --- apt-indicator1/src/help_browser.ui 2004-07-16 21:53:04 +0400 +++ apt-indicator/src/help_browser.ui 2004-07-16 21:39:28 +0400 @@ -161,7 +161,12 @@ qtextbrowser.h qpushbutton.h local.h + help_browser.ui.h + + init() + execLink( const QString & link ) + QPixmap diff -uNrp apt-indicator1/src/help_browser.ui.h apt-indicator/src/help_browser.ui.h --- apt-indicator1/src/help_browser.ui.h 1970-01-01 03:00:00 +0300 +++ apt-indicator/src/help_browser.ui.h 2004-07-16 21:50:47 +0400 @@ -0,0 +1,68 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you want to add, delete, or rename functions or slots, use +** Qt Designer to update this file, preserving your code. +** +** You should not define a constructor or destructor in this file. +** Instead, write your code in functions called init() and destroy(). +** These will automatically be called by the form's constructor and +** destructor. +*****************************************************************************/ + +#include + +void HelpBrowser::init() +{ +// QObject::connect( this->helpText, SIGNAL( linkClicked(QString) ), this, SLOT( execLink(QString) ) ); + connect( helpText, SIGNAL( linkClicked(const QString&) ), this, SLOT( execLink( const QString& ) ) ); +} + + +void HelpBrowser::execLink( const QString& link ) +{ + QString progname; + if( link.startsWith("http:") ) + { + progname = getenv("HELP_BROWSER"); + if( progname.isEmpty() ) + { + qWarning(tr("HELP_BROWSER environment variable is empty")); + progname = getenv("BROWSER"); + if( progname.isEmpty() ) + qWarning(tr("BROWSER environment variable is empty")); + } + } + else if( link.startsWith("mailto:") ) + { + progname = getenv("MAILER"); + if( progname.isEmpty() ) + qWarning(tr("MAILER environment variable is empty")); + } + else + { + return; + } + helpText->reload(); + + if( progname.isEmpty() ) + { + progname = "url_handler.sh"; + qDebug(QString("Set progname to %1").arg(progname)); + } + + QProcess prog; + QStringList proglist = QStringList::split(" ", progname); + QStringList::Iterator i = proglist.begin(); + while ( i != proglist.end() ) + { + prog.addArgument( *i ); + qDebug(*i); + i++; + } + prog.addArgument(link); + + if ( !prog.start() ) { + qWarning(tr("Unable to execute %1 for %2").arg(progname).arg(link)); + } +}