[QGIS Commit] r12855 - in trunk/qgis/src: app app/postgres ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Feb 1 04:01:41 EST 2010


Author: mhugent
Date: 2010-02-01 04:01:41 -0500 (Mon, 01 Feb 2010)
New Revision: 12855

Added:
   trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp
   trunk/qgis/src/app/qgsmanageconnectionsdialog.h
   trunk/qgis/src/ui/qgsmanageconnectionsdialogbase.ui
Modified:
   trunk/qgis/src/app/CMakeLists.txt
   trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
   trunk/qgis/src/app/postgres/qgspgsourceselect.h
   trunk/qgis/src/app/qgswmssourceselect.cpp
   trunk/qgis/src/app/qgswmssourceselect.h
   trunk/qgis/src/ui/qgspgsourceselectbase.ui
   trunk/qgis/src/ui/qgswmssourceselectbase.ui
Log:
Applied patch #2341 (loading and saving of WMS and PostGIS connections) from alexbruy

Modified: trunk/qgis/src/app/CMakeLists.txt
===================================================================
--- trunk/qgis/src/app/CMakeLists.txt	2010-01-31 16:38:06 UTC (rev 12854)
+++ trunk/qgis/src/app/CMakeLists.txt	2010-02-01 09:01:41 UTC (rev 12855)
@@ -72,6 +72,8 @@
   qgsvectorlayerproperties.cpp
   qgsquerybuilder.cpp
 
+  qgsmanageconnectionsdialog.cpp
+
   composer/qgsattributeselectiondialog.cpp
   composer/qgscomposer.cpp
   composer/qgscomposerarrowwidget.cpp
@@ -138,6 +140,8 @@
   qgsidentifyresults.h
   qgslabeldialog.h
 
+  qgsmanageconnectionsdialog.h
+
   qgsmaptoolidentify.h
   qgsmaptoolsplitfeatures.h
   qgsmaptoolvertexedit.h

Modified: trunk/qgis/src/app/postgres/qgspgsourceselect.cpp
===================================================================
--- trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2010-01-31 16:38:06 UTC (rev 12854)
+++ trunk/qgis/src/app/postgres/qgspgsourceselect.cpp	2010-02-01 09:01:41 UTC (rev 12855)
@@ -24,6 +24,7 @@
 #include "qgsapplication.h"
 #include "qgscontexthelp.h"
 #include "qgspgnewconnection.h"
+#include "qgsmanageconnectionsdialog.h"
 #include "qgsquerybuilder.h"
 #include "qgsdatasourceuri.h"
 #include "qgsvectorlayer.h"
@@ -126,6 +127,19 @@
   populateConnectionList();
 }
 
+void QgsPgSourceSelect::on_btnSave_clicked()
+{
+  QgsManageConnectionsDialog dlg( this, QgsManageConnectionsDialog::Save, QgsManageConnectionsDialog::PostGIS );
+  dlg.exec();
+}
+
+void QgsPgSourceSelect::on_btnLoad_clicked()
+{
+  QgsManageConnectionsDialog dlg( this, QgsManageConnectionsDialog::Load, QgsManageConnectionsDialog::PostGIS );
+  dlg.exec();
+  populateConnectionList();
+}
+
 // Slot for editing a connection
 void QgsPgSourceSelect::on_btnEdit_clicked()
 {

Modified: trunk/qgis/src/app/postgres/qgspgsourceselect.h
===================================================================
--- trunk/qgis/src/app/postgres/qgspgsourceselect.h	2010-01-31 16:38:06 UTC (rev 12854)
+++ trunk/qgis/src/app/postgres/qgspgsourceselect.h	2010-02-01 09:01:41 UTC (rev 12855)
@@ -131,6 +131,10 @@
     void on_btnBuildQuery_clicked();
     //! Deletes the selected connection
     void on_btnDelete_clicked();
+    //! Saves the selected connections to the file
+    void on_btnSave_clicked();
+    //! Loads the selected connections from the file
+    void on_btnLoad_clicked();
     void on_mSearchOptionsButton_clicked();
     void on_mSearchTableEdit_textChanged( const QString & text );
     void on_mSearchColumnComboBox_currentIndexChanged( const QString & text );

Added: trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp	                        (rev 0)
+++ trunk/qgis/src/app/qgsmanageconnectionsdialog.cpp	2010-02-01 09:01:41 UTC (rev 12855)
@@ -0,0 +1,413 @@
+/***************************************************************************
+    qgsmanageconnectionsdialog.cpp
+    ---------------------
+    begin                : Dec 2009
+    copyright            : (C) 2009 by Alexander Bruy
+    email                : alexander dot bruy at gmail dot com
+
+ ***************************************************************************
+ *                                                                         *
+ *   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 <QFileDialog>
+#include <QMessageBox>
+#include <QSettings>
+#include <QTextStream>
+#include <QDebug>
+
+#include "qgsmanageconnectionsdialog.h"
+
+QgsManageConnectionsDialog::QgsManageConnectionsDialog( QWidget *parent, Mode mode, Type type ) : QDialog( parent ), mDialogMode( mode ), mConnectionType( type )
+{
+  setupUi( this );
+
+  if ( mDialogMode == Load )
+  {
+    label->setText( tr( "Load from file" ) );
+    buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Load" ) );
+  }
+  else
+  {
+    buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Save" ) );
+    populateConnections();
+  }
+
+  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
+}
+
+void QgsManageConnectionsDialog::on_btnBrowse_clicked()
+{
+  QString fileName;
+  if ( mDialogMode == Save )
+  {
+    fileName = QFileDialog::getSaveFileName( this, tr( "Save connections" ), ".", tr( "XML files (*.xml *.XML)" ) );
+  }
+  else
+  {
+    fileName = QFileDialog::getOpenFileName( this, tr( "Load connections" ), ".", tr( "XML files (*.xml *XML)" ) );
+  }
+
+  if ( fileName.isEmpty() )
+  {
+    return;
+  }
+
+  // ensure the user never ommited the extension from the file name
+  if ( !fileName.toLower().endsWith( ".xml" ) )
+  {
+    fileName += ".xml";
+  }
+
+  mFileName = fileName;
+  leFileName->setText( mFileName );
+  //buttonBox->button( QDialogButtonBox::Ok )->setEnabled( true );
+
+  if ( mDialogMode == Load )
+  {
+    populateConnections();
+  }
+
+  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( true );
+}
+
+void QgsManageConnectionsDialog::on_buttonBox_accepted()
+{
+  QList<QListWidgetItem *> selection = listConnections->selectedItems();
+  if ( selection.isEmpty() )
+  {
+    return;
+  }
+  QStringList items;
+  for ( int i = 0; i < selection.size(); ++i )
+  {
+    items.append( selection.at( i )->text() );
+  }
+
+  if ( mDialogMode == Save )
+  {
+    QDomDocument doc;
+    if ( mConnectionType == WMS )
+    {
+      doc = saveWMSConnections( items );
+    }
+    else
+    {
+      doc = savePgConnections( items );
+    }
+
+    QFile file( mFileName );
+    if ( !file.open( QIODevice::WriteOnly | QIODevice::Text ) )
+    {
+      QMessageBox::warning( this, tr( "Saving connections" ),
+                            tr( "Cannot write file %1:\n%2." )
+                            .arg( mFileName )
+                            .arg( file.errorString() ) );
+      return;
+    }
+
+    QTextStream out( &file );
+    doc.save( out, 4 );
+  }
+  else // load connections
+  {
+    QFile file( mFileName );
+    if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
+    {
+      QMessageBox::warning( this, tr( "Loading connections" ),
+                            tr( "Cannot read file %1:\n%2." )
+                            .arg( mFileName )
+                            .arg( file.errorString() ) );
+      return;
+    }
+
+    QDomDocument doc;
+    QString errorStr;
+    int errorLine;
+    int errorColumn;
+
+    if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
+    {
+      QMessageBox::warning( this, tr( "Loading connections" ),
+                            tr( "Parse error at line %1, column %2:\n%3" )
+                            .arg( errorLine )
+                            .arg( errorColumn )
+                            .arg( errorStr ) );
+      return;
+    }
+
+    if ( mConnectionType == WMS )
+    {
+      loadWMSConnections( doc, items );
+    }
+    else
+    {
+      loadPgConnections( doc, items );
+    }
+  }
+
+  mFileName = "";
+  leFileName->clear();
+  listConnections->clear();
+  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
+}
+
+void QgsManageConnectionsDialog::populateConnections()
+{
+  // Save mode. Populate connections list from settings
+  if ( mDialogMode == 0 )
+  {
+    QSettings settings;
+    if ( mConnectionType == 0 )
+    {
+      settings.beginGroup( "/Qgis/connections-wms" );
+    }
+    else
+    {
+      settings.beginGroup( "/PostgreSQL/connections" );
+    }
+    QStringList keys = settings.childGroups();
+    QStringList::Iterator it = keys.begin();
+    while ( it != keys.end() )
+    {
+      QListWidgetItem *item = new QListWidgetItem();
+      item->setText( *it );
+      listConnections->addItem( item );
+      ++it;
+    }
+    settings.endGroup();
+  }
+  // Load mode. Populate connections list from file
+  else
+  {
+    QFile file( mFileName );
+    if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
+    {
+      QMessageBox::warning( this, tr( "Loading connections" ),
+                            tr( "Cannot read file %1:\n%2." )
+                            .arg( mFileName )
+                            .arg( file.errorString() ) );
+      return;
+    }
+
+    QDomDocument doc;
+    QString errorStr;
+    int errorLine;
+    int errorColumn;
+
+    if ( !doc.setContent( &file, true, &errorStr, &errorLine, &errorColumn ) )
+    {
+      QMessageBox::warning( this, tr( "Loading connections" ),
+                            tr( "Parse error at line %1, column %2:\n%3" )
+                            .arg( errorLine )
+                            .arg( errorColumn )
+                            .arg( errorStr ) );
+      return;
+    }
+
+    QDomElement root = doc.documentElement();
+    if ( mConnectionType == 0 )
+    {
+      if ( root.tagName() != "qgsWMSConnections" )
+      {
+        QMessageBox::information( this, tr( "Loading connections" ),
+                                  tr( "The file is not an WMS connections exchange file." ) );
+        mFileName = "";
+        leFileName->clear();
+        listConnections->clear();
+        return;
+      }
+    }
+    else
+    {
+      if ( root.tagName() != "qgsPgConnections" )
+      {
+        QMessageBox::information( this, tr( "Loading connections" ),
+                                  tr( "The file is not an PostGIS connections exchange file." ) );
+        mFileName = "";
+        leFileName->clear();
+        listConnections->clear();
+        return;
+      }
+    }
+
+    QDomElement child = root.firstChildElement();
+    while ( !child.isNull() )
+    {
+      QListWidgetItem *item = new QListWidgetItem();
+      item->setText( child.attribute( "name" ) );
+      listConnections->addItem( item );
+      child = child.nextSiblingElement();
+    }
+  }
+}
+
+QDomDocument QgsManageConnectionsDialog::saveWMSConnections( const QStringList &connections )
+{
+  QDomDocument doc( "connections" );
+  QDomElement root = doc.createElement( "qgsWMSConnections" );
+  root.setAttribute( "version", "1.0" );
+  doc.appendChild( root );
+
+  QSettings settings;
+  QString path;
+  for ( int i = 0; i < connections.count(); ++i )
+  {
+    path = "/Qgis/connections-wms/";
+    QDomElement el = doc.createElement( "wms" );
+    el.setAttribute( "name", connections[ i ] );
+    el.setAttribute( "url", settings.value( path + connections[ i ] + "/url", "" ).toString() );
+
+    path = "/Qgis/WMS/";
+    el.setAttribute( "username", settings.value( path + connections[ i ] + "/username", "" ).toString() );
+    el.setAttribute( "password", settings.value( path + connections[ i ] + "/password", "" ).toString() );
+    root.appendChild( el );
+  }
+
+  return doc;
+}
+
+QDomDocument QgsManageConnectionsDialog::savePgConnections( const QStringList &connections )
+{
+  QDomDocument doc( "connections" );
+  QDomElement root = doc.createElement( "qgsPgConnections" );
+  root.setAttribute( "version", "1.0" );
+  doc.appendChild( root );
+
+  QSettings settings;
+  QString path;
+  for ( int i = 0; i < connections.count(); ++i )
+  {
+    path = "/PostgreSQL/connections/" + connections[ i ];
+    QDomElement el = doc.createElement( "postgis" );
+    el.setAttribute( "name", connections[ i ] );
+    el.setAttribute( "host", settings.value( path + "/host", "" ).toString() );
+    el.setAttribute( "port", settings.value( path + "/port", "" ).toString() );
+    el.setAttribute( "db", settings.value( path + "/database", "" ).toString() );
+    el.setAttribute( "username", settings.value( path + "/username", "" ).toString() );
+    el.setAttribute( "password", settings.value( path + "/password", "" ).toString() );
+    el.setAttribute( "sslmode", settings.value( path + "/sslmode", "1" ).toString() );
+    root.appendChild( el );
+  }
+
+  return doc;
+}
+
+void QgsManageConnectionsDialog::loadWMSConnections( const QDomDocument &doc, const QStringList &items )
+{
+  QDomElement root = doc.documentElement();
+  if ( root.tagName() != "qgsWMSConnections" )
+  {
+    QMessageBox::information( this, tr( "Loading connections" ),
+                              tr( "The file is not an WMS connections exchange file." ) );
+    return;
+  }
+
+  QString connectionName;
+  QSettings settings;
+  settings.beginGroup( "/Qgis/connections-wms" );
+  QStringList keys = settings.childGroups();
+  settings.endGroup();
+  QDomElement child = root.firstChildElement();
+  while ( !child.isNull() )
+  {
+    connectionName = child.attribute( "name" );
+    if ( !items.contains( connectionName ) )
+    {
+      child = child.nextSiblingElement();
+      continue;
+    }
+
+    // check for duplicates
+    if ( keys.contains( connectionName ) )
+    {
+      int res = QMessageBox::warning( this, tr( "Loading connections" ),
+                                      tr( "Connection with name %1 already exists. Overwrite?" )
+                                      .arg( connectionName ),
+                                      QMessageBox::Yes | QMessageBox::No );
+      if ( res != QMessageBox::Yes )
+      {
+        child = child.nextSiblingElement();
+        continue;
+      }
+    }
+
+    // no dups detected or overwrite is allowed
+    settings.beginGroup( "/Qgis/connections-wms" );
+    settings.setValue( QString( "/" + connectionName + "/url" ) , child.attribute( "url" ) );
+    settings.endGroup();
+
+    if ( !child.attribute( "username" ).isEmpty() )
+    {
+      settings.beginGroup( "/Qgis/WMS/" + connectionName );
+      settings.setValue( "/username", child.attribute( "username" ) );
+      settings.setValue( "/password", child.attribute( "password" ) );
+      settings.endGroup();
+    }
+    child = child.nextSiblingElement();
+  }
+}
+
+void QgsManageConnectionsDialog::loadPgConnections( const QDomDocument &doc, const QStringList &items )
+{
+  QDomElement root = doc.documentElement();
+  if ( root.tagName() != "qgsPgConnections" )
+  {
+    QMessageBox::information( this, tr( "Loading connections" ),
+                              tr( "The file is not an PostGIS connections exchange file." ) );
+    return;
+  }
+
+  QString connectionName;
+  QSettings settings;
+  settings.beginGroup( "/PostgreSQL/connections" );
+  QStringList keys = settings.childGroups();
+  settings.endGroup();
+  QDomElement child = root.firstChildElement();
+  while ( !child.isNull() )
+  {
+    connectionName = child.attribute( "name" );
+    if ( !items.contains( connectionName ) )
+    {
+      child = child.nextSiblingElement();
+      continue;
+    }
+
+    // check for duplicates
+    if ( keys.contains( connectionName ) )
+    {
+      int res = QMessageBox::warning( this, tr( "Loading conections" ),
+                                      tr( "Connection with name %1 already exists. Overwrite?" )
+                                      .arg( connectionName ),
+                                      QMessageBox::Yes | QMessageBox::No );
+      if ( res != QMessageBox::Yes )
+      {
+        child = child.nextSiblingElement();
+        continue;
+      }
+    }
+
+    //no dups detected or overwrite is allowed
+    settings.beginGroup( "/PostgreSQL/connections/" + connectionName );
+    settings.setValue( "/host", child.attribute( "host" ) );
+    settings.setValue( "/port", child.attribute( "port" ) );
+    settings.setValue( "/database", child.attribute( "db" ) );
+    settings.setValue( "/sslmode", child.attribute( "sslmode" ) );
+    if ( !child.attribute( "username" ).isEmpty() )
+    {
+      settings.setValue( "/username", child.attribute( "username" ) );
+      settings.setValue( "/password", child.attribute( "password" ) );
+      settings.setValue( "/save", "true" );
+    }
+    settings.endGroup();
+
+    child = child.nextSiblingElement();
+  }
+}
+

Added: trunk/qgis/src/app/qgsmanageconnectionsdialog.h
===================================================================
--- trunk/qgis/src/app/qgsmanageconnectionsdialog.h	                        (rev 0)
+++ trunk/qgis/src/app/qgsmanageconnectionsdialog.h	2010-02-01 09:01:41 UTC (rev 12855)
@@ -0,0 +1,66 @@
+/***************************************************************************
+    qgsmanageconnectionsdialog.h
+    ---------------------
+    begin                : Dec 2009
+    copyright            : (C) 2009 by Alexander Bruy
+    email                : alexander dot bruy at gmail dot com
+
+ ***************************************************************************
+ *                                                                         *
+ *   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$ */
+
+#ifndef QGSMANAGECONNECTIONSDIALOG_H
+#define QGSMANAGECONNECTIONSDIALOG_H
+
+#include <QDialog>
+#include <QDomDocument>
+#include "ui_qgsmanageconnectionsdialogbase.h"
+
+class QgsManageConnectionsDialog : public QDialog, private Ui::QgsManageConnectionsDialogBase
+{
+    Q_OBJECT
+
+  public:
+    enum Mode
+    {
+      Save,
+      Load
+    };
+
+    enum Type
+    {
+      WMS,
+      PostGIS
+    };
+
+    // constructor
+    // mode argument must be 0 for saving and 1 for loading
+    // type argument must be 0 for WMS and 1 for PostGIS
+    QgsManageConnectionsDialog( QWidget *parent = NULL, Mode mode = Save, Type type = WMS );
+
+  public slots:
+    void on_btnBrowse_clicked();
+    void on_buttonBox_accepted();
+
+    void populateConnections();
+
+  private:
+    QDomDocument saveWMSConnections( const QStringList &connections );
+    QDomDocument savePgConnections( const QStringList & connections );
+    void loadWMSConnections( const QDomDocument &doc, const QStringList &items );
+    void loadPgConnections( const QDomDocument &doc, const QStringList &items );
+
+    QString mFileName;
+    Mode mDialogMode;
+    Type mConnectionType;
+};
+
+#endif // QGSMANAGECONNECTIONSDIALOG_H
+

Modified: trunk/qgis/src/app/qgswmssourceselect.cpp
===================================================================
--- trunk/qgis/src/app/qgswmssourceselect.cpp	2010-01-31 16:38:06 UTC (rev 12854)
+++ trunk/qgis/src/app/qgswmssourceselect.cpp	2010-02-01 09:01:41 UTC (rev 12855)
@@ -27,6 +27,7 @@
 #include "qgsgenericprojectionselector.h"
 #include "qgshttptransaction.h"
 #include "qgslogger.h"
+#include "qgsmanageconnectionsdialog.h"
 #include "qgsmessageviewer.h"
 #include "qgsnewhttpconnection.h"
 #include "qgsnumericsortlistviewitem.h"
@@ -35,7 +36,6 @@
 #include "qgswmssourceselect.h"
 #include <qgisinterface.h>
 
-
 #include <QButtonGroup>
 #include <QDomDocument>
 #include <QHeaderView>
@@ -203,11 +203,25 @@
   if ( result == QMessageBox::Ok )
   {
     settings.remove( key );
+    settings.remove( "/Qgis/WMS/" + cmbConnections->currentText() );
     cmbConnections->removeItem( cmbConnections->currentIndex() );  // populateConnectionList();
     setConnectionListPosition();
   }
 }
 
+void QgsWMSSourceSelect::on_btnSave_clicked()
+{
+  QgsManageConnectionsDialog dlg( this, QgsManageConnectionsDialog::Save, QgsManageConnectionsDialog::WMS );
+  dlg.exec();
+}
+
+void QgsWMSSourceSelect::on_btnLoad_clicked()
+{
+  QgsManageConnectionsDialog dlg( this, QgsManageConnectionsDialog::Load, QgsManageConnectionsDialog::WMS );
+  dlg.exec();
+  populateConnectionList();
+}
+
 QgsNumericSortTreeWidgetItem *QgsWMSSourceSelect::createItem(
   int id, const QStringList &names, QMap<int, QgsNumericSortTreeWidgetItem *> &items, int &layerAndStyleCount,
   const QMap<int, int> &layerParents, const QMap<int, QStringList> &layerParentNames )
@@ -821,7 +835,7 @@
   }
   // Get username/password from settings for protected WMS
 
-  QString mySearchUrl = settings.value("/qgis/WMSSearchUrl", "http://geopole.org/wms/search?search=%1&type=rss").toString();
+  QString mySearchUrl = settings.value( "/qgis/WMSSearchUrl", "http://geopole.org/wms/search?search=%1&type=rss" ).toString();
   QUrl url( mySearchUrl.arg( searchTerm ) );
   QgsDebugMsg( url.toString() );
   QgsHttpTransaction http( url.toEncoded(),

Modified: trunk/qgis/src/app/qgswmssourceselect.h
===================================================================
--- trunk/qgis/src/app/qgswmssourceselect.h	2010-01-31 16:38:06 UTC (rev 12854)
+++ trunk/qgis/src/app/qgswmssourceselect.h	2010-02-01 09:01:41 UTC (rev 12855)
@@ -98,6 +98,10 @@
     void on_btnEdit_clicked();
     //! Deletes the selected connection
     void on_btnDelete_clicked();
+    //! Saves conncetions to the file
+    void on_btnSave_clicked();
+    //! Loads connections from the file
+    void on_btnLoad_clicked();
 
     /*! Connects to the database using the stored connection parameters.
     * Once connected, available layers are displayed.

Added: trunk/qgis/src/ui/qgsmanageconnectionsdialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsmanageconnectionsdialogbase.ui	                        (rev 0)
+++ trunk/qgis/src/ui/qgsmanageconnectionsdialogbase.ui	2010-02-01 09:01:41 UTC (rev 12855)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>QgsManageConnectionsDialogBase</class>
+ <widget class="QDialog" name="QgsManageConnectionsDialogBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Manage connections</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Save to file</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="leFileName"/>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnBrowse">
+       <property name="text">
+        <string>Browse</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QListWidget" name="listConnections">
+     <property name="editTriggers">
+      <set>QAbstractItemView::NoEditTriggers</set>
+     </property>
+     <property name="alternatingRowColors">
+      <bool>true</bool>
+     </property>
+     <property name="selectionMode">
+      <enum>QAbstractItemView::ExtendedSelection</enum>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>QgsManageConnectionsDialogBase</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>QgsManageConnectionsDialogBase</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Modified: trunk/qgis/src/ui/qgspgsourceselectbase.ui
===================================================================
--- trunk/qgis/src/ui/qgspgsourceselectbase.ui	2010-01-31 16:38:06 UTC (rev 12854)
+++ trunk/qgis/src/ui/qgspgsourceselectbase.ui	2010-02-01 09:01:41 UTC (rev 12855)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>406</width>
-    <height>470</height>
+    <height>500</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -37,28 +37,28 @@
       <property name="spacing">
        <number>6</number>
       </property>
-      <item row="1" column="3">
+      <item row="2" column="3">
        <widget class="QPushButton" name="btnDelete">
         <property name="text">
          <string>Delete</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="2">
+      <item row="2" column="2">
        <widget class="QPushButton" name="btnEdit">
         <property name="text">
          <string>Edit</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
+      <item row="2" column="1">
        <widget class="QPushButton" name="btnNew">
         <property name="text">
          <string>New</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="0">
+      <item row="2" column="0">
        <widget class="QPushButton" name="btnConnect">
         <property name="text">
          <string>Connect</string>
@@ -72,6 +72,24 @@
     </widget>
    </item>
    <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QPushButton" name="btnSave">
+       <property name="text">
+        <string>Save connections</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnLoad">
+       <property name="text">
+        <string>Load connections</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
     <widget class="QTreeView" name="mTablesTreeView">
      <property name="selectionMode">
       <enum>QAbstractItemView::ExtendedSelection</enum>

Modified: trunk/qgis/src/ui/qgswmssourceselectbase.ui
===================================================================
--- trunk/qgis/src/ui/qgswmssourceselectbase.ui	2010-01-31 16:38:06 UTC (rev 12854)
+++ trunk/qgis/src/ui/qgswmssourceselectbase.ui	2010-02-01 09:01:41 UTC (rev 12855)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>555</width>
-    <height>508</height>
+    <width>439</width>
+    <height>539</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -15,8 +15,7 @@
   </property>
   <property name="windowIcon">
    <iconset>
-    <normaloff/>
-   </iconset>
+    <normaloff>../../../../.designer/backup</normaloff>../../../../.designer/backup</iconset>
   </property>
   <property name="sizeGripEnabled">
    <bool>true</bool>
@@ -24,8 +23,8 @@
   <property name="modal">
    <bool>true</bool>
   </property>
-  <layout class="QGridLayout">
-   <item row="0" column="0" colspan="2">
+  <layout class="QGridLayout" name="gridLayout_2">
+   <item row="0" column="0">
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
       <number>0</number>
@@ -34,11 +33,11 @@
       <attribute name="title">
        <string>Servers</string>
       </attribute>
-      <layout class="QGridLayout">
-       <item row="0" column="0" colspan="6">
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="0" column="0" colspan="8">
         <widget class="QComboBox" name="cmbConnections"/>
        </item>
-       <item row="1" column="0">
+       <item row="1" column="0" colspan="2">
         <widget class="QPushButton" name="btnConnect">
          <property name="enabled">
           <bool>false</bool>
@@ -48,14 +47,14 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
+       <item row="1" column="2" colspan="2">
         <widget class="QPushButton" name="btnNew">
          <property name="text">
           <string>&amp;New</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="2">
+       <item row="1" column="4">
         <widget class="QPushButton" name="btnEdit">
          <property name="enabled">
           <bool>false</bool>
@@ -65,7 +64,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="3">
+       <item row="1" column="5">
         <widget class="QPushButton" name="btnDelete">
          <property name="enabled">
           <bool>false</bool>
@@ -75,23 +74,20 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="4">
-        <spacer>
+       <item row="1" column="6">
+        <spacer name="horizontalSpacer_2">
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Expanding</enum>
-         </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>16</width>
-           <height>31</height>
+           <width>8</width>
+           <height>20</height>
           </size>
          </property>
         </spacer>
        </item>
-       <item row="1" column="5">
+       <item row="1" column="7">
         <widget class="QPushButton" name="btnAddDefault">
          <property name="statusTip">
           <string>Adds a few example WMS servers</string>
@@ -104,7 +100,7 @@
          </property>
         </widget>
        </item>
-       <item row="2" column="0" colspan="6">
+       <item row="2" column="0" colspan="8">
         <widget class="QTreeWidget" name="lstLayers">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -140,6 +136,33 @@
          </column>
         </widget>
        </item>
+       <item row="3" column="0">
+        <widget class="QPushButton" name="btnSave">
+         <property name="text">
+          <string>Save</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1" colspan="2">
+        <widget class="QPushButton" name="btnLoad">
+         <property name="text">
+          <string>Load</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="3" colspan="5">
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>292</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tabLayerOrder">
@@ -250,7 +273,7 @@
      </widget>
     </widget>
    </item>
-   <item row="1" column="0" colspan="2">
+   <item row="1" column="0">
     <widget class="QGroupBox" name="btnGrpImageEncoding">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -269,7 +292,7 @@
      </property>
     </widget>
    </item>
-   <item row="2" column="0" colspan="2">
+   <item row="2" column="0">
     <widget class="QGroupBox" name="gbCRS">
      <property name="title">
       <string>Options</string>
@@ -311,7 +334,14 @@
      </layout>
     </widget>
    </item>
-   <item row="4" column="0" colspan="2">
+   <item row="3" column="0">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0">
     <widget class="QLabel" name="labelStatus">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Ignored" vsizetype="Preferred">
@@ -327,13 +357,6 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="0" colspan="2">
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <layoutdefault spacing="6" margin="11"/>



More information about the QGIS-commit mailing list