Skip to content

Commit d5bdd2b

Browse files
author
mhugent
committedApr 16, 2008

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed
 

‎src/app/qgsnewhttpconnection.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "qgscontexthelp.h"
2020
#include <QSettings>
2121

22-
QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl): QDialog(parent, fl), mBaseKey(baseKey)
22+
QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl): QDialog(parent, fl), mBaseKey(baseKey), mOriginalConnName(connName)
2323
{
2424
setupUi(this);
2525
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
@@ -58,6 +58,12 @@ void QgsNewHttpConnection::saveConnection()
5858
{
5959
QSettings settings;
6060
QString key = mBaseKey + txtName->text();
61+
62+
//delete original entry first
63+
if(!mOriginalConnName.isNull() && mOriginalConnName != key)
64+
{
65+
settings.remove(mBaseKey + mOriginalConnName);
66+
}
6167
settings.writeEntry(key + "/url", txtUrl->text().trimmed());
6268
settings.writeEntry(key + "/proxyhost", txtProxyHost->text().trimmed());
6369
settings.writeEntry(key + "/proxyport", txtProxyPort->text().trimmed());

‎src/app/qgsnewhttpconnection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpConnectionBas
4040
void on_btnHelp_clicked();
4141
private:
4242
QString mBaseKey;
43+
QString mOriginalConnName; //store initial name to delete entry in case of rename
4344
static const int context_id = 308026563;
4445
};
4546

‎src/app/qgsserversourceselect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void QgsServerSourceSelect::on_btnEdit_clicked()
159159

160160
if (nc->exec())
161161
{
162-
nc->saveConnection();
162+
populateConnectionList();
163163
}
164164
}
165165

‎src/plugins/wfs/qgswfssourceselect.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,8 @@ void QgsWFSSourceSelect::modifyEntryOfServerList()
246246

247247
if (nc.exec())
248248
{
249-
nc.saveConnection();
249+
populateConnectionList();
250250
}
251-
populateConnectionList();
252251
}
253252

254253
void QgsWFSSourceSelect::deleteEntryOfServerList()

0 commit comments

Comments
 (0)
Please sign in to comment.