2005-05-28 23:23:13 +00:00
|
|
|
/***************************************************************************
|
|
|
|
qgsnewhttpconnection.cpp - selector for a new HTTP server for WMS, etc.
|
|
|
|
-------------------
|
|
|
|
begin : 3 April 2005
|
|
|
|
copyright : (C) 2005 by Brendan Morley
|
|
|
|
email : morb at ozemail dot com dot au
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
/* $Id$ */
|
|
|
|
#include "qgsnewhttpconnection.h"
|
2006-01-15 20:57:38 +00:00
|
|
|
#include "qgscontexthelp.h"
|
2005-12-30 04:56:31 +00:00
|
|
|
#include <QSettings>
|
2005-05-28 23:23:13 +00:00
|
|
|
|
2006-01-15 12:08:18 +00:00
|
|
|
QgsNewHttpConnection::QgsNewHttpConnection(QWidget *parent, const QString& connName, Qt::WFlags fl)
|
|
|
|
: QDialog(parent, fl)
|
2005-05-28 23:23:13 +00:00
|
|
|
{
|
2005-12-30 04:56:31 +00:00
|
|
|
setupUi(this);
|
|
|
|
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
|
|
|
connect(btnOk, SIGNAL(clicked()), this, SLOT(saveConnection()));
|
|
|
|
|
2005-05-28 23:23:13 +00:00
|
|
|
if (!connName.isEmpty())
|
|
|
|
{
|
|
|
|
// populate the dialog with the information stored for the connection
|
|
|
|
// populate the fields with the stored setting parameters
|
|
|
|
|
2005-11-24 17:18:36 +00:00
|
|
|
QSettings settings;
|
2005-05-28 23:23:13 +00:00
|
|
|
|
|
|
|
QString key = "/Qgis/connections-wms/" + connName;
|
2005-06-05 21:45:52 +00:00
|
|
|
txtName->setText (connName);
|
|
|
|
txtUrl->setText (settings.readEntry(key + "/url"));
|
|
|
|
txtProxyHost->setText(settings.readEntry(key + "/proxyhost"));
|
|
|
|
txtProxyPort->setText(settings.readEntry(key + "/proxyport"));
|
2006-04-10 08:55:44 +00:00
|
|
|
txtProxyUser->setText(settings.readEntry(key + "/proxyuser"));
|
|
|
|
txtProxyPass->setText(settings.readEntry(key + "/proxypassword"));
|
2005-05-28 23:23:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QgsNewHttpConnection::~QgsNewHttpConnection()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void QgsNewHttpConnection::testConnection()
|
|
|
|
{
|
|
|
|
// following line uses Qt SQL plugin - currently not used
|
|
|
|
// QSqlDatabase *testCon = QSqlDatabase::addDatabase("QPSQL7","testconnection");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void QgsNewHttpConnection::saveConnection()
|
|
|
|
{
|
2005-11-24 17:18:36 +00:00
|
|
|
QSettings settings;
|
2005-05-28 23:23:13 +00:00
|
|
|
QString baseKey = "/Qgis/connections-wms/";
|
|
|
|
|
|
|
|
baseKey += txtName->text();
|
2006-04-08 23:46:52 +00:00
|
|
|
settings.writeEntry(baseKey + "/url", txtUrl->text().trimmed());
|
|
|
|
settings.writeEntry(baseKey + "/proxyhost", txtProxyHost->text().trimmed());
|
|
|
|
settings.writeEntry(baseKey + "/proxyport", txtProxyPort->text().trimmed());
|
2006-04-10 08:55:44 +00:00
|
|
|
settings.writeEntry(baseKey + "/proxyuser", txtProxyUser->text().trimmed());
|
|
|
|
settings.writeEntry(baseKey + "/proxypassword",
|
|
|
|
txtProxyPass->text().trimmed());
|
2005-05-28 23:23:13 +00:00
|
|
|
|
|
|
|
accept();
|
|
|
|
}
|
|
|
|
|
2006-01-15 20:57:38 +00:00
|
|
|
void QgsNewHttpConnection::on_btnHelp_clicked()
|
|
|
|
{
|
|
|
|
QgsContextHelp::run(context_id);
|
|
|
|
}
|