QgsOracleSelectGeoraster::QgsOracleSelectGeoraster( QWidget* parent, QgisInterface* iface, Qt::WindowFlags fl ) : QDialog( parent, fl ), mIface( iface ) { setupUi( this ); /* * Load the list of connection from the registry */ populateConnectionList(); /* * Repeat last selected connection */ QSettings settings; QString selected = settings.value( "/Oracle/connections/selected" ).toString(); restoreGeometry( settings.value( "/Oracle/geometry" ).toByteArray() ); cmbConnections->setCurrentIndex( cmbConnections->findText( selected ) ); if ( selected == cmbConnections->currentText() ) { connectToServer(); } }
void QgsSpatiaLiteSourceSelect::on_btnNew_clicked() { // Retrieve last used project dir from persistent settings sqlite3 *handle; QSettings settings; QString lastUsedDir = settings.value( "/UI/lastSpatiaLiteDir", "." ).toString(); QString myFile = QFileDialog::getOpenFileName( this, tr( "Choose a SpatiaLite/SQLite DB to open" ), lastUsedDir, QObject::tr( "SQLite DB (*.sqlite *.db);;All files (*)" ) ); if ( myFile.isEmpty() ) return; QFileInfo myFI( myFile ); QString myPath = myFI.path(); QString myName = myFI.fileName(); handle = openSpatiaLiteDb( myFI.canonicalFilePath() ); if ( !handle ) return; // OK, this one is a valid SpatiaLite DB closeSpatiaLiteDb( handle ); // Persist last used SpatiaLite dir settings.setValue( "/UI/lastSpatiaLiteDir", myPath ); // inserting this SQLite DB path QString baseKey = "/SpatiaLite/connections/"; settings.setValue( baseKey + "selected", myName ); baseKey += myName; settings.setValue( baseKey + "/sqlitepath", myFI.canonicalFilePath() ); populateConnectionList(); }
QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WindowFlags fl, bool embeddedMode ) : QDialog( parent, fl ) , mCapabilities( nullptr ) { setupUi( this ); if ( embeddedMode ) { buttonBox->button( QDialogButtonBox::Close )->hide(); } mAddButton = new QPushButton( tr( "&Add" ) ); mAddButton->setEnabled( false ); mBuildQueryButton = new QPushButton( tr( "&Build query" ) ); mBuildQueryButton->setToolTip( tr( "Build query" ) ); mBuildQueryButton->setDisabled( true ); buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole ); connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addLayer() ) ); buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole ); connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQueryButtonClicked() ) ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( btnNew, SIGNAL( clicked() ), this, SLOT( addEntryToServerList() ) ); connect( btnEdit, SIGNAL( clicked() ), this, SLOT( modifyEntryOfServerList() ) ); connect( btnDelete, SIGNAL( clicked() ), this, SLOT( deleteEntryOfServerList() ) ); connect( btnConnect, SIGNAL( clicked() ), this, SLOT( connectToServer() ) ); connect( btnChangeSpatialRefSys, SIGNAL( clicked() ), this, SLOT( changeCRS() ) ); connect( lineFilter, SIGNAL( textChanged( QString ) ), this, SLOT( filterChanged( QString ) ) ); populateConnectionList(); mProjectionSelector = new QgsGenericProjectionSelector( this ); mProjectionSelector->setMessage(); mItemDelegate = new QgsWFSItemDelegate( treeView ); treeView->setItemDelegate( mItemDelegate ); QSettings settings; QgsDebugMsg( "restoring settings" ); restoreGeometry( settings.value( "/Windows/WFSSourceSelect/geometry" ).toByteArray() ); cbxUseTitleLayerName->setChecked( settings.value( "/Windows/WFSSourceSelect/UseTitleLayerName", false ).toBool() ); mHoldDialogOpen->setChecked( settings.value( "/Windows/WFSSourceSelect/HoldDialogOpen", false ).toBool() ); mModel = new QStandardItemModel(); mModel->setHorizontalHeaderItem( MODEL_IDX_TITLE, new QStandardItem( "Title" ) ); mModel->setHorizontalHeaderItem( MODEL_IDX_NAME, new QStandardItem( "Name" ) ); mModel->setHorizontalHeaderItem( MODEL_IDX_ABSTRACT, new QStandardItem( "Abstract" ) ); mModel->setHorizontalHeaderItem( MODEL_IDX_FILTER, new QStandardItem( "Filter" ) ); mModelProxy = new QSortFilterProxyModel( this ); mModelProxy->setSourceModel( mModel ); mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive ); treeView->setModel( mModelProxy ); connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( treeWidgetItemDoubleClicked( const QModelIndex& ) ) ); connect( treeView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), this, SLOT( treeWidgetCurrentRowChanged( const QModelIndex&, const QModelIndex& ) ) ); }
QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode theWidgetMode ) : QgsAbstractDataSourceWidget( parent, fl, theWidgetMode ) { setupUi( this ); connect( cmbConnections, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsWFSSourceSelect::cmbConnections_activated ); connect( btnSave, &QPushButton::clicked, this, &QgsWFSSourceSelect::btnSave_clicked ); connect( btnLoad, &QPushButton::clicked, this, &QgsWFSSourceSelect::btnLoad_clicked ); setupButtons( buttonBox ); connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsWFSSourceSelect::showHelp ); if ( widgetMode() != QgsProviderRegistry::WidgetMode::None ) { mHoldDialogOpen->hide(); } mBuildQueryButton = new QPushButton( tr( "&Build query" ) ); mBuildQueryButton->setToolTip( tr( "Build query" ) ); mBuildQueryButton->setDisabled( true ); buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole ); connect( mBuildQueryButton, &QAbstractButton::clicked, this, &QgsWFSSourceSelect::buildQueryButtonClicked ); connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject ); connect( btnNew, &QAbstractButton::clicked, this, &QgsWFSSourceSelect::addEntryToServerList ); connect( btnEdit, &QAbstractButton::clicked, this, &QgsWFSSourceSelect::modifyEntryOfServerList ); connect( btnDelete, &QAbstractButton::clicked, this, &QgsWFSSourceSelect::deleteEntryOfServerList ); connect( btnConnect, &QAbstractButton::clicked, this, &QgsWFSSourceSelect::connectToServer ); connect( btnChangeSpatialRefSys, &QAbstractButton::clicked, this, &QgsWFSSourceSelect::changeCRS ); connect( lineFilter, &QLineEdit::textChanged, this, &QgsWFSSourceSelect::filterChanged ); populateConnectionList(); mProjectionSelector = new QgsProjectionSelectionDialog( this ); mProjectionSelector->setMessage( QString() ); mItemDelegate = new QgsWFSItemDelegate( treeView ); treeView->setItemDelegate( mItemDelegate ); QgsSettings settings; QgsDebugMsg( QStringLiteral( "restoring settings" ) ); restoreGeometry( settings.value( QStringLiteral( "Windows/WFSSourceSelect/geometry" ) ).toByteArray() ); cbxUseTitleLayerName->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/UseTitleLayerName" ), false ).toBool() ); cbxFeatureCurrentViewExtent->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/FeatureCurrentViewExtent" ), true ).toBool() ); mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "Windows/WFSSourceSelect/HoldDialogOpen" ), false ).toBool() ); mModel = new QStandardItemModel(); mModel->setHorizontalHeaderItem( MODEL_IDX_TITLE, new QStandardItem( QStringLiteral( "Title" ) ) ); mModel->setHorizontalHeaderItem( MODEL_IDX_NAME, new QStandardItem( QStringLiteral( "Name" ) ) ); mModel->setHorizontalHeaderItem( MODEL_IDX_ABSTRACT, new QStandardItem( QStringLiteral( "Abstract" ) ) ); mModel->setHorizontalHeaderItem( MODEL_IDX_SQL, new QStandardItem( QStringLiteral( "Sql" ) ) ); mModelProxy = new QSortFilterProxyModel( this ); mModelProxy->setSourceModel( mModel ); mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive ); treeView->setModel( mModelProxy ); connect( treeView, &QAbstractItemView::doubleClicked, this, &QgsWFSSourceSelect::treeWidgetItemDoubleClicked ); connect( treeView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &QgsWFSSourceSelect::treeWidgetCurrentRowChanged ); }
QgsArcGisServiceSourceSelect::QgsArcGisServiceSourceSelect( const QString &serviceName, ServiceType serviceType, QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode ) : QgsAbstractDataSourceWidget( parent, fl, widgetMode ) , mServiceName( serviceName ) , mServiceType( serviceType ) { setupUi( this ); connect( cmbConnections, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsArcGisServiceSourceSelect::cmbConnections_activated ); setupButtons( buttonBox ); connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsArcGisServiceSourceSelect::showHelp ); setWindowTitle( QStringLiteral( "Add %1 Layer from a Server" ).arg( mServiceName ) ); if ( mServiceType == FeatureService ) { mBuildQueryButton = buttonBox->addButton( tr( "&Build query" ), QDialogButtonBox::ActionRole ); mBuildQueryButton->setDisabled( true ); connect( mBuildQueryButton, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::buildQueryButtonClicked ); } connect( buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject ); connect( btnNew, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::addEntryToServerList ); connect( btnEdit, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::modifyEntryOfServerList ); connect( btnDelete, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::deleteEntryOfServerList ); connect( btnConnect, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::connectToServer ); connect( btnChangeSpatialRefSys, &QAbstractButton::clicked, this, &QgsArcGisServiceSourceSelect::changeCrs ); connect( lineFilter, &QLineEdit::textChanged, this, &QgsArcGisServiceSourceSelect::filterChanged ); populateConnectionList(); mProjectionSelector = new QgsProjectionSelectionDialog( this ); mProjectionSelector->setMessage( QString() ); treeView->setItemDelegate( new QgsAbstractDataSourceWidgetItemDelegate( treeView ) ); QgsSettings settings; restoreGeometry( settings.value( QStringLiteral( "Windows/SourceSelectDialog/geometry" ) ).toByteArray() ); cbxUseTitleLayerName->setChecked( settings.value( QStringLiteral( "Windows/SourceSelectDialog/UseTitleLayerName" ), false ).toBool() ); mModel = new QStandardItemModel(); mModel->setHorizontalHeaderItem( 0, new QStandardItem( QStringLiteral( "Title" ) ) ); mModel->setHorizontalHeaderItem( 1, new QStandardItem( QStringLiteral( "Name" ) ) ); mModel->setHorizontalHeaderItem( 2, new QStandardItem( QStringLiteral( "Abstract" ) ) ); if ( serviceType == FeatureService ) { mModel->setHorizontalHeaderItem( 3, new QStandardItem( QStringLiteral( "Cache Feature" ) ) ); mModel->setHorizontalHeaderItem( 4, new QStandardItem( QStringLiteral( "Filter" ) ) ); gbImageEncoding->hide(); } else { cbxFeatureCurrentViewExtent->hide(); mImageEncodingGroup = new QButtonGroup( this ); } mModelProxy = new QSortFilterProxyModel( this ); mModelProxy->setSourceModel( mModel ); mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive ); treeView->setModel( mModelProxy ); connect( treeView, &QAbstractItemView::doubleClicked, this, &QgsArcGisServiceSourceSelect::treeWidgetItemDoubleClicked ); connect( treeView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &QgsArcGisServiceSourceSelect::treeWidgetCurrentRowChanged ); }
void QgsOgrSourceSelect::addNewConnection() { QgsNewOgrConnection *nc = new QgsNewOgrConnection( this ); nc->exec(); delete nc; populateConnectionList(); }
void QgsOpenVectorLayerDialog::addNewConnection() { QgsNewOgrConnection *nc = new QgsNewOgrConnection( this ); nc->exec(); delete nc; populateConnectionList(); }
// Slot for editing a connection void SaSourceSelect::on_btnEdit_clicked() { SaNewConnection *nc = new SaNewConnection( this, cmbConnections->currentText() ); nc->exec(); delete nc; populateConnectionList(); }
void QgsOpenVectorLayerDialog::editConnection() { QgsNewOgrConnection *nc = new QgsNewOgrConnection( this, cmbDatabaseTypes->currentText(), cmbConnections->currentText() ); nc->exec(); delete nc; populateConnectionList(); }
// Slot for adding a new connection void SaSourceSelect::on_btnNew_clicked() { SaNewConnection *nc = new SaNewConnection( this ); nc->exec(); delete nc; populateConnectionList(); }
void QgsOracleSelectGeoraster::on_btnNew_clicked() { QgsOracleConnect *oc = new QgsOracleConnect( this, "New Connection" ); if ( oc->exec() ) { populateConnectionList(); } }
void QgsOracleSelectGeoraster::on_btnEdit_clicked() { QgsOracleConnect *oc = new QgsOracleConnect( this, cmbConnections->currentText() ); if ( oc->exec() ) { populateConnectionList(); } }
void QgsOgrSourceSelect::editConnection() { QgsNewOgrConnection *nc = new QgsNewOgrConnection( this, cmbDatabaseTypes->currentText(), cmbConnections->currentText() ); nc->exec(); delete nc; populateConnectionList(); }
QgsSourceSelectDialog::QgsSourceSelectDialog( const QString& serviceName, ServiceType serviceType, QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ), mServiceName( serviceName ), mServiceType( serviceType ), mBuildQueryButton( 0 ), mImageEncodingGroup( 0 ) { setupUi( this ); setWindowTitle( QStringLiteral( "Add %1 Layer from a Server" ).arg( mServiceName ) ); mAddButton = buttonBox->addButton( tr( "&Add" ), QDialogButtonBox::ActionRole ); mAddButton->setEnabled( false ); connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addButtonClicked() ) ); if ( mServiceType == FeatureService ) { mBuildQueryButton = buttonBox->addButton( tr( "&Build query" ), QDialogButtonBox::ActionRole ); mBuildQueryButton->setDisabled( true ); connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQueryButtonClicked() ) ); } connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( btnNew, SIGNAL( clicked() ), this, SLOT( addEntryToServerList() ) ); connect( btnEdit, SIGNAL( clicked() ), this, SLOT( modifyEntryOfServerList() ) ); connect( btnDelete, SIGNAL( clicked() ), this, SLOT( deleteEntryOfServerList() ) ); connect( btnConnect, SIGNAL( clicked() ), this, SLOT( connectToServer() ) ); connect( btnChangeSpatialRefSys, SIGNAL( clicked() ), this, SLOT( changeCrs() ) ); connect( lineFilter, SIGNAL( textChanged( QString ) ), this, SLOT( filterChanged( QString ) ) ); populateConnectionList(); mProjectionSelector = new QgsGenericProjectionSelector( this ); mProjectionSelector->setMessage(); treeView->setItemDelegate( new QgsSourceSelectItemDelegate( treeView ) ); QSettings settings; restoreGeometry( settings.value( QStringLiteral( "/Windows/SourceSelectDialog/geometry" ) ).toByteArray() ); cbxUseTitleLayerName->setChecked( settings.value( QStringLiteral( "/Windows/SourceSelectDialog/UseTitleLayerName" ), false ).toBool() ); mModel = new QStandardItemModel(); mModel->setHorizontalHeaderItem( 0, new QStandardItem( QStringLiteral( "Title" ) ) ); mModel->setHorizontalHeaderItem( 1, new QStandardItem( QStringLiteral( "Name" ) ) ); mModel->setHorizontalHeaderItem( 2, new QStandardItem( QStringLiteral( "Abstract" ) ) ); if ( serviceType == FeatureService ) { mModel->setHorizontalHeaderItem( 3, new QStandardItem( QStringLiteral( "Cache Feature" ) ) ); mModel->setHorizontalHeaderItem( 4, new QStandardItem( QStringLiteral( "Filter" ) ) ); gbImageEncoding->hide(); } else { cbxFeatureCurrentViewExtent->hide(); mImageEncodingGroup = new QButtonGroup( this ); } mModelProxy = new QSortFilterProxyModel( this ); mModelProxy->setSourceModel( mModel ); mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive ); treeView->setModel( mModelProxy ); connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( treeWidgetItemDoubleClicked( const QModelIndex& ) ) ); connect( treeView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), this, SLOT( treeWidgetCurrentRowChanged( const QModelIndex&, const QModelIndex& ) ) ); }
void QgsArcGisServiceSourceSelect::modifyEntryOfServerList() { QgsNewHttpConnection nc( nullptr, QgsNewHttpConnection::ConnectionOther, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ), cmbConnections->currentText() ); nc.setWindowTitle( tr( "Modify %1 Connection" ).arg( mServiceName ) ); if ( nc.exec() ) { populateConnectionList(); emit connectionsChanged(); } }
void QgsArcGisServiceSourceSelect::addEntryToServerList() { QgsNewHttpConnection nc( nullptr, QgsNewHttpConnection::ConnectionOther, QStringLiteral( "qgis/connections-%1/" ).arg( mServiceName.toLower() ) ); nc.setWindowTitle( tr( "Create a New %1 Connection" ).arg( mServiceName ) ); if ( nc.exec() ) { populateConnectionList(); emit connectionsChanged(); } }
void QgsWFSSourceSelect::modifyEntryOfServerList() { QgsNewHttpConnection nc( nullptr, QgsWFSConstants::CONNECTIONS_WFS, cmbConnections->currentText() ); nc.setWindowTitle( tr( "Modify WFS connection" ) ); if ( nc.exec() ) { populateConnectionList(); emit connectionsChanged(); } }
void QgsWFSSourceSelect::addEntryToServerList() { QgsNewHttpConnection nc( nullptr, QgsWFSConstants::CONNECTIONS_WFS ); nc.setWindowTitle( tr( "Create a new WFS connection" ) ); if ( nc.exec() ) { populateConnectionList(); emit connectionsChanged(); } }
QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QgisApp * app, Qt::WFlags fl ): QDialog( app, fl ), qgisApp( app ) { setupUi( this ); setWindowTitle( tr( "Add SpatiaLite Table(s)" ) ); connectionsGroupBox->setTitle( tr( "Databases" ) ); btnEdit->hide(); // hide the edit button btnSave->hide(); btnLoad->hide(); mAddButton = new QPushButton( tr( "&Add" ) ); buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole ); connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addClicked() ) ); mAddButton->setEnabled( false ); mBuildQueryButton = new QPushButton( tr( "&Build Query" ) ); buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole ); connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQuery() ) ); mBuildQueryButton->setEnabled( false ); populateConnectionList(); mSearchModeComboBox->addItem( tr( "Wildcard" ) ); mSearchModeComboBox->addItem( tr( "RegExp" ) ); mSearchColumnComboBox->addItem( tr( "All" ) ); mSearchColumnComboBox->addItem( tr( "Table" ) ); mSearchColumnComboBox->addItem( tr( "Type" ) ); mSearchColumnComboBox->addItem( tr( "Geometry column" ) ); mSearchColumnComboBox->addItem( tr( "Sql" ) ); mProxyModel.setParent( this ); mProxyModel.setFilterKeyColumn( -1 ); mProxyModel.setFilterCaseSensitivity( Qt::CaseInsensitive ); mProxyModel.setDynamicSortFilter( true ); mProxyModel.setSourceModel( &mTableModel ); mTablesTreeView->setModel( &mProxyModel ); mTablesTreeView->setSortingEnabled( true ); //for Qt < 4.3.2, passing -1 to include all model columns //in search does not seem to work mSearchColumnComboBox->setCurrentIndex( 1 ); //hide the search options by default //they will be shown when the user ticks //the search options group box mSearchLabel->setVisible( false ); mSearchColumnComboBox->setVisible( false ); mSearchColumnsLabel->setVisible( false ); mSearchModeComboBox->setVisible( false ); mSearchModeLabel->setVisible( false ); mSearchTableEdit->setVisible( false ); cbxAllowGeometrylessTables->setVisible( false ); }
void QgsWFSSourceSelect::modifyEntryOfServerList() { QgsNewHttpConnection* nc = new QgsNewHttpConnection( this, QgsWFSConstants::CONNECTIONS_WFS, cmbConnections->currentText() ); nc->setAttribute( Qt::WA_DeleteOnClose ); nc->setWindowTitle( tr( "Modify WFS connection" ) ); // For testability, do not use exec() if ( !property( "hideDialogs" ).toBool() ) nc->open(); connect( nc, SIGNAL( accepted() ), this, SLOT( populateConnectionList() ) ); connect( nc, SIGNAL( accepted() ), this, SIGNAL( connectionsChanged() ) ); }
void QgsWFSSourceSelect::on_btnLoad_clicked() { QString fileName = QFileDialog::getOpenFileName( this, tr( "Load connections" ), QDir::homePath(), tr( "XML files (*.xml *XML)" ) ); if ( fileName.isEmpty() ) { return; } QgsManageConnectionsDialog dlg( this, QgsManageConnectionsDialog::Import, QgsManageConnectionsDialog::WFS, fileName ); dlg.exec(); populateConnectionList(); emit connectionsChanged(); }
void QgsOgrSourceSelect::on_radioSrcDatabase_toggled( bool checked ) { if ( checked ) { layout()->blockSignals( true ); fileGroupBox->hide(); protocolGroupBox->hide(); dbGroupBox->show(); layout()->blockSignals( false ); setConnectionTypeListPosition(); populateConnectionList(); setConnectionListPosition(); mDataSourceType = QStringLiteral( "database" ); } }
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(); mDataSourceType = "database"; } }
// Slot for deleting an existing connection void QgsSpatiaLiteSourceSelect::on_btnDelete_clicked() { QSettings settings; QString subKey = cmbConnections->currentText(); int idx = subKey.indexOf( "@" ); if ( idx > 0 ) subKey.truncate( idx ); QString key = "/SpatiaLite/connections/" + subKey; QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" ).arg( subKey ); QMessageBox::StandardButton result = QMessageBox::information( this, tr( "Confirm Delete" ), msg, QMessageBox::Ok | QMessageBox::Cancel ); if ( result != QMessageBox::Ok ) return; settings.remove( key + "/sqlitepath" ); settings.remove( key ); populateConnectionList(); }
// Slot for deleting an existing connection void SaSourceSelect::on_btnDelete_clicked() { QSettings settings; QString key = "/SQLAnywhere/connections/" + cmbConnections->currentText(); QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" ) .arg( cmbConnections->currentText() ); if ( QMessageBox::Ok != QMessageBox::information( this, tr( "Confirm Delete" ), msg, QMessageBox::Ok | QMessageBox::Cancel ) ) return; settings.remove( key + "/host" ); settings.remove( key + "/port" ); settings.remove( key + "/server" ); settings.remove( key + "/database" ); settings.remove( key + "/parameters" ); settings.remove( key + "/username" ); settings.remove( key + "/password" ); settings.remove( key + "/saveUsername" ); settings.remove( key + "/savePassword" ); settings.remove( key + "/simpleEncryption" ); settings.remove( key + "/simpleMetadata" ); settings.remove( key ); populateConnectionList(); }
void QgsWFSSourceSelect::refresh() { populateConnectionList(); }
void QgsArcGisServiceSourceSelect::refresh() { populateConnectionList(); }
void QgsOpenVectorLayerDialog::on_cmbDatabaseTypes_currentIndexChanged( const QString & text ) { populateConnectionList(); setSelectedConnectionType(); }
SaSourceSelect::SaSourceSelect( QWidget *parent, Qt::WFlags fl ) : QDialog( parent, fl ), mColumnTypeThread( NULL ) { setupUi( this ); mAddButton = new QPushButton( tr( "&Add" ) ); buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole ); connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addTables() ) ); mAddButton->setEnabled( false ); mBuildQueryButton = new QPushButton( tr( "&Build Query" ) ); buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole ); connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQuery() ) ); mBuildQueryButton->setEnabled( false ); populateConnectionList(); mSearchModeComboBox->addItem( tr( "Wildcard" ) ); mSearchModeComboBox->addItem( tr( "RegExp" ) ); mSearchColumnComboBox->addItem( tr( "All" ) ); mSearchColumnComboBox->addItem( tr( "Schema" ) ); mSearchColumnComboBox->addItem( tr( "Table" ) ); mSearchColumnComboBox->addItem( tr( "Type" ) ); mSearchColumnComboBox->addItem( tr( "SRID" ) ); mSearchColumnComboBox->addItem( tr( "Line Interpretation" ) ); mSearchColumnComboBox->addItem( tr( "Geometry column" ) ); mSearchColumnComboBox->addItem( tr( "Sql" ) ); mProxyModel.setParent( this ); mProxyModel.setFilterKeyColumn( -1 ); mProxyModel.setFilterCaseSensitivity( Qt::CaseInsensitive ); mProxyModel.setDynamicSortFilter( true ); mProxyModel.setSourceModel( &mTableModel ); mTablesTreeView->setModel( &mProxyModel ); mTablesTreeView->setSortingEnabled( true ); mTablesTreeView->setEditTriggers( QAbstractItemView::CurrentChanged ); mTablesTreeView->setItemDelegate( new SaSourceSelectDelegate( this ) ); //for Qt < 4.3.2, passing -1 to include all model columns //in search does not seem to work mSearchColumnComboBox->setCurrentIndex( 2 ); QSettings settings; restoreGeometry( settings.value( "/Windows/SaSourceSelect/geometry" ).toByteArray() ); for ( int i = 0; i < mTableModel.columnCount(); i++ ) { mTablesTreeView->setColumnWidth( i, settings.value( QString( "/Windows/SaSourceSelect/columnWidths/%1" ).arg( i ), mTablesTreeView->columnWidth( i ) ).toInt() ); } //hide the search options by default //they will be shown when the user ticks //the search options group box mSearchLabel->setVisible( false ); mSearchColumnComboBox->setVisible( false ); mSearchColumnsLabel->setVisible( false ); mSearchModeComboBox->setVisible( false ); mSearchModeLabel->setVisible( false ); mSearchTableEdit->setVisible( false ); }
QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget * parent, Qt::WindowFlags fl, bool embedded ): QDialog( parent, fl ) { setupUi( this ); QSettings settings; restoreGeometry( settings.value( "/Windows/SpatiaLiteSourceSelect/geometry" ).toByteArray() ); mHoldDialogOpen->setChecked( settings.value( "/Windows/SpatiaLiteSourceSelect/HoldDialogOpen", false ).toBool() ); setWindowTitle( tr( "Add SpatiaLite Table(s)" ) ); connectionsGroupBox->setTitle( tr( "Databases" ) ); btnEdit->hide(); // hide the edit button btnSave->hide(); btnLoad->hide(); mStatsButton = new QPushButton( tr( "&Update Statistics" ) ); connect( mStatsButton, SIGNAL( clicked() ), this, SLOT( updateStatistics() ) ); mStatsButton->setEnabled( false ); mAddButton = new QPushButton( tr( "&Add" ) ); connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addClicked() ) ); mAddButton->setEnabled( false ); mBuildQueryButton = new QPushButton( tr( "&Set Filter" ) ); connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQuery() ) ); mBuildQueryButton->setEnabled( false ); if ( embedded ) { buttonBox->button( QDialogButtonBox::Close )->hide(); } else { buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole ); buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole ); buttonBox->addButton( mStatsButton, QDialogButtonBox::ActionRole ); } populateConnectionList(); mSearchModeComboBox->addItem( tr( "Wildcard" ) ); mSearchModeComboBox->addItem( tr( "RegExp" ) ); mSearchColumnComboBox->addItem( tr( "All" ) ); mSearchColumnComboBox->addItem( tr( "Table" ) ); mSearchColumnComboBox->addItem( tr( "Type" ) ); mSearchColumnComboBox->addItem( tr( "Geometry column" ) ); mSearchColumnComboBox->addItem( tr( "Sql" ) ); mProxyModel.setParent( this ); mProxyModel.setFilterKeyColumn( -1 ); mProxyModel.setFilterCaseSensitivity( Qt::CaseInsensitive ); mProxyModel.setDynamicSortFilter( true ); mProxyModel.setSourceModel( &mTableModel ); mTablesTreeView->setModel( &mProxyModel ); mTablesTreeView->setSortingEnabled( true ); connect( mTablesTreeView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( treeWidgetSelectionChanged( const QItemSelection&, const QItemSelection& ) ) ); //for Qt < 4.3.2, passing -1 to include all model columns //in search does not seem to work mSearchColumnComboBox->setCurrentIndex( 1 ); //hide the search options by default //they will be shown when the user ticks //the search options group box mSearchLabel->setVisible( false ); mSearchColumnComboBox->setVisible( false ); mSearchColumnsLabel->setVisible( false ); mSearchModeComboBox->setVisible( false ); mSearchModeLabel->setVisible( false ); mSearchTableEdit->setVisible( false ); cbxAllowGeometrylessTables->setDisabled( true ); }