[QGIS Commit] r10289 - in trunk/qgis: python/core resources/context_help src/app src/app/ogr src/core src/providers/ogr src/ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Mar 18 01:38:23 EDT 2009


Author: gcontreras
Date: 2009-03-18 01:38:23 -0400 (Wed, 18 Mar 2009)
New Revision: 10289

Added:
   trunk/qgis/resources/context_help/348772824_en_US
   trunk/qgis/resources/context_help/63428984_en_US
   trunk/qgis/src/app/ogr/
   trunk/qgis/src/app/ogr/qgsnewogrconnection.cpp
   trunk/qgis/src/app/ogr/qgsnewogrconnection.h
   trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp
   trunk/qgis/src/app/ogr/qgsogrhelperfunctions.h
   trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.cpp
   trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.h
   trunk/qgis/src/ui/qgsnewogrconnectionbase.ui
   trunk/qgis/src/ui/qgsopenvectorlayerdialogbase.ui
Modified:
   trunk/qgis/python/core/qgsproviderregistry.sip
   trunk/qgis/resources/context_help/contextids.txt
   trunk/qgis/src/app/CMakeLists.txt
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
   trunk/qgis/src/core/qgsproviderregistry.cpp
   trunk/qgis/src/core/qgsproviderregistry.h
   trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
   trunk/qgis/src/providers/ogr/qgsogrprovider.h
Log:
Changes in openvector dialog to support all drivers available in ogr including database and protocol drivers

Modified: trunk/qgis/python/core/qgsproviderregistry.sip
===================================================================
--- trunk/qgis/python/core/qgsproviderregistry.sip	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/python/core/qgsproviderregistry.sip	2009-03-18 05:38:23 UTC (rev 10289)
@@ -1,58 +1,72 @@
-
-/** canonical manager of data providers
-
-  This is a Singleton class that manages data provider access.
-*/
-class QgsProviderRegistry
-{
-%TypeHeaderCode
-#include <qgsproviderregistry.h>
-%End
-
-  public:
-
-    /** means of accessing canonical single instance  */
-    static QgsProviderRegistry* instance(QString pluginPath = QString::null);
-    
-    /** Virtual dectructor */
-    virtual ~QgsProviderRegistry();
-
-    QString library(const QString & providerKey) const;
-
-    QString pluginList(bool asHtml = false) const;
-
-    /** return library directory where plugins are found */
-    const QDir & libraryDirectory() const;
-
-    void setLibraryDirectory(const QDir & path);
- 
-    QgsDataProvider * getProvider( const QString & providerKey, 
-                                   const QString & dataSource );
-
-    /** Return list of available providers by their keys */
-    QStringList providerList() const;
-
-    /** Return metadata of the provider or NULL if not found */
-    const QgsProviderMetadata* providerMetadata(const QString& providerKey) const;
-
-    /** return vector file filter string
-
-      Returns a string suitable for a QFileDialog of vector file formats
-      supported by all data providers.
-
-      This walks through all data providers appending calls to their
-      fileVectorFilters to a string, which is then returned.
-
-      @note
-
-      It'd be nice to eventually be raster/vector neutral.
-    */
-    virtual QString fileVectorFilters() const;
-
-  private:
-
-        /** ctor private since instance() creates it */
-        QgsProviderRegistry(QString pluginPath) /Default/ ;
-
-}; // class QgsProviderRegistry
-
+
+/** canonical manager of data providers
+
+  This is a Singleton class that manages data provider access.
+*/
+class QgsProviderRegistry
+{
+%TypeHeaderCode
+#include <qgsproviderregistry.h>
+%End
+
+  public:
+
+    /** means of accessing canonical single instance  */
+    static QgsProviderRegistry* instance(QString pluginPath = QString::null);
+    
+    /** Virtual dectructor */
+    virtual ~QgsProviderRegistry();
+
+    QString library(const QString & providerKey) const;
+
+    QString pluginList(bool asHtml = false) const;
+
+    /** return library directory where plugins are found */
+    const QDir & libraryDirectory() const;
+
+    void setLibraryDirectory(const QDir & path);
+ 
+    QgsDataProvider * getProvider( const QString & providerKey, 
+                                   const QString & dataSource );
+
+    /** Return list of available providers by their keys */
+    QStringList providerList() const;
+
+    /** Return metadata of the provider or NULL if not found */
+    const QgsProviderMetadata* providerMetadata(const QString& providerKey) const;
+
+    /** return vector file filter string
+
+      Returns a string suitable for a QFileDialog of vector file formats
+      supported by all data providers.
+
+      This walks through all data providers appending calls to their
+      fileVectorFilters to a string, which is then returned.
+
+      @note
+
+      It'd be nice to eventually be raster/vector neutral.
+    */
+    virtual QString fileVectorFilters() const;
+    /** return a string containing the available database drivers
+    * @note this method was added in QGIS 1.1
+    */
+    virtual QString databaseDrivers() const;
+    /** return a string containing the available directory drivers
+     * @note this method was added in QGIS 1.1   
+     */
+    virtual QString directoryDrivers() const;
+    /** return a string containing the available protocol drivers
+     * @note this method was added in QGIS 1.1
+     */
+    virtual QString protocolDrivers() const;
+    
+
+
+  private:
+
+        /** ctor private since instance() creates it */
+        QgsProviderRegistry(QString pluginPath) /Default/ ;
+
+}; // class QgsProviderRegistry
+

Added: trunk/qgis/resources/context_help/348772824_en_US
===================================================================
--- trunk/qgis/resources/context_help/348772824_en_US	                        (rev 0)
+++ trunk/qgis/resources/context_help/348772824_en_US	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1 @@
+<h3>Open Vector Layer Dialog</h3>

Added: trunk/qgis/resources/context_help/63428984_en_US
===================================================================
--- trunk/qgis/resources/context_help/63428984_en_US	                        (rev 0)
+++ trunk/qgis/resources/context_help/63428984_en_US	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1 @@
+<h3>New OGR Database Connection Dialog</h3>

Modified: trunk/qgis/resources/context_help/contextids.txt
===================================================================
--- trunk/qgis/resources/context_help/contextids.txt	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/resources/context_help/contextids.txt	2009-03-18 05:38:23 UTC (rev 10289)
@@ -1,13 +1,15 @@
-151694916_en_US   QgsBookmark
-32338213_en_US    QgsCopyrightLabelPluginGui
-361087368_en_US   QgsProjectProperties
-308026563_en_US   QgsNewHttpConnection
-689216579_en_US   QgsIdentifyResults
-710979116_en_US   QgsServerSourceSelect
-929865718_en_US   QgsNewConnection
-939347163_en_US   QgsDbSourceSelect
-687883780_en_US   QgsMeasure
-1033030847_en_US  QgsDelimitedTextPluginGui
-863656587_en_US   QgsMapserverExport
-94000531_en_US    QgsVectorLayerProperties
-985715179_en_US   QgsComposer
+151694916_en_US   QgsBookmark
+32338213_en_US    QgsCopyrightLabelPluginGui
+361087368_en_US   QgsProjectProperties
+308026563_en_US   QgsNewHttpConnection
+689216579_en_US   QgsIdentifyResults
+710979116_en_US   QgsServerSourceSelect
+929865718_en_US   QgsNewConnection
+939347163_en_US   QgsDbSourceSelect
+687883780_en_US   QgsMeasure
+1033030847_en_US  QgsDelimitedTextPluginGui
+863656587_en_US   QgsMapserverExport
+94000531_en_US    QgsVectorLayerProperties
+985715179_en_US   QgsComposer
+63428984_en_US    QgsNewOgrConnection
+348772824_en_US   QgsOpenVectorLayerDialog
\ No newline at end of file

Modified: trunk/qgis/src/app/CMakeLists.txt
===================================================================
--- trunk/qgis/src/app/CMakeLists.txt	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/src/app/CMakeLists.txt	2009-03-18 05:38:23 UTC (rev 10289)
@@ -78,6 +78,10 @@
   legend/qgslegendsymbologygroup.cpp
   legend/qgslegendsymbologyitem.cpp
   legend/qgslegendvectorsymbologyitem.cpp
+
+  ogr/qgsogrhelperfunctions.cpp
+  ogr/qgsopenvectorlayerdialog.cpp
+  ogr/qgsnewogrconnection.cpp
   )
 
 
@@ -141,6 +145,10 @@
   legend/qgslegend.h
   legend/qgslegendlayer.h
   legend/qgslegendlayerfile.h
+  
+  
+  ogr/qgsopenvectorlayerdialog.h
+  ogr/qgsnewogrconnection.h
   )
 
 IF (POSTGRES_FOUND)

Added: trunk/qgis/src/app/ogr/qgsnewogrconnection.cpp
===================================================================
--- trunk/qgis/src/app/ogr/qgsnewogrconnection.cpp	                        (rev 0)
+++ trunk/qgis/src/app/ogr/qgsnewogrconnection.cpp	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,145 @@
+/***************************************************************************
+                          qgsnewogrconnection.cpp  -  description
+                             -------------------
+    begin                : Mon Jan 2 2009
+    copyright            : (C) 2009 by Godofredo Contreras Nava
+    email                : frdcn at hotmail.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 <iostream>
+
+#include <QSettings>
+#include <QMessageBox>
+#include <QInputDialog>
+
+#include "qgsnewogrconnection.h"
+#include "qgscontexthelp.h"
+#include "qgslogger.h"
+#include "qgsproviderregistry.h"
+#include "qgsogrhelperfunctions.h"
+#include <ogr_api.h>
+#include <cpl_error.h>
+
+
+QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent,const QString& connType, const QString& connName, Qt::WFlags fl )
+    : QDialog( parent, fl )
+{
+  setupUi( this );
+  //add database drivers
+  QStringList dbDrivers=QgsProviderRegistry::instance()->databaseDrivers().split(";");
+  for(int i=0;i<dbDrivers.count();i++) 
+  {
+	QString dbDrive=dbDrivers.at(i);
+	cmbDatabaseTypes->addItem(dbDrive.split(",").at(0));
+  }
+  txtName->setEnabled(true);
+  cmbDatabaseTypes->setEnabled(true);
+  if ( !connName.isEmpty() )
+  {
+    // populate the dialog with the information stored for the connection
+    // populate the fields with the stored setting parameters
+    QSettings settings;
+    QString key = "/"+connType+"/connections/" + connName;
+    txtHost->setText( settings.value( key + "/host" ).toString() );
+    txtDatabase->setText( settings.value( key + "/database" ).toString() );
+    QString port = settings.value( key + "/port" ).toString();
+    txtPort->setText( port );
+    txtUsername->setText( settings.value( key + "/username" ).toString() );
+    if ( settings.value( key + "/save" ).toString() == "true" )
+    {
+      txtPassword->setText( settings.value( key + "/password" ).toString() );
+      chkStorePassword->setChecked( true );
+    }
+	cmbDatabaseTypes->setCurrentIndex(cmbDatabaseTypes->findText(connType));
+    txtName->setText( connName );
+	txtName->setEnabled(false);
+	cmbDatabaseTypes->setEnabled(false);
+  }
+}
+
+QgsNewOgrConnection::~QgsNewOgrConnection()
+{
+}
+
+void QgsNewOgrConnection::testConnection()
+{
+  QString uri;
+  uri=createDatabaseURI(cmbDatabaseTypes->currentText(), txtHost->text(),
+	                    txtDatabase->text(), txtPort->text(),  
+                        txtUsername->text(), txtPassword->text() );
+  QgsDebugMsg( "Connecting using uri = " + uri );
+  OGRRegisterAll();
+  OGRDataSourceH       poDS;
+  OGRSFDriverH         pahDriver;
+  CPLErrorReset();
+  poDS = OGROpen( QFile::encodeName( uri ).constData(), FALSE, &pahDriver );
+    if( poDS == NULL )
+     {
+		 QMessageBox::information( this, tr( "Test connection" ), tr( "Connection failed - Check settings and try again.\n\nExtended error information:\n%1" ).arg( CPLGetLastErrorMsg() ) );
+     }
+	else
+	 {
+		 QMessageBox::information( this, tr( "Test connection" ), tr( "Connection to %1 was successful" ).arg( uri ) );
+	 }
+  OGRReleaseDataSource(poDS);
+}
+
+void QgsNewOgrConnection::saveConnection()
+{
+  QSettings settings;
+  QString baseKey = "/"+cmbDatabaseTypes->currentText()+"/connections/";
+  settings.setValue( baseKey + "selected", txtName->text() );
+  baseKey += txtName->text();
+  settings.setValue( baseKey + "/host", txtHost->text() );
+  settings.setValue( baseKey + "/database", txtDatabase->text() );
+  settings.setValue( baseKey + "/port", txtPort->text() );
+  settings.setValue( baseKey + "/username", txtUsername->text() );
+  settings.setValue( baseKey + "/password", chkStorePassword->isChecked() ? txtPassword->text() : "" );
+  settings.setValue( baseKey + "/save", chkStorePassword->isChecked() ? "true" : "false" );
+  accept();
+}
+
+void QgsNewOgrConnection::helpInfo()
+{
+  QgsContextHelp::run( context_id );
+}
+
+/** Autoconnected SLOTS **/
+void QgsNewOgrConnection::on_btnOk_clicked()
+{
+  saveConnection();
+}
+
+void QgsNewOgrConnection::on_btnHelp_clicked()
+{
+  helpInfo();
+}
+
+void QgsNewOgrConnection::on_btnConnect_clicked()
+{
+  testConnection();
+}
+
+void QgsNewOgrConnection::on_btnCancel_clicked()
+{
+  reject();
+}
+/** end  Autoconnected SLOTS **/
+
+
+
+
+
+
+
+
+

Added: trunk/qgis/src/app/ogr/qgsnewogrconnection.h
===================================================================
--- trunk/qgis/src/app/ogr/qgsnewogrconnection.h	                        (rev 0)
+++ trunk/qgis/src/app/ogr/qgsnewogrconnection.h	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,51 @@
+/***************************************************************************
+                          qgsnewogrconnection.h  -  description
+                             -------------------
+    begin                : Mon Jan 2 2009
+    copyright            : (C) 2009 by Godofredo Contreras Nava
+    email                : frdcn at hotmail.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 QGSNEWOGRCONNECTION_H
+#define QGSNEWOGRCONNECTION_H
+#include "ui_qgsnewogrconnectionbase.h"
+#include "qgisgui.h"
+
+/*! \class QgsNewOgrConnection
+ * \brief Dialog to allow the user to define, test and save connection
+ * information for OGR databases
+ */
+class QgsNewOgrConnection : public QDialog, private Ui::QgsNewOgrConnectionBase
+{
+    Q_OBJECT
+  public:
+    //! Constructor
+    QgsNewOgrConnection( QWidget *parent = 0, const QString& connType = QString::null, const QString& connName = QString::null, Qt::WFlags fl = QgisGui::ModalDialogFlags );
+    //! Destructor
+    ~QgsNewOgrConnection();
+    //! Tests the connection using the parameters supplied
+    void testConnection();
+    //! Saves the connection to ~/.qt/qgisrc
+    void saveConnection();
+    //! Display the context help
+    void helpInfo();
+  public slots:
+    void on_btnOk_clicked();
+    void on_btnCancel_clicked();
+    void on_btnHelp_clicked();
+    void on_btnConnect_clicked();
+  private:
+    static const int context_id = 63428984;
+};
+
+#endif //  QGSNEWOGRCONNECTIONBASE_H

Added: trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp
===================================================================
--- trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp	                        (rev 0)
+++ trunk/qgis/src/app/ogr/qgsogrhelperfunctions.cpp	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,103 @@
+/***************************************************************************
+                          qgsogrhelperfunctions.cpp  
+    helper functions to create ogr uris for database and protocol drivers
+                             -------------------
+    begin                : Mon Jan 2 2009
+    copyright            : (C) 2009 by Godofredo Contreras Nava
+    email                : frdcn at hotmail.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 "qgsogrhelperfunctions.h"
+#include "qgslogger.h"
+
+QString createDatabaseURI(QString connectionType, QString host, QString database, QString port, QString user, QString password)
+{
+	QString uri="";  
+
+	if (connectionType=="ESRI Personal GeoDatabase")
+	 {
+		 uri="PGeo:"+database;   
+	 }
+	else if (connectionType=="ESRI ArcSDE")
+	 {
+        //not tested 
+		uri="SDE:"+host+","+database+","+user+","+password;
+	 }
+	else if (connectionType=="Informix DataBlade")
+	 {
+       //not tested
+       uri="IDB:dbname="+database+" server="+host
+			+" user="+user
+			+" pass="+password;	   
+       
+	 }
+	else if (connectionType=="INGRES")
+	 {
+       //not tested
+       uri="@driver=ingres,dbname="+database+",userid="+user+",password="+password;
+	 }
+	else if (connectionType=="MySQL")
+	 { 
+        uri="MySQL:"+database+",host="+host
+			+",port="+port+",user="+user
+			+",password="+password+"";	    
+	 }
+	else if (connectionType=="Oracle Spatial")
+	 {
+		 uri="OCI:"+user+"/"+password
+			+"@"+host+"/"+database;	    
+	 }
+    else if (connectionType=="ODBC")
+	 { 
+		 if(!user.isEmpty())
+		   {
+             if(password.isEmpty())
+			  {
+                uri="ODBC:"+user+"@"+database;
+			  }
+			 else
+			  {
+                uri="ODBC:"+user+"/"+password+"@"+database;
+			  }
+		     
+		   }
+		 else
+		   {            
+			 uri="ODBC:"+database;
+		   }
+	 }
+	else if (connectionType=="OGDI Vectors")
+	 {
+	 }
+	else if (connectionType=="PostgreSQL")
+	 {
+		 uri="PG:dbname='"+database+"' host='"+host
+			+"' port='"+port+"' user='"+user
+			+"' password='"+password+"'";	  
+		
+	 }
+	QgsDebugMsg("Connection type is="+connectionType+" and uri="+uri);
+	return uri;
+}
+
+
+QString createProtocolURI(QString type, QString url)
+{
+	QString uri="";
+	if (type=="GeoJSON")
+	 {
+		 uri=url;	  		
+	 }
+	QgsDebugMsg("Connection type is="+type+" and uri="+uri);
+	return uri;
+}

Added: trunk/qgis/src/app/ogr/qgsogrhelperfunctions.h
===================================================================
--- trunk/qgis/src/app/ogr/qgsogrhelperfunctions.h	                        (rev 0)
+++ trunk/qgis/src/app/ogr/qgsogrhelperfunctions.h	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,23 @@
+/***************************************************************************
+                          qgsogrhelperfunctions.h  
+    helper functions to create ogr uris for database and protocol drivers
+                             -------------------
+    begin                : Mon Jan 2 2009
+    copyright            : (C) 2009 by Godofredo Contreras Nava
+    email                : frdcn at hotmail.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 <QString>
+
+QString createDatabaseURI(QString connectionType, QString host, QString database, QString port, QString user, QString password);
+QString createProtocolURI(QString type, QString url);
\ No newline at end of file

Added: trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.cpp
===================================================================
--- trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.cpp	                        (rev 0)
+++ trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.cpp	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,500 @@
+/***************************************************************************
+                          qgsopenvectorlayerdialog.cpp
+	Dialog to select the type and source for ogr vectors, supports
+	file, database, directory and protocol sources.
+                             -------------------
+    begin                : Mon Jan 2 2009
+    copyright            : (C) 2009 by Godofredo Contreras Nava
+    email                : frdcn at hotmail.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 <QSettings>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QInputDialog>
+#include <QTextCodec>
+#include "qgslogger.h"
+#include "qgsencodingfiledialog.h"
+#include "qgsopenvectorlayerdialog.h"
+#include <ogr_api.h>
+#include "qgsproviderregistry.h"
+#include "qgsnewogrconnection.h"
+#include "qgsogrhelperfunctions.h"
+#include "qgscontexthelp.h"
+
+QgsOpenVectorLayerDialog::QgsOpenVectorLayerDialog( QWidget* parent, Qt::WFlags fl )
+: QDialog( parent, fl )
+{
+  setupUi( this );  
+  cmbDatabaseTypes->blockSignals(true);
+  cmbConnections->blockSignals(true);
+  radioSrcFile->setChecked( true );  
+  //set encoding
+  cmbEncodings->setItemText( cmbEncodings->currentIndex(), QString( QTextCodec::codecForLocale()->name() ) );
+  
+  //add database drivers
+  mVectorFileFilter=QgsProviderRegistry::instance()->fileVectorFilters();
+  QgsDebugMsg( "Database drivers :"+QgsProviderRegistry::instance()->databaseDrivers());
+  QStringList dbDrivers=QgsProviderRegistry::instance()->databaseDrivers().split(";");
+  
+  for(int i=0;i<dbDrivers.count();i++) 
+  {
+	  QString dbDriver=dbDrivers.at(i);
+	  if((!dbDriver.isEmpty())&&(!dbDriver.isNull()))
+	  cmbDatabaseTypes->addItem(dbDriver.split(",").at(0));
+  }
+
+  //add directory drivers
+  QStringList dirDrivers=QgsProviderRegistry::instance()->directoryDrivers().split(";");
+  for(int i=0;i<dirDrivers.count();i++) 
+  {
+	  QString dirDriver=dirDrivers.at(i);
+	  if((!dirDriver.isEmpty())&&(!dirDriver.isNull()))
+	  cmbDirectoryTypes->addItem(dirDriver.split(",").at(0));
+  }
+
+  //add protocol drivers
+  QStringList proDrivers=QgsProviderRegistry::instance()->protocolDrivers().split(";");
+  for(int i=0;i<proDrivers.count();i++) 
+  {
+	  QString proDriver=proDrivers.at(i);
+	  if((!proDriver.isEmpty())&&(!proDriver.isNull()))
+	  cmbProtocolTypes->addItem(proDriver.split(",").at(0));
+  }  
+  cmbDatabaseTypes->blockSignals(false);
+  cmbConnections->blockSignals(false);
+ }
+
+QgsOpenVectorLayerDialog::~QgsOpenVectorLayerDialog()
+{
+}
+
+QStringList QgsOpenVectorLayerDialog::openFile()
+{
+  
+  QStringList selectedFiles;
+  QgsDebugMsg( "Vector file filters: " + mVectorFileFilter );
+  QString enc;
+  QString title = tr( "Open an OGR Supported Vector Layer" );
+  openFilesRememberingFilter( "lastVectorFileFilter", mVectorFileFilter, selectedFiles,
+	                          title );
+  mEnc=enc;
+  return selectedFiles;
+}
+
+QString QgsOpenVectorLayerDialog::openDirectory()
+{
+  QSettings settings;
+
+  bool haveLastUsedDir = settings.contains( "/UI/LastUsedDirectory");
+  QString lastUsedDir = settings.value( "/UI/LastUsedDirectory",
+                           QVariant( QString::null ) ).toString();
+  if (!haveLastUsedDir)
+    lastUsedDir="";
+  
+  QString path = QFileDialog::getExistingDirectory( this,
+                 tr( "Open Directory" ), lastUsedDir,
+                 QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks );
+  
+  settings.setValue("/UI/LastUsedDirectory",path);
+  //process path if it is grass
+  if(cmbDirectoryTypes->currentText()=="Grass Vector")
+   {
+    #ifdef WIN32
+      //replace backslashes with forward slashes    
+	  path.replace("\\","/");
+    #endif
+    path=path+"/head";
+   }
+  return path;
+}
+
+QStringList QgsOpenVectorLayerDialog::dataSources()
+{
+  return mDataSources;
+}
+
+QString QgsOpenVectorLayerDialog::encoding()
+{
+	return cmbEncodings->currentText();
+}
+
+void QgsOpenVectorLayerDialog::helpInfo()
+{
+  QgsContextHelp::run( context_id );
+}
+
+void QgsOpenVectorLayerDialog::addNewConnection()
+{
+  QgsNewOgrConnection *nc = new QgsNewOgrConnection( this );   
+  if ( nc->exec() )
+  {
+    populateConnectionList();
+  }
+}
+
+void QgsOpenVectorLayerDialog::editConnection()
+{
+  QgsNewOgrConnection *nc = new QgsNewOgrConnection( this,cmbDatabaseTypes->currentText(), cmbConnections->currentText() );
+
+  if ( nc->exec() )
+  {
+    nc->saveConnection();
+  }
+}
+
+void QgsOpenVectorLayerDialog::deleteConnection()
+{
+  QSettings settings;
+  QString key = "/"+cmbDatabaseTypes->currentText()+"/connections/" + cmbConnections->currentText();
+  QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" )
+                .arg( cmbConnections->currentText() );
+  QMessageBox::StandardButton result = QMessageBox::information( this, tr( "Confirm Delete" ), msg, QMessageBox::Ok | QMessageBox::Cancel );
+  if ( result == QMessageBox::Ok )
+  {
+    settings.remove( key + "/host" );
+    settings.remove( key + "/database" );
+    settings.remove( key + "/username" );
+    settings.remove( key + "/password" );
+    settings.remove( key + "/port" );
+    settings.remove( key + "/save" );
+    settings.remove( key );
+    cmbConnections->removeItem( cmbConnections->currentIndex() );  // populateConnectionList();
+    setConnectionListPosition();
+  }
+}
+
+void QgsOpenVectorLayerDialog::populateConnectionList()
+{
+  QSettings settings;
+  settings.beginGroup( "/"+cmbDatabaseTypes->currentText()+"/connections" );
+  QStringList keys = settings.childGroups();
+  QStringList::Iterator it = keys.begin();
+  cmbConnections->clear();
+  while ( it != keys.end() )
+  {
+    cmbConnections->addItem( *it );
+    ++it;
+  }
+  settings.endGroup();
+  setConnectionListPosition();
+}
+
+void QgsOpenVectorLayerDialog::setConnectionListPosition()
+{
+  QSettings settings;
+  // If possible, set the item currently displayed database
+  
+  QString toSelect = settings.value( "/"+cmbDatabaseTypes->currentText()+"/connections/selected" ).toString();
+  // Does toSelect exist in cmbConnections?
+  bool set = false;
+  for ( int i = 0; i < cmbConnections->count(); ++i )
+    if ( cmbConnections->itemText( i ) == toSelect )
+    {
+      cmbConnections->setCurrentIndex( i );
+      set = true;
+      break;
+    }
+  // If we couldn't find the stored item, but there are some,
+  // default to the last item (this makes some sense when deleting
+  // items as it allows the user to repeatidly click on delete to
+  // remove a whole lot of items).
+  if ( !set && cmbConnections->count() > 0 )
+  {
+    // If toSelect is null, then the selected connection wasn't found
+    // by QSettings, which probably means that this is the first time
+    // the user has used qgis with database connections, so default to
+    // the first in the list of connetions. Otherwise default to the last.
+    if ( toSelect.isNull() )
+      cmbConnections->setCurrentIndex( 0 );
+    else
+      cmbConnections->setCurrentIndex( cmbConnections->count() - 1 );
+  }
+}
+
+void QgsOpenVectorLayerDialog::setConnectionTypeListPosition()
+{
+  QSettings settings;
+    
+  QString toSelect = settings.value( "/ogr/connections/selectedtype" ).toString();
+  bool set = false;
+  for ( int i = 0; i < cmbDatabaseTypes->count(); ++i )
+    if ( cmbDatabaseTypes->itemText( i ) == toSelect )
+    {
+      cmbDatabaseTypes->setCurrentIndex( i );
+      set = true;
+      break;
+    }
+}
+
+void QgsOpenVectorLayerDialog::setSelectedConnectionType()
+{
+  QSettings settings;
+  QString baseKey = "/ogr/connections/";
+  settings.setValue( baseKey + "selectedtype", cmbDatabaseTypes->currentText() );    
+  QgsDebugMsg("Setting selected type to"+cmbDatabaseTypes->currentText());
+}
+
+void QgsOpenVectorLayerDialog::setSelectedConnection()
+{
+  QSettings settings;
+  settings.setValue( "/"+cmbDatabaseTypes->currentText()+"/connections/selected",cmbConnections->currentText());  
+  QgsDebugMsg("Setting selected connection to "+cmbConnections->currentText() );
+}
+
+
+void QgsOpenVectorLayerDialog::on_buttonSelectSrc_clicked()
+{
+  QSettings settings;
+  QString filepath;
+  
+  mDataSources.clear();
+
+  if ( radioSrcFile->isChecked() )
+  {
+	//file  
+    
+    //mType="file";
+    mDataSources = openFile();
+	filepath="";
+    for(int i=0;i<mDataSources.count();i++)
+	  filepath+=mDataSources.at(i)+";";
+    inputSrcDataset->setText( filepath );
+  }
+  else if ( radioSrcDirectory->isChecked() )
+  {
+    
+    filepath = openDirectory();
+	mDataSources.append(filepath);
+	inputSrcDataset->setText( filepath );
+	//mType="directory";
+  }
+  else if ( radioSrcDatabase->isChecked() )
+  {
+    //mType="database";
+    //src = inputSrcDataset->text();
+  }
+  else
+  {
+    Q_ASSERT( !"SHOULD NEVER GET HERE" );
+  }
+  
+
+  
+}
+
+/**
+  Open files, preferring to have the default file selector be the
+  last one used, if any; also, prefer to start in the last directory
+  associated with filterName.
+
+  @param filterName the name of the filter; used for persistent store
+  key
+  @param filters    the file filters used for QFileDialog
+
+  @param selectedFiles string list of selected files; will be empty
+  if none selected
+  @param title      the title for the dialog
+  @note
+
+  Stores persistent settings under /UI/.  The sub-keys will be
+  filterName and filterName + "Dir".
+
+  Opens dialog on last directory associated with the filter name, or
+  the current working directory if this is the first time invoked
+  with the current filter name.
+
+*/
+void QgsOpenVectorLayerDialog::openFilesRememberingFilter( QString const &filterName,
+    QString const &filters, QStringList & selectedFiles, QString &title )
+{
+
+  bool haveLastUsedFilter = false; // by default, there is no last
+  // used filter
+
+  QSettings settings;         // where we keep last used filter in
+  
+  // persistant state
+
+  haveLastUsedFilter = settings.contains( "/UI/" + filterName );
+  QString lastUsedFilter = settings.value( "/UI/" + filterName,
+                           QVariant( QString::null ) ).toString();
+
+  QString lastUsedDir = settings.value( "/UI/" + filterName + "Dir", "." ).toString();
+
+  //QString lastUsedEncoding = settings.value( "/UI/encoding" ).toString();
+
+  QgsDebugMsg( "Opening file dialog with filters: " + filters );
+
+  QFileDialog* openFileDialog = new QFileDialog( 0,
+      title, lastUsedDir, filters );
+
+  // allow for selection of more than one file
+  openFileDialog->setFileMode( QFileDialog::ExistingFiles );
+
+  if ( haveLastUsedFilter )     // set the filter to the last one used
+  {
+    openFileDialog->selectFilter( lastUsedFilter );
+  }
+
+  if ( openFileDialog->exec() == QDialog::Accepted )
+  {
+	selectedFiles = openFileDialog->selectedFiles();
+    //enc = openFileDialog->encoding();
+    // Fix by Tim - getting the dirPath from the dialog
+    // directly truncates the last node in the dir path.
+    // This is a workaround for that
+	QString myFirstFileName=selectedFiles.first();
+    QFileInfo myFI( myFirstFileName );
+    QString myPath = myFI.path();
+
+    QgsDebugMsg( "Writing last used dir: " + myPath );
+
+    settings.setValue( "/UI/" + filterName, openFileDialog->selectedFilter() );
+    settings.setValue( "/UI/" + filterName + "Dir", myPath );
+    //settings.setValue( "/UI/encoding", openFileDialog->encoding() );
+  }
+    
+  delete openFileDialog;
+
+}   // openFilesRememberingFilter_
+
+//********************auto connected slots *****************/
+void QgsOpenVectorLayerDialog::on_buttonBox_accepted()
+{		
+	QgsDebugMsg("dialog button accepted");
+	if (radioSrcDatabase->isChecked())
+	 {
+       mDataSources.clear();
+	   QSettings settings;
+       QString baseKey = "/"+cmbDatabaseTypes->currentText()+"/connections/";
+       baseKey += cmbConnections->currentText();
+	   QString host=settings.value( baseKey + "/host" ).toString();
+       QString database=settings.value( baseKey + "/database" ).toString();
+	   QString port=settings.value( baseKey + "/port" ).toString();
+       QString user=settings.value( baseKey + "/username" ).toString();
+	   QString pass=settings.value( baseKey + "/password" ).toString();
+	   bool makeConnection = false;
+	   if(pass.isEmpty())
+         pass = QInputDialog::getText( this, tr( "Password for " ) + user,
+                                      tr( "Please enter your password:" ),
+                                      QLineEdit::Password, QString::null, &makeConnection );
+	   if(makeConnection||(!pass.isEmpty()))
+	     mDataSources.append(createDatabaseURI(
+		                     cmbDatabaseTypes->currentText(),
+							 host,
+							 database,
+							 port,
+							 user,
+							 pass
+		                   ));
+	 }
+	else if (radioSrcProtocol->isChecked())
+	 {
+       mDataSources.clear();
+	   mDataSources.append(createProtocolURI(
+		                     cmbProtocolTypes->currentText(),
+                             protocolURI->text()
+		                  )); 
+	 }
+	accept();
+}
+
+void QgsOpenVectorLayerDialog::on_btnHelp_clicked()
+{
+  helpInfo();
+}
+
+void QgsOpenVectorLayerDialog::on_radioSrcFile_toggled( bool checked )
+{
+  if ( checked )
+  {
+    labelDirectoryType->hide();
+	cmbDirectoryTypes->hide();
+    fileGroupBox->show();
+	dbGroupBox->hide();
+	protocolGroupBox->hide();
+	layout()->setSizeConstraint(QLayout::SetFixedSize);
+  }
+}
+
+void QgsOpenVectorLayerDialog::on_radioSrcDirectory_toggled( bool checked )
+{
+  if ( checked )
+  {
+    labelDirectoryType->show();
+	cmbDirectoryTypes->show();
+    fileGroupBox->show();
+	dbGroupBox->hide();
+	protocolGroupBox->hide();
+	layout()->setSizeConstraint(QLayout::SetFixedSize);
+  }
+}
+
+void QgsOpenVectorLayerDialog::on_radioSrcDatabase_toggled( bool checked )
+{
+  if ( checked )
+  {
+	layout()->blockSignals(true);
+    fileGroupBox->hide();
+	protocolGroupBox->hide();
+	dbGroupBox->show();
+	layout()->blockSignals(false);
+	layout()->setSizeConstraint(QLayout::SetFixedSize);
+	setConnectionTypeListPosition();
+	populateConnectionList();
+    setConnectionListPosition();
+  }
+}
+
+void QgsOpenVectorLayerDialog::on_radioSrcProtocol_toggled( bool checked )
+{
+  if ( checked )
+  {
+    fileGroupBox->hide();
+	dbGroupBox->hide();
+	protocolGroupBox->show();
+	layout()->setSizeConstraint(QLayout::SetFixedSize);
+  }
+}
+
+ // Slot for adding a new connection
+void QgsOpenVectorLayerDialog::on_btnNew_clicked()
+{
+  addNewConnection();  
+}
+// Slot for deleting an existing connection
+void QgsOpenVectorLayerDialog::on_btnDelete_clicked()
+{
+  deleteConnection();
+}
+
+
+// Slot for editing a connection
+void QgsOpenVectorLayerDialog::on_btnEdit_clicked()
+{
+  editConnection();
+}
+
+void QgsOpenVectorLayerDialog::on_cmbDatabaseTypes_currentIndexChanged( const QString & text )
+{
+  populateConnectionList();
+  setSelectedConnectionType();  
+}
+
+void QgsOpenVectorLayerDialog::on_cmbConnections_currentIndexChanged( const QString & text )
+{
+  setSelectedConnection(); 
+}
+//********************end auto connected slots *****************/
+
+

Added: trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.h
===================================================================
--- trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.h	                        (rev 0)
+++ trunk/qgis/src/app/ogr/qgsopenvectorlayerdialog.h	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,94 @@
+/***************************************************************************
+                          qgsopenvectorlayerdialog.h
+	Dialog to select the type and source for ogr vectors, supports
+	file, database, directory and protocol sources.
+                             -------------------
+    begin                : Mon Jan 2 2009
+    copyright            : (C) 2009 by Godofredo Contreras Nava
+    email                : frdcn at hotmail.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 QGSOPENVECTORLAYERDIALOG_H
+#define QGSOPENVECTORLAYERDIALOG_H
+
+
+#include <ui_qgsopenvectorlayerdialogbase.h>
+#include <QDialog>
+
+/** 
+ *  Class for a  dialog to select the type and source for ogr vectors, supports
+ * 	file, database, directory and protocol sources.
+ */
+class QgsOpenVectorLayerDialog : public QDialog, private Ui::QgsOpenVectorLayerDialogBase
+{
+    Q_OBJECT
+
+  public:
+    QgsOpenVectorLayerDialog( QWidget* parent = 0,  Qt::WFlags fl = 0 );
+    ~QgsOpenVectorLayerDialog();
+    //! Opens a dialog to select a file datasource*/
+	QStringList openFile();
+	//! Opens a dialog to select a directory datasource*/
+	QString openDirectory();
+	//! Returns a list of selected datasources*/
+	QStringList dataSources();	
+	//! Returns the encoding selected for user*/
+	QString encoding();
+	//! Display the context help
+    void helpInfo();
+  private:
+    //! Shows a dialog remembering the last directory and filter selected */
+    void openFilesRememberingFilter( QString const &filterName,
+    QString const &filters, QStringList & selectedFiles, QString &title );
+	//! Stores the file vector filters */
+	QString mVectorFileFilter;
+	//! Stores the selected datasources */
+	QStringList mDataSources;	
+	//! Stores the user selected encoding 
+	QString mEnc;
+
+	static const int context_id = 348772824;
+	
+
+  private slots:
+    //! Opens the create connection dialog to build a new connection
+    void addNewConnection();
+    //! Opens a dialog to edit an existing connection
+    void editConnection();
+    //! Deletes the selected connection
+    void deleteConnection();
+    //! Populate the connection list combo box
+    void populateConnectionList();
+    //! Sets the actual position in connection list
+	void setConnectionListPosition();
+	//! Sets the actual position in types connection list
+	void setConnectionTypeListPosition();
+	//! Sets the selected connection type
+	void setSelectedConnectionType();
+	//! Sets the selected connection
+	void setSelectedConnection();
+
+    void on_buttonBox_accepted();
+	void on_btnHelp_clicked();
+    void on_buttonSelectSrc_clicked();   
+	void on_radioSrcFile_toggled( bool checked );
+    void on_radioSrcDirectory_toggled( bool checked );
+    void on_radioSrcDatabase_toggled( bool checked );
+	void on_radioSrcProtocol_toggled( bool checked );
+	void on_btnNew_clicked();
+    void on_btnEdit_clicked();
+    void on_btnDelete_clicked();
+	void on_cmbDatabaseTypes_currentIndexChanged( const QString & text );
+    void on_cmbConnections_currentIndexChanged( const QString & text );
+};
+
+#endif // QGSOPENVECTORDIALOG_H

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/src/app/qgisapp.cpp	2009-03-18 05:38:23 UTC (rev 10289)
@@ -132,7 +132,7 @@
 #include "qgsserversourceselect.h"
 #include "qgsvectordataprovider.h"
 #include "qgsvectorlayer.h"
-
+#include "ogr/qgsopenvectorlayerdialog.h"
 //
 // Gdal/Ogr includes
 //
@@ -2054,6 +2054,7 @@
   with the current filter name.
 
 */
+
 static void openFilesRememberingFilter_( QString const &filterName,
     QString const &filters, QStringList & selectedFiles, QString& enc, QString &title )
 {
@@ -2117,23 +2118,25 @@
     return;
   }
   mMapCanvas->freeze();
-
-  QStringList selectedFiles;
-  QgsDebugMsg( "Vector file filters: " + mVectorFileFilter );
-
-  QString enc;
-  QString title = tr( "Open an OGR Supported Vector Layer" );
-  openFilesRememberingFilter_( "lastVectorFileFilter", mVectorFileFilter, selectedFiles, enc,
-                               title );
-  if ( selectedFiles.isEmpty() )
+  QgsOpenVectorLayerDialog *ovl = new QgsOpenVectorLayerDialog( this );
+  
+  if ( ovl->exec() )
   {
-    // no files were selected, so just bail
-    mMapCanvas->freeze( false );
-
-    return;
+    QStringList selectedSources=ovl->dataSources();
+    QString enc=ovl->encoding();
+    if ( selectedSources.isEmpty() )
+     {
+      // no files were selected, so just bail
+      mMapCanvas->freeze( false );
+      return;
+     }
+	else
+     addVectorLayers( selectedSources, enc );
   }
 
-  addVectorLayers( selectedFiles, enc );
+  delete ovl;
+  // update UI
+  qApp->processEvents();
 }
 
 
@@ -2234,6 +2237,7 @@
   }
 
   QStringList sublayers = layer->dataProvider()->subLayers();
+  QString layertype = layer->dataProvider()->storageType();
 
   // We initialize a selection dialog and display it.
   QgsOGRSublayersDialog chooseSublayersDialog( this );
@@ -2242,17 +2246,19 @@
   if ( chooseSublayersDialog.exec() )
   {
     QString uri = layer->source();
-    if ( uri.contains( '&', Qt::CaseSensitive ) )
+	//the separator char & was changed to | to be compatible
+	//with url for protocol drivers
+    if ( uri.contains( '|', Qt::CaseSensitive ) )
     {
       // If we get here, there are some options added to the filename.
       // A valid uri is of the form: filename&option1=value1&option2=value2,...
       // We want only the filename here, so we get the first part of the split.
-      QStringList theURIParts = uri.split( "&" );
+      QStringList theURIParts = uri.split( "|" );
       uri = theURIParts.at( 0 );
     }
-
+    QgsDebugMsg("Layer type "+layertype);
     // the user has done his choice
-    loadOGRSublayers( uri, chooseSublayersDialog.getSelection() );
+    loadOGRSublayers(layertype ,uri, chooseSublayersDialog.getSelection() );
   }
 }
 
@@ -2261,14 +2267,22 @@
 // format of the ogrprovider so as to give precisions about which
 // sublayer to load into QGIS. It is normally triggered by the
 // sublayer selection dialog.
-void QgisApp::loadOGRSublayers( QString uri, QStringList list )
+void QgisApp::loadOGRSublayers(QString layertype, QString uri, QStringList list )
 {
   // The uri must contain the actual uri of the vectorLayer from which we are
   // going to load the sublayers.
   QString fileName = QFileInfo( uri ).baseName();
   for ( int i = 0; i < list.size(); i++ )
   {
-    QString composedURI = uri + "&layername=" + list.at( i );
+    QString composedURI;
+    if(layertype!="GRASS")
+	{
+      composedURI = uri + "|layername=" + list.at( i );
+	}
+	else
+	{
+      composedURI = uri + "|layerindex=" + list.at( i );
+	}
     addVectorLayer( composedURI, fileName + ":" + list.at( i ), "ogr" );
   }
 }

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/src/app/qgisapp.h	2009-03-18 05:38:23 UTC (rev 10289)
@@ -346,7 +346,7 @@
      */
     void editPaste( QgsMapLayer * destinationLayer = 0 );
 
-    void loadOGRSublayers( QString uri, QStringList list );
+    void loadOGRSublayers(QString layertype, QString uri, QStringList list );
 
   protected:
 

Modified: trunk/qgis/src/core/qgsproviderregistry.cpp
===================================================================
--- trunk/qgis/src/core/qgsproviderregistry.cpp	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/src/core/qgsproviderregistry.cpp	2009-03-18 05:38:23 UTC (rev 10289)
@@ -38,6 +38,9 @@
 typedef QString description_t();
 typedef bool    isprovider_t();
 typedef QString fileVectorFilters_t();
+typedef QString databaseDrivers_t();
+typedef QString directoryDrivers_t();
+typedef QString protocolDrivers_t();
 
 QgsProviderRegistry *QgsProviderRegistry::_instance = 0;
 
@@ -132,6 +135,27 @@
               // now get vector file filters, if any
               fileVectorFilters_t *pFileVectorFilters =
                 ( fileVectorFilters_t * ) cast_to_fptr( myLib->resolve( "fileVectorFilters" ) );
+			  //load database drivers
+			  databaseDrivers_t *pDatabaseDrivers =
+                  ( databaseDrivers_t * ) cast_to_fptr( myLib->resolve( "databaseDrivers" ) );
+              if ( pDatabaseDrivers )
+                {
+                  mDatabaseDrivers = pDatabaseDrivers();
+			    }
+              //load directory drivers
+			  directoryDrivers_t *pDirectoryDrivers =
+                  ( directoryDrivers_t * ) cast_to_fptr( myLib->resolve( "directoryDrivers" ) );
+              if ( pDirectoryDrivers )
+                {
+                  mDirectoryDrivers = pDirectoryDrivers();
+			    }
+              //load protocol drivers
+			  protocolDrivers_t *pProtocolDrivers =
+                  ( protocolDrivers_t * ) cast_to_fptr( myLib->resolve( "protocolDrivers" ) );
+              if ( pProtocolDrivers )
+                {
+                  mProtocolDrivers = pProtocolDrivers();
+			    }
 
               if ( pFileVectorFilters )
               {
@@ -400,14 +424,25 @@
 
 } // QgsProviderRegistry::setDataProvider
 
+QString QgsProviderRegistry::fileVectorFilters() const
+{
+  return mVectorFileFilters;
+} 
 
+QString QgsProviderRegistry::databaseDrivers() const
+{
+  return mDatabaseDrivers;
+} 
 
+QString QgsProviderRegistry::directoryDrivers() const
+{
+  return mDirectoryDrivers;
+} 
 
-
-QString QgsProviderRegistry::fileVectorFilters() const
+QString QgsProviderRegistry::protocolDrivers() const
 {
-  return mVectorFileFilters;
-} //  QgsProviderRegistry::fileVectorFilters
+  return mProtocolDrivers;
+} 
 
 
 QStringList QgsProviderRegistry::providerList() const

Modified: trunk/qgis/src/core/qgsproviderregistry.h
===================================================================
--- trunk/qgis/src/core/qgsproviderregistry.h	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/src/core/qgsproviderregistry.h	2009-03-18 05:38:23 UTC (rev 10289)
@@ -86,6 +86,19 @@
       It'd be nice to eventually be raster/vector neutral.
     */
     virtual QString fileVectorFilters() const;
+    /** return a string containing the available database drivers
+	* @note this method was added in QGIS 1.1
+	*/
+	virtual QString databaseDrivers() const;
+	/** return a string containing the available directory drivers
+	* @note this method was added in QGIS 1.1
+	*/
+    virtual QString directoryDrivers() const;
+	/** return a string containing the available protocol drivers
+	* @note this method was added in QGIS 1.1
+	*/
+    virtual QString protocolDrivers() const;
+    
 
     /** open the given vector data source
 
@@ -138,6 +151,24 @@
         one time.
      */
     QString mVectorFileFilters;
+	/** Available database drivers string for vector databases
+        
+		This is a string of form:
+		DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
+     */
+	QString mDatabaseDrivers;
+	/** Available directory drivers string for vector databases
+        
+		This is a string of form:
+		DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
+     */
+	QString mDirectoryDrivers;
+	/** Available protocol drivers string for vector databases
+        
+		This is a string of form:
+		DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
+     */
+	QString mProtocolDrivers;
 
 }; // class QgsProviderRegistry
 

Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp	2009-03-18 05:38:23 UTC (rev 10289)
@@ -83,7 +83,8 @@
 
   // If there is no & in the uri, then the uri is just the filename. The loaded
   // layer will be layer 0.
-  if ( ! uri.contains( '&', Qt::CaseSensitive ) )
+  //this is not true for geojson
+  if ( ! uri.contains( '|', Qt::CaseSensitive ) )
   {
     mFilePath = uri;
   }
@@ -94,7 +95,7 @@
     // value around the =.
     // A valid uri is of the form: filename&option1=value1&option2=value2,...
 
-    QStringList theURIParts = uri.split( "&" );
+    QStringList theURIParts = uri.split( "|" );
     mFilePath = theURIParts.at( 0 );
 
     for ( int i = 1 ; i < theURIParts.size(); i++ )
@@ -1014,17 +1015,25 @@
 } // createFileFilter_
 
 
-
-QGISEXTERN QString fileVectorFilters()
+QString createFilters(QString type)
 {
-  static QString myFileFilters;
+    /**Database drivers available*/
+	static QString myDatabaseDrivers;
+	/**Protocol drivers available*/
+	static QString myProtocolDrivers;
+	/**File filters*/
+	static QString myFileFilters;
+	/**Directory drivers*/
+	static QString myDirectoryDrivers;
 
+
   // if we've already built the supported vector string, just return what
   // we've already built
-  if ( !( myFileFilters.isEmpty() || myFileFilters.isNull() ) )
+  
+  if  ( myFileFilters.isEmpty() || myFileFilters.isNull() )      
   {
-    return myFileFilters;
-  }
+    
+  
 
   // register ogr plugins
   QgsApplication::registerOgrDrivers();
@@ -1057,95 +1066,151 @@
 
     driverName = OGR_Dr_GetName( driver );
 
-
-    if ( driverName.startsWith( "ESRI" ) )
+    if ( driverName.startsWith( "AVCBin" ) )
     {
-      myFileFilters += createFileFilter_( "ESRI Shapefiles", "*.shp" );
+      myDirectoryDrivers += "Arc/Info Binary Coverage,AVCBin;";
     }
-    else if ( driverName.startsWith( "UK" ) )
+	else if ( driverName.startsWith( "AVCE00" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "Arc/Info ASCII Coverage", "*.e00");
     }
-    else if ( driverName.startsWith( "SDTS" ) )
+	else if ( driverName.startsWith( "BNA" ) )
     {
-      myFileFilters += createFileFilter_( "Spatial Data Transfer Standard",
-                                          "*catd.ddf" );
+      myFileFilters += createFileFilter_( "Atlas BNA", "*.bna" );
     }
-    else if ( driverName.startsWith( "TIGER" ) )
+	else if ( driverName.startsWith( "CSV" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "Comma Separated Value", "*.csv" );
     }
-    else if ( driverName.startsWith( "S57" ) )
+    else if ( driverName.startsWith( "DODS" ) )
     {
-      // XXX needs file filter extension
+      myProtocolDrivers += "DODS/OPeNDAP,DODS;";
     }
-    else if ( driverName.startsWith( "MapInfo" ) )
+    else if ( driverName.startsWith( "PGeo" ) )
     {
-      myFileFilters += createFileFilter_( "MapInfo", "*.mif *.tab" );
-      // XXX needs file filter extension
+      myDatabaseDrivers += "ESRI Personal GeoDatabase,PGeo;";
+      #ifdef WIN32
+      myFileFilters += createFileFilter_( "ESRI Personal GeoDatabase", "*.mdb" );
+      #endif
     }
-    else if ( driverName.startsWith( "DGN" ) )
+    else if ( driverName.startsWith( "SDE" ) )
     {
-      // XXX needs file filter extension
+      myDatabaseDrivers += "ESRI ArcSDE,SDE;";      
     }
-    else if ( driverName.startsWith( "VRT" ) )
+	else if ( driverName.startsWith( "ESRI" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "ESRI Shapefiles", "*.shp" );
     }
-    else if ( driverName.startsWith( "AVCBin" ) )
+    else if ( driverName.startsWith( "FMEObjects Gateway" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "FMEObjects Gateway", "*.fdd" );     
     }
-    else if ( driverName.startsWith( "REC" ) )
+    else if ( driverName.startsWith( "GeoJSON" ) )
     {
-      // XXX needs file filter extension
+      myProtocolDrivers += "GeoJSON,GeoJSON;";    
+	  myFileFilters += createFileFilter_( "GeoJSON", "*.geojson" );
     }
-    else if ( driverName.startsWith( "Memory" ) )
+    else if ( driverName.startsWith( "GeoRSS" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "GeoRSS", "*.xml" );
     }
-    else if ( driverName.startsWith( "Jis" ) )
+	else if ( driverName.startsWith( "GML" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "Geography Markup Language", "*.gml" );
     }
-    else if ( driverName.startsWith( "GML" ) )
+	else if ( driverName.startsWith( "GMT" ) )
     {
-      // XXX not yet supported; post 0.1 release task
-      myFileFilters += createFileFilter_( "Geography Markup Language",
-                                          "*.gml" );
+      myFileFilters += createFileFilter_( "GMT", "*.gmt" );
     }
-    else if ( driverName.startsWith( "CSV" ) )
+    else if ( driverName.startsWith( "GPX" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "GPX", "*.gpx" );
     }
+	else if ( driverName.startsWith( "GRASS" ) )
+    {
+      myDirectoryDrivers += "Grass Vector,GRASS;";
+    } 
+    else if ( driverName.startsWith( "IDB" ) )
+    {
+      myDatabaseDrivers += "Informix DataBlade,IDB;";
+    } 
+    else if ( driverName.startsWith( "Interlis 1" ) )		     
+    {
+      myFileFilters += createFileFilter_( "INTERLIS 1", "*.itf *.xml *.ili" );
+    } 
+	else if (driverName.startsWith( "Interlis 2" ) )		    
+    {
+      myFileFilters += createFileFilter_( "INTERLIS 2", "*.itf *.xml *.ili" );
+    } 
+    else if ( driverName.startsWith( "INGRES" ) )
+    {
+      myDatabaseDrivers += "INGRES,INGRES;";
+    } 
+	else if ( driverName.startsWith( "KML" ) )
+    {
+      myFileFilters += createFileFilter_( "KML", "*.kml" );
+    } 
+	else if ( driverName.startsWith( "MapInfo File" ) )
+    {
+      myFileFilters += createFileFilter_( "Mapinfo File", "*.mif *.tab" );
+    } 
+	else if ( driverName.startsWith( "DGN" ) )
+    {
+      myFileFilters += createFileFilter_( "Microstation DGN", "*.dgn" );
+    }
+    else if ( driverName.startsWith( "MySQL" ) )
+    {
+      myDatabaseDrivers += "MySQL,MySQL;";
+    }
+    else if ( driverName.startsWith( "OCI" ) )
+    {
+      myDatabaseDrivers += "Oracle Spatial,OCI;";
+    }
+    else if ( driverName.startsWith( "ODBC" ) )
+    {
+      myDatabaseDrivers += "ODBC,ODBC;";
+    }
+    else if ( driverName.startsWith( "OGDI" ) )
+    {
+      myDatabaseDrivers += "OGDI Vectors,OGDI;";
+    }
     else if ( driverName.startsWith( "PostgreSQL" ) )
     {
-      // XXX needs file filter extension
+      myDatabaseDrivers += "PostgreSQL,PostgreSQL;";
     }
-    else if ( driverName.startsWith( "GRASS" ) )
+	else if ( driverName.startsWith( "S57" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "S-57 Base file",
+                                          "*.000" );
     }
-    else if ( driverName.startsWith( "KML" ) )
+    else if ( driverName.startsWith( "SDTS" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "Spatial Data Transfer Standard",
+                                          "*catd.ddf" );
     }
-    else if ( driverName.startsWith( "Interlis 1" ) )
+	else if ( driverName.startsWith( "SQLite" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "SQLite",
+                                          "*.sqlite" );
     }
-    else if ( driverName.startsWith( "Interlis 2" ) )
+    else if ( driverName.startsWith( "UK .NTF" ) )
     {
-      // XXX needs file filter extension
+      myDirectoryDrivers += "UK. NTF,UK. NTF;";
     }
-    else if ( driverName.startsWith( "SQLite" ) )
+    else if ( driverName.startsWith( "TIGER" ) )
     {
-      // XXX needs file filter extension
+      myDirectoryDrivers += "U.S. Census TIGER/Line,TIGER;";
     }
-    else if ( driverName.startsWith( "MySQL" ) )
+    else if ( driverName.startsWith( "VRT" ) )
     {
-      // XXX needs file filter extension
+      myFileFilters += createFileFilter_( "VRT - Virtual Datasource ",
+                                          "*.vrt" );
     }
+	else if ( driverName.startsWith( "XPlane" ) )
+    {
+      myFileFilters += createFileFilter_( "X-Plane/Flighgear",
+                                          "apt.dat nav.dat fix.dat awy.dat" );
+    }    
     else
     {
       // NOP, we don't know anything about the current driver
@@ -1157,19 +1222,73 @@
 
   // can't forget the default case
 
-  myFileFilters += "All files (*.*)";
+   myFileFilters += "All files (*.*)";
+  }
 
-  return myFileFilters;
+  if (type=="file")
+  {
+    return myFileFilters;
+  }
+  if (type=="database")
+  {
+    return myDatabaseDrivers;
+  }
+  if (type=="protocol")
+  {
+    return myProtocolDrivers;
+  }
+  if (type=="directory")
+  {
+    return myDirectoryDrivers;
+  }
+  else
+  {
+    return "";
+  }
+}
 
-} // fileVectorFilters() const
 
+QGISEXTERN QString fileVectorFilters()
+{	
+  return createFilters("file");
+} 
 
 QString QgsOgrProvider::fileVectorFilters() const
 {
-  return fileVectorFilters();
-} // QgsOgrProvider::fileVectorFilters() const
+	return createFilters("file");
+} 
 
+QGISEXTERN QString databaseDrivers()
+{
+    return createFilters("database");
+} 
 
+QString QgsOgrProvider::databaseDrivers() const
+{  
+   return createFilters("database");
+} 
+
+QGISEXTERN QString protocolDrivers()
+{  
+  return createFilters("protocol");
+} 
+
+QString QgsOgrProvider::protocolDrivers() const
+{  
+  return createFilters("protocol");
+} 
+
+QGISEXTERN QString directoryDrivers()
+{
+  return  createFilters("directory");
+} 
+
+QString QgsOgrProvider::directoryDrivers() const
+{
+  return  createFilters("directory");
+} 
+
+
 /**
  * Class factory to return a pointer to a newly created
  * QgsOgrProvider object

Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.h
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.h	2009-03-17 11:42:50 UTC (rev 10288)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.h	2009-03-18 05:38:23 UTC (rev 10289)
@@ -43,8 +43,6 @@
      */
     virtual ~QgsOgrProvider();
 
-
-
     virtual QgsCoordinateReferenceSystem crs();
 
     /**
@@ -111,7 +109,6 @@
      */
     virtual long featureCount() const;
 
-
     /**
      * Get the number of fields in the layer
      */
@@ -170,7 +167,14 @@
 
       It'd be nice to eventually be raster/vector neutral.
     */
-    /* virtual */ QString fileVectorFilters() const;
+    /* virtual */
+	QString fileVectorFilters() const;
+    /** return a string containing the available database drivers */
+	QString databaseDrivers() const;
+	/** return a string containing the available directory drivers */
+	QString protocolDrivers() const;
+	/** return a string containing the available protocol drivers */
+	QString directoryDrivers() const;
 
     /**Returns true if this is a valid shapefile
     */
@@ -217,7 +221,7 @@
       anything strange with regards to their name or description?
 
      */
-    QString description() const;
+    QString description() const;	
 
   protected:
     /** loads fields from input file to member attributeFields */
@@ -230,9 +234,7 @@
 
   private:
     unsigned char *getGeometryPointer( OGRFeatureH fet );
-
     QgsFieldMap mAttributeFields;
-
     OGRDataSourceH ogrDataSource;
     void *extent_;
 

Added: trunk/qgis/src/ui/qgsnewogrconnectionbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsnewogrconnectionbase.ui	                        (rev 0)
+++ trunk/qgis/src/ui/qgsnewogrconnectionbase.ui	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,316 @@
+<ui version="4.0" >
+ <class>QgsNewOgrConnectionBase</class>
+ <widget class="QDialog" name="QgsNewOgrConnectionBase" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>509</width>
+    <height>263</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle" >
+   <string>Create a New OGR Database connection</string>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>true</bool>
+  </property>
+  <property name="modal" >
+   <bool>true</bool>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="0" column="0" >
+    <widget class="QGroupBox" name="GroupBox1" >
+     <property name="title" >
+      <string>Connection Information</string>
+     </property>
+     <layout class="QGridLayout" >
+      <property name="margin" >
+       <number>0</number>
+      </property>
+      <property name="spacing" >
+       <number>5</number>
+      </property>
+      <item rowspan="3" row="0" column="2" >
+       <widget class="QFrame" name="frame_2" >
+        <property name="frameShape" >
+         <enum>QFrame::NoFrame</enum>
+        </property>
+        <property name="frameShadow" >
+         <enum>QFrame::Raised</enum>
+        </property>
+       </widget>
+      </item>
+      <item rowspan="3" row="0" column="0" >
+       <widget class="QFrame" name="frame" >
+        <property name="frameShape" >
+         <enum>QFrame::NoFrame</enum>
+        </property>
+        <property name="frameShadow" >
+         <enum>QFrame::Raised</enum>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" >
+       <layout class="QHBoxLayout" >
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <item>
+         <widget class="QCheckBox" name="chkStorePassword" >
+          <property name="text" >
+           <string>Save Password</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="btnConnect" >
+          <property name="text" >
+           <string>Test Connect</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="0" column="1" >
+       <layout class="QHBoxLayout" >
+        <property name="spacing" >
+         <number>6</number>
+        </property>
+        <property name="margin" >
+         <number>0</number>
+        </property>
+        <item>
+         <layout class="QVBoxLayout" >
+          <property name="spacing" >
+           <number>6</number>
+          </property>
+          <property name="margin" >
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="QLabel" name="label" >
+            <property name="text" >
+             <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:8pt;">Type&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="TextLabel1_2" >
+            <property name="text" >
+             <string>Name</string>
+            </property>
+            <property name="buddy" >
+             <cstring>txtName</cstring>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="TextLabel1" >
+            <property name="text" >
+             <string>Host</string>
+            </property>
+            <property name="buddy" >
+             <cstring>txtHost</cstring>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="TextLabel2" >
+            <property name="text" >
+             <string>Database</string>
+            </property>
+            <property name="buddy" >
+             <cstring>txtDatabase</cstring>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="TextLabel2_2" >
+            <property name="text" >
+             <string>Port</string>
+            </property>
+            <property name="buddy" >
+             <cstring>txtPort</cstring>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="TextLabel3" >
+            <property name="text" >
+             <string>Username</string>
+            </property>
+            <property name="buddy" >
+             <cstring>txtUsername</cstring>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="TextLabel3_2" >
+            <property name="text" >
+             <string>Password</string>
+            </property>
+            <property name="buddy" >
+             <cstring>txtPassword</cstring>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QVBoxLayout" >
+          <property name="spacing" >
+           <number>6</number>
+          </property>
+          <property name="margin" >
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="QComboBox" name="cmbDatabaseTypes" />
+          </item>
+          <item>
+           <widget class="QLineEdit" name="txtName" >
+            <property name="toolTip" >
+             <string>Name of the new connection</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="txtHost" />
+          </item>
+          <item>
+           <widget class="QLineEdit" name="txtDatabase" />
+          </item>
+          <item>
+           <widget class="QLineEdit" name="txtPort" >
+            <property name="text" >
+             <string/>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLineEdit" name="txtUsername" />
+          </item>
+          <item>
+           <widget class="QLineEdit" name="txtPassword" >
+            <property name="echoMode" >
+             <enum>QLineEdit::Password</enum>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="0" column="1" >
+    <layout class="QVBoxLayout" >
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <item>
+      <widget class="QPushButton" name="btnOk" >
+       <property name="text" >
+        <string>OK</string>
+       </property>
+       <property name="shortcut" >
+        <string/>
+       </property>
+       <property name="autoDefault" >
+        <bool>true</bool>
+       </property>
+       <property name="default" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnCancel" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+       <property name="shortcut" >
+        <string/>
+       </property>
+       <property name="autoDefault" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnHelp" >
+       <property name="enabled" >
+        <bool>true</bool>
+       </property>
+       <property name="text" >
+        <string>Help</string>
+       </property>
+       <property name="shortcut" >
+        <string>F1</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" stdset="0" >
+        <size>
+         <width>87</width>
+         <height>150</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <tabstops>
+  <tabstop>txtName</tabstop>
+  <tabstop>txtHost</tabstop>
+  <tabstop>txtDatabase</tabstop>
+  <tabstop>txtPort</tabstop>
+  <tabstop>txtUsername</tabstop>
+  <tabstop>txtPassword</tabstop>
+  <tabstop>chkStorePassword</tabstop>
+  <tabstop>btnConnect</tabstop>
+  <tabstop>btnOk</tabstop>
+  <tabstop>btnCancel</tabstop>
+  <tabstop>btnHelp</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>

Added: trunk/qgis/src/ui/qgsopenvectorlayerdialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsopenvectorlayerdialogbase.ui	                        (rev 0)
+++ trunk/qgis/src/ui/qgsopenvectorlayerdialogbase.ui	2009-03-18 05:38:23 UTC (rev 10289)
@@ -0,0 +1,615 @@
+<ui version="4.0" >
+ <class>QgsOpenVectorLayerDialogBase</class>
+ <widget class="QDialog" name="QgsOpenVectorLayerDialogBase" >
+  <property name="windowModality" >
+   <enum>Qt::WindowModal</enum>
+  </property>
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>500</width>
+    <height>569</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize" >
+   <size>
+    <width>500</width>
+    <height>150</height>
+   </size>
+  </property>
+  <property name="windowTitle" >
+   <string>Add vector layer</string>
+  </property>
+  <property name="windowIcon" >
+   <iconset>
+    <normaloff>../../../../../Documents and Settings/freddy/.designer/plugins/ogr_converter</normaloff>../../../../../Documents and Settings/freddy/.designer/plugins/ogr_converter</iconset>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_3" >
+   <item>
+    <widget class="QGroupBox" name="srcGroupBox_2" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize" >
+      <size>
+       <width>482</width>
+       <height>80</height>
+      </size>
+     </property>
+     <property name="maximumSize" >
+      <size>
+       <width>16777215</width>
+       <height>70</height>
+      </size>
+     </property>
+     <property name="title" >
+      <string>Source type</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_4" >
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_3" >
+        <item>
+         <widget class="QRadioButton" name="radioSrcFile" >
+          <property name="text" >
+           <string>File</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioSrcDirectory" >
+          <property name="text" >
+           <string>Directory</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioSrcDatabase" >
+          <property name="text" >
+           <string>Database</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioSrcProtocol" >
+          <property name="text" >
+           <string>Protocol</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_4" >
+        <item>
+         <widget class="QLabel" name="label_3" >
+          <property name="text" >
+           <string>Encoding :</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QComboBox" name="cmbEncodings" >
+          <property name="minimumSize" >
+           <size>
+            <width>380</width>
+            <height>0</height>
+           </size>
+          </property>
+          <item>
+           <property name="text" >
+            <string>BIG5</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>BIG5-HKSCS</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>EUCJP</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>EUCKR</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>GB2312</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>GBK</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>GB18030</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>JIS7</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>SHIFT-JIS</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>TSCII</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>UTF-8</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>UTF-16</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>KOI8-R</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>KOI8-U</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-1</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-2</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-3</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-4</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-5</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-6</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-7</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-8</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-8-I</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-9</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-10</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-11</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-12</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-13</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-14</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>ISO8859-15</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>IBM 850</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>IBM 866</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP874</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1250</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1251</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1252</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1253</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1254</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1255</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1256</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1257</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>CP1258</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>Apple Roman</string>
+           </property>
+          </item>
+          <item>
+           <property name="text" >
+            <string>TIS-620</string>
+           </property>
+          </item>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="protocolGroupBox" >
+     <property name="minimumSize" >
+      <size>
+       <width>482</width>
+       <height>90</height>
+      </size>
+     </property>
+     <property name="maximumSize" >
+      <size>
+       <width>16777215</width>
+       <height>90</height>
+      </size>
+     </property>
+     <property name="title" >
+      <string>Protocol</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="label_2" >
+        <property name="text" >
+         <string>Type</string>
+        </property>
+       </widget>
+      </item>
+      <item rowspan="2" row="0" column="1" >
+       <widget class="QComboBox" name="cmbProtocolTypes" />
+      </item>
+      <item rowspan="2" row="1" column="0" >
+       <widget class="QLabel" name="label" >
+        <property name="text" >
+         <string>URI</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1" >
+       <widget class="QLineEdit" name="protocolURI" />
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="fileGroupBox" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize" >
+      <size>
+       <width>482</width>
+       <height>90</height>
+      </size>
+     </property>
+     <property name="maximumSize" >
+      <size>
+       <width>16777215</width>
+       <height>90</height>
+      </size>
+     </property>
+     <property name="title" >
+      <string>Source</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="labelDirectoryType" >
+        <property name="text" >
+         <string>Type</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="2" colspan="2" >
+       <widget class="QComboBox" name="cmbDirectoryTypes" />
+      </item>
+      <item row="1" column="0" colspan="2" >
+       <widget class="QLabel" name="labelSrcDataset" >
+        <property name="text" >
+         <string>Dataset</string>
+        </property>
+        <property name="buddy" >
+         <cstring>inputSrcDataset</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="2" >
+       <widget class="QLineEdit" name="inputSrcDataset" >
+        <property name="minimumSize" >
+         <size>
+          <width>200</width>
+          <height>0</height>
+         </size>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="3" >
+       <widget class="QPushButton" name="buttonSelectSrc" >
+        <property name="text" >
+         <string>Browse</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="dbGroupBox" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize" >
+      <size>
+       <width>482</width>
+       <height>240</height>
+      </size>
+     </property>
+     <property name="maximumSize" >
+      <size>
+       <width>16777215</width>
+       <height>240</height>
+      </size>
+     </property>
+     <property name="title" >
+      <string>Database</string>
+     </property>
+     <widget class="QGroupBox" name="groupBox_2" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>30</y>
+        <width>454</width>
+        <height>61</height>
+       </rect>
+      </property>
+      <property name="title" >
+       <string>Type</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2" >
+       <item>
+        <widget class="QComboBox" name="cmbDatabaseTypes" />
+       </item>
+      </layout>
+     </widget>
+     <widget class="QGroupBox" name="groupBox" >
+      <property name="geometry" >
+       <rect>
+        <x>10</x>
+        <y>90</y>
+        <width>454</width>
+        <height>126</height>
+       </rect>
+      </property>
+      <property name="title" >
+       <string>Connections</string>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout" >
+       <item>
+        <widget class="QComboBox" name="cmbConnections" />
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout" >
+         <item>
+          <widget class="QPushButton" name="btnNew" >
+           <property name="text" >
+            <string>New</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btnEdit" >
+           <property name="text" >
+            <string>Edit</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btnDelete" >
+           <property name="text" >
+            <string>Delete</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2" >
+     <item>
+      <widget class="QPushButton" name="btnHelp" >
+       <property name="text" >
+        <string>Help</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer" >
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0" >
+        <size>
+         <width>228</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QDialogButtonBox" name="buttonBox" >
+       <property name="standardButtons" >
+        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <tabstops>
+  <tabstop>inputSrcDataset</tabstop>
+  <tabstop>buttonSelectSrc</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>QgsOpenVectorLayerDialogBase</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>433</x>
+     <y>585</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>481</x>
+     <y>297</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>QgsOpenVectorLayerDialogBase</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>374</x>
+     <y>585</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>281</x>
+     <y>339</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>radioSrcDatabase</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>dbGroupBox</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>362</x>
+     <y>41</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>245</x>
+     <y>408</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>



More information about the QGIS-commit mailing list