Showing with 23 additions and 15 deletions.
  1. +17 −1 src/core/qgscontexthelp.cpp
  2. +2 −10 src/core/qgscontexthelp.h
  3. +2 −2 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  4. +2 −2 src/providers/postgres/qgspostgresconn.cpp
18 changes: 17 additions & 1 deletion src/core/qgscontexthelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QTextStream>

#include "qgscontexthelp.h"
#include "qgsmessagelog.h"
#include "qgsapplication.h"
#include "qgslogger.h"

Expand Down Expand Up @@ -56,17 +57,32 @@ QProcess *QgsContextHelp::start()
QgsDebugMsg( QString( "Help path is %1" ).arg( helpPath ) );

QProcess *process = new QProcess;
process->start( helpPath );

// Delete this object if the process terminates
connect( process, SIGNAL( finished( int, QProcess::ExitStatus ) ), SLOT( processExited() ) );

// Delete the process if the application quits
connect( qApp, SIGNAL( aboutToQuit() ), process, SLOT( terminate() ) );

connect( process, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( error( QProcess::ProcessError ) ) );

#ifdef Q_OS_WIN
if ( QgsApplication::isRunningFromBuildDir() )
{
process->setEnvironment( QStringList() << QString( "PATH=%1;%2" ).arg( getenv( "PATH" ) ).arg( QApplication::applicationDirPath() ) );
}
#endif

process->start( helpPath );

return process;
}

void QgsContextHelp::error( QProcess::ProcessError error )
{
QgsMessageLog::logMessage( tr( "Error starting help viewer [%1]" ).arg( error ), tr( "Context help" ) );
}

void QgsContextHelp::showContext( QString context )
{
init();
Expand Down
12 changes: 2 additions & 10 deletions src/core/qgscontexthelp.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@

#include <QObject>
#include <QHash>
#include <QProcess>

class QProcess;

#ifdef Q_OS_MACX
#define QGSCONTEXTHELP_REUSE 1
#endif
/** \ingroup core
* Provides a context based help browser for a dialog.
*
Expand All @@ -35,11 +31,6 @@ class QProcess;
* viewer using QProcess and ensures that only one viewer is open.
* The viewer will be terminated if open when the main application quits.
*
* If the compile-time flag QGSCONTEXTHELP_REUSE is defined, the help viewer
* will be reused if it is still open. If this flag is not set, the viewer
* process will be terminated if open and restarted; this makes it the top
* window for window managers such as Linux/GNOME which will make a window
* active but not bring it to the top if raised programatically.
*/
class CORE_EXPORT QgsContextHelp : public QObject
{
Expand All @@ -49,6 +40,7 @@ class CORE_EXPORT QgsContextHelp : public QObject

private slots:
void processExited();
void error( QProcess::ProcessError error );

private:
//! Constructor
Expand Down
4 changes: 2 additions & 2 deletions src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ void QgsDelimitedTextProvider::fetchAttribute( QgsFeature& feature, int fieldIdx
{
case QVariant::Int:
{
int ivalue;
int ivalue = 0;
bool ok = false;
if ( ! value.isEmpty() ) ivalue = value.toInt( &ok );
if ( ok )
Expand All @@ -1217,7 +1217,7 @@ void QgsDelimitedTextProvider::fetchAttribute( QgsFeature& feature, int fieldIdx
}
case QVariant::Double:
{
double dvalue;
double dvalue = 0.0;
bool ok = false;
if ( ! value.isEmpty() )
{
Expand Down
4 changes: 2 additions & 2 deletions src/providers/postgres/qgspostgresconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,11 @@ PGresult *QgsPostgresConn::PQexec( QString query, bool logError )
}
else if ( logError )
{
QgsMessageLog::logMessage( tr( "Query failed: %1\nError: no result buffer" ).arg( query ) );
QgsMessageLog::logMessage( tr( "Query failed: %1\nError: no result buffer" ).arg( query ), tr( "PostGIS" ) );
}
else
{
QgsDebugMsg( tr( "Not logged query failed: %1\nError: no result buffer" ).arg( query ) );
QgsDebugMsg( QString( "Not logged query failed: %1\nError: no result buffer" ).arg( query ) );
}

return res;
Expand Down