Skip to content

Commit

Permalink
use messagebar to report test connection results in the Add new Oracle
Browse files Browse the repository at this point in the history
connection dialog
  • Loading branch information
alexbruy committed May 23, 2017
1 parent 1f8d1e7 commit a49c175
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/providers/oracle/qgsoraclenewconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,23 +150,21 @@ void QgsOracleNewConnection::on_btnConnect_clicked()
if ( conn )
{
// Database successfully opened; we can now issue SQL commands.
QMessageBox::information( this,
tr( "Test connection" ),
tr( "Connection to %1 was successful" ).arg( txtDatabase->text() ) );

bar->pushMessage( tr( "Connection to %1 was successful" ).arg( txtDatabase->text() ),
QgsMessageBar::INFO );
// free connection resources
QgsOracleConnPool::instance()->releaseConnection( conn );
}
else
{
QMessageBox::information( this,
tr( "Test connection" ),
tr( "Connection failed - consult message log for details.\n\n" ) );
bar->pushMessage( tr( "Connection failed - consult message log for details." ),
QgsMessageBar::WARNING );
}
}

//! End Autoconnected SLOTS *

QgsOracleNewConnection::~QgsOracleNewConnection()
{
delete bar;
}
15 changes: 12 additions & 3 deletions src/ui/qgsoraclenewconnectionbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>513</height>
<height>529</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -41,14 +41,14 @@
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QGroupBox" name="GroupBox1">
<property name="title">
<string>Connection Information</string>
Expand Down Expand Up @@ -277,6 +277,9 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QgsMessageBar" name="bar" native="true"/>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
Expand All @@ -286,6 +289,12 @@
<extends>QLineEdit</extends>
<header>qgspasswordlineedit.h</header>
</customwidget>
<customwidget>
<class>QgsMessageBar</class>
<extends>QWidget</extends>
<header>qgsmessagebar.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>txtName</tabstop>
Expand Down

0 comments on commit a49c175

Please sign in to comment.