Skip to content

Commit

Permalink
database source select: 'move build query' to button box
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15283 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 28, 2011
1 parent 7e4cc50 commit b183477
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
9 changes: 7 additions & 2 deletions src/app/spatialite/qgsspatialitesourceselect.cpp
Expand Up @@ -47,6 +47,11 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QgisApp * app, Qt::WFlags
connectionsGroupBox->setTitle( tr( "Databases" ) );
btnEdit->hide(); // hide the edit button

mBuildQueryButton = new QPushButton( tr( "&Build Query" ) );
buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole );
connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQuery() ) );
mBuildQueryButton->setEnabled( false );

mAddButton = new QPushButton( tr( "&Add" ) );
buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole );
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addClicked() ) );
Expand Down Expand Up @@ -101,14 +106,14 @@ void QgsSpatiaLiteSourceSelect::on_cmbConnections_activated( int )
dbChanged();
}

void QgsSpatiaLiteSourceSelect::on_btnBuildQuery_clicked()
void QgsSpatiaLiteSourceSelect::buildQuery()
{
setSql( mTablesTreeView->currentIndex() );
}

void QgsSpatiaLiteSourceSelect::on_mTablesTreeView_clicked( const QModelIndex &index )
{
btnBuildQuery->setEnabled( index.parent().isValid() );
mBuildQueryButton->setEnabled( index.parent().isValid() );
}

void QgsSpatiaLiteSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex &index )
Expand Down
3 changes: 2 additions & 1 deletion src/app/spatialite/qgsspatialitesourceselect.h
Expand Up @@ -76,10 +76,10 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
* Once connected, available layers are displayed.
*/
void on_btnConnect_clicked();
void buildQuery();
void addClicked();
//! Opens the create connection dialog to build a new connection
void on_btnNew_clicked();
void on_btnBuildQuery_clicked();
//! Deletes the selected connection
void on_btnDelete_clicked();
void on_mSearchTableEdit_textChanged( const QString & text );
Expand Down Expand Up @@ -151,6 +151,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
QgsDbFilterProxyModel mProxyModel;

QString layerURI( const QModelIndex &index );
QPushButton *mBuildQueryButton;
QPushButton *mAddButton;
};

Expand Down
7 changes: 6 additions & 1 deletion src/plugins/sqlanywhere/sasourceselect.cpp
Expand Up @@ -59,6 +59,11 @@ SaSourceSelect::SaSourceSelect( QWidget *parent, Qt::WFlags fl )
{
setupUi( this );

mBuildQueryButton = new QPushButton( tr( "&Build Query" ) );
buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole );
connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQuery() ) );
mBuildQueryButton->setEnabled( false );

mAddButton = new QPushButton( tr( "&Add" ) );
buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole );
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addTables() ) );
Expand Down Expand Up @@ -168,7 +173,7 @@ void SaSourceSelect::on_cmbConnections_activated( int )
settings.setValue( "/SQLAnywhere/connections/selected", cmbConnections->currentText() );
}

void SaSourceSelect::on_btnBuildQuery_clicked()
void SaSourceSelect::buildQuery()
{
setSql( mTablesTreeView->currentIndex() );
}
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/sqlanywhere/sasourceselect.h
Expand Up @@ -114,6 +114,7 @@ class SaSourceSelect : public QDialog, private Ui::SaSourceSelectBase
public slots:
//! Determines the tables the user selected and closes the dialog
void addTables();
void buildQuery();

/*! Connects to the database using the stored connection parameters.
* Once connected, available layers are displayed.
Expand All @@ -123,7 +124,6 @@ class SaSourceSelect : public QDialog, private Ui::SaSourceSelectBase
void on_btnNew_clicked();
//! Opens a dialog to edit an existing connection
void on_btnEdit_clicked();
void on_btnBuildQuery_clicked();
//! Deletes the selected connection
void on_btnDelete_clicked();
void on_mSearchTableEdit_textChanged( const QString & text );
Expand Down Expand Up @@ -183,6 +183,9 @@ class SaSourceSelect : public QDialog, private Ui::SaSourceSelectBase
SaDbTableModel mTableModel;
SaDbFilterProxyModel mProxyModel;

// button for building queries
QPushButton *mBuildQueryButton;

// button for adding layers
QPushButton *mAddButton;
};
Expand Down
10 changes: 0 additions & 10 deletions src/ui/qgsdbsourceselectbase.ui
Expand Up @@ -83,16 +83,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBuildQuery">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Build query</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mSearchGroupBox">
<property name="title">
Expand Down

0 comments on commit b183477

Please sign in to comment.