Skip to content
Permalink
Browse files

pass password on to geometry type detection thread

git-svn-id: http://svn.osgeo.org/qgis/trunk@12795 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Jan 19, 2010
1 parent d49dc34 commit 9cc24e2a4d2e754f3021a8f961b3a986f73dbd16
Showing with 13 additions and 9 deletions.
  1. +11 −8 src/app/postgres/qgspgsourceselect.cpp
  2. +2 −1 src/app/postgres/qgspgsourceselect.h
@@ -321,7 +321,7 @@ QString QgsPgSourceSelect::layerURI( const QModelIndex &index )
}
}

QString uri = m_connectionInfo;
QString uri = m_connInfo;

if ( !pkColumnName.isEmpty() )
{
@@ -400,13 +400,15 @@ void QgsPgSourceSelect::on_btnConnect_clicked()

QgsDebugMsg( "Connection info: " + uri.connectionInfo() );

m_connectionInfo = uri.connectionInfo();
//qDebug(m_connectionInfo);
m_connInfo = uri.connectionInfo();

// Tidy up an existing connection if one exists.
if ( pd != 0 )
PQfinish( pd );

pd = PQconnectdb( uri.connectionInfo().toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
m_privConnInfo = m_connInfo;

pd = PQconnectdb( m_privConnInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8
// check the connection status
if ( PQstatus( pd ) != CONNECTION_OK && QString::fromUtf8( PQerrorMessage( pd ) ) == PQnoPasswordSupplied )
{
@@ -419,7 +421,7 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
tr( "Enter password" ),
tr( "Error: %1Enter password for %2" )
.arg( QString::fromUtf8( PQerrorMessage( pd ) ) )
.arg( uri.connectionInfo() ),
.arg( m_connInfo ),
QLineEdit::Password,
password,
&ok );
@@ -429,7 +431,8 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
if ( !ok )
break;

pd = PQconnectdb( QString( "%1 password='%2'" ).arg( uri.connectionInfo() ).arg( password ).toLocal8Bit() );
m_privConnInfo = QString( "%1 password='%2'" ).arg( m_connInfo ).arg( password );
pd = PQconnectdb( m_privConnInfo.toLocal8Bit() );
}
}

@@ -497,7 +500,7 @@ QStringList QgsPgSourceSelect::selectedTables()

QString QgsPgSourceSelect::connectionInfo()
{
return m_connectionInfo;
return m_connInfo;
}

void QgsPgSourceSelect::setSql( const QModelIndex &index )
@@ -533,7 +536,7 @@ void QgsPgSourceSelect::addSearchGeometryColumn( const QString &schema, const QS
if ( mColumnTypeThread == NULL )
{
mColumnTypeThread = new QgsGeomColumnTypeThread();
mColumnTypeThread->setConnInfo( m_connectionInfo );
mColumnTypeThread->setConnInfo( m_privConnInfo );
}
mColumnTypeThread->addGeometryColumn( schema, table, column );
}
@@ -175,7 +175,8 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsPgSourceSelectBase
QStringList mColumnLabels;
// Our thread for doing long running queries
QgsGeomColumnTypeThread* mColumnTypeThread;
QString m_connectionInfo;
QString m_connInfo;
QString m_privConnInfo;
QStringList m_selectedTables;
// Storage for the range of layer type icons
QMap<QString, QPair<QString, QIcon> > mLayerIcons;

0 comments on commit 9cc24e2

Please sign in to comment.
You can’t perform that action at this time.