qgsnewconnection.cpp_add_overwrite_prompt.patch
src/app/qgsnewconnection.cpp (working copy) | ||
---|---|---|
126 | 126 |
void QgsNewConnection::saveConnection() |
127 | 127 |
{ |
128 | 128 |
QSettings settings; |
129 | ||
130 |
// check for existing connection with same name |
|
131 |
settings.beginGroup( "/PostgreSQL/connections" ); |
|
132 |
QStringList keys = settings.childGroups(); |
|
133 |
if ( keys.contains( txtName->text() ) ) |
|
134 |
{ |
|
135 |
int res = QMessageBox::question( this, |
|
136 |
tr( "Save connection" ), |
|
137 |
tr( "Conection with name %1 already exists. Overwrite?" ).arg( txtName->text() ), |
|
138 |
QMessageBox::Yes | QMessageBox::No ); |
|
139 |
if ( res != QMessageBox::Yes ) |
|
140 |
{ |
|
141 |
return; |
|
142 |
} |
|
143 |
} |
|
144 |
settings.endGroup(); |
|
145 | ||
129 | 146 |
QString baseKey = "/PostgreSQL/connections/"; |
130 | 147 |
settings.setValue( baseKey + "selected", txtName->text() ); |
131 | 148 |
//delete original entry first |