diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 232dcfbfe9..f4437603be 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -1012,13 +1012,26 @@ void CClientSettingsDlg::OnFeedbackDetectionChanged ( int value ) { pSettings->b void CClientSettingsDlg::OnCustomDirectoriesChanged ( bool bDelete ) { - if ( bDelete && cbxCustomDirectories->currentData().isValid() ) + if ( bDelete ) { + if ( !cbxCustomDirectories->currentData().isValid() ) + { + // no selected directory to delete + return; + } // delete the selected directory pSettings->vstrDirectoryAddress[cbxCustomDirectories->currentData().toInt()] = QString(); } - else if ( !cbxCustomDirectories->currentText().isEmpty() ) + else { + + if ( cbxCustomDirectories->currentText().isEmpty() || + ( cbxCustomDirectories->currentData().isValid() && pSettings->vstrDirectoryAddress[cbxCustomDirectories->currentData().toInt()].compare ( + NetworkUtil::FixAddress ( cbxCustomDirectories->currentText() ) ) == 0 ) ) + { + // no need to add a already added directory + return; + } // store new address at the top of the list, if the list was already // full, the last element is thrown out pSettings->vstrDirectoryAddress.StringFiFoWithCompare ( NetworkUtil::FixAddress ( cbxCustomDirectories->currentText() ) ); diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index 0907ff488f..e88cb2d215 100644 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -1031,7 +1031,7 @@ - Custom Directories + Custom Directories: cbxCustomDirectories