Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Some small changes to use QgsNewHttpConnection for non-wms http conne…
…ctions (WFS in this case)

git-svn-id: http://svn.osgeo.org/qgis/trunk@5740 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 28, 2006
1 parent c2e3aad commit 771aa6f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
20 changes: 8 additions & 12 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -19,8 +19,7 @@
#include "qgscontexthelp.h"
#include <QSettings>

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()));
Expand All @@ -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"));
Expand All @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsnewhttpconnection.h
Expand Up @@ -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
Expand All @@ -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;
};

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsserversourceselect.cpp
Expand Up @@ -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())
{
Expand Down

0 comments on commit 771aa6f

Please sign in to comment.