Skip to content
Permalink
Browse files

use messagebar to report test connection results in the Add new BD2

connection dialog

Also reduce debug noise
  • Loading branch information
alexbruy committed May 23, 2017
1 parent 9b7d389 commit 1f8d1e7fe94afd8d11897826895671a7c8810544
Showing with 24 additions and 23 deletions.
  1. +5 −6 src/providers/db2/qgsdb2newconnection.cpp
  2. +19 −17 src/ui/qgsdb2newconnectionbase.ui
@@ -50,7 +50,6 @@ QgsDb2NewConnection::QgsDb2NewConnection( QWidget *parent, const QString &connNa
txtDriver->setText( settings.value( key + "/driver" ).toString() );
txtDatabase->setText( settings.value( key + "/database" ).toString() );


if ( settings.value( key + "/saveUsername" ).toString() == QLatin1String( "true" ) )
{
txtUsername->setText( settings.value( key + "/username" ).toString() );
@@ -129,7 +128,6 @@ void QgsDb2NewConnection::accept()

void QgsDb2NewConnection::on_btnConnect_clicked()
{
QgsDebugMsg( "DB2: TestDatabase; button clicked" );
testConnection();
}

@@ -147,7 +145,7 @@ void QgsDb2NewConnection::on_cb_trustedConnection_clicked()

QgsDb2NewConnection::~QgsDb2NewConnection()
{

delete bar;
}

bool QgsDb2NewConnection::testConnection()
@@ -179,18 +177,19 @@ bool QgsDb2NewConnection::testConnection()
if ( errMsg.isEmpty() )
{
QgsDebugMsg( "connection open succeeded " + connInfo );
db2ConnectStatus -> setText( QStringLiteral( "DB2 connection open succeeded" ) );
bar->pushMessage( tr( "Connection to %1 was successful" ).arg( txtDatabase->text() ),
QgsMessageBar::INFO );
return true;
}
else
{
QgsDebugMsg( "connection open failed: " + errMsg );
db2ConnectStatus -> setText( "DB2 connection failed : " + errMsg );
bar->pushMessage( tr( "Connection failed: %1." ).arg( errMsg ),
QgsMessageBar::WARNING );
return false;
}
}

void QgsDb2NewConnection::listDatabases()
{
QgsDebugMsg( "DB2 New Connection Dialogue : list database" );
}
@@ -15,23 +15,6 @@
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="db2ConnectStatus">
<property name="text">
<string>DB2 Connect Status: </string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Connection Information</string>
@@ -196,6 +179,19 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QgsMessageBar" name="bar" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
@@ -204,6 +200,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>

0 comments on commit 1f8d1e7

Please sign in to comment.