Fix for renaming of wms/wfs connections in dialog

git-svn-id: http://svn.osgeo.org/qgis/trunk@8354 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2008-04-16 15:41:24 +00:00
parent ed93065099
commit 44b97a3a7d
4 changed files with 10 additions and 4 deletions

View File

@ -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()));
@ -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());

View File

@ -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;
};

View File

@ -159,7 +159,7 @@ void QgsServerSourceSelect::on_btnEdit_clicked()
if (nc->exec())
{
nc->saveConnection();
populateConnectionList();
}
}

View File

@ -246,9 +246,8 @@ void QgsWFSSourceSelect::modifyEntryOfServerList()
if (nc.exec())
{
nc.saveConnection();
populateConnectionList();
}
populateConnectionList();
}
void QgsWFSSourceSelect::deleteEntryOfServerList()