Skip to content

Commit

Permalink
Fix for renaming of wms/wfs connections in dialog
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@8354 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 16, 2008
1 parent ed93065 commit 44b97a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/app/qgsnewhttpconnection.cpp
Expand Up @@ -19,7 +19,7 @@
#include "qgscontexthelp.h"
#include <QSettings>

QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl): QDialog(parent, fl), mBaseKey(baseKey)
QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl): QDialog(parent, fl), mBaseKey(baseKey), mOriginalConnName(connName)
{
setupUi(this);
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
Expand Down Expand Up @@ -58,6 +58,12 @@ void QgsNewHttpConnection::saveConnection()
{
QSettings settings;
QString key = mBaseKey + txtName->text();

//delete original entry first
if(!mOriginalConnName.isNull() && mOriginalConnName != key)
{
settings.remove(mBaseKey + mOriginalConnName);
}
settings.writeEntry(key + "/url", txtUrl->text().trimmed());
settings.writeEntry(key + "/proxyhost", txtProxyHost->text().trimmed());
settings.writeEntry(key + "/proxyport", txtProxyPort->text().trimmed());
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsnewhttpconnection.h
Expand Up @@ -40,6 +40,7 @@ class QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpConnectionBas
void on_btnHelp_clicked();
private:
QString mBaseKey;
QString mOriginalConnName; //store initial name to delete entry in case of rename
static const int context_id = 308026563;
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsserversourceselect.cpp
Expand Up @@ -159,7 +159,7 @@ void QgsServerSourceSelect::on_btnEdit_clicked()

if (nc->exec())
{
nc->saveConnection();
populateConnectionList();
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/wfs/qgswfssourceselect.cpp
Expand Up @@ -246,9 +246,8 @@ void QgsWFSSourceSelect::modifyEntryOfServerList()

if (nc.exec())
{
nc.saveConnection();
populateConnectionList();
}
populateConnectionList();
}

void QgsWFSSourceSelect::deleteEntryOfServerList()
Expand Down

0 comments on commit 44b97a3

Please sign in to comment.