Skip to content

Commit 771aa6f

Browse files
author
mhugent
committedAug 28, 2006
Some small changes to use QgsNewHttpConnection for non-wms http connections (WFS in this case)
git-svn-id: http://svn.osgeo.org/qgis/trunk@5740 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c2e3aad commit 771aa6f

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed
 

‎src/gui/qgsnewhttpconnection.cpp

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

22-
QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& connName, Qt::WFlags fl)
23-
: QDialog(parent, fl)
22+
QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl): QDialog(parent, fl), mBaseKey(baseKey)
2423
{
2524
setupUi(this);
2625
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
@@ -33,7 +32,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& connN
3332

3433
QSettings settings;
3534

36-
QString key = "/Qgis/connections-wms/" + connName;
35+
QString key = mBaseKey + connName;
3736
txtName->setText (connName);
3837
txtUrl->setText (settings.readEntry(key + "/url"));
3938
txtProxyHost->setText(settings.readEntry(key + "/proxyhost"));
@@ -58,15 +57,12 @@ void QgsNewHttpConnection::testConnection()
5857
void QgsNewHttpConnection::saveConnection()
5958
{
6059
QSettings settings;
61-
QString baseKey = "/Qgis/connections-wms/";
62-
63-
baseKey += txtName->text();
64-
settings.writeEntry(baseKey + "/url", txtUrl->text().trimmed());
65-
settings.writeEntry(baseKey + "/proxyhost", txtProxyHost->text().trimmed());
66-
settings.writeEntry(baseKey + "/proxyport", txtProxyPort->text().trimmed());
67-
settings.writeEntry(baseKey + "/proxyuser", txtProxyUser->text().trimmed());
68-
settings.writeEntry(baseKey + "/proxypassword",
69-
txtProxyPass->text().trimmed());
60+
QString key = mBaseKey + txtName->text();
61+
settings.writeEntry(key + "/url", txtUrl->text().trimmed());
62+
settings.writeEntry(key + "/proxyhost", txtProxyHost->text().trimmed());
63+
settings.writeEntry(key + "/proxyport", txtProxyPort->text().trimmed());
64+
settings.writeEntry(key + "/proxyuser", txtProxyUser->text().trimmed());
65+
settings.writeEntry(key + "/proxypassword", txtProxyPass->text().trimmed());
7066

7167
accept();
7268
}

‎src/gui/qgsnewhttpconnection.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpConnectionBas
2828
Q_OBJECT
2929
public:
3030
//! Constructor
31-
QgsNewHttpConnection(QWidget *parent = 0, const QString& connName = QString::null, Qt::WFlags fl = QgisGui::ModalDialogFlags);
31+
QgsNewHttpConnection(QWidget *parent = 0, const QString& baseKey = "/Qgis/connections-wms/", const QString& connName = QString::null, Qt::WFlags fl = QgisGui::ModalDialogFlags);
3232
//! Destructor
3333
~QgsNewHttpConnection();
3434
//! Tests the connection using the parameters supplied
@@ -39,6 +39,7 @@ class QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpConnectionBas
3939
//! Show context help
4040
void on_btnHelp_clicked();
4141
private:
42+
QString mBaseKey;
4243
static const int context_id = 308026563;
4344
};
4445

‎src/gui/qgsserversourceselect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void QgsServerSourceSelect::on_btnNew_clicked()
142142
void QgsServerSourceSelect::on_btnEdit_clicked()
143143
{
144144

145-
QgsNewHttpConnection *nc = new QgsNewHttpConnection(this, cmbConnections->currentText());
145+
QgsNewHttpConnection *nc = new QgsNewHttpConnection(this, "/Qgis/connections-wms/", cmbConnections->currentText());
146146

147147
if (nc->exec())
148148
{

0 commit comments

Comments
 (0)
Please sign in to comment.