bug fix with combo box, add flag to show that server list item was chosen

This commit is contained in:
Volker Fischer 2011-04-23 21:02:05 +00:00
parent c4818c55e0
commit 26e01e80be

View file

@ -28,9 +28,10 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f ) CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
: QDialog ( parent, f ), : QDialog ( parent, f ),
strSelectedAddress ( "" ), strSelectedAddress ( "" ),
bServerListReceived ( false ), bServerListReceived ( false ),
bCancelPressed ( false ) bCancelPressed ( false ),
bServerListItemWasChosen ( false )
{ {
setupUi ( this ); setupUi ( this );
@ -87,6 +88,7 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddresses ) void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddresses )
{ {
// load stored IP addresses in combo box // load stored IP addresses in combo box
LineEditServerAddr->clear();
for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ ) for ( int iLEIdx = 0; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; iLEIdx++ )
{ {
if ( !vstrIPAddresses[iLEIdx].isEmpty() ) if ( !vstrIPAddresses[iLEIdx].isEmpty() )
@ -100,8 +102,9 @@ void CConnectDlg::showEvent ( QShowEvent* )
{ {
// reset flags (on opening the connect dialg, we always want to request a // reset flags (on opening the connect dialg, we always want to request a
// new updated server list per definition) // new updated server list per definition)
bServerListReceived = false; bServerListReceived = false;
bCancelPressed = false; bCancelPressed = false;
bServerListItemWasChosen = false;
// clear current address // clear current address
strSelectedAddress = ""; strSelectedAddress = "";
@ -139,8 +142,12 @@ void CConnectDlg::hideEvent ( QHideEvent* )
if ( CurSelListItemList.count() > 0 ) if ( CurSelListItemList.count() > 0 )
{ {
// get host address from selected list view item as a string
strSelectedAddress = strSelectedAddress =
CurSelListItemList[0]->data ( 0, Qt::UserRole ).toString(); CurSelListItemList[0]->data ( 0, Qt::UserRole ).toString();
// set flag that a server list item was chosen to connect
bServerListItemWasChosen = true;
} }
else else
{ {