Skip to content
Permalink
Browse files

missed a file in r12390

git-svn-id: http://svn.osgeo.org/qgis/trunk@12391 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 9, 2009
1 parent 80c1cf3 commit 0c5ea3aac03e3cd0cfde85253990ac485174b65a
Showing with 22 additions and 7 deletions.
  1. +22 −7 src/app/ogr/qgsnewogrconnection.cpp
@@ -31,7 +31,8 @@


QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString& connType, const QString& connName, Qt::WFlags fl )
: QDialog( parent, fl )
: QDialog( parent, fl ),
mOriginalConnName( connName )
{
setupUi( this );

@@ -94,24 +95,38 @@ void QgsNewOgrConnection::testConnection()
}
}

void QgsNewOgrConnection::saveConnection()
/** Autoconnected SLOTS **/
void QgsNewOgrConnection::accept()
{
QSettings settings;
QString baseKey = "/" + cmbDatabaseTypes->currentText() + "/connections/";
settings.setValue( baseKey + "selected", txtName->text() );

// warn if entry was renamed to an existing connection
if (( mOriginalConnName.isNull() || mOriginalConnName != txtName->text() ) &&
settings.contains( baseKey + txtName->text() + "/host" ) &&
QMessageBox::question( this,
tr( "Save connection" ),
tr( "Should the existing connection %1 be overwritten?" ).arg( txtName->text() ),
QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel )
{
return;
}

// on rename delete original entry first
if ( !mOriginalConnName.isNull() && mOriginalConnName != txtName->text() )
{
settings.remove( baseKey + mOriginalConnName );
}

baseKey += txtName->text();
settings.setValue( baseKey + "/host", txtHost->text() );
settings.setValue( baseKey + "/database", txtDatabase->text() );
settings.setValue( baseKey + "/port", txtPort->text() );
settings.setValue( baseKey + "/username", txtUsername->text() );
settings.setValue( baseKey + "/password", chkStorePassword->isChecked() ? txtPassword->text() : "" );
settings.setValue( baseKey + "/save", chkStorePassword->isChecked() ? "true" : "false" );
}

/** Autoconnected SLOTS **/
void QgsNewOgrConnection::accept()
{
saveConnection();
QDialog::accept();
}

0 comments on commit 0c5ea3a

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