From 784e8ce6cee072eb3d4e4385a0fdf22b87dec3d9 Mon Sep 17 00:00:00 2001 From: mhugent Date: Mon, 28 Aug 2006 14:48:57 +0000 Subject: [PATCH] Some small changes to use QgsNewHttpConnection for non-wms http connections (WFS in this case) git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5740 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/gui/qgsnewhttpconnection.cpp | 20 ++++++++------------ src/gui/qgsnewhttpconnection.h | 3 ++- src/gui/qgsserversourceselect.cpp | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/gui/qgsnewhttpconnection.cpp b/src/gui/qgsnewhttpconnection.cpp index a8fecf1f593..c4b8cfa17a7 100644 --- a/src/gui/qgsnewhttpconnection.cpp +++ b/src/gui/qgsnewhttpconnection.cpp @@ -19,8 +19,7 @@ #include "qgscontexthelp.h" #include -QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& connName, Qt::WFlags fl) - : QDialog(parent, fl) +QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl): QDialog(parent, fl), mBaseKey(baseKey) { setupUi(this); connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); @@ -33,7 +32,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& connN QSettings settings; - QString key = "/Qgis/connections-wms/" + connName; + QString key = mBaseKey + connName; txtName->setText (connName); txtUrl->setText (settings.readEntry(key + "/url")); txtProxyHost->setText(settings.readEntry(key + "/proxyhost")); @@ -58,15 +57,12 @@ void QgsNewHttpConnection::testConnection() void QgsNewHttpConnection::saveConnection() { QSettings settings; - QString baseKey = "/Qgis/connections-wms/"; - - baseKey += txtName->text(); - settings.writeEntry(baseKey + "/url", txtUrl->text().trimmed()); - settings.writeEntry(baseKey + "/proxyhost", txtProxyHost->text().trimmed()); - settings.writeEntry(baseKey + "/proxyport", txtProxyPort->text().trimmed()); - settings.writeEntry(baseKey + "/proxyuser", txtProxyUser->text().trimmed()); - settings.writeEntry(baseKey + "/proxypassword", - txtProxyPass->text().trimmed()); + QString key = mBaseKey + txtName->text(); + settings.writeEntry(key + "/url", txtUrl->text().trimmed()); + settings.writeEntry(key + "/proxyhost", txtProxyHost->text().trimmed()); + settings.writeEntry(key + "/proxyport", txtProxyPort->text().trimmed()); + settings.writeEntry(key + "/proxyuser", txtProxyUser->text().trimmed()); + settings.writeEntry(key + "/proxypassword", txtProxyPass->text().trimmed()); accept(); } diff --git a/src/gui/qgsnewhttpconnection.h b/src/gui/qgsnewhttpconnection.h index 3f718fb05a9..15027c573ed 100644 --- a/src/gui/qgsnewhttpconnection.h +++ b/src/gui/qgsnewhttpconnection.h @@ -28,7 +28,7 @@ class QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpConnectionBas Q_OBJECT public: //! Constructor - QgsNewHttpConnection(QWidget *parent = 0, const QString& connName = QString::null, Qt::WFlags fl = QgisGui::ModalDialogFlags); + QgsNewHttpConnection(QWidget *parent = 0, const QString& baseKey = "/Qgis/connections-wms/", const QString& connName = QString::null, Qt::WFlags fl = QgisGui::ModalDialogFlags); //! Destructor ~QgsNewHttpConnection(); //! Tests the connection using the parameters supplied @@ -39,6 +39,7 @@ class QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpConnectionBas //! Show context help void on_btnHelp_clicked(); private: + QString mBaseKey; static const int context_id = 308026563; }; diff --git a/src/gui/qgsserversourceselect.cpp b/src/gui/qgsserversourceselect.cpp index 12d19642bd8..b08e70223c9 100644 --- a/src/gui/qgsserversourceselect.cpp +++ b/src/gui/qgsserversourceselect.cpp @@ -142,7 +142,7 @@ void QgsServerSourceSelect::on_btnNew_clicked() void QgsServerSourceSelect::on_btnEdit_clicked() { - QgsNewHttpConnection *nc = new QgsNewHttpConnection(this, cmbConnections->currentText()); + QgsNewHttpConnection *nc = new QgsNewHttpConnection(this, "/Qgis/connections-wms/", cmbConnections->currentText()); if (nc->exec()) {