@@ -96,6 +96,11 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR
9696 cbxServerAddr->setAccessibleName ( tr ( " Server address edit box" ) );
9797 cbxServerAddr->setAccessibleDescription ( tr ( " Holds the current server address. It also stores old addresses in the combo box list." ) );
9898
99+ butDeleteServerAddr->setAccessibleName ( tr ( " Delete server address button" ) );
100+ butDeleteServerAddr->setWhatsThis ( " <b>" + tr ( " Delete Server Address" ) + " :</b> " +
101+ tr ( " Click the button to clear the currently selected server address "
102+ " and delete it from the list of stored servers." ) );
103+
99104 UpdateDirectoryComboBox ();
100105
101106 // init server address combo box (max MAX_NUM_SERVER_ADDR_ITEMS entries)
@@ -179,6 +184,9 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR
179184
180185 QObject::connect ( butConnect, &QPushButton::clicked, this , &CConnectDlg::OnConnectClicked );
181186
187+ // tool buttons
188+ QObject::connect ( butDeleteServerAddr, &QPushButton::clicked, this , &CConnectDlg::OnDeleteServerAddrClicked );
189+
182190 // timers
183191 QObject::connect ( &TimerPing, &QTimer::timeout, this , &CConnectDlg::OnTimerPing );
184192
@@ -731,6 +739,31 @@ void CConnectDlg::OnConnectClicked()
731739 done ( QDialog::Accepted );
732740}
733741
742+ void CConnectDlg::OnDeleteServerAddrClicked ()
743+ {
744+ if ( cbxServerAddr->currentText ().isEmpty () )
745+ {
746+ return ;
747+ }
748+
749+ // move later items down one
750+ for ( int iLEIdx = 0 ; iLEIdx < MAX_NUM_SERVER_ADDR_ITEMS - 1 ; iLEIdx++ )
751+ {
752+ while ( pSettings->vstrIPAddress [iLEIdx].compare ( cbxServerAddr->currentText () ) == 0 )
753+ {
754+ for ( int jLEIdx = iLEIdx + 1 ; jLEIdx < MAX_NUM_SERVER_ADDR_ITEMS; jLEIdx++ )
755+ {
756+ pSettings->vstrIPAddress [jLEIdx - 1 ] = pSettings->vstrIPAddress [jLEIdx];
757+ }
758+ }
759+ }
760+ // empty last entry
761+ pSettings->vstrIPAddress [MAX_NUM_SERVER_ADDR_ITEMS - 1 ] = QString ();
762+
763+ // redisplay to pick up updated list
764+ showEvent ( nullptr );
765+ }
766+
734767void CConnectDlg::OnTimerPing ()
735768{
736769 // send ping messages to the servers in the list
0 commit comments